aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-05-24 01:41:32 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-05-24 01:41:32 +0300
commitcd8edbd5e26829d9b6af7aee1c969eaf4840bee5 (patch)
treec8da692616a7e898132f14b4153172a19db618d3
parentcode style (diff)
downloadaes-tools-cd8edbd5e26829d9b6af7aee1c969eaf4840bee5.tar.gz
aes-tools-cd8edbd5e26829d9b6af7aee1c969eaf4840bee5.zip
add state-to-block conversion function
Diffstat (limited to '')
-rw-r--r--include/aesni/data.h1
-rw-r--r--src/common.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/include/aesni/data.h b/include/aesni/data.h
index 029d8c8..d2f6cd5 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -37,5 +37,6 @@ typedef struct
AesState;
AesState aes_block_to_state(AesBlock);
+AesBlock aes_state_to_block(AesState);
void print_aes_block(AesBlock);
diff --git a/src/common.c b/src/common.c
index 92f5e24..f4020db 100644
--- a/src/common.c
+++ b/src/common.c
@@ -24,6 +24,11 @@ AesState aes_block_to_state(AesBlock block)
return state;
}
+AesBlock aes_state_to_block(AesState state)
+{
+ return _mm_loadu_si128((__m128i*) &state.bytes);
+}
+
void print_aes_block(AesBlock block)
{
int i, j;