From c469e081c5cfa8ba4fd99db762b084be9d3cfd90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Tue, 25 Aug 2009 13:10:32 +0200
Subject: [PATCH] Trimmed stack storage.

Rev: nettle/x86/sha1-compress.asm:1.3
---
 x86/sha1-compress.asm | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/x86/sha1-compress.asm b/x86/sha1-compress.asm
index b0957a66..259ff5c3 100644
--- a/x86/sha1-compress.asm
+++ b/x86/sha1-compress.asm
@@ -145,17 +145,19 @@ C adding, and then rotating back.
 	ALIGN(4)
 PROLOGUE(_nettle_sha1_compress)
 	C save all registers that need to be saved
-	
-	pushl	%ebx		C  80(%esp)
-	pushl	%ebp		C  76(%esp)
-	pushl	%esi		C  72(%esp)
-	pushl	%edi		C  68(%esp)
+	C 			   88(%esp)  data
+	C 			   84(%esp)  state
+	C 			   80(%esp)  Return address
+	pushl	%ebx		C  76(%esp)
+	pushl	%ebp		C  72(%esp)
+	pushl	%esi		C  68(%esp)
+	pushl	%edi		C  64(%esp)
 
 	C FIXME: Trim to 64
-	subl	$68, %esp	C  %esp = W
+	subl	$64, %esp	C  %esp = W
 
 	C Load and byteswap data
-	movl	92(%esp), TMP2
+	movl	88(%esp), TMP2
 
 	SWAP( 0, %eax) SWAP( 1, %ebx) SWAP( 2, %ecx) SWAP( 3, %edx)
 	SWAP( 4, %eax) SWAP( 5, %ebx) SWAP( 6, %ecx) SWAP( 7, %edx)
@@ -163,7 +165,7 @@ PROLOGUE(_nettle_sha1_compress)
 	SWAP(12, %eax) SWAP(13, %ebx) SWAP(14, %ecx) SWAP(15, %edx)
 
 	C load the state vector
-	movl	88(%esp),TMP
+	movl	84(%esp),TMP
 	movl	(TMP),   SA
 	movl	4(TMP),  SB
 	movl	8(TMP),  SC
@@ -273,14 +275,14 @@ PROLOGUE(_nettle_sha1_compress)
 	EXPAND(79) ROUND(SB, SC, SD, SE, SA, <F2>)
 
 	C Update the state vector
-	movl	88(%esp),TMP
+	movl	84(%esp),TMP
 	addl	SA, (TMP) 
 	addl	SB, 4(TMP) 
 	addl	SC, 8(TMP) 
 	addl	SD, 12(TMP) 
 	addl	SE, 16(TMP)
 
-	addl	$68, %esp
+	addl	$64, %esp
 	popl	%edi
 	popl	%esi
 	popl	%ebp
-- 
GitLab