Commit 6f4a6a5c authored by Rich Salz's avatar Rich Salz
Browse files

RT4586: Remove RSA_memory_lock; unused, not needed



Reviewed-by: default avatarBen Laurie <ben@openssl.org>
parent 56add338
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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"},
+0 −44
Original line number Diff line number Diff line
@@ -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);
+0 −4
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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