@@ -34,6 +34,89 @@ default rel
3434
3535section .text align=IPP_ALIGN_FACTOR
3636
37+ ;;
38+ ;; void
39+ ;; cp_SHA3_224_Absorb(void *state, const Ipp8u *input, Ipp64u inlen);
40+ ;; Input:
41+ ;; - state/arg1: pointer to the state
42+ ;; - input/arg2: pointer to the input message
43+ ;; - inlen/arg3: length of the input message in bytes
44+ align IPP_ALIGN_FACTOR
45+ IPPASM cp_SHA3_224_Absorb , PUBLIC
46+ USES_GPR NONVOLATILE_REGS_LIN64_GPR NONVOLATILE_REGS_WIN64_GPR
47+ USES_XMM_AVX NONVOLATILE_REGS_WIN64_YMM
48+ COMP_ABI 3
49+
50+ mov arg1 , [ arg1 ] ; state.ctx into arg1
51+
52+ ; check for partially processed block
53+ mov r14 , [ arg1 + 8 * 25 ]
54+ or r14 , r14 ; s[25] == 0?
55+ je .absorb_main_loop_start
56+
57+ ; process remaining bytes if message long enough
58+ mov r12 , SHA3_224_RATE ; c = rate - s[25]
59+ sub r12 , r14 ; r12 = capacity
60+
61+ cmp arg3 , r12 ; if mlen < capacity then cannot permute yet
62+ jb .absorb_skip_permute
63+
64+ mov r10 , arg3
65+ lea r13 , [ arg1 + r14 ] ; r13 = state + s[25]
66+ mov arg3 , arg2
67+ CALL_IPPASM keccak_1600_partial_add
68+ mov arg3 , r10
69+
70+ CALL_IPPASM keccak_1600_load_state
71+ CALL_IPPASM keccak1600_block_64bit
72+
73+ mov qword [ arg1 + 8 * 25 ], 0 ; clear s[25]
74+ jmp .absorb_partial_block_done
75+
76+ .absorb_skip_permute:
77+ mov r11 , arg3 ; copy message length to r11
78+ xor r12 , r12 ; zero message offset
79+ add [ arg1 + 8 * 25 ], r11 ; store partially processed length in s[25]
80+ add arg1 , r14 ; state += s[25]
81+ jmp .absorb_final_partial_add
82+
83+ .absorb_main_loop_start:
84+ CALL_IPPASM keccak_1600_load_state
85+
86+ .absorb_partial_block_done:
87+ mov r11 , arg3 ; copy message length to r11
88+ xor r12 , r12 ; zero message offset
89+
90+ ; Process the input message in blocks
91+ align IPP_ALIGN_FACTOR
92+ .absorb_while_loop:
93+ cmp r11 , SHA3_224_RATE ; compare mlen to rate
94+ jb .absorb_while_loop_done
95+
96+ ABSORB_BYTES arg2 , r12 , SHA3_224_RATE ; input, offset, rate
97+
98+ sub r11 , SHA3_224_RATE ; Subtract the rate from the remaining length
99+ add r12 , SHA3_224_RATE ; Adjust the pointer to the next block of the input message
100+ CALL_IPPASM keccak1600_block_64bit ; Perform the Keccak permutation
101+ jmp .absorb_while_loop
102+
103+ align IPP_ALIGN_FACTOR
104+ .absorb_while_loop_done:
105+
106+ CALL_IPPASM keccak_1600_save_state
107+ add [ arg1 + 8 * 25 ], r11 ; store partially processed length in s[25]
108+
109+ .absorb_final_partial_add:
110+ add arg2 , r12
111+ mov r13 , arg1
112+ mov r12 , r11
113+ CALL_IPPASM keccak_1600_partial_add
114+
115+ REST_XMM_AVX
116+ REST_GPR
117+ ret
118+ ENDFUNC cp_SHA3_224_Absorb
119+
37120;;
38121;; void
39122;; cp_SHA3_256_Absorb(void *state, const Ipp8u *input, Ipp64u inlen);
0 commit comments