Mbed TLS v3.6.3
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
mbedcrypto
psa
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 are 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
* definitions 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
#include "
mbedtls/private_access.h
"
24
25
#include "
crypto_driver_common.h
"
26
27
/*
28
* Hash multi-part operation definitions.
29
*/
30
31
#include "
mbedtls/md5.h
"
32
#include "
mbedtls/ripemd160.h
"
33
#include "
mbedtls/sha1.h
"
34
#include "
mbedtls/sha256.h
"
35
#include "
mbedtls/sha512.h
"
36
#include "
mbedtls/sha3.h
"
37
38
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \
39
defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \
40
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \
41
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \
42
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
43
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
44
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
45
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
46
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
47
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
48
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
49
#define MBEDTLS_PSA_BUILTIN_HASH
50
#endif
51
52
typedef
struct
{
53
psa_algorithm_t
MBEDTLS_PRIVATE
(alg);
54
union
{
55
unsigned
dummy
;
/* Make the union non-empty even with no supported algorithms. */
56
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5)
57
mbedtls_md5_context
md5
;
58
#endif
59
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160)
60
mbedtls_ripemd160_context
ripemd160
;
61
#endif
62
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1)
63
mbedtls_sha1_context
sha1
;
64
#endif
65
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
66
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
67
mbedtls_sha256_context
sha256
;
68
#endif
69
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
70
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
71
mbedtls_sha512_context
sha512
;
72
#endif
73
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224) || \
74
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256) || \
75
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384) || \
76
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
77
mbedtls_sha3_context
sha3
;
78
#endif
79
}
MBEDTLS_PRIVATE
(ctx);
80
}
mbedtls_psa_hash_operation_t
;
81
82
#define MBEDTLS_PSA_HASH_OPERATION_INIT { 0, { 0 } }
83
84
/*
85
* Cipher multi-part operation definitions.
86
*/
87
88
#include "
mbedtls/cipher.h
"
89
90
#if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \
91
defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \
92
defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \
93
defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \
94
defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \
95
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
96
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7) || \
97
defined(MBEDTLS_PSA_BUILTIN_ALG_CCM_STAR_NO_TAG)
98
#define MBEDTLS_PSA_BUILTIN_CIPHER 1
99
#endif
100
101
typedef
struct
{
102
/* Context structure for the Mbed TLS cipher implementation. */
103
psa_algorithm_t
MBEDTLS_PRIVATE
(alg);
104
uint8_t
MBEDTLS_PRIVATE
(iv_length);
105
uint8_t
MBEDTLS_PRIVATE
(block_length);
106
union
{
107
unsigned
int
MBEDTLS_PRIVATE
(dummy);
108
mbedtls_cipher_context_t
MBEDTLS_PRIVATE
(cipher);
109
}
MBEDTLS_PRIVATE
(ctx);
110
}
mbedtls_psa_cipher_operation_t
;
111
112
#define MBEDTLS_PSA_CIPHER_OPERATION_INIT { 0, 0, 0, { 0 } }
113
114
#endif
/* PSA_CRYPTO_BUILTIN_PRIMITIVES_H */
mbedtls_psa_hash_operation_t::dummy
unsigned dummy
Definition:
crypto_builtin_primitives.h:55
mbedtls_cipher_context_t
Definition:
cipher.h:316
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition:
private_access.h:15
ripemd160.h
RIPE MD-160 message digest.
mbedtls_psa_cipher_operation_t
Definition:
crypto_builtin_primitives.h:101
mbedtls_sha512_context
Definition:
sha512_alt.h:10
mbedtls_psa_hash_operation_t::sha512
mbedtls_sha512_context sha512
Definition:
crypto_builtin_primitives.h:71
sha3.h
This file contains SHA-3 definitions and functions.
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition:
crypto_types.h:134
mbedtls_psa_hash_operation_t::md5
mbedtls_md5_context md5
Definition:
crypto_builtin_primitives.h:57
private_access.h
Macro wrapper for struct's members.
cipher.h
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
mbedtls_sha256_context
Definition:
sha256_alt.h:10
mbedtls_psa_hash_operation_t
Definition:
crypto_builtin_primitives.h:52
mbedtls_psa_hash_operation_t::ripemd160
mbedtls_ripemd160_context ripemd160
Definition:
crypto_builtin_primitives.h:60
mbedtls_ripemd160_context
Definition:
ripemd160_alt.h:10
sha1.h
This file contains SHA-1 definitions and functions.
mbedtls_md5_context
Definition:
md5_alt.h:10
mbedtls_psa_hash_operation_t::sha3
mbedtls_sha3_context sha3
Definition:
crypto_builtin_primitives.h:77
mbedtls_sha1_context
Definition:
sha1_alt.h:10
crypto_driver_common.h
Definitions for all PSA crypto drivers.
sha512.h
This file contains SHA-384 and SHA-512 definitions and functions.
md5.h
MD5 message digest algorithm (hash function)
sha256.h
This file contains SHA-224 and SHA-256 definitions and functions.
mbedtls_sha3_context
The SHA-3 context structure.
Definition:
sha3.h:50
mbedtls_psa_hash_operation_t::sha256
mbedtls_sha256_context sha256
Definition:
crypto_builtin_primitives.h:67
mbedtls_psa_hash_operation_t::sha1
mbedtls_sha1_context sha1
Definition:
crypto_builtin_primitives.h:63
Generated on Thu Jul 3 2025 18:37:15 for Mbed TLS v3.6.3 by
1.8.6