mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
sm4: add cbcEncAble interface
This commit is contained in:
parent
206c8075c3
commit
5b075213c0
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/emmansun/gmsm/internal/xor"
|
"github.com/emmansun/gmsm/internal/xor"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Assert that sm4CipherAsm implements the cbcDecAble interfaces.
|
// Assert that sm4CipherAsm implements the cbcEncAble and cbcDecAble interfaces.
|
||||||
var _ cbcDecAble = (*sm4CipherAsm)(nil)
|
var _ cbcEncAble = (*sm4CipherAsm)(nil)
|
||||||
var _ cbcDecAble = (*sm4CipherAsm)(nil)
|
var _ cbcDecAble = (*sm4CipherAsm)(nil)
|
||||||
|
|
||||||
const cbcEncrypt = 1
|
const cbcEncrypt = 1
|
||||||
|
@ -2,6 +2,13 @@ package sm4
|
|||||||
|
|
||||||
import "crypto/cipher"
|
import "crypto/cipher"
|
||||||
|
|
||||||
|
// cbcEncAble is implemented by cipher.Blocks that can provide an optimized
|
||||||
|
// implementation of CBC encryption through the cipher.BlockMode interface.
|
||||||
|
// See crypto/cipher/cbc.go.
|
||||||
|
type cbcEncAble interface {
|
||||||
|
NewCBCEncrypter(iv []byte) cipher.BlockMode
|
||||||
|
}
|
||||||
|
|
||||||
// cbcDecAble is implemented by cipher.Blocks that can provide an optimized
|
// cbcDecAble is implemented by cipher.Blocks that can provide an optimized
|
||||||
// implementation of CBC decryption through the cipher.BlockMode interface.
|
// implementation of CBC decryption through the cipher.BlockMode interface.
|
||||||
// See crypto/cipher/cbc.go.
|
// See crypto/cipher/cbc.go.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user