mirror of
https://github.com/espressif/mbedtls.git
synced 2026-09-20 01:07:22 +00:00
feat(component/mbedtls): Add support for RSASSA-PSS with RSA alt
- set RSA padding only when DS peripheral is configured
This commit is contained in:
@@ -1443,6 +1443,16 @@ int mbedtls_pk_sign_ext(mbedtls_pk_type_t pk_type,
|
||||
sig, sig_size, sig_len);
|
||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
if (ctx->pk_info->type == MBEDTLS_PK_RSA_ALT) {
|
||||
mbedtls_rsa_alt_context *rsa_alt = ctx->pk_ctx;
|
||||
mbedtls_rsa_context *rsa = (mbedtls_rsa_context *)rsa_alt->key;
|
||||
if (rsa != NULL) {
|
||||
mbedtls_rsa_set_padding(rsa, MBEDTLS_RSA_PKCS_V21, md_alg);
|
||||
return mbedtls_pk_sign(ctx, md_alg, hash, hash_len,
|
||||
sig, sig_size, sig_len, f_rng, p_rng);
|
||||
}
|
||||
}
|
||||
|
||||
if (sig_size < mbedtls_pk_get_len(ctx)) {
|
||||
return MBEDTLS_ERR_PK_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1282,7 +1282,7 @@ const mbedtls_pk_info_t mbedtls_ecdsa_info = {
|
||||
|
||||
static int rsa_alt_can_do(mbedtls_pk_type_t type)
|
||||
{
|
||||
return type == MBEDTLS_PK_RSA;
|
||||
return (type == MBEDTLS_PK_RSA) || (type == MBEDTLS_PK_RSASSA_PSS);
|
||||
}
|
||||
|
||||
static size_t rsa_alt_get_bitlen(mbedtls_pk_context *pk)
|
||||
|
||||
Reference in New Issue
Block a user