feat: add Jasmin assembly integration for crypto acceleration
- Integrated `zupt_mac_verify_ct` in `zupt_decrypt_buffer()` to replace C XOR loop for HMAC-SHA256 - Integrated `zupt_ct_select_32` in `zupt_mlkem768_decaps()` to replace C `cmov()` for FO transformation - Added `include/zupt_jasmin.h` with extern declarations and ABI docs - Added `#ifdef ZUPT_USE_JASMIN` guards with clean C fallbacks in `zupt_crypto.c` and `zupt_mlkem.c` - Makefile now auto-detects `jasmin/*.s`, assembles and links with `-DZUPT_USE_JASMIN` Closes #3
This commit is contained in:
parent
cea317653e
commit
06c877ec86
43 changed files with 1913 additions and 546 deletions
39
jasmin/zupt_mlkem_select.s
Normal file
39
jasmin/zupt_mlkem_select.s
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
.intel_syntax noprefix
|
||||
.text
|
||||
.p2align 5
|
||||
.global zupt_ct_select_32
|
||||
.type zupt_ct_select_32, %function
|
||||
zupt_ct_select_32:
|
||||
mov rax, 0
|
||||
sub rax, rcx
|
||||
mov rcx, qword ptr[rsi]
|
||||
mov r8, qword ptr[rdx]
|
||||
mov r9, rcx
|
||||
xor r9, r8
|
||||
and r9, rax
|
||||
xor rcx, r9
|
||||
mov qword ptr[rdi], rcx
|
||||
mov rcx, qword ptr[rsi + 8]
|
||||
mov r8, qword ptr[rdx + 8]
|
||||
mov r9, rcx
|
||||
xor r9, r8
|
||||
and r9, rax
|
||||
xor rcx, r9
|
||||
mov qword ptr[rdi + 8], rcx
|
||||
mov rcx, qword ptr[rsi + 16]
|
||||
mov r8, qword ptr[rdx + 16]
|
||||
mov r9, rcx
|
||||
xor r9, r8
|
||||
and r9, rax
|
||||
xor rcx, r9
|
||||
mov qword ptr[rdi + 16], rcx
|
||||
mov rcx, qword ptr[rsi + 24]
|
||||
mov r8, qword ptr[rdx + 24]
|
||||
mov r9, rcx
|
||||
xor r9, r8
|
||||
and r9, rax
|
||||
xor rcx, r9
|
||||
mov qword ptr[rdi + 24], rcx
|
||||
ret
|
||||
.ident "Jasmin Compiler 2026.03.0"
|
||||
.section ".note.GNU-stack", "", %progbits
|
||||
Loading…
Reference in a new issue