Fix RSASSA-PSS example programs
diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c
index fecfcc2..7e8ac4a 100644
--- a/programs/pkey/rsa_sign_pss.c
+++ b/programs/pkey/rsa_sign_pss.c
@@ -101,7 +101,8 @@
if( ( ret = pk_parse_keyfile( &pk, argv[1], "" ) ) != 0 )
{
ret = 1;
- printf( " failed\n ! Could not open '%s'\n", argv[1] );
+ printf( " failed\n ! Could not read key from '%s'\n", argv[1] );
+ printf( " ! pk_parse_public_keyfile returned %d\n\n", ret );
goto exit;
}
@@ -112,6 +113,8 @@
goto exit;
}
+ rsa_set_padding( pk_rsa( pk ), RSA_PKCS_V21, POLARSSL_MD_SHA1 );
+
/*
* Compute the SHA-1 hash of the input file,
* then calculate the RSA signature of the hash.
diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c
index 2ac5a5b..b41bcf8 100644
--- a/programs/pkey/rsa_verify_pss.c
+++ b/programs/pkey/rsa_verify_pss.c
@@ -81,7 +81,8 @@
if( ( ret = pk_parse_public_keyfile( &pk, argv[1] ) ) != 0 )
{
- printf( " failed\n ! pk_parse_public_keyfile returned %d\n\n", ret );
+ printf( " failed\n ! Could not read key from '%s'\n", argv[1] );
+ printf( " ! pk_parse_public_keyfile returned %d\n\n", ret );
goto exit;
}
@@ -92,6 +93,8 @@
goto exit;
}
+ rsa_set_padding( pk_rsa( pk ), RSA_PKCS_V21, POLARSSL_MD_SHA1 );
+
/*
* Extract the RSA signature from the text file
*/