35#include "cipher/cipher_algorithms.h"
36#include "cipher_modes/cipher_modes.h"
38#include "boot_config.h"
41#define CIPHER_SUPPORT DISABLED
42#elif ((CIPHER_SUPPORT != ENABLED) && (CIPHER_SUPPORT != DISABLED))
43#error CIPHER_SUPPORT parameter is not valid!
47#define CIPHER_MAGIC_NUMBER "5ef41578fcfbb9a98ffc218dde463d44"
48#define CIPHER_MAGIC_NUMBER_SIZE 16
51#define MAX_CIPHER_IV_SIZE MAX_CIPHER_BLOCK_SIZE
65 CipherContext context;
66 const CipherAlgo *algo;
70 uint8_t iv[MAX_CIPHER_IV_SIZE];
76 const uint8_t *key,
size_t keyLen);
cboot_error_t
Error codes.
Definition cboot_error.h:57
cboot_error_t cipherGenerateIv(uint8_t *iv, size_t ivLen)
Generate the initialization vector of an image about to be encrypted. The default implementation gene...
Definition cipher.c:232
cboot_error_t cipherCheckMagicNumberCrc(uint32_t magicNumberCrc, bool_t *magicNumberIsValid)
Definition cipher.c:251
cboot_error_t cipherInit(CipherEngine *engine, const CipherAlgo *algo, CipherMode mode, const uint8_t *key, size_t keyLen)
Initialize cipher engine context.
Definition cipher.c:53
cboot_error_t cipherDecryptData(CipherEngine *cipherEngine, uint8_t *data, size_t length)
Decrypt given encrypted data using cipher engine.
Definition cipher.c:180
cboot_error_t cipherEncryptData(CipherEngine *cipherEngine, uint8_t *data, size_t length)
Encrypt given data using cipher engine.
Definition cipher.c:130
cboot_error_t cipherComputeMagicNumberCrc(uint32_t *magicNumberCrc)
Definition cipher.c:283
cboot_error_t cipherSetIv(CipherEngine *engine, uint8_t *iv, size_t ivLen)
Set cipher initialization vector.
Definition cipher.c:104
Cipher engine structure definition.
Definition cipher.h:64