Bypass algorithm blocking with TLS MD5+SHA1 signature in FIPS mode by
authorDr. Stephen Henson <steve@openssl.org>
Wed, 27 Jan 2010 00:51:24 +0000 (00:51 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 27 Jan 2010 00:51:24 +0000 (00:51 +0000)
calling underlying method directly.

crypto/rsa/rsa_sign.c

index 5488c06f6d8d9df23c756eaf5f4417aab60693b1..743dfd76501ea3141b2f15b78d626a69cfc779da 100644 (file)
@@ -137,7 +137,12 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
                i2d_X509_SIG(&sig,&p);
                s=tmps;
        }
+#ifdef OPENSSL_FIPS
+       /* Bypass algorithm blocking: this is allowed if we get this far */
+       i=rsa->meth->rsa_priv_enc(i,s,sigret,rsa,RSA_PKCS1_PADDING);
+#else
        i=RSA_private_encrypt(i,s,sigret,rsa,RSA_PKCS1_PADDING);
+#endif
        if (i <= 0)
                ret=0;
        else
@@ -190,8 +195,11 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
                RSAerr(RSA_F_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
                return 0;
                }
-#endif
+       /* Bypass algorithm blocking: this is allowed */
+       i=rsa->meth->rsa_pub_dec((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);
+#else
        i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);
+#endif
 
        if (i <= 0) goto err;