summaryrefslogtreecommitdiff
path: root/arm64
diff options
context:
space:
mode:
authorMamone Tarsha <maamoun.tk@googlemail.com>2021-08-08 16:12:16 +0300
committerMamone Tarsha <maamoun.tk@googlemail.com>2021-08-08 16:12:16 +0300
commita47813c241804fa3b60f6b1cdf2f0569214fc827 (patch)
treebbf2c7c0339be971794724543235647a7fbeeb0b /arm64
parent5f7740a3872e076688ec4767c5942d8b49c6efa7 (diff)
downloadnettle-a47813c241804fa3b60f6b1cdf2f0569214fc827.tar.gz
[AArch64] Utilize AES 1-block macros in 4-block macros
Diffstat (limited to 'arm64')
-rw-r--r--arm64/machine.m488
1 files changed, 36 insertions, 52 deletions
diff --git a/arm64/machine.m4 b/arm64/machine.m4
index 8256febd..d47825ae 100644
--- a/arm64/machine.m4
+++ b/arm64/machine.m4
@@ -6,32 +6,6 @@ C Get 128-bit floating-point register from vector register
C QFP(VR)
define(`QFP',``q'substr($1,1,len($1))')
-C AES encryption round of 4-blocks
-C AESE_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY)
-define(`AESE_ROUND_4B', m4_assert_numargs(5)`
- aese $1.16b,$5.16b
- aesmc $1.16b,$1.16b
- aese $2.16b,$5.16b
- aesmc $2.16b,$2.16b
- aese $3.16b,$5.16b
- aesmc $3.16b,$3.16b
- aese $4.16b,$5.16b
- aesmc $4.16b,$4.16b
-')
-
-C AES last encryption round of 4-blocks
-C AESE_LAST_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY0, KEY1)
-define(`AESE_LAST_ROUND_4B', m4_assert_numargs(6)`
- aese $1.16b,$5.16b
- eor $1.16b,$1.16b,$6.16b
- aese $2.16b,$5.16b
- eor $2.16b,$2.16b,$6.16b
- aese $3.16b,$5.16b
- eor $3.16b,$3.16b,$6.16b
- aese $4.16b,$5.16b
- eor $4.16b,$4.16b,$6.16b
-')
-
C AES encryption round of 1-block
C AESE_ROUND_1B(BLOCK, KEY)
define(`AESE_ROUND_1B', m4_assert_numargs(2)`
@@ -46,32 +20,6 @@ define(`AESE_LAST_ROUND_1B', m4_assert_numargs(3)`
eor $1.16b,$1.16b,$3.16b
')
-C AES decryption round of 4-blocks
-C AESD_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY)
-define(`AESD_ROUND_4B', m4_assert_numargs(5)`
- aesd $1.16b,$5.16b
- aesimc $1.16b,$1.16b
- aesd $2.16b,$5.16b
- aesimc $2.16b,$2.16b
- aesd $3.16b,$5.16b
- aesimc $3.16b,$3.16b
- aesd $4.16b,$5.16b
- aesimc $4.16b,$4.16b
-')
-
-C AES last decryption round of 4-blocks
-C AESD_LAST_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY0, KEY1)
-define(`AESD_LAST_ROUND_4B', m4_assert_numargs(6)`
- aesd $1.16b,$5.16b
- eor $1.16b,$1.16b,$6.16b
- aesd $2.16b,$5.16b
- eor $2.16b,$2.16b,$6.16b
- aesd $3.16b,$5.16b
- eor $3.16b,$3.16b,$6.16b
- aesd $4.16b,$5.16b
- eor $4.16b,$4.16b,$6.16b
-')
-
C AES decryption round of 1-block
C AESD_ROUND_1B(BLOCK, KEY)
define(`AESD_ROUND_1B', m4_assert_numargs(2)`
@@ -85,3 +33,39 @@ define(`AESD_LAST_ROUND_1B', m4_assert_numargs(3)`
aesd $1.16b,$2.16b
eor $1.16b,$1.16b,$3.16b
')
+
+C AES encryption round of 4-blocks
+C AESE_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY)
+define(`AESE_ROUND_4B', m4_assert_numargs(5)`
+ AESE_ROUND_1B($1,$5)
+ AESE_ROUND_1B($2,$5)
+ AESE_ROUND_1B($3,$5)
+ AESE_ROUND_1B($4,$5)
+')
+
+C AES last encryption round of 4-blocks
+C AESE_LAST_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY0, KEY1)
+define(`AESE_LAST_ROUND_4B', m4_assert_numargs(6)`
+ AESE_LAST_ROUND_1B($1,$5,$6)
+ AESE_LAST_ROUND_1B($2,$5,$6)
+ AESE_LAST_ROUND_1B($3,$5,$6)
+ AESE_LAST_ROUND_1B($4,$5,$6)
+')
+
+C AES decryption round of 4-blocks
+C AESD_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY)
+define(`AESD_ROUND_4B', m4_assert_numargs(5)`
+ AESD_ROUND_1B($1,$5)
+ AESD_ROUND_1B($2,$5)
+ AESD_ROUND_1B($3,$5)
+ AESD_ROUND_1B($4,$5)
+')
+
+C AES last decryption round of 4-blocks
+C AESD_LAST_ROUND_4B(BLOCK0, BLOCK1, BLOCK2, BLOCK3, KEY0, KEY1)
+define(`AESD_LAST_ROUND_4B', m4_assert_numargs(6)`
+ AESD_LAST_ROUND_1B($1,$5,$6)
+ AESD_LAST_ROUND_1B($2,$5,$6)
+ AESD_LAST_ROUND_1B($3,$5,$6)
+ AESD_LAST_ROUND_1B($4,$5,$6)
+')