Fix selftest.

This commit is contained in:
Ben Laurie 2004-05-06 15:36:28 +00:00
parent 9227a5912f
commit 55e81315dc
2 changed files with 6 additions and 10 deletions

View 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

View 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);