aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dh/dh_gen.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-01-15 02:01:55 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-01-15 02:01:55 +0000
commit0e4aa0d2d2807e0cbeac29b65d2b9061daed8941 (patch)
treecec435e2a3ce007d0b1a7be92c4cf12cdc4bd1a5 /crypto/dh/dh_gen.c
parent08cb96bba2831a8fc3dbda697ab65d64bb05a371 (diff)
downloadopenssl-0e4aa0d2d2807e0cbeac29b65d2b9061daed8941.tar.gz
As with RSA, which was modified recently, this change makes it possible to
override key-generation implementations by placing handlers in the methods for DSA and DH. Also, parameter generation for DSA and DH is possible by another new handler for each method.
Diffstat (limited to 'crypto/dh/dh_gen.c')
-rw-r--r--crypto/dh/dh_gen.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c
index a929a0f064..1f805073cf 100644
--- a/crypto/dh/dh_gen.c
+++ b/crypto/dh/dh_gen.c
@@ -66,6 +66,15 @@
#include <openssl/bn.h>
#include <openssl/dh.h>
+static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb);
+
+int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb)
+ {
+ if(ret->meth->generate_params)
+ return ret->meth->generate_params(ret, prime_len, generator, cb);
+ return dh_builtin_genparams(ret, prime_len, generator, cb);
+ }
+
/* We generate DH parameters as follows
* find a prime q which is prime_len/2 bits long.
* p=(2*q)+1 or (p-1)/2 = q
@@ -91,7 +100,7 @@
* It's just as OK (and in some sense better) to use a generator of the
* order-q subgroup.
*/
-int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb)
+static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb)
{
BIGNUM *t1,*t2;
int g,ok= -1;