| OLD | NEW | 
|---|
| 1 /* crypto/engine/hw_cswift.c */ | 1 /* crypto/engine/hw_cswift.c */ | 
| 2 /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | 2 /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | 
| 3  * project 2000. | 3  * project 2000. | 
| 4  */ | 4  */ | 
| 5 /* ==================================================================== | 5 /* ==================================================================== | 
| 6  * Copyright (c) 1999-2001 The OpenSSL Project.  All rights reserved. | 6  * Copyright (c) 1999-2001 The OpenSSL Project.  All rights reserved. | 
| 7  * | 7  * | 
| 8  * Redistribution and use in source and binary forms, with or without | 8  * Redistribution and use in source and binary forms, with or without | 
| 9  * modification, are permitted provided that the following conditions | 9  * modification, are permitted provided that the following conditions | 
| 10  * are met: | 10  * are met: | 
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 804         } | 804         } | 
| 805 #endif  /* OPENSSL_NO_RSA */ | 805 #endif  /* OPENSSL_NO_RSA */ | 
| 806 | 806 | 
| 807 #ifndef OPENSSL_NO_DSA | 807 #ifndef OPENSSL_NO_DSA | 
| 808 static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 808 static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 
| 809         { | 809         { | 
| 810         SW_CONTEXT_HANDLE hac; | 810         SW_CONTEXT_HANDLE hac; | 
| 811         SW_PARAM sw_param; | 811         SW_PARAM sw_param; | 
| 812         SW_STATUS sw_status; | 812         SW_STATUS sw_status; | 
| 813         SW_LARGENUMBER arg, res; | 813         SW_LARGENUMBER arg, res; | 
| 814         unsigned char *ptr; |  | 
| 815         BN_CTX *ctx; | 814         BN_CTX *ctx; | 
| 816         BIGNUM *dsa_p = NULL; | 815         BIGNUM *dsa_p = NULL; | 
| 817         BIGNUM *dsa_q = NULL; | 816         BIGNUM *dsa_q = NULL; | 
| 818         BIGNUM *dsa_g = NULL; | 817         BIGNUM *dsa_g = NULL; | 
| 819         BIGNUM *dsa_key = NULL; | 818         BIGNUM *dsa_key = NULL; | 
| 820         BIGNUM *result = NULL; | 819         BIGNUM *result = NULL; | 
| 821         DSA_SIG *to_return = NULL; | 820         DSA_SIG *to_return = NULL; | 
| 822         int acquired = 0; | 821         int acquired = 0; | 
| 823 | 822 | 
| 824         if((ctx = BN_CTX_new()) == NULL) | 823         if((ctx = BN_CTX_new()) == NULL) | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 892                 &res, 1); | 891                 &res, 1); | 
| 893         if(sw_status != SW_OK) | 892         if(sw_status != SW_OK) | 
| 894                 { | 893                 { | 
| 895                 char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | 894                 char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | 
| 896                 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED); | 895                 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED); | 
| 897                 sprintf(tmpbuf, "%ld", sw_status); | 896                 sprintf(tmpbuf, "%ld", sw_status); | 
| 898                 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | 897                 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | 
| 899                 goto err; | 898                 goto err; | 
| 900                 } | 899                 } | 
| 901         /* Convert the response */ | 900         /* Convert the response */ | 
| 902         ptr = (unsigned char *)result->d; |  | 
| 903         if((to_return = DSA_SIG_new()) == NULL) | 901         if((to_return = DSA_SIG_new()) == NULL) | 
| 904                 goto err; | 902                 goto err; | 
| 905         to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL); | 903         to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL); | 
| 906         to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL); | 904         to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL); | 
| 907 | 905 | 
| 908 err: | 906 err: | 
| 909         if(acquired) | 907         if(acquired) | 
| 910                 release_context(hac); | 908                 release_context(hac); | 
| 911         if(ctx) | 909         if(ctx) | 
| 912                 { | 910                 { | 
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1122         if(!bind_helper(e)) | 1120         if(!bind_helper(e)) | 
| 1123                 return 0; | 1121                 return 0; | 
| 1124         return 1; | 1122         return 1; | 
| 1125         } | 1123         } | 
| 1126 IMPLEMENT_DYNAMIC_CHECK_FN() | 1124 IMPLEMENT_DYNAMIC_CHECK_FN() | 
| 1127 IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | 1125 IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | 
| 1128 #endif /* OPENSSL_NO_DYNAMIC_ENGINE */ | 1126 #endif /* OPENSSL_NO_DYNAMIC_ENGINE */ | 
| 1129 | 1127 | 
| 1130 #endif /* !OPENSSL_NO_HW_CSWIFT */ | 1128 #endif /* !OPENSSL_NO_HW_CSWIFT */ | 
| 1131 #endif /* !OPENSSL_NO_HW */ | 1129 #endif /* !OPENSSL_NO_HW */ | 
| OLD | NEW | 
|---|