Loading...
Searching...
No Matches
crypto_contexts.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_CONTEXTS_H
21#define PSA_CRYPTO_PSA_CRYPTO_CONTEXTS_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "kernel_defines.h"
28
29#include "psa/crypto_includes.h"
30
31
32#if IS_USED(MODULE_PSA_HASH)
36typedef union {
37#if IS_USED(MODULE_PSA_HASH_MD5) || defined(DOXYGEN)
38 psa_hashes_md5_ctx_t md5;
39#endif
40#if IS_USED(MODULE_PSA_HASH_SHA_1) || defined(DOXYGEN)
42#endif
43#if IS_USED(MODULE_PSA_HASH_SHA_224) || defined(DOXYGEN)
45#endif
46#if IS_USED(MODULE_PSA_HASH_SHA_256) || defined(DOXYGEN)
48#endif
49#if IS_USED(MODULE_PSA_HASH_SHA_384) || defined(DOXYGEN)
50 psa_hashes_sha384_ctx_t sha384;
51#endif
52#if IS_USED(MODULE_PSA_HASH_SHA_512) || defined(DOXYGEN)
54#endif
55#if IS_USED(MODULE_PSA_HASH_SHA_512_224) || defined(DOXYGEN)
56 psa_hashes_sha512_224_ctx_t sha512_224;
57#endif
58#if IS_USED(MODULE_PSA_HASH_SHA_512_256) || defined(DOXYGEN)
59 psa_hashes_sha512_256_ctx_t sha512_256;
60#endif
61} psa_hash_context_t;
62#endif
63
64#if IS_USED(MODULE_PSA_CIPHER)
68typedef union {
69#if IS_USED(MODULE_PSA_CIPHER_AES_128_ECB) ||\
70 IS_USED(MODULE_PSA_CIPHER_AES_128_CBC) ||\
71 defined(DOXYGEN)
73#endif
74#if IS_USED(MODULE_PSA_CIPHER_AES_192_CBC) || defined(DOXYGEN)
75 psa_cipher_aes_192_ctx_t aes_192;
76#endif
77#if IS_USED(MODULE_PSA_CIPHER_AES_256_CBC) || defined(DOXYGEN)
78 psa_cipher_aes_256_ctx_t aes_256;
79#endif
80} psa_cipher_context_t;
81#endif
82
83#if IS_USED(MODULE_PSA_SECURE_ELEMENT)
88typedef struct {
89 psa_encrypt_or_decrypt_t direction;
91 union driver_context {
92 unsigned dummy;
93 #if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A) || defined(DOXYGEN)
94 atca_aes_cbc_ctx_t atca_aes_cbc;
95 #endif
96 } drv_ctx;
97} psa_se_cipher_context_t;
98#endif
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif /* PSA_CRYPTO_PSA_CRYPTO_CONTEXTS_H */
psa_encrypt_or_decrypt_t
For encrypt-decrypt functions, whether the operation is an encryption or a decryption.
void md5(void *digest, const void *data, size_t len)
Calculate a MD5 hash from the given data.
void sha1(void *digest, const void *data, size_t len)
Calculate a SHA1 hash from the given data.
void sha224(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash, this is useful for generating sha224 for one...
void sha256(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash, this is useful for generating sha256 for one...
void sha384(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash.
void sha512_224(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash.
void sha512_256(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash.
void sha512(const void *data, size_t len, void *digest)
A wrapper function to simplify the generation of a hash.
Common macros and compiler attributes/pragmas configuration.
SaSiAesUserContext_t psa_cipher_aes_128_ctx_t
Map driver specific AES context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha224_ctx_t
Map driver specific SHA224 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha256_ctx_t
Map driver specific SHA256 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha512_ctx_t
Map driver specific SHA512 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha1_ctx_t
Map driver specific SHA1 context to PSA context.