Loading...
Searching...
No Matches
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
24extern "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_KEY_MANAGEMENT) || defined(DOXYGEN)
39
44
55
60#define PSA_KEY_ATTRIBUTES_INIT { 0 }
61
68{
70
71 return v;
72}
73#endif /*(MODULE_PSA_KEY_MANAGEMENT */
74
75#if IS_USED(MODULE_PSA_AEAD) || defined(DOXYGEN)
82 int dummy;
83};
84
89#define PSA_AEAD_OPERATION_INIT { 0 }
90
97{
99
100 return v;
101}
102#endif /* MODULE_PSA_AEAD */
103
104#if IS_USED(MODULE_PSA_CIPHER) || defined(DOXYGEN)
109 uint8_t iv_required : 1;
110 uint8_t iv_set : 1;
115 psa_cipher_context_t cipher_ctx;
116#if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A) || defined(DOXYGEN)
117 psa_se_cipher_context_t se_ctx;
118#endif
120};
121
126#define PSA_CIPHER_OPERATION_INIT { 0 }
127
134{
136
137 return v;
138}
139#endif /* MODULE_PSA_CIPHER */
140
141#if IS_USED(MODULE_PSA_KEY_DERIVATION) || defined(DOXYGEN)
146#define PSA_KEY_DERIVATION_OPERATION_INIT { 0 }
147
156
168#endif /* MODULE_PSA_KEY_DERIVATION */
169
170#if IS_USED(MODULE_PSA_HASH) || defined(DOXYGEN)
176#if IS_USED(MODULE_PSA_HASH)
177 psa_hash_context_t ctx;
178#endif
179};
180
185#define PSA_HASH_OPERATION_INIT { 0 }
186
193{
195
196 return v;
197}
198#endif /* MODULE_PSA_HASH */
199
200#if IS_USED(MODULE_PSA_MAC) || defined(DOXYGEN)
205#define PSA_MAC_OPERATION_INIT { 0 }
206
213 int dummy;
214};
215
222{
224
225 return v;
226}
227#endif /* MODULE_PSA_MAC */
228
229#ifdef __cplusplus
230}
231#endif
232
233#endif /* PSA_CRYPTO_PSA_CRYPTO_STRUCT_H */
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_...
#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.
#define PSA_KEY_DERIVATION_OPERATION_INIT
This macro returns a suitable initializer for a key derivation operation object of type psa_key_deriv...
static struct psa_key_attributes_s psa_key_attributes_init(void)
Return an initial value for a key attribute object.
#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.
static struct psa_mac_operation_s psa_mac_operation_init(void)
Return an initial value for a MAC operation object.
#define PSA_KEY_ATTRIBUTES_INIT
This macro returns a suitable initializer for a key attribute object of type psa_key_attributes_t.
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.
Type definitions for PSA Crypto.
uint32_t psa_key_id_t
Key identifier.
uint16_t psa_key_bits_t
Public interfaces use size_t, but internally we use a smaller type.
uint16_t psa_key_type_t
Encoding of a key type.
uint32_t psa_key_lifetime_t
Encoding of key lifetimes.
uint32_t psa_key_usage_t
Encoding of permitted usage on a key.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Structure storing an AEAD operation context.
int dummy
Not implemented, yet.
Structure storing a cipher operation context.
uint8_t iv_required
True if algorithm requires IV.
psa_algorithm_t alg
Operation algorithm.
uint8_t default_iv_length
Default IV length for algorithm.
union psa_cipher_operation_s::cipher_context backend_ctx
Backend specific cipher context.
uint8_t iv_set
True if IV was already set.
Structure containing a hash context and algorithm.
psa_algorithm_t alg
Operation algorithm.
Structure storing key attributes.
psa_key_id_t id
Key identifier.
psa_key_bits_t bits
Size of key in bits.
psa_key_policy_t policy
Key usage policy.
psa_key_type_t type
Type of key.
psa_key_lifetime_t lifetime
Lifetime of key.
Structure storing a key derivation context.
int dummy
Not implemented yet.
Structure storing the key usage policies.
psa_key_usage_t usage
Key usage policy.
psa_algorithm_t alg
Algorithm for key usage.
Structure storing a MAC operation context.
int dummy
Not yet implemented.
Union containing cipher contexts for the executing backend.
psa_cipher_context_t cipher_ctx
Cipher context.
psa_se_cipher_context_t se_ctx
SE Cipher context.