Mbed TLS v3.6.6
 
Loading...
Searching...
No Matches
crypto_extra.h
Go to the documentation of this file.
1
11/*
12 * Copyright The Mbed TLS Contributors
13 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
14 */
15
16#ifndef PSA_CRYPTO_EXTRA_H
17#define PSA_CRYPTO_EXTRA_H
19
20#include "crypto_types.h"
21#include "crypto_compat.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* UID for secure storage seed */
28#define PSA_CRYPTO_ITS_RANDOM_SEED_UID 0xFFFFFF52
29
30/* See mbedtls_config.h for definition */
31#if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)
32#define MBEDTLS_PSA_KEY_SLOT_COUNT 32
33#endif
34
35/* If the size of static key slots is not explicitly defined by the user, then
36 * try to guess it based on some of the most common the key types enabled in the build.
37 * See mbedtls_config.h for the definition of MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE. */
38#if !defined(MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE)
39
40#define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE 1
41
42#if PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
43#undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
44#define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE
45#endif
46
47/* This covers ciphers, AEADs and CMAC. */
48#if PSA_CIPHER_MAX_KEY_LENGTH > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
49#undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
50#define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_CIPHER_MAX_KEY_LENGTH
51#endif
52
53/* For HMAC, it's typical but not mandatory to use a key size that is equal to
54 * the hash size. */
55#if defined(PSA_WANT_ALG_HMAC)
56#if PSA_HASH_MAX_SIZE > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
57#undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
58#define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_HASH_MAX_SIZE
59#endif
60#endif /* PSA_WANT_ALG_HMAC */
61
62#endif /* !MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE*/
63
67
88 psa_key_attributes_t *attributes,
89 psa_algorithm_t alg2)
90{
91 attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
92}
93
101 const psa_key_attributes_t *attributes)
102{
103 return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
104}
105
106#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
107
130psa_status_t psa_get_key_slot_number(
131 const psa_key_attributes_t *attributes,
132 psa_key_slot_number_t *slot_number);
133
157static inline void psa_set_key_slot_number(
158 psa_key_attributes_t *attributes,
159 psa_key_slot_number_t slot_number)
160{
161 attributes->MBEDTLS_PRIVATE(has_slot_number) = 1;
162 attributes->MBEDTLS_PRIVATE(slot_number) = slot_number;
163}
164
171static inline void psa_clear_key_slot_number(
172 psa_key_attributes_t *attributes)
173{
174 attributes->MBEDTLS_PRIVATE(has_slot_number) = 0;
175}
176
225psa_status_t mbedtls_psa_register_se_key(
226 const psa_key_attributes_t *attributes);
227
228#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
229
231
243
250typedef struct mbedtls_psa_stats_s {
252 size_t MBEDTLS_PRIVATE(volatile_slots);
255 size_t MBEDTLS_PRIVATE(persistent_slots);
258 size_t MBEDTLS_PRIVATE(external_slots);
261 size_t MBEDTLS_PRIVATE(half_filled_slots);
263 size_t MBEDTLS_PRIVATE(cache_slots);
265 size_t MBEDTLS_PRIVATE(empty_slots);
267 size_t MBEDTLS_PRIVATE(locked_slots);
269 psa_key_id_t MBEDTLS_PRIVATE(max_open_internal_key_id);
271 psa_key_id_t MBEDTLS_PRIVATE(max_open_external_key_id);
273
282
353 size_t seed_size);
354
358
366#define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t) 0x4002)
367
384#define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t) 0x7002)
385
387#define PSA_KEY_TYPE_IS_DSA(type) \
388 (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)
389
390#define PSA_ALG_DSA_BASE ((psa_algorithm_t) 0x06000400)
405#define PSA_ALG_DSA(hash_alg) \
406 (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
407#define PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t) 0x06000500)
408#define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG
423#define PSA_ALG_DETERMINISTIC_DSA(hash_alg) \
424 (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
425#define PSA_ALG_IS_DSA(alg) \
426 (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \
427 PSA_ALG_DSA_BASE)
428#define PSA_ALG_DSA_IS_DETERMINISTIC(alg) \
429 (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)
430#define PSA_ALG_IS_DETERMINISTIC_DSA(alg) \
431 (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))
432#define PSA_ALG_IS_RANDOMIZED_DSA(alg) \
433 (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))
434
435
436/* We need to expand the sample definition of this macro from
437 * the API definition. */
438#undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN
439#define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \
440 PSA_ALG_IS_DSA(alg)
441
443
447
449#define PSA_PAKE_OPERATION_STAGE_SETUP 0
450#define PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS 1
451#define PSA_PAKE_OPERATION_STAGE_COMPUTATION 2
452
454
455
459
460#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
500psa_status_t mbedtls_psa_external_get_random(
501 mbedtls_psa_external_random_context_t *context,
502 uint8_t *output, size_t output_size, size_t *output_length);
503#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
504
575psa_status_t psa_random_reseed(const uint8_t *perso, size_t perso_size);
576
608
653
655
659
671#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
672
678#define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t) 0x7fffefff)
679
684typedef uint64_t psa_drv_slot_number_t;
685
686#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
696static inline int psa_key_id_is_builtin(psa_key_id_t key_id)
697{
698 return (key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN) &&
700}
701
746psa_status_t mbedtls_psa_platform_get_builtin_key(
748 psa_key_lifetime_t *lifetime,
749 psa_drv_slot_number_t *slot_number);
750#endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
751
753
765
781
796
798
802
803#define PSA_ALG_CATEGORY_PAKE ((psa_algorithm_t) 0x0a000000)
804
814#define PSA_ALG_IS_PAKE(alg) \
815 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_PAKE)
816
943#define PSA_ALG_JPAKE ((psa_algorithm_t) 0x0a000100)
944
946
958
965typedef uint8_t psa_pake_role_t;
966
973typedef uint8_t psa_pake_step_t;
974
984
990typedef uint8_t psa_pake_family_t;
991
996typedef uint32_t psa_pake_primitive_t;
997
1002#define PSA_PAKE_ROLE_NONE ((psa_pake_role_t) 0x00)
1003
1011#define PSA_PAKE_ROLE_FIRST ((psa_pake_role_t) 0x01)
1012
1020#define PSA_PAKE_ROLE_SECOND ((psa_pake_role_t) 0x02)
1021
1026#define PSA_PAKE_ROLE_CLIENT ((psa_pake_role_t) 0x11)
1027
1032#define PSA_PAKE_ROLE_SERVER ((psa_pake_role_t) 0x12)
1033
1052#define PSA_PAKE_PRIMITIVE_TYPE_ECC ((psa_pake_primitive_type_t) 0x01)
1053
1072#define PSA_PAKE_PRIMITIVE_TYPE_DH ((psa_pake_primitive_type_t) 0x02)
1073
1093#define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits) \
1094 ((pake_bits & 0xFFFF) != pake_bits) ? 0 : \
1095 ((psa_pake_primitive_t) (((pake_type) << 24 | \
1096 (pake_family) << 16) | (pake_bits)))
1097
1110#define PSA_PAKE_STEP_KEY_SHARE ((psa_pake_step_t) 0x01)
1111
1127#define PSA_PAKE_STEP_ZK_PUBLIC ((psa_pake_step_t) 0x02)
1128
1148#define PSA_PAKE_STEP_ZK_PROOF ((psa_pake_step_t) 0x03)
1149
1151
1172#define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \
1173 (alg == PSA_ALG_JPAKE && \
1174 primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1175 PSA_ECC_FAMILY_SECP_R1, 256) ? \
1176 ( \
1177 output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1178 output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1179 32 \
1180 ) : \
1181 0)
1182
1202#define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \
1203 (alg == PSA_ALG_JPAKE && \
1204 primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1205 PSA_ECC_FAMILY_SECP_R1, 256) ? \
1206 ( \
1207 input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1208 input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1209 32 \
1210 ) : \
1211 0)
1212
1223#define PSA_PAKE_OUTPUT_MAX_SIZE 65
1224
1235#define PSA_PAKE_INPUT_MAX_SIZE 65
1236
1240#define PSA_PAKE_CIPHER_SUITE_INIT { PSA_ALG_NONE, 0, 0, 0, PSA_ALG_NONE }
1241
1245#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1246#define PSA_PAKE_OPERATION_INIT { 0 }
1247#else
1248#define PSA_PAKE_OPERATION_INIT { 0, PSA_ALG_NONE, 0, PSA_PAKE_OPERATION_STAGE_SETUP, \
1249 { 0 }, { { 0 } } }
1250#endif
1251
1259
1261 uint8_t *MBEDTLS_PRIVATE(password);
1262 size_t MBEDTLS_PRIVATE(password_len);
1263 uint8_t *MBEDTLS_PRIVATE(user);
1264 size_t MBEDTLS_PRIVATE(user_len);
1265 uint8_t *MBEDTLS_PRIVATE(peer);
1266 size_t MBEDTLS_PRIVATE(peer_len);
1269};
1270
1272 PSA_JPAKE_STEP_INVALID = 0, /* Invalid step */
1273 PSA_JPAKE_X1_STEP_KEY_SHARE = 1, /* Round 1: input/output key share (for ephemeral private key X1).*/
1274 PSA_JPAKE_X1_STEP_ZK_PUBLIC = 2, /* Round 1: input/output Schnorr NIZKP public key for the X1 key */
1275 PSA_JPAKE_X1_STEP_ZK_PROOF = 3, /* Round 1: input/output Schnorr NIZKP proof for the X1 key */
1276 PSA_JPAKE_X2_STEP_KEY_SHARE = 4, /* Round 1: input/output key share (for ephemeral private key X2).*/
1277 PSA_JPAKE_X2_STEP_ZK_PUBLIC = 5, /* Round 1: input/output Schnorr NIZKP public key for the X2 key */
1278 PSA_JPAKE_X2_STEP_ZK_PROOF = 6, /* Round 1: input/output Schnorr NIZKP proof for the X2 key */
1279 PSA_JPAKE_X2S_STEP_KEY_SHARE = 7, /* Round 2: output X2S key (our key) */
1280 PSA_JPAKE_X2S_STEP_ZK_PUBLIC = 8, /* Round 2: output Schnorr NIZKP public key for the X2S key (our key) */
1281 PSA_JPAKE_X2S_STEP_ZK_PROOF = 9, /* Round 2: output Schnorr NIZKP proof for the X2S key (our key) */
1282 PSA_JPAKE_X4S_STEP_KEY_SHARE = 10, /* Round 2: input X4S key (from peer) */
1283 PSA_JPAKE_X4S_STEP_ZK_PUBLIC = 11, /* Round 2: input Schnorr NIZKP public key for the X4S key (from peer) */
1284 PSA_JPAKE_X4S_STEP_ZK_PROOF = 12 /* Round 2: input Schnorr NIZKP proof for the X4S key (from peer) */
1286
1292
1297
1299 /* The J-PAKE round we are currently on */
1301 /* The 'mode' we are currently in (inputting or outputting) */
1303 /* The number of completed inputs so far this round */
1304 uint8_t MBEDTLS_PRIVATE(inputs);
1305 /* The number of completed outputs so far this round */
1306 uint8_t MBEDTLS_PRIVATE(outputs);
1307 /* The next expected step (KEY_SHARE, ZK_PUBLIC or ZK_PROOF) */
1309};
1310
1311#define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1312 ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1313#define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1314 ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1315
1317#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1318 mbedtls_psa_client_handle_t handle;
1319#else
1326 unsigned int MBEDTLS_PRIVATE(id);
1327 /* Algorithm of the PAKE operation */
1329 /* A primitive of type compatible with algorithm */
1331 /* Stage of the PAKE operation: waiting for the setup, collecting inputs
1332 * or computing. */
1333 uint8_t MBEDTLS_PRIVATE(stage);
1334 /* Holds computation stage of the PAKE algorithms. */
1335 union {
1336 uint8_t MBEDTLS_PRIVATE(dummy);
1337#if defined(PSA_WANT_ALG_JPAKE)
1339#endif
1340 } MBEDTLS_PRIVATE(computation_stage);
1341 union {
1345#endif
1346};
1347
1351
1359
1363
1371 const psa_pake_cipher_suite_t *cipher_suite);
1372
1387static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite,
1389
1397 const psa_pake_cipher_suite_t *cipher_suite);
1398
1412static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite,
1413 psa_pake_primitive_t primitive);
1414
1422 const psa_pake_cipher_suite_t *cipher_suite);
1423
1430static uint16_t psa_pake_cs_get_bits(
1431 const psa_pake_cipher_suite_t *cipher_suite);
1432
1442 const psa_pake_cipher_suite_t *cipher_suite);
1443
1460static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
1462
1492
1495
1498
1502
1514 const psa_crypto_driver_pake_inputs_t *inputs,
1515 size_t *password_len);
1516
1530 const psa_crypto_driver_pake_inputs_t *inputs,
1531 uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
1532
1544 const psa_crypto_driver_pake_inputs_t *inputs,
1545 size_t *user_len);
1546
1558 const psa_crypto_driver_pake_inputs_t *inputs,
1559 size_t *peer_len);
1560
1576 const psa_crypto_driver_pake_inputs_t *inputs,
1577 uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
1578
1594 const psa_crypto_driver_pake_inputs_t *inputs,
1595 uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
1596
1608 const psa_crypto_driver_pake_inputs_t *inputs,
1609 psa_pake_cipher_suite_t *cipher_suite);
1610
1682 const psa_pake_cipher_suite_t *cipher_suite);
1683
1730 mbedtls_svc_key_id_t password);
1731
1774 const uint8_t *user_id,
1775 size_t user_id_len);
1776
1820 const uint8_t *peer_id,
1821 size_t peer_id_len);
1822
1862 psa_pake_role_t role);
1863
1920 psa_pake_step_t step,
1921 uint8_t *output,
1922 size_t output_size,
1923 size_t *output_length);
1924
1975 psa_pake_step_t step,
1976 const uint8_t *input,
1977 size_t input_length);
1978
2039
2065
2067
2069 const psa_pake_cipher_suite_t *cipher_suite)
2070{
2071 return cipher_suite->algorithm;
2072}
2073
2074static inline void psa_pake_cs_set_algorithm(
2075 psa_pake_cipher_suite_t *cipher_suite,
2076 psa_algorithm_t algorithm)
2077{
2078 if (!PSA_ALG_IS_PAKE(algorithm)) {
2079 cipher_suite->algorithm = 0;
2080 } else {
2081 cipher_suite->algorithm = algorithm;
2082 }
2083}
2084
2086 const psa_pake_cipher_suite_t *cipher_suite)
2087{
2088 return PSA_PAKE_PRIMITIVE(cipher_suite->type, cipher_suite->family,
2089 cipher_suite->bits);
2090}
2091
2092static inline void psa_pake_cs_set_primitive(
2093 psa_pake_cipher_suite_t *cipher_suite,
2094 psa_pake_primitive_t primitive)
2095{
2096 cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24);
2097 cipher_suite->family = (psa_pake_family_t) (0xFF & (primitive >> 16));
2098 cipher_suite->bits = (uint16_t) (0xFFFF & primitive);
2099}
2100
2102 const psa_pake_cipher_suite_t *cipher_suite)
2103{
2104 return cipher_suite->family;
2105}
2106
2107static inline uint16_t psa_pake_cs_get_bits(
2108 const psa_pake_cipher_suite_t *cipher_suite)
2109{
2110 return cipher_suite->bits;
2111}
2112
2114 const psa_pake_cipher_suite_t *cipher_suite)
2115{
2116 return cipher_suite->hash;
2117}
2118
2119static inline void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
2120 psa_algorithm_t hash)
2121{
2122 if (!PSA_ALG_IS_HASH(hash)) {
2123 cipher_suite->hash = 0;
2124 } else {
2125 cipher_suite->hash = hash;
2126 }
2127}
2128
2130{
2132 return v;
2133}
2134
2136{
2138 return v;
2139}
2140
2141#ifdef __cplusplus
2142}
2143#endif
2144
2145#endif /* PSA_CRYPTO_EXTRA_H */
PSA cryptography module: Backward compatibility aliases.
void mbedtls_psa_crypto_free(void)
Library deinitialization.
#define PSA_PAKE_OPERATION_INIT
psa_crypto_driver_pake_step
@ PSA_JPAKE_X2_STEP_KEY_SHARE
@ PSA_JPAKE_X2S_STEP_KEY_SHARE
@ PSA_JPAKE_X1_STEP_ZK_PUBLIC
@ PSA_JPAKE_STEP_INVALID
@ PSA_JPAKE_X4S_STEP_KEY_SHARE
@ PSA_JPAKE_X2S_STEP_ZK_PROOF
@ PSA_JPAKE_X2_STEP_ZK_PUBLIC
@ PSA_JPAKE_X4S_STEP_ZK_PROOF
@ PSA_JPAKE_X2_STEP_ZK_PROOF
@ PSA_JPAKE_X4S_STEP_ZK_PUBLIC
@ PSA_JPAKE_X1_STEP_KEY_SHARE
@ PSA_JPAKE_X2S_STEP_ZK_PUBLIC
@ PSA_JPAKE_X1_STEP_ZK_PROOF
psa_jpake_io_mode
@ PSA_JPAKE_OUTPUT
@ PSA_JPAKE_INPUT
enum psa_crypto_driver_pake_step psa_crypto_driver_pake_step_t
psa_jpake_round
@ PSA_JPAKE_FINISHED
@ PSA_JPAKE_FIRST
@ PSA_JPAKE_SECOND
#define PSA_PAKE_CIPHER_SUITE_INIT
enum psa_jpake_io_mode psa_jpake_io_mode_t
enum psa_jpake_round psa_jpake_round_t
void mbedtls_psa_get_stats(mbedtls_psa_stats_t *stats)
Get statistics about resource consumption related to the PSA keystore.
struct mbedtls_psa_stats_s mbedtls_psa_stats_t
Statistics about resource consumption related to the PSA keystore.
psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed, size_t seed_size)
Inject an initial entropy seed for the random generator into secure storage.
PSA cryptography module: type aliases.
struct psa_key_attributes_s psa_key_attributes_t
static psa_algorithm_t psa_get_key_enrollment_algorithm(const psa_key_attributes_t *attributes)
static void psa_set_key_enrollment_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg2)
Declare the enrollment algorithm for a key.
uint16_t psa_key_type_t
Encoding of a key type.
#define PSA_ALG_IS_PAKE(alg)
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
#define PSA_ALG_IS_HASH(alg)
int32_t psa_status_t
Function return status.
struct psa_key_derivation_s psa_key_derivation_operation_t
Definition crypto.h:3221
uint32_t psa_key_id_t
uint32_t psa_key_lifetime_t
psa_key_id_t mbedtls_svc_key_id_t
static uint16_t psa_pake_cs_get_bits(const psa_pake_cipher_suite_t *cipher_suite)
psa_status_t psa_pake_set_password_key(psa_pake_operation_t *operation, mbedtls_svc_key_id_t password)
static psa_pake_primitive_t psa_pake_cs_get_primitive(const psa_pake_cipher_suite_t *cipher_suite)
struct psa_pake_cipher_suite_s psa_pake_cipher_suite_t
psa_status_t psa_pake_abort(psa_pake_operation_t *operation)
psa_status_t psa_crypto_driver_pake_get_password(const psa_crypto_driver_pake_inputs_t *inputs, uint8_t *buffer, size_t buffer_size, size_t *buffer_length)
struct psa_pake_operation_s psa_pake_operation_t
psa_status_t psa_pake_input(psa_pake_operation_t *operation, psa_pake_step_t step, const uint8_t *input, size_t input_length)
uint32_t psa_pake_primitive_t
Encoding of the primitive associated with the PAKE.
static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite, psa_algorithm_t hash)
psa_status_t psa_pake_setup(psa_pake_operation_t *operation, const psa_pake_cipher_suite_t *cipher_suite)
psa_status_t psa_pake_output(psa_pake_operation_t *operation, psa_pake_step_t step, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t psa_pake_set_user(psa_pake_operation_t *operation, const uint8_t *user_id, size_t user_id_len)
static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite, psa_pake_primitive_t primitive)
static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void)
psa_status_t psa_crypto_driver_pake_get_password_len(const psa_crypto_driver_pake_inputs_t *inputs, size_t *password_len)
struct psa_crypto_driver_pake_inputs_s psa_crypto_driver_pake_inputs_t
static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite, psa_algorithm_t algorithm)
uint8_t psa_pake_role_t
Encoding of the application role of PAKE.
static psa_pake_family_t psa_pake_cs_get_family(const psa_pake_cipher_suite_t *cipher_suite)
psa_status_t psa_pake_set_peer(psa_pake_operation_t *operation, const uint8_t *peer_id, size_t peer_id_len)
static psa_pake_operation_t psa_pake_operation_init(void)
uint8_t psa_pake_step_t
psa_status_t psa_crypto_driver_pake_get_peer(const psa_crypto_driver_pake_inputs_t *inputs, uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length)
uint8_t psa_pake_primitive_type_t
struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t
psa_status_t psa_crypto_driver_pake_get_peer_len(const psa_crypto_driver_pake_inputs_t *inputs, size_t *peer_len)
psa_status_t psa_crypto_driver_pake_get_user_len(const psa_crypto_driver_pake_inputs_t *inputs, size_t *user_len)
psa_status_t psa_pake_get_implicit_key(psa_pake_operation_t *operation, psa_key_derivation_operation_t *output)
uint8_t psa_pake_family_t
Encoding of the family of the primitive associated with the PAKE.
psa_status_t psa_crypto_driver_pake_get_user(const psa_crypto_driver_pake_inputs_t *inputs, uint8_t *user_id, size_t user_id_size, size_t *user_id_len)
static psa_algorithm_t psa_pake_cs_get_algorithm(const psa_pake_cipher_suite_t *cipher_suite)
#define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits)
psa_status_t psa_pake_set_role(psa_pake_operation_t *operation, psa_pake_role_t role)
psa_status_t psa_crypto_driver_pake_get_cipher_suite(const psa_crypto_driver_pake_inputs_t *inputs, psa_pake_cipher_suite_t *cipher_suite)
static psa_algorithm_t psa_pake_cs_get_hash(const psa_pake_cipher_suite_t *cipher_suite)
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX
uint64_t psa_drv_slot_number_t
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN
int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg)
int psa_can_do_hash(psa_algorithm_t hash_alg)
psa_status_t psa_random_set_prediction_resistance(unsigned enabled)
psa_status_t psa_random_reseed(const uint8_t *perso, size_t perso_size)
psa_status_t psa_random_deplete(void)
uint64_t psa_key_slot_number_t
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
Statistics about resource consumption related to the PSA keystore.
psa_algorithm_t algorithm
psa_pake_primitive_type_t type
psa_pake_family_t family