Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- format ELF64
- public CPUSupportsOptimizations
- public fast_aesb_pseudo_round_mut
- public fast_aesb_single_round
- ; Returns nonzero if AES instruction set is supported
- ; void CPUSupportsOptimizations(void)
- CPUSupportsOptimizations:
- mov eax, 1
- cpuid
- and ecx, 0xFFFFFFDF
- mov eax, ecx
- ret
- ; void fast_aesb_single_round(in, out, expandedKey)
- fast_aesb_single_round:
- movdqu xmm1, [rdi] ; Move state into XMM1
- aesenc xmm1, [rdx]
- movdqu [rsi], xmm1
- ret
- ; void fast_aesb_pseudo_round_mut(val, expandedKey)
- fast_aesb_pseudo_round_mut:
- xor r9, r9 ; Clear this so it can be used as a counter
- mov r10, 10 ; Number of rounds
- movdqu xmm1, [rdi] ; Move state into XMM1
- .AESRoundLoop:
- aesenc xmm1, [rsi]
- add rsi, 0x10 ; Advance expanded key pointer
- inc r9 ; Increment round counter
- cmp r9, r10 ; Did we do all the rounds?
- jl .AESRoundLoop ; If not, loop some more
- movdqu [rdi], xmm1
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement