From 62c8b42c68479aca573af0f63dce3777636d8828 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Wed, 4 Sep 2024 17:47:15 +0800 Subject: [PATCH] sm3: update file format --- sm3/kdf_mult4_asm.go | 4 ++++ sm3/sm3blocks_s390x.s | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sm3/kdf_mult4_asm.go b/sm3/kdf_mult4_asm.go index 9edc15c..bef16cc 100644 --- a/sm3/kdf_mult4_asm.go +++ b/sm3/kdf_mult4_asm.go @@ -1,3 +1,7 @@ +// Copyright 2024 Sun Yimin. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + //go:build (amd64 || arm64 || s390x) && !purego package sm3 diff --git a/sm3/sm3blocks_s390x.s b/sm3/sm3blocks_s390x.s index b3384d5..4c8d6ce 100644 --- a/sm3/sm3blocks_s390x.s +++ b/sm3/sm3blocks_s390x.s @@ -78,28 +78,28 @@ GLOBL mask<>(SB), 8, $64 VAF TMP2, TMP0, TMP0 \ VAF e, TMP0, TMP0 \ PROLD(TMP0, TMP2, 7) \ // TMP2 = SS1 - VX TMP2, TMP1, TMP0 \ // TMP0 = SS2 + VX TMP2, TMP1, TMP0 \ // TMP0 = SS2 VX a, b, TMP1 \ - VX c, TMP1, TMP1 \ + VX c, TMP1, TMP1 \ VAF TMP1, d, TMP1 \ // TMP1 = (a XOR b XOR c) + d loadWordByIndex(TMP3, index) \ loadWordByIndex(TMP4, index+4) \ VX TMP3, TMP4, TMP4 \ VAF TMP4, TMP1, TMP1 \ // TMP1 = (a XOR b XOR c) + d + (Wt XOR Wt+4) - VAF TMP1, TMP0, TMP1 \ // TMP1 = TT1 - VAF h, TMP3, TMP3 \ - VAF TMP3, TMP2, TMP3 \ // Wt + h + SS1 - VX e, f, TMP4 \ - VX g, TMP4, TMP4 \ - VAF TMP4, TMP3, TMP3 \ // TT2 = (e XOR f XOR g) + Wt + h + SS1 - VLR b, TMP4 \ + VAF TMP1, TMP0, TMP1 \ // TMP1 = TT1 + VAF h, TMP3, TMP3 \ + VAF TMP3, TMP2, TMP3 \ // Wt + h + SS1 + VX e, f, TMP4 \ + VX g, TMP4, TMP4 \ + VAF TMP4, TMP3, TMP3 \ // TT2 = (e XOR f XOR g) + Wt + h + SS1 + VLR b, TMP4 \ PROLD(TMP4, b, 9) \ // b = b <<< 9 - VLR TMP1, h \ // h = TT1 - VLR f, TMP4 \ + VLR TMP1, h \ // h = TT1 + VLR f, TMP4 \ PROLD(TMP4, f, 19) \ // f = f <<< 19 PROLD(TMP3, TMP4, 9) \ // TMP4 = TT2 <<< 9 PROLD(TMP4, TMP0, 8) \ // TMP0 = TT2 <<< 17 - VX TMP3, TMP4, TMP4 \ // TMP4 = TT2 XOR (TT2 <<< 9) + VX TMP3, TMP4, TMP4 \ // TMP4 = TT2 XOR (TT2 <<< 9) VX TMP4, TMP0, d \ // d = TT2 XOR (TT2 <<< 9) XOR (TT2 <<< 17) #define MESSAGE_SCHEDULE(index) \