Add definition of mbedtls_pk_can_do_ext()

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2022-05-11 10:10:20 +02:00
parent a745c7d439
commit 0b5295848e

View file

@ -411,6 +411,27 @@ static inline size_t mbedtls_pk_get_len( const mbedtls_pk_context *ctx )
*/
int mbedtls_pk_can_do( const mbedtls_pk_context *ctx, mbedtls_pk_type_t type );
#if defined(MBEDTLS_USE_PSA_CRYPTO)
/**
* \brief Tell if context can do the operation given by PSA algorighm
*
* \param ctx The context to query. It must have been initialized.
* \param alg PSA algorithm to check against, the following are allowed:
* PSA_ALG_RSA_PKCS1V15_SIGN(hash),
* PSA_ALG_RSA_PSS(hash),
* PSA_ALG_RSA_PKCS1V15_CRYPT,
* PSA_ALG_ECDSA(hash),
* PSA_ALG_ECDH, where hash is a specific hash.
*
* \return 1 if the context can do operations on the given type.
* \return 0 if the context cannot do the operations on the given
* type. This is always the case for a context that has
* been initialized but not set up, or that has been
* cleared with mbedtls_pk_free().
*/
int mbedtls_pk_can_do_ext( const mbedtls_pk_context *ctx, psa_algorithm_t alg );
#endif /* MBEDTLS_USE_PSA_CRYPTO */
/**
* \brief Verify signature (including padding if relevant).
*