Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 TU Dresden
3 * SPDX-FileCopyrightText: 2021 HAW Hamburg
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include "crypto/psa/riot_ciphers.h"
26#include "kernel_defines.h"
27#include "psa/algorithm.h"
28
29#if IS_USED(MODULE_PERIPH_CIPHER_AES_128_CBC)
30#include "psa_periph_aes_ctx.h"
31#endif
32
33#if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A)
34#include "atca_params.h"
35#endif
36
41typedef enum {
42 PSA_CRYPTO_DRIVER_DECRYPT,
43 PSA_CRYPTO_DRIVER_ENCRYPT
45
49typedef union {
50#if IS_USED(MODULE_PSA_CIPHER_AES_128_ECB) ||\
51 IS_USED(MODULE_PSA_CIPHER_AES_128_CBC) ||\
52 defined(DOXYGEN)
54#endif
55#if IS_USED(MODULE_PSA_CIPHER_AES_192_CBC) || defined(DOXYGEN)
56 psa_cipher_aes_192_ctx_t aes_192;
57#endif
58#if IS_USED(MODULE_PSA_CIPHER_AES_256_CBC) || defined(DOXYGEN)
59 psa_cipher_aes_256_ctx_t aes_256;
60#endif
62
67typedef struct {
71 unsigned dummy;
72 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A) || defined(DOXYGEN)
73 atca_aes_cbc_ctx_t atca_aes_cbc;
74 #endif
75 } drv_ctx;
77
82 uint8_t iv_required : 1;
83 uint8_t iv_set : 1;
89#if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A) || defined(DOXYGEN)
91#endif
93};
94
126
131#define PSA_CIPHER_OPERATION_INIT { 0 }
132
139{
141
142 return v;
143}
144
145#ifdef __cplusplus
146}
147#endif
148
Algorithm definitions for the PSA Crypto API.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition algorithm.h:35
Default configuration for Microchip CryptoAuth devices.
Common macros and compiler attributes/pragmas configuration.
CryptoCell 310 driver specific AES contexts.
SaSiAesUserContext_t psa_cipher_aes_128_ctx_t
Map driver specific AES context to PSA context.
Structure storing a cipher operation context.
Definition types.h:81
uint8_t iv_required
True if algorithm requires IV.
Definition types.h:82
psa_algorithm_t alg
Operation algorithm.
Definition types.h:85
uint8_t default_iv_length
Default IV length for algorithm.
Definition types.h:84
union psa_cipher_operation_s::cipher_context backend_ctx
Backend specific cipher context.
uint8_t iv_set
True if IV was already set.
Definition types.h:83
Structure containing the secure element specific cipher contexts needed by the application.
Definition types.h:67
psa_encrypt_or_decrypt_t direction
Direction of this cipher operation.
Definition types.h:68
static psa_cipher_operation_t psa_cipher_operation_init(void)
Return an initial value for a cipher operation object.
Definition types.h:138
struct psa_cipher_operation_s psa_cipher_operation_t
The type of the state object for multi-part cipher operations.
Definition types.h:125
#define PSA_CIPHER_OPERATION_INIT
This macro returns a suitable initializer for a cipher operation object of type psa_cipher_operation_...
Definition types.h:131
psa_encrypt_or_decrypt_t
For encrypt-decrypt functions, whether the operation is an encryption or a decryption.
Definition types.h:41
Structure containing the cipher contexts needed by the application.
Definition types.h:49
psa_cipher_aes_192_ctx_t aes_192
AES 192 context.
Definition types.h:56
psa_cipher_aes_256_ctx_t aes_256
AES 256 context.
Definition types.h:59
psa_cipher_aes_128_ctx_t aes_128
AES 128 context.
Definition types.h:53
Union containing cipher contexts for the executing backend.
Definition types.h:87
psa_cipher_context_t cipher_ctx
Cipher context.
Definition types.h:88
psa_se_cipher_context_t se_ctx
SE Cipher context.
Definition types.h:90
Structure containing a driver specific cipher context.
Definition types.h:70
atca_aes_cbc_ctx_t atca_aes_cbc
ATCA AES CBC context.
Definition types.h:73
unsigned dummy
Make the union non-empty even with no supported algorithms.
Definition types.h:71