mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
sm4: reduce bounds check
This commit is contained in:
parent
056d14a892
commit
a2ce3f51d0
@ -61,7 +61,7 @@ func (x *cbc) CryptBlocks(dst, src []byte) {
|
||||
if x.enc == cbcEncrypt {
|
||||
iv := x.iv
|
||||
|
||||
for len(src) > 0 {
|
||||
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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user