sm4: reduce slice checking internally

This commit is contained in:
Sun Yimin 2024-03-27 13:08:27 +08:00 committed by GitHub
parent 34dd5104ee
commit 02258d2351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,7 +64,7 @@ func (x *cbc) CryptBlocks(dst, src []byte) {
for len(src) >= BlockSize {
// Write the xor to dst, then encrypt in place.
subtle.XORBytes(dst[:BlockSize], src[:BlockSize], iv)
x.b.Encrypt(dst[:BlockSize], dst[:BlockSize])
x.b.encrypt(dst[:BlockSize], dst[:BlockSize])
// Move to the next block with this block as the next iv.
iv = dst[:BlockSize]