Tidy up an error code.
authorAndy Polyakov <appro@openssl.org>
Tue, 10 May 2005 22:57:21 +0000 (22:57 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 10 May 2005 22:57:21 +0000 (22:57 +0000)
fips/Makefile
fips/fips.h
fips/fips_err.h
fips/fipshashes.c
fips/hmac/Makefile
fips/hmac/fips_hmac_selftest.c
fips/rand/Makefile
fips/rsa/Makefile
fips/rsa/fips_rsa_selftest.c
fips/sha1/fips_sha1_selftest.c

index be3ab1e296d85935a4b9a7f66fdf489e3084d156..d1d4561e01e486012efdefdd12b0d8a9e28b6974 100644 (file)
@@ -115,7 +115,7 @@ fips_test_suite: fips_test_suite.o $(TOP)/libcrypto.a
 
 fips_test: top top_fips_test_suite
        cd testvectors && perl -p -i -e 's/COUNT=/COUNT = /' des[23]/req/*.req
-       @for i in dsa sha1 aes des ; \
+       @for i in dsa sha1 aes des hmac rand rsa; \
        do \
                (cd $$i && echo "making fips_test in fips/$$i..." && $(MAKE) fips_test) \
        done;
index d76b0de95562da8ef568d7e136d198267323b97b..b1621b7de96f5ff94cceca1669292bdea2b4b660 100644 (file)
@@ -72,6 +72,7 @@ void FIPS_corrupt_rsa(void);
 int FIPS_selftest_rsa(void);
 void FIPS_corrupt_dsa(void);
 int FIPS_selftest_dsa(void);
+void FIPS_corrupt_rng(void);
 int FIPS_selftest_rng(void);
 int FIPS_selftest_hmac(void);
 
@@ -103,7 +104,7 @@ void ERR_load_FIPS_strings(void);
 #define FIPS_F_FIPS_SELFTEST_DSA                        109
 #define FIPS_F_FIPS_SELFTEST_RNG                        118
 #define FIPS_F_FIPS_SELFTEST_RSA                        108
-#define FIPS_F_FIPS_SELFTEST_SHA1                       103
+#define FIPS_F_FIPS_SELFTEST_SHA                        103
 #define FIPS_F_HASH_FINAL                               100
 #define FIPS_F_RSA_EAY_PUBLIC_ENCRYPT                   114
 #define FIPS_F_RSA_GENERATE_KEY                                 113
index aa70f22fcb69380a423551a4c3438929eb680422..779787f35e5373c2e9dd9c282c182c70b88e1e9e 100644 (file)
@@ -84,7 +84,7 @@ static ERR_STRING_DATA FIPS_str_functs[]=
 {ERR_FUNC(FIPS_F_FIPS_SELFTEST_DSA),   "FIPS_selftest_dsa"},
 {ERR_FUNC(FIPS_F_FIPS_SELFTEST_RNG),   "FIPS_selftest_rng"},
 {ERR_FUNC(FIPS_F_FIPS_SELFTEST_RSA),   "FIPS_selftest_rsa"},
-{ERR_FUNC(FIPS_F_FIPS_SELFTEST_SHA1),  "FIPS_selftest_sha1"},
+{ERR_FUNC(FIPS_F_FIPS_SELFTEST_SHA),   "FIPS_selftest_sha"},
 {ERR_FUNC(FIPS_F_HASH_FINAL),  "HASH_FINAL"},
 {ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_ENCRYPT),      "RSA_EAY_PUBLIC_ENCRYPT"},
 {ERR_FUNC(FIPS_F_RSA_GENERATE_KEY),    "RSA_generate_key"},
index c817e8a9bc6f34596b4235585e2e430b5cc0dc83..1dc78609693d33e2e1f00a182d7a030af69e965b 100644 (file)
@@ -1,8 +1,8 @@
 const char * const FIPS_source_hashes[] = {
 "HMAC-SHA1(fips.c)= 7cbbda3b9e8aec46ee31797179cb72faeef80712",
 "HMAC-SHA1(fips_err_wrapper.c)= d3e2be316062510312269e98f964cb87e7577898",
-"HMAC-SHA1(fips.h)= b36e2f13c0c1ede4dd94f0dbb9f89354b53681d8",
-"HMAC-SHA1(fips_err.h)= d356c4436362dba2974f767e06c6be1c90dbfe9f",
+"HMAC-SHA1(fips.h)= 8f48edb7734408c1a82cbb97106f8d823f0b7c91",
+"HMAC-SHA1(fips_err.h)= 0b2bd6999ee5792fec3739689cde5f352789e63a",
 "HMAC-SHA1(aes/fips_aes_core.c)= b70bbbd675efe0613da0d57055310926a0104d55",
 "HMAC-SHA1(aes/asm/fips-ax86-elf.s)= f797b524a79196e7f59458a5b223432fcfd4a868",
 "HMAC-SHA1(aes/fips_aes_selftest.c)= 98b01502221e7fe529fd981222f2cbb52eb4cbe0",
@@ -23,10 +23,10 @@ const char * const FIPS_source_hashes[] = {
 "HMAC-SHA1(rand/fips_rand_selftest.c)= d9c8985e08feecefafe667ad0119d444b42f807c",
 "HMAC-SHA1(rsa/fips_rsa_eay.c)= 2596773a7af8f037427217b79f56858296961d66",
 "HMAC-SHA1(rsa/fips_rsa_gen.c)= beedbc14a7b262d36a2b829494030f3032563bac",
-"HMAC-SHA1(rsa/fips_rsa_selftest.c)= dcd0970a4de2d7f0d2333d6a3efb1ae350209b57",
+"HMAC-SHA1(rsa/fips_rsa_selftest.c)= a9dc47bd1001f795d1565111d26433c300101e06",
 "HMAC-SHA1(sha1/fips_sha1dgst.c)= 26e529d630b5e754b4a29bd1bb697e991e7fdc04",
 "HMAC-SHA1(sha1/fips_standalone_sha1.c)= faae95bc36cc80f5be6a0cde02ebab0f63d4fd97",
-"HMAC-SHA1(sha1/fips_sha1_selftest.c)= c8cb6e96a4b8c56f75f1b657ebf77a90545b774d",
+"HMAC-SHA1(sha1/fips_sha1_selftest.c)= a08f9c1e2c0f63b9aa96b927c0333a03b020749f",
 "HMAC-SHA1(sha1/asm/fips-sx86-elf.s)= ae66fb23ab8e1a2287e87a0a2dd30a4b9039fe63",
 "HMAC-SHA1(sha1/fips_sha_locl.h)= 30b6d6bdbdc9db0d66dc89010c1f4fe1c7b60574",
 "HMAC-SHA1(sha1/fips_md32_common.h)= c34d8b7785d3194ff968cf6d3efdd2bfcaec1fad",
@@ -34,5 +34,5 @@ const char * const FIPS_source_hashes[] = {
 "HMAC-SHA1(sha1/fips_sha256.c)= 826e768677e67b7c87dfc9e084245b619804d01c",
 "HMAC-SHA1(sha1/fips_sha512.c)= 27e16912ff196982425c00fe266fa84ef4f48fcd",
 "HMAC-SHA1(hmac/fips_hmac.c)= a477cec1da76c0092979c4a875b6469339bff7ef",
-"HMAC-SHA1(hmac/fips_hmac_selftest.c)= 380df511aa9330f317900effefb50d5dc3582082",
+"HMAC-SHA1(hmac/fips_hmac_selftest.c)= 63aa4e9699ae8178051c59fec7d18d3bd9aad25d",
 };
index 88d1e29e7cd526480fe691290283ae24e2394138..268c0cf0339382ae88830ba01c320f97abe05625 100644 (file)
@@ -62,6 +62,21 @@ tags:
 
 tests:
 
+top_fips_hmactest:
+       (cd $(TOP); $(MAKE) DIRS=fips FDIRS=$(DIR) TARGET=fips_hmactest sub_target)
+
+fips_hmactest: fips_hmactest.o $(TOP)/libcrypto.a
+       $(CC) $(CFLAGS) -o fips_hmactest fips_hmactest.o $(PEX_LIBS) $(TOP)/libcrypto.a $(EX_LIBS)
+       TOP=$(TOP) $(TOP)/fips/openssl_fips_fingerprint $(TOP)/libcrypto.a fips_hmactest
+
+Q=../testvectors/hmac/req
+A=../testvectors/hmac/rsp
+
+fips_test: top top_fips_hmactest
+       -rm -rf $(A)
+       mkdir $(A)
+       ./fips_hmactest < $(Q)/HMAC.req > $(A)/HMAC.rsp
+
 lint:
        lint -DLINT $(INCLUDES) $(SRC)>fluff
 
index 98a6457333a3884bd5a91f2b22209c835d0f09f9..71e26d1eede5a8d137775cdfaee9a6b0a200a77f 100644 (file)
@@ -126,7 +126,7 @@ int FIPS_selftest_hmac()
 
        if(outlen<md->md_size || memcmp(out,t->kaval,md->md_size))
            {
-           FIPSerr(FIPS_F_FIPS_SELFTEST_SHA1,FIPS_R_SELFTEST_FAILED);
+           FIPSerr(FIPS_F_FIPS_SELFTEST_SHA,FIPS_R_SELFTEST_FAILED);
            return 0;
            }
        }
index 71780b21470fcd4326658621a46c579f7706153c..85852f4b5b6aa78165dbb6292942ec8c0a6347f2 100644 (file)
@@ -73,10 +73,10 @@ Q=../testvectors/rng/req
 A=../testvectors/rng/rsp
 
 fips_test: top_fips_rngvs
-       -rm -rf $A
-       mkdir $A
-       ./fips_rngvs mct < $Q/MCT.req > $A/MCT.rsp
-       ./fips_rngvs vst < $Q/VST.req > $A/VST.rsp
+       -rm -rf $(A)
+       mkdir $(A)
+       ./fips_rngvs mct < $(Q)/MCT.req > $(A)/MCT.rsp
+       ./fips_rngvs vst < $(Q)/VST.req > $(A)/VST.rsp
 
 lint:
        lint -DLINT $(INCLUDES) $(SRC)>fluff
index 54a4dcd5376a9a3d11dc086ef60ea12c3190377c..be750a1b18a0b2d20f9a97bb6c8840f4b2dc7e9b 100644 (file)
@@ -62,6 +62,29 @@ tags:
 
 tests:
 
+top_fips_rsastest:
+       (cd $(TOP); $(MAKE) DIRS=fips FDIRS=$(DIR) TARGET=fips_rsastest sub_target)
+
+top_fips_rsavtest:
+       (cd $(TOP); $(MAKE) DIRS=fips FDIRS=$(DIR) TARGET=fips_rsavtest sub_target)
+
+fips_rsastest: fips_rsastest.o $(TOP)/libcrypto.a
+       $(CC) $(CFLAGS) -o fips_rsastest fips_rsastest.o $(PEX_LIBS) $(TOP)/libcrypto.a $(EX_LIBS)
+       TOP=$(TOP) $(TOP)/fips/openssl_fips_fingerprint $(TOP)/libcrypto.a fips_rsastest
+
+fips_rsavtest: fips_rsavtest.o $(TOP)/libcrypto.a
+       $(CC) $(CFLAGS) -o fips_rsavtest fips_rsavtest.o $(PEX_LIBS) $(TOP)/libcrypto.a $(EX_LIBS)
+       TOP=$(TOP) $(TOP)/fips/openssl_fips_fingerprint $(TOP)/libcrypto.a fips_rsavtest
+
+Q=../testvectors/rsa/req
+A=../testvectors/rsa/rsp
+
+fips_test: top top_fips_rsastest top_fips_rsavtest
+       -rm -rf $(A)
+       mkdir $(A)
+       ./fips_rsastest < $(Q)/SigGen15.req > $(A)/SigGen15.rsp
+       ./fips_rsavtest < $(Q)/SigVer15.req > $(A)/SigVer15.rsp
+
 lint:
        lint -DLINT $(INCLUDES) $(SRC)>fluff
 
index 0da4905374dd92530e8365cc749e7c9d651f29be..0b620c717bbb701107d4b8e123bfe7e7aa2cef3f 100644 (file)
@@ -222,7 +222,7 @@ int FIPS_selftest_rsa()
     SHA1(original_ptext,sizeof(original_ptext) - 1,md);
     if(memcmp(md,mdkat,SHA_DIGEST_LENGTH))
        {
-       FIPSerr(FIPS_F_FIPS_SELFTEST_SHA1,FIPS_R_SELFTEST_FAILED);
+       FIPSerr(FIPS_F_FIPS_SELFTEST_SHA,FIPS_R_SELFTEST_FAILED);
        return 0;
        }
     /* ...3) then encrypt the digest, and compare the ciphertext
index a52530c34f03c589ff55f2079759987b5b9048ad..73a65cdc065fb5090595d067691bbfc6db1f6387 100644 (file)
@@ -86,7 +86,7 @@ int FIPS_selftest_sha1()
        SHA1((unsigned char*)test[n],strlen(test[n]),md);
        if(memcmp(md,ret[n],sizeof md))
            {
-           FIPSerr(FIPS_F_FIPS_SELFTEST_SHA1,FIPS_R_SELFTEST_FAILED);
+           FIPSerr(FIPS_F_FIPS_SELFTEST_SHA,FIPS_R_SELFTEST_FAILED);
            return 0;
            }
        }