diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 6ec9282653..7ae14ee4d0 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -225,22 +225,11 @@ void BN_clear_free(BIGNUM *a) | |||
| 225 | free(a); | 225 | free(a); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | void BN_free(BIGNUM *a) | 228 | void |
| 229 | { | 229 | BN_free(BIGNUM *a) |
| 230 | if (a == NULL) return; | 230 | { |
| 231 | bn_check_top(a); | 231 | BN_clear_free(a); |
| 232 | if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 232 | } |
| 233 | free(a->d); | ||
| 234 | if (a->flags & BN_FLG_MALLOCED) | ||
| 235 | free(a); | ||
| 236 | else | ||
| 237 | { | ||
| 238 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 239 | a->flags|=BN_FLG_FREE; | ||
| 240 | #endif | ||
| 241 | a->d = NULL; | ||
| 242 | } | ||
| 243 | } | ||
| 244 | 233 | ||
| 245 | void BN_init(BIGNUM *a) | 234 | void BN_init(BIGNUM *a) |
| 246 | { | 235 | { |
| @@ -399,7 +388,10 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) | |||
| 399 | { | 388 | { |
| 400 | BN_ULONG *a = bn_expand_internal(b, words); | 389 | BN_ULONG *a = bn_expand_internal(b, words); |
| 401 | if(!a) return NULL; | 390 | if(!a) return NULL; |
| 402 | if(b->d) free(b->d); | 391 | if(b->d) { |
| 392 | OPENSSL_cleanse(b->d, b->dmax * sizeof(b->d[0])); | ||
| 393 | free(b->d); | ||
| 394 | } | ||
| 403 | b->d=a; | 395 | b->d=a; |
| 404 | b->dmax=words; | 396 | b->dmax=words; |
| 405 | } | 397 | } |
