init: v1.0.0

This commit is contained in:
yaole
2026-05-27 23:03:00 +08:00
commit 8d97f750eb
466 changed files with 80067 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
// In amd64, Encrypt4 implemented
package sm4
import "xdx.jelly/xgcl/internal/subtle"
//go:noescape
func encrypt4(dst []byte, src []byte, rk []uint32)
func (c *sm4CipherAsm) Encrypt4(dst, src []byte) {
if len(src) < BlockSize {
panic("gcl/sm/sm4/Encrypt: input not full block")
}
if len(dst) < BlockSize {
panic("gcl/sm/sm4/Encrypt: output not full block")
}
if subtle.InexactOverlap(dst[:BlockSize], src[:BlockSize]) {
panic("gcl/sm/sm4/Encrypt: invalid buffer overlap")
}
encrypt4(dst, src, c.encKey[:])
}
func (c *sm4CipherAsm) Decrypt4(dst, src []byte) {
if len(src) < BlockSize {
panic("gcl/sm/sm4/Decrypt: input not full block")
}
if len(dst) < BlockSize {
panic("gcl/sm/sm4/Decrypt: output not full block")
}
if subtle.InexactOverlap(dst[:BlockSize], src[:BlockSize]) {
panic("gcl/sm/sm4/Decrypt: invalid buffer overlap")
}
encrypt4(dst, src, c.decKey[:])
}