Mbed TLS v2.28.9
crypto_builtin_primitives.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 do not
5  * rely on other algorithms, i.e. are 'primitive' 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_PRIMITIVES_H
22 #define PSA_CRYPTO_BUILTIN_PRIMITIVES_H
23 
25 
26 /*
27  * Hash multi-part operation definitions.
28  */
29 
30 #include "mbedtls/md2.h"
31 #include "mbedtls/md4.h"
32 #include "mbedtls/md5.h"
33 #include "mbedtls/ripemd160.h"
34 #include "mbedtls/sha1.h"
35 #include "mbedtls/sha256.h"
36 #include "mbedtls/sha512.h"
37 
38 #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2) || \
39  defined(MBEDTLS_PSA_BUILTIN_ALG_MD4) || \
40  defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \
41  defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \
42  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \
43  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \
44  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
45  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
46  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
47 #define MBEDTLS_PSA_BUILTIN_HASH
48 #endif
49 
50 typedef struct {
52  union {
53  unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
54 #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2)
56 #endif
57 #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD4)
59 #endif
60 #if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5)
62 #endif
63 #if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160)
65 #endif
66 #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1)
68 #endif
69 #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
70  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
72 #endif
73 #if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
74  defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
76 #endif
77  } ctx;
79 
80 #define MBEDTLS_PSA_HASH_OPERATION_INIT { 0, { 0 } }
81 
82 /*
83  * Cipher multi-part operation definitions.
84  */
85 
86 #include "mbedtls/cipher.h"
87 
88 #if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \
89  defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \
90  defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \
91  defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \
92  defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \
93  defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
94  defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7)
95 #define MBEDTLS_PSA_BUILTIN_CIPHER 1
96 #endif
97 
98 typedef struct {
99  /* Context structure for the Mbed TLS cipher implementation. */
101  uint8_t iv_length;
102  uint8_t block_length;
103  union {
104  unsigned int dummy;
106  } ctx;
108 
109 #define MBEDTLS_PSA_CIPHER_OPERATION_INIT { 0, 0, 0, { 0 } }
110 
111 #endif /* PSA_CRYPTO_BUILTIN_PRIMITIVES_H */
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
#define md4
Definition: compat-1.3.h:2000
#define md2
Definition: compat-1.3.h:1990
Definitions for all PSA crypto drivers.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:125
MD2 message digest algorithm (hash function)
MD4 message digest algorithm (hash function)
MD5 message digest algorithm (hash function)
RIPE MD-160 message digest.
This file contains SHA-1 definitions and functions.
This file contains SHA-224 and SHA-256 definitions and functions.
This file contains SHA-384 and SHA-512 definitions and functions.
MD2 context structure.
Definition: md2.h:46
MD4 context structure.
Definition: md4.h:47
MD5 context structure.
Definition: md5.h:46
mbedtls_ripemd160_context ripemd160
RIPEMD-160 context structure.
Definition: ripemd160.h:38
The SHA-1 context structure.
Definition: sha1.h:51
The SHA-256 context structure.
Definition: sha256.h:46
The SHA-512 context structure.
Definition: sha512.h:45