Flag to allow use of DSA_METHOD in FIPS mode.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 31 Mar 2006 17:09:46 +0000 (17:09 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 31 Mar 2006 17:09:46 +0000 (17:09 +0000)
crypto/dsa/dsa.h
crypto/dsa/dsa_sign.c
crypto/dsa/dsa_vrf.c

index 925f11cd579ad2b742617550faa6c3856d4cf6a5..851e3f0445c648ed6e4202dc45cf1543bdde9edf 100644 (file)
                                               * be used for all exponents.
                                               */
 
+/* If this flag is set external DSA_METHOD callbacks are allowed in FIPS mode
+ * it is then the applications responsibility to ensure the external method
+ * is compliant.
+ */
+
+#define DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW    0x04
+
 #if defined(OPENSSL_FIPS)
 #define FIPS_DSA_SIZE_T        int
 #endif
index 3c9753bac391f0a67bbd70ccccbe0aae0e8edaf8..46601102b57c37b1bcca993a1fbde37cb43fb617 100644 (file)
@@ -72,7 +72,8 @@
 DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
        {
 #ifdef OPENSSL_FIPS
-       if(FIPS_mode() && !FIPS_dsa_check(dsa))
+       if(FIPS_mode() && !FIPS_dsa_check(dsa)
+               && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW))
                return NULL;
 #endif
        return dsa->meth->dsa_do_sign(dgst, dlen, dsa);
@@ -96,7 +97,8 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
 int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
        {
 #ifdef OPENSSL_FIPS
-       if(FIPS_mode() && !FIPS_dsa_check(dsa))
+       if(FIPS_mode() && !FIPS_dsa_check(dsa)
+               && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW))
                return 0;
 #endif
        return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
index 8ef0c4502527c67a587448d831566574e7e20856..608431ca56553e25f6a1e35c20cf4e789f96005d 100644 (file)
@@ -74,7 +74,8 @@ int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
                  DSA *dsa)
        {
 #ifdef OPENSSL_FIPS
-       if(FIPS_mode() && !FIPS_dsa_check(dsa))
+       if(FIPS_mode() && !FIPS_dsa_check(dsa)
+               && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW))
                return -1;
 #endif
        return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa);