Mbed TLS v3.6.1
Loading...
Searching...
No Matches
Macros | Functions
psa_util.h File Reference

Utility functions for the use of the PSA Crypto library. More...

#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include "psa/crypto.h"
#include <mbedtls/asn1write.h>
#include <mbedtls/ecp.h>
Include dependency graph for psa_util.h:

Go to the source code of this file.

Macros

#define MBEDTLS_PSA_RANDOM_STATE   NULL
 

Functions

int mbedtls_psa_get_random (void *p_rng, unsigned char *output, size_t output_size)
 
psa_ecc_family_t mbedtls_ecc_group_to_psa (mbedtls_ecp_group_id grpid, size_t *bits)
 
mbedtls_ecp_group_id mbedtls_ecc_group_from_psa (psa_ecc_family_t family, size_t bits)
 
static psa_algorithm_t mbedtls_md_psa_alg_from_type (mbedtls_md_type_t md_type)
 This function returns the PSA algorithm identifier associated with the given digest type.
 
static mbedtls_md_type_t mbedtls_md_type_from_psa_alg (psa_algorithm_t psa_alg)
 This function returns the given digest type associated with the PSA algorithm identifier.
 
int mbedtls_ecdsa_raw_to_der (size_t bits, const unsigned char *raw, size_t raw_len, unsigned char *der, size_t der_size, size_t *der_len)
 
int mbedtls_ecdsa_der_to_raw (size_t bits, const unsigned char *der, size_t der_len, unsigned char *raw, size_t raw_size, size_t *raw_len)
 

Detailed Description

Utility functions for the use of the PSA Crypto library.

Definition in file psa_util.h.

Macro Definition Documentation

◆ MBEDTLS_PSA_RANDOM_STATE

#define MBEDTLS_PSA_RANDOM_STATE   NULL

The random generator state for the PSA subsystem.

This macro always expands to NULL because the p_rng parameter is unused in mbedtls_psa_get_random(), but it's kept for interface's backward compatibility.

Definition at line 67 of file psa_util.h.

Function Documentation

◆ mbedtls_psa_get_random()

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_rng random generator function parameter of many mbedtls_xxx functions.

The implementation of this function depends on the configuration of the library.

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_rngThis parameter is only kept for backward compatibility reasons with legacy f_rng functions and it's ignored. Set to MBEDTLS_PSA_RANDOM_STATE or NULL.
outputThe buffer to fill. It must have room for output_size bytes.
output_sizeThe number of bytes to write to output. This function may fail if output_size is 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
0 on success.
An MBEDTLS_ERR_ENTROPY_xxx, MBEDTLS_ERR_PLATFORM_xxx, MBEDTLS_ERR_CTR_DRBG_xxxor MBEDTLS_ERR_HMAC_DRBG_xxx` on error.