From 230bf3309e2621f35d8eb6fc83d3a9428a580cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 31 Dec 2006 10:43:47 +0000 Subject: [PATCH] add RSA_generate_key_ex git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19612 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/des/rsa.c | 18 +++++++++++++++++- lib/des/rsa.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/des/rsa.c b/lib/des/rsa.c index c6b108d4a..aa4bbd6bf 100644 --- a/lib/des/rsa.c +++ b/lib/des/rsa.c @@ -231,7 +231,6 @@ RSA_verify(int type, const unsigned char *from, unsigned int flen, return -1; } - /* * A NULL RSA_METHOD that returns failure for all operations. This is * used as the default RSA method is we don't have any native @@ -243,6 +242,23 @@ static RSAFUNC(null_rsa_public_decrypt, -1) static RSAFUNC(null_rsa_private_encrypt, -1) static RSAFUNC(null_rsa_private_decrypt, -1) +/* + * + */ + +int +RSA_generate_key_ex(RSA *r, int bits, BIGNUM *e, BN_GENCB *cb) +{ + if (r->meth->rsa_keygen) + return (*r->meth->rsa_keygen)(r, bits, e, cb); + return 0; +} + + +/* + * + */ + static int null_rsa_init(RSA *rsa) { diff --git a/lib/des/rsa.h b/lib/des/rsa.h index 56558128b..58f8b8759 100644 --- a/lib/des/rsa.h +++ b/lib/des/rsa.h @@ -59,6 +59,7 @@ #define RSA_private_decrypt hc_RSA_private_decrypt #define RSA_sign hc_RSA_sign #define RSA_verify hc_RSA_verify +#define RSA_generate_key_ex hc_RSA_generate_key_ex #define d2i_RSAPrivateKey hc_d2i_RSAPrivateKey #define i2d_RSAPublicKey hc_i2d_RSAPublicKey @@ -163,6 +164,8 @@ int RSA_sign(int, const unsigned char *, unsigned int, int RSA_verify(int, const unsigned char *, unsigned int, unsigned char *, unsigned int, RSA *); +int RSA_generate_key_ex(RSA *, int, BIGNUM *, BN_GENCB *); + RSA * d2i_RSAPrivateKey(RSA *, const unsigned char **, size_t); int i2d_RSAPublicKey(RSA *, unsigned char **);