mbed TLS v2.23.0

crypto_struct.h
Go to the documentation of this file.
1
36 /*
37 * Copyright (C) 2018, ARM Limited, All Rights Reserved
38 * SPDX-License-Identifier: Apache-2.0
39 *
40 * Licensed under the Apache License, Version 2.0 (the "License"); you may
41 * not use this file except in compliance with the License.
42 * You may obtain a copy of the License at
43 *
44 * http://www.apache.org/licenses/LICENSE-2.0
45 *
46 * Unless required by applicable law or agreed to in writing, software
47 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
48 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49 * See the License for the specific language governing permissions and
50 * limitations under the License.
51 *
52 * This file is part of mbed TLS (https://tls.mbed.org)
53 */
54
55 #ifndef PSA_CRYPTO_STRUCT_H
56 #define PSA_CRYPTO_STRUCT_H
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 /* Include the Mbed TLS configuration file, the way Mbed TLS does it
63 * in each of its header files. */
64 #if !defined(MBEDTLS_CONFIG_FILE)
65 #include "mbedtls/config.h"
66 #else
67 #include MBEDTLS_CONFIG_FILE
68 #endif
69
70 #include "mbedtls/cipher.h"
71 #include "mbedtls/cmac.h"
72 #include "mbedtls/gcm.h"
73 #include "mbedtls/md.h"
74 #include "mbedtls/md2.h"
75 #include "mbedtls/md4.h"
76 #include "mbedtls/md5.h"
77 #include "mbedtls/ripemd160.h"
78 #include "mbedtls/sha1.h"
79 #include "mbedtls/sha256.h"
80 #include "mbedtls/sha512.h"
81
82 struct psa_hash_operation_s
83 {
84 psa_algorithm_t alg;
85 union
86 {
87 unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
88 #if defined(MBEDTLS_MD2_C)
89 mbedtls_md2_context md2;
90 #endif
91 #if defined(MBEDTLS_MD4_C)
92 mbedtls_md4_context md4;
93 #endif
94 #if defined(MBEDTLS_MD5_C)
95 mbedtls_md5_context md5;
96 #endif
97 #if defined(MBEDTLS_RIPEMD160_C)
98 mbedtls_ripemd160_context ripemd160;
99 #endif
100 #if defined(MBEDTLS_SHA1_C)
101 mbedtls_sha1_context sha1;
102 #endif
103 #if defined(MBEDTLS_SHA256_C)
104 mbedtls_sha256_context sha256;
105 #endif
106 #if defined(MBEDTLS_SHA512_C)
107 mbedtls_sha512_context sha512;
108 #endif
109 } ctx;
110 };
111
112 #define PSA_HASH_OPERATION_INIT {0, {0}}
113 static inline struct psa_hash_operation_s psa_hash_operation_init( void )
114 {
115 const struct psa_hash_operation_s v = PSA_HASH_OPERATION_INIT;
116 return( v );
117 }
118
119 #if defined(MBEDTLS_MD_C)
120 typedef struct
121 {
123 struct psa_hash_operation_s hash_ctx;
125 uint8_t opad[PSA_HMAC_MAX_HASH_BLOCK_SIZE];
126 } psa_hmac_internal_data;
127 #endif /* MBEDTLS_MD_C */
128
129 struct psa_mac_operation_s
130 {
131 psa_algorithm_t alg;
132 unsigned int key_set : 1;
133 unsigned int iv_required : 1;
134 unsigned int iv_set : 1;
135 unsigned int has_input : 1;
136 unsigned int is_sign : 1;
137 uint8_t mac_size;
138 union
139 {
140 unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
141 #if defined(MBEDTLS_MD_C)
142 psa_hmac_internal_data hmac;
143 #endif
144 #if defined(MBEDTLS_CMAC_C)
145 mbedtls_cipher_context_t cmac;
146 #endif
147 } ctx;
148 };
149
150 #define PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, {0}}
151 static inline struct psa_mac_operation_s psa_mac_operation_init( void )
152 {
153 const struct psa_mac_operation_s v = PSA_MAC_OPERATION_INIT;
154 return( v );
155 }
156
157 struct psa_cipher_operation_s
158 {
159 psa_algorithm_t alg;
160 unsigned int key_set : 1;
161 unsigned int iv_required : 1;
162 unsigned int iv_set : 1;
163 uint8_t iv_size;
164 uint8_t block_size;
165 union
166 {
167 unsigned dummy; /* Enable easier initializing of the union. */
168 mbedtls_cipher_context_t cipher;
169 } ctx;
170 };
171
172 #define PSA_CIPHER_OPERATION_INIT {0, 0, 0, 0, 0, 0, {0}}
173 static inline struct psa_cipher_operation_s psa_cipher_operation_init( void )
174 {
175 const struct psa_cipher_operation_s v = PSA_CIPHER_OPERATION_INIT;
176 return( v );
177 }
178
179 struct psa_aead_operation_s
180 {
181 psa_algorithm_t alg;
182 unsigned int key_set : 1;
183 unsigned int iv_set : 1;
184 uint8_t iv_size;
185 uint8_t block_size;
186 union
187 {
188 unsigned dummy; /* Enable easier initializing of the union. */
189 mbedtls_cipher_context_t cipher;
190 } ctx;
191 };
192
193 #define PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, {0}}
194 static inline struct psa_aead_operation_s psa_aead_operation_init( void )
195 {
196 const struct psa_aead_operation_s v = PSA_AEAD_OPERATION_INIT;
197 return( v );
198 }
199
200 #if defined(MBEDTLS_MD_C)
201 typedef struct
202 {
203 uint8_t *info;
204 size_t info_length;
205 psa_hmac_internal_data hmac;
206 uint8_t prk[PSA_HASH_MAX_SIZE];
207 uint8_t output_block[PSA_HASH_MAX_SIZE];
208 #if PSA_HASH_MAX_SIZE > 0xff
209 #error "PSA_HASH_MAX_SIZE does not fit in uint8_t"
210 #endif
211 uint8_t offset_in_block;
212 uint8_t block_number;
213 unsigned int state : 2;
214 unsigned int info_set : 1;
215 } psa_hkdf_key_derivation_t;
216 #endif /* MBEDTLS_MD_C */
217
218 #if defined(MBEDTLS_MD_C)
219 typedef enum
220 {
221 TLS12_PRF_STATE_INIT, /* no input provided */
222 TLS12_PRF_STATE_SEED_SET, /* seed has been set */
223 TLS12_PRF_STATE_KEY_SET, /* key has been set */
224 TLS12_PRF_STATE_LABEL_SET, /* label has been set */
225 TLS12_PRF_STATE_OUTPUT /* output has been started */
226 } psa_tls12_prf_key_derivation_state_t;
227
228 typedef struct psa_tls12_prf_key_derivation_s
229 {
230 #if PSA_HASH_MAX_SIZE > 0xff
231 #error "PSA_HASH_MAX_SIZE does not fit in uint8_t"
232 #endif
233
234 /* Indicates how many bytes in the current HMAC block have
235 * not yet been read by the user. */
236 uint8_t left_in_block;
237
238 /* The 1-based number of the block. */
239 uint8_t block_number;
240
241 psa_tls12_prf_key_derivation_state_t state;
242
243 uint8_t *seed;
244 size_t seed_length;
245 uint8_t *label;
246 size_t label_length;
247 psa_hmac_internal_data hmac;
248 uint8_t Ai[PSA_HASH_MAX_SIZE];
249
250 /* `HMAC_hash( prk, A(i) + seed )` in the notation of RFC 5246, Sect. 5. */
251 uint8_t output_block[PSA_HASH_MAX_SIZE];
252 } psa_tls12_prf_key_derivation_t;
253 #endif /* MBEDTLS_MD_C */
254
255 struct psa_key_derivation_s
256 {
257 psa_algorithm_t alg;
258 unsigned int can_output_key : 1;
259 size_t capacity;
260 union
261 {
262 /* Make the union non-empty even with no supported algorithms. */
263 uint8_t dummy;
264 #if defined(MBEDTLS_MD_C)
265 psa_hkdf_key_derivation_t hkdf;
266 psa_tls12_prf_key_derivation_t tls12_prf;
267 #endif
268 } ctx;
269 };
270
271 /* This only zeroes out the first byte in the union, the rest is unspecified. */
272 #define PSA_KEY_DERIVATION_OPERATION_INIT {0, 0, 0, {0}}
273 static inline struct psa_key_derivation_s psa_key_derivation_operation_init( void )
274 {
275 const struct psa_key_derivation_s v = PSA_KEY_DERIVATION_OPERATION_INIT;
276 return( v );
277 }
278
279 struct psa_key_policy_s
280 {
281 psa_key_usage_t usage;
282 psa_algorithm_t alg;
283 psa_algorithm_t alg2;
284 };
285 typedef struct psa_key_policy_s psa_key_policy_t;
286
287 #define PSA_KEY_POLICY_INIT {0, 0, 0}
288 static inline struct psa_key_policy_s psa_key_policy_init( void )
289 {
290 const struct psa_key_policy_s v = PSA_KEY_POLICY_INIT;
291 return( v );
292 }
293
294 /* The type used internally for key sizes.
295 * Public interfaces use size_t, but internally we use a smaller type. */
296 typedef uint16_t psa_key_bits_t;
297 /* The maximum value of the type used to represent bit-sizes.
298 * This is used to mark an invalid key size. */
299 #define PSA_KEY_BITS_TOO_LARGE ( (psa_key_bits_t) ( -1 ) )
300 /* The maximum size of a key in bits.
301 * Currently defined as the maximum that can be represented, rounded down
302 * to a whole number of bytes.
303 * This is an uncast value so that it can be used in preprocessor
304 * conditionals. */
305 #define PSA_MAX_KEY_BITS 0xfff8
306
314 typedef uint16_t psa_key_attributes_flag_t;
315
316 #define MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER \
317 ( (psa_key_attributes_flag_t) 0x0001 )
318
319 /* A mask of key attribute flags used externally only.
320 * Only meant for internal checks inside the library. */
321 #define MBEDTLS_PSA_KA_MASK_EXTERNAL_ONLY ( \
322 MBEDTLS_PSA_KA_FLAG_HAS_SLOT_NUMBER | \
323 0 )
324
325 /* A mask of key attribute flags used both internally and externally.
326 * Currently there aren't any. */
327 #define MBEDTLS_PSA_KA_MASK_DUAL_USE ( \
328 0 )
329
330 typedef struct
331 {
332 psa_key_type_t type;
333 psa_key_bits_t bits;
334 psa_key_lifetime_t lifetime;
335 psa_key_id_t id;
336 psa_key_policy_t policy;
337 psa_key_attributes_flag_t flags;
338 } psa_core_key_attributes_t;
339
340 #define PSA_CORE_KEY_ATTRIBUTES_INIT {PSA_KEY_TYPE_NONE, 0, PSA_KEY_LIFETIME_VOLATILE, PSA_KEY_ID_INIT, PSA_KEY_POLICY_INIT, 0}
341
342 struct psa_key_attributes_s
343 {
344 psa_core_key_attributes_t core;
345 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
346 psa_key_slot_number_t slot_number;
347 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
348 void *domain_parameters;
349 size_t domain_parameters_size;
350 };
351
352 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
353 #define PSA_KEY_ATTRIBUTES_INIT {PSA_CORE_KEY_ATTRIBUTES_INIT, 0, NULL, 0}
354 #else
355 #define PSA_KEY_ATTRIBUTES_INIT {PSA_CORE_KEY_ATTRIBUTES_INIT, NULL, 0}
356 #endif
357
358 static inline struct psa_key_attributes_s psa_key_attributes_init( void )
359 {
360 const struct psa_key_attributes_s v = PSA_KEY_ATTRIBUTES_INIT;
361 return( v );
362 }
363
364 static inline void psa_set_key_id(psa_key_attributes_t *attributes,
365 psa_key_id_t id)
366 {
367 attributes->core.id = id;
368 if( attributes->core.lifetime == PSA_KEY_LIFETIME_VOLATILE )
369 attributes->core.lifetime = PSA_KEY_LIFETIME_PERSISTENT;
370 }
371
372 static inline psa_key_id_t psa_get_key_id(
373 const psa_key_attributes_t *attributes)
374 {
375 return( attributes->core.id );
376 }
377
378 static inline void psa_set_key_lifetime(psa_key_attributes_t *attributes,
379 psa_key_lifetime_t lifetime)
380 {
381 attributes->core.lifetime = lifetime;
382 if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
383 {
384 #ifdef MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
385 attributes->core.id.key_id = 0;
386 attributes->core.id.owner = 0;
387 #else
388 attributes->core.id = 0;
389 #endif
390 }
391 }
392
393 static inline psa_key_lifetime_t psa_get_key_lifetime(
394 const psa_key_attributes_t *attributes)
395 {
396 return( attributes->core.lifetime );
397 }
398
399 static inline void psa_set_key_usage_flags(psa_key_attributes_t *attributes,
400 psa_key_usage_t usage_flags)
401 {
402 attributes->core.policy.usage = usage_flags;
403 }
404
405 static inline psa_key_usage_t psa_get_key_usage_flags(
406 const psa_key_attributes_t *attributes)
407 {
408 return( attributes->core.policy.usage );
409 }
410
411 static inline void psa_set_key_algorithm(psa_key_attributes_t *attributes,
412 psa_algorithm_t alg)
413 {
414 attributes->core.policy.alg = alg;
415 }
416
417 static inline psa_algorithm_t psa_get_key_algorithm(
418 const psa_key_attributes_t *attributes)
419 {
420 return( attributes->core.policy.alg );
421 }
422
423 /* This function is declared in crypto_extra.h, which comes after this
424 * header file, but we need the function here, so repeat the declaration. */
425 psa_status_t psa_set_key_domain_parameters(psa_key_attributes_t *attributes,
426 psa_key_type_t type,
427 const uint8_t *data,
428 size_t data_length);
429
430 static inline void psa_set_key_type(psa_key_attributes_t *attributes,
431 psa_key_type_t type)
432 {
433 if( attributes->domain_parameters == NULL )
434 {
435 /* Common case: quick path */
436 attributes->core.type = type;
437 }
438 else
439 {
440 /* Call the bigger function to free the old domain paramteres.
441 * Ignore any errors which may arise due to type requiring
442 * non-default domain parameters, since this function can't
443 * report errors. */
444 (void) psa_set_key_domain_parameters( attributes, type, NULL, 0 );
445 }
446 }
447
448 static inline psa_key_type_t psa_get_key_type(
449 const psa_key_attributes_t *attributes)
450 {
451 return( attributes->core.type );
452 }
453
454 static inline void psa_set_key_bits(psa_key_attributes_t *attributes,
455 size_t bits)
456 {
457 if( bits > PSA_MAX_KEY_BITS )
458 attributes->core.bits = PSA_KEY_BITS_TOO_LARGE;
459 else
460 attributes->core.bits = (psa_key_bits_t) bits;
461 }
462
463 static inline size_t psa_get_key_bits(
464 const psa_key_attributes_t *attributes)
465 {
466 return( attributes->core.bits );
467 }
468
469 #ifdef __cplusplus
470 }
471 #endif
472
473 #endif /* PSA_CRYPTO_STRUCT_H */
PSA_KEY_ATTRIBUTES_INIT
#define PSA_KEY_ATTRIBUTES_INIT
Definition: crypto_struct.h:355
psa_get_key_usage_flags
static psa_key_usage_t psa_get_key_usage_flags(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:405
mbedtls_sha1_context
The SHA-1 context structure.
Definition: sha1.h:64
mbedtls_md5_context
MD5 context structure.
Definition: md5.h:60
PSA_AEAD_OPERATION_INIT
#define PSA_AEAD_OPERATION_INIT
Definition: crypto_struct.h:193
psa_status_t
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:55
psa_key_policy_s::alg2
psa_algorithm_t alg2
Definition: crypto_struct.h:283
psa_mac_operation_s::dummy
unsigned dummy
Definition: crypto_struct.h:140
psa_aead_operation_s::block_size
uint8_t block_size
Definition: crypto_struct.h:185
psa_aead_operation_s::iv_size
uint8_t iv_size
Definition: crypto_struct.h:184
psa_aead_operation_s::dummy
unsigned dummy
Definition: crypto_struct.h:188
PSA_HMAC_MAX_HASH_BLOCK_SIZE
#define PSA_HMAC_MAX_HASH_BLOCK_SIZE
Definition: crypto_sizes.h:105
psa_core_key_attributes_t::id
psa_key_id_t id
Definition: crypto_struct.h:335
psa_cipher_operation_s::key_set
unsigned int key_set
Definition: crypto_struct.h:160
psa_cipher_operation_s::iv_set
unsigned int iv_set
Definition: crypto_struct.h:162
psa_core_key_attributes_t::policy
psa_key_policy_t policy
Definition: crypto_struct.h:336
psa_mac_operation_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:131
TLS12_PRF_STATE_SEED_SET
@ TLS12_PRF_STATE_SEED_SET
Definition: crypto_struct.h:222
sha1.h
This file contains SHA-1 definitions and functions.
psa_key_attributes_s
Definition: crypto_struct.h:343
psa_cipher_operation_init
static struct psa_cipher_operation_s psa_cipher_operation_init(void)
Definition: crypto_struct.h:173
PSA_MAC_OPERATION_INIT
#define PSA_MAC_OPERATION_INIT
Definition: crypto_struct.h:150
psa_cipher_operation_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:159
psa_aead_operation_s::key_set
unsigned int key_set
Definition: crypto_struct.h:182
psa_tls12_prf_key_derivation_s::label_length
size_t label_length
Definition: crypto_struct.h:246
psa_hkdf_key_derivation_t::info_length
size_t info_length
Definition: crypto_struct.h:204
md.h
This file contains the generic message-digest wrapper.
psa_set_key_id
static void psa_set_key_id(psa_key_attributes_t *attributes, psa_key_id_t id)
Definition: crypto_struct.h:364
psa_hash_operation_s::sha512
mbedtls_sha512_context sha512
Definition: crypto_struct.h:107
md4
#define md4
Definition: compat-1.3.h:1999
psa_hash_operation_s
Definition: crypto_struct.h:83
sha512.h
This file contains SHA-384 and SHA-512 definitions and functions.
psa_core_key_attributes_t
Definition: crypto_struct.h:331
psa_core_key_attributes_t::type
psa_key_type_t type
Definition: crypto_struct.h:332
psa_hkdf_key_derivation_t::offset_in_block
uint8_t offset_in_block
Definition: crypto_struct.h:211
psa_tls12_prf_key_derivation_s
Definition: crypto_struct.h:229
psa_aead_operation_init
static struct psa_aead_operation_s psa_aead_operation_init(void)
Definition: crypto_struct.h:194
psa_key_policy_init
static struct psa_key_policy_s psa_key_policy_init(void)
Definition: crypto_struct.h:288
mbedtls_ripemd160_context
RIPEMD-160 context structure.
Definition: ripemd160.h:52
psa_tls12_prf_key_derivation_t
struct psa_tls12_prf_key_derivation_s psa_tls12_prf_key_derivation_t
psa_hash_operation_s::ctx
union psa_hash_operation_s::@4 ctx
psa_tls12_prf_key_derivation_s::output_block
uint8_t output_block[PSA_HASH_MAX_SIZE]
Definition: crypto_struct.h:251
PSA_KEY_LIFETIME_VOLATILE
#define PSA_KEY_LIFETIME_VOLATILE
Definition: crypto_values.h:1555
psa_key_attributes_s::core
psa_core_key_attributes_t core
Definition: crypto_struct.h:344
TLS12_PRF_STATE_KEY_SET
@ TLS12_PRF_STATE_KEY_SET
Definition: crypto_struct.h:223
psa_key_id_t
uint32_t psa_key_id_t
Definition: crypto_types.h:237
psa_key_derivation_s::capacity
size_t capacity
Definition: crypto_struct.h:259
psa_set_key_type
static void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type)
Definition: crypto_struct.h:430
psa_key_bits_t
uint16_t psa_key_bits_t
Definition: crypto_struct.h:296
psa_key_derivation_operation_init
static struct psa_key_derivation_s psa_key_derivation_operation_init(void)
Definition: crypto_struct.h:273
psa_key_derivation_s::dummy
uint8_t dummy
Definition: crypto_struct.h:263
psa_key_policy_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:282
psa_core_key_attributes_t::flags
psa_key_attributes_flag_t flags
Definition: crypto_struct.h:337
psa_get_key_bits
static size_t psa_get_key_bits(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:463
psa_tls12_prf_key_derivation_s::hmac
psa_hmac_internal_data hmac
Definition: crypto_struct.h:247
psa_key_attributes_s::domain_parameters
void * domain_parameters
Definition: crypto_struct.h:348
psa_tls12_prf_key_derivation_s::seed_length
size_t seed_length
Definition: crypto_struct.h:244
psa_aead_operation_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:181
psa_set_key_bits
static void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits)
Definition: crypto_struct.h:454
psa_hash_operation_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:84
psa_tls12_prf_key_derivation_s::label
uint8_t * label
Definition: crypto_struct.h:245
psa_key_derivation_s::can_output_key
unsigned int can_output_key
Definition: crypto_struct.h:258
psa_hkdf_key_derivation_t::hmac
psa_hmac_internal_data hmac
Definition: crypto_struct.h:205
psa_key_policy_s::usage
psa_key_usage_t usage
Definition: crypto_struct.h:281
psa_key_derivation_s::ctx
union psa_key_derivation_s::@8 ctx
psa_aead_operation_s::cipher
mbedtls_cipher_context_t cipher
Definition: crypto_struct.h:189
mbedtls_sha512_context
The SHA-512 context structure.
Definition: sha512.h:58
psa_core_key_attributes_t::bits
psa_key_bits_t bits
Definition: crypto_struct.h:333
psa_aead_operation_s::iv_set
unsigned int iv_set
Definition: crypto_struct.h:183
psa_set_key_algorithm
static void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg)
Definition: crypto_struct.h:411
psa_set_key_lifetime
static void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
Definition: crypto_struct.h:378
psa_aead_operation_s
Definition: crypto_struct.h:180
cipher.h
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
PSA_CIPHER_OPERATION_INIT
#define PSA_CIPHER_OPERATION_INIT
Definition: crypto_struct.h:172
psa_cipher_operation_s::block_size
uint8_t block_size
Definition: crypto_struct.h:164
psa_hash_operation_s::dummy
unsigned dummy
Definition: crypto_struct.h:87
psa_get_key_id
static psa_key_id_t psa_get_key_id(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:372
psa_cipher_operation_s::cipher
mbedtls_cipher_context_t cipher
Definition: crypto_struct.h:168
psa_get_key_type
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:448
psa_key_derivation_s::alg
psa_algorithm_t alg
Definition: crypto_struct.h:257
psa_hmac_internal_data
Definition: crypto_struct.h:121
psa_key_slot_number_t
uint64_t psa_key_slot_number_t
Definition: crypto_se_driver.h:148
psa_key_usage_t
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
Definition: crypto_types.h:248
psa_hkdf_key_derivation_t::info_set
unsigned int info_set
Definition: crypto_struct.h:214
psa_cipher_operation_s
Definition: crypto_struct.h:158
psa_key_attributes_flag_t
uint16_t psa_key_attributes_flag_t
Definition: crypto_struct.h:314
psa_tls12_prf_key_derivation_s::state
psa_tls12_prf_key_derivation_state_t state
Definition: crypto_struct.h:241
PSA_KEY_DERIVATION_OPERATION_INIT
#define PSA_KEY_DERIVATION_OPERATION_INIT
Definition: crypto_struct.h:272
psa_cipher_operation_s::iv_required
unsigned int iv_required
Definition: crypto_struct.h:161
PSA_KEY_POLICY_INIT
#define PSA_KEY_POLICY_INIT
Definition: crypto_struct.h:287
psa_mac_operation_s::hmac
psa_hmac_internal_data hmac
Definition: crypto_struct.h:142
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:98
PSA_KEY_LIFETIME_PERSISTENT
#define PSA_KEY_LIFETIME_PERSISTENT
Definition: crypto_values.h:1570
psa_mac_operation_s::mac_size
uint8_t mac_size
Definition: crypto_struct.h:137
psa_hash_operation_s::ripemd160
mbedtls_ripemd160_context ripemd160
Definition: crypto_struct.h:98
psa_key_policy_s
Definition: crypto_struct.h:280
TLS12_PRF_STATE_INIT
@ TLS12_PRF_STATE_INIT
Definition: crypto_struct.h:221
ripemd160.h
RIPE MD-160 message digest.
psa_mac_operation_init
static struct psa_mac_operation_s psa_mac_operation_init(void)
Definition: crypto_struct.h:151
sha256.h
This file contains SHA-224 and SHA-256 definitions and functions.
psa_hash_operation_s::sha256
mbedtls_sha256_context sha256
Definition: crypto_struct.h:104
md2
#define md2
Definition: compat-1.3.h:1989
psa_tls12_prf_key_derivation_s::left_in_block
uint8_t left_in_block
Definition: crypto_struct.h:236
psa_key_derivation_s::tls12_prf
psa_tls12_prf_key_derivation_t tls12_prf
Definition: crypto_struct.h:266
TLS12_PRF_STATE_OUTPUT
@ TLS12_PRF_STATE_OUTPUT
Definition: crypto_struct.h:225
PSA_HASH_MAX_SIZE
#define PSA_HASH_MAX_SIZE
Definition: crypto_sizes.h:104
psa_key_type_t
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:66
md4.h
MD4 message digest algorithm (hash function)
psa_tls12_prf_key_derivation_s::seed
uint8_t * seed
Definition: crypto_struct.h:243
psa_mac_operation_s
Definition: crypto_struct.h:130
psa_cipher_operation_s::dummy
unsigned dummy
Definition: crypto_struct.h:167
gcm.h
This file contains GCM definitions and functions.
md5.h
MD5 message digest algorithm (hash function)
psa_aead_operation_s::ctx
union psa_aead_operation_s::@7 ctx
PSA_MAX_KEY_BITS
#define PSA_MAX_KEY_BITS
Definition: crypto_struct.h:305
md2.h
MD2 message digest algorithm (hash function)
mbedtls_sha256_context
The SHA-256 context structure.
Definition: sha256.h:59
psa_core_key_attributes_t::lifetime
psa_key_lifetime_t lifetime
Definition: crypto_struct.h:334
PSA_KEY_BITS_TOO_LARGE
#define PSA_KEY_BITS_TOO_LARGE
Definition: crypto_struct.h:299
psa_cipher_operation_s::iv_size
uint8_t iv_size
Definition: crypto_struct.h:163
mbedtls_cipher_context_t
Definition: cipher.h:293
psa_hkdf_key_derivation_t::block_number
uint8_t block_number
Definition: crypto_struct.h:212
psa_cipher_operation_s::ctx
union psa_cipher_operation_s::@6 ctx
psa_mac_operation_s::has_input
unsigned int has_input
Definition: crypto_struct.h:135
psa_mac_operation_s::key_set
unsigned int key_set
Definition: crypto_struct.h:132
psa_key_derivation_s::hkdf
psa_hkdf_key_derivation_t hkdf
Definition: crypto_struct.h:265
psa_key_attributes_s::domain_parameters_size
size_t domain_parameters_size
Definition: crypto_struct.h:349
psa_hkdf_key_derivation_t::info
uint8_t * info
Definition: crypto_struct.h:203
config.h
Configuration options (set of defines)
psa_set_key_usage_flags
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
Definition: crypto_struct.h:399
psa_mac_operation_s::iv_set
unsigned int iv_set
Definition: crypto_struct.h:134
PSA_HASH_OPERATION_INIT
#define PSA_HASH_OPERATION_INIT
Definition: crypto_struct.h:112
psa_get_key_algorithm
static psa_algorithm_t psa_get_key_algorithm(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:417
psa_tls12_prf_key_derivation_s::block_number
uint8_t block_number
Definition: crypto_struct.h:239
psa_set_key_domain_parameters
psa_status_t psa_set_key_domain_parameters(psa_key_attributes_t *attributes, psa_key_type_t type, const uint8_t *data, size_t data_length)
psa_hash_operation_init
static struct psa_hash_operation_s psa_hash_operation_init(void)
Definition: crypto_struct.h:113
psa_mac_operation_s::ctx
union psa_mac_operation_s::@5 ctx
psa_hkdf_key_derivation_t
Definition: crypto_struct.h:202
psa_key_attributes_init
static struct psa_key_attributes_s psa_key_attributes_init(void)
Definition: crypto_struct.h:358
psa_get_key_lifetime
static psa_key_lifetime_t psa_get_key_lifetime(const psa_key_attributes_t *attributes)
Definition: crypto_struct.h:393
cmac.h
This file contains CMAC definitions and functions.
psa_mac_operation_s::iv_required
unsigned int iv_required
Definition: crypto_struct.h:133
TLS12_PRF_STATE_LABEL_SET
@ TLS12_PRF_STATE_LABEL_SET
Definition: crypto_struct.h:224
psa_hash_operation_s::md5
mbedtls_md5_context md5
Definition: crypto_struct.h:95
psa_key_lifetime_t
uint32_t psa_key_lifetime_t
Definition: crypto_types.h:141
psa_hkdf_key_derivation_t::state
unsigned int state
Definition: crypto_struct.h:213
psa_tls12_prf_key_derivation_s::Ai
uint8_t Ai[PSA_HASH_MAX_SIZE]
Definition: crypto_struct.h:248
psa_tls12_prf_key_derivation_state_t
psa_tls12_prf_key_derivation_state_t
Definition: crypto_struct.h:220
mbedtls_md2_context
MD2 context structure.
Definition: md2.h:60
psa_key_derivation_s
Definition: crypto_struct.h:256
psa_hash_operation_s::sha1
mbedtls_sha1_context sha1
Definition: crypto_struct.h:101
psa_mac_operation_s::is_sign
unsigned int is_sign
Definition: crypto_struct.h:136
mbedtls_md4_context
MD4 context structure.
Definition: md4.h:61