Fix selftest. OpenSSL-fips-0_9_7-stable
authorBen Laurie <ben@openssl.org>
Thu, 6 May 2004 15:36:28 +0000 (15:36 +0000)
committerBen Laurie <ben@openssl.org>
Thu, 6 May 2004 15:36:28 +0000 (15:36 +0000)
fips/rsa/fingerprint.sha1
fips/rsa/fips_rsa_gen.c

index 74ed0c9404578e953978681ba988c7e870b4d2b5..727c71930aba5ab18243115a922626d290964eb9 100644 (file)
@@ -1,3 +1,3 @@
 HMAC-SHA1(fips_rsa_eay.c)= 3808fed15de958768052db96ff710699ca9afd92
-HMAC-SHA1(fips_rsa_gen.c)= f0c9424afae306f47aa8f941c80d51d5612896e3
+HMAC-SHA1(fips_rsa_gen.c)= 0f7eec6b217844f638902ff82fe41e2201ade1d5
 HMAC-SHA1(fips_rsa_selftest.c)= af5b9c9a0237b2219f375849a5b2311d786e711b
index a38023d86ced2513ab1a341c73993d28ecb953d9..e191baa926ab6833954d630b228602bdd2f288d5 100644 (file)
@@ -71,18 +71,14 @@ static int fips_check_rsa(RSA *rsa)
     int n;
     unsigned char ctext[256];
     unsigned char ptext[256];
+    /* The longest we can have with OAEP padding and a 512 bit key */
     static unsigned char original_ptext[] =
        "\x01\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0"
-       "\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12"
-       "\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12\x34"
-       "\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12\x34\x56"
-       "\x01\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0"
-       "\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12"
-       "\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12\x34"
-       "\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a\xbc\xde\xf0\x12\x34\x56";
+       "\x23\x45\x67\x89\xab\xcd";
 
+    /* this will fail for keys shorter than 512 bits */
     n=RSA_public_encrypt(sizeof(original_ptext)-1,original_ptext,ctext,rsa,
-                        RSA_NO_PADDING);
+                        RSA_PKCS1_OAEP_PADDING);
     if(n < 0)
        {
        ERR_print_errors_fp(stderr);
@@ -93,7 +89,7 @@ static int fips_check_rsa(RSA *rsa)
        FIPSerr(FIPS_F_FIPS_CHECK_RSA,FIPS_R_PAIRWISE_TEST_FAILED);
        return 0;
        }
-    n=RSA_private_decrypt(n,ctext,ptext,rsa,RSA_NO_PADDING);
+    n=RSA_private_decrypt(n,ctext,ptext,rsa,RSA_PKCS1_OAEP_PADDING);
     if(n < 0)
        {
        ERR_print_errors_fp(stderr);