ssl_server2: refactor opaque code

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-05-04 11:23:13 +02:00
parent 89132a6ab0
commit e5e9ba920f

View file

@ -2607,6 +2607,16 @@ int main( int argc, char *argv[] )
(unsigned int) -ret );
goto exit;
}
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey, &key_slot,
psa_alg,
psa_usage,
psa_alg2 ) ) != 0 )
{
mbedtls_printf( " failed\n ! "
"mbedtls_pk_wrap_as_opaque returned -0x%x\n\n", (unsigned int) -ret );
goto exit;
}
}
else
{
@ -2625,8 +2635,6 @@ int main( int argc, char *argv[] )
psa_alg2 = PSA_ALG_NONE;
psa_usage = PSA_KEY_USAGE_SIGN_HASH;
}
}
}
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey, &key_slot,
psa_alg,
@ -2637,7 +2645,8 @@ int main( int argc, char *argv[] )
"mbedtls_pk_wrap_as_opaque returned -0x%x\n\n", (unsigned int) -ret );
goto exit;
}
}
}
if ( strcmp( opt.key2_opaque_alg1, DFL_KEY_OPAQUE_ALG ) != 0 )
{
@ -2650,6 +2659,16 @@ int main( int argc, char *argv[] )
(unsigned int) -ret );
goto exit;
}
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey2, &key_slot2,
psa_alg,
psa_usage,
psa_alg2 ) ) != 0 )
{
mbedtls_printf( " failed\n ! "
"mbedtls_pk_wrap_as_opaque returned -0x%x\n\n", (unsigned int) -ret );
goto exit;
}
}
else
{
@ -2668,8 +2687,6 @@ int main( int argc, char *argv[] )
psa_alg2 = PSA_ALG_NONE;
psa_usage = PSA_KEY_USAGE_SIGN_HASH;
}
}
}
if( ( ret = mbedtls_pk_wrap_as_opaque( &pkey2, &key_slot2,
psa_alg,
@ -2681,6 +2698,8 @@ int main( int argc, char *argv[] )
goto exit;
}
}
}
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
mbedtls_printf( " ok (key types: %s, %s)\n",