mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Merge pull request #5771 from superna9999/5761-rsa-decrypt-rework-pk-wrap-as-opaque
RSA decrypt 0: Rework `mbedtls_pk_wrap_as_opaque()`
This commit is contained in:
@ -1698,8 +1698,22 @@ int main( int argc, char *argv[] )
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
if( opt.key_opaque != 0 )
|
||||
{
|
||||
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey, &key_slot,
|
||||
PSA_ALG_ANY_HASH ) ) != 0 )
|
||||
psa_algorithm_t psa_alg, psa_alg2;
|
||||
|
||||
if( mbedtls_pk_get_type( &pkey ) == MBEDTLS_PK_ECKEY )
|
||||
{
|
||||
psa_alg = PSA_ALG_ECDSA( PSA_ALG_ANY_HASH );
|
||||
psa_alg2 = PSA_ALG_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
psa_alg = PSA_ALG_RSA_PKCS1V15_SIGN( PSA_ALG_ANY_HASH );
|
||||
psa_alg2 = PSA_ALG_RSA_PSS( PSA_ALG_ANY_HASH );
|
||||
}
|
||||
|
||||
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey, &key_slot, psa_alg,
|
||||
PSA_KEY_USAGE_SIGN_HASH,
|
||||
psa_alg2 ) ) != 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! "
|
||||
"mbedtls_pk_wrap_as_opaque returned -0x%x\n\n", (unsigned int) -ret );
|
||||
|
Reference in New Issue
Block a user