Documentation
¶
Overview ¶
Package ccm implements the CCM (Counter with CBC-MAC) AEAD mode specified by RFC 3610 and NIST SP 800-38C, suitable for use with AES (or any 128-bit block cipher).
CCM is not provided by the Go standard library — stdlib's crypto/cipher only exposes GCM. This package fills that gap so callers (in particular OpenZFS native-encryption parsers) don't have to depend on golang.org/x/crypto for AES-CCM.
The implementation is pure Go, uses only crypto/aes + the caller-supplied cipher.Block, and exposes the standard cipher.AEAD interface so it composes with any code that already understands GCM-style sealed/open.
Parameter ranges:
nonce size N ∈ [7, 13] (RFC 3610 §3 — encoded as L = 15 - N)
tag size M ∈ {4, 6, 8, 10, 12, 14, 16}
plaintext P with len(P) ≤ 2^(8L) - 1
Typical OpenZFS usage: N=12, M=16 (L=3, so the encoded-length field is 3 bytes — sufficient for any ZFS block since a block is at most 2^24 bytes).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CCM ¶
type CCM struct {
// contains filtered or unexported fields
}
CCM is the cipher.AEAD wrapper around a 128-bit block cipher configured for CCM mode. Construct one with NewCCM.
func (*CCM) Open ¶
Open verifies and decrypts ciphertext, authenticates additionalData, and if successful appends the resulting plaintext to dst, returning the updated slice. The nonce must be NonceSize() bytes long. If the authentication tag does not verify Open returns an error and dst is unchanged.
func (*CCM) Overhead ¶
Overhead returns the number of bytes Seal appends after the ciphertext (the authentication tag).
