From f0b1271a42404a481840394ca9ec0cf1f7d6c28b Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Mon, 21 Mar 2022 09:31:32 +0100 Subject: [PATCH] Support RSA Opaque PK keys in ssl_server2 Signed-off-by: Neil Armstrong --- programs/ssl/ssl_server2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 02919b4275..24d9ea949c 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -2562,7 +2562,8 @@ int main( int argc, char *argv[] ) #if defined(MBEDTLS_USE_PSA_CRYPTO) if( opt.key_opaque != 0 ) { - if ( mbedtls_pk_get_type( &pkey ) == MBEDTLS_PK_ECKEY ) + if ( mbedtls_pk_get_type( &pkey ) == MBEDTLS_PK_ECKEY || + mbedtls_pk_get_type( &pkey ) == MBEDTLS_PK_RSA ) { if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey, &key_slot, PSA_ALG_ANY_HASH ) ) != 0 ) @@ -2573,7 +2574,8 @@ int main( int argc, char *argv[] ) } } - if ( mbedtls_pk_get_type( &pkey2 ) == MBEDTLS_PK_ECKEY ) + if ( mbedtls_pk_get_type( &pkey2 ) == MBEDTLS_PK_ECKEY || + mbedtls_pk_get_type( &pkey2 ) == MBEDTLS_PK_RSA ) { if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey2, &key_slot2, PSA_ALG_ANY_HASH ) ) != 0 )