Mbed TLS v3.6.5
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
18 #include "mbedtls/private_access.h"
19 
20 #include "crypto_types.h"
21 #include "crypto_compat.h"
22 
23 #ifdef __cplusplus
24 extern "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  * set it to the maximum between PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE and
37  * PSA_CIPHER_MAX_KEY_LENGTH.
38  * See mbedtls_config.h for the definition. */
39 #if !defined(MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE)
40 #define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE \
41  ((PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE > PSA_CIPHER_MAX_KEY_LENGTH) ? \
42  PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE : PSA_CIPHER_MAX_KEY_LENGTH)
43 #endif /* !MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE*/
44 
69  psa_key_attributes_t *attributes,
70  psa_algorithm_t alg2)
71 {
72  attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
73 }
74 
82  const psa_key_attributes_t *attributes)
83 {
84  return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
85 }
86 
87 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
88 
111 psa_status_t psa_get_key_slot_number(
112  const psa_key_attributes_t *attributes,
113  psa_key_slot_number_t *slot_number);
114 
138 static inline void psa_set_key_slot_number(
139  psa_key_attributes_t *attributes,
140  psa_key_slot_number_t slot_number)
141 {
142  attributes->MBEDTLS_PRIVATE(has_slot_number) = 1;
143  attributes->MBEDTLS_PRIVATE(slot_number) = slot_number;
144 }
145 
152 static inline void psa_clear_key_slot_number(
153  psa_key_attributes_t *attributes)
154 {
155  attributes->MBEDTLS_PRIVATE(has_slot_number) = 0;
156 }
157 
206 psa_status_t mbedtls_psa_register_se_key(
207  const psa_key_attributes_t *attributes);
208 
209 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
210 
223 void mbedtls_psa_crypto_free(void);
224 
231 typedef struct mbedtls_psa_stats_s {
233  size_t MBEDTLS_PRIVATE(volatile_slots);
236  size_t MBEDTLS_PRIVATE(persistent_slots);
239  size_t MBEDTLS_PRIVATE(external_slots);
242  size_t MBEDTLS_PRIVATE(half_filled_slots);
244  size_t MBEDTLS_PRIVATE(cache_slots);
246  size_t MBEDTLS_PRIVATE(empty_slots);
248  size_t MBEDTLS_PRIVATE(locked_slots);
250  psa_key_id_t MBEDTLS_PRIVATE(max_open_internal_key_id);
252  psa_key_id_t MBEDTLS_PRIVATE(max_open_external_key_id);
254 
263 
333 psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed,
334  size_t seed_size);
335 
347 #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t) 0x4002)
348 
365 #define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t) 0x7002)
366 
368 #define PSA_KEY_TYPE_IS_DSA(type) \
369  (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)
370 
371 #define PSA_ALG_DSA_BASE ((psa_algorithm_t) 0x06000400)
372 
386 #define PSA_ALG_DSA(hash_alg) \
387  (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
388 #define PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t) 0x06000500)
389 #define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG
390 
404 #define PSA_ALG_DETERMINISTIC_DSA(hash_alg) \
405  (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
406 #define PSA_ALG_IS_DSA(alg) \
407  (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \
408  PSA_ALG_DSA_BASE)
409 #define PSA_ALG_DSA_IS_DETERMINISTIC(alg) \
410  (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)
411 #define PSA_ALG_IS_DETERMINISTIC_DSA(alg) \
412  (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))
413 #define PSA_ALG_IS_RANDOMIZED_DSA(alg) \
414  (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))
415 
416 
417 /* We need to expand the sample definition of this macro from
418  * the API definition. */
419 #undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN
420 #define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \
421  PSA_ALG_IS_DSA(alg)
422 
430 #define PSA_PAKE_OPERATION_STAGE_SETUP 0
431 #define PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS 1
432 #define PSA_PAKE_OPERATION_STAGE_COMPUTATION 2
433 
441 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
442 
481 psa_status_t mbedtls_psa_external_get_random(
482  mbedtls_psa_external_random_context_t *context,
483  uint8_t *output, size_t output_size, size_t *output_length);
484 #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
485 
503 #define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
504 
510 #define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t) 0x7fffefff)
511 
516 typedef uint64_t psa_drv_slot_number_t;
517 
518 #if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
519 
528 static inline int psa_key_id_is_builtin(psa_key_id_t key_id)
529 {
530  return (key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN) &&
531  (key_id <= MBEDTLS_PSA_KEY_ID_BUILTIN_MAX);
532 }
533 
578 psa_status_t mbedtls_psa_platform_get_builtin_key(
579  mbedtls_svc_key_id_t key_id,
580  psa_key_lifetime_t *lifetime,
581  psa_drv_slot_number_t *slot_number);
582 #endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
583 
612 int psa_can_do_hash(psa_algorithm_t hash_alg);
613 
627 int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg);
628 
635 #define PSA_ALG_CATEGORY_PAKE ((psa_algorithm_t) 0x0a000000)
636 
646 #define PSA_ALG_IS_PAKE(alg) \
647  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_PAKE)
648 
775 #define PSA_ALG_JPAKE ((psa_algorithm_t) 0x0a000100)
776 
797 typedef uint8_t psa_pake_role_t;
798 
805 typedef uint8_t psa_pake_step_t;
806 
816 
822 typedef uint8_t psa_pake_family_t;
823 
828 typedef uint32_t psa_pake_primitive_t;
829 
834 #define PSA_PAKE_ROLE_NONE ((psa_pake_role_t) 0x00)
835 
843 #define PSA_PAKE_ROLE_FIRST ((psa_pake_role_t) 0x01)
844 
852 #define PSA_PAKE_ROLE_SECOND ((psa_pake_role_t) 0x02)
853 
858 #define PSA_PAKE_ROLE_CLIENT ((psa_pake_role_t) 0x11)
859 
864 #define PSA_PAKE_ROLE_SERVER ((psa_pake_role_t) 0x12)
865 
884 #define PSA_PAKE_PRIMITIVE_TYPE_ECC ((psa_pake_primitive_type_t) 0x01)
885 
904 #define PSA_PAKE_PRIMITIVE_TYPE_DH ((psa_pake_primitive_type_t) 0x02)
905 
925 #define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits) \
926  ((pake_bits & 0xFFFF) != pake_bits) ? 0 : \
927  ((psa_pake_primitive_t) (((pake_type) << 24 | \
928  (pake_family) << 16) | (pake_bits)))
929 
942 #define PSA_PAKE_STEP_KEY_SHARE ((psa_pake_step_t) 0x01)
943 
959 #define PSA_PAKE_STEP_ZK_PUBLIC ((psa_pake_step_t) 0x02)
960 
980 #define PSA_PAKE_STEP_ZK_PROOF ((psa_pake_step_t) 0x03)
981 
1004 #define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \
1005  (alg == PSA_ALG_JPAKE && \
1006  primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1007  PSA_ECC_FAMILY_SECP_R1, 256) ? \
1008  ( \
1009  output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1010  output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1011  32 \
1012  ) : \
1013  0)
1014 
1034 #define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \
1035  (alg == PSA_ALG_JPAKE && \
1036  primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1037  PSA_ECC_FAMILY_SECP_R1, 256) ? \
1038  ( \
1039  input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1040  input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1041  32 \
1042  ) : \
1043  0)
1044 
1055 #define PSA_PAKE_OUTPUT_MAX_SIZE 65
1056 
1067 #define PSA_PAKE_INPUT_MAX_SIZE 65
1068 
1072 #define PSA_PAKE_CIPHER_SUITE_INIT { PSA_ALG_NONE, 0, 0, 0, PSA_ALG_NONE }
1073 
1077 #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1078 #define PSA_PAKE_OPERATION_INIT { 0 }
1079 #else
1080 #define PSA_PAKE_OPERATION_INIT { 0, PSA_ALG_NONE, 0, PSA_PAKE_OPERATION_STAGE_SETUP, \
1081  { 0 }, { { 0 } } }
1082 #endif
1083 
1086  psa_pake_primitive_type_t type;
1087  psa_pake_family_t family;
1088  uint16_t bits;
1090 };
1091 
1093  uint8_t *MBEDTLS_PRIVATE(password);
1094  size_t MBEDTLS_PRIVATE(password_len);
1095  uint8_t *MBEDTLS_PRIVATE(user);
1096  size_t MBEDTLS_PRIVATE(user_len);
1097  uint8_t *MBEDTLS_PRIVATE(peer);
1098  size_t MBEDTLS_PRIVATE(peer_len);
1101 };
1102 
1104  PSA_JPAKE_STEP_INVALID = 0, /* Invalid step */
1105  PSA_JPAKE_X1_STEP_KEY_SHARE = 1, /* Round 1: input/output key share (for ephemeral private key X1).*/
1106  PSA_JPAKE_X1_STEP_ZK_PUBLIC = 2, /* Round 1: input/output Schnorr NIZKP public key for the X1 key */
1107  PSA_JPAKE_X1_STEP_ZK_PROOF = 3, /* Round 1: input/output Schnorr NIZKP proof for the X1 key */
1108  PSA_JPAKE_X2_STEP_KEY_SHARE = 4, /* Round 1: input/output key share (for ephemeral private key X2).*/
1109  PSA_JPAKE_X2_STEP_ZK_PUBLIC = 5, /* Round 1: input/output Schnorr NIZKP public key for the X2 key */
1110  PSA_JPAKE_X2_STEP_ZK_PROOF = 6, /* Round 1: input/output Schnorr NIZKP proof for the X2 key */
1111  PSA_JPAKE_X2S_STEP_KEY_SHARE = 7, /* Round 2: output X2S key (our key) */
1112  PSA_JPAKE_X2S_STEP_ZK_PUBLIC = 8, /* Round 2: output Schnorr NIZKP public key for the X2S key (our key) */
1113  PSA_JPAKE_X2S_STEP_ZK_PROOF = 9, /* Round 2: output Schnorr NIZKP proof for the X2S key (our key) */
1114  PSA_JPAKE_X4S_STEP_KEY_SHARE = 10, /* Round 2: input X4S key (from peer) */
1115  PSA_JPAKE_X4S_STEP_ZK_PUBLIC = 11, /* Round 2: input Schnorr NIZKP public key for the X4S key (from peer) */
1116  PSA_JPAKE_X4S_STEP_ZK_PROOF = 12 /* Round 2: input Schnorr NIZKP proof for the X4S key (from peer) */
1118 
1119 typedef enum psa_jpake_round {
1124 
1125 typedef enum psa_jpake_io_mode {
1129 
1131  /* The J-PAKE round we are currently on */
1133  /* The 'mode' we are currently in (inputting or outputting) */
1135  /* The number of completed inputs so far this round */
1136  uint8_t MBEDTLS_PRIVATE(inputs);
1137  /* The number of completed outputs so far this round */
1138  uint8_t MBEDTLS_PRIVATE(outputs);
1139  /* The next expected step (KEY_SHARE, ZK_PUBLIC or ZK_PROOF) */
1140  psa_pake_step_t MBEDTLS_PRIVATE(step);
1141 };
1142 
1143 #define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1144  ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1145 #define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1146  ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1147 
1149 #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1150  mbedtls_psa_client_handle_t handle;
1151 #else
1152 
1158  unsigned int MBEDTLS_PRIVATE(id);
1159  /* Algorithm of the PAKE operation */
1161  /* A primitive of type compatible with algorithm */
1162  psa_pake_primitive_t MBEDTLS_PRIVATE(primitive);
1163  /* Stage of the PAKE operation: waiting for the setup, collecting inputs
1164  * or computing. */
1165  uint8_t MBEDTLS_PRIVATE(stage);
1166  /* Holds computation stage of the PAKE algorithms. */
1167  union {
1168  uint8_t MBEDTLS_PRIVATE(dummy);
1169 #if defined(PSA_WANT_ALG_JPAKE)
1171 #endif
1172  } MBEDTLS_PRIVATE(computation_stage);
1173  union {
1176  } MBEDTLS_PRIVATE(data);
1177 #endif
1178 };
1179 
1191 
1195 
1203  const psa_pake_cipher_suite_t *cipher_suite);
1204 
1219 static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite,
1221 
1228 static psa_pake_primitive_t psa_pake_cs_get_primitive(
1229  const psa_pake_cipher_suite_t *cipher_suite);
1230 
1244 static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite,
1245  psa_pake_primitive_t primitive);
1246 
1253 static psa_pake_family_t psa_pake_cs_get_family(
1254  const psa_pake_cipher_suite_t *cipher_suite);
1255 
1262 static uint16_t psa_pake_cs_get_bits(
1263  const psa_pake_cipher_suite_t *cipher_suite);
1264 
1274  const psa_pake_cipher_suite_t *cipher_suite);
1275 
1292 static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
1294 
1324 
1327 
1330 
1334 
1346  const psa_crypto_driver_pake_inputs_t *inputs,
1347  size_t *password_len);
1348 
1362  const psa_crypto_driver_pake_inputs_t *inputs,
1363  uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
1364 
1376  const psa_crypto_driver_pake_inputs_t *inputs,
1377  size_t *user_len);
1378 
1390  const psa_crypto_driver_pake_inputs_t *inputs,
1391  size_t *peer_len);
1392 
1408  const psa_crypto_driver_pake_inputs_t *inputs,
1409  uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
1410 
1426  const psa_crypto_driver_pake_inputs_t *inputs,
1427  uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
1428 
1440  const psa_crypto_driver_pake_inputs_t *inputs,
1441  psa_pake_cipher_suite_t *cipher_suite);
1442 
1514  const psa_pake_cipher_suite_t *cipher_suite);
1515 
1562  mbedtls_svc_key_id_t password);
1563 
1606  const uint8_t *user_id,
1607  size_t user_id_len);
1608 
1652  const uint8_t *peer_id,
1653  size_t peer_id_len);
1654 
1694  psa_pake_role_t role);
1695 
1752  psa_pake_step_t step,
1753  uint8_t *output,
1754  size_t output_size,
1755  size_t *output_length);
1756 
1807  psa_pake_step_t step,
1808  const uint8_t *input,
1809  size_t input_length);
1810 
1871 
1897 
1901  const psa_pake_cipher_suite_t *cipher_suite)
1902 {
1903  return cipher_suite->algorithm;
1904 }
1905 
1906 static inline void psa_pake_cs_set_algorithm(
1907  psa_pake_cipher_suite_t *cipher_suite,
1908  psa_algorithm_t algorithm)
1909 {
1910  if (!PSA_ALG_IS_PAKE(algorithm)) {
1911  cipher_suite->algorithm = 0;
1912  } else {
1913  cipher_suite->algorithm = algorithm;
1914  }
1915 }
1916 
1917 static inline psa_pake_primitive_t psa_pake_cs_get_primitive(
1918  const psa_pake_cipher_suite_t *cipher_suite)
1919 {
1920  return PSA_PAKE_PRIMITIVE(cipher_suite->type, cipher_suite->family,
1921  cipher_suite->bits);
1922 }
1923 
1924 static inline void psa_pake_cs_set_primitive(
1925  psa_pake_cipher_suite_t *cipher_suite,
1926  psa_pake_primitive_t primitive)
1927 {
1928  cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24);
1929  cipher_suite->family = (psa_pake_family_t) (0xFF & (primitive >> 16));
1930  cipher_suite->bits = (uint16_t) (0xFFFF & primitive);
1931 }
1932 
1933 static inline psa_pake_family_t psa_pake_cs_get_family(
1934  const psa_pake_cipher_suite_t *cipher_suite)
1935 {
1936  return cipher_suite->family;
1937 }
1938 
1939 static inline uint16_t psa_pake_cs_get_bits(
1940  const psa_pake_cipher_suite_t *cipher_suite)
1941 {
1942  return cipher_suite->bits;
1943 }
1944 
1946  const psa_pake_cipher_suite_t *cipher_suite)
1947 {
1948  return cipher_suite->hash;
1949 }
1950 
1951 static inline void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
1952  psa_algorithm_t hash)
1953 {
1954  if (!PSA_ALG_IS_HASH(hash)) {
1955  cipher_suite->hash = 0;
1956  } else {
1957  cipher_suite->hash = hash;
1958  }
1959 }
1960 
1962 {
1964  return v;
1965 }
1966 
1968 {
1970  return v;
1971 }
1972 
1973 #ifdef __cplusplus
1974 }
1975 #endif
1976 
1977 #endif /* PSA_CRYPTO_EXTRA_H */
uint32_t psa_pake_primitive_t
Encoding of the primitive associated with the PAKE.
Definition: crypto_extra.h:828
static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite, psa_algorithm_t hash)
uint8_t psa_pake_step_t
Definition: crypto_extra.h:805
static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void)
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)
void mbedtls_psa_crypto_free(void)
Library deinitialization.
psa_status_t psa_pake_set_role(psa_pake_operation_t *operation, psa_pake_role_t role)
psa_status_t psa_pake_abort(psa_pake_operation_t *operation)
PSA cryptography module: Backward compatibility aliases.
static void psa_set_key_enrollment_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg2)
Declare the enrollment algorithm for a key.
Definition: crypto_extra.h:68
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN
Definition: crypto_extra.h:503
static psa_algorithm_t psa_pake_cs_get_algorithm(const psa_pake_cipher_suite_t *cipher_suite)
psa_pake_primitive_type_t type
#define PSA_PAKE_OPERATION_INIT
PSA cryptography module: type aliases.
#define MBEDTLS_PRIVATE(member)
static uint16_t psa_pake_cs_get_bits(const psa_pake_cipher_suite_t *cipher_suite)
uint32_t psa_key_id_t
Definition: crypto_types.h:275
psa_jpake_round
psa_status_t psa_pake_get_implicit_key(psa_pake_operation_t *operation, psa_key_derivation_operation_t *output)
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)
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.
static psa_algorithm_t psa_pake_cs_get_hash(const psa_pake_cipher_suite_t *cipher_suite)
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 mbedtls_psa_inject_entropy(const uint8_t *seed, size_t seed_size)
Inject an initial entropy seed for the random generator into secure storage.
static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite, psa_pake_primitive_t primitive)
#define PSA_PAKE_CIPHER_SUITE_INIT
uint8_t psa_pake_family_t
Encoding of the family of the primitive associated with the PAKE.
Definition: crypto_extra.h:822
uint64_t psa_drv_slot_number_t
Definition: crypto_extra.h:516
uint64_t psa_key_slot_number_t
static psa_algorithm_t psa_get_key_enrollment_algorithm(const psa_key_attributes_t *attributes)
Definition: crypto_extra.h:81
psa_status_t psa_crypto_driver_pake_get_password_len(const psa_crypto_driver_pake_inputs_t *inputs, size_t *password_len)
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:134
static psa_pake_family_t psa_pake_cs_get_family(const psa_pake_cipher_suite_t *cipher_suite)
Macro wrapper for struct's members.
#define PSA_ALG_IS_HASH(alg)
uint8_t psa_pake_primitive_type_t
Definition: crypto_extra.h:815
enum psa_jpake_io_mode psa_jpake_io_mode_t
psa_status_t psa_pake_set_password_key(psa_pake_operation_t *operation, mbedtls_svc_key_id_t password)
enum psa_jpake_round psa_jpake_round_t
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:78
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)
psa_crypto_driver_pake_step
psa_status_t psa_pake_set_user(psa_pake_operation_t *operation, const uint8_t *user_id, size_t user_id_len)
#define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits)
Definition: crypto_extra.h:925
static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite, psa_algorithm_t algorithm)
int psa_can_do_hash(psa_algorithm_t hash_alg)
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX
Definition: crypto_extra.h:510
int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg)
psa_key_id_t mbedtls_svc_key_id_t
Definition: crypto_types.h:292
psa_jpake_io_mode
#define PSA_ALG_IS_PAKE(alg)
Definition: crypto_extra.h:646
static psa_pake_primitive_t psa_pake_cs_get_primitive(const psa_pake_cipher_suite_t *cipher_suite)
static psa_pake_operation_t psa_pake_operation_init(void)
psa_status_t psa_pake_input(psa_pake_operation_t *operation, psa_pake_step_t step, const uint8_t *input, size_t input_length)
psa_status_t psa_crypto_driver_pake_get_user_len(const psa_crypto_driver_pake_inputs_t *inputs, size_t *user_len)
psa_pake_family_t family
uint8_t psa_pake_role_t
Encoding of the application role of PAKE.
Definition: crypto_extra.h:797
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)
uint32_t psa_key_lifetime_t
Definition: crypto_types.h:183
psa_status_t psa_pake_set_peer(psa_pake_operation_t *operation, const uint8_t *peer_id, size_t peer_id_len)
psa_status_t psa_pake_setup(psa_pake_operation_t *operation, const psa_pake_cipher_suite_t *cipher_suite)
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:59
enum psa_crypto_driver_pake_step psa_crypto_driver_pake_step_t
psa_algorithm_t algorithm
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)
psa_algorithm_t hash
Statistics about resource consumption related to the PSA keystore.
Definition: crypto_extra.h:231