From: Ben Laurie Date: Thu, 6 May 2004 15:36:28 +0000 (+0000) Subject: Fix selftest. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fheads%2FOpenSSL-fips-0_9_7-stable;p=oweals%2Fopenssl.git Fix selftest. --- diff --git a/fips/rsa/fingerprint.sha1 b/fips/rsa/fingerprint.sha1 index 74ed0c9404..727c71930a 100644 --- a/fips/rsa/fingerprint.sha1 +++ b/fips/rsa/fingerprint.sha1 @@ -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 diff --git a/fips/rsa/fips_rsa_gen.c b/fips/rsa/fips_rsa_gen.c index a38023d86c..e191baa926 100644 --- a/fips/rsa/fips_rsa_gen.c +++ b/fips/rsa/fips_rsa_gen.c @@ -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);