aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-10 03:06:24 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-10 03:06:24 +0300
commit82cef11d443c71c7d5ebc92f144c2b7ceb4e1cb2 (patch)
tree70eed008b868b440b915f1e02d8d8264865fa2e6 /include
parentadd KAT vectors from the CAVP (diff)
downloadaes-tools-82cef11d443c71c7d5ebc92f144c2b7ceb4e1cb2.tar.gz
aes-tools-82cef11d443c71c7d5ebc92f144c2b7ceb4e1cb2.zip
add file encryption utils for AES-128-ECB
Diffstat (limited to '')
-rw-r--r--include/aesni/all.h1
-rw-r--r--include/aesni/data.h11
-rw-r--r--include/aesni/file.h20
3 files changed, 32 insertions, 0 deletions
diff --git a/include/aesni/all.h b/include/aesni/all.h
index 3935d2a..a383b87 100644
--- a/include/aesni/all.h
+++ b/include/aesni/all.h
@@ -10,4 +10,5 @@
#include "api.h"
#include "data.h"
+#include "file.h"
#include "raw.h"
diff --git a/include/aesni/data.h b/include/aesni/data.h
index 0cee7c6..73b7f6e 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -13,6 +13,17 @@
typedef __m128i AesBlock128;
+static __inline AesBlock128 load_aes_block128(const unsigned char* src)
+{
+ return _mm_loadu_si128((AesBlock128*) src);
+}
+
+static __inline void __fastcall store_aes_block128(AesBlock128 block,
+ unsigned char* dest)
+{
+ _mm_storeu_si128((AesBlock128*) dest, block);
+}
+
static __inline AesBlock128 __fastcall make_aes_block128(int hi3, int hi2, int lo1, int lo0)
{
return _mm_set_epi32(hi3, hi2, lo1, lo0);
diff --git a/include/aesni/file.h b/include/aesni/file.h
new file mode 100644
index 0000000..eb84d09
--- /dev/null
+++ b/include/aesni/file.h
@@ -0,0 +1,20 @@
+/**
+ * \file
+ * \author Egor Tensin <Egor.Tensin@gmail.com>
+ * \date 2015
+ * \copyright This file is licensed under the terms of the MIT License.
+ * See LICENSE.txt for details.
+ */
+
+#pragma once
+
+#include <stdio.h>
+
+size_t aes128ecb_encrypt_file(const unsigned char* src,
+ size_t src_size,
+ unsigned char* dest,
+ Aes128KeySchedule* key_schedule);
+size_t aes128ecb_decrypt_file(const unsigned char* src,
+ size_t src_size,
+ unsigned char* dest,
+ Aes128KeySchedule* inverted_schedule);