Really add the EVP and all of the DES changes.
[openssl.git] / crypto / dsa / dsa_gen.c
index 2294a362d9954419cf92bd3d4176ce33ce8210d0..0dc00191ab8d1832428e4ddad6692723a96d4c1e 100644 (file)
 #ifdef GENUINE_DSA
 /* Parameter generation follows the original release of FIPS PUB 186,
  * Appendix 2.2 (i.e. use SHA as defined in FIPS PUB 180) */
-#define HASH    SHA
+#define HASH    EVP_sha()
 #else
 /* Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
  * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in
  * FIPS PUB 180-1) */
-#define HASH    SHA1
+#define HASH    EVP_sha1()
 #endif 
 
-#ifndef NO_SHA
+#ifndef OPENSSL_NO_SHA
 
 #include <stdio.h>
 #include <time.h>
 #include "cryptlib.h"
-#include <openssl/sha.h>
+#include <openssl/evp.h>
 #include <openssl/bn.h>
 #include <openssl/dsa.h>
 #include <openssl/rand.h>
+#include <openssl/sha.h>
 
-DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
+DSA *DSA_generate_parameters(int bits,
+               unsigned char *seed_in, int seed_len,
                int *counter_ret, unsigned long *h_ret,
                void (*callback)(int, int, void *),
                void *cb_arg)
@@ -157,8 +159,8 @@ DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
                                }
 
                        /* step 2 */
-                       HASH(seed,SHA_DIGEST_LENGTH,md);
-                       HASH(buf,SHA_DIGEST_LENGTH,buf2);
+                       EVP_Digest(seed,SHA_DIGEST_LENGTH,md,NULL,HASH);
+                       EVP_Digest(buf,SHA_DIGEST_LENGTH,buf2,NULL,HASH);
                        for (i=0; i<SHA_DIGEST_LENGTH; i++)
                                md[i]^=buf2[i];
 
@@ -205,7 +207,7 @@ DSA *DSA_generate_parameters(int bits, unsigned char *seed_in, int seed_len,
                                        if (buf[i] != 0) break;
                                        }
 
-                               HASH(buf,SHA_DIGEST_LENGTH,md);
+                               EVP_Digest(buf,SHA_DIGEST_LENGTH,md,NULL,HASH);
 
                                /* step 8 */
                                if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0))