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.
if (a == NULL) return;
bn_check_top(a);
- if (a->d != NULL)
+ if (a->d != NULL && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
{
OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
- if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- free(a->d);
+ free(a->d);
}
i=BN_get_flags(a,BN_FLG_MALLOCED);
OPENSSL_cleanse(a,sizeof(BIGNUM));
if (a == NULL) return;
bn_check_top(a);
- if (a->d != NULL)
+ if (a->d != NULL && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
{
OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
- if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- free(a->d);
+ free(a->d);
}
i=BN_get_flags(a,BN_FLG_MALLOCED);
OPENSSL_cleanse(a,sizeof(BIGNUM));