From 6f4a6a5cd472d56937a8e9d6665e7c9cc6b1b2e2 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 24 Jun 2016 09:49:51 -0400 Subject: [PATCH] RT4586: Remove RSA_memory_lock; unused, not needed Reviewed-by: Ben Laurie --- crypto/rsa/rsa_err.c | 1 - crypto/rsa/rsa_lib.c | 44 ------------------------------------------- include/openssl/rsa.h | 4 ---- util/libcrypto.num | 1 - 4 files changed, 50 deletions(-) diff --git a/crypto/rsa/rsa_err.c b/crypto/rsa/rsa_err.c index a92ea5d026..0bde045583 100644 --- a/crypto/rsa/rsa_err.c +++ b/crypto/rsa/rsa_err.c @@ -32,7 +32,6 @@ static ERR_STRING_DATA RSA_str_functs[] = { {ERR_FUNC(RSA_F_RSA_CHECK_KEY_EX), "RSA_check_key_ex"}, {ERR_FUNC(RSA_F_RSA_CMS_DECRYPT), "rsa_cms_decrypt"}, {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "rsa_item_verify"}, - {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"}, {ERR_FUNC(RSA_F_RSA_METH_DUP), "RSA_meth_dup"}, {ERR_FUNC(RSA_F_RSA_METH_NEW), "RSA_meth_new"}, {ERR_FUNC(RSA_F_RSA_METH_SET1_NAME), "RSA_meth_set1_name"}, diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 9ba86d856a..14750d177e 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -180,50 +180,6 @@ void *RSA_get_ex_data(const RSA *r, int idx) return (CRYPTO_get_ex_data(&r->ex_data, idx)); } -int RSA_memory_lock(RSA *r) -{ - int i, j, k, off; - char *p; - BIGNUM *bn, **t[6], *b; - BN_ULONG *ul; - - if (r->d == NULL) - return (1); - t[0] = &r->d; - t[1] = &r->p; - t[2] = &r->q; - t[3] = &r->dmp1; - t[4] = &r->dmq1; - t[5] = &r->iqmp; - k = bn_sizeof_BIGNUM() * 6; - off = k / sizeof(BN_ULONG) + 1; - j = 1; - for (i = 0; i < 6; i++) - j += bn_get_top(*t[i]); - if ((p = OPENSSL_malloc((off + j) * sizeof(*p))) == NULL) { - RSAerr(RSA_F_RSA_MEMORY_LOCK, ERR_R_MALLOC_FAILURE); - return (0); - } - memset(p, 0, sizeof(*p) * (off + j)); - bn = (BIGNUM *)p; - ul = (BN_ULONG *)&(p[off]); - for (i = 0; i < 6; i++) { - b = *(t[i]); - *(t[i]) = bn_array_el(bn, i); - memcpy(bn_array_el(bn, i), b, bn_sizeof_BIGNUM()); - memcpy(ul, bn_get_words(b), sizeof(*ul) * 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); - } - - /* I should fix this so it can still be done */ - r->flags &= ~(RSA_FLAG_CACHE_PRIVATE | RSA_FLAG_CACHE_PUBLIC); - - r->bignum_data = p; - return (1); -} - int RSA_security_bits(const RSA *rsa) { return BN_security_bits(BN_num_bits(rsa->n), -1); diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h index 70d3755124..cd173856c4 100644 --- a/include/openssl/rsa.h +++ b/include/openssl/rsa.h @@ -226,9 +226,6 @@ const RSA_METHOD *RSA_get_default_method(void); const RSA_METHOD *RSA_get_method(const RSA *rsa); int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); -/* This function needs the memory locking malloc callbacks to be installed */ -int RSA_memory_lock(RSA *r); - /* these are the actual RSA functions */ const RSA_METHOD *RSA_PKCS1_OpenSSL(void); @@ -477,7 +474,6 @@ void ERR_load_RSA_strings(void); # define RSA_F_RSA_CHECK_KEY_EX 160 # define RSA_F_RSA_CMS_DECRYPT 159 # define RSA_F_RSA_ITEM_VERIFY 148 -# define RSA_F_RSA_MEMORY_LOCK 130 # define RSA_F_RSA_METH_DUP 161 # define RSA_F_RSA_METH_NEW 162 # define RSA_F_RSA_METH_SET1_NAME 163 diff --git a/util/libcrypto.num b/util/libcrypto.num index fc118b19bb..e9966eba87 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -1396,7 +1396,6 @@ SCT_set_timestamp 1380 1_1_0 EXIST::FUNCTION:CT UI_new 1381 1_1_0 EXIST::FUNCTION:UI TS_REQ_get_msg_imprint 1382 1_1_0 EXIST::FUNCTION:TS i2d_PKCS12_BAGS 1383 1_1_0 EXIST::FUNCTION: -RSA_memory_lock 1384 1_1_0 EXIST::FUNCTION:RSA CERTIFICATEPOLICIES_free 1385 1_1_0 EXIST::FUNCTION: X509V3_get_section 1386 1_1_0 EXIST::FUNCTION: BIO_parse_hostserv 1387 1_1_0 EXIST::FUNCTION:SOCK -- 2.25.1