Mbed TLS v2.28.9
crypto_builtin_composites.h
Go to the documentation of this file.
1 /*
2  * Context structure declaration of the Mbed TLS software-based PSA drivers
3  * called through the PSA Crypto driver dispatch layer.
4  * This file contains the context structures of those algorithms which need to
5  * rely on other algorithms, i.e. are 'composite' algorithms.
6  *
7  * \note This file may not be included directly. Applications must
8  * include psa/crypto.h.
9  *
10  * \note This header and its content is not part of the Mbed TLS API and
11  * applications must not depend on it. Its main purpose is to define the
12  * multi-part state objects of the Mbed TLS software-based PSA drivers. The
13  * definition of these objects are then used by crypto_struct.h to define the
14  * implementation-defined types of PSA multi-part state objects.
15  */
16 /*
17  * Copyright The Mbed TLS Contributors
18  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
19  */
20 
21 #ifndef PSA_CRYPTO_BUILTIN_COMPOSITES_H
22 #define PSA_CRYPTO_BUILTIN_COMPOSITES_H
23 
25 
26 /*
27  * MAC multi-part operation definitions.
28  */
29 #if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || \
30  defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC)
31 #define MBEDTLS_PSA_BUILTIN_MAC
32 #endif
33 
34 #if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM) || \
35  defined(MBEDTLS_PSA_BUILTIN_ALG_CCM) || \
36  defined(MBEDTLS_PSA_BUILTIN_ALG_CHACHA20_POLY1305)
37 #define MBEDTLS_PSA_BUILTIN_AEAD 1
38 #endif
39 
40 #if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
41 typedef struct {
45  struct psa_hash_operation_s hash_ctx;
49 
50 #define MBEDTLS_PSA_HMAC_OPERATION_INIT { 0, PSA_HASH_OPERATION_INIT, { 0 } }
51 #endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
52 
53 #include "mbedtls/cmac.h"
54 
55 typedef struct {
57  union {
58  unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
59 #if defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
61 #endif /* MBEDTLS_PSA_BUILTIN_ALG_HMAC */
62 #if defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || defined(PSA_CRYPTO_DRIVER_TEST)
64 #endif /* MBEDTLS_PSA_BUILTIN_ALG_CMAC */
65  } ctx;
67 
68 #define MBEDTLS_PSA_MAC_OPERATION_INIT { 0, { 0 } }
69 
70 #endif /* PSA_CRYPTO_BUILTIN_COMPOSITES_H */
#define PSA_HMAC_MAX_HASH_BLOCK_SIZE
Definition: crypto_sizes.h:125
This file contains CMAC definitions and functions.
psa_driver_hash_context_t ctx
Definition: crypto_struct.h:79
mbedtls_psa_hmac_operation_t hmac
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:125
Definitions for all PSA crypto drivers.