aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sha_x86
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-13 09:11:07 +0000
committerlloyd <[email protected]>2006-08-13 09:11:07 +0000
commit0fe6a3c9b5729d64a08a5aba85d5256f43d5f7f1 (patch)
tree57428ae9107167547e2fba94998e80245b6bc658 /modules/sha_x86
parent31daef3b6e6f77f7773518791d91203f980b7c30 (diff)
Reverse the order of arguments to AND() and OR()
Diffstat (limited to 'modules/sha_x86')
-rw-r--r--modules/sha_x86/asm_macr.h5
-rw-r--r--modules/sha_x86/sha1core.S20
2 files changed, 12 insertions, 13 deletions
diff --git a/modules/sha_x86/asm_macr.h b/modules/sha_x86/asm_macr.h
index f72f61119..02967c4e0 100644
--- a/modules/sha_x86/asm_macr.h
+++ b/modules/sha_x86/asm_macr.h
@@ -50,9 +50,8 @@ func_name:
#define ADD2_IMM(TO, FROM, NUM) leal NUM(FROM), TO
#define XOR(TO, FROM) xorl FROM, TO
-
-#define AND(FROM, TO) andl FROM, TO
-#define OR(FROM, TO) orl FROM, TO
+#define AND(TO, FROM) andl FROM, TO
+#define OR(TO, FROM) orl FROM, TO
#define ZEROIZE(REG) XOR(REG, REG)
#define ROTL_IMM(REG, NUM) roll IMM(NUM), REG
diff --git a/modules/sha_x86/sha1core.S b/modules/sha_x86/sha1core.S
index ab9aeb025..f09c4a05d 100644
--- a/modules/sha_x86/sha1core.S
+++ b/modules/sha_x86/sha1core.S
@@ -99,7 +99,7 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
ROTL_IMM(A, 5) ; \
XOR(TEMP, D) ; \
ADD(E, A) ; \
- AND(B, TEMP) ; \
+ AND(TEMP, B) ; \
ROTR_IMM(B, 2) ; \
XOR(TEMP, D) ; \
leal MAGIC1(E,TEMP,1), E ; \
@@ -120,11 +120,11 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
ADD(E, ARRAY(EDI, MSG)) ; \
ASSIGN(TEMP, B) ; \
ROTL_IMM(A, 5) ; \
- OR(C, TEMP) ; \
+ OR(TEMP, C) ; \
ASSIGN(ARRAY(EDI, MSG), B) ; \
- AND(D, TEMP) ; \
- AND(C, ARRAY(EDI, MSG)) ; \
- OR(ARRAY(EDI, MSG), TEMP) ; \
+ AND(TEMP, D) ; \
+ AND(ARRAY(EDI, MSG), C) ; \
+ OR(TEMP, ARRAY(EDI, MSG)) ; \
ADD(E, A) ; \
leal MAGIC3(E,TEMP,1), E ; \
ROTR_IMM(B, 2) ; \
@@ -137,11 +137,11 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
F2_OR_F4(A, B, C, D, E, TEMP, MSG, MAGIC4)
#define F_BLOCK(F, MSG) \
- F(EAX, EBX, ECX, EDX, ESI, EBP, (MSG+0)) \
- F(ESI, EAX, EBX, ECX, EDX, EBP, (MSG+1)) \
- F(EDX, ESI, EAX, EBX, ECX, EBP, (MSG+2)) \
- F(ECX, EDX, ESI, EAX, EBX, EBP, (MSG+3)) \
- F(EBX, ECX, EDX, ESI, EAX, EBP, (MSG+4))
+ F(EAX, EBX, ECX, EDX, ESI, EBP, (MSG+0)) \
+ F(ESI, EAX, EBX, ECX, EDX, EBP, (MSG+1)) \
+ F(EDX, ESI, EAX, EBX, ECX, EBP, (MSG+2)) \
+ F(ECX, EDX, ESI, EAX, EBX, EBP, (MSG+3)) \
+ F(EBX, ECX, EDX, ESI, EAX, EBP, (MSG+4))
F_BLOCK(F1, 0)
F_BLOCK(F1, 5)