Small bug fixes.
authorRichard Levitte <levitte@openssl.org>
Tue, 20 Apr 2004 10:26:13 +0000 (10:26 +0000)
committerRichard Levitte <levitte@openssl.org>
Tue, 20 Apr 2004 10:26:13 +0000 (10:26 +0000)
Move the declaration of FIPS_allow_md5() from fips_locl.h to fips.h.
Consequently, util/mkdef.pl doesn't need to look at fips_locl.h any
more.

apps/openssl.c
fips/fips.c
fips/fips.h
fips/fips_locl.h
util/mkdef.pl

index 697748c16c95152545a35d66e47cfaac91f9c827..c31a04bb6babaf28dccd648c9ebd5fcdce874e97 100644 (file)
@@ -233,11 +233,21 @@ int main(int Argc, char *Argv[])
        arg.count=0;
 
 #ifdef OPENSSL_FIPS
-       if(getenv("OPENSSL_FIPS") && !FIPS_mode_set(1,Argv[0]))
-               {
+       if(getenv("OPENSSL_FIPS")) {
+#if defined(_WIN32)
+               char filename[MAX_PATH] = "";
+               GetModuleFileName( NULL, filename, MAX_PATH) ;
+               p = filename;
+#else
+               p = Argv[0];
+#endif
+               if (!FIPS_mode_set(1,p)) {
                ERR_load_crypto_strings();
                ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
                exit(1);
+                       }
+               if (getenv("OPENSSL_FIPS_MD5"))
+                       FIPS_allow_md5(1);
                }
 #endif
        if (bio_err == NULL)
index 30bb5fba4849b94fd2a71bf333ab914e3fb4a9d2..912bb9d1f771d18a788a92813790b7ce97ba098c 100644 (file)
@@ -111,7 +111,7 @@ static int FIPS_check_exe(const char *path)
     f=fopen(p2,"rb");
     if(!f || fread(buf,1,20,f) != 20)
        {
-       fclose(f);
+       if (f) fclose(f);
        FIPSerr(FIPS_F_FIPS_CHECK_EXE,FIPS_R_CANNOT_READ_EXE_DIGEST);
        return 0;
        }
index c7f9c5c6dc5230b5fbdc9f915288e9556be46c1c..e169ebf43e713ac2c7158c16560b06da515f9f51 100644 (file)
@@ -64,6 +64,7 @@ extern void *FIPS_rand_check;
 struct dsa_st;
 
 int FIPS_mode_set(int onoff,const char *path);
+void FIPS_allow_md5(int onoff);
 int FIPS_dsa_check(struct dsa_st *dsa);
 void FIPS_corrupt_sha1(void);
 int FIPS_selftest_sha1(void);
index 0b3fecb39d370d71c9d96228af9c309548ec00b6..501fc756f30163b209e040283828602b9b52af15 100644 (file)
@@ -54,7 +54,6 @@ extern "C" {
 #endif
 
 /* FIPS 140 allows MD5 to be used during certain parts of TLS */
-void FIPS_allow_md5(int onoff);
 extern int FIPS_md5_allowed;
 
 #ifdef  __cplusplus
index c4cdce6c568a44bc3b7c58c785a76024a8ae8c71..443d74d4481a1d2b9f9623ceeabeaf8047c91143 100755 (executable)
@@ -267,7 +267,7 @@ $crypto.=" crypto/ocsp/ocsp.h";
 $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
 $crypto.=" crypto/krb5/krb5_asn.h";
 $crypto.=" crypto/tmdiff.h";
-$crypto.=" fips/fips.h fips/fips_locl.h fips/rand/fips_rand.h";
+$crypto.=" fips/fips.h fips/rand/fips_rand.h";
 
 my $symhacks="crypto/symhacks.h";