File psa_util.h
Utility functions for the use of the PSA Crypto library.
Warning
This function is not part of the public API and may change at any time.
Defines
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH
-
MBEDTLS_PSA_RANDOM_STATE
The random generator state for the PSA subsystem.
This macro expands to an expression which is suitable as the
p_rngrandom generator state parameter of manymbedtls_xxxfunctions. It must be used in combination with the random generator function mbedtls_psa_get_random().The implementation of this macro depends on the configuration of the library. Do not make any assumption on its nature.
Typedefs
-
typedef int mbedtls_f_rng_t(void *p_rng, unsigned char *output, size_t output_size)
Functions
-
static inline psa_key_type_t mbedtls_psa_translate_cipher_type(mbedtls_cipher_type_t cipher)
-
static inline psa_algorithm_t mbedtls_psa_translate_cipher_mode(mbedtls_cipher_mode_t mode, size_t taglen)
-
static inline psa_key_usage_t mbedtls_psa_translate_cipher_operation(mbedtls_operation_t op)
-
static inline psa_algorithm_t mbedtls_psa_translate_md(mbedtls_md_type_t md_alg)
-
static inline int mbedtls_psa_get_ecc_oid_from_id(psa_ecc_family_t curve, size_t bits, char const **oid, size_t *oid_len)
-
static inline int mbedtls_psa_err_translate_pk(psa_status_t status)
-
static inline psa_key_type_t mbedtls_psa_parse_tls_ecc_group(uint16_t tls_ecc_grp_reg_id, size_t *bits)
-
static inline int mbedtls_psa_tls_psa_ec_to_ecpoint(unsigned char *src, size_t srclen, unsigned char **dst, size_t *dstlen)
-
static inline int mbedtls_psa_tls_ecpoint_to_psa_ec(unsigned char const *src, size_t srclen, unsigned char *dst, size_t dstlen, size_t *olen)
-
int mbedtls_psa_get_random(void *p_rng, unsigned char *output, size_t output_size)
The random generator function for the PSA subsystem.
This function is suitable as the
f_rngrandom generator function parameter of manymbedtls_xxxfunctions. Use MBEDTLS_PSA_RANDOM_STATE to obtain thep_rngparameter.The implementation of this function depends on the configuration of the library.
Note
Depending on the configuration, this may be a function or a pointer to a function.
Note
This function may only be used if the PSA crypto subsystem is active. This means that you must call psa_crypto_init() before any call to this function, and you must not call this function after calling mbedtls_psa_crypto_free().
- Parameters
p_rng – The random generator context. This must be MBEDTLS_PSA_RANDOM_STATE. No other state is supported.
output – The buffer to fill. It must have room for
output_sizebytes.output_size – The number of bytes to write to
output. This function may fail ifoutput_sizeis too large. It is guaranteed to accept any output size requested by Mbed TLS library functions. The maximum request size depends on the library configuration.
- Returns
0on success.- Returns
An
MBEDTLS_ERR_ENTROPY_xxx,MBEDTLS_ERR_PLATFORM_xxx,MBEDTLS_ERR_CTR_DRBG_xxxorMBEDTLS_ERR_HMAC_DRBG_xxx` on error.