diff options
| author | beck <> | 2014-04-17 13:37:50 +0000 |
|---|---|---|
| committer | beck <> | 2014-04-17 13:37:50 +0000 |
| commit | 6aa5f85bab6ba5f9189fbc3d53a12e0f6dae48dd (patch) | |
| tree | 7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libcrypto/rsa | |
| parent | 4d13fb9c7b5ac7311d7031173c21ab0121388413 (diff) | |
| download | openbsd-6aa5f85bab6ba5f9189fbc3d53a12e0f6dae48dd.tar.gz openbsd-6aa5f85bab6ba5f9189fbc3d53a12e0f6dae48dd.tar.bz2 openbsd-6aa5f85bab6ba5f9189fbc3d53a12e0f6dae48dd.zip | |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
Diffstat (limited to 'src/lib/libcrypto/rsa')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_eay.c | 16 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_oaep.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_pmeth.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_pss.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_saos.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_sign.c | 8 |
8 files changed, 38 insertions, 38 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 5a2062f903..fdd11835ad 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
| @@ -78,7 +78,7 @@ static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
| 78 | V_ASN1_NULL, NULL, penc, penclen)) | 78 | V_ASN1_NULL, NULL, penc, penclen)) |
| 79 | return 1; | 79 | return 1; |
| 80 | 80 | ||
| 81 | OPENSSL_free(penc); | 81 | free(penc); |
| 82 | return 0; | 82 | return 0; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -201,7 +201,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
| 201 | update_buflen(x->iqmp, &buf_len); | 201 | update_buflen(x->iqmp, &buf_len); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | 204 | m=(unsigned char *)malloc(buf_len+10); |
| 205 | if (m == NULL) | 205 | if (m == NULL) |
| 206 | { | 206 | { |
| 207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); | 207 | RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE); |
| @@ -248,7 +248,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
| 248 | } | 248 | } |
| 249 | ret=1; | 249 | ret=1; |
| 250 | err: | 250 | err: |
| 251 | if (m != NULL) OPENSSL_free(m); | 251 | if (m != NULL) free(m); |
| 252 | return(ret); | 252 | return(ret); |
| 253 | } | 253 | } |
| 254 | 254 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 88ee2cb557..dcf0c16a8f 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
| @@ -185,7 +185,7 @@ static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | |||
| 185 | f = BN_CTX_get(ctx); | 185 | f = BN_CTX_get(ctx); |
| 186 | ret = BN_CTX_get(ctx); | 186 | ret = BN_CTX_get(ctx); |
| 187 | num=BN_num_bytes(rsa->n); | 187 | num=BN_num_bytes(rsa->n); |
| 188 | buf = OPENSSL_malloc(num); | 188 | buf = malloc(num); |
| 189 | if (!f || !ret || !buf) | 189 | if (!f || !ret || !buf) |
| 190 | { | 190 | { |
| 191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); | 191 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); |
| @@ -247,7 +247,7 @@ err: | |||
| 247 | if (buf != NULL) | 247 | if (buf != NULL) |
| 248 | { | 248 | { |
| 249 | OPENSSL_cleanse(buf,num); | 249 | OPENSSL_cleanse(buf,num); |
| 250 | OPENSSL_free(buf); | 250 | free(buf); |
| 251 | } | 251 | } |
| 252 | return(r); | 252 | return(r); |
| 253 | } | 253 | } |
| @@ -366,7 +366,7 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
| 366 | f = BN_CTX_get(ctx); | 366 | f = BN_CTX_get(ctx); |
| 367 | ret = BN_CTX_get(ctx); | 367 | ret = BN_CTX_get(ctx); |
| 368 | num = BN_num_bytes(rsa->n); | 368 | num = BN_num_bytes(rsa->n); |
| 369 | buf = OPENSSL_malloc(num); | 369 | buf = malloc(num); |
| 370 | if(!f || !ret || !buf) | 370 | if(!f || !ret || !buf) |
| 371 | { | 371 | { |
| 372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); | 372 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE); |
| @@ -484,7 +484,7 @@ err: | |||
| 484 | if (buf != NULL) | 484 | if (buf != NULL) |
| 485 | { | 485 | { |
| 486 | OPENSSL_cleanse(buf,num); | 486 | OPENSSL_cleanse(buf,num); |
| 487 | OPENSSL_free(buf); | 487 | free(buf); |
| 488 | } | 488 | } |
| 489 | return(r); | 489 | return(r); |
| 490 | } | 490 | } |
| @@ -509,7 +509,7 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | |||
| 509 | f = BN_CTX_get(ctx); | 509 | f = BN_CTX_get(ctx); |
| 510 | ret = BN_CTX_get(ctx); | 510 | ret = BN_CTX_get(ctx); |
| 511 | num = BN_num_bytes(rsa->n); | 511 | num = BN_num_bytes(rsa->n); |
| 512 | buf = OPENSSL_malloc(num); | 512 | buf = malloc(num); |
| 513 | if(!f || !ret || !buf) | 513 | if(!f || !ret || !buf) |
| 514 | { | 514 | { |
| 515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); | 515 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE); |
| @@ -624,7 +624,7 @@ err: | |||
| 624 | if (buf != NULL) | 624 | if (buf != NULL) |
| 625 | { | 625 | { |
| 626 | OPENSSL_cleanse(buf,num); | 626 | OPENSSL_cleanse(buf,num); |
| 627 | OPENSSL_free(buf); | 627 | free(buf); |
| 628 | } | 628 | } |
| 629 | return(r); | 629 | return(r); |
| 630 | } | 630 | } |
| @@ -666,7 +666,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | |||
| 666 | f = BN_CTX_get(ctx); | 666 | f = BN_CTX_get(ctx); |
| 667 | ret = BN_CTX_get(ctx); | 667 | ret = BN_CTX_get(ctx); |
| 668 | num=BN_num_bytes(rsa->n); | 668 | num=BN_num_bytes(rsa->n); |
| 669 | buf = OPENSSL_malloc(num); | 669 | buf = malloc(num); |
| 670 | if(!f || !ret || !buf) | 670 | if(!f || !ret || !buf) |
| 671 | { | 671 | { |
| 672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); | 672 | RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE); |
| @@ -729,7 +729,7 @@ err: | |||
| 729 | if (buf != NULL) | 729 | if (buf != NULL) |
| 730 | { | 730 | { |
| 731 | OPENSSL_cleanse(buf,num); | 731 | OPENSSL_cleanse(buf,num); |
| 732 | OPENSSL_free(buf); | 732 | free(buf); |
| 733 | } | 733 | } |
| 734 | return(r); | 734 | return(r); |
| 735 | } | 735 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 9e3f7dafcd..e99a3627dc 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
| @@ -125,7 +125,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
| 125 | { | 125 | { |
| 126 | RSA *ret; | 126 | RSA *ret; |
| 127 | 127 | ||
| 128 | ret=(RSA *)OPENSSL_malloc(sizeof(RSA)); | 128 | ret=(RSA *)malloc(sizeof(RSA)); |
| 129 | if (ret == NULL) | 129 | if (ret == NULL) |
| 130 | { | 130 | { |
| 131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | 131 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); |
| @@ -139,7 +139,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
| 139 | if (!ENGINE_init(engine)) | 139 | if (!ENGINE_init(engine)) |
| 140 | { | 140 | { |
| 141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 141 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
| 142 | OPENSSL_free(ret); | 142 | free(ret); |
| 143 | return NULL; | 143 | return NULL; |
| 144 | } | 144 | } |
| 145 | ret->engine = engine; | 145 | ret->engine = engine; |
| @@ -154,7 +154,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
| 154 | RSAerr(RSA_F_RSA_NEW_METHOD, | 154 | RSAerr(RSA_F_RSA_NEW_METHOD, |
| 155 | ERR_R_ENGINE_LIB); | 155 | ERR_R_ENGINE_LIB); |
| 156 | ENGINE_finish(ret->engine); | 156 | ENGINE_finish(ret->engine); |
| 157 | OPENSSL_free(ret); | 157 | free(ret); |
| 158 | return NULL; | 158 | return NULL; |
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| @@ -184,7 +184,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
| 184 | if (ret->engine) | 184 | if (ret->engine) |
| 185 | ENGINE_finish(ret->engine); | 185 | ENGINE_finish(ret->engine); |
| 186 | #endif | 186 | #endif |
| 187 | OPENSSL_free(ret); | 187 | free(ret); |
| 188 | return(NULL); | 188 | return(NULL); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| @@ -195,7 +195,7 @@ RSA *RSA_new_method(ENGINE *engine) | |||
| 195 | ENGINE_finish(ret->engine); | 195 | ENGINE_finish(ret->engine); |
| 196 | #endif | 196 | #endif |
| 197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | 197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); |
| 198 | OPENSSL_free(ret); | 198 | free(ret); |
| 199 | ret=NULL; | 199 | ret=NULL; |
| 200 | } | 200 | } |
| 201 | return(ret); | 201 | return(ret); |
| @@ -240,7 +240,7 @@ void RSA_free(RSA *r) | |||
| 240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | 240 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); |
| 241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | 241 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); |
| 242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | 242 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); |
| 243 | OPENSSL_free(r); | 243 | free(r); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | int RSA_up_ref(RSA *r) | 246 | int RSA_up_ref(RSA *r) |
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index af4d24a56e..a107e89b81 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
| @@ -70,7 +70,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 70 | 20); | 70 | 20); |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH); | 73 | dbmask = malloc(emlen - SHA_DIGEST_LENGTH); |
| 74 | if (dbmask == NULL) | 74 | if (dbmask == NULL) |
| 75 | { | 75 | { |
| 76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 76 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
| @@ -87,7 +87,7 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 87 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
| 88 | seed[i] ^= seedmask[i]; | 88 | seed[i] ^= seedmask[i]; |
| 89 | 89 | ||
| 90 | OPENSSL_free(dbmask); | 90 | free(dbmask); |
| 91 | return 1; | 91 | return 1; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| @@ -121,7 +121,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | dblen = num - SHA_DIGEST_LENGTH; | 123 | dblen = num - SHA_DIGEST_LENGTH; |
| 124 | db = OPENSSL_malloc(dblen + num); | 124 | db = malloc(dblen + num); |
| 125 | if (db == NULL) | 125 | if (db == NULL) |
| 126 | { | 126 | { |
| 127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | 127 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); |
| @@ -172,14 +172,14 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 172 | memcpy(to, db + i, mlen); | 172 | memcpy(to, db + i, mlen); |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | OPENSSL_free(db); | 175 | free(db); |
| 176 | return mlen; | 176 | return mlen; |
| 177 | 177 | ||
| 178 | decoding_err: | 178 | decoding_err: |
| 179 | /* to avoid chosen ciphertext attacks, the error message should not reveal | 179 | /* to avoid chosen ciphertext attacks, the error message should not reveal |
| 180 | * which kind of decoding error happened */ | 180 | * which kind of decoding error happened */ |
| 181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); | 181 | RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR); |
| 182 | if (db != NULL) OPENSSL_free(db); | 182 | if (db != NULL) free(db); |
| 183 | return -1; | 183 | return -1; |
| 184 | } | 184 | } |
| 185 | 185 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index d706d35ff6..adec632b3b 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
| @@ -93,7 +93,7 @@ typedef struct | |||
| 93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) | 93 | static int pkey_rsa_init(EVP_PKEY_CTX *ctx) |
| 94 | { | 94 | { |
| 95 | RSA_PKEY_CTX *rctx; | 95 | RSA_PKEY_CTX *rctx; |
| 96 | rctx = OPENSSL_malloc(sizeof(RSA_PKEY_CTX)); | 96 | rctx = malloc(sizeof(RSA_PKEY_CTX)); |
| 97 | if (!rctx) | 97 | if (!rctx) |
| 98 | return 0; | 98 | return 0; |
| 99 | rctx->nbits = 1024; | 99 | rctx->nbits = 1024; |
| @@ -135,7 +135,7 @@ static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk) | |||
| 135 | { | 135 | { |
| 136 | if (ctx->tbuf) | 136 | if (ctx->tbuf) |
| 137 | return 1; | 137 | return 1; |
| 138 | ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey)); | 138 | ctx->tbuf = malloc(EVP_PKEY_size(pk->pkey)); |
| 139 | if (!ctx->tbuf) | 139 | if (!ctx->tbuf) |
| 140 | return 0; | 140 | return 0; |
| 141 | return 1; | 141 | return 1; |
| @@ -149,8 +149,8 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) | |||
| 149 | if (rctx->pub_exp) | 149 | if (rctx->pub_exp) |
| 150 | BN_free(rctx->pub_exp); | 150 | BN_free(rctx->pub_exp); |
| 151 | if (rctx->tbuf) | 151 | if (rctx->tbuf) |
| 152 | OPENSSL_free(rctx->tbuf); | 152 | free(rctx->tbuf); |
| 153 | OPENSSL_free(rctx); | 153 | free(rctx); |
| 154 | } | 154 | } |
| 155 | } | 155 | } |
| 156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 156 | static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c index 5f9f533d0c..75e8c18533 100644 --- a/src/lib/libcrypto/rsa/rsa_pss.c +++ b/src/lib/libcrypto/rsa/rsa_pss.c | |||
| @@ -133,7 +133,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
| 133 | } | 133 | } |
| 134 | maskedDBLen = emLen - hLen - 1; | 134 | maskedDBLen = emLen - hLen - 1; |
| 135 | H = EM + maskedDBLen; | 135 | H = EM + maskedDBLen; |
| 136 | DB = OPENSSL_malloc(maskedDBLen); | 136 | DB = malloc(maskedDBLen); |
| 137 | if (!DB) | 137 | if (!DB) |
| 138 | { | 138 | { |
| 139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); | 139 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE); |
| @@ -177,7 +177,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
| 177 | 177 | ||
| 178 | err: | 178 | err: |
| 179 | if (DB) | 179 | if (DB) |
| 180 | OPENSSL_free(DB); | 180 | free(DB); |
| 181 | EVP_MD_CTX_cleanup(&ctx); | 181 | EVP_MD_CTX_cleanup(&ctx); |
| 182 | 182 | ||
| 183 | return ret; | 183 | return ret; |
| @@ -239,7 +239,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
| 239 | } | 239 | } |
| 240 | if (sLen > 0) | 240 | if (sLen > 0) |
| 241 | { | 241 | { |
| 242 | salt = OPENSSL_malloc(sLen); | 242 | salt = malloc(sLen); |
| 243 | if (!salt) | 243 | if (!salt) |
| 244 | { | 244 | { |
| 245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); | 245 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE); |
| @@ -289,7 +289,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | |||
| 289 | 289 | ||
| 290 | err: | 290 | err: |
| 291 | if (salt) | 291 | if (salt) |
| 292 | OPENSSL_free(salt); | 292 | free(salt); |
| 293 | 293 | ||
| 294 | return ret; | 294 | return ret; |
| 295 | 295 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index f98e0a80a6..ee5473a184 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
| @@ -82,7 +82,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
| 82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); | 82 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); |
| 83 | return(0); | 83 | return(0); |
| 84 | } | 84 | } |
| 85 | s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 85 | s=(unsigned char *)malloc((unsigned int)j+1); |
| 86 | if (s == NULL) | 86 | if (s == NULL) |
| 87 | { | 87 | { |
| 88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 88 | RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
| @@ -97,7 +97,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type, | |||
| 97 | *siglen=i; | 97 | *siglen=i; |
| 98 | 98 | ||
| 99 | OPENSSL_cleanse(s,(unsigned int)j+1); | 99 | OPENSSL_cleanse(s,(unsigned int)j+1); |
| 100 | OPENSSL_free(s); | 100 | free(s); |
| 101 | return(ret); | 101 | return(ret); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| @@ -117,7 +117,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, | |||
| 117 | return(0); | 117 | return(0); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 120 | s=(unsigned char *)malloc((unsigned int)siglen); |
| 121 | if (s == NULL) | 121 | if (s == NULL) |
| 122 | { | 122 | { |
| 123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); | 123 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); |
| @@ -143,7 +143,7 @@ err: | |||
| 143 | if (s != NULL) | 143 | if (s != NULL) |
| 144 | { | 144 | { |
| 145 | OPENSSL_cleanse(s,(unsigned int)siglen); | 145 | OPENSSL_cleanse(s,(unsigned int)siglen); |
| 146 | OPENSSL_free(s); | 146 | free(s); |
| 147 | } | 147 | } |
| 148 | return(ret); | 148 | return(ret); |
| 149 | } | 149 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index fa3239ab30..71d6bb3ce4 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
| @@ -120,7 +120,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
| 120 | return(0); | 120 | return(0); |
| 121 | } | 121 | } |
| 122 | if(type != NID_md5_sha1) { | 122 | if(type != NID_md5_sha1) { |
| 123 | tmps=(unsigned char *)OPENSSL_malloc((unsigned int)j+1); | 123 | tmps=(unsigned char *)malloc((unsigned int)j+1); |
| 124 | if (tmps == NULL) | 124 | if (tmps == NULL) |
| 125 | { | 125 | { |
| 126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); | 126 | RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE); |
| @@ -138,7 +138,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
| 138 | 138 | ||
| 139 | if(type != NID_md5_sha1) { | 139 | if(type != NID_md5_sha1) { |
| 140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); | 140 | OPENSSL_cleanse(tmps,(unsigned int)j+1); |
| 141 | OPENSSL_free(tmps); | 141 | free(tmps); |
| 142 | } | 142 | } |
| 143 | return(ret); | 143 | return(ret); |
| 144 | } | 144 | } |
| @@ -169,7 +169,7 @@ int int_rsa_verify(int dtype, const unsigned char *m, | |||
| 169 | return 1; | 169 | return 1; |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 172 | s=(unsigned char *)malloc((unsigned int)siglen); |
| 173 | if (s == NULL) | 173 | if (s == NULL) |
| 174 | { | 174 | { |
| 175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); | 175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); |
| @@ -281,7 +281,7 @@ err: | |||
| 281 | if (s != NULL) | 281 | if (s != NULL) |
| 282 | { | 282 | { |
| 283 | OPENSSL_cleanse(s,(unsigned int)siglen); | 283 | OPENSSL_cleanse(s,(unsigned int)siglen); |
| 284 | OPENSSL_free(s); | 284 | free(s); |
| 285 | } | 285 | } |
| 286 | return(ret); | 286 | return(ret); |
| 287 | } | 287 | } |
