ssl_client: use key opaque algs given from command line
@@ -1718,7 +1718,22 @@ int main( int argc, char *argv[] )
if( opt.key_opaque != 0 )
{
psa_algorithm_t psa_alg, psa_alg2;
+ psa_key_usage_t usage = PSA_KEY_USAGE_SIGN_HASH;
+ if ( strcmp( opt.key_opaque_alg1, DFL_KEY_OPAQUE_ALG ) != 0 )
+ {
+ ret = key_opaque_set_alg_usage( opt.key_opaque_alg1,
+ opt.key_opaque_alg2,
+ &psa_alg, &psa_alg2, &usage );
+ if( ret != 0 )
+ {
+ mbedtls_printf( " failed\n ! key_opaque_set_alg_usage returned -0x%x\n\n",
+ (unsigned int) -ret );
+ goto exit;
+ }
+ }
+ else
+ {
if( mbedtls_pk_get_type( &pkey ) == MBEDTLS_PK_ECKEY )
{
psa_alg = PSA_ALG_ECDSA( PSA_ALG_ANY_HASH );
@@ -1729,6 +1744,7 @@ int main( int argc, char *argv[] )
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,
