diff options
| author | tedu <> | 2014-05-07 21:06:05 +0000 |
|---|---|---|
| committer | tedu <> | 2014-05-07 21:06:05 +0000 |
| commit | 38032d526b500060215164962909684100dc4bdc (patch) | |
| tree | 12cd88c23032ad7586ab59e31ffae76e6118e809 /src/lib/libc | |
| parent | d4f5f3aa4283881df0366f88a495f1c26c1867cb (diff) | |
| download | openbsd-38032d526b500060215164962909684100dc4bdc.tar.gz openbsd-38032d526b500060215164962909684100dc4bdc.tar.bz2 openbsd-38032d526b500060215164962909684100dc4bdc.zip | |
in BN_clear_free, don't cleanse the data if the static data flag is set.
much debugging work done by otto. ok miod otto.
side note: BN_FLG_STATIC_DATA doesn't actually mean the data is static.
it's also used to indicate the data may be secretly shared behind your back
as a sort of poor man's refcounting, but without the refcounting.
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 9787a31dbb..6ec9282653 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -214,11 +214,10 @@ void BN_clear_free(BIGNUM *a) | |||
| 214 | 214 | ||
| 215 | if (a == NULL) return; | 215 | if (a == NULL) return; |
| 216 | bn_check_top(a); | 216 | bn_check_top(a); |
| 217 | if (a->d != NULL) | 217 | if (a->d != NULL && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) |
| 218 | { | 218 | { |
| 219 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); | 219 | OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0])); |
| 220 | if (!(BN_get_flags(a,BN_FLG_STATIC_DATA))) | 220 | free(a->d); |
| 221 | free(a->d); | ||
| 222 | } | 221 | } |
| 223 | i=BN_get_flags(a,BN_FLG_MALLOCED); | 222 | i=BN_get_flags(a,BN_FLG_MALLOCED); |
| 224 | OPENSSL_cleanse(a,sizeof(BIGNUM)); | 223 | OPENSSL_cleanse(a,sizeof(BIGNUM)); |
