Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Dec 5, 2024
1 parent f4dddeb commit ddf783f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mac/cbc_mac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type cbcmac struct {
// GB/T 15821.1-2020 MAC scheme 1
func NewCBCMAC(b cipher.Block, size int) BlockCipherMAC {
if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

return &cbcmac{
Expand Down
2 changes: 1 addition & 1 deletion mac/cbcr_mac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type cbcrMAC struct {
// Reference: CBCR: CBC MAC with rotating transformations.
func NewCBCRMAC(b cipher.Block, size int) BlockCipherMAC {
if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

return &cbcrMAC{
Expand Down
2 changes: 1 addition & 1 deletion mac/cmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type cmac struct {
// Reference: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38B.pdf
func NewCMAC(b cipher.Block, size int) BlockCipherMAC {
if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

blockSize := b.BlockSize()
Expand Down
2 changes: 1 addition & 1 deletion mac/lmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewLMAC(creator BlockCipherFunc, key []byte, size int) BlockCipherMAC {
}

if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

blockSize := b.BlockSize()
Expand Down
2 changes: 1 addition & 1 deletion mac/mac_des.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewMACDES(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipher
}

if size <= 0 || size > b1.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

if b2, err = creator(key2); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions mac/mac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func TestMustPanic(t *testing.T) {
t.Run("invalid size", func(t *testing.T) {
key := make([]byte, 16)
block, _ := sm4.NewCipher(key)
cryptobin_test.MustPanic(t, "cbcmac: invalid size", func() {
cryptobin_test.MustPanic(t, "go-cryptobin/mac: invalid size", func() {
NewCBCMAC(block, 0)
NewCBCMAC(block, 17)
NewEMAC(sm4.NewCipher, key, key, 0)
Expand All @@ -340,7 +340,7 @@ func TestMustPanic(t *testing.T) {

t.Run("invalid key size", func(t *testing.T) {
key := make([]byte, 16)
cryptobin_test.MustPanic(t, "cbcmac: invalid size", func() {
cryptobin_test.MustPanic(t, "go-cryptobin/mac: invalid size", func() {
NewEMAC(sm4.NewCipher, key[:15], key, 8)
NewEMAC(sm4.NewCipher, key, key[:15], 8)
NewANSIRetailMAC(sm4.NewCipher, key[:15], key, 8)
Expand Down
2 changes: 1 addition & 1 deletion mac/tr_cbc_mac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type trCBCMAC struct {
// Reference: TrCBC: Another look at CBC-MAC.
func NewTRCBCMAC(b cipher.Block, size int) BlockCipherMAC {
if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
panic("go-cryptobin/mac: invalid size")
}

return &trCBCMAC{
Expand Down

0 comments on commit ddf783f

Please sign in to comment.