#define HASH SHA1
#endif
+#ifndef NO_SHA
#include <stdio.h>
#include <time.h>
#include "cryptlib.h"
-#include "sha.h"
-#include "bn.h"
-#include "dsa.h"
-#include "rand.h"
-
-DSA *DSA_generate_parameters(bits,seed_in,seed_len,counter_ret,h_ret,callback,
- cb_arg)
-int bits;
-unsigned char *seed_in;
-int seed_len;
-int *counter_ret;
-unsigned long *h_ret;
-void (*callback)();
-char *cb_arg;
+#include <openssl/sha.h>
+#include <openssl/bn.h>
+#include <openssl/dsa.h>
+#include <openssl/rand.h>
+
+DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
+ int *counter_ret, unsigned long *h_ret, void (*callback)(),
+ char *cb_arg)
{
int ok=0;
unsigned char seed[SHA_DIGEST_LENGTH];
/* We now need to gernerate g */
/* Set r0=(p-1)/q */
- BN_sub(test,p,BN_value_one());
- BN_div(r0,NULL,test,q,ctx);
+ BN_sub(test,p,BN_value_one());
+ BN_div(r0,NULL,test,q,ctx);
BN_set_word(test,h);
BN_MONT_CTX_set(mont,p,ctx);
return(ok?ret:NULL);
}
-int DSA_is_prime(w, callback,cb_arg)
-BIGNUM *w;
-void (*callback)();
-char *cb_arg;
+int DSA_is_prime(BIGNUM *w, void (*callback)(), char *cb_arg)
{
int ok= -1,j,i,n;
BN_CTX *ctx=NULL,*ctx2=NULL;
if (ok == -1) DSAerr(DSA_F_DSA_IS_PRIME,ERR_R_BN_LIB);
BN_CTX_free(ctx);
BN_CTX_free(ctx2);
+ BN_MONT_CTX_free(mont);
return(ok);
}
-
+#endif