summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_gen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dh_gen.c')
-rw-r--r--src/lib/libcrypto/dh/dh_gen.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c
index 04c7046a7b..b7bcd2c7a4 100644
--- a/src/lib/libcrypto/dh/dh_gen.c
+++ b/src/lib/libcrypto/dh/dh_gen.c
@@ -58,8 +58,8 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "dh.h" 62#include <openssl/dh.h>
63 63
64/* We generate DH parameters as follows 64/* We generate DH parameters as follows
65 * find a prime q which is prime_len/2 bits long. 65 * find a prime q which is prime_len/2 bits long.
@@ -83,11 +83,8 @@
83 * this generator function can take a very very long time to run. 83 * this generator function can take a very very long time to run.
84 */ 84 */
85 85
86DH *DH_generate_parameters(prime_len,generator,callback,cb_arg) 86DH *DH_generate_parameters(int prime_len, int generator,
87int prime_len; 87 void (*callback)(int,int,void *), void *cb_arg)
88int generator;
89void (*callback)(P_I_I_P);
90char *cb_arg;
91 { 88 {
92 BIGNUM *p=NULL,*t1,*t2; 89 BIGNUM *p=NULL,*t1,*t2;
93 DH *ret=NULL; 90 DH *ret=NULL;
@@ -95,10 +92,11 @@ char *cb_arg;
95 BN_CTX *ctx=NULL; 92 BN_CTX *ctx=NULL;
96 93
97 ret=DH_new(); 94 ret=DH_new();
95 if (ret == NULL) goto err;
98 ctx=BN_CTX_new(); 96 ctx=BN_CTX_new();
99 if (ctx == NULL) goto err; 97 if (ctx == NULL) goto err;
100 t1=ctx->bn[0]; 98 t1= &(ctx->bn[0]);
101 t2=ctx->bn[1]; 99 t2= &(ctx->bn[1]);
102 ctx->tos=2; 100 ctx->tos=2;
103 101
104 if (generator == DH_GENERATOR_2) 102 if (generator == DH_GENERATOR_2)
@@ -126,7 +124,7 @@ char *cb_arg;
126 else 124 else
127 g=generator; 125 g=generator;
128 126
129 p=BN_generate_prime(prime_len,1,t1,t2,callback,cb_arg); 127 p=BN_generate_prime(NULL,prime_len,1,t1,t2,callback,cb_arg);
130 if (p == NULL) goto err; 128 if (p == NULL) goto err;
131 if (callback != NULL) callback(3,0,cb_arg); 129 if (callback != NULL) callback(3,0,cb_arg);
132 ret->p=p; 130 ret->p=p;