aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/aesni/data.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/aesni/data.h')
-rw-r--r--include/aesni/data.h156
1 files changed, 78 insertions, 78 deletions
diff --git a/include/aesni/data.h b/include/aesni/data.h
index d104f9d..de03110 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -16,146 +16,146 @@ extern "C"
{
#endif
-typedef __m128i AesBlock128;
+typedef __m128i AesNI_Block128;
-static __inline AesBlock128 load_aes_block128(const unsigned char* src)
+static __inline AesNI_Block128 aesni_load_block128(const void* src)
{
- return _mm_loadu_si128((AesBlock128*) src);
+ return _mm_loadu_si128((AesNI_Block128*) src);
}
-static __inline void __fastcall store_aes_block128(AesBlock128 block,
- unsigned char* dest)
+static __inline void __fastcall aesni_store_block128(
+ void* dest, AesNI_Block128 block)
{
- _mm_storeu_si128((AesBlock128*) dest, block);
+ _mm_storeu_si128((AesNI_Block128*) dest, block);
}
-static __inline AesBlock128 __fastcall make_aes_block128(int hi3, int hi2, int lo1, int lo0)
+static __inline AesNI_Block128 __fastcall aesni_make_block128(int hi3, int hi2, int lo1, int lo0)
{
return _mm_set_epi32(hi3, hi2, lo1, lo0);
}
typedef struct
{
- AesBlock128 hi;
- AesBlock128 lo;
+ AesNI_Block128 hi;
+ AesNI_Block128 lo;
}
-AesBlock192;
+AesNI_Block192;
-static __inline AesBlock192 __fastcall make_aes_block192(int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
+static __inline AesNI_Block192 __fastcall aesni_make_block192(int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
{
- AesBlock192 result;
- result.hi = make_aes_block128( 0, 0, hi5, hi4);
- result.lo = make_aes_block128(lo3, lo2, lo1, lo0);
+ AesNI_Block192 result;
+ result.hi = aesni_make_block128( 0, 0, hi5, hi4);
+ result.lo = aesni_make_block128(lo3, lo2, lo1, lo0);
return result;
}
typedef struct
{
- AesBlock128 hi;
- AesBlock128 lo;
+ AesNI_Block128 hi;
+ AesNI_Block128 lo;
}
-AesBlock256;
+AesNI_Block256;
-static __inline AesBlock256 __fastcall make_aes_block256(int hi7, int hi6, int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
+static __inline AesNI_Block256 __fastcall aesni_make_block256(int hi7, int hi6, int hi5, int hi4, int lo3, int lo2, int lo1, int lo0)
{
- AesBlock256 result;
- result.hi = make_aes_block128(hi7, hi6, hi5, hi4);
- result.lo = make_aes_block128(lo3, lo2, lo1, lo0);
+ AesNI_Block256 result;
+ result.hi = aesni_make_block128(hi7, hi6, hi5, hi4);
+ result.lo = aesni_make_block128(lo3, lo2, lo1, lo0);
return result;
}
typedef struct
{
- AesBlock128 keys[11];
+ AesNI_Block128 keys[11];
}
-Aes128KeySchedule;
+AesNI_KeySchedule128;
typedef struct
{
- AesBlock128 keys[13];
+ AesNI_Block128 keys[13];
}
-Aes192KeySchedule;
+AesNI_KeySchedule192;
typedef struct
{
- AesBlock128 keys[15];
+ AesNI_Block128 keys[15];
}
-Aes256KeySchedule;
+AesNI_KeySchedule256;
-static __inline AesBlock128 __fastcall aes128_reverse_byte_order(AesBlock128 block)
+static __inline AesNI_Block128 __fastcall aesni_reverse_byte_order128(AesNI_Block128 block)
{
- return _mm_shuffle_epi8(block, make_aes_block128(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f));
+ return _mm_shuffle_epi8(block, aesni_make_block128(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f));
}
-static __inline AesBlock128 __fastcall aes128_le2be(AesBlock128 block)
+static __inline AesNI_Block128 __fastcall aesni_le2be128(AesNI_Block128 block)
{
- return aes128_reverse_byte_order(block);
+ return aesni_reverse_byte_order128(block);
}
-static __inline AesBlock128 __fastcall aes128_be2le(AesBlock128 block)
+static __inline AesNI_Block128 __fastcall aesni_be2le128(AesNI_Block128 block)
{
- return aes128_reverse_byte_order(block);
+ return aesni_reverse_byte_order128(block);
}
-typedef struct { char str[33]; } AesBlockString128;
-typedef struct { char str[49]; } AesBlockString192;
-typedef struct { char str[65]; } AesBlockString256;
+typedef struct { char str[33]; } AesNI_BlockString128;
+typedef struct { char str[49]; } AesNI_BlockString192;
+typedef struct { char str[65]; } AesNI_BlockString256;
-AesBlockString128 format_aes_block128(AesBlock128*);
-AesBlockString192 format_aes_block192(AesBlock192*);
-AesBlockString256 format_aes_block256(AesBlock256*);
+AesNI_BlockString128 aesni_format_block128(AesNI_Block128*);
+AesNI_BlockString192 aesni_format_block192(AesNI_Block192*);
+AesNI_BlockString256 aesni_format_block256(AesNI_Block256*);
-AesBlockString128 format_aes_block128_le(AesBlock128*);
-AesBlockString192 format_aes_block192_le(AesBlock192*);
-AesBlockString256 format_aes_block256_le(AesBlock256*);
+AesNI_BlockString128 aesni_format_block128_le(AesNI_Block128*);
+AesNI_BlockString192 aesni_format_block192_le(AesNI_Block192*);
+AesNI_BlockString256 aesni_format_block256_le(AesNI_Block256*);
-AesBlockString128 format_aes_block128_be(AesBlock128*);
-AesBlockString192 format_aes_block192_be(AesBlock192*);
-AesBlockString256 format_aes_block256_be(AesBlock256*);
+AesNI_BlockString128 aesni_format_block128_be(AesNI_Block128*);
+AesNI_BlockString192 aesni_format_block192_be(AesNI_Block192*);
+AesNI_BlockString256 aesni_format_block256_be(AesNI_Block256*);
-typedef struct { char str[49]; } AesBlockMatrixString128;
-typedef struct { char str[73]; } AesBlockMatrixString192;
-typedef struct { char str[97]; } AesBlockMatrixString256;
+typedef struct { char str[49]; } AesNI_BlockMatrixString128;
+typedef struct { char str[73]; } AesNI_BlockMatrixString192;
+typedef struct { char str[97]; } AesNI_BlockMatrixString256;
-AesBlockMatrixString128 format_aes_block128_as_matrix(AesBlock128*);
-AesBlockMatrixString192 format_aes_block192_as_matrix(AesBlock192*);
-AesBlockMatrixString256 format_aes_block256_as_matrix(AesBlock256*);
+AesNI_BlockMatrixString128 aesni_format_block128_as_matrix(AesNI_Block128*);
+AesNI_BlockMatrixString192 aesni_format_block192_as_matrix(AesNI_Block192*);
+AesNI_BlockMatrixString256 aesni_format_block256_as_matrix(AesNI_Block256*);
-AesBlockMatrixString128 format_aes_block128_be_as_matrix(AesBlock128*);
-AesBlockMatrixString192 format_aes_block192_be_as_matrix(AesBlock192*);
-AesBlockMatrixString256 format_aes_block256_be_as_matrix(AesBlock256*);
+AesNI_BlockMatrixString128 aesni_format_block128_be_as_matrix(AesNI_Block128*);
+AesNI_BlockMatrixString192 aesni_format_block192_be_as_matrix(AesNI_Block192*);
+AesNI_BlockMatrixString256 aesni_format_block256_be_as_matrix(AesNI_Block256*);
-void print_aes_block128(AesBlock128*);
-void print_aes_block192(AesBlock192*);
-void print_aes_block256(AesBlock256*);
+void aesni_print_block128(AesNI_Block128*);
+void aesni_print_block192(AesNI_Block192*);
+void aesni_print_block256(AesNI_Block256*);
-void print_aes_block128_le(AesBlock128*);
-void print_aes_block192_le(AesBlock192*);
-void print_aes_block256_le(AesBlock256*);
+void aesni_print_block128_le(AesNI_Block128*);
+void aesni_print_block192_le(AesNI_Block192*);
+void aesni_print_block256_le(AesNI_Block256*);
-void print_aes_block128_be(AesBlock128*);
-void print_aes_block192_be(AesBlock192*);
-void print_aes_block256_be(AesBlock256*);
+void aesni_print_block128_be(AesNI_Block128*);
+void aesni_print_block192_be(AesNI_Block192*);
+void aesni_print_block256_be(AesNI_Block256*);
-void print_aes_block128_as_matrix(AesBlock128*);
-void print_aes_block192_as_matrix(AesBlock192*);
-void print_aes_block256_as_matrix(AesBlock256*);
+void aesni_print_block128_as_matrix(AesNI_Block128*);
+void aesni_print_block192_as_matrix(AesNI_Block192*);
+void aesni_print_block256_as_matrix(AesNI_Block256*);
-void print_aes_block128_be_as_matrix(AesBlock128*);
-void print_aes_block192_be_as_matrix(AesBlock192*);
-void print_aes_block256_be_as_matrix(AesBlock256*);
+void aesni_print_block128_be_as_matrix(AesNI_Block128*);
+void aesni_print_block192_be_as_matrix(AesNI_Block192*);
+void aesni_print_block256_be_as_matrix(AesNI_Block256*);
-int parse_aes_block128(AesBlock128*, const char*);
-int parse_aes_block192(AesBlock192*, const char*);
-int parse_aes_block256(AesBlock256*, const char*);
+int aesni_parse_block128(AesNI_Block128*, const char*);
+int aesni_parse_block192(AesNI_Block192*, const char*);
+int aesni_parse_block256(AesNI_Block256*, const char*);
-int parse_aes_block128_le(AesBlock128*, const char*);
-int parse_aes_block192_le(AesBlock192*, const char*);
-int parse_aes_block256_le(AesBlock256*, const char*);
+int aesni_parse_block128_le(AesNI_Block128*, const char*);
+int aesni_parse_block192_le(AesNI_Block192*, const char*);
+int aesni_parse_block256_le(AesNI_Block256*, const char*);
-int parse_aes_block128_be(AesBlock128*, const char*);
-int parse_aes_block192_be(AesBlock192*, const char*);
-int parse_aes_block256_be(AesBlock256*, const char*);
+int aesni_parse_block128_be(AesNI_Block128*, const char*);
+int aesni_parse_block192_be(AesNI_Block192*, const char*);
+int aesni_parse_block256_be(AesNI_Block256*, const char*);
#ifdef __cplusplus
}