summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2024-11-12 13:51:14 +0000
committerjsing <>2024-11-12 13:51:14 +0000
commitf990073d2baa86725977a5dd82e4447e689ed5d2 (patch)
treea4a9778049a708a687fae8b5da1cbf191076e9aa /src/lib
parentdffaba364fb662064a71e6531610d2583f829e15 (diff)
downloadopenbsd-f990073d2baa86725977a5dd82e4447e689ed5d2.tar.gz
openbsd-f990073d2baa86725977a5dd82e4447e689ed5d2.tar.bz2
openbsd-f990073d2baa86725977a5dd82e4447e689ed5d2.zip
Use multipliers for stack offsets and tweak comment.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/sha/sha256_amd64_generic.S18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/sha/sha256_amd64_generic.S b/src/lib/libcrypto/sha/sha256_amd64_generic.S
index 07078fb0d5..a7d2f9ddad 100644
--- a/src/lib/libcrypto/sha/sha256_amd64_generic.S
+++ b/src/lib/libcrypto/sha/sha256_amd64_generic.S
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256_amd64_generic.S,v 1.1 2024/11/08 15:09:48 jsing Exp $ */ 1/* $OpenBSD: sha256_amd64_generic.S,v 1.2 2024/11/12 13:51:14 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -164,17 +164,17 @@ sha256_block_generic:
164 pushq %r14 164 pushq %r14
165 pushq %r15 165 pushq %r15
166 166
167 /* Allocate space for message schedule and context pointer. */ 167 /* Allocate space for message schedule, context pointer and end of message. */
168 movq %rsp, %rax 168 movq %rsp, %rax
169 subq $(64+32), %rsp 169 subq $(64+3*8), %rsp
170 andq $~63, %rsp 170 andq $~63, %rsp
171 movq %rax, (64+16)(%rsp) 171 movq %rax, (64+2*8)(%rsp)
172 movq ctx, (64+8)(%rsp) 172 movq ctx, (64+1*8)(%rsp)
173 173
174 /* Compute and store end of message. */ 174 /* Compute and store end of message. */
175 shlq $6, num 175 shlq $6, num
176 leaq (in, num, 1), %rbx 176 leaq (in, num, 1), %rbx
177 movq %rbx, (64+0)(%rsp) 177 movq %rbx, (64+0*8)(%rsp)
178 178
179 /* Address of SHA-256 constants. */ 179 /* Address of SHA-256 constants. */
180 leaq K256(%rip), k256 180 leaq K256(%rip), k256
@@ -238,7 +238,7 @@ sha256_block_generic:
238 cmp $64, round 238 cmp $64, round
239 jb .Lblock_loop16 239 jb .Lblock_loop16
240 240
241 movq (64+8)(%rsp), ctx 241 movq (64+1*8)(%rsp), ctx
242 242
243 /* Add intermediate state to hash state. */ 243 /* Add intermediate state to hash state. */
244 addl (0*4)(ctx), hs0 244 addl (0*4)(ctx), hs0
@@ -261,10 +261,10 @@ sha256_block_generic:
261 movl hs7, (7*4)(ctx) 261 movl hs7, (7*4)(ctx)
262 262
263 addq $64, in 263 addq $64, in
264 cmpq (64+0)(%rsp), in 264 cmpq (64+0*8)(%rsp), in
265 jb .Lblock_loop0 265 jb .Lblock_loop0
266 266
267 movq (64+16)(%rsp), %rsp 267 movq (64+2*8)(%rsp), %rsp
268 268
269 /* Restore callee save registers. */ 269 /* Restore callee save registers. */
270 popq %r15 270 popq %r15