Mbed TLS v3.6.0
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 
59  psa_key_attributes_t *attributes,
60  psa_algorithm_t alg2)
61 {
62  attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
63 }
64 
72  const psa_key_attributes_t *attributes)
73 {
74  return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
75 }
76 
77 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
78 
101 psa_status_t psa_get_key_slot_number(
102  const psa_key_attributes_t *attributes,
103  psa_key_slot_number_t *slot_number);
104 
128 static inline void psa_set_key_slot_number(
129  psa_key_attributes_t *attributes,
130  psa_key_slot_number_t slot_number)
131 {
132  attributes->MBEDTLS_PRIVATE(has_slot_number) = 1;
133  attributes->MBEDTLS_PRIVATE(slot_number) = slot_number;
134 }
135 
142 static inline void psa_clear_key_slot_number(
143  psa_key_attributes_t *attributes)
144 {
145  attributes->MBEDTLS_PRIVATE(has_slot_number) = 0;
146 }
147 
188 psa_status_t mbedtls_psa_register_se_key(
189  const psa_key_attributes_t *attributes);
190 
191 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
192 
206 
213 typedef struct mbedtls_psa_stats_s {
215  size_t MBEDTLS_PRIVATE(volatile_slots);
218  size_t MBEDTLS_PRIVATE(persistent_slots);
221  size_t MBEDTLS_PRIVATE(external_slots);
224  size_t MBEDTLS_PRIVATE(half_filled_slots);
226  size_t MBEDTLS_PRIVATE(cache_slots);
228  size_t MBEDTLS_PRIVATE(empty_slots);
230  size_t MBEDTLS_PRIVATE(locked_slots);
232  psa_key_id_t MBEDTLS_PRIVATE(max_open_internal_key_id);
234  psa_key_id_t MBEDTLS_PRIVATE(max_open_external_key_id);
236 
245 
316  size_t seed_size);
317 
329 #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t) 0x4002)
330 
347 #define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t) 0x7002)
348 
350 #define PSA_KEY_TYPE_IS_DSA(type) \
351  (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)
352 
353 #define PSA_ALG_DSA_BASE ((psa_algorithm_t) 0x06000400)
368 #define PSA_ALG_DSA(hash_alg) \
369  (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
370 #define PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t) 0x06000500)
371 #define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG
386 #define PSA_ALG_DETERMINISTIC_DSA(hash_alg) \
387  (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
388 #define PSA_ALG_IS_DSA(alg) \
389  (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \
390  PSA_ALG_DSA_BASE)
391 #define PSA_ALG_DSA_IS_DETERMINISTIC(alg) \
392  (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)
393 #define PSA_ALG_IS_DETERMINISTIC_DSA(alg) \
394  (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))
395 #define PSA_ALG_IS_RANDOMIZED_DSA(alg) \
396  (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))
397 
398 
399 /* We need to expand the sample definition of this macro from
400  * the API definition. */
401 #undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN
402 #define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \
403  PSA_ALG_IS_DSA(alg)
404 
412 #define PSA_PAKE_OPERATION_STAGE_SETUP 0
413 #define PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS 1
414 #define PSA_PAKE_OPERATION_STAGE_COMPUTATION 2
415 
423 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
463 psa_status_t mbedtls_psa_external_get_random(
464  mbedtls_psa_external_random_context_t *context,
465  uint8_t *output, size_t output_size, size_t *output_length);
466 #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
467 
485 #define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
486 
492 #define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t) 0x7fffefff)
493 
498 typedef uint64_t psa_drv_slot_number_t;
499 
500 #if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
510 static inline int psa_key_id_is_builtin(psa_key_id_t key_id)
511 {
512  return (key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN) &&
513  (key_id <= MBEDTLS_PSA_KEY_ID_BUILTIN_MAX);
514 }
515 
560 psa_status_t mbedtls_psa_platform_get_builtin_key(
561  mbedtls_svc_key_id_t key_id,
562  psa_key_lifetime_t *lifetime,
563  psa_drv_slot_number_t *slot_number);
564 #endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
565 
572 #define PSA_ALG_CATEGORY_PAKE ((psa_algorithm_t) 0x0a000000)
573 
583 #define PSA_ALG_IS_PAKE(alg) \
584  (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_PAKE)
585 
701 #define PSA_ALG_JPAKE ((psa_algorithm_t) 0x0a000100)
702 
723 typedef uint8_t psa_pake_role_t;
724 
731 typedef uint8_t psa_pake_step_t;
732 
742 
748 typedef uint8_t psa_pake_family_t;
749 
754 typedef uint32_t psa_pake_primitive_t;
755 
760 #define PSA_PAKE_ROLE_NONE ((psa_pake_role_t) 0x00)
761 
769 #define PSA_PAKE_ROLE_FIRST ((psa_pake_role_t) 0x01)
770 
778 #define PSA_PAKE_ROLE_SECOND ((psa_pake_role_t) 0x02)
779 
784 #define PSA_PAKE_ROLE_CLIENT ((psa_pake_role_t) 0x11)
785 
790 #define PSA_PAKE_ROLE_SERVER ((psa_pake_role_t) 0x12)
791 
810 #define PSA_PAKE_PRIMITIVE_TYPE_ECC ((psa_pake_primitive_type_t) 0x01)
811 
830 #define PSA_PAKE_PRIMITIVE_TYPE_DH ((psa_pake_primitive_type_t) 0x02)
831 
851 #define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits) \
852  ((pake_bits & 0xFFFF) != pake_bits) ? 0 : \
853  ((psa_pake_primitive_t) (((pake_type) << 24 | \
854  (pake_family) << 16) | (pake_bits)))
855 
868 #define PSA_PAKE_STEP_KEY_SHARE ((psa_pake_step_t) 0x01)
869 
885 #define PSA_PAKE_STEP_ZK_PUBLIC ((psa_pake_step_t) 0x02)
886 
906 #define PSA_PAKE_STEP_ZK_PROOF ((psa_pake_step_t) 0x03)
907 
915 
919 
927  const psa_pake_cipher_suite_t *cipher_suite);
928 
941 static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite,
943 
951  const psa_pake_cipher_suite_t *cipher_suite);
952 
962 static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite,
963  psa_pake_primitive_t primitive);
964 
972  const psa_pake_cipher_suite_t *cipher_suite);
973 
980 static uint16_t psa_pake_cs_get_bits(
981  const psa_pake_cipher_suite_t *cipher_suite);
982 
992  const psa_pake_cipher_suite_t *cipher_suite);
993 
1012 
1042 
1045 
1048 
1052 
1064  const psa_crypto_driver_pake_inputs_t *inputs,
1065  size_t *password_len);
1066 
1080  const psa_crypto_driver_pake_inputs_t *inputs,
1081  uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
1082 
1094  const psa_crypto_driver_pake_inputs_t *inputs,
1095  size_t *user_len);
1096 
1108  const psa_crypto_driver_pake_inputs_t *inputs,
1109  size_t *peer_len);
1110 
1126  const psa_crypto_driver_pake_inputs_t *inputs,
1127  uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
1128 
1144  const psa_crypto_driver_pake_inputs_t *inputs,
1145  uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
1146 
1158  const psa_crypto_driver_pake_inputs_t *inputs,
1159  psa_pake_cipher_suite_t *cipher_suite);
1160 
1232  const psa_pake_cipher_suite_t *cipher_suite);
1233 
1280  mbedtls_svc_key_id_t password);
1281 
1320  const uint8_t *user_id,
1321  size_t user_id_len);
1322 
1362  const uint8_t *peer_id,
1363  size_t peer_id_len);
1364 
1404  psa_pake_role_t role);
1405 
1462  psa_pake_step_t step,
1463  uint8_t *output,
1464  size_t output_size,
1465  size_t *output_length);
1466 
1517  psa_pake_step_t step,
1518  const uint8_t *input,
1519  size_t input_length);
1520 
1581 
1607 
1630 #define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \
1631  (alg == PSA_ALG_JPAKE && \
1632  primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1633  PSA_ECC_FAMILY_SECP_R1, 256) ? \
1634  ( \
1635  output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1636  output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1637  32 \
1638  ) : \
1639  0)
1640 
1660 #define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \
1661  (alg == PSA_ALG_JPAKE && \
1662  primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1663  PSA_ECC_FAMILY_SECP_R1, 256) ? \
1664  ( \
1665  input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1666  input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1667  32 \
1668  ) : \
1669  0)
1670 
1681 #define PSA_PAKE_OUTPUT_MAX_SIZE 65
1682 
1693 #define PSA_PAKE_INPUT_MAX_SIZE 65
1694 
1698 #define PSA_PAKE_CIPHER_SUITE_INIT { PSA_ALG_NONE, 0, 0, 0, PSA_ALG_NONE }
1699 
1703 #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1704 #define PSA_PAKE_OPERATION_INIT { 0 }
1705 #else
1706 #define PSA_PAKE_OPERATION_INIT { 0, PSA_ALG_NONE, 0, PSA_PAKE_OPERATION_STAGE_SETUP, \
1707  { 0 }, { { 0 } } }
1708 #endif
1709 
1714  uint16_t bits;
1716 };
1717 
1719  const psa_pake_cipher_suite_t *cipher_suite)
1720 {
1721  return cipher_suite->algorithm;
1722 }
1723 
1724 static inline void psa_pake_cs_set_algorithm(
1725  psa_pake_cipher_suite_t *cipher_suite,
1726  psa_algorithm_t algorithm)
1727 {
1728  if (!PSA_ALG_IS_PAKE(algorithm)) {
1729  cipher_suite->algorithm = 0;
1730  } else {
1731  cipher_suite->algorithm = algorithm;
1732  }
1733 }
1734 
1736  const psa_pake_cipher_suite_t *cipher_suite)
1737 {
1738  return PSA_PAKE_PRIMITIVE(cipher_suite->type, cipher_suite->family,
1739  cipher_suite->bits);
1740 }
1741 
1742 static inline void psa_pake_cs_set_primitive(
1743  psa_pake_cipher_suite_t *cipher_suite,
1744  psa_pake_primitive_t primitive)
1745 {
1746  cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24);
1747  cipher_suite->family = (psa_pake_family_t) (0xFF & (primitive >> 16));
1748  cipher_suite->bits = (uint16_t) (0xFFFF & primitive);
1749 }
1750 
1752  const psa_pake_cipher_suite_t *cipher_suite)
1753 {
1754  return cipher_suite->family;
1755 }
1756 
1757 static inline uint16_t psa_pake_cs_get_bits(
1758  const psa_pake_cipher_suite_t *cipher_suite)
1759 {
1760  return cipher_suite->bits;
1761 }
1762 
1764  const psa_pake_cipher_suite_t *cipher_suite)
1765 {
1766  return cipher_suite->hash;
1767 }
1768 
1769 static inline void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
1770  psa_algorithm_t hash)
1771 {
1772  if (!PSA_ALG_IS_HASH(hash)) {
1773  cipher_suite->hash = 0;
1774  } else {
1775  cipher_suite->hash = hash;
1776  }
1777 }
1778 
1780  uint8_t *MBEDTLS_PRIVATE(password);
1781  size_t MBEDTLS_PRIVATE(password_len);
1782  uint8_t *MBEDTLS_PRIVATE(user);
1783  size_t MBEDTLS_PRIVATE(user_len);
1784  uint8_t *MBEDTLS_PRIVATE(peer);
1785  size_t MBEDTLS_PRIVATE(peer_len);
1788 };
1789 
1791  PSA_JPAKE_STEP_INVALID = 0, /* Invalid step */
1792  PSA_JPAKE_X1_STEP_KEY_SHARE = 1, /* Round 1: input/output key share (for ephemeral private key X1).*/
1793  PSA_JPAKE_X1_STEP_ZK_PUBLIC = 2, /* Round 1: input/output Schnorr NIZKP public key for the X1 key */
1794  PSA_JPAKE_X1_STEP_ZK_PROOF = 3, /* Round 1: input/output Schnorr NIZKP proof for the X1 key */
1795  PSA_JPAKE_X2_STEP_KEY_SHARE = 4, /* Round 1: input/output key share (for ephemeral private key X2).*/
1796  PSA_JPAKE_X2_STEP_ZK_PUBLIC = 5, /* Round 1: input/output Schnorr NIZKP public key for the X2 key */
1797  PSA_JPAKE_X2_STEP_ZK_PROOF = 6, /* Round 1: input/output Schnorr NIZKP proof for the X2 key */
1798  PSA_JPAKE_X2S_STEP_KEY_SHARE = 7, /* Round 2: output X2S key (our key) */
1799  PSA_JPAKE_X2S_STEP_ZK_PUBLIC = 8, /* Round 2: output Schnorr NIZKP public key for the X2S key (our key) */
1800  PSA_JPAKE_X2S_STEP_ZK_PROOF = 9, /* Round 2: output Schnorr NIZKP proof for the X2S key (our key) */
1801  PSA_JPAKE_X4S_STEP_KEY_SHARE = 10, /* Round 2: input X4S key (from peer) */
1802  PSA_JPAKE_X4S_STEP_ZK_PUBLIC = 11, /* Round 2: input Schnorr NIZKP public key for the X4S key (from peer) */
1803  PSA_JPAKE_X4S_STEP_ZK_PROOF = 12 /* Round 2: input Schnorr NIZKP proof for the X4S key (from peer) */
1805 
1806 typedef enum psa_jpake_round {
1809  PSA_JPAKE_FINISHED = 2
1811 
1812 typedef enum psa_jpake_io_mode {
1814  PSA_JPAKE_OUTPUT = 1
1816 
1818  /* The J-PAKE round we are currently on */
1820  /* The 'mode' we are currently in (inputting or outputting) */
1822  /* The number of completed inputs so far this round */
1823  uint8_t MBEDTLS_PRIVATE(inputs);
1824  /* The number of completed outputs so far this round */
1825  uint8_t MBEDTLS_PRIVATE(outputs);
1826  /* The next expected step (KEY_SHARE, ZK_PUBLIC or ZK_PROOF) */
1828 };
1829 
1830 #define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1831  ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1832 #define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1833  ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1834 
1836 #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1837  mbedtls_psa_client_handle_t handle;
1838 #else
1845  unsigned int MBEDTLS_PRIVATE(id);
1846  /* Algorithm of the PAKE operation */
1848  /* A primitive of type compatible with algorithm */
1850  /* Stage of the PAKE operation: waiting for the setup, collecting inputs
1851  * or computing. */
1852  uint8_t MBEDTLS_PRIVATE(stage);
1853  /* Holds computation stage of the PAKE algorithms. */
1854  union {
1855  uint8_t MBEDTLS_PRIVATE(dummy);
1856 #if defined(PSA_WANT_ALG_JPAKE)
1858 #endif
1859  } MBEDTLS_PRIVATE(computation_stage);
1860  union {
1864 #endif
1865 };
1866 
1867 static inline struct psa_pake_cipher_suite_s psa_pake_cipher_suite_init(void)
1868 {
1870  return v;
1871 }
1872 
1873 static inline struct psa_pake_operation_s psa_pake_operation_init(void)
1874 {
1876  return v;
1877 }
1878 
1879 #ifdef __cplusplus
1880 }
1881 #endif
1882 
1883 #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.
static psa_algorithm_t psa_get_key_enrollment_algorithm(const psa_key_attributes_t *attributes)
Definition: crypto_extra.h:71
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:58
#define PSA_ALG_IS_PAKE(alg)
Definition: crypto_extra.h:583
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:134
#define PSA_ALG_IS_HASH(alg)
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:59
uint32_t psa_key_id_t
Definition: crypto_types.h:275
uint32_t psa_key_lifetime_t
Definition: crypto_types.h:183
psa_key_id_t mbedtls_svc_key_id_t
Definition: crypto_types.h:292
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)
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)
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.
Definition: crypto_extra.h:754
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)
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.
Definition: crypto_extra.h:723
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
Definition: crypto_extra.h:731
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
Definition: crypto_extra.h:741
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.
Definition: crypto_extra.h:748
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)
Definition: crypto_extra.h:851
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
Definition: crypto_extra.h:492
uint64_t psa_drv_slot_number_t
Definition: crypto_extra.h:498
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN
Definition: crypto_extra.h:485
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.
Definition: crypto_extra.h:213
psa_algorithm_t hash
psa_algorithm_t algorithm
psa_pake_primitive_type_t type
psa_pake_family_t family