summaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2014-08-14 16:47:13 -0400
committerRich Salz <rsalz@openssl.org>2014-09-08 11:11:49 -0400
commit2afb29b480d87c4c24f830e69dfe82762e3db608 (patch)
tree25bac5a5fdc21fc75def7c071517eb61e1e0043e /crypto/rsa
parentbe0bd11d698677bb7dde14cde73af098da94da18 (diff)
RT992: RSA_check_key should have a callback arg
The original RT request included a patch. By the time we got around to doing it, however, the callback scheme had changed. So I wrote a new function RSA_check_key_ex() that uses the BN_GENCB callback. But thanks very much to Vinet Sharma <vineet.sharma@gmail.com> for the initial implementation. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa.h1
-rw-r--r--crypto/rsa/rsa_chk.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h
index 543deaf572..d74719f57e 100644
--- a/crypto/rsa/rsa.h
+++ b/crypto/rsa/rsa.h
@@ -325,6 +325,7 @@ int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2,
int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb);
int RSA_check_key(const RSA *);
+int RSA_check_key_ex(const RSA *, BN_GENCB *cb);
/* next 4 return -1 on error */
int RSA_public_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa,int padding);
diff --git a/crypto/rsa/rsa_chk.c b/crypto/rsa/rsa_chk.c
index cc30e77132..a351e6dee4 100644
--- a/crypto/rsa/rsa_chk.c
+++ b/crypto/rsa/rsa_chk.c
@@ -55,6 +55,11 @@
int RSA_check_key(const RSA *key)
{
+ return RSA_check_key_ex(key, NULL);
+ }
+
+int RSA_check_key_ex(const RSA *key, BN_GENCB *cb)
+ {
BIGNUM *i, *j, *k, *l, *m;
BN_CTX *ctx;
int r;
@@ -81,7 +86,7 @@ int RSA_check_key(const RSA *key)
}
/* p prime? */
- r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL);
+ r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb);
if (r != 1)
{
ret = r;
@@ -91,7 +96,7 @@ int RSA_check_key(const RSA *key)
}
/* q prime? */
- r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, NULL);
+ r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb);
if (r != 1)
{
ret = r;