diff options
Diffstat (limited to 'crypto/rsa/rsa_lib.c')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index ba277cacd8..37c0f4eba1 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -60,7 +60,7 @@ #include <openssl/crypto.h> #include "cryptlib.h" #include <openssl/lhash.h> -#include <openssl/bn.h> +#include "internal/bn_int.h" #include <openssl/rsa.h> #include <openssl/rand.h> #ifndef OPENSSL_NO_ENGINE @@ -290,27 +290,27 @@ int RSA_memory_lock(RSA *r) t[3]= &r->dmp1; t[4]= &r->dmq1; t[5]= &r->iqmp; - k=sizeof(BIGNUM)*6; + k=bn_sizeof_BIGNUM()*6; off=k/sizeof(BN_ULONG)+1; j=1; for (i=0; i<6; i++) - j+= (*t[i])->top; + j+= bn_get_top(*t[i]); if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) { RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); return(0); } + memset(p, 0, (off+j)*sizeof(BN_ULONG)); bn=(BIGNUM *)p; ul=(BN_ULONG *)&(p[off]); for (i=0; i<6; i++) { b= *(t[i]); - *(t[i])= &(bn[i]); - memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM)); - bn[i].flags=BN_FLG_STATIC_DATA; - bn[i].d=ul; - memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top); - ul+=b->top; + *(t[i])= bn_array_el(bn, i); + memcpy((char *)bn_array_el(bn, i),(char *)b,bn_sizeof_BIGNUM()); + memcpy((char *)ul,bn_get_words(b),sizeof(BN_ULONG)*bn_get_top(b)); + bn_set_static_words(bn_array_el(bn, i), ul, bn_get_top(b)); + ul+=bn_get_top(b); BN_clear_free(b); } |