Advertisement
Guest User

Untitled

a guest
May 20th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Most of a failed code modification to cpuminer-multi
  2. ; Maybe LucasJones knows what went wrong?
  3.  
  4. format ELF64
  5.  
  6. public CPUSupportsOptimizations
  7. public fast_aesb_pseudo_round_mut
  8.  
  9. ; Returns nonzero if AES instruction set is supported
  10. ; void CPUSupportsOptimizations(void)
  11. CPUSupportsOptimizations:
  12.     mov eax, 1
  13.     cpuid
  14.     and ecx, 0xFFFFFFDF
  15.     mov eax, ecx
  16.     ret
  17.  
  18. ; void fast_aesb_pseudo_round_mut(val, expandedKey)
  19. fast_aesb_pseudo_round_mut:
  20.     xor r9, r9                  ; Clear this so it can be used as a counter
  21.     mov r10, 9                  ; Number of rounds minus one
  22.    
  23.     movdqu xmm1, [rdi]          ; Move state into XMM1
  24.     pxor xmm1, [rsi]            ; Key whitening step
  25.     add rdx, 0x10               ; Advance expanded key
  26.    
  27.     .AESRoundLoop:
  28.         aesenc xmm1, [rsi]
  29.         add rdx, 0x10           ; Advance expanded key pointer
  30.        
  31.         inc r9                  ; Increment round counter
  32.         cmp r9, r10             ; Did we do all the rounds except one?
  33.         jl .AESRoundLoop        ; If not, loop some more
  34.        
  35.     aesenclast xmm1, [rsi]      ; Do last AES round (without MixColumns)
  36.    
  37.     ; Move the result back into the buffer the state
  38.     ; came in and get outta here.
  39.    
  40.     movdqu [rsi], xmm1
  41.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement