Rename lst1 to list1 to avoid name conflict on some platforms.
[openssl.git] / crypto / dsa / dsa_gen.c
index 8202b80292ab32fe6c679ff33eed5f841615a264..b5e5ec06e5e49750cc233b5b5580826a32af195d 100644 (file)
 #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];
@@ -217,8 +212,8 @@ end:
 
        /* 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);
@@ -255,10 +250,7 @@ err:
        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;
@@ -334,7 +326,8 @@ err:
        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