39 #if IS_USED(MODULE_CRYPTO_AES_256) 
   40     #define CIPHERS_MAX_KEY_SIZE 32 
   41 #elif IS_USED(MODULE_CRYPTO_AES_192) 
   42     #define CIPHERS_MAX_KEY_SIZE 24 
   44     #define CIPHERS_MAX_KEY_SIZE 16 
   46 #define CIPHER_MAX_BLOCK_SIZE 16 
   54 #if IS_USED(MODULE_CRYPTO_AES_256) || IS_USED(MODULE_CRYPTO_AES_192) || \ 
   55     IS_USED(MODULE_CRYPTO_AES_128) 
   56     #define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE 
   59     #define CIPHER_MAX_CONTEXT_SIZE 1 
   64 #define CIPHER_ERR_INVALID_KEY_SIZE   -3 
   65 #define CIPHER_ERR_INVALID_LENGTH     -4 
   66 #define CIPHER_ERR_ENC_FAILED         -5 
   67 #define CIPHER_ERR_DEC_FAILED         -6 
   70 #define CIPHER_ERR_BAD_CONTEXT_SIZE    0 
   72 #define CIPHER_INIT_SUCCESS            1 
   99                    uint8_t *cipher_block);
 
  103                    uint8_t *plain_block);
 
struct cipher_interface_st cipher_interface_t
BlockCipher-Interface for the Cipher-Algorithms.
 
int cipher_init(cipher_t *cipher, cipher_id_t cipher_id, const uint8_t *key, uint8_t key_size)
Initialize new cipher state.
 
#define CIPHER_MAX_CONTEXT_SIZE
Context sizes needed for the different ciphers.
 
int cipher_decrypt(const cipher_t *cipher, const uint8_t *input, uint8_t *output)
Decrypt data of BLOCK_SIZE length *.
 
int cipher_encrypt(const cipher_t *cipher, const uint8_t *input, uint8_t *output)
Encrypt data of BLOCK_SIZE length *.
 
int cipher_get_block_size(const cipher_t *cipher)
Get block size of cipher *.
 
const cipher_interface_t * cipher_id_t
Pointer type to BlockCipher-Interface for the Cipher-Algorithms.
 
const cipher_id_t CIPHER_AES
AES cipher id.
 
Common macros and compiler attributes/pragmas configuration.
 
the context for cipher-operations
 
uint8_t key_size
key size used
 
BlockCipher-Interface for the Cipher-Algorithms.
 
int(* decrypt)(const cipher_context_t *ctx, const uint8_t *cipher_block, uint8_t *plain_block)
the decrypt function
 
uint8_t block_size
Blocksize of this cipher.
 
int(* init)(cipher_context_t *ctx, const uint8_t *key, uint8_t key_size)
the init function.
 
int(* encrypt)(const cipher_context_t *ctx, const uint8_t *plain_block, uint8_t *cipher_block)
the encrypt function
 
basic struct for using block ciphers contains the cipher interface and the context
 
cipher_context_t context
The encryption context (buffer) for the algorithm.
 
const cipher_interface_t * interface
BlockCipher-Interface for the Cipher-Algorithms.