mbed TLS v3.1.0
|
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/ecp.h"
#include "mbedtls/md.h"
#include "mbedtls/pk.h"
#include "mbedtls/oid.h"
#include "mbedtls/error.h"
#include <string.h>
Go to the source code of this file.
Macros | |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH 1 |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 192 + 7 ) / 8 ) + 1 ) |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 224 + 7 ) / 8 ) + 1 ) |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 256 + 7 ) / 8 ) + 1 ) |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 384 + 7 ) / 8 ) + 1 ) |
#define | MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 521 + 7 ) / 8 ) + 1 ) |
#define | MBEDTLS_PSA_RANDOM_STATE NULL |
Typedefs | |
typedef int | mbedtls_f_rng_t (void *p_rng, unsigned char *output, size_t output_size) |
Functions | |
static psa_key_type_t | mbedtls_psa_translate_cipher_type (mbedtls_cipher_type_t cipher) |
static psa_algorithm_t | mbedtls_psa_translate_cipher_mode (mbedtls_cipher_mode_t mode, size_t taglen) |
static psa_key_usage_t | mbedtls_psa_translate_cipher_operation (mbedtls_operation_t op) |
static psa_algorithm_t | mbedtls_psa_translate_md (mbedtls_md_type_t md_alg) |
static int | mbedtls_psa_get_ecc_oid_from_id (psa_ecc_family_t curve, size_t bits, char const **oid, size_t *oid_len) |
static int | mbedtls_psa_err_translate_pk (psa_status_t status) |
static psa_key_type_t | mbedtls_psa_parse_tls_ecc_group (uint16_t tls_ecc_grp_reg_id, size_t *bits) |
static int | mbedtls_psa_tls_psa_ec_to_ecpoint (unsigned char *src, size_t srclen, unsigned char **dst, size_t *dstlen) |
static 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) |
Utility functions for the use of the PSA Crypto library.
Definition in file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH 1 |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 192 + 7 ) / 8 ) + 1 ) |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 224 + 7 ) / 8 ) + 1 ) |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 256 + 7 ) / 8 ) + 1 ) |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 384 + 7 ) / 8 ) + 1 ) |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_MAX_EC_PUBKEY_LENGTH ( 2 * ( ( 521 + 7 ) / 8 ) + 1 ) |
Definition at line 294 of file psa_util.h.
#define MBEDTLS_PSA_RANDOM_STATE NULL |
The random generator state for the PSA subsystem.
This macro expands to an expression which is suitable as the p_rng
random generator state parameter of many mbedtls_xxx
functions. 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.
Definition at line 493 of file psa_util.h.
typedef int mbedtls_f_rng_t(void *p_rng, unsigned char *output, size_t output_size) |
Definition at line 440 of file psa_util.h.
|
inlinestatic |
Definition at line 343 of file psa_util.h.
References MBEDTLS_ERR_ECP_RANDOM_FAILED, MBEDTLS_ERR_PK_ALLOC_FAILED, MBEDTLS_ERR_PK_BAD_INPUT_DATA, MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE, MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED, PSA_ERROR_BAD_STATE, PSA_ERROR_COMMUNICATION_FAILURE, PSA_ERROR_CORRUPTION_DETECTED, PSA_ERROR_HARDWARE_FAILURE, PSA_ERROR_INSUFFICIENT_ENTROPY, PSA_ERROR_INSUFFICIENT_MEMORY, PSA_ERROR_NOT_SUPPORTED, and PSA_SUCCESS.
|
inlinestatic |
Definition at line 168 of file psa_util.h.
References MBEDTLS_OID_EC_GRP_BP256R1, MBEDTLS_OID_EC_GRP_BP384R1, MBEDTLS_OID_EC_GRP_BP512R1, MBEDTLS_OID_EC_GRP_SECP192K1, MBEDTLS_OID_EC_GRP_SECP192R1, MBEDTLS_OID_EC_GRP_SECP224K1, MBEDTLS_OID_EC_GRP_SECP224R1, MBEDTLS_OID_EC_GRP_SECP256K1, MBEDTLS_OID_EC_GRP_SECP256R1, MBEDTLS_OID_EC_GRP_SECP384R1, MBEDTLS_OID_EC_GRP_SECP521R1, MBEDTLS_OID_SIZE, PSA_ECC_FAMILY_BRAINPOOL_P_R1, PSA_ECC_FAMILY_SECP_K1, and PSA_ECC_FAMILY_SECP_R1.
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. Use MBEDTLS_PSA_RANDOM_STATE to obtain the p_rng
parameter.
The implementation of this function depends on the configuration of the library.
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_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. MBEDTLS_ERR_ENTROPY_xxx
, MBEDTLS_ERR_PLATFORM_xxx,
MBEDTLS_ERR_CTR_DRBG_xxxor
MBEDTLS_ERR_HMAC_DRBG_xxx` on error.
|
inlinestatic |
Definition at line 375 of file psa_util.h.
References mbedtls_ecp_curve_info::grp_id, mbedtls_ecc_group_to_psa(), mbedtls_ecp_curve_info_from_tls_id(), and PSA_KEY_TYPE_ECC_KEY_PAIR.
|
inlinestatic |
Definition at line 412 of file psa_util.h.
References MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL.
|
inlinestatic |
Definition at line 397 of file psa_util.h.
|
inlinestatic |
Definition at line 88 of file psa_util.h.
References MBEDTLS_MODE_CBC, MBEDTLS_MODE_CCM, MBEDTLS_MODE_CCM_STAR_NO_TAG, MBEDTLS_MODE_ECB, MBEDTLS_MODE_GCM, PSA_ALG_AEAD_WITH_SHORTENED_TAG, PSA_ALG_CBC_NO_PADDING, PSA_ALG_CCM, PSA_ALG_CCM_STAR_NO_TAG, PSA_ALG_ECB_NO_PADDING, and PSA_ALG_GCM.
|
inlinestatic |
Definition at line 111 of file psa_util.h.
References MBEDTLS_DECRYPT, MBEDTLS_ENCRYPT, PSA_KEY_USAGE_DECRYPT, and PSA_KEY_USAGE_ENCRYPT.
|
inlinestatic |
Definition at line 46 of file psa_util.h.
References MBEDTLS_CIPHER_AES_128_CBC, MBEDTLS_CIPHER_AES_128_CCM, MBEDTLS_CIPHER_AES_128_CCM_STAR_NO_TAG, MBEDTLS_CIPHER_AES_128_ECB, MBEDTLS_CIPHER_AES_128_GCM, MBEDTLS_CIPHER_AES_192_CBC, MBEDTLS_CIPHER_AES_192_CCM, MBEDTLS_CIPHER_AES_192_CCM_STAR_NO_TAG, MBEDTLS_CIPHER_AES_192_ECB, MBEDTLS_CIPHER_AES_192_GCM, MBEDTLS_CIPHER_AES_256_CBC, MBEDTLS_CIPHER_AES_256_CCM, MBEDTLS_CIPHER_AES_256_CCM_STAR_NO_TAG, MBEDTLS_CIPHER_AES_256_ECB, MBEDTLS_CIPHER_AES_256_GCM, and PSA_KEY_TYPE_AES.
|
inlinestatic |
Definition at line 127 of file psa_util.h.
References MBEDTLS_MD_MD5, MBEDTLS_MD_NONE, MBEDTLS_MD_RIPEMD160, MBEDTLS_MD_SHA1, MBEDTLS_MD_SHA224, MBEDTLS_MD_SHA256, MBEDTLS_MD_SHA384, MBEDTLS_MD_SHA512, PSA_ALG_MD5, PSA_ALG_RIPEMD160, PSA_ALG_SHA_1, PSA_ALG_SHA_224, PSA_ALG_SHA_256, PSA_ALG_SHA_384, and PSA_ALG_SHA_512.