aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-13 17:07:55 +0000
committerlloyd <[email protected]>2006-08-13 17:07:55 +0000
commit1da3529749f0cc2c20dcba0b30c318a188725c51 (patch)
tree0a2a9146dd56fdd099a03a07ed2a0c4f4eba67f4 /modules
parent82f6a73359657f0e2fb95ff9c0749a8bec14877f (diff)
Introduce a MSG() macro which returns the desired message word
Diffstat (limited to 'modules')
-rw-r--r--modules/alg_ia32/sha1core.S22
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/alg_ia32/sha1core.S b/modules/alg_ia32/sha1core.S
index ab5f1e7af..8280d615c 100644
--- a/modules/alg_ia32/sha1core.S
+++ b/modules/alg_ia32/sha1core.S
@@ -89,11 +89,14 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
#define MAGIC3 0x8F1BBCDC
#define MAGIC4 0xCA62C1D6
+#define T1 EDI
#define T2 EBP
-#define F1(A, B, C, D, E, MSG) \
+#define MSG(N) ARRAY4(EDI, N)
+
+#define F1(A, B, C, D, E, N) \
ROTL_IMM(A, 5) ; \
- ADD(E, ARRAY4(EDI, MSG)) ; \
+ ADD(E, MSG(N)) ; \
ASSIGN(T2, C) ; \
XOR(T2, D) ; \
AND(T2, B) ; \
@@ -103,9 +106,9 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
ADD(E, T2) ; \
ROTR_IMM(A, 5) ;
-#define F2_4(A, B, C, D, E, MSG, MAGIC) \
+#define F2_4(A, B, C, D, E, N, MAGIC) \
ROTL_IMM(A, 5) ; \
- ADD(E, ARRAY4(EDI, MSG)) ; \
+ ADD(E, MSG(N)) ; \
ASSIGN(T2, D) ; \
XOR(T2, C) ; \
XOR(T2, B) ; \
@@ -114,15 +117,15 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
ADD(E, T2) ; \
ROTR_IMM(A, 5) ;
-#define F3(A, B, C, D, E, MSG) \
+#define F3(A, B, C, D, E, N) \
ROTL_IMM(A, 5) ; \
- ADD(E, ARRAY4(EDI, MSG)) ; \
+ ADD(E, MSG(N)) ; \
ASSIGN(T2, B) ; \
OR(T2, C) ; \
AND(T2, D) ; \
- ASSIGN(ARRAY4(EDI, MSG), B) ; \
- AND(ARRAY4(EDI, MSG), C) ; \
- OR(T2, ARRAY4(EDI, MSG)) ; \
+ ASSIGN(MSG(N), B) ; \
+ AND(MSG(N), C) ; \
+ OR(T2, MSG(N)) ; \
ROTR_IMM(B, 2) ; \
ADD3_IMM(E, A, MAGIC3) ; \
ADD(E, T2) ; \
@@ -146,6 +149,7 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION)
F_BLOCK(F1, 10)
F_BLOCK(F1, 15)
+ ASSIGN(EDI, ARG(3))
F_BLOCK(F2, 20)
F_BLOCK(F2, 25)
F_BLOCK(F2, 30)