make depend
[oweals/openssl.git] / crypto / dsa / dsa_key.c
index c4aa86bc6dce4eb7f2e034fe8486444acd410f81..9cf669b921ac647b3a286b620f473ec4cbc59c2f 100644 (file)
 #include <openssl/dsa.h>
 #include <openssl/rand.h>
 
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
 static int dsa_builtin_keygen(DSA *dsa);
 
 int DSA_generate_key(DSA *dsa)
        {
+#ifdef OPENSSL_FIPS
+       if (FIPS_mode() && !(dsa->meth->flags & DSA_FLAG_FIPS_METHOD)
+                       && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
+               {
+               DSAerr(DSA_F_DSA_GENERATE_KEY, DSA_R_NON_FIPS_DSA_METHOD);
+               return 0;
+               }
+#endif
        if(dsa->meth->dsa_keygen)
                return dsa->meth->dsa_keygen(dsa);
+#ifdef OPENSSL_FIPS
+       if (FIPS_mode())
+               return FIPS_dsa_generate_key(dsa);
+#endif
        return dsa_builtin_keygen(dsa);
        }