ssl_test_lib: add function translate given opaque algoritms to psa

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-05-02 13:41:53 +02:00
parent 77fc9ab1ba
commit 01396a16da
2 changed files with 82 additions and 0 deletions

View file

@ -240,6 +240,24 @@ int rng_get( void *p_rng, unsigned char *output, size_t output_len );
*/
int key_opaque_alg_parse( const char *arg, const char **alg1, const char **alg2 );
/** Parse given opaque key algoritms to obtain psa algs and usage
* that will be passed to mbedtls_pk_wrap_as_opaque().
*
*
* \param alg1 input string opaque key algorithm #1
* \param alg1 input string opaque key algorithm #2
* \param psa_alg1 output PSA algorithm #1
* \param psa_alg2 output PSA algorithm #2
* \param usage output key usage
*
* \return \c 0 on success.
* \return \c 1 on parse failure.
*/
int key_opaque_set_alg_usage( const char *alg1, const char *alg2,
psa_algorithm_t *psa_alg1,
psa_algorithm_t *psa_alg2,
psa_key_usage_t *usage );
#if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
/* The test implementation of the PSA external RNG is insecure. When
* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled, before using any PSA crypto