kdf-sm3: fix arm64 bug

This commit is contained in:
Sun Yimin 2024-05-21 15:36:19 +08:00 committed by GitHub
parent 145eba63cb
commit dc23026764
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -30,8 +30,7 @@ func copyResult(result []byte, dig *[8]uint32) {
// state || words // state || words
// 1216 = 68 * 4 * 4 + 8 * 4 * 4 = 76 * 16 // 1216 = 68 * 4 * 4 + 8 * 4 * 4 = 76 * 16
// 8 * 16 = 128 const preallocSize = 1216
const preallocSize = 1344
func kdfBy4(baseMD *digest, keyLen int, limit int) []byte { func kdfBy4(baseMD *digest, keyLen int, limit int) []byte {
if limit < 4 { if limit < 4 {

View File

@ -190,7 +190,6 @@ TEXT ·blockMultBy4(SB), NOSPLIT, $0
MOVD statePtr, wordStart MOVD statePtr, wordStart
VST1.P [a.S4, b.S4, c.S4, d.S4], 64(wordStart) VST1.P [a.S4, b.S4, c.S4, d.S4], 64(wordStart)
VST1.P [e.S4, f.S4, g.S4, h.S4], 64(wordStart) VST1.P [e.S4, f.S4, g.S4, h.S4], 64(wordStart)
MOVD wordStart, wordPtr
MOVD.P 8(srcPtrPtr), srcPtr1 MOVD.P 8(srcPtrPtr), srcPtr1
MOVD.P 8(srcPtrPtr), srcPtr2 MOVD.P 8(srcPtrPtr), srcPtr2
@ -198,6 +197,7 @@ TEXT ·blockMultBy4(SB), NOSPLIT, $0
MOVD (srcPtrPtr), srcPtr4 MOVD (srcPtrPtr), srcPtr4
loop: loop:
MOVD wordStart, wordPtr
// load message block // load message block
prepare4Words prepare4Words
prepare4Words prepare4Words