summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c26
-rw-r--r--src/lib/libssl/src/crypto/bn/bn_lib.c26
2 files changed, 18 insertions, 34 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
228void BN_free(BIGNUM *a) 228void
229 { 229BN_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
245void BN_init(BIGNUM *a) 234void 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 }
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c
index 6ec9282653..7ae14ee4d0 100644
--- a/src/lib/libssl/src/crypto/bn/bn_lib.c
+++ b/src/lib/libssl/src/crypto/bn/bn_lib.c
@@ -225,22 +225,11 @@ void BN_clear_free(BIGNUM *a)
225 free(a); 225 free(a);
226 } 226 }
227 227
228void BN_free(BIGNUM *a) 228void
229 { 229BN_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
245void BN_init(BIGNUM *a) 234void 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 }