24#ifndef MBEDTLS_CIPHER_WRAP_H
25#define MBEDTLS_CIPHER_WRAP_H
27#if !defined(MBEDTLS_CONFIG_FILE)
30#include MBEDTLS_CONFIG_FILE
35#if defined(MBEDTLS_USE_PSA_CRYPTO)
53 const unsigned char *input,
unsigned char *output );
55#if defined(MBEDTLS_CIPHER_MODE_CBC)
58 unsigned char *iv,
const unsigned char *input,
59 unsigned char *output );
62#if defined(MBEDTLS_CIPHER_MODE_CFB)
65 unsigned char *iv,
const unsigned char *input,
66 unsigned char *output );
69#if defined(MBEDTLS_CIPHER_MODE_OFB)
71 int (*ofb_func)(
void *ctx,
size_t length,
size_t *iv_off,
73 const unsigned char *input,
74 unsigned char *output );
77#if defined(MBEDTLS_CIPHER_MODE_CTR)
79 int (*
ctr_func)(
void *ctx,
size_t length,
size_t *nc_off,
80 unsigned char *nonce_counter,
unsigned char *stream_block,
81 const unsigned char *input,
unsigned char *output );
84#if defined(MBEDTLS_CIPHER_MODE_XTS)
87 const unsigned char data_unit[16],
88 const unsigned char *input,
unsigned char *output );
91#if defined(MBEDTLS_CIPHER_MODE_STREAM)
93 int (*stream_func)(
void *ctx,
size_t length,
94 const unsigned char *input,
unsigned char *output );
99 unsigned int key_bitlen );
103 unsigned int key_bitlen);
106 void * (*ctx_alloc_func)( void );
119#if defined(MBEDTLS_USE_PSA_CRYPTO)
122 MBEDTLS_CIPHER_PSA_KEY_UNSET = 0,
123 MBEDTLS_CIPHER_PSA_KEY_OWNED,
128 MBEDTLS_CIPHER_PSA_KEY_NOT_OWNED,
132} mbedtls_cipher_psa_key_ownership;
138 mbedtls_cipher_psa_key_ownership slot_state;
139} mbedtls_cipher_context_psa;
144extern int mbedtls_cipher_supported[];
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
Configuration options (set of defines)
Platform Security Architecture cryptography module.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
uint32_t psa_key_id_t
Encoding of identifiers of persistent keys.
mbedtls_cipher_type_t
Supported {cipher type, cipher mode} pairs.
mbedtls_operation_t
Type of operation.
mbedtls_cipher_id_t
Supported cipher types.
mbedtls_cipher_id_t cipher
Base Cipher type (e.g.
int(* ecb_func)(void *ctx, mbedtls_operation_t mode, const unsigned char *input, unsigned char *output)
Encrypt using ECB.
int(* setkey_dec_func)(void *ctx, const unsigned char *key, unsigned int key_bitlen)
Set key for decryption purposes.
int(* ctr_func)(void *ctx, size_t length, size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, const unsigned char *input, unsigned char *output)
Encrypt using CTR.
void(* ctx_free_func)(void *ctx)
Free the given context.
int(* setkey_enc_func)(void *ctx, const unsigned char *key, unsigned int key_bitlen)
Set key for encryption purposes.