psa_util.h
mbedtls/private_access.h
mbedtls/build_info.h
psa/crypto.h
mbedtls/asn1write.h
mbedtls/ecp.h
mbedtls/asn1.h
mbedtls/asn1write.h
mbedtls/bignum.h
mbedtls/build_info.h
mbedtls/ccm.h
mbedtls/chacha20.h
mbedtls/chachapoly.h
mbedtls/check_config.h
mbedtls/cipher.h
mbedtls/cmac.h
mbedtls/config_adjust_legacy_crypto.h
mbedtls/config_adjust_psa_from_legacy.h
mbedtls/config_adjust_psa_superset_legacy.h
mbedtls/config_adjust_ssl.h
mbedtls/config_adjust_x509.h
mbedtls/config_psa.h
mbedtls/ecdsa.h
mbedtls/ecjpake.h
mbedtls/ecp.h
mbedtls/gcm.h
mbedtls/mbedtls_config.h
mbedtls/md.h
mbedtls/md5.h
mbedtls/platform_time.h
mbedtls/platform_util.h
mbedtls/poly1305.h
mbedtls/private_access.h
psa_util.h
mbedtls/ripemd160.h
mbedtls/sha1.h
mbedtls/sha256.h
mbedtls/sha3.h
mbedtls/sha512.h
psa/build_info.h
psa/crypto.h
psa/crypto_adjust_auto_enabled.h
psa/crypto_adjust_config_dependencies.h
psa/crypto_adjust_config_key_pair_types.h
psa/crypto_adjust_config_synonyms.h
psa/crypto_builtin_composites.h
psa/crypto_builtin_key_derivation.h
psa/crypto_builtin_primitives.h
crypto_compat.h
psa/crypto_driver_common.h
psa/crypto_driver_contexts_composites.h
psa/crypto_driver_contexts_key_derivation.h
psa/crypto_driver_contexts_primitives.h
crypto_extra.h
psa/crypto_legacy.h
crypto_platform.h
crypto_sizes.h
crypto_struct.h
crypto_types.h
crypto_values.h
inttypes.h
limits.h
stddef.h
stdint.h
stdio.h
time.h
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.

int int mbedtls_psa_get_random (void *p_rng, unsigned char *output, size_t output_size) 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.

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().

p_rng

This 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.

output

The buffer to fill. It must have room for `output_size` bytes.

output_size

The 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.

`0` on success.

An `MBEDTLS_ERR_ENTROPY_xxx`, `MBEDTLS_ERR_PLATFORM_xxx,` MBEDTLS_ERR_CTR_DRBG_xxx`or` MBEDTLS_ERR_HMAC_DRBG_xxx` on error.

- mbedtls_ecc_group_to_psa
- mbedtls_ecc_group_from_psa
- mbedtls_md_psa_alg_from_type
- mbedtls_md_type_from_psa_alg
- mbedtls_ecdsa_raw_to_der
- mbedtls_ecdsa_der_to_raw

Utility functions for the use of the PSA Crypto library.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */

    #ifndefMBEDTLS_PSA_UTIL_H
    #defineMBEDTLS_PSA_UTIL_H
    #include"mbedtls/private_access.h"

    #include"mbedtls/build_info.h"

    #include"psa/crypto.h"

    /*ASN1definesusedintheECDSAconversionfunctions.
    *Note:intentionallynotaddingMBEDTLS_ASN1_[PARSE|WRITE]_Cguardshere
    *otherwiseerrorcodeswouldbeunknownintest_suite_psa_crypto_util.data.*/
    #include<mbedtls/asn1write.h>

    #ifdefined(MBEDTLS_PSA_CRYPTO_CLIENT)

    intmbedtls_psa_get_random(void*p_rng,
    unsignedchar*output,
    size_toutput_size);

    #defineMBEDTLS_PSA_RANDOM_STATENULL

    #ifdefined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
    #include<mbedtls/ecp.h>

    psa_ecc_family_tmbedtls_ecc_group_to_psa(mbedtls_ecp_group_idgrpid,
    size_t*bits);

    mbedtls_ecp_group_idmbedtls_ecc_group_from_psa(psa_ecc_family_tfamily,
    size_tbits);
    #endif/*PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY*/

    staticinlinepsa_algorithm_tmbedtls_md_psa_alg_from_type(mbedtls_md_type_tmd_type)
    {
    returnPSA_ALG_CATEGORY_HASH|(psa_algorithm_t)md_type;
    }

    staticinlinembedtls_md_type_tmbedtls_md_type_from_psa_alg(psa_algorithm_tpsa_alg)
    {
    return(mbedtls_md_type_t)(psa_alg&PSA_ALG_HASH_MASK);
    }
    #endif/*MBEDTLS_PSA_CRYPTO_CLIENT*/

    #ifdefined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)

    intmbedtls_ecdsa_raw_to_der(size_tbits,constunsignedchar*raw,size_traw_len,
    unsignedchar*der,size_tder_size,size_t*der_len);

    intmbedtls_ecdsa_der_to_raw(size_tbits,constunsignedchar*der,size_tder_len,
    unsignedchar*raw,size_traw_size,size_t*raw_len);

    #endif/*MBEDTLS_PSA_UTIL_HAVE_ECDSA*/

    #endif/*MBEDTLS_PSA_UTIL_H*/