Loading...
Searching...
No Matches
crypto_builtin_primitives.h
Go to the documentation of this file.
/*
* Context structure declaration of the Mbed TLS software-based PSA drivers
* called through the PSA Crypto driver dispatch layer.
* This file contains the context structures of those algorithms which do not
* rely on other algorithms, i.e. are 'primitive' algorithms.
*
* \note This file may not be included directly. Applications must
* include psa/crypto.h.
*
* \note This header and its content is not part of the Mbed TLS API and
* applications must not depend on it. Its main purpose is to define the
* multi-part state objects of the Mbed TLS software-based PSA drivers. The
* definition of these objects are then used by crypto_struct.h to define the
* implementation-defined types of PSA multi-part state objects.
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_BUILTIN_PRIMITIVES_H
#define PSA_CRYPTO_BUILTIN_PRIMITIVES_H
#include <psa/crypto_driver_common.h>
/*
* Hash multi-part operation definitions.
*/
#include "mbedtls/md2.h"
#include "mbedtls/md4.h"
#include "mbedtls/md5.h"
#include "mbedtls/ripemd160.h"
#include "mbedtls/sha1.h"
#include "mbedtls/sha256.h"
#include "mbedtls/sha512.h"
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_MD4) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_MD5) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
#define MBEDTLS_PSA_BUILTIN_HASH
#endif
typedef struct {
psa_algorithm_t alg;
union {
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD2)
mbedtls_md2_context md2;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD4)
mbedtls_md4_context md4;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_MD5)
mbedtls_md5_context md5;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RIPEMD160)
mbedtls_ripemd160_context ripemd160;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_1)
mbedtls_sha1_context sha1;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
mbedtls_sha256_context sha256;
#endif
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
mbedtls_sha512_context sha512;
#endif
} ctx;
} mbedtls_psa_hash_operation_t;
#define MBEDTLS_PSA_HASH_OPERATION_INIT { 0, { 0 } }
/*
* Cipher multi-part operation definitions.
*/
#include "mbedtls/cipher.h"
#if defined(MBEDTLS_PSA_BUILTIN_ALG_STREAM_CIPHER) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CTR) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CFB) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_OFB) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7)
#define MBEDTLS_PSA_BUILTIN_CIPHER 1
#endif
typedef struct {
/* Context structure for the Mbed TLS cipher implementation. */
psa_algorithm_t alg;
uint8_t iv_length;
uint8_t block_length;
union {
unsigned int dummy;
mbedtls_cipher_context_t cipher;
} ctx;
} mbedtls_psa_cipher_operation_t;
#define MBEDTLS_PSA_CIPHER_OPERATION_INIT { 0, 0, 0, { 0 } }
#endif /* PSA_CRYPTO_BUILTIN_PRIMITIVES_H */
cipher.h
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
crypto_driver_common.h
Definitions for all PSA crypto drivers.
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition crypto_types.h:125
md2.h
MD2 message digest algorithm (hash function)
md4.h
MD4 message digest algorithm (hash function)
md5.h
MD5 message digest algorithm (hash function)
ripemd160.h
RIPE MD-160 message digest.
sha1.h
This file contains SHA-1 definitions and functions.
sha256.h
This file contains SHA-224 and SHA-256 definitions and functions.
sha512.h
This file contains SHA-384 and SHA-512 definitions and functions.
mbedtls_cipher_context_t
Definition cipher.h:305
mbedtls_md2_context
MD2 context structure.
Definition md2.h:46
mbedtls_md4_context
MD4 context structure.
Definition md4.h:47
mbedtls_md5_context
MD5 context structure.
Definition md5.h:46
mbedtls_psa_cipher_operation_t
Definition crypto_builtin_primitives.h:98
mbedtls_psa_cipher_operation_t::block_length
uint8_t block_length
Definition crypto_builtin_primitives.h:102
mbedtls_psa_cipher_operation_t::dummy
unsigned int dummy
Definition crypto_builtin_primitives.h:104
mbedtls_psa_cipher_operation_t::alg
psa_algorithm_t alg
Definition crypto_builtin_primitives.h:100
mbedtls_psa_cipher_operation_t::iv_length
uint8_t iv_length
Definition crypto_builtin_primitives.h:101
mbedtls_psa_cipher_operation_t::cipher
mbedtls_cipher_context_t cipher
Definition crypto_builtin_primitives.h:105
mbedtls_psa_hash_operation_t
Definition crypto_builtin_primitives.h:50
mbedtls_psa_hash_operation_t::md5
mbedtls_md5_context md5
Definition crypto_builtin_primitives.h:61
mbedtls_psa_hash_operation_t::alg
psa_algorithm_t alg
Definition crypto_builtin_primitives.h:51
mbedtls_psa_hash_operation_t::dummy
unsigned dummy
Definition crypto_builtin_primitives.h:53
mbedtls_psa_hash_operation_t::ripemd160
mbedtls_ripemd160_context ripemd160
Definition crypto_builtin_primitives.h:64
mbedtls_psa_hash_operation_t::sha256
mbedtls_sha256_context sha256
Definition crypto_builtin_primitives.h:71
mbedtls_psa_hash_operation_t::sha1
mbedtls_sha1_context sha1
Definition crypto_builtin_primitives.h:67
mbedtls_psa_hash_operation_t::sha512
mbedtls_sha512_context sha512
Definition crypto_builtin_primitives.h:75
mbedtls_psa_hash_operation_t::md4
mbedtls_md4_context md4
Definition crypto_builtin_primitives.h:58
mbedtls_psa_hash_operation_t::md2
mbedtls_md2_context md2
Definition crypto_builtin_primitives.h:55
mbedtls_ripemd160_context
RIPEMD-160 context structure.
Definition ripemd160.h:38
mbedtls_sha1_context
The SHA-1 context structure.
Definition sha1.h:51
mbedtls_sha256_context
The SHA-256 context structure.
Definition sha256.h:46
mbedtls_sha512_context
The SHA-512 context structure.
Definition sha512.h:45