first version

This commit is contained in:
Martins Mozeiko
2017-09-23 10:18:46 -07:00
commit 0a7c2955d2
15 changed files with 1556 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <stdint.h>
#include <stddef.h>
#if defined(_MSC_VER)
# define MSVC_ALIGN(x) __declspec(align(x))
# define GCC_ALIGN(x)
#else
# define MSVC_ALIGN(x)
# define GCC_ALIGN(x) __attribute__((aligned(x)))
#endif
typedef struct {
MSVC_ALIGN(16) uint32_t key[44] GCC_ALIGN(16);
} aes128_key;
void aes128_init(aes128_key* context, const uint8_t* key);
void aes128_ecb_encrypt(const aes128_key* context, const uint8_t* input, uint8_t* output);
void aes128_ctr_xor(const aes128_key* context, const uint8_t* iv, uint64_t block, uint8_t* buffer, size_t size);