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/rsa_oaep.c | |
| 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/rsa_oaep.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_oaep.c | 10 |
1 files changed, 5 insertions, 5 deletions
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 | ||
