Commit 7daba20c authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: x86/sha256-ni - simplify do_4rounds

Instead of loading the message words into both MSG and \m0 and then
adding the round constants to MSG, load the message words into \m0 and
the round constants into MSG and then add \m0 to MSG.  This shortens the
source code slightly.  It changes the instructions slightly, but it
doesn't affect binary code size and doesn't seem to affect performance.
Suggested-by: default avatarStefan Kanthak <stefan.kanthak@nexgo.de>
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 59e62b20
......@@ -78,13 +78,11 @@
.macro do_4rounds i, m0, m1, m2, m3
.if \i < 16
movdqu \i*4(DATA_PTR), MSG
pshufb SHUF_MASK, MSG
movdqa MSG, \m0
.else
movdqa \m0, MSG
movdqu \i*4(DATA_PTR), \m0
pshufb SHUF_MASK, \m0
.endif
paddd (\i-32)*4(SHA256CONSTANTS), MSG
movdqa (\i-32)*4(SHA256CONSTANTS), MSG
paddd \m0, MSG
sha256rnds2 STATE0, STATE1
.if \i >= 12 && \i < 60
movdqa \m0, TMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment