crypto_struct.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef PSA_CRYPTO_PSA_CRYPTO_STRUCT_H
21 #define PSA_CRYPTO_PSA_CRYPTO_STRUCT_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "crypto_types.h"
28 #include "crypto_sizes.h"
29 #include "crypto_contexts.h"
30 
31 #if IS_USED(MODULE_PSA_AEAD) || defined(DOXYGEN)
38  int dummy;
39 };
40 
45 #define PSA_AEAD_OPERATION_INIT { 0 }
46 
52 static inline struct psa_aead_operation_s psa_aead_operation_init(void)
53 {
55 
56  return v;
57 }
58 #endif /* MODULE_PSA_AEAD */
59 
60 #if IS_USED(MODULE_PSA_CIPHER) || defined(DOXYGEN)
65  uint8_t iv_required : 1;
66  uint8_t iv_set : 1;
71  psa_cipher_context_t cipher_ctx;
72 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A) || defined(DOXYGEN)
73  psa_se_cipher_context_t se_ctx;
74 #endif
76 };
77 
82 #define PSA_CIPHER_OPERATION_INIT { 0 }
83 
89 static inline struct psa_cipher_operation_s psa_cipher_operation_init(void)
90 {
92 
93  return v;
94 }
95 #endif /* MODULE_PSA_CIPHER */
96 
97 #if IS_USED(MODULE_PSA_KEY_DERIVATION) || defined(DOXYGEN)
102 #define PSA_KEY_DERIVATION_OPERATION_INIT { 0 }
103 
110  int dummy;
111 };
112 
119 {
121 
122  return v;
123 }
124 #endif /* MODULE_PSA_KEY_DERIVATION */
125 
126 #if IS_USED(MODULE_PSA_HASH) || defined(DOXYGEN)
132 #if IS_USED(MODULE_PSA_HASH)
133  psa_hash_context_t ctx;
134 #endif
135 };
136 
141 #define PSA_HASH_OPERATION_INIT { 0 }
142 
148 static inline struct psa_hash_operation_s psa_hash_operation_init(void)
149 {
151 
152  return v;
153 }
154 #endif /* MODULE_PSA_HASH */
155 
156 #if IS_USED(MODULE_PSA_MAC) || defined(DOXYGEN)
161 #define PSA_MAC_OPERATION_INIT { 0 }
162 
169  int dummy;
170 };
171 
177 static inline struct psa_mac_operation_s psa_mac_operation_init(void)
178 {
180 
181  return v;
182 }
183 #endif /* MODULE_PSA_MAC */
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif /* PSA_CRYPTO_PSA_CRYPTO_STRUCT_H */
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: algorithm.h:39
Context definitions for PSA Crypto.
Size definitions for PSA Crypto.
#define PSA_CIPHER_OPERATION_INIT
This macro returns a suitable initializer for a cipher operation object of type psa_cipher_operation_...
Definition: crypto_struct.h:82
#define PSA_MAC_OPERATION_INIT
This macro returns a suitable initializer for a MAC operation object of type psa_mac_operation_t.
static struct psa_aead_operation_s psa_aead_operation_init(void)
Return an initial value for an AEAD operation object.
Definition: crypto_struct.h:52
#define PSA_KEY_DERIVATION_OPERATION_INIT
This macro returns a suitable initializer for a key derivation operation object of type psa_key_deriv...
#define PSA_HASH_OPERATION_INIT
This macro returns a suitable initializer for a hash operation object of type psa_hash_operation_t.
static struct psa_cipher_operation_s psa_cipher_operation_init(void)
Return an initial value for a cipher operation object.
Definition: crypto_struct.h:89
static struct psa_mac_operation_s psa_mac_operation_init(void)
Return an initial value for a MAC operation object.
static struct psa_hash_operation_s psa_hash_operation_init(void)
Return an initial value for a hash operation object.
static struct psa_key_derivation_operation_s psa_key_derivation_operation_init(void)
Return an initial value for a key derivation operation object.
#define PSA_AEAD_OPERATION_INIT
This macro returns a suitable initializer for an AEAD operation object of type psa_aead_operation_t.
Definition: crypto_struct.h:45
Type definitions for PSA Crypto.
Structure storing an AEAD operation context.
Definition: crypto_struct.h:37
int dummy
Not implemented, yet.
Definition: crypto_struct.h:38
Structure storing a cipher operation context.
Definition: crypto_struct.h:64
uint8_t iv_required
True if algorithm requires IV.
Definition: crypto_struct.h:65
psa_algorithm_t alg
Operation algorithm.
Definition: crypto_struct.h:68
uint8_t default_iv_length
Default IV length for algorithm.
Definition: crypto_struct.h:67
union psa_cipher_operation_s::cipher_context backend_ctx
Backend specific cipher context.
uint8_t iv_set
True if IV was already set.
Definition: crypto_struct.h:66
Structure containing a hash context and algorithm.
psa_algorithm_t alg
Operation algorithm.
Structure storing a key derivation context.
int dummy
Not implemented yet.
Structure storing a MAC operation context.
int dummy
Not yet implemented.
Union containing cipher contexts for the executing backend.
Definition: crypto_struct.h:70
psa_cipher_context_t cipher_ctx
Cipher context.
Definition: crypto_struct.h:71
psa_se_cipher_context_t se_ctx
SE Cipher context.
Definition: crypto_struct.h:73