Removes mode param from mbedtls_rsa_rsassa_pss_verify_ext
Commit removes the mode parameter from the mbedtls_rsa_rsassa_pss_verify_ext function. This change is propagated throughout the codebase. Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
parent
9e65f791b5
commit
782a7f5bd6
5 changed files with 8 additions and 26 deletions
|
@ -1080,8 +1080,6 @@ int mbedtls_rsa_rsassa_pss_verify( mbedtls_rsa_context *ctx,
|
||||||
* \note The \p hash_id in the RSA context is ignored.
|
* \note The \p hash_id in the RSA context is ignored.
|
||||||
*
|
*
|
||||||
* \param ctx The initialized RSA public key context to use.
|
* \param ctx The initialized RSA public key context to use.
|
||||||
* \param mode The mode of operation. This must be either
|
|
||||||
* #MBEDTLS_RSA_PUBLIC or #MBEDTLS_RSA_PRIVATE.
|
|
||||||
* \param md_alg The message-digest algorithm used to hash the original data.
|
* \param md_alg The message-digest algorithm used to hash the original data.
|
||||||
* Use #MBEDTLS_MD_NONE for signing raw data.
|
* Use #MBEDTLS_MD_NONE for signing raw data.
|
||||||
* \param hashlen The length of the message digest.
|
* \param hashlen The length of the message digest.
|
||||||
|
@ -1102,7 +1100,6 @@ int mbedtls_rsa_rsassa_pss_verify( mbedtls_rsa_context *ctx,
|
||||||
* \return An \c MBEDTLS_ERR_RSA_XXX error code on failure.
|
* \return An \c MBEDTLS_ERR_RSA_XXX error code on failure.
|
||||||
*/
|
*/
|
||||||
int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
||||||
int mode,
|
|
||||||
mbedtls_md_type_t md_alg,
|
mbedtls_md_type_t md_alg,
|
||||||
unsigned int hashlen,
|
unsigned int hashlen,
|
||||||
const unsigned char *hash,
|
const unsigned char *hash,
|
||||||
|
|
|
@ -367,7 +367,6 @@ int mbedtls_pk_verify_ext( mbedtls_pk_type_t type, const void *options,
|
||||||
return( MBEDTLS_ERR_RSA_VERIFY_FAILED );
|
return( MBEDTLS_ERR_RSA_VERIFY_FAILED );
|
||||||
|
|
||||||
ret = mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_pk_rsa( *ctx ),
|
ret = mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_pk_rsa( *ctx ),
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
md_alg, (unsigned int) hash_len, hash,
|
md_alg, (unsigned int) hash_len, hash,
|
||||||
pss_opts->mgf1_hash_id,
|
pss_opts->mgf1_hash_id,
|
||||||
pss_opts->expected_salt_len,
|
pss_opts->expected_salt_len,
|
||||||
|
|
|
@ -2147,7 +2147,6 @@ int mbedtls_rsa_pkcs1_sign( mbedtls_rsa_context *ctx,
|
||||||
* Implementation of the PKCS#1 v2.1 RSASSA-PSS-VERIFY function
|
* Implementation of the PKCS#1 v2.1 RSASSA-PSS-VERIFY function
|
||||||
*/
|
*/
|
||||||
int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
||||||
int mode,
|
|
||||||
mbedtls_md_type_t md_alg,
|
mbedtls_md_type_t md_alg,
|
||||||
unsigned int hashlen,
|
unsigned int hashlen,
|
||||||
const unsigned char *hash,
|
const unsigned char *hash,
|
||||||
|
@ -2168,24 +2167,17 @@ int mbedtls_rsa_rsassa_pss_verify_ext( mbedtls_rsa_context *ctx,
|
||||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||||
|
|
||||||
RSA_VALIDATE_RET( ctx != NULL );
|
RSA_VALIDATE_RET( ctx != NULL );
|
||||||
RSA_VALIDATE_RET( mode == MBEDTLS_RSA_PRIVATE ||
|
|
||||||
mode == MBEDTLS_RSA_PUBLIC );
|
|
||||||
RSA_VALIDATE_RET( sig != NULL );
|
RSA_VALIDATE_RET( sig != NULL );
|
||||||
RSA_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE &&
|
RSA_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE &&
|
||||||
hashlen == 0 ) ||
|
hashlen == 0 ) ||
|
||||||
hash != NULL );
|
hash != NULL );
|
||||||
|
|
||||||
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V21 )
|
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
|
||||||
|
|
||||||
siglen = ctx->len;
|
siglen = ctx->len;
|
||||||
|
|
||||||
if( siglen < 16 || siglen > sizeof( buf ) )
|
if( siglen < 16 || siglen > sizeof( buf ) )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
ret = ( mode == MBEDTLS_RSA_PUBLIC )
|
ret = mbedtls_rsa_public( ctx, sig, buf );
|
||||||
? mbedtls_rsa_public( ctx, sig, buf )
|
|
||||||
: mbedtls_rsa_private( ctx, NULL, NULL, sig, buf );
|
|
||||||
|
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
|
@ -2312,7 +2304,6 @@ int mbedtls_rsa_rsassa_pss_verify( mbedtls_rsa_context *ctx,
|
||||||
: md_alg;
|
: md_alg;
|
||||||
|
|
||||||
return( mbedtls_rsa_rsassa_pss_verify_ext( ctx,
|
return( mbedtls_rsa_rsassa_pss_verify_ext( ctx,
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
md_alg, hashlen, hash,
|
md_alg, hashlen, hash,
|
||||||
mgf1_hash_id,
|
mgf1_hash_id,
|
||||||
MBEDTLS_RSA_SALT_LEN_ANY,
|
MBEDTLS_RSA_SALT_LEN_ANY,
|
||||||
|
|
|
@ -248,9 +248,8 @@ void pkcs1_rsassa_pss_verify_ext( int mod, data_t * input_N, data_t * input_E,
|
||||||
hash_len, hash_result,
|
hash_len, hash_result,
|
||||||
result_str->x ) == result_simple );
|
result_str->x ) == result_simple );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_rsa_rsassa_pss_verify_ext( &ctx, MBEDTLS_RSA_PUBLIC,
|
TEST_ASSERT( mbedtls_rsa_rsassa_pss_verify_ext( &ctx, msg_digest_id, hash_len,
|
||||||
msg_digest_id, hash_len, hash_result,
|
hash_result, mgf_hash, salt_len,
|
||||||
mgf_hash, salt_len,
|
|
||||||
result_str->x ) == result_full );
|
result_str->x ) == result_full );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
|
@ -334,26 +334,22 @@ void rsa_invalid_param( )
|
||||||
|
|
||||||
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
||||||
mbedtls_rsa_rsassa_pss_verify_ext( NULL,
|
mbedtls_rsa_rsassa_pss_verify_ext( NULL,
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
0, sizeof( buf ),
|
0, sizeof( buf ),
|
||||||
buf,
|
buf,
|
||||||
0, 0,
|
0, 0,
|
||||||
buf ) );
|
buf ) );
|
||||||
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
||||||
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
0, sizeof( buf ),
|
0, sizeof( buf ),
|
||||||
NULL, 0, 0,
|
NULL, 0, 0,
|
||||||
buf ) );
|
buf ) );
|
||||||
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
||||||
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
0, sizeof( buf ),
|
0, sizeof( buf ),
|
||||||
buf, 0, 0,
|
buf, 0, 0,
|
||||||
NULL ) );
|
NULL ) );
|
||||||
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
|
||||||
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
mbedtls_rsa_rsassa_pss_verify_ext( &ctx,
|
||||||
MBEDTLS_RSA_PUBLIC,
|
|
||||||
MBEDTLS_MD_SHA1,
|
MBEDTLS_MD_SHA1,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue