From 82f6a73359657f0e2fb95ff9c0749a8bec14877f Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 13 Aug 2006 16:59:43 +0000 Subject: Use LEA with the magic constant and A, rather than the magic and the boolean; same trick as in MD5. Roughly a 5% speedup. --- modules/alg_ia32/sha1core.S | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/alg_ia32/sha1core.S b/modules/alg_ia32/sha1core.S index 7578685b2..ab5f1e7af 100644 --- a/modules/alg_ia32/sha1core.S +++ b/modules/alg_ia32/sha1core.S @@ -99,19 +99,19 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION) AND(T2, B) ; \ XOR(T2, D) ; \ ROTR_IMM(B, 2) ; \ - ADD(E, A) ; \ - ADD3_IMM(E, T2, MAGIC1) ; \ + ADD3_IMM(E, A, MAGIC1) ; \ + ADD(E, T2) ; \ ROTR_IMM(A, 5) ; -#define F2_OR_F4(A, B, C, D, E, MSG, MAGIC) \ +#define F2_4(A, B, C, D, E, MSG, MAGIC) \ ROTL_IMM(A, 5) ; \ ADD(E, ARRAY4(EDI, MSG)) ; \ ASSIGN(T2, D) ; \ XOR(T2, C) ; \ XOR(T2, B) ; \ ROTR_IMM(B, 2) ; \ - ADD(E, A) ; \ - ADD3_IMM(E, T2, MAGIC) ; \ + ADD3_IMM(E, A, MAGIC) ; \ + ADD(E, T2) ; \ ROTR_IMM(A, 5) ; #define F3(A, B, C, D, E, MSG) \ @@ -124,15 +124,15 @@ LOOP_UNTIL(ESI, IMM(80), .EXPANSION) AND(ARRAY4(EDI, MSG), C) ; \ OR(T2, ARRAY4(EDI, MSG)) ; \ ROTR_IMM(B, 2) ; \ - ADD(E, A) ; \ - ADD3_IMM(E, T2, MAGIC3) ; \ + ADD3_IMM(E, A, MAGIC3) ; \ + ADD(E, T2) ; \ ROTR_IMM(A, 5) ; #define F2(A, B, C, D, E, MSG) \ - F2_OR_F4(A, B, C, D, E, MSG, MAGIC2) + F2_4(A, B, C, D, E, MSG, MAGIC2) #define F4(A, B, C, D, E, MSG) \ - F2_OR_F4(A, B, C, D, E, MSG, MAGIC4) + F2_4(A, B, C, D, E, MSG, MAGIC4) #define F_BLOCK(F, MSG) \ F(EAX, EBX, ECX, EDX, ESI, (MSG+0)) \ -- cgit v1.2.3