fix ci fail without RSA_C

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-03-22 14:20:15 +08:00
parent 92339d25b4
commit 89107d1bc2
3 changed files with 22 additions and 17 deletions

View File

@ -544,11 +544,14 @@ int mbedtls_pk_sign_ext( mbedtls_pk_type_t pk_type,
return( mbedtls_pk_sign( ctx, md_alg, hash, hash_len,
sig, sig_size, sig_len, f_rng, p_rng ) );
}
return( mbedtls_pk_psa_sign_ext( PSA_ALG_RSA_PSS(
mbedtls_psa_translate_md( md_alg ) ),
ctx->pk_ctx, hash, hash_len,
sig, sig_size, sig_len ) );
#if defined(MBEDTLS_RSA_C)
return( mbedtls_pk_psa_rsa_sign_ext( PSA_ALG_RSA_PSS(
mbedtls_psa_translate_md( md_alg ) ),
ctx->pk_ctx, hash, hash_len,
sig, sig_size, sig_len ) );
#else /* MBEDTLS_RSA_C */
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
#endif /* !MBEDTLS_RSA_C */
}
#endif /* MBEDTLS_PSA_CRYPTO_C */

View File

@ -197,10 +197,10 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
}
#if defined(MBEDTLS_PSA_CRYPTO_C)
int mbedtls_pk_psa_sign_ext( psa_algorithm_t psa_alg_md, void *pk_ctx,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t sig_size,
size_t *sig_len )
int mbedtls_pk_psa_rsa_sign_ext( psa_algorithm_t psa_alg_md, void *pk_ctx,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t sig_size,
size_t *sig_len )
{
mbedtls_rsa_context * rsa = (mbedtls_rsa_context *) pk_ctx;
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
@ -269,10 +269,10 @@ static int rsa_sign_wrap( void *ctx, mbedtls_md_type_t md_alg,
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
#endif /* SIZE_MAX > UINT_MAX */
return( mbedtls_pk_psa_sign_ext( PSA_ALG_RSA_PKCS1V15_SIGN(
mbedtls_psa_translate_md( md_alg ) ),
ctx, hash, hash_len,
sig, sig_size, sig_len ) );
return( mbedtls_pk_psa_rsa_sign_ext( PSA_ALG_RSA_PKCS1V15_SIGN(
mbedtls_psa_translate_md( md_alg ) ),
ctx, hash, hash_len,
sig, sig_size, sig_len ) );
}
#else
static int rsa_sign_wrap( void *ctx, mbedtls_md_type_t md_alg,

View File

@ -150,10 +150,12 @@ int mbedtls_pk_error_from_psa_ecdsa( psa_status_t status );
int mbedtls_pk_error_from_psa_rsa( psa_status_t status );
#endif
int mbedtls_pk_psa_sign_ext( psa_algorithm_t psa_alg_md, void *ctx,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t sig_size,
size_t *sig_len );
#if defined(MBEDTLS_RSA_C)
int mbedtls_pk_psa_rsa_sign_ext( psa_algorithm_t psa_alg_md, void *ctx,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t sig_size,
size_t *sig_len );
#endif /* MBEDTLS_RSA_C */
#endif /* MBEDTLS_PSA_CRYPTO_C */