Mbed TLS v3.6.7
Toggle main menu visibility
Loading...
Searching...
No Matches
psa_util.h
Go to the documentation of this file.
1
6
/*
7
* Copyright The Mbed TLS Contributors
8
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9
*/
10
11
#ifndef MBEDTLS_PSA_UTIL_H
12
#define MBEDTLS_PSA_UTIL_H
13
#include "
mbedtls/private_access.h
"
14
15
#include "
mbedtls/build_info.h
"
16
17
#include "
psa/crypto.h
"
18
19
/* ASN1 defines used in the ECDSA conversion functions.
20
* Note: intentionally not adding MBEDTLS_ASN1_[PARSE|WRITE]_C guards here
21
* otherwise error codes would be unknown in test_suite_psa_crypto_util.data.*/
22
#include <
mbedtls/asn1write.h
>
23
24
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
25
57
int
mbedtls_psa_get_random(
void
*p_rng,
58
unsigned
char
*output,
59
size_t
output_size);
60
67
#define MBEDTLS_PSA_RANDOM_STATE NULL
68
72
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
73
#include <
mbedtls/ecp.h
>
74
87
psa_ecc_family_t
mbedtls_ecc_group_to_psa
(
mbedtls_ecp_group_id
grpid,
88
size_t
*bits);
89
102
mbedtls_ecp_group_id
mbedtls_ecc_group_from_psa
(
psa_ecc_family_t
family,
103
size_t
bits);
104
#endif
/* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY */
105
121
static
inline
psa_algorithm_t
mbedtls_md_psa_alg_from_type
(
mbedtls_md_type_t
md_type)
122
{
123
return
PSA_ALG_CATEGORY_HASH
| (
psa_algorithm_t
) md_type;
124
}
125
138
static
inline
mbedtls_md_type_t
mbedtls_md_type_from_psa_alg
(
psa_algorithm_t
psa_alg)
139
{
140
return
(
mbedtls_md_type_t
) (psa_alg &
PSA_ALG_HASH_MASK
);
141
}
142
#endif
/* MBEDTLS_PSA_CRYPTO_CLIENT */
143
144
#if defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)
145
175
int
mbedtls_ecdsa_raw_to_der
(
size_t
bits,
const
unsigned
char
*raw,
size_t
raw_len,
176
unsigned
char
*der,
size_t
der_size,
size_t
*der_len);
177
200
int
mbedtls_ecdsa_der_to_raw
(
size_t
bits,
const
unsigned
char
*der,
size_t
der_len,
201
unsigned
char
*raw,
size_t
raw_size,
size_t
*raw_len);
202
203
#endif
/* MBEDTLS_PSA_UTIL_HAVE_ECDSA */
204
206
207
#endif
/* MBEDTLS_PSA_UTIL_H */
asn1write.h
ASN.1 buffer writing functionality.
crypto.h
Platform Security Architecture cryptography module.
ecp.h
This file provides an API for Elliptic Curves over GF(P) (ECP).
mbedtls_ecp_group_id
mbedtls_ecp_group_id
Definition
ecp.h:102
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition
crypto_types.h:134
PSA_ALG_HASH_MASK
#define PSA_ALG_HASH_MASK
Definition
crypto_values.h:914
psa_ecc_family_t
uint8_t psa_ecc_family_t
Definition
crypto_types.h:97
PSA_ALG_CATEGORY_HASH
#define PSA_ALG_CATEGORY_HASH
Definition
crypto_values.h:784
mbedtls_md_type_from_psa_alg
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.
Definition
psa_util.h:138
mbedtls_ecdsa_der_to_raw
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)
mbedtls_ecc_group_from_psa
mbedtls_ecp_group_id mbedtls_ecc_group_from_psa(psa_ecc_family_t family, size_t bits)
mbedtls_ecdsa_raw_to_der
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)
mbedtls_ecc_group_to_psa
psa_ecc_family_t mbedtls_ecc_group_to_psa(mbedtls_ecp_group_id grpid, size_t *bits)
mbedtls_md_psa_alg_from_type
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.
Definition
psa_util.h:121
build_info.h
Build-time configuration info.
mbedtls_md_type_t
mbedtls_md_type_t
Supported message digests.
Definition
md.h:47
private_access.h
Macro wrapper for struct's members.
include
mbedtls
psa_util.h
Generated on
for Mbed TLS v3.6.7 by
1.17.0