func NewCCMWithNonceSize(cipher goCipher.Block, size int) (goCipher.AEAD, error) {
	return NewCCMWithNonceAndTagSize(cipher, size, ccmTagSize)
}
NewCCMWithNonceSize returns the given 128-bit, block cipher wrapped in CCM,
which accepts nonces of the given length. The length must not
be zero.
package cipher
import (
	goCipher "crypto/cipher"
	goSubtle "crypto/subtle"
	"encoding/binary"
	"math"
	"errors"
	"github.com/emmansun/gmsm/internal/subtle"
	"github.com/emmansun/gmsm/internal/xor"
)
const (
	ccmBlockSize         = 16
	ccmTagSize           = 16
	ccmMinimumTagSize    = 4
	ccmStandardNonceSize = 12
)
type ccmAble interface {
	NewCCM(nonceSize, tagSize int) (goCipher.AEAD, error)
}
type ccm struct {
	cipher    goCipher.Block
	nonceSize int
	tagSize   int
}
func (c *ccm) NonceSize() int {
	return c.nonceSize
}
func (c *ccm) Overhead() int {
	return c.tagSize
}
func (c *ccm) MaxLength() int {
	return maxlen(15-c.NonceSize(), c.Overhead())
}
func maxlen(L, tagsize int) int {
	max := (uint64(1) << (8 * L)) - 1
	if m64 := uint64(math.MaxInt64) - uint64(tagsize); L > 8 || max > m64 {
		max = m64  
	}
	if max != uint64(int(max)) {
		return math.MaxInt32 - tagsize  
	}
	return int(max)
}
func NewCCM(cipher goCipher.Block) (goCipher.AEAD, error) {
	return NewCCMWithNonceAndTagSize(cipher, ccmStandardNonceSize, ccmTagSize)
}