/src/mbedtls/include/psa/crypto_extra.h
Line | Count | Source |
1 | | /** |
2 | | * \file psa/crypto_extra.h |
3 | | * |
4 | | * \brief PSA cryptography module: Mbed TLS vendor extensions |
5 | | * |
6 | | * \note This file may not be included directly. Applications must |
7 | | * include psa/crypto.h. |
8 | | * |
9 | | * This file is reserved for vendor-specific definitions. |
10 | | */ |
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 | 3.74k | #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_KEY_PAIR_OR_PUBLIC_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_KEY_PAIR_OR_PUBLIC_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 | | |
64 | | /** \addtogroup attributes |
65 | | * @{ |
66 | | */ |
67 | | |
68 | | /** \brief Declare the enrollment algorithm for a key. |
69 | | * |
70 | | * An operation on a key may indifferently use the algorithm set with |
71 | | * psa_set_key_algorithm() or with this function. |
72 | | * |
73 | | * \param[out] attributes The attribute structure to write to. |
74 | | * \param alg2 A second algorithm that the key may be used |
75 | | * for, in addition to the algorithm set with |
76 | | * psa_set_key_algorithm(). |
77 | | * |
78 | | * \warning Setting an enrollment algorithm is not recommended, because |
79 | | * using the same key with different algorithms can allow some |
80 | | * attacks based on arithmetic relations between different |
81 | | * computations made with the same key, or can escalate harmless |
82 | | * side channels into exploitable ones. Use this function only |
83 | | * if it is necessary to support a protocol for which it has been |
84 | | * verified that the usage of the key with multiple algorithms |
85 | | * is safe. |
86 | | */ |
87 | | static inline void psa_set_key_enrollment_algorithm( |
88 | | psa_key_attributes_t *attributes, |
89 | | psa_algorithm_t alg2) |
90 | 0 | { |
91 | 0 | attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2; |
92 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: platform_builtin_keys.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: helpers.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_helpers.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_stubs.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_exercise_key.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: certs.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_test_wrappers.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: x509_crl.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: x509.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: oid.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pk.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pk_ecc.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pk_wrap.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pkparse.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_aead.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_cipher.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_client.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_ecp.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_ffdh.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_hash.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_mac.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_pake.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_rsa.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_se.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_slot_management.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_storage.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: psa_util.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: rsa.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: md.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pkcs12.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pkcs5.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_pkcs7.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pkcs7.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: x509_crt.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: pem.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: cipher.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: cipher_wrap.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_server.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_msg.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_ticket.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls12_client.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls12_server.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_keys.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_server.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_client.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_generic.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: debug.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_ciphersuites.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_client.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_x509csr.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: x509_csr.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_client.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_dtlsclient.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_dtlsserver.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: ssl_cookie.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_x509crt.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_privkey.c:psa_set_key_enrollment_algorithm Unexecuted instantiation: fuzz_pubkey.c:psa_set_key_enrollment_algorithm |
93 | | |
94 | | /** Retrieve the enrollment algorithm policy from key attributes. |
95 | | * |
96 | | * \param[in] attributes The key attribute structure to query. |
97 | | * |
98 | | * \return The enrollment algorithm stored in the attribute structure. |
99 | | */ |
100 | | static inline psa_algorithm_t psa_get_key_enrollment_algorithm( |
101 | | const psa_key_attributes_t *attributes) |
102 | 0 | { |
103 | 0 | return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2); |
104 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: platform_builtin_keys.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: helpers.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_helpers.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_stubs.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_exercise_key.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: certs.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_test_wrappers.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: x509_crl.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: x509.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: oid.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pk.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pk_ecc.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pk_wrap.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pkparse.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_aead.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_cipher.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_client.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_ecp.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_ffdh.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_hash.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_mac.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_pake.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_rsa.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_se.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_slot_management.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_crypto_storage.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: psa_util.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: rsa.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: md.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pkcs12.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pkcs5.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_pkcs7.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pkcs7.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: x509_crt.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pem.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: pk.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: cipher.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: cipher_wrap.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_server.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_msg.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_ticket.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls12_client.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls12_server.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_keys.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_server.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_client.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_tls13_generic.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: debug.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_ciphersuites.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_client.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_x509csr.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: x509_csr.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_client.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_dtlsclient.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_dtlsserver.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: ssl_cookie.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_x509crt.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_privkey.c:psa_get_key_enrollment_algorithm Unexecuted instantiation: fuzz_pubkey.c:psa_get_key_enrollment_algorithm |
105 | | |
106 | | #if defined(MBEDTLS_PSA_CRYPTO_SE_C) |
107 | | |
108 | | /** Retrieve the slot number where a key is stored. |
109 | | * |
110 | | * A slot number is only defined for keys that are stored in a secure |
111 | | * element. |
112 | | * |
113 | | * This information is only useful if the secure element is not entirely |
114 | | * managed through the PSA Cryptography API. It is up to the secure |
115 | | * element driver to decide how PSA slot numbers map to any other interface |
116 | | * that the secure element may have. |
117 | | * |
118 | | * \param[in] attributes The key attribute structure to query. |
119 | | * \param[out] slot_number On success, the slot number containing the key. |
120 | | * |
121 | | * \retval #PSA_SUCCESS |
122 | | * The key is located in a secure element, and \p *slot_number |
123 | | * indicates the slot number that contains it. |
124 | | * \retval #PSA_ERROR_NOT_PERMITTED |
125 | | * The caller is not permitted to query the slot number. |
126 | | * Mbed TLS currently does not return this error. |
127 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
128 | | * The key is not located in a secure element. |
129 | | */ |
130 | | psa_status_t psa_get_key_slot_number( |
131 | | const psa_key_attributes_t *attributes, |
132 | | psa_key_slot_number_t *slot_number); |
133 | | |
134 | | /** Choose the slot number where a key is stored. |
135 | | * |
136 | | * This function declares a slot number in the specified attribute |
137 | | * structure. |
138 | | * |
139 | | * A slot number is only meaningful for keys that are stored in a secure |
140 | | * element. It is up to the secure element driver to decide how PSA slot |
141 | | * numbers map to any other interface that the secure element may have. |
142 | | * |
143 | | * \note Setting a slot number in key attributes for a key creation can |
144 | | * cause the following errors when creating the key: |
145 | | * - #PSA_ERROR_NOT_SUPPORTED if the selected secure element does |
146 | | * not support choosing a specific slot number. |
147 | | * - #PSA_ERROR_NOT_PERMITTED if the caller is not permitted to |
148 | | * choose slot numbers in general or to choose this specific slot. |
149 | | * - #PSA_ERROR_INVALID_ARGUMENT if the chosen slot number is not |
150 | | * valid in general or not valid for this specific key. |
151 | | * - #PSA_ERROR_ALREADY_EXISTS if there is already a key in the |
152 | | * selected slot. |
153 | | * |
154 | | * \param[out] attributes The attribute structure to write to. |
155 | | * \param slot_number The slot number to set. |
156 | | */ |
157 | | static inline void psa_set_key_slot_number( |
158 | | psa_key_attributes_t *attributes, |
159 | | psa_key_slot_number_t slot_number) |
160 | 0 | { |
161 | 0 | attributes->MBEDTLS_PRIVATE(has_slot_number) = 1; |
162 | 0 | attributes->MBEDTLS_PRIVATE(slot_number) = slot_number; |
163 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_set_key_slot_number Unexecuted instantiation: platform_builtin_keys.c:psa_set_key_slot_number Unexecuted instantiation: helpers.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_helpers.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_stubs.c:psa_set_key_slot_number Unexecuted instantiation: psa_exercise_key.c:psa_set_key_slot_number Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_set_key_slot_number Unexecuted instantiation: certs.c:psa_set_key_slot_number Unexecuted instantiation: psa_test_wrappers.c:psa_set_key_slot_number Unexecuted instantiation: x509_crl.c:psa_set_key_slot_number Unexecuted instantiation: x509.c:psa_set_key_slot_number Unexecuted instantiation: oid.c:psa_set_key_slot_number Unexecuted instantiation: pk.c:psa_set_key_slot_number Unexecuted instantiation: pk_ecc.c:psa_set_key_slot_number Unexecuted instantiation: pk_wrap.c:psa_set_key_slot_number Unexecuted instantiation: pkparse.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_aead.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_cipher.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_client.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_ecp.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_ffdh.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_hash.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_mac.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_pake.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_rsa.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_se.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_slot_management.c:psa_set_key_slot_number Unexecuted instantiation: psa_crypto_storage.c:psa_set_key_slot_number Unexecuted instantiation: psa_util.c:psa_set_key_slot_number Unexecuted instantiation: rsa.c:psa_set_key_slot_number Unexecuted instantiation: md.c:psa_set_key_slot_number Unexecuted instantiation: pkcs12.c:psa_set_key_slot_number Unexecuted instantiation: pkcs5.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_pkcs7.c:psa_set_key_slot_number Unexecuted instantiation: pkcs7.c:psa_set_key_slot_number Unexecuted instantiation: x509_crt.c:psa_set_key_slot_number Unexecuted instantiation: pem.c:psa_set_key_slot_number Unexecuted instantiation: cipher.c:psa_set_key_slot_number Unexecuted instantiation: cipher_wrap.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_server.c:psa_set_key_slot_number Unexecuted instantiation: ssl_msg.c:psa_set_key_slot_number Unexecuted instantiation: ssl_ticket.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls12_client.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls12_server.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls13_keys.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls13_server.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls13_client.c:psa_set_key_slot_number Unexecuted instantiation: ssl_tls13_generic.c:psa_set_key_slot_number Unexecuted instantiation: debug.c:psa_set_key_slot_number Unexecuted instantiation: ssl_ciphersuites.c:psa_set_key_slot_number Unexecuted instantiation: ssl_client.c:psa_set_key_slot_number Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_x509csr.c:psa_set_key_slot_number Unexecuted instantiation: x509_csr.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_client.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_dtlsclient.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_dtlsserver.c:psa_set_key_slot_number Unexecuted instantiation: ssl_cookie.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_x509crt.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_privkey.c:psa_set_key_slot_number Unexecuted instantiation: fuzz_pubkey.c:psa_set_key_slot_number |
164 | | |
165 | | /** Remove the slot number attribute from a key attribute structure. |
166 | | * |
167 | | * This function undoes the action of psa_set_key_slot_number(). |
168 | | * |
169 | | * \param[out] attributes The attribute structure to write to. |
170 | | */ |
171 | | static inline void psa_clear_key_slot_number( |
172 | | psa_key_attributes_t *attributes) |
173 | 0 | { |
174 | 0 | attributes->MBEDTLS_PRIVATE(has_slot_number) = 0; |
175 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_clear_key_slot_number Unexecuted instantiation: platform_builtin_keys.c:psa_clear_key_slot_number Unexecuted instantiation: helpers.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_helpers.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_stubs.c:psa_clear_key_slot_number Unexecuted instantiation: psa_exercise_key.c:psa_clear_key_slot_number Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_clear_key_slot_number Unexecuted instantiation: certs.c:psa_clear_key_slot_number Unexecuted instantiation: psa_test_wrappers.c:psa_clear_key_slot_number Unexecuted instantiation: x509_crl.c:psa_clear_key_slot_number Unexecuted instantiation: x509.c:psa_clear_key_slot_number Unexecuted instantiation: oid.c:psa_clear_key_slot_number Unexecuted instantiation: pk.c:psa_clear_key_slot_number Unexecuted instantiation: pk_ecc.c:psa_clear_key_slot_number Unexecuted instantiation: pk_wrap.c:psa_clear_key_slot_number Unexecuted instantiation: pkparse.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_aead.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_cipher.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_client.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_ecp.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_ffdh.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_hash.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_mac.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_pake.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_rsa.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_se.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_slot_management.c:psa_clear_key_slot_number Unexecuted instantiation: psa_crypto_storage.c:psa_clear_key_slot_number Unexecuted instantiation: psa_util.c:psa_clear_key_slot_number Unexecuted instantiation: rsa.c:psa_clear_key_slot_number Unexecuted instantiation: md.c:psa_clear_key_slot_number Unexecuted instantiation: pkcs12.c:psa_clear_key_slot_number Unexecuted instantiation: pkcs5.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_pkcs7.c:psa_clear_key_slot_number Unexecuted instantiation: pkcs7.c:psa_clear_key_slot_number Unexecuted instantiation: x509_crt.c:psa_clear_key_slot_number Unexecuted instantiation: pem.c:psa_clear_key_slot_number Unexecuted instantiation: cipher.c:psa_clear_key_slot_number Unexecuted instantiation: cipher_wrap.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_server.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_msg.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_ticket.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls12_client.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls12_server.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls13_keys.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls13_server.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls13_client.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_tls13_generic.c:psa_clear_key_slot_number Unexecuted instantiation: debug.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_ciphersuites.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_client.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_x509csr.c:psa_clear_key_slot_number Unexecuted instantiation: x509_csr.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_client.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_dtlsclient.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_dtlsserver.c:psa_clear_key_slot_number Unexecuted instantiation: ssl_cookie.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_x509crt.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_privkey.c:psa_clear_key_slot_number Unexecuted instantiation: fuzz_pubkey.c:psa_clear_key_slot_number |
176 | | |
177 | | /** Register a key that is already present in a secure element. |
178 | | * |
179 | | * The key must be located in a secure element designated by the |
180 | | * lifetime field in \p attributes, in the slot set with |
181 | | * psa_set_key_slot_number() in the attribute structure. |
182 | | * This function makes the key available through the key identifier |
183 | | * specified in \p attributes. |
184 | | * |
185 | | * \param[in] attributes The attributes of the existing key. |
186 | | * - The lifetime must be a persistent lifetime |
187 | | * in a secure element. Volatile lifetimes are |
188 | | * not currently supported. |
189 | | * - The key identifier must be in the valid |
190 | | * range for persistent keys. |
191 | | * - The key type and size must be specified and |
192 | | * must be consistent with the key material |
193 | | * in the secure element. |
194 | | * |
195 | | * \retval #PSA_SUCCESS |
196 | | * The key was successfully registered. |
197 | | * Note that depending on the design of the driver, this may or may |
198 | | * not guarantee that a key actually exists in the designated slot |
199 | | * and is compatible with the specified attributes. |
200 | | * \retval #PSA_ERROR_ALREADY_EXISTS |
201 | | * There is already a key with the identifier specified in |
202 | | * \p attributes. |
203 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
204 | | * The secure element driver for the specified lifetime does not |
205 | | * support registering a key. |
206 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
207 | | * The identifier in \p attributes is invalid, namely the identifier is |
208 | | * not in the user range, or |
209 | | * \p attributes specifies a lifetime which is not located |
210 | | * in a secure element, or no slot number is specified in \p attributes, |
211 | | * or the specified slot number is not valid. |
212 | | * \retval #PSA_ERROR_NOT_PERMITTED |
213 | | * The caller is not authorized to register the specified key slot. |
214 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
215 | | * \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription |
216 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
217 | | * \retval #PSA_ERROR_DATA_INVALID \emptydescription |
218 | | * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription |
219 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
220 | | * \retval #PSA_ERROR_BAD_STATE |
221 | | * The library has not been previously initialized by psa_crypto_init(). |
222 | | * It is implementation-dependent whether a failure to initialize |
223 | | * results in this error code. |
224 | | */ |
225 | | psa_status_t mbedtls_psa_register_se_key( |
226 | | const psa_key_attributes_t *attributes); |
227 | | |
228 | | #endif /* MBEDTLS_PSA_CRYPTO_SE_C */ |
229 | | |
230 | | /**@}*/ |
231 | | |
232 | | /** |
233 | | * \brief Library deinitialization. |
234 | | * |
235 | | * This function clears all data associated with the PSA layer, |
236 | | * including the whole key store. |
237 | | * This function is not thread safe, it wipes every key slot regardless of |
238 | | * state and reader count. It should only be called when no slot is in use. |
239 | | * |
240 | | * This is an Mbed TLS extension. |
241 | | */ |
242 | | void mbedtls_psa_crypto_free(void); |
243 | | |
244 | | /** \brief Statistics about |
245 | | * resource consumption related to the PSA keystore. |
246 | | * |
247 | | * \note The content of this structure is not part of the stable API and ABI |
248 | | * of Mbed TLS and may change arbitrarily from version to version. |
249 | | */ |
250 | | typedef struct mbedtls_psa_stats_s { |
251 | | /** Number of slots containing key material for a volatile key. */ |
252 | | size_t MBEDTLS_PRIVATE(volatile_slots); |
253 | | /** Number of slots containing key material for a key which is in |
254 | | * internal persistent storage. */ |
255 | | size_t MBEDTLS_PRIVATE(persistent_slots); |
256 | | /** Number of slots containing a reference to a key in a |
257 | | * secure element. */ |
258 | | size_t MBEDTLS_PRIVATE(external_slots); |
259 | | /** Number of slots which are occupied, but do not contain |
260 | | * key material yet. */ |
261 | | size_t MBEDTLS_PRIVATE(half_filled_slots); |
262 | | /** Number of slots that contain cache data. */ |
263 | | size_t MBEDTLS_PRIVATE(cache_slots); |
264 | | /** Number of slots that are not used for anything. */ |
265 | | size_t MBEDTLS_PRIVATE(empty_slots); |
266 | | /** Number of slots that are locked. */ |
267 | | size_t MBEDTLS_PRIVATE(locked_slots); |
268 | | /** Largest key id value among open keys in internal persistent storage. */ |
269 | | psa_key_id_t MBEDTLS_PRIVATE(max_open_internal_key_id); |
270 | | /** Largest key id value among open keys in secure elements. */ |
271 | | psa_key_id_t MBEDTLS_PRIVATE(max_open_external_key_id); |
272 | | } mbedtls_psa_stats_t; |
273 | | |
274 | | /** \brief Get statistics about |
275 | | * resource consumption related to the PSA keystore. |
276 | | * |
277 | | * \note When Mbed TLS is built as part of a service, with isolation |
278 | | * between the application and the keystore, the service may or |
279 | | * may not expose this function. |
280 | | */ |
281 | | void mbedtls_psa_get_stats(mbedtls_psa_stats_t *stats); |
282 | | |
283 | | /** |
284 | | * \brief Inject an initial entropy seed for the random generator into |
285 | | * secure storage. |
286 | | * |
287 | | * This function injects data to be used as a seed for the random generator |
288 | | * used by the PSA Crypto implementation. On devices that lack a trusted |
289 | | * entropy source (preferably a hardware random number generator), |
290 | | * the Mbed PSA Crypto implementation uses this value to seed its |
291 | | * random generator. |
292 | | * |
293 | | * On devices without a trusted entropy source, this function must be |
294 | | * called exactly once in the lifetime of the device. On devices with |
295 | | * a trusted entropy source, calling this function is optional. |
296 | | * In all cases, this function may only be called before calling any |
297 | | * other function in the PSA Crypto API, including psa_crypto_init(). |
298 | | * |
299 | | * When this function returns successfully, it populates a file in |
300 | | * persistent storage. Once the file has been created, this function |
301 | | * can no longer succeed. |
302 | | * |
303 | | * If any error occurs, this function does not change the system state. |
304 | | * You can call this function again after correcting the reason for the |
305 | | * error if possible. |
306 | | * |
307 | | * \warning This function **can** fail! Callers MUST check the return status. |
308 | | * |
309 | | * \warning If you use this function, you should use it as part of a |
310 | | * factory provisioning process. The value of the injected seed |
311 | | * is critical to the security of the device. It must be |
312 | | * *secret*, *unpredictable* and (statistically) *unique per device*. |
313 | | * You should be generate it randomly using a cryptographically |
314 | | * secure random generator seeded from trusted entropy sources. |
315 | | * You should transmit it securely to the device and ensure |
316 | | * that its value is not leaked or stored anywhere beyond the |
317 | | * needs of transmitting it from the point of generation to |
318 | | * the call of this function, and erase all copies of the value |
319 | | * once this function returns. |
320 | | * |
321 | | * This is an Mbed TLS extension. |
322 | | * |
323 | | * \note This function is only available on the following platforms: |
324 | | * * If the compile-time option MBEDTLS_PSA_INJECT_ENTROPY is enabled. |
325 | | * Note that you must provide compatible implementations of |
326 | | * mbedtls_nv_seed_read and mbedtls_nv_seed_write. |
327 | | * * In a client-server integration of PSA Cryptography, on the client side, |
328 | | * if the server supports this feature. |
329 | | * \param[in] seed Buffer containing the seed value to inject. |
330 | | * \param[in] seed_size Size of the \p seed buffer. |
331 | | * The size of the seed in bytes must be greater |
332 | | * or equal to both #MBEDTLS_ENTROPY_BLOCK_SIZE |
333 | | * and the value of \c MBEDTLS_ENTROPY_MIN_PLATFORM |
334 | | * in `library/entropy_poll.h` in the Mbed TLS source |
335 | | * code. |
336 | | * It must be less or equal to |
337 | | * #MBEDTLS_ENTROPY_MAX_SEED_SIZE. |
338 | | * |
339 | | * \retval #PSA_SUCCESS |
340 | | * The seed value was injected successfully. The random generator |
341 | | * of the PSA Crypto implementation is now ready for use. |
342 | | * You may now call psa_crypto_init() and use the PSA Crypto |
343 | | * implementation. |
344 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
345 | | * \p seed_size is out of range. |
346 | | * \retval #PSA_ERROR_STORAGE_FAILURE |
347 | | * There was a failure reading or writing from storage. |
348 | | * \retval #PSA_ERROR_NOT_PERMITTED |
349 | | * The library has already been initialized. It is no longer |
350 | | * possible to call this function. |
351 | | */ |
352 | | psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed, |
353 | | size_t seed_size); |
354 | | |
355 | | /** \addtogroup crypto_types |
356 | | * @{ |
357 | | */ |
358 | | |
359 | | /** DSA public key. |
360 | | * |
361 | | * The import and export format is the |
362 | | * representation of the public key `y = g^x mod p` as a big-endian byte |
363 | | * string. The length of the byte string is the length of the base prime `p` |
364 | | * in bytes. |
365 | | */ |
366 | 0 | #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t) 0x4002) |
367 | | |
368 | | /** DSA key pair (private and public key). |
369 | | * |
370 | | * The import and export format is the |
371 | | * representation of the private key `x` as a big-endian byte string. The |
372 | | * length of the byte string is the private key size in bytes (leading zeroes |
373 | | * are not stripped). |
374 | | * |
375 | | * Deterministic DSA key derivation with psa_generate_derived_key follows |
376 | | * FIPS 186-4 §B.1.2: interpret the byte string as integer |
377 | | * in big-endian order. Discard it if it is not in the range |
378 | | * [0, *N* - 2] where *N* is the boundary of the private key domain |
379 | | * (the prime *p* for Diffie-Hellman, the subprime *q* for DSA, |
380 | | * or the order of the curve's base point for ECC). |
381 | | * Add 1 to the resulting integer and use this as the private key *x*. |
382 | | * |
383 | | */ |
384 | 0 | #define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t) 0x7002) |
385 | | |
386 | | /** Whether a key type is a DSA key (pair or public-only). */ |
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 | 0 | #define PSA_ALG_DSA_BASE ((psa_algorithm_t) 0x06000400) |
391 | | /** DSA signature with hashing. |
392 | | * |
393 | | * This is the signature scheme defined by FIPS 186-4, |
394 | | * with a random per-message secret number (*k*). |
395 | | * |
396 | | * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that |
397 | | * #PSA_ALG_IS_HASH(\p hash_alg) is true). |
398 | | * This includes #PSA_ALG_ANY_HASH |
399 | | * when specifying the algorithm in a usage policy. |
400 | | * |
401 | | * \return The corresponding DSA signature algorithm. |
402 | | * \return Unspecified if \p hash_alg is not a supported |
403 | | * hash algorithm. |
404 | | */ |
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 | 0 | #define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG |
409 | | /** Deterministic DSA signature with hashing. |
410 | | * |
411 | | * This is the deterministic variant defined by RFC 6979 of |
412 | | * the signature scheme defined by FIPS 186-4. |
413 | | * |
414 | | * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that |
415 | | * #PSA_ALG_IS_HASH(\p hash_alg) is true). |
416 | | * This includes #PSA_ALG_ANY_HASH |
417 | | * when specifying the algorithm in a usage policy. |
418 | | * |
419 | | * \return The corresponding DSA signature algorithm. |
420 | | * \return Unspecified if \p hash_alg is not a supported |
421 | | * hash algorithm. |
422 | | */ |
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 | 0 | (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \ |
427 | 0 | 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 | 0 | PSA_ALG_IS_DSA(alg) |
441 | | |
442 | | /**@}*/ |
443 | | |
444 | | /** \addtogroup attributes |
445 | | * @{ |
446 | | */ |
447 | | |
448 | | /** PAKE operation stages. */ |
449 | 0 | #define PSA_PAKE_OPERATION_STAGE_SETUP 0 |
450 | 0 | #define PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS 1 |
451 | 0 | #define PSA_PAKE_OPERATION_STAGE_COMPUTATION 2 |
452 | | |
453 | | /**@}*/ |
454 | | |
455 | | |
456 | | /** \defgroup psa_external_rng External random generator |
457 | | * @{ |
458 | | */ |
459 | | |
460 | | #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) |
461 | | /** External random generator function, implemented by the platform. |
462 | | * |
463 | | * When the compile-time option #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled, |
464 | | * this function replaces Mbed TLS's entropy and DRBG modules for all |
465 | | * random generation triggered via PSA crypto interfaces. |
466 | | * |
467 | | * \note This random generator must deliver random numbers with cryptographic |
468 | | * quality and high performance. It must supply unpredictable numbers |
469 | | * with a uniform distribution. The implementation of this function |
470 | | * is responsible for ensuring that the random generator is seeded |
471 | | * with sufficient entropy. If you have a hardware TRNG which is slow |
472 | | * or delivers non-uniform output, declare it as an entropy source |
473 | | * with mbedtls_entropy_add_source() instead of enabling this option. |
474 | | * |
475 | | * \param[in,out] context Pointer to the random generator context. |
476 | | * This is all-bits-zero on the first call |
477 | | * and preserved between successive calls. |
478 | | * \param[out] output Output buffer. On success, this buffer |
479 | | * contains random data with a uniform |
480 | | * distribution. |
481 | | * \param output_size The size of the \p output buffer in bytes. |
482 | | * \param[out] output_length On success, set this value to \p output_size. |
483 | | * |
484 | | * \retval #PSA_SUCCESS |
485 | | * Success. The output buffer contains \p output_size bytes of |
486 | | * cryptographic-quality random data, and \c *output_length is |
487 | | * set to \p output_size. |
488 | | * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY |
489 | | * The random generator requires extra entropy and there is no |
490 | | * way to obtain entropy under current environment conditions. |
491 | | * This error should not happen under normal circumstances since |
492 | | * this function is responsible for obtaining as much entropy as |
493 | | * it needs. However implementations of this function may return |
494 | | * #PSA_ERROR_INSUFFICIENT_ENTROPY if there is no way to obtain |
495 | | * entropy without blocking indefinitely. |
496 | | * \retval #PSA_ERROR_HARDWARE_FAILURE |
497 | | * A failure of the random generator hardware that isn't covered |
498 | | * by #PSA_ERROR_INSUFFICIENT_ENTROPY. |
499 | | */ |
500 | | psa_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 | | |
505 | | /**@}*/ |
506 | | |
507 | | /** \defgroup psa_builtin_keys Built-in keys |
508 | | * @{ |
509 | | */ |
510 | | |
511 | | /** The minimum value for a key identifier that is built into the |
512 | | * implementation. |
513 | | * |
514 | | * The range of key identifiers from #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN |
515 | | * to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX within the range from |
516 | | * #PSA_KEY_ID_VENDOR_MIN and #PSA_KEY_ID_VENDOR_MAX and must not intersect |
517 | | * with any other set of implementation-chosen key identifiers. |
518 | | * |
519 | | * This value is part of the library's API since changing it would invalidate |
520 | | * the values of built-in key identifiers in applications. |
521 | | */ |
522 | 0 | #define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000) |
523 | | |
524 | | /** The maximum value for a key identifier that is built into the |
525 | | * implementation. |
526 | | * |
527 | | * See #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN for more information. |
528 | | */ |
529 | 0 | #define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t) 0x7fffefff) |
530 | | |
531 | | /** A slot number identifying a key in a driver. |
532 | | * |
533 | | * Values of this type are used to identify built-in keys. |
534 | | */ |
535 | | typedef uint64_t psa_drv_slot_number_t; |
536 | | |
537 | | #if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS) |
538 | | /** Test whether a key identifier belongs to the builtin key range. |
539 | | * |
540 | | * \param key_id Key identifier to test. |
541 | | * |
542 | | * \retval 1 |
543 | | * The key identifier is a builtin key identifier. |
544 | | * \retval 0 |
545 | | * The key identifier is not a builtin key identifier. |
546 | | */ |
547 | | static inline int psa_key_id_is_builtin(psa_key_id_t key_id) |
548 | 0 | { |
549 | 0 | return (key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN) && |
550 | 0 | (key_id <= MBEDTLS_PSA_KEY_ID_BUILTIN_MAX); |
551 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_key_id_is_builtin Unexecuted instantiation: platform_builtin_keys.c:psa_key_id_is_builtin Unexecuted instantiation: helpers.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_helpers.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_stubs.c:psa_key_id_is_builtin Unexecuted instantiation: psa_exercise_key.c:psa_key_id_is_builtin Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_key_id_is_builtin Unexecuted instantiation: certs.c:psa_key_id_is_builtin Unexecuted instantiation: psa_test_wrappers.c:psa_key_id_is_builtin Unexecuted instantiation: x509_crl.c:psa_key_id_is_builtin Unexecuted instantiation: x509.c:psa_key_id_is_builtin Unexecuted instantiation: oid.c:psa_key_id_is_builtin Unexecuted instantiation: pk.c:psa_key_id_is_builtin Unexecuted instantiation: pk_ecc.c:psa_key_id_is_builtin Unexecuted instantiation: pk_wrap.c:psa_key_id_is_builtin Unexecuted instantiation: pkparse.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_aead.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_cipher.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_client.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_ecp.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_ffdh.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_hash.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_mac.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_pake.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_rsa.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_se.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_slot_management.c:psa_key_id_is_builtin Unexecuted instantiation: psa_crypto_storage.c:psa_key_id_is_builtin Unexecuted instantiation: psa_util.c:psa_key_id_is_builtin Unexecuted instantiation: rsa.c:psa_key_id_is_builtin Unexecuted instantiation: md.c:psa_key_id_is_builtin Unexecuted instantiation: pkcs12.c:psa_key_id_is_builtin Unexecuted instantiation: pkcs5.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_pkcs7.c:psa_key_id_is_builtin Unexecuted instantiation: pkcs7.c:psa_key_id_is_builtin Unexecuted instantiation: x509_crt.c:psa_key_id_is_builtin Unexecuted instantiation: pem.c:psa_key_id_is_builtin Unexecuted instantiation: cipher.c:psa_key_id_is_builtin Unexecuted instantiation: cipher_wrap.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_server.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_msg.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_ticket.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls12_client.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls12_server.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls13_keys.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls13_server.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls13_client.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_tls13_generic.c:psa_key_id_is_builtin Unexecuted instantiation: debug.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_ciphersuites.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_client.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_x509csr.c:psa_key_id_is_builtin Unexecuted instantiation: x509_csr.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_client.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_dtlsclient.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_dtlsserver.c:psa_key_id_is_builtin Unexecuted instantiation: ssl_cookie.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_x509crt.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_privkey.c:psa_key_id_is_builtin Unexecuted instantiation: fuzz_pubkey.c:psa_key_id_is_builtin |
552 | | |
553 | | /** Platform function to obtain the location and slot number of a built-in key. |
554 | | * |
555 | | * An application-specific implementation of this function must be provided if |
556 | | * #MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS is enabled. This would typically be provided |
557 | | * as part of a platform's system image. |
558 | | * |
559 | | * #MBEDTLS_SVC_KEY_ID_GET_KEY_ID(\p key_id) needs to be in the range from |
560 | | * #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX. |
561 | | * |
562 | | * In a multi-application configuration |
563 | | * (\c MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER is defined), |
564 | | * this function should check that #MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(\p key_id) |
565 | | * is allowed to use the given key. |
566 | | * |
567 | | * \param key_id The key ID for which to retrieve the |
568 | | * location and slot attributes. |
569 | | * \param[out] lifetime On success, the lifetime associated with the key |
570 | | * corresponding to \p key_id. Lifetime is a |
571 | | * combination of which driver contains the key, |
572 | | * and with what persistence level the key is |
573 | | * intended to be used. If the platform |
574 | | * implementation does not contain specific |
575 | | * information about the intended key persistence |
576 | | * level, the persistence level may be reported as |
577 | | * #PSA_KEY_PERSISTENCE_DEFAULT. |
578 | | * \param[out] slot_number On success, the slot number known to the driver |
579 | | * registered at the lifetime location reported |
580 | | * through \p lifetime which corresponds to the |
581 | | * requested built-in key. |
582 | | * |
583 | | * \retval #PSA_SUCCESS |
584 | | * The requested key identifier designates a built-in key. |
585 | | * In a multi-application configuration, the requested owner |
586 | | * is allowed to access it. |
587 | | * \retval #PSA_ERROR_DOES_NOT_EXIST |
588 | | * The requested key identifier is not a built-in key which is known |
589 | | * to this function. If a key exists in the key storage with this |
590 | | * identifier, the data from the storage will be used. |
591 | | * \return (any other error) |
592 | | * Any other error is propagated to the function that requested the key. |
593 | | * Common errors include: |
594 | | * - #PSA_ERROR_NOT_PERMITTED: the key exists but the requested owner |
595 | | * is not allowed to access it. |
596 | | */ |
597 | | psa_status_t mbedtls_psa_platform_get_builtin_key( |
598 | | mbedtls_svc_key_id_t key_id, |
599 | | psa_key_lifetime_t *lifetime, |
600 | | psa_drv_slot_number_t *slot_number); |
601 | | #endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */ |
602 | | |
603 | | /** @} */ |
604 | | |
605 | | /** \defgroup psa_crypto_client Functions defined by a client provider |
606 | | * |
607 | | * The functions in this group are meant to be implemented by providers of |
608 | | * the PSA Crypto client interface. They are provided by the library when |
609 | | * #MBEDTLS_PSA_CRYPTO_C is enabled. |
610 | | * |
611 | | * \note All functions in this group are experimental, as using |
612 | | * alternative client interface providers is experimental. |
613 | | * |
614 | | * @{ |
615 | | */ |
616 | | |
617 | | /** Check if PSA is capable of handling the specified hash algorithm. |
618 | | * |
619 | | * This means that PSA core was built with the corresponding PSA_WANT_ALG_xxx |
620 | | * set and that psa_crypto_init has already been called. |
621 | | * |
622 | | * \note When using the built-in version of the PSA core (i.e. |
623 | | * #MBEDTLS_PSA_CRYPTO_C is set), for now, this function only checks |
624 | | * the state of the driver subsystem, not the algorithm. |
625 | | * This might be improved in the future. |
626 | | * |
627 | | * \param hash_alg The hash algorithm. |
628 | | * |
629 | | * \return 1 if the PSA can handle \p hash_alg, 0 otherwise. |
630 | | */ |
631 | | int psa_can_do_hash(psa_algorithm_t hash_alg); |
632 | | |
633 | | /** |
634 | | * Tell if PSA is ready for this cipher. |
635 | | * |
636 | | * \note When using the built-in version of the PSA core (i.e. |
637 | | * #MBEDTLS_PSA_CRYPTO_C is set), for now, this function only checks |
638 | | * the state of the driver subsystem, not the key type and algorithm. |
639 | | * This might be improved in the future. |
640 | | * |
641 | | * \param key_type The key type. |
642 | | * \param cipher_alg The cipher algorithm. |
643 | | * |
644 | | * \return 1 if the PSA can handle \p cipher_alg, 0 otherwise. |
645 | | */ |
646 | | int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg); |
647 | | |
648 | | /**@}*/ |
649 | | |
650 | | /** \addtogroup crypto_types |
651 | | * @{ |
652 | | */ |
653 | | |
654 | 0 | #define PSA_ALG_CATEGORY_PAKE ((psa_algorithm_t) 0x0a000000) |
655 | | |
656 | | /** Whether the specified algorithm is a password-authenticated key exchange. |
657 | | * |
658 | | * \param alg An algorithm identifier (value of type #psa_algorithm_t). |
659 | | * |
660 | | * \return 1 if \p alg is a password-authenticated key exchange (PAKE) |
661 | | * algorithm, 0 otherwise. |
662 | | * This macro may return either 0 or 1 if \p alg is not a supported |
663 | | * algorithm identifier. |
664 | | */ |
665 | | #define PSA_ALG_IS_PAKE(alg) \ |
666 | 0 | (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_PAKE) |
667 | | |
668 | | /** The Password-authenticated key exchange by juggling (J-PAKE) algorithm. |
669 | | * |
670 | | * This is J-PAKE as defined by RFC 8236, instantiated with the following |
671 | | * parameters: |
672 | | * |
673 | | * - The group can be either an elliptic curve or defined over a finite field. |
674 | | * - Schnorr NIZK proof as defined by RFC 8235 and using the same group as the |
675 | | * J-PAKE algorithm. |
676 | | * - A cryptographic hash function. |
677 | | * |
678 | | * To select these parameters and set up the cipher suite, call these functions |
679 | | * in any order: |
680 | | * |
681 | | * \code |
682 | | * psa_pake_cs_set_algorithm(cipher_suite, PSA_ALG_JPAKE); |
683 | | * psa_pake_cs_set_primitive(cipher_suite, |
684 | | * PSA_PAKE_PRIMITIVE(type, family, bits)); |
685 | | * psa_pake_cs_set_hash(cipher_suite, hash); |
686 | | * \endcode |
687 | | * |
688 | | * For more information on how to set a specific curve or field, refer to the |
689 | | * documentation of the individual \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants. |
690 | | * |
691 | | * After initializing a J-PAKE operation, call |
692 | | * |
693 | | * \code |
694 | | * psa_pake_setup(operation, cipher_suite); |
695 | | * psa_pake_set_user(operation, ...); |
696 | | * psa_pake_set_peer(operation, ...); |
697 | | * psa_pake_set_password_key(operation, ...); |
698 | | * \endcode |
699 | | * |
700 | | * The password is provided as a key. This can be the password text itself, |
701 | | * in an agreed character encoding, or some value derived from the password |
702 | | * as required by a higher level protocol. |
703 | | * |
704 | | * (The implementation converts the key material to a number as described in |
705 | | * Section 2.3.8 of _SEC 1: Elliptic Curve Cryptography_ |
706 | | * (https://www.secg.org/sec1-v2.pdf), before reducing it modulo \c q. Here |
707 | | * \c q is order of the group defined by the primitive set in the cipher suite. |
708 | | * The \c psa_pake_set_password_key() function returns an error if the result |
709 | | * of the reduction is 0.) |
710 | | * |
711 | | * The key exchange flow for J-PAKE is as follows: |
712 | | * -# To get the first round data that needs to be sent to the peer, call |
713 | | * \code |
714 | | * // Get g1 |
715 | | * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
716 | | * // Get the ZKP public key for x1 |
717 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
718 | | * // Get the ZKP proof for x1 |
719 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
720 | | * // Get g2 |
721 | | * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
722 | | * // Get the ZKP public key for x2 |
723 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
724 | | * // Get the ZKP proof for x2 |
725 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
726 | | * \endcode |
727 | | * -# To provide the first round data received from the peer to the operation, |
728 | | * call |
729 | | * \code |
730 | | * // Set g3 |
731 | | * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
732 | | * // Set the ZKP public key for x3 |
733 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
734 | | * // Set the ZKP proof for x3 |
735 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
736 | | * // Set g4 |
737 | | * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
738 | | * // Set the ZKP public key for x4 |
739 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
740 | | * // Set the ZKP proof for x4 |
741 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
742 | | * \endcode |
743 | | * -# To get the second round data that needs to be sent to the peer, call |
744 | | * \code |
745 | | * // Get A |
746 | | * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
747 | | * // Get ZKP public key for x2*s |
748 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
749 | | * // Get ZKP proof for x2*s |
750 | | * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
751 | | * \endcode |
752 | | * -# To provide the second round data received from the peer to the operation, |
753 | | * call |
754 | | * \code |
755 | | * // Set B |
756 | | * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...); |
757 | | * // Set ZKP public key for x4*s |
758 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...); |
759 | | * // Set ZKP proof for x4*s |
760 | | * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...); |
761 | | * \endcode |
762 | | * -# To access the shared secret call |
763 | | * \code |
764 | | * // Get Ka=Kb=K |
765 | | * psa_pake_get_implicit_key() |
766 | | * \endcode |
767 | | * |
768 | | * For more information consult the documentation of the individual |
769 | | * \c PSA_PAKE_STEP_XXX constants. |
770 | | * |
771 | | * At this point there is a cryptographic guarantee that only the authenticated |
772 | | * party who used the same password is able to compute the key. But there is no |
773 | | * guarantee that the peer is the party it claims to be and was able to do so. |
774 | | * |
775 | | * That is, the authentication is only implicit (the peer is not authenticated |
776 | | * at this point, and no action should be taken that assume that they are - like |
777 | | * for example accessing restricted files). |
778 | | * |
779 | | * To make the authentication explicit there are various methods, see Section 5 |
780 | | * of RFC 8236 for two examples. |
781 | | * |
782 | | * \note The JPAKE implementation has the following limitations: |
783 | | * - The only supported primitive is ECC on the curve secp256r1, i.e. |
784 | | * `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, |
785 | | * PSA_ECC_FAMILY_SECP_R1, 256)`. |
786 | | * - The only supported hash algorithm is SHA-256, i.e. |
787 | | * `PSA_ALG_SHA_256`. |
788 | | * - When using the built-in implementation, the user ID and the peer ID |
789 | | * must be `"client"` (6-byte string) and `"server"` (6-byte string), |
790 | | * or the other way round. |
791 | | * Third-party drivers may or may not have this limitation. |
792 | | * |
793 | | */ |
794 | 0 | #define PSA_ALG_JPAKE ((psa_algorithm_t) 0x0a000100) |
795 | | |
796 | | /** @} */ |
797 | | |
798 | | /** \defgroup pake Password-authenticated key exchange (PAKE) |
799 | | * |
800 | | * This is a proposed PAKE interface for the PSA Crypto API. It is not part of |
801 | | * the official PSA Crypto API yet. |
802 | | * |
803 | | * \note The content of this section is not part of the stable API and ABI |
804 | | * of Mbed TLS and may change arbitrarily from version to version. |
805 | | * Same holds for the corresponding macros #PSA_ALG_CATEGORY_PAKE and |
806 | | * #PSA_ALG_JPAKE. |
807 | | * @{ |
808 | | */ |
809 | | |
810 | | /** \brief Encoding of the application role of PAKE |
811 | | * |
812 | | * Encodes the application's role in the algorithm is being executed. For more |
813 | | * information see the documentation of individual \c PSA_PAKE_ROLE_XXX |
814 | | * constants. |
815 | | */ |
816 | | typedef uint8_t psa_pake_role_t; |
817 | | |
818 | | /** Encoding of input and output indicators for PAKE. |
819 | | * |
820 | | * Some PAKE algorithms need to exchange more data than just a single key share. |
821 | | * This type is for encoding additional input and output data for such |
822 | | * algorithms. |
823 | | */ |
824 | | typedef uint8_t psa_pake_step_t; |
825 | | |
826 | | /** Encoding of the type of the PAKE's primitive. |
827 | | * |
828 | | * Values defined by this standard will never be in the range 0x80-0xff. |
829 | | * Vendors who define additional types must use an encoding in this range. |
830 | | * |
831 | | * For more information see the documentation of individual |
832 | | * \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants. |
833 | | */ |
834 | | typedef uint8_t psa_pake_primitive_type_t; |
835 | | |
836 | | /** \brief Encoding of the family of the primitive associated with the PAKE. |
837 | | * |
838 | | * For more information see the documentation of individual |
839 | | * \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants. |
840 | | */ |
841 | | typedef uint8_t psa_pake_family_t; |
842 | | |
843 | | /** \brief Encoding of the primitive associated with the PAKE. |
844 | | * |
845 | | * For more information see the documentation of the #PSA_PAKE_PRIMITIVE macro. |
846 | | */ |
847 | | typedef uint32_t psa_pake_primitive_t; |
848 | | |
849 | | /** A value to indicate no role in a PAKE algorithm. |
850 | | * This value can be used in a call to psa_pake_set_role() for symmetric PAKE |
851 | | * algorithms which do not assign roles. |
852 | | */ |
853 | 0 | #define PSA_PAKE_ROLE_NONE ((psa_pake_role_t) 0x00) |
854 | | |
855 | | /** The first peer in a balanced PAKE. |
856 | | * |
857 | | * Although balanced PAKE algorithms are symmetric, some of them needs an |
858 | | * ordering of peers for the transcript calculations. If the algorithm does not |
859 | | * need this, both #PSA_PAKE_ROLE_FIRST and #PSA_PAKE_ROLE_SECOND are |
860 | | * accepted. |
861 | | */ |
862 | | #define PSA_PAKE_ROLE_FIRST ((psa_pake_role_t) 0x01) |
863 | | |
864 | | /** The second peer in a balanced PAKE. |
865 | | * |
866 | | * Although balanced PAKE algorithms are symmetric, some of them needs an |
867 | | * ordering of peers for the transcript calculations. If the algorithm does not |
868 | | * need this, either #PSA_PAKE_ROLE_FIRST or #PSA_PAKE_ROLE_SECOND are |
869 | | * accepted. |
870 | | */ |
871 | | #define PSA_PAKE_ROLE_SECOND ((psa_pake_role_t) 0x02) |
872 | | |
873 | | /** The client in an augmented PAKE. |
874 | | * |
875 | | * Augmented PAKE algorithms need to differentiate between client and server. |
876 | | */ |
877 | | #define PSA_PAKE_ROLE_CLIENT ((psa_pake_role_t) 0x11) |
878 | | |
879 | | /** The server in an augmented PAKE. |
880 | | * |
881 | | * Augmented PAKE algorithms need to differentiate between client and server. |
882 | | */ |
883 | | #define PSA_PAKE_ROLE_SERVER ((psa_pake_role_t) 0x12) |
884 | | |
885 | | /** The PAKE primitive type indicating the use of elliptic curves. |
886 | | * |
887 | | * The values of the \c family and \c bits fields of the cipher suite identify a |
888 | | * specific elliptic curve, using the same mapping that is used for ECC |
889 | | * (::psa_ecc_family_t) keys. |
890 | | * |
891 | | * (Here \c family means the value returned by psa_pake_cs_get_family() and |
892 | | * \c bits means the value returned by psa_pake_cs_get_bits().) |
893 | | * |
894 | | * Input and output during the operation can involve group elements and scalar |
895 | | * values: |
896 | | * -# The format for group elements is the same as for public keys on the |
897 | | * specific curve would be. For more information, consult the documentation of |
898 | | * psa_export_public_key(). |
899 | | * -# The format for scalars is the same as for private keys on the specific |
900 | | * curve would be. For more information, consult the documentation of |
901 | | * psa_export_key(). |
902 | | */ |
903 | 0 | #define PSA_PAKE_PRIMITIVE_TYPE_ECC ((psa_pake_primitive_type_t) 0x01) |
904 | | |
905 | | /** The PAKE primitive type indicating the use of Diffie-Hellman groups. |
906 | | * |
907 | | * The values of the \c family and \c bits fields of the cipher suite identify |
908 | | * a specific Diffie-Hellman group, using the same mapping that is used for |
909 | | * Diffie-Hellman (::psa_dh_family_t) keys. |
910 | | * |
911 | | * (Here \c family means the value returned by psa_pake_cs_get_family() and |
912 | | * \c bits means the value returned by psa_pake_cs_get_bits().) |
913 | | * |
914 | | * Input and output during the operation can involve group elements and scalar |
915 | | * values: |
916 | | * -# The format for group elements is the same as for public keys on the |
917 | | * specific group would be. For more information, consult the documentation of |
918 | | * psa_export_public_key(). |
919 | | * -# The format for scalars is the same as for private keys on the specific |
920 | | * group would be. For more information, consult the documentation of |
921 | | * psa_export_key(). |
922 | | */ |
923 | | #define PSA_PAKE_PRIMITIVE_TYPE_DH ((psa_pake_primitive_type_t) 0x02) |
924 | | |
925 | | /** Construct a PAKE primitive from type, family and bit-size. |
926 | | * |
927 | | * \param pake_type The type of the primitive |
928 | | * (value of type ::psa_pake_primitive_type_t). |
929 | | * \param pake_family The family of the primitive |
930 | | * (the type and interpretation of this parameter depends |
931 | | * on \p pake_type, for more information consult the |
932 | | * documentation of individual ::psa_pake_primitive_type_t |
933 | | * constants). |
934 | | * \param pake_bits The bit-size of the primitive |
935 | | * (Value of type \c size_t. The interpretation |
936 | | * of this parameter depends on \p pake_family, for more |
937 | | * information consult the documentation of individual |
938 | | * ::psa_pake_primitive_type_t constants). |
939 | | * |
940 | | * \return The constructed primitive value of type ::psa_pake_primitive_t. |
941 | | * Return 0 if the requested primitive can't be encoded as |
942 | | * ::psa_pake_primitive_t. |
943 | | */ |
944 | | #define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits) \ |
945 | 0 | ((pake_bits & 0xFFFF) != pake_bits) ? 0 : \ |
946 | 0 | ((psa_pake_primitive_t) (((pake_type) << 24 | \ |
947 | 0 | (pake_family) << 16) | (pake_bits))) |
948 | | |
949 | | /** The key share being sent to or received from the peer. |
950 | | * |
951 | | * The format for both input and output at this step is the same as for public |
952 | | * keys on the group determined by the primitive (::psa_pake_primitive_t) would |
953 | | * be. |
954 | | * |
955 | | * For more information on the format, consult the documentation of |
956 | | * psa_export_public_key(). |
957 | | * |
958 | | * For information regarding how the group is determined, consult the |
959 | | * documentation #PSA_PAKE_PRIMITIVE. |
960 | | */ |
961 | 0 | #define PSA_PAKE_STEP_KEY_SHARE ((psa_pake_step_t) 0x01) |
962 | | |
963 | | /** A Schnorr NIZKP public key. |
964 | | * |
965 | | * This is the ephemeral public key in the Schnorr Non-Interactive |
966 | | * Zero-Knowledge Proof (the value denoted by the letter 'V' in RFC 8235). |
967 | | * |
968 | | * The format for both input and output at this step is the same as for public |
969 | | * keys on the group determined by the primitive (::psa_pake_primitive_t) would |
970 | | * be. |
971 | | * |
972 | | * For more information on the format, consult the documentation of |
973 | | * psa_export_public_key(). |
974 | | * |
975 | | * For information regarding how the group is determined, consult the |
976 | | * documentation #PSA_PAKE_PRIMITIVE. |
977 | | */ |
978 | 0 | #define PSA_PAKE_STEP_ZK_PUBLIC ((psa_pake_step_t) 0x02) |
979 | | |
980 | | /** A Schnorr NIZKP proof. |
981 | | * |
982 | | * This is the proof in the Schnorr Non-Interactive Zero-Knowledge Proof (the |
983 | | * value denoted by the letter 'r' in RFC 8235). |
984 | | * |
985 | | * Both for input and output, the value at this step is an integer less than |
986 | | * the order of the group selected in the cipher suite. The format depends on |
987 | | * the group as well: |
988 | | * |
989 | | * - For Montgomery curves, the encoding is little endian. |
990 | | * - For everything else the encoding is big endian (see Section 2.3.8 of |
991 | | * _SEC 1: Elliptic Curve Cryptography_ at https://www.secg.org/sec1-v2.pdf). |
992 | | * |
993 | | * In both cases leading zeroes are allowed as long as the length in bytes does |
994 | | * not exceed the byte length of the group order. |
995 | | * |
996 | | * For information regarding how the group is determined, consult the |
997 | | * documentation #PSA_PAKE_PRIMITIVE. |
998 | | */ |
999 | 0 | #define PSA_PAKE_STEP_ZK_PROOF ((psa_pake_step_t) 0x03) |
1000 | | |
1001 | | /**@}*/ |
1002 | | |
1003 | | /** A sufficient output buffer size for psa_pake_output(). |
1004 | | * |
1005 | | * If the size of the output buffer is at least this large, it is guaranteed |
1006 | | * that psa_pake_output() will not fail due to an insufficient output buffer |
1007 | | * size. The actual size of the output might be smaller in any given call. |
1008 | | * |
1009 | | * See also #PSA_PAKE_OUTPUT_MAX_SIZE |
1010 | | * |
1011 | | * \param alg A PAKE algorithm (\c PSA_ALG_XXX value such that |
1012 | | * #PSA_ALG_IS_PAKE(\p alg) is true). |
1013 | | * \param primitive A primitive of type ::psa_pake_primitive_t that is |
1014 | | * compatible with algorithm \p alg. |
1015 | | * \param output_step A value of type ::psa_pake_step_t that is valid for the |
1016 | | * algorithm \p alg. |
1017 | | * \return A sufficient output buffer size for the specified |
1018 | | * PAKE algorithm, primitive, and output step. If the |
1019 | | * PAKE algorithm, primitive, or output step is not |
1020 | | * recognized, or the parameters are incompatible, |
1021 | | * return 0. |
1022 | | */ |
1023 | | #define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \ |
1024 | | (alg == PSA_ALG_JPAKE && \ |
1025 | | primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \ |
1026 | | PSA_ECC_FAMILY_SECP_R1, 256) ? \ |
1027 | | ( \ |
1028 | | output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \ |
1029 | | output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \ |
1030 | | 32 \ |
1031 | | ) : \ |
1032 | | 0) |
1033 | | |
1034 | | /** A sufficient input buffer size for psa_pake_input(). |
1035 | | * |
1036 | | * The value returned by this macro is guaranteed to be large enough for any |
1037 | | * valid input to psa_pake_input() in an operation with the specified |
1038 | | * parameters. |
1039 | | * |
1040 | | * See also #PSA_PAKE_INPUT_MAX_SIZE |
1041 | | * |
1042 | | * \param alg A PAKE algorithm (\c PSA_ALG_XXX value such that |
1043 | | * #PSA_ALG_IS_PAKE(\p alg) is true). |
1044 | | * \param primitive A primitive of type ::psa_pake_primitive_t that is |
1045 | | * compatible with algorithm \p alg. |
1046 | | * \param input_step A value of type ::psa_pake_step_t that is valid for the |
1047 | | * algorithm \p alg. |
1048 | | * \return A sufficient input buffer size for the specified |
1049 | | * input, cipher suite and algorithm. If the cipher suite, |
1050 | | * the input type or PAKE algorithm is not recognized, or |
1051 | | * the parameters are incompatible, return 0. |
1052 | | */ |
1053 | | #define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \ |
1054 | 0 | (alg == PSA_ALG_JPAKE && \ |
1055 | 0 | primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \ |
1056 | 0 | PSA_ECC_FAMILY_SECP_R1, 256) ? \ |
1057 | 0 | ( \ |
1058 | 0 | input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \ |
1059 | 0 | input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \ |
1060 | 0 | 32 \ |
1061 | 0 | ) : \ |
1062 | 0 | 0) |
1063 | | |
1064 | | /** Output buffer size for psa_pake_output() for any of the supported PAKE |
1065 | | * algorithm and primitive suites and output step. |
1066 | | * |
1067 | | * This macro must expand to a compile-time constant integer. |
1068 | | * |
1069 | | * The value of this macro must be at least as large as the largest value |
1070 | | * returned by PSA_PAKE_OUTPUT_SIZE() |
1071 | | * |
1072 | | * See also #PSA_PAKE_OUTPUT_SIZE(\p alg, \p primitive, \p output_step). |
1073 | | */ |
1074 | | #define PSA_PAKE_OUTPUT_MAX_SIZE 65 |
1075 | | |
1076 | | /** Input buffer size for psa_pake_input() for any of the supported PAKE |
1077 | | * algorithm and primitive suites and input step. |
1078 | | * |
1079 | | * This macro must expand to a compile-time constant integer. |
1080 | | * |
1081 | | * The value of this macro must be at least as large as the largest value |
1082 | | * returned by PSA_PAKE_INPUT_SIZE() |
1083 | | * |
1084 | | * See also #PSA_PAKE_INPUT_SIZE(\p alg, \p primitive, \p output_step). |
1085 | | */ |
1086 | | #define PSA_PAKE_INPUT_MAX_SIZE 65 |
1087 | | |
1088 | | /** Returns a suitable initializer for a PAKE cipher suite object of type |
1089 | | * psa_pake_cipher_suite_t. |
1090 | | */ |
1091 | 0 | #define PSA_PAKE_CIPHER_SUITE_INIT { PSA_ALG_NONE, 0, 0, 0, PSA_ALG_NONE } |
1092 | | |
1093 | | /** Returns a suitable initializer for a PAKE operation object of type |
1094 | | * psa_pake_operation_t. |
1095 | | */ |
1096 | | #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C) |
1097 | | #define PSA_PAKE_OPERATION_INIT { 0 } |
1098 | | #else |
1099 | 0 | #define PSA_PAKE_OPERATION_INIT { 0, PSA_ALG_NONE, 0, PSA_PAKE_OPERATION_STAGE_SETUP, \ |
1100 | 0 | { 0 }, { { 0 } } } |
1101 | | #endif |
1102 | | |
1103 | | struct psa_pake_cipher_suite_s { |
1104 | | psa_algorithm_t algorithm; |
1105 | | psa_pake_primitive_type_t type; |
1106 | | psa_pake_family_t family; |
1107 | | uint16_t bits; |
1108 | | psa_algorithm_t hash; |
1109 | | }; |
1110 | | |
1111 | | struct psa_crypto_driver_pake_inputs_s { |
1112 | | uint8_t *MBEDTLS_PRIVATE(password); |
1113 | | size_t MBEDTLS_PRIVATE(password_len); |
1114 | | uint8_t *MBEDTLS_PRIVATE(user); |
1115 | | size_t MBEDTLS_PRIVATE(user_len); |
1116 | | uint8_t *MBEDTLS_PRIVATE(peer); |
1117 | | size_t MBEDTLS_PRIVATE(peer_len); |
1118 | | psa_key_attributes_t MBEDTLS_PRIVATE(attributes); |
1119 | | struct psa_pake_cipher_suite_s MBEDTLS_PRIVATE(cipher_suite); |
1120 | | }; |
1121 | | |
1122 | | typedef enum psa_crypto_driver_pake_step { |
1123 | | PSA_JPAKE_STEP_INVALID = 0, /* Invalid step */ |
1124 | | PSA_JPAKE_X1_STEP_KEY_SHARE = 1, /* Round 1: input/output key share (for ephemeral private key X1).*/ |
1125 | | PSA_JPAKE_X1_STEP_ZK_PUBLIC = 2, /* Round 1: input/output Schnorr NIZKP public key for the X1 key */ |
1126 | | PSA_JPAKE_X1_STEP_ZK_PROOF = 3, /* Round 1: input/output Schnorr NIZKP proof for the X1 key */ |
1127 | | PSA_JPAKE_X2_STEP_KEY_SHARE = 4, /* Round 1: input/output key share (for ephemeral private key X2).*/ |
1128 | | PSA_JPAKE_X2_STEP_ZK_PUBLIC = 5, /* Round 1: input/output Schnorr NIZKP public key for the X2 key */ |
1129 | | PSA_JPAKE_X2_STEP_ZK_PROOF = 6, /* Round 1: input/output Schnorr NIZKP proof for the X2 key */ |
1130 | | PSA_JPAKE_X2S_STEP_KEY_SHARE = 7, /* Round 2: output X2S key (our key) */ |
1131 | | PSA_JPAKE_X2S_STEP_ZK_PUBLIC = 8, /* Round 2: output Schnorr NIZKP public key for the X2S key (our key) */ |
1132 | | PSA_JPAKE_X2S_STEP_ZK_PROOF = 9, /* Round 2: output Schnorr NIZKP proof for the X2S key (our key) */ |
1133 | | PSA_JPAKE_X4S_STEP_KEY_SHARE = 10, /* Round 2: input X4S key (from peer) */ |
1134 | | PSA_JPAKE_X4S_STEP_ZK_PUBLIC = 11, /* Round 2: input Schnorr NIZKP public key for the X4S key (from peer) */ |
1135 | | PSA_JPAKE_X4S_STEP_ZK_PROOF = 12 /* Round 2: input Schnorr NIZKP proof for the X4S key (from peer) */ |
1136 | | } psa_crypto_driver_pake_step_t; |
1137 | | |
1138 | | typedef enum psa_jpake_round { |
1139 | | PSA_JPAKE_FIRST = 0, |
1140 | | PSA_JPAKE_SECOND = 1, |
1141 | | PSA_JPAKE_FINISHED = 2 |
1142 | | } psa_jpake_round_t; |
1143 | | |
1144 | | typedef enum psa_jpake_io_mode { |
1145 | | PSA_JPAKE_INPUT = 0, |
1146 | | PSA_JPAKE_OUTPUT = 1 |
1147 | | } psa_jpake_io_mode_t; |
1148 | | |
1149 | | struct psa_jpake_computation_stage_s { |
1150 | | /* The J-PAKE round we are currently on */ |
1151 | | psa_jpake_round_t MBEDTLS_PRIVATE(round); |
1152 | | /* The 'mode' we are currently in (inputting or outputting) */ |
1153 | | psa_jpake_io_mode_t MBEDTLS_PRIVATE(io_mode); |
1154 | | /* The number of completed inputs so far this round */ |
1155 | | uint8_t MBEDTLS_PRIVATE(inputs); |
1156 | | /* The number of completed outputs so far this round */ |
1157 | | uint8_t MBEDTLS_PRIVATE(outputs); |
1158 | | /* The next expected step (KEY_SHARE, ZK_PUBLIC or ZK_PROOF) */ |
1159 | | psa_pake_step_t MBEDTLS_PRIVATE(step); |
1160 | | }; |
1161 | | |
1162 | 0 | #define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \ |
1163 | 0 | ((round) == PSA_JPAKE_FIRST ? 2 : 1)) |
1164 | 0 | #define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \ |
1165 | 0 | ((round) == PSA_JPAKE_FIRST ? 2 : 1)) |
1166 | | |
1167 | | struct psa_pake_operation_s { |
1168 | | #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C) |
1169 | | mbedtls_psa_client_handle_t handle; |
1170 | | #else |
1171 | | /** Unique ID indicating which driver got assigned to do the |
1172 | | * operation. Since driver contexts are driver-specific, swapping |
1173 | | * drivers halfway through the operation is not supported. |
1174 | | * ID values are auto-generated in psa_crypto_driver_wrappers.h |
1175 | | * ID value zero means the context is not valid or not assigned to |
1176 | | * any driver (i.e. none of the driver contexts are active). */ |
1177 | | unsigned int MBEDTLS_PRIVATE(id); |
1178 | | /* Algorithm of the PAKE operation */ |
1179 | | psa_algorithm_t MBEDTLS_PRIVATE(alg); |
1180 | | /* A primitive of type compatible with algorithm */ |
1181 | | psa_pake_primitive_t MBEDTLS_PRIVATE(primitive); |
1182 | | /* Stage of the PAKE operation: waiting for the setup, collecting inputs |
1183 | | * or computing. */ |
1184 | | uint8_t MBEDTLS_PRIVATE(stage); |
1185 | | /* Holds computation stage of the PAKE algorithms. */ |
1186 | | union { |
1187 | | uint8_t MBEDTLS_PRIVATE(dummy); |
1188 | | #if defined(PSA_WANT_ALG_JPAKE) |
1189 | | struct psa_jpake_computation_stage_s MBEDTLS_PRIVATE(jpake); |
1190 | | #endif |
1191 | | } MBEDTLS_PRIVATE(computation_stage); |
1192 | | union { |
1193 | | psa_driver_pake_context_t MBEDTLS_PRIVATE(ctx); |
1194 | | struct psa_crypto_driver_pake_inputs_s MBEDTLS_PRIVATE(inputs); |
1195 | | } MBEDTLS_PRIVATE(data); |
1196 | | #endif |
1197 | | }; |
1198 | | |
1199 | | /** \addtogroup pake |
1200 | | * @{ |
1201 | | */ |
1202 | | |
1203 | | /** The type of the data structure for PAKE cipher suites. |
1204 | | * |
1205 | | * This is an implementation-defined \c struct. Applications should not |
1206 | | * make any assumptions about the content of this structure. |
1207 | | * Implementation details can change in future versions without notice. |
1208 | | */ |
1209 | | typedef struct psa_pake_cipher_suite_s psa_pake_cipher_suite_t; |
1210 | | |
1211 | | /** Return an initial value for a PAKE cipher suite object. |
1212 | | */ |
1213 | | static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void); |
1214 | | |
1215 | | /** Retrieve the PAKE algorithm from a PAKE cipher suite. |
1216 | | * |
1217 | | * \param[in] cipher_suite The cipher suite structure to query. |
1218 | | * |
1219 | | * \return The PAKE algorithm stored in the cipher suite structure. |
1220 | | */ |
1221 | | static psa_algorithm_t psa_pake_cs_get_algorithm( |
1222 | | const psa_pake_cipher_suite_t *cipher_suite); |
1223 | | |
1224 | | /** Declare the PAKE algorithm for the cipher suite. |
1225 | | * |
1226 | | * This function overwrites any PAKE algorithm |
1227 | | * previously set in \p cipher_suite. |
1228 | | * |
1229 | | * \note For #PSA_ALG_JPAKE, the only supported hash algorithm is SHA-256. |
1230 | | * |
1231 | | * \param[out] cipher_suite The cipher suite structure to write to. |
1232 | | * \param algorithm The PAKE algorithm to write. |
1233 | | * (`PSA_ALG_XXX` values of type ::psa_algorithm_t |
1234 | | * such that #PSA_ALG_IS_PAKE(\c alg) is true.) |
1235 | | * If this is 0, the PAKE algorithm in |
1236 | | * \p cipher_suite becomes unspecified. |
1237 | | */ |
1238 | | static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite, |
1239 | | psa_algorithm_t algorithm); |
1240 | | |
1241 | | /** Retrieve the primitive from a PAKE cipher suite. |
1242 | | * |
1243 | | * \param[in] cipher_suite The cipher suite structure to query. |
1244 | | * |
1245 | | * \return The primitive stored in the cipher suite structure. |
1246 | | */ |
1247 | | static psa_pake_primitive_t psa_pake_cs_get_primitive( |
1248 | | const psa_pake_cipher_suite_t *cipher_suite); |
1249 | | |
1250 | | /** Declare the primitive for a PAKE cipher suite. |
1251 | | * |
1252 | | * This function overwrites any primitive previously set in \p cipher_suite. |
1253 | | * |
1254 | | * \note For #PSA_ALG_JPAKE, the only supported primitive is ECC on the curve |
1255 | | * secp256r1, i.e. `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, |
1256 | | * PSA_ECC_FAMILY_SECP_R1, 256)`. |
1257 | | * |
1258 | | * \param[out] cipher_suite The cipher suite structure to write to. |
1259 | | * \param primitive The primitive to write. If this is 0, the |
1260 | | * primitive type in \p cipher_suite becomes |
1261 | | * unspecified. |
1262 | | */ |
1263 | | static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite, |
1264 | | psa_pake_primitive_t primitive); |
1265 | | |
1266 | | /** Retrieve the PAKE family from a PAKE cipher suite. |
1267 | | * |
1268 | | * \param[in] cipher_suite The cipher suite structure to query. |
1269 | | * |
1270 | | * \return The PAKE family stored in the cipher suite structure. |
1271 | | */ |
1272 | | static psa_pake_family_t psa_pake_cs_get_family( |
1273 | | const psa_pake_cipher_suite_t *cipher_suite); |
1274 | | |
1275 | | /** Retrieve the PAKE primitive bit-size from a PAKE cipher suite. |
1276 | | * |
1277 | | * \param[in] cipher_suite The cipher suite structure to query. |
1278 | | * |
1279 | | * \return The PAKE primitive bit-size stored in the cipher suite structure. |
1280 | | */ |
1281 | | static uint16_t psa_pake_cs_get_bits( |
1282 | | const psa_pake_cipher_suite_t *cipher_suite); |
1283 | | |
1284 | | /** Retrieve the hash algorithm from a PAKE cipher suite. |
1285 | | * |
1286 | | * \param[in] cipher_suite The cipher suite structure to query. |
1287 | | * |
1288 | | * \return The hash algorithm stored in the cipher suite structure. The return |
1289 | | * value is 0 if the PAKE is not parametrised by a hash algorithm or if |
1290 | | * the hash algorithm is not set. |
1291 | | */ |
1292 | | static psa_algorithm_t psa_pake_cs_get_hash( |
1293 | | const psa_pake_cipher_suite_t *cipher_suite); |
1294 | | |
1295 | | /** Declare the hash algorithm for a PAKE cipher suite. |
1296 | | * |
1297 | | * This function overwrites any hash algorithm |
1298 | | * previously set in \p cipher_suite. |
1299 | | * |
1300 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1301 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1302 | | * for more information. |
1303 | | * |
1304 | | * \param[out] cipher_suite The cipher suite structure to write to. |
1305 | | * \param hash The hash involved in the cipher suite. |
1306 | | * (`PSA_ALG_XXX` values of type ::psa_algorithm_t |
1307 | | * such that #PSA_ALG_IS_HASH(\c alg) is true.) |
1308 | | * If this is 0, the hash algorithm in |
1309 | | * \p cipher_suite becomes unspecified. |
1310 | | */ |
1311 | | static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite, |
1312 | | psa_algorithm_t hash); |
1313 | | |
1314 | | /** The type of the state data structure for PAKE operations. |
1315 | | * |
1316 | | * Before calling any function on a PAKE operation object, the application |
1317 | | * must initialize it by any of the following means: |
1318 | | * - Set the structure to all-bits-zero, for example: |
1319 | | * \code |
1320 | | * psa_pake_operation_t operation; |
1321 | | * memset(&operation, 0, sizeof(operation)); |
1322 | | * \endcode |
1323 | | * - Initialize the structure to logical zero values, for example: |
1324 | | * \code |
1325 | | * psa_pake_operation_t operation = {0}; |
1326 | | * \endcode |
1327 | | * - Initialize the structure to the initializer #PSA_PAKE_OPERATION_INIT, |
1328 | | * for example: |
1329 | | * \code |
1330 | | * psa_pake_operation_t operation = PSA_PAKE_OPERATION_INIT; |
1331 | | * \endcode |
1332 | | * - Assign the result of the function psa_pake_operation_init() |
1333 | | * to the structure, for example: |
1334 | | * \code |
1335 | | * psa_pake_operation_t operation; |
1336 | | * operation = psa_pake_operation_init(); |
1337 | | * \endcode |
1338 | | * |
1339 | | * This is an implementation-defined \c struct. Applications should not |
1340 | | * make any assumptions about the content of this structure. |
1341 | | * Implementation details can change in future versions without notice. */ |
1342 | | typedef struct psa_pake_operation_s psa_pake_operation_t; |
1343 | | |
1344 | | /** The type of input values for PAKE operations. */ |
1345 | | typedef struct psa_crypto_driver_pake_inputs_s psa_crypto_driver_pake_inputs_t; |
1346 | | |
1347 | | /** The type of computation stage for J-PAKE operations. */ |
1348 | | typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t; |
1349 | | |
1350 | | /** Return an initial value for a PAKE operation object. |
1351 | | */ |
1352 | | static psa_pake_operation_t psa_pake_operation_init(void); |
1353 | | |
1354 | | /** Get the length of the password in bytes from given inputs. |
1355 | | * |
1356 | | * \param[in] inputs Operation inputs. |
1357 | | * \param[out] password_len Password length. |
1358 | | * |
1359 | | * \retval #PSA_SUCCESS |
1360 | | * Success. |
1361 | | * \retval #PSA_ERROR_BAD_STATE |
1362 | | * Password hasn't been set yet. |
1363 | | */ |
1364 | | psa_status_t psa_crypto_driver_pake_get_password_len( |
1365 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1366 | | size_t *password_len); |
1367 | | |
1368 | | /** Get the password from given inputs. |
1369 | | * |
1370 | | * \param[in] inputs Operation inputs. |
1371 | | * \param[out] buffer Return buffer for password. |
1372 | | * \param buffer_size Size of the return buffer in bytes. |
1373 | | * \param[out] buffer_length Actual size of the password in bytes. |
1374 | | * |
1375 | | * \retval #PSA_SUCCESS |
1376 | | * Success. |
1377 | | * \retval #PSA_ERROR_BAD_STATE |
1378 | | * Password hasn't been set yet. |
1379 | | */ |
1380 | | psa_status_t psa_crypto_driver_pake_get_password( |
1381 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1382 | | uint8_t *buffer, size_t buffer_size, size_t *buffer_length); |
1383 | | |
1384 | | /** Get the length of the user id in bytes from given inputs. |
1385 | | * |
1386 | | * \param[in] inputs Operation inputs. |
1387 | | * \param[out] user_len User id length. |
1388 | | * |
1389 | | * \retval #PSA_SUCCESS |
1390 | | * Success. |
1391 | | * \retval #PSA_ERROR_BAD_STATE |
1392 | | * User id hasn't been set yet. |
1393 | | */ |
1394 | | psa_status_t psa_crypto_driver_pake_get_user_len( |
1395 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1396 | | size_t *user_len); |
1397 | | |
1398 | | /** Get the length of the peer id in bytes from given inputs. |
1399 | | * |
1400 | | * \param[in] inputs Operation inputs. |
1401 | | * \param[out] peer_len Peer id length. |
1402 | | * |
1403 | | * \retval #PSA_SUCCESS |
1404 | | * Success. |
1405 | | * \retval #PSA_ERROR_BAD_STATE |
1406 | | * Peer id hasn't been set yet. |
1407 | | */ |
1408 | | psa_status_t psa_crypto_driver_pake_get_peer_len( |
1409 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1410 | | size_t *peer_len); |
1411 | | |
1412 | | /** Get the user id from given inputs. |
1413 | | * |
1414 | | * \param[in] inputs Operation inputs. |
1415 | | * \param[out] user_id User id. |
1416 | | * \param user_id_size Size of \p user_id in bytes. |
1417 | | * \param[out] user_id_len Size of the user id in bytes. |
1418 | | * |
1419 | | * \retval #PSA_SUCCESS |
1420 | | * Success. |
1421 | | * \retval #PSA_ERROR_BAD_STATE |
1422 | | * User id hasn't been set yet. |
1423 | | * \retval #PSA_ERROR_BUFFER_TOO_SMALL |
1424 | | * The size of the \p user_id is too small. |
1425 | | */ |
1426 | | psa_status_t psa_crypto_driver_pake_get_user( |
1427 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1428 | | uint8_t *user_id, size_t user_id_size, size_t *user_id_len); |
1429 | | |
1430 | | /** Get the peer id from given inputs. |
1431 | | * |
1432 | | * \param[in] inputs Operation inputs. |
1433 | | * \param[out] peer_id Peer id. |
1434 | | * \param peer_id_size Size of \p peer_id in bytes. |
1435 | | * \param[out] peer_id_length Size of the peer id in bytes. |
1436 | | * |
1437 | | * \retval #PSA_SUCCESS |
1438 | | * Success. |
1439 | | * \retval #PSA_ERROR_BAD_STATE |
1440 | | * Peer id hasn't been set yet. |
1441 | | * \retval #PSA_ERROR_BUFFER_TOO_SMALL |
1442 | | * The size of the \p peer_id is too small. |
1443 | | */ |
1444 | | psa_status_t psa_crypto_driver_pake_get_peer( |
1445 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1446 | | uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length); |
1447 | | |
1448 | | /** Get the cipher suite from given inputs. |
1449 | | * |
1450 | | * \param[in] inputs Operation inputs. |
1451 | | * \param[out] cipher_suite Return buffer for role. |
1452 | | * |
1453 | | * \retval #PSA_SUCCESS |
1454 | | * Success. |
1455 | | * \retval #PSA_ERROR_BAD_STATE |
1456 | | * Cipher_suite hasn't been set yet. |
1457 | | */ |
1458 | | psa_status_t psa_crypto_driver_pake_get_cipher_suite( |
1459 | | const psa_crypto_driver_pake_inputs_t *inputs, |
1460 | | psa_pake_cipher_suite_t *cipher_suite); |
1461 | | |
1462 | | /** Set the session information for a password-authenticated key exchange. |
1463 | | * |
1464 | | * The sequence of operations to set up a password-authenticated key exchange |
1465 | | * is as follows: |
1466 | | * -# Allocate an operation object which will be passed to all the functions |
1467 | | * listed here. |
1468 | | * -# Initialize the operation object with one of the methods described in the |
1469 | | * documentation for #psa_pake_operation_t, e.g. |
1470 | | * #PSA_PAKE_OPERATION_INIT. |
1471 | | * -# Call psa_pake_setup() to specify the cipher suite. |
1472 | | * -# Call \c psa_pake_set_xxx() functions on the operation to complete the |
1473 | | * setup. The exact sequence of \c psa_pake_set_xxx() functions that needs |
1474 | | * to be called depends on the algorithm in use. |
1475 | | * |
1476 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1477 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1478 | | * for more information. |
1479 | | * |
1480 | | * A typical sequence of calls to perform a password-authenticated key |
1481 | | * exchange: |
1482 | | * -# Call psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...) to get the |
1483 | | * key share that needs to be sent to the peer. |
1484 | | * -# Call psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...) to provide |
1485 | | * the key share that was received from the peer. |
1486 | | * -# Depending on the algorithm additional calls to psa_pake_output() and |
1487 | | * psa_pake_input() might be necessary. |
1488 | | * -# Call psa_pake_get_implicit_key() for accessing the shared secret. |
1489 | | * |
1490 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1491 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1492 | | * for more information. |
1493 | | * |
1494 | | * If an error occurs at any step after a call to psa_pake_setup(), |
1495 | | * the operation will need to be reset by a call to psa_pake_abort(). The |
1496 | | * application may call psa_pake_abort() at any time after the operation |
1497 | | * has been initialized. |
1498 | | * |
1499 | | * After a successful call to psa_pake_setup(), the application must |
1500 | | * eventually terminate the operation. The following events terminate an |
1501 | | * operation: |
1502 | | * - A call to psa_pake_abort(). |
1503 | | * - A successful call to psa_pake_get_implicit_key(). |
1504 | | * |
1505 | | * \param[in,out] operation The operation object to set up. It must have |
1506 | | * been initialized but not set up yet. |
1507 | | * \param[in] cipher_suite The cipher suite to use. (A cipher suite fully |
1508 | | * characterizes a PAKE algorithm and determines |
1509 | | * the algorithm as well.) |
1510 | | * |
1511 | | * \retval #PSA_SUCCESS |
1512 | | * Success. |
1513 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1514 | | * The algorithm in \p cipher_suite is not a PAKE algorithm, or the |
1515 | | * PAKE primitive in \p cipher_suite is not compatible with the |
1516 | | * PAKE algorithm, or the hash algorithm in \p cipher_suite is invalid |
1517 | | * or not compatible with the PAKE algorithm and primitive. |
1518 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1519 | | * The algorithm in \p cipher_suite is not a supported PAKE algorithm, |
1520 | | * or the PAKE primitive in \p cipher_suite is not supported or not |
1521 | | * compatible with the PAKE algorithm, or the hash algorithm in |
1522 | | * \p cipher_suite is not supported or not compatible with the PAKE |
1523 | | * algorithm and primitive. |
1524 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1525 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1526 | | * \retval #PSA_ERROR_BAD_STATE |
1527 | | * The operation state is not valid, or |
1528 | | * the library has not been previously initialized by psa_crypto_init(). |
1529 | | * It is implementation-dependent whether a failure to initialize |
1530 | | * results in this error code. |
1531 | | */ |
1532 | | psa_status_t psa_pake_setup(psa_pake_operation_t *operation, |
1533 | | const psa_pake_cipher_suite_t *cipher_suite); |
1534 | | |
1535 | | /** Set the password for a password-authenticated key exchange from key ID. |
1536 | | * |
1537 | | * Call this function when the password, or a value derived from the password, |
1538 | | * is already present in the key store. |
1539 | | * |
1540 | | * \param[in,out] operation The operation object to set the password for. It |
1541 | | * must have been set up by psa_pake_setup() and |
1542 | | * not yet in use (neither psa_pake_output() nor |
1543 | | * psa_pake_input() has been called yet). It must |
1544 | | * be on operation for which the password hasn't |
1545 | | * been set yet (psa_pake_set_password_key() |
1546 | | * hasn't been called yet). |
1547 | | * \param password Identifier of the key holding the password or a |
1548 | | * value derived from the password (eg. by a |
1549 | | * memory-hard function). It must remain valid |
1550 | | * until the operation terminates. It must be of |
1551 | | * type #PSA_KEY_TYPE_PASSWORD or |
1552 | | * #PSA_KEY_TYPE_PASSWORD_HASH. It has to allow |
1553 | | * the usage #PSA_KEY_USAGE_DERIVE. |
1554 | | * |
1555 | | * \retval #PSA_SUCCESS |
1556 | | * Success. |
1557 | | * \retval #PSA_ERROR_INVALID_HANDLE |
1558 | | * \p password is not a valid key identifier. |
1559 | | * \retval #PSA_ERROR_NOT_PERMITTED |
1560 | | * The key does not have the #PSA_KEY_USAGE_DERIVE flag, or it does not |
1561 | | * permit the \p operation's algorithm. |
1562 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1563 | | * The key type for \p password is not #PSA_KEY_TYPE_PASSWORD or |
1564 | | * #PSA_KEY_TYPE_PASSWORD_HASH, or \p password is not compatible with |
1565 | | * the \p operation's cipher suite. |
1566 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1567 | | * The key type or key size of \p password is not supported with the |
1568 | | * \p operation's cipher suite. |
1569 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1570 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1571 | | * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription |
1572 | | * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription |
1573 | | * \retval #PSA_ERROR_DATA_INVALID \emptydescription |
1574 | | * \retval #PSA_ERROR_BAD_STATE |
1575 | | * The operation state is not valid (it must have been set up.), or |
1576 | | * the library has not been previously initialized by psa_crypto_init(). |
1577 | | * It is implementation-dependent whether a failure to initialize |
1578 | | * results in this error code. |
1579 | | */ |
1580 | | psa_status_t psa_pake_set_password_key(psa_pake_operation_t *operation, |
1581 | | mbedtls_svc_key_id_t password); |
1582 | | |
1583 | | /** Set the user ID for a password-authenticated key exchange. |
1584 | | * |
1585 | | * Call this function to set the user ID. For PAKE algorithms that associate a |
1586 | | * user identifier with each side of the session you need to call |
1587 | | * psa_pake_set_peer() as well. For PAKE algorithms that associate a single |
1588 | | * user identifier with the session, call psa_pake_set_user() only. |
1589 | | * |
1590 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1591 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1592 | | * for more information. |
1593 | | * |
1594 | | * \note When using the built-in implementation of #PSA_ALG_JPAKE, the user ID |
1595 | | * must be `"client"` (6-byte string) or `"server"` (6-byte string). |
1596 | | * Third-party drivers may or may not have this limitation. |
1597 | | * |
1598 | | * \param[in,out] operation The operation object to set the user ID for. It |
1599 | | * must have been set up by psa_pake_setup() and |
1600 | | * not yet in use (neither psa_pake_output() nor |
1601 | | * psa_pake_input() has been called yet). It must |
1602 | | * be on operation for which the user ID hasn't |
1603 | | * been set (psa_pake_set_user() hasn't been |
1604 | | * called yet). |
1605 | | * \param[in] user_id The user ID to authenticate with. |
1606 | | * \param user_id_len Size of the \p user_id buffer in bytes. |
1607 | | * |
1608 | | * \retval #PSA_SUCCESS |
1609 | | * Success. |
1610 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1611 | | * \p user_id is not valid for the \p operation's algorithm and cipher |
1612 | | * suite. |
1613 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1614 | | * The value of \p user_id is not supported by the implementation. |
1615 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
1616 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1617 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1618 | | * \retval #PSA_ERROR_BAD_STATE |
1619 | | * The operation state is not valid, or |
1620 | | * the library has not been previously initialized by psa_crypto_init(). |
1621 | | * It is implementation-dependent whether a failure to initialize |
1622 | | * results in this error code. |
1623 | | */ |
1624 | | psa_status_t psa_pake_set_user(psa_pake_operation_t *operation, |
1625 | | const uint8_t *user_id, |
1626 | | size_t user_id_len); |
1627 | | |
1628 | | /** Set the peer ID for a password-authenticated key exchange. |
1629 | | * |
1630 | | * Call this function in addition to psa_pake_set_user() for PAKE algorithms |
1631 | | * that associate a user identifier with each side of the session. For PAKE |
1632 | | * algorithms that associate a single user identifier with the session, call |
1633 | | * psa_pake_set_user() only. |
1634 | | * |
1635 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1636 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1637 | | * for more information. |
1638 | | * |
1639 | | * \note When using the built-in implementation of #PSA_ALG_JPAKE, the peer ID |
1640 | | * must be `"client"` (6-byte string) or `"server"` (6-byte string). |
1641 | | * Third-party drivers may or may not have this limitation. |
1642 | | * |
1643 | | * \param[in,out] operation The operation object to set the peer ID for. It |
1644 | | * must have been set up by psa_pake_setup() and |
1645 | | * not yet in use (neither psa_pake_output() nor |
1646 | | * psa_pake_input() has been called yet). It must |
1647 | | * be on operation for which the peer ID hasn't |
1648 | | * been set (psa_pake_set_peer() hasn't been |
1649 | | * called yet). |
1650 | | * \param[in] peer_id The peer's ID to authenticate. |
1651 | | * \param peer_id_len Size of the \p peer_id buffer in bytes. |
1652 | | * |
1653 | | * \retval #PSA_SUCCESS |
1654 | | * Success. |
1655 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1656 | | * \p peer_id is not valid for the \p operation's algorithm and cipher |
1657 | | * suite. |
1658 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1659 | | * The algorithm doesn't associate a second identity with the session. |
1660 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
1661 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1662 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1663 | | * \retval #PSA_ERROR_BAD_STATE |
1664 | | * Calling psa_pake_set_peer() is invalid with the \p operation's |
1665 | | * algorithm, the operation state is not valid, or the library has not |
1666 | | * been previously initialized by psa_crypto_init(). |
1667 | | * It is implementation-dependent whether a failure to initialize |
1668 | | * results in this error code. |
1669 | | */ |
1670 | | psa_status_t psa_pake_set_peer(psa_pake_operation_t *operation, |
1671 | | const uint8_t *peer_id, |
1672 | | size_t peer_id_len); |
1673 | | |
1674 | | /** Set the application role for a password-authenticated key exchange. |
1675 | | * |
1676 | | * Not all PAKE algorithms need to differentiate the communicating entities. |
1677 | | * It is optional to call this function for PAKEs that don't require a role |
1678 | | * to be specified. For such PAKEs the application role parameter is ignored, |
1679 | | * or #PSA_PAKE_ROLE_NONE can be passed as \c role. |
1680 | | * |
1681 | | * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX` |
1682 | | * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) |
1683 | | * for more information. |
1684 | | * |
1685 | | * \param[in,out] operation The operation object to specify the |
1686 | | * application's role for. It must have been set up |
1687 | | * by psa_pake_setup() and not yet in use (neither |
1688 | | * psa_pake_output() nor psa_pake_input() has been |
1689 | | * called yet). It must be on operation for which |
1690 | | * the application's role hasn't been specified |
1691 | | * (psa_pake_set_role() hasn't been called yet). |
1692 | | * \param role A value of type ::psa_pake_role_t indicating the |
1693 | | * application's role in the PAKE the algorithm |
1694 | | * that is being set up. For more information see |
1695 | | * the documentation of \c PSA_PAKE_ROLE_XXX |
1696 | | * constants. |
1697 | | * |
1698 | | * \retval #PSA_SUCCESS |
1699 | | * Success. |
1700 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1701 | | * The \p role is not a valid PAKE role in the \p operation’s algorithm. |
1702 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1703 | | * The \p role for this algorithm is not supported or is not valid. |
1704 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1705 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1706 | | * \retval #PSA_ERROR_BAD_STATE |
1707 | | * The operation state is not valid, or |
1708 | | * the library has not been previously initialized by psa_crypto_init(). |
1709 | | * It is implementation-dependent whether a failure to initialize |
1710 | | * results in this error code. |
1711 | | */ |
1712 | | psa_status_t psa_pake_set_role(psa_pake_operation_t *operation, |
1713 | | psa_pake_role_t role); |
1714 | | |
1715 | | /** Get output for a step of a password-authenticated key exchange. |
1716 | | * |
1717 | | * Depending on the algorithm being executed, you might need to call this |
1718 | | * function several times or you might not need to call this at all. |
1719 | | * |
1720 | | * The exact sequence of calls to perform a password-authenticated key |
1721 | | * exchange depends on the algorithm in use. Refer to the documentation of |
1722 | | * individual PAKE algorithm types (`PSA_ALG_XXX` values of type |
1723 | | * ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more |
1724 | | * information. |
1725 | | * |
1726 | | * If this function returns an error status, the operation enters an error |
1727 | | * state and must be aborted by calling psa_pake_abort(). |
1728 | | * |
1729 | | * \param[in,out] operation Active PAKE operation. |
1730 | | * \param step The step of the algorithm for which the output is |
1731 | | * requested. |
1732 | | * \param[out] output Buffer where the output is to be written in the |
1733 | | * format appropriate for this \p step. Refer to |
1734 | | * the documentation of the individual |
1735 | | * \c PSA_PAKE_STEP_XXX constants for more |
1736 | | * information. |
1737 | | * \param output_size Size of the \p output buffer in bytes. This must |
1738 | | * be at least #PSA_PAKE_OUTPUT_SIZE(\c alg, \c |
1739 | | * primitive, \p output_step) where \c alg and |
1740 | | * \p primitive are the PAKE algorithm and primitive |
1741 | | * in the operation's cipher suite, and \p step is |
1742 | | * the output step. |
1743 | | * |
1744 | | * \param[out] output_length On success, the number of bytes of the returned |
1745 | | * output. |
1746 | | * |
1747 | | * \retval #PSA_SUCCESS |
1748 | | * Success. |
1749 | | * \retval #PSA_ERROR_BUFFER_TOO_SMALL |
1750 | | * The size of the \p output buffer is too small. |
1751 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1752 | | * \p step is not compatible with the operation's algorithm. |
1753 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1754 | | * \p step is not supported with the operation's algorithm. |
1755 | | * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription |
1756 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
1757 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1758 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1759 | | * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription |
1760 | | * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription |
1761 | | * \retval #PSA_ERROR_DATA_INVALID \emptydescription |
1762 | | * \retval #PSA_ERROR_BAD_STATE |
1763 | | * The operation state is not valid (it must be active, and fully set |
1764 | | * up, and this call must conform to the algorithm's requirements |
1765 | | * for ordering of input and output steps), or |
1766 | | * the library has not been previously initialized by psa_crypto_init(). |
1767 | | * It is implementation-dependent whether a failure to initialize |
1768 | | * results in this error code. |
1769 | | */ |
1770 | | psa_status_t psa_pake_output(psa_pake_operation_t *operation, |
1771 | | psa_pake_step_t step, |
1772 | | uint8_t *output, |
1773 | | size_t output_size, |
1774 | | size_t *output_length); |
1775 | | |
1776 | | /** Provide input for a step of a password-authenticated key exchange. |
1777 | | * |
1778 | | * Depending on the algorithm being executed, you might need to call this |
1779 | | * function several times or you might not need to call this at all. |
1780 | | * |
1781 | | * The exact sequence of calls to perform a password-authenticated key |
1782 | | * exchange depends on the algorithm in use. Refer to the documentation of |
1783 | | * individual PAKE algorithm types (`PSA_ALG_XXX` values of type |
1784 | | * ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more |
1785 | | * information. |
1786 | | * |
1787 | | * If this function returns an error status, the operation enters an error |
1788 | | * state and must be aborted by calling psa_pake_abort(). |
1789 | | * |
1790 | | * \param[in,out] operation Active PAKE operation. |
1791 | | * \param step The step for which the input is provided. |
1792 | | * \param[in] input Buffer containing the input in the format |
1793 | | * appropriate for this \p step. Refer to the |
1794 | | * documentation of the individual |
1795 | | * \c PSA_PAKE_STEP_XXX constants for more |
1796 | | * information. |
1797 | | * \param input_length Size of the \p input buffer in bytes. |
1798 | | * |
1799 | | * \retval #PSA_SUCCESS |
1800 | | * Success. |
1801 | | * \retval #PSA_ERROR_INVALID_SIGNATURE |
1802 | | * The verification fails for a #PSA_PAKE_STEP_ZK_PROOF input step. |
1803 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1804 | | * \p input_length is not compatible with the \p operation’s algorithm, |
1805 | | * or the \p input is not valid for the \p operation's algorithm, |
1806 | | * cipher suite or \p step. |
1807 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1808 | | * \p step p is not supported with the \p operation's algorithm, or the |
1809 | | * \p input is not supported for the \p operation's algorithm, cipher |
1810 | | * suite or \p step. |
1811 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
1812 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1813 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1814 | | * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription |
1815 | | * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription |
1816 | | * \retval #PSA_ERROR_DATA_INVALID \emptydescription |
1817 | | * \retval #PSA_ERROR_BAD_STATE |
1818 | | * The operation state is not valid (it must be active, and fully set |
1819 | | * up, and this call must conform to the algorithm's requirements |
1820 | | * for ordering of input and output steps), or |
1821 | | * the library has not been previously initialized by psa_crypto_init(). |
1822 | | * It is implementation-dependent whether a failure to initialize |
1823 | | * results in this error code. |
1824 | | */ |
1825 | | psa_status_t psa_pake_input(psa_pake_operation_t *operation, |
1826 | | psa_pake_step_t step, |
1827 | | const uint8_t *input, |
1828 | | size_t input_length); |
1829 | | |
1830 | | /** Get implicitly confirmed shared secret from a PAKE. |
1831 | | * |
1832 | | * At this point there is a cryptographic guarantee that only the authenticated |
1833 | | * party who used the same password is able to compute the key. But there is no |
1834 | | * guarantee that the peer is the party it claims to be and was able to do so. |
1835 | | * |
1836 | | * That is, the authentication is only implicit. Since the peer is not |
1837 | | * authenticated yet, no action should be taken yet that assumes that the peer |
1838 | | * is who it claims to be. For example, do not access restricted files on the |
1839 | | * peer's behalf until an explicit authentication has succeeded. |
1840 | | * |
1841 | | * This function can be called after the key exchange phase of the operation |
1842 | | * has completed. It imports the shared secret output of the PAKE into the |
1843 | | * provided derivation operation. The input step |
1844 | | * #PSA_KEY_DERIVATION_INPUT_SECRET is used when placing the shared key |
1845 | | * material in the key derivation operation. |
1846 | | * |
1847 | | * The exact sequence of calls to perform a password-authenticated key |
1848 | | * exchange depends on the algorithm in use. Refer to the documentation of |
1849 | | * individual PAKE algorithm types (`PSA_ALG_XXX` values of type |
1850 | | * ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more |
1851 | | * information. |
1852 | | * |
1853 | | * When this function returns successfully, \p operation becomes inactive. |
1854 | | * If this function returns an error status, both \p operation |
1855 | | * and \c key_derivation operations enter an error state and must be aborted by |
1856 | | * calling psa_pake_abort() and psa_key_derivation_abort() respectively. |
1857 | | * |
1858 | | * \param[in,out] operation Active PAKE operation. |
1859 | | * \param[out] output A key derivation operation that is ready |
1860 | | * for an input step of type |
1861 | | * #PSA_KEY_DERIVATION_INPUT_SECRET. |
1862 | | * |
1863 | | * \retval #PSA_SUCCESS |
1864 | | * Success. |
1865 | | * \retval #PSA_ERROR_INVALID_ARGUMENT |
1866 | | * #PSA_KEY_DERIVATION_INPUT_SECRET is not compatible with the |
1867 | | * algorithm in the \p output key derivation operation. |
1868 | | * \retval #PSA_ERROR_NOT_SUPPORTED |
1869 | | * Input from a PAKE is not supported by the algorithm in the \p output |
1870 | | * key derivation operation. |
1871 | | * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription |
1872 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1873 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1874 | | * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription |
1875 | | * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription |
1876 | | * \retval #PSA_ERROR_DATA_INVALID \emptydescription |
1877 | | * \retval #PSA_ERROR_BAD_STATE |
1878 | | * The PAKE operation state is not valid (it must be active, but beyond |
1879 | | * that validity is specific to the algorithm), or |
1880 | | * the library has not been previously initialized by psa_crypto_init(), |
1881 | | * or the state of \p output is not valid for |
1882 | | * the #PSA_KEY_DERIVATION_INPUT_SECRET step. This can happen if the |
1883 | | * step is out of order or the application has done this step already |
1884 | | * and it may not be repeated. |
1885 | | * It is implementation-dependent whether a failure to initialize |
1886 | | * results in this error code. |
1887 | | */ |
1888 | | psa_status_t psa_pake_get_implicit_key(psa_pake_operation_t *operation, |
1889 | | psa_key_derivation_operation_t *output); |
1890 | | |
1891 | | /** Abort a PAKE operation. |
1892 | | * |
1893 | | * Aborting an operation frees all associated resources except for the \c |
1894 | | * operation structure itself. Once aborted, the operation object can be reused |
1895 | | * for another operation by calling psa_pake_setup() again. |
1896 | | * |
1897 | | * This function may be called at any time after the operation |
1898 | | * object has been initialized as described in #psa_pake_operation_t. |
1899 | | * |
1900 | | * In particular, calling psa_pake_abort() after the operation has been |
1901 | | * terminated by a call to psa_pake_abort() or psa_pake_get_implicit_key() |
1902 | | * is safe and has no effect. |
1903 | | * |
1904 | | * \param[in,out] operation The operation to abort. |
1905 | | * |
1906 | | * \retval #PSA_SUCCESS |
1907 | | * Success. |
1908 | | * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription |
1909 | | * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription |
1910 | | * \retval #PSA_ERROR_BAD_STATE |
1911 | | * The library has not been previously initialized by psa_crypto_init(). |
1912 | | * It is implementation-dependent whether a failure to initialize |
1913 | | * results in this error code. |
1914 | | */ |
1915 | | psa_status_t psa_pake_abort(psa_pake_operation_t *operation); |
1916 | | |
1917 | | /**@}*/ |
1918 | | |
1919 | | static inline psa_algorithm_t psa_pake_cs_get_algorithm( |
1920 | | const psa_pake_cipher_suite_t *cipher_suite) |
1921 | 0 | { |
1922 | 0 | return cipher_suite->algorithm; |
1923 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_get_algorithm Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_get_algorithm Unexecuted instantiation: helpers.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_get_algorithm Unexecuted instantiation: certs.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_get_algorithm Unexecuted instantiation: x509_crl.c:psa_pake_cs_get_algorithm Unexecuted instantiation: x509.c:psa_pake_cs_get_algorithm Unexecuted instantiation: oid.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pk.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pk_ecc.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pk_wrap.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pkparse.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_get_algorithm Unexecuted instantiation: psa_util.c:psa_pake_cs_get_algorithm Unexecuted instantiation: rsa.c:psa_pake_cs_get_algorithm Unexecuted instantiation: md.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pkcs12.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pkcs5.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pkcs7.c:psa_pake_cs_get_algorithm Unexecuted instantiation: x509_crt.c:psa_pake_cs_get_algorithm Unexecuted instantiation: pem.c:psa_pake_cs_get_algorithm Unexecuted instantiation: cipher.c:psa_pake_cs_get_algorithm Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_server.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_msg.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_get_algorithm Unexecuted instantiation: debug.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_client.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_get_algorithm Unexecuted instantiation: x509_csr.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_client.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_get_algorithm Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_get_algorithm Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_get_algorithm |
1924 | | |
1925 | | static inline void psa_pake_cs_set_algorithm( |
1926 | | psa_pake_cipher_suite_t *cipher_suite, |
1927 | | psa_algorithm_t algorithm) |
1928 | 0 | { |
1929 | 0 | if (!PSA_ALG_IS_PAKE(algorithm)) { |
1930 | 0 | cipher_suite->algorithm = 0; |
1931 | 0 | } else { |
1932 | 0 | cipher_suite->algorithm = algorithm; |
1933 | 0 | } |
1934 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_set_algorithm Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_set_algorithm Unexecuted instantiation: helpers.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_set_algorithm Unexecuted instantiation: certs.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_set_algorithm Unexecuted instantiation: x509_crl.c:psa_pake_cs_set_algorithm Unexecuted instantiation: x509.c:psa_pake_cs_set_algorithm Unexecuted instantiation: oid.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pk.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pk_ecc.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pk_wrap.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pkparse.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_set_algorithm Unexecuted instantiation: psa_util.c:psa_pake_cs_set_algorithm Unexecuted instantiation: rsa.c:psa_pake_cs_set_algorithm Unexecuted instantiation: md.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pkcs12.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pkcs5.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pkcs7.c:psa_pake_cs_set_algorithm Unexecuted instantiation: x509_crt.c:psa_pake_cs_set_algorithm Unexecuted instantiation: pem.c:psa_pake_cs_set_algorithm Unexecuted instantiation: cipher.c:psa_pake_cs_set_algorithm Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_server.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_msg.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_set_algorithm Unexecuted instantiation: debug.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_client.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_set_algorithm Unexecuted instantiation: x509_csr.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_client.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_tls.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_set_algorithm Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_set_algorithm Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_set_algorithm |
1935 | | |
1936 | | static inline psa_pake_primitive_t psa_pake_cs_get_primitive( |
1937 | | const psa_pake_cipher_suite_t *cipher_suite) |
1938 | 0 | { |
1939 | 0 | return PSA_PAKE_PRIMITIVE(cipher_suite->type, cipher_suite->family, |
1940 | 0 | cipher_suite->bits); |
1941 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_get_primitive Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_get_primitive Unexecuted instantiation: helpers.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_get_primitive Unexecuted instantiation: certs.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_get_primitive Unexecuted instantiation: x509_crl.c:psa_pake_cs_get_primitive Unexecuted instantiation: x509.c:psa_pake_cs_get_primitive Unexecuted instantiation: oid.c:psa_pake_cs_get_primitive Unexecuted instantiation: pk.c:psa_pake_cs_get_primitive Unexecuted instantiation: pk_ecc.c:psa_pake_cs_get_primitive Unexecuted instantiation: pk_wrap.c:psa_pake_cs_get_primitive Unexecuted instantiation: pkparse.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_get_primitive Unexecuted instantiation: psa_util.c:psa_pake_cs_get_primitive Unexecuted instantiation: rsa.c:psa_pake_cs_get_primitive Unexecuted instantiation: md.c:psa_pake_cs_get_primitive Unexecuted instantiation: pkcs12.c:psa_pake_cs_get_primitive Unexecuted instantiation: pkcs5.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_get_primitive Unexecuted instantiation: pkcs7.c:psa_pake_cs_get_primitive Unexecuted instantiation: x509_crt.c:psa_pake_cs_get_primitive Unexecuted instantiation: pem.c:psa_pake_cs_get_primitive Unexecuted instantiation: cipher.c:psa_pake_cs_get_primitive Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_server.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_msg.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_get_primitive Unexecuted instantiation: debug.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_client.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_get_primitive Unexecuted instantiation: x509_csr.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_client.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_get_primitive Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_get_primitive Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_get_primitive |
1942 | | |
1943 | | static inline void psa_pake_cs_set_primitive( |
1944 | | psa_pake_cipher_suite_t *cipher_suite, |
1945 | | psa_pake_primitive_t primitive) |
1946 | 0 | { |
1947 | 0 | cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24); |
1948 | 0 | cipher_suite->family = (psa_pake_family_t) (0xFF & (primitive >> 16)); |
1949 | 0 | cipher_suite->bits = (uint16_t) (0xFFFF & primitive); |
1950 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_set_primitive Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_set_primitive Unexecuted instantiation: helpers.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_set_primitive Unexecuted instantiation: certs.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_set_primitive Unexecuted instantiation: x509_crl.c:psa_pake_cs_set_primitive Unexecuted instantiation: x509.c:psa_pake_cs_set_primitive Unexecuted instantiation: oid.c:psa_pake_cs_set_primitive Unexecuted instantiation: pk.c:psa_pake_cs_set_primitive Unexecuted instantiation: pk_ecc.c:psa_pake_cs_set_primitive Unexecuted instantiation: pk_wrap.c:psa_pake_cs_set_primitive Unexecuted instantiation: pkparse.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_set_primitive Unexecuted instantiation: psa_util.c:psa_pake_cs_set_primitive Unexecuted instantiation: rsa.c:psa_pake_cs_set_primitive Unexecuted instantiation: md.c:psa_pake_cs_set_primitive Unexecuted instantiation: pkcs12.c:psa_pake_cs_set_primitive Unexecuted instantiation: pkcs5.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_set_primitive Unexecuted instantiation: pkcs7.c:psa_pake_cs_set_primitive Unexecuted instantiation: x509_crt.c:psa_pake_cs_set_primitive Unexecuted instantiation: pem.c:psa_pake_cs_set_primitive Unexecuted instantiation: cipher.c:psa_pake_cs_set_primitive Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_server.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_msg.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_set_primitive Unexecuted instantiation: debug.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_client.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_set_primitive Unexecuted instantiation: x509_csr.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_client.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_set_primitive Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_set_primitive Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_set_primitive |
1951 | | |
1952 | | static inline psa_pake_family_t psa_pake_cs_get_family( |
1953 | | const psa_pake_cipher_suite_t *cipher_suite) |
1954 | 0 | { |
1955 | 0 | return cipher_suite->family; |
1956 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_get_family Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_get_family Unexecuted instantiation: helpers.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_get_family Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_get_family Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_get_family Unexecuted instantiation: certs.c:psa_pake_cs_get_family Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_get_family Unexecuted instantiation: x509_crl.c:psa_pake_cs_get_family Unexecuted instantiation: x509.c:psa_pake_cs_get_family Unexecuted instantiation: oid.c:psa_pake_cs_get_family Unexecuted instantiation: pk.c:psa_pake_cs_get_family Unexecuted instantiation: pk_ecc.c:psa_pake_cs_get_family Unexecuted instantiation: pk_wrap.c:psa_pake_cs_get_family Unexecuted instantiation: pkparse.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_get_family Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_get_family Unexecuted instantiation: psa_util.c:psa_pake_cs_get_family Unexecuted instantiation: rsa.c:psa_pake_cs_get_family Unexecuted instantiation: md.c:psa_pake_cs_get_family Unexecuted instantiation: pkcs12.c:psa_pake_cs_get_family Unexecuted instantiation: pkcs5.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_get_family Unexecuted instantiation: pkcs7.c:psa_pake_cs_get_family Unexecuted instantiation: x509_crt.c:psa_pake_cs_get_family Unexecuted instantiation: pem.c:psa_pake_cs_get_family Unexecuted instantiation: cipher.c:psa_pake_cs_get_family Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_server.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_msg.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_get_family Unexecuted instantiation: debug.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_client.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_get_family Unexecuted instantiation: x509_csr.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_client.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_get_family Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_get_family Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_get_family |
1957 | | |
1958 | | static inline uint16_t psa_pake_cs_get_bits( |
1959 | | const psa_pake_cipher_suite_t *cipher_suite) |
1960 | 0 | { |
1961 | 0 | return cipher_suite->bits; |
1962 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_get_bits Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_get_bits Unexecuted instantiation: helpers.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_get_bits Unexecuted instantiation: certs.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_get_bits Unexecuted instantiation: x509_crl.c:psa_pake_cs_get_bits Unexecuted instantiation: x509.c:psa_pake_cs_get_bits Unexecuted instantiation: oid.c:psa_pake_cs_get_bits Unexecuted instantiation: pk.c:psa_pake_cs_get_bits Unexecuted instantiation: pk_ecc.c:psa_pake_cs_get_bits Unexecuted instantiation: pk_wrap.c:psa_pake_cs_get_bits Unexecuted instantiation: pkparse.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_get_bits Unexecuted instantiation: psa_util.c:psa_pake_cs_get_bits Unexecuted instantiation: rsa.c:psa_pake_cs_get_bits Unexecuted instantiation: md.c:psa_pake_cs_get_bits Unexecuted instantiation: pkcs12.c:psa_pake_cs_get_bits Unexecuted instantiation: pkcs5.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_get_bits Unexecuted instantiation: pkcs7.c:psa_pake_cs_get_bits Unexecuted instantiation: x509_crt.c:psa_pake_cs_get_bits Unexecuted instantiation: pem.c:psa_pake_cs_get_bits Unexecuted instantiation: cipher.c:psa_pake_cs_get_bits Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_server.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_msg.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_get_bits Unexecuted instantiation: debug.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_client.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_get_bits Unexecuted instantiation: x509_csr.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_client.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_get_bits Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_get_bits Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_get_bits |
1963 | | |
1964 | | static inline psa_algorithm_t psa_pake_cs_get_hash( |
1965 | | const psa_pake_cipher_suite_t *cipher_suite) |
1966 | 0 | { |
1967 | 0 | return cipher_suite->hash; |
1968 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_get_hash Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_get_hash Unexecuted instantiation: helpers.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_get_hash Unexecuted instantiation: certs.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_get_hash Unexecuted instantiation: x509_crl.c:psa_pake_cs_get_hash Unexecuted instantiation: x509.c:psa_pake_cs_get_hash Unexecuted instantiation: oid.c:psa_pake_cs_get_hash Unexecuted instantiation: pk.c:psa_pake_cs_get_hash Unexecuted instantiation: pk_ecc.c:psa_pake_cs_get_hash Unexecuted instantiation: pk_wrap.c:psa_pake_cs_get_hash Unexecuted instantiation: pkparse.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_get_hash Unexecuted instantiation: psa_util.c:psa_pake_cs_get_hash Unexecuted instantiation: rsa.c:psa_pake_cs_get_hash Unexecuted instantiation: md.c:psa_pake_cs_get_hash Unexecuted instantiation: pkcs12.c:psa_pake_cs_get_hash Unexecuted instantiation: pkcs5.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_get_hash Unexecuted instantiation: pkcs7.c:psa_pake_cs_get_hash Unexecuted instantiation: x509_crt.c:psa_pake_cs_get_hash Unexecuted instantiation: pem.c:psa_pake_cs_get_hash Unexecuted instantiation: cipher.c:psa_pake_cs_get_hash Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_server.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_msg.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_get_hash Unexecuted instantiation: debug.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_client.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_get_hash Unexecuted instantiation: x509_csr.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_client.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_get_hash Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_get_hash Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_get_hash |
1969 | | |
1970 | | static inline void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite, |
1971 | | psa_algorithm_t hash) |
1972 | 0 | { |
1973 | 0 | if (!PSA_ALG_IS_HASH(hash)) { |
1974 | 0 | cipher_suite->hash = 0; |
1975 | 0 | } else { |
1976 | 0 | cipher_suite->hash = hash; |
1977 | 0 | } |
1978 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cs_set_hash Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cs_set_hash Unexecuted instantiation: helpers.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_exercise_key.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cs_set_hash Unexecuted instantiation: certs.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cs_set_hash Unexecuted instantiation: x509_crl.c:psa_pake_cs_set_hash Unexecuted instantiation: x509.c:psa_pake_cs_set_hash Unexecuted instantiation: oid.c:psa_pake_cs_set_hash Unexecuted instantiation: pk.c:psa_pake_cs_set_hash Unexecuted instantiation: pk_ecc.c:psa_pake_cs_set_hash Unexecuted instantiation: pk_wrap.c:psa_pake_cs_set_hash Unexecuted instantiation: pkparse.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_client.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_se.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cs_set_hash Unexecuted instantiation: psa_util.c:psa_pake_cs_set_hash Unexecuted instantiation: rsa.c:psa_pake_cs_set_hash Unexecuted instantiation: md.c:psa_pake_cs_set_hash Unexecuted instantiation: pkcs12.c:psa_pake_cs_set_hash Unexecuted instantiation: pkcs5.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cs_set_hash Unexecuted instantiation: pkcs7.c:psa_pake_cs_set_hash Unexecuted instantiation: x509_crt.c:psa_pake_cs_set_hash Unexecuted instantiation: pem.c:psa_pake_cs_set_hash Unexecuted instantiation: cipher.c:psa_pake_cs_set_hash Unexecuted instantiation: cipher_wrap.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_server.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_msg.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_ticket.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cs_set_hash Unexecuted instantiation: debug.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_client.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cs_set_hash Unexecuted instantiation: x509_csr.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_client.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_tls.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cs_set_hash Unexecuted instantiation: ssl_cookie.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_privkey.c:psa_pake_cs_set_hash Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cs_set_hash |
1979 | | |
1980 | | static inline struct psa_pake_cipher_suite_s psa_pake_cipher_suite_init(void) |
1981 | 0 | { |
1982 | 0 | const struct psa_pake_cipher_suite_s v = PSA_PAKE_CIPHER_SUITE_INIT; |
1983 | 0 | return v; |
1984 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_cipher_suite_init Unexecuted instantiation: platform_builtin_keys.c:psa_pake_cipher_suite_init Unexecuted instantiation: helpers.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_exercise_key.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_cipher_suite_init Unexecuted instantiation: certs.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_test_wrappers.c:psa_pake_cipher_suite_init Unexecuted instantiation: x509_crl.c:psa_pake_cipher_suite_init Unexecuted instantiation: x509.c:psa_pake_cipher_suite_init Unexecuted instantiation: oid.c:psa_pake_cipher_suite_init Unexecuted instantiation: pk.c:psa_pake_cipher_suite_init Unexecuted instantiation: pk_ecc.c:psa_pake_cipher_suite_init Unexecuted instantiation: pk_wrap.c:psa_pake_cipher_suite_init Unexecuted instantiation: pkparse.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_aead.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_client.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_hash.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_mac.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_pake.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_se.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_crypto_storage.c:psa_pake_cipher_suite_init Unexecuted instantiation: psa_util.c:psa_pake_cipher_suite_init Unexecuted instantiation: rsa.c:psa_pake_cipher_suite_init Unexecuted instantiation: md.c:psa_pake_cipher_suite_init Unexecuted instantiation: pkcs12.c:psa_pake_cipher_suite_init Unexecuted instantiation: pkcs5.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_cipher_suite_init Unexecuted instantiation: pkcs7.c:psa_pake_cipher_suite_init Unexecuted instantiation: x509_crt.c:psa_pake_cipher_suite_init Unexecuted instantiation: pem.c:psa_pake_cipher_suite_init Unexecuted instantiation: cipher.c:psa_pake_cipher_suite_init Unexecuted instantiation: cipher_wrap.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_server.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_msg.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_ticket.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls12_client.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls12_server.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls13_server.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls13_client.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_cipher_suite_init Unexecuted instantiation: debug.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_client.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_x509csr.c:psa_pake_cipher_suite_init Unexecuted instantiation: x509_csr.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_client.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_tls.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_cipher_suite_init Unexecuted instantiation: ssl_cookie.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_x509crt.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_privkey.c:psa_pake_cipher_suite_init Unexecuted instantiation: fuzz_pubkey.c:psa_pake_cipher_suite_init |
1985 | | |
1986 | | static inline struct psa_pake_operation_s psa_pake_operation_init(void) |
1987 | 0 | { |
1988 | 0 | const struct psa_pake_operation_s v = PSA_PAKE_OPERATION_INIT; |
1989 | 0 | return v; |
1990 | 0 | } Unexecuted instantiation: fuzz_x509crl.c:psa_pake_operation_init Unexecuted instantiation: platform_builtin_keys.c:psa_pake_operation_init Unexecuted instantiation: helpers.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_helpers.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_stubs.c:psa_pake_operation_init Unexecuted instantiation: psa_exercise_key.c:psa_pake_operation_init Unexecuted instantiation: psa_memory_poisoning_wrappers.c:psa_pake_operation_init Unexecuted instantiation: certs.c:psa_pake_operation_init Unexecuted instantiation: psa_test_wrappers.c:psa_pake_operation_init Unexecuted instantiation: x509_crl.c:psa_pake_operation_init Unexecuted instantiation: x509.c:psa_pake_operation_init Unexecuted instantiation: oid.c:psa_pake_operation_init Unexecuted instantiation: pk.c:psa_pake_operation_init Unexecuted instantiation: pk_ecc.c:psa_pake_operation_init Unexecuted instantiation: pk_wrap.c:psa_pake_operation_init Unexecuted instantiation: pkparse.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_aead.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_cipher.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_client.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_driver_wrappers_no_static.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_ecp.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_ffdh.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_hash.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_mac.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_pake.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_rsa.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_se.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_slot_management.c:psa_pake_operation_init Unexecuted instantiation: psa_crypto_storage.c:psa_pake_operation_init Unexecuted instantiation: psa_util.c:psa_pake_operation_init Unexecuted instantiation: rsa.c:psa_pake_operation_init Unexecuted instantiation: md.c:psa_pake_operation_init Unexecuted instantiation: pkcs12.c:psa_pake_operation_init Unexecuted instantiation: pkcs5.c:psa_pake_operation_init Unexecuted instantiation: fuzz_pkcs7.c:psa_pake_operation_init Unexecuted instantiation: pkcs7.c:psa_pake_operation_init Unexecuted instantiation: x509_crt.c:psa_pake_operation_init Unexecuted instantiation: pem.c:psa_pake_operation_init Unexecuted instantiation: cipher.c:psa_pake_operation_init Unexecuted instantiation: cipher_wrap.c:psa_pake_operation_init Unexecuted instantiation: fuzz_server.c:psa_pake_operation_init Unexecuted instantiation: ssl_msg.c:psa_pake_operation_init Unexecuted instantiation: ssl_ticket.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls12_client.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls12_server.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls13_keys.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls13_server.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls13_client.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls13_generic.c:psa_pake_operation_init Unexecuted instantiation: debug.c:psa_pake_operation_init Unexecuted instantiation: ssl_ciphersuites.c:psa_pake_operation_init Unexecuted instantiation: ssl_client.c:psa_pake_operation_init Unexecuted instantiation: ssl_debug_helpers_generated.c:psa_pake_operation_init Unexecuted instantiation: fuzz_x509csr.c:psa_pake_operation_init Unexecuted instantiation: x509_csr.c:psa_pake_operation_init Unexecuted instantiation: fuzz_client.c:psa_pake_operation_init Unexecuted instantiation: ssl_tls.c:psa_pake_operation_init Unexecuted instantiation: fuzz_dtlsclient.c:psa_pake_operation_init Unexecuted instantiation: fuzz_dtlsserver.c:psa_pake_operation_init Unexecuted instantiation: ssl_cookie.c:psa_pake_operation_init Unexecuted instantiation: fuzz_x509crt.c:psa_pake_operation_init Unexecuted instantiation: fuzz_privkey.c:psa_pake_operation_init Unexecuted instantiation: fuzz_pubkey.c:psa_pake_operation_init |
1991 | | |
1992 | | #ifdef __cplusplus |
1993 | | } |
1994 | | #endif |
1995 | | |
1996 | | #endif /* PSA_CRYPTO_EXTRA_H */ |