diff -ruN origin/lib/rsa/rsa-sign.c ok/lib/rsa/rsa-sign.c --- origin/lib/rsa/rsa-sign.c 2018-07-02 13:44:23.368200000 +0800 +++ ok/lib/rsa/rsa-sign.c 2018-07-02 13:49:21.079383927 +0800 @@ -229,7 +229,8 @@ ret = rsa_err("Could not obtain signature"); goto err_sign; } - EVP_MD_CTX_cleanup(context); + + EVP_MD_CTX_reset(context); EVP_MD_CTX_destroy(context); EVP_PKEY_free(key); @@ -319,24 +320,25 @@ int ret; BIGNUM *bn_te; uint64_t te; + const BIGNUM *rsa_e; ret = -EINVAL; bn_te = NULL; if (!e) goto cleanup; - - if (BN_num_bits(key->e) > 64) + RSA_get0_key(key, NULL, &rsa_e, NULL); + if (BN_num_bits(rsa_e) > 64) goto cleanup; - *e = BN_get_word(key->e); + *e = BN_get_word(rsa_e); - if (BN_num_bits(key->e) < 33) { + if (BN_num_bits(rsa_e) < 33) { ret = 0; goto cleanup; } - bn_te = BN_dup(key->e); + bn_te = BN_dup(rsa_e); if (!bn_te) goto cleanup; @@ -367,6 +369,7 @@ BIGNUM *big1, *big2, *big64, *big2_64; BIGNUM *n0, *n, *r, *r_squared, *tmp; BN_CTX *bn_ctx = BN_CTX_new(); + const BIGNUM *rsa_n; int ret = 0; /* Initialize BIGNUMs */ @@ -388,7 +391,8 @@ if (0 != rsa_get_exponent(key, exponent)) ret = -1; - if (!BN_copy(n, key->n) || !BN_set_word(big1, 1L) || + RSA_get0_key(key, &rsa_n, NULL, NULL); + if (!BN_copy(n, rsa_n) || !BN_set_word(big1, 1L) || !BN_set_word(big2, 2L) || !BN_set_word(big64, 64L)) ret = -1;