7171
7272/ ************************ MACROS **************************** /
7373
74- #define STACK_LOCS 4
74+ #define MLK_STACK_LOCS 4
7575
76- #define STACK_SIZE ( 16 * 6 + (STACK_LOCS ) * 8 )
77- #define STACK_BASE_GPRS ( 3 * 8 + 8 )
78- #define STACK_LOC_INPUT ( 0 * 8 )
79- #define STACK_LOC_CONST ( 1 * 8 )
80- #define STACK_LOC_COUNT ( 2 * 8 )
81- #define STACK_LOC_MISC0 ( 3 * 8 )
76+ #define MLK_STACK_SIZE ( 16 * 6 + (MLK_STACK_LOCS ) * 8 )
77+ #define MLK_STACK_BASE_GPRS ( 3 * 8 + 8 )
78+ #define MLK_STACK_LOC_INPUT ( 0 * 8 )
79+ #define MLK_STACK_LOC_CONST ( 1 * 8 )
80+ #define MLK_STACK_LOC_COUNT ( 2 * 8 )
81+ #define MLK_STACK_LOC_MISC0 ( 3 * 8 )
8282
8383.macro alloc_stack
84- sub sp , sp , #(STACK_SIZE )
84+ sub sp , sp , #(MLK_STACK_SIZE )
8585.endm
8686
8787.macro free_stack
88- add sp , sp , #(STACK_SIZE )
88+ add sp , sp , #(MLK_STACK_SIZE )
8989.endm
9090
9191.macro save_gprs
92- stp x19 , x20 , [ sp , #(STACK_BASE_GPRS + 16 * 0 ) ]
93- stp x21 , x22 , [ sp , #(STACK_BASE_GPRS + 16 * 1 ) ]
94- stp x23 , x24 , [ sp , #(STACK_BASE_GPRS + 16 * 2 ) ]
95- stp x25 , x26 , [ sp , #(STACK_BASE_GPRS + 16 * 3 ) ]
96- stp x27 , x28 , [ sp , #(STACK_BASE_GPRS + 16 * 4 ) ]
97- stp x29 , x30 , [ sp , #(STACK_BASE_GPRS + 16 * 5 ) ]
92+ stp x19 , x20 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 0 ) ]
93+ stp x21 , x22 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 1 ) ]
94+ stp x23 , x24 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 2 ) ]
95+ stp x25 , x26 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 3 ) ]
96+ stp x27 , x28 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 4 ) ]
97+ stp x29 , x30 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 5 ) ]
9898.endm
9999
100100.macro restore_gprs
101- ldp x19 , x20 , [ sp , #(STACK_BASE_GPRS + 16 * 0 ) ]
102- ldp x21 , x22 , [ sp , #(STACK_BASE_GPRS + 16 * 1 ) ]
103- ldp x23 , x24 , [ sp , #(STACK_BASE_GPRS + 16 * 2 ) ]
104- ldp x25 , x26 , [ sp , #(STACK_BASE_GPRS + 16 * 3 ) ]
105- ldp x27 , x28 , [ sp , #(STACK_BASE_GPRS + 16 * 4 ) ]
106- ldp x29 , x30 , [ sp , #(STACK_BASE_GPRS + 16 * 5 ) ]
101+ ldp x19 , x20 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 0 ) ]
102+ ldp x21 , x22 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 1 ) ]
103+ ldp x23 , x24 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 2 ) ]
104+ ldp x25 , x26 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 3 ) ]
105+ ldp x27 , x28 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 4 ) ]
106+ ldp x29 , x30 , [ sp , #(MLK_STACK_BASE_GPRS + 16 * 5 ) ]
107107.endm
108108
109109.macro load_state
164164 ror Asu , Asu , #( 64 - 55 )
165165.endm
166166
167- #define KECCAK_F1600_ROUNDS 24
167+ #define MLK_KECCAK_F1600_ROUNDS 24
168168
169169 .text
170170 . global MLK_ASM_NAMESPACE(keccak_f1600_x1_scalar_asm)
@@ -175,9 +175,9 @@ MLK_ASM_FN_SYMBOL(keccak_f1600_x1_scalar_asm)
175175
176176keccak_f1600_x1_scalar_initial:
177177 mov const_addr , input_rc
178- str input_rc , [ sp , #STACK_LOC_CONST ]
178+ str input_rc , [ sp , #MLK_STACK_LOC_CONST ]
179179 load_state
180- str input_addr , [ sp , #STACK_LOC_INPUT ] // @slothy:writes=STACK_LOC_INPUT
180+ str input_addr , [ sp , #MLK_STACK_LOC_INPUT ] // @slothy:writes=MLK_STACK_LOC_INPUT
181181
182182 // (Optimized for Cortex - A55)
183183 // Instructions: 107
@@ -209,7 +209,7 @@ keccak_f1600_x1_scalar_initial:
209209 eor x30 , x30 , x29 , ror # 63 // ......... * ............................................
210210 eor x22 , x22 , x30 // .......... * ...........................................
211211 eor x23 , x23 , x30 // .......... * ...........................................
212- str x23 , [ sp , #STACK_LOC_MISC0 ] // ........... * ..........................................
212+ str x23 , [ sp , #MLK_STACK_LOC_MISC0 ] // ........... * ..........................................
213213 eor x23 , x14 , x15 // ........... * ..........................................
214214 eor x14 , x14 , x0 // ............ * .........................................
215215 eor x23 , x23 , x11 // ............ * .........................................
@@ -237,7 +237,7 @@ keccak_f1600_x1_scalar_initial:
237237 eor x12 , x3 , x27 // ........................ * .............................
238238 bic x3 , x13 , x17 , ror # 19 // ........................ * .............................
239239 eor x5 , x5 , x27 // ......................... * ............................
240- ldr x27 , [ sp , #STACK_LOC_MISC0 ] // ......................... * ............................
240+ ldr x27 , [ sp , #MLK_STACK_LOC_MISC0 ] // ......................... * ............................
241241 bic x25 , x17 , x2 , ror # 5 // .......................... * ...........................
242242 eor x9 , x9 , x29 // .......................... * ...........................
243243 eor x23 , x25 , x5 , ror # 52 // ........................... * ..........................
@@ -267,12 +267,12 @@ keccak_f1600_x1_scalar_initial:
267267 eor x12 , x15 , x12 , ror # 58 // ....................................... * ..............
268268 eor x15 , x5 , x27 , ror # 27 // ....................................... * ..............
269269 eor x5 , x20 , x11 , ror # 41 // ........................................ * .............
270- ldr x11 , [ sp , #STACK_LOC_CONST ] // ........................................ * .............
270+ ldr x11 , [ sp , #MLK_STACK_LOC_CONST ] // ........................................ * .............
271271 eor x20 , x17 , x4 , ror # 21 // ......................................... * ............
272272 eor x17 , x24 , x9 , ror # 47 // ......................................... * ............
273273 mov x24 , # 1 // .......................................... * ...........
274274 bic x9 , x0 , x16 , ror # 9 // .......................................... * ...........
275- str x24 , [ sp , #STACK_LOC_COUNT ] // ........................................... * ..........
275+ str x24 , [ sp , #MLK_STACK_LOC_COUNT ] // ........................................... * ..........
276276 bic x24 , x29 , x1 , ror # 44 // ........................................... * ..........
277277 bic x27 , x1 , x21 , ror # 50 // ............................................ * .........
278278 bic x4 , x26 , x29 , ror # 63 // ............................................ * .........
@@ -323,7 +323,7 @@ keccak_f1600_x1_scalar_initial:
323323 ror x26 , x26 , # 58 // ........ * ................................................
324324 eor x16 , x30 , x16 // ......... * ...............................................
325325 eor x28 , x30 , x28 , ror # 63 // ......... * ...............................................
326- str x28 , [ sp , #STACK_LOC_MISC0 ] // .......... * ..............................................
326+ str x28 , [ sp , #MLK_STACK_LOC_MISC0 ] // .......... * ..............................................
327327 eor x29 , x29 , x17 , ror # 36 // .......... * ..............................................
328328 eor x28 , x1 , x2 , ror # 61 // ........... * .............................................
329329 eor x19 , x30 , x19 , ror # 37 // ........... * .............................................
@@ -377,9 +377,9 @@ keccak_f1600_x1_scalar_initial:
377377 eor x16 , x21 , x19 , ror # 43 // .................................... * ....................
378378 eor x21 , x17 , x25 , ror # 30 // .................................... * ....................
379379 bic x19 , x25 , x19 , ror # 57 // ..................................... * ...................
380- ldr x25 , [ sp , #STACK_LOC_COUNT ] // ..................................... * ...................
380+ ldr x25 , [ sp , #MLK_STACK_LOC_COUNT ] // ..................................... * ...................
381381 eor x17 , x10 , x9 , ror # 47 // ...................................... * ..................
382- ldr x9 , [ sp , #STACK_LOC_CONST ] // ...................................... * ..................
382+ ldr x9 , [ sp , #MLK_STACK_LOC_CONST ] // ...................................... * ..................
383383 eor x15 , x20 , x28 , ror # 27 // ....................................... * .................
384384 bic x20 , x4 , x28 , ror # 2 // ....................................... * .................
385385 eor x10 , x20 , x1 , ror # 50 // ........................................ * ................
@@ -388,10 +388,10 @@ keccak_f1600_x1_scalar_initial:
388388 bic x4 , x28 , x1 , ror # 48 // ......................................... * ...............
389389 bic x1 , x1 , x11 , ror # 57 // .......................................... * ..............
390390 ldr x28 , [ x9 , x25 , LSL # 3 ] // .......................................... * ..............
391- ldr x9 , [ sp , #STACK_LOC_MISC0 ] // ........................................... * .............
391+ ldr x9 , [ sp , #MLK_STACK_LOC_MISC0 ] // ........................................... * .............
392392 add x25 , x25 , # 1 // ........................................... * .............
393- str x25 , [ sp , #STACK_LOC_COUNT ] // ............................................ * ............
394- cmp x25 , #(KECCAK_F1600_ROUNDS - 1 ) // ............................................ * ............
393+ str x25 , [ sp , #MLK_STACK_LOC_COUNT ] // ............................................ * ............
394+ cmp x25 , #(MLK_KECCAK_F1600_ROUNDS - 1 ) // ............................................ * ............
395395 eor x25 , x1 , x27 , ror # 53 // ............................................. * ...........
396396 bic x27 , x30 , x26 , ror # 47 // ............................................. * ...........
397397 eor x1 , x5 , x28 // .............................................. * ..........
@@ -419,7 +419,7 @@ keccak_f1600_x1_scalar_initial:
419419 ble keccak_f1600_x1_scalar_loop
420420
421421 final_rotate
422- ldr input_addr , [ sp , #STACK_LOC_INPUT ]
422+ ldr input_addr , [ sp , #MLK_STACK_LOC_INPUT ]
423423 store_state
424424
425425 restore_gprs
@@ -458,14 +458,14 @@ keccak_f1600_x1_scalar_initial:
458458
459459/ * To facilitate single - compilation - unit (SCU) builds , undefine all macros.
460460 * Don't modify by hand -- this is auto - generated by scripts/autogen. * /
461- #undef STACK_LOCS
462- #undef STACK_SIZE
463- #undef STACK_BASE_GPRS
464- #undef STACK_LOC_INPUT
465- #undef STACK_LOC_CONST
466- #undef STACK_LOC_COUNT
467- #undef STACK_LOC_MISC0
468- #undef KECCAK_F1600_ROUNDS
461+ #undef MLK_STACK_LOCS
462+ #undef MLK_STACK_SIZE
463+ #undef MLK_STACK_BASE_GPRS
464+ #undef MLK_STACK_LOC_INPUT
465+ #undef MLK_STACK_LOC_CONST
466+ #undef MLK_STACK_LOC_COUNT
467+ #undef MLK_STACK_LOC_MISC0
468+ #undef MLK_KECCAK_F1600_ROUNDS
469469
470470/ * simpasm: footer - start * /
471471#endif / * MLK_FIPS202_AARCH64_NEED_X1_SCALAR && \
0 commit comments