Implemented AES-128 encryption

This commit is contained in:
Mark Qvist 2019-02-07 18:36:40 +01:00
parent 0e24b54657
commit b3b1a9b253
15 changed files with 730 additions and 118 deletions

View file

@ -5,7 +5,8 @@
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "hardware/crypto/aes.h"
#include "hardware/crypto/AES.h"
#include "hardware/crypto/HMAC_MD5.h"
#include "hardware/LED.h"
#include "hardware/SD.h"
@ -15,9 +16,23 @@
#define CRYPTO_KEY_SIZE_BITS 128
#define CRYPTO_KEY_SIZE (CRYPTO_KEY_SIZE_BITS/8)
#define CRYPTO_HMAC_SIZE_BITS 128
#define CRYPTO_HMAC_SIZE (CRYPTO_HMAC_SIZE_BITS/8)
#define MAX_IVS_PER_ENTROPY_BLOCK 128
uint8_t crypto_work_block[CRYPTO_KEY_SIZE];
void crypto_init(void);
bool crypto_enabled(void);
bool crypto_generate_iv(void);
uint8_t* crypto_get_iv(void);
void crypto_set_iv_from_workblock(void);
void crypto_generate_hmac(uint8_t *data, size_t length);
void crypto_prepare(void);
void crypto_encrypt_block(uint8_t block[CRYPTO_KEY_SIZE]);
void crypto_decrypt_block(uint8_t block[CRYPTO_KEY_SIZE]);
void crypto_test(void);
bool load_key(void);