Skip to content

Commit

Permalink
Merge pull request lucasjones#4 from wolf9466/master
Browse files Browse the repository at this point in the history
Minor optimizations
  • Loading branch information
lucasjones committed May 22, 2014
2 parents 834d79c + 194148b commit 5db4950
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
30 changes: 14 additions & 16 deletions aesb-x64.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
fast_aesb_single_round:
_fast_aesb_single_round:
#if defined(_WIN64) || defined(__CYGWIN__)
movdqu (%rcx), %xmm1
movdqa (%rcx), %xmm1
aesenc (%r8), %xmm1
movdqu %xmm1, (%rdx)
movdqa %xmm1, (%rdx)
#else
movdqu (%rdi), %xmm1
movdqa (%rdi), %xmm1
aesenc (%rdx), %xmm1
movdqu %xmm1, (%rsi)
movdqa %xmm1, (%rsi)
#endif
ret

Expand All @@ -28,30 +28,28 @@ _fast_aesb_single_round:
fast_aesb_pseudo_round_mut:
_fast_aesb_pseudo_round_mut:
#if defined(_WIN64) || defined(__CYGWIN__)
mov $0, %r9
mov $10, %r10
movdqu (%rcx), %xmm1
mov %rdx, %r9
add $0xA0, %r9
movdqa (%rcx), %xmm1

.LOOP:
aesenc (%rdx), %xmm1
add $0x10, %rdx
inc %r9
cmp %r10, %r9
cmp %r9, %rdx
jl .LOOP

movdqu %xmm1, (%rcx)
movdqa %xmm1, (%rcx)
#else
mov $0, %r9
mov $10, %r10
movdqu (%rdi), %xmm1
mov %rsi, %r9
add $0xA0, %r9
movdqa (%rdi), %xmm1

.LOOP:
aesenc (%rsi), %xmm1
add $0x10, %rsi
inc %r9
cmp %r10, %r9
cmp %r9, %rsi
jl .LOOP

movdqu %xmm1, (%rdi)
movdqa %xmm1, (%rdi)
#endif
ret
2 changes: 1 addition & 1 deletion cryptonight.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static inline void xor_blocks_dst(const uint8_t* a, const uint8_t* b, uint8_t* d
struct cryptonight_ctx {
uint8_t long_state[MEMORY] __attribute((aligned(16)));
union cn_slow_hash_state state;
uint8_t text[INIT_SIZE_BYTE];
uint8_t text[INIT_SIZE_BYTE] __attribute((aligned(16)));
uint8_t a[AES_BLOCK_SIZE] __attribute__((aligned(16)));
uint8_t b[AES_BLOCK_SIZE] __attribute__((aligned(16)));
uint8_t c[AES_BLOCK_SIZE] __attribute__((aligned(16)));
Expand Down

0 comments on commit 5db4950

Please sign in to comment.