cipher_internal.h
Go to the documentation of this file.
#ifndef MBEDTLS_CIPHER_WRAP_H
#define MBEDTLS_CIPHER_WRAP_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "cipher.h"
#ifdef __cplusplus
extern "C" {
#endif
struct mbedtls_cipher_base_t
{
mbedtls_cipher_id_t cipher;
int (*ecb_func)( void *ctx, mbedtls_operation_t mode,
const unsigned char *input, unsigned char *output );
#if defined(MBEDTLS_CIPHER_MODE_CBC)
int (*cbc_func)( void *ctx, mbedtls_operation_t mode, size_t length,
unsigned char *iv, const unsigned char *input,
unsigned char *output );
#endif
#if defined(MBEDTLS_CIPHER_MODE_CFB)
int (*cfb_func)( void *ctx, mbedtls_operation_t mode, size_t length, size_t *iv_off,
unsigned char *iv, const unsigned char *input,
unsigned char *output );
#endif
#if defined(MBEDTLS_CIPHER_MODE_CTR)
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 );
#endif
#if defined(MBEDTLS_CIPHER_MODE_STREAM)
int (*stream_func)( void *ctx, size_t length,
const unsigned char *input, unsigned char *output );
#endif
int (*setkey_enc_func)( void *ctx, const unsigned char *key,
unsigned int key_bitlen );
int (*setkey_dec_func)( void *ctx, const unsigned char *key,
unsigned int key_bitlen);
void * (*ctx_alloc_func)( void );
void (*ctx_free_func)( void *ctx );
};
typedef struct
{
mbedtls_cipher_type_t type;
const mbedtls_cipher_info_t *info;
} mbedtls_cipher_definition_t;
extern const mbedtls_cipher_definition_t mbedtls_cipher_definitions[];
extern int mbedtls_cipher_supported[];
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_CIPHER_WRAP_H */
mbedtls_cipher_base_t::setkey_enc_func
int(* setkey_enc_func)(void *ctx, const unsigned char *key, unsigned int key_bitlen)
Set key for encryption purposes.
Definition: cipher_internal.h:80
mbedtls_operation_t
mbedtls_operation_t
Definition: cipher.h:151
mbedtls_cipher_base_t::setkey_dec_func
int(* setkey_dec_func)(void *ctx, const unsigned char *key, unsigned int key_bitlen)
Set key for decryption purposes.
Definition: cipher_internal.h:84
mbedtls_cipher_base_t::ctx_free_func
void(* ctx_free_func)(void *ctx)
Free the given context.
Definition: cipher_internal.h:91
config.h
Configuration options (set of defines)
mbedtls_cipher_definitions
const mbedtls_cipher_definition_t mbedtls_cipher_definitions[]
mbedtls_cipher_info_t
Cipher information.
Definition: cipher.h:181
mbedtls_cipher_base_t
Base cipher information.
Definition: cipher_internal.h:43
mbedtls_cipher_type_t
mbedtls_cipher_type_t
Definition: cipher.h:79
mbedtls_cipher_base_t::stream_func
int(* stream_func)(void *ctx, size_t length, const unsigned char *input, unsigned char *output)
Encrypt using STREAM.
Definition: cipher_internal.h:75
mbedtls_cipher_base_t::ctr_func
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.
Definition: cipher_internal.h:68
mbedtls_cipher_id_t
mbedtls_cipher_id_t
Definition: cipher.h:68
cipher.h
Generic cipher wrapper.
mbedtls_cipher_supported
int mbedtls_cipher_supported[]
mbedtls_cipher_definition_t
Definition: cipher_internal.h:95
mbedtls_cipher_base_t::cipher
mbedtls_cipher_id_t cipher
Base Cipher type (e.g.
Definition: cipher_internal.h:46
mbedtls_cipher_base_t::cfb_func
int(* cfb_func)(void *ctx, mbedtls_operation_t mode, size_t length, size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output)
Encrypt using CFB (Full length)
Definition: cipher_internal.h:61
mbedtls_cipher_definition_t::info
const mbedtls_cipher_info_t * info
Definition: cipher_internal.h:98
mbedtls_cipher_base_t::cbc_func
int(* cbc_func)(void *ctx, mbedtls_operation_t mode, size_t length, unsigned char *iv, const unsigned char *input, unsigned char *output)
Encrypt using CBC.
Definition: cipher_internal.h:54
mbedtls_cipher_base_t::ecb_func
int(* ecb_func)(void *ctx, mbedtls_operation_t mode, const unsigned char *input, unsigned char *output)
Encrypt using ECB.
Definition: cipher_internal.h:49
mbedtls_cipher_definition_t::type
mbedtls_cipher_type_t type
Definition: cipher_internal.h:97