Documentation ¶
Overview ¶
Package aes provides access to the hardware AES encryption/decryption accelerator and supports basic key expansion functionality. The low-level primitives are subsequently used to construct hardened building blocks like a family of hash functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
func Hash[T Hashable](e *HashEngine, v T) uint64
func HashCombine ¶
func HashCombine(e *HashEngine, hashes ...uint64) uint64
HashCombine combines multiple uint64 hash values into a new one
func HashSlice ¶
func HashSlice[T Hashable](e *HashEngine, in []T) uint64
Types ¶
type ExpandedKey128 ¶
type ExpandedKey128 [11]Key128
ExpandedKey128 stores the 11 round keys produced by the AES key expansion algorithm.
func (*ExpandedKey128) ExpandFrom ¶
func (p *ExpandedKey128) ExpandFrom(key Key128)
ExpandFrom takes a Key128 key and expands it into 11 round keys
type ExpandedKey128Quad ¶
type ExpandedKey128Quad [11]Key128Quad
ExpandedKey128Quad stores a quad of the 11 round keys produced by the AES key expansion algorithm.
func (*ExpandedKey128Quad) ExpandFrom ¶
func (p *ExpandedKey128Quad) ExpandFrom(quad Key128Quad)
ExpandFrom takes a Key128 quad and expands them into a quad of 11 round keys
type HashEngine ¶
type HashEngine ExpandedKey128Quad
var Stable HashEngine = HashEngine{ Key128Quad{ Key128{0x71032c93, 0xabc264e6, 0x6eb0443e, 0x5ccb9956}, Key128{0x3b63ebd9, 0xb4c73073, 0x67d7f51b, 0xcedc356c}, Key128{0xed641267, 0x974d4f29, 0x572f117e, 0x2c0507e8}, Key128{0x673e49f9, 0x47b42d12, 0xdff6ea71, 0x1dbc8d0f}, }, Key128Quad{ Key128{0x685eaf6f, 0x195d83fc, 0x5a257207, 0x34953639}, Key128{0x2021d54d, 0x1b423e94, 0x892a153a, 0xeefde021}, Key128{0x897248cd, 0x64165aaa, 0xf2585e5b, 0xa5774f25}, Key128{0x8314266d, 0xe42a6f94, 0x415e4113, 0x9ea8ab62}, }, Key128Quad{ Key128{0xb4bd13d1, 0xdce3bcbe, 0xda0d57ef, 0x802825e8}, Key128{0xbbc40e82, 0x9be5dbcf, 0xdc13fb99, 0x5539eea3}, Key128{0xd4ed783d, 0x5d9f30f0, 0x83c26943, 0x719a3718}, Key128{0x1abd1178, 0x99a93715, 0xc54bfb09, 0x8415ba1a}, }, Key128Quad{ Key128{0xb7097830, 0x03b46be1, 0xed2c0a37, 0x37215dd8}, Key128{0xcea7a846, 0x7563a6c4, 0x478dbd7c, 0x9b9e46e5}, Key128{0x939e6d30, 0x4773150d, 0x61c6336b, 0xe2045a28}, Key128{0x82b29566, 0x980f841e, 0xc3ecd475, 0x06a72f7c}, }, Key128Quad{ Key128{0x2ee862be, 0x99e11a8e, 0xf4e53551, 0x19c93f66}, Key128{0xab6453f0, 0x65c3fbb6, 0x7777a869, 0x30fa1515}, Key128{0xab02ccf6, 0x389ca1c6, 0x28c0a5b5, 0x490696de}, Key128{0x8793df38, 0x05214a5e, 0x42d82431, 0x8134f044}, }, Key128Quad{ Key128{0x66b6a1b6, 0x485ec308, 0x8b9aab81, 0x7f7f9ed0}, Key128{0x37525d94, 0x9c360e64, 0x70dfe0e8, 0x07a84881}, Key128{0x46aad726, 0xeda81bd0, 0x276ce44d, 0x0fac41f8}, Key128{0x459ef440, 0xc20d2b78, 0x86722035, 0xc4aa0404}, }, Key128Quad{ Key128{0x22d5dafc, 0x44637b4a, 0xd630efad, 0x5daa442c}, Key128{0x3035cd31, 0x076790a5, 0x47426558, 0x379d85b0}, Key128{0x48ce9cbf, 0x0e644b99, 0x600e390a, 0x4762dd47}, Key128{0x11d79faf, 0x54496bef, 0x530fbb9e, 0xd57d9bab}, }, Key128Quad{ Key128{0xf340a529, 0xd1957fd5, 0x78da0ea8, 0xaeeae105}, Key128{0x5df27199, 0x6dc7bca8, 0x2d2d9171, 0x6a6ff429}, Key128{0x217a7c74, 0x69b4e0cb, 0x06169839, 0x6618a133}, Key128{0x4e7382ea, 0x5fa41d45, 0xc801a2df, 0x9b0e1941}, }, Key128Quad{ Key128{0xe0698dd7, 0x132928fe, 0x3659627a, 0x4e836cd2}, Key128{0x93ed1530, 0xce1f64a9, 0xd4af7068, 0xf982e119}, Key128{0x5aa1db79, 0x7bdba70d, 0x3aafe273, 0x3cb97a4a}, Key128{0x8f3fe315, 0xc14c61ff, 0xdc30588b, 0x1431fa54}, }, Key128Quad{ Key128{0x29456e98, 0xc92ce34f, 0x519f6030, 0x67c6024a}, Key128{0x18ba08d3, 0x8b571de3, 0x359799a2, 0xe138e9ca}, Key128{0xaefa05f7, 0xf45bde8e, 0xa8ec9dce, 0x92437fbd}, Key128{0x73f5869b, 0xfcca658e, 0xbbf42444, 0x67c47ccf}, }, Key128Quad{ Key128{0xe4b85631, 0xcdfd38a9, 0xd2e1344b, 0x837e547b}, Key128{0xa97b9de8, 0xb1c1953b, 0x7dd4ed80, 0x48437422}, Key128{0xd1631511, 0x7f9910e6, 0xebccf762, 0x43206aac}, Key128{0x94d55c15, 0xe720da8e, 0x48e5049e, 0xf31120da}, }, }
Stable is an out-of-the-box HashEngine initialized with hard-coded values. DO NOT ALTER!
var Volatile HashEngine
Volatile is an out-of-the-box HashEngine initialized with a FIPS 140-2-compliant random number generator
func (*HashEngine) Initialize ¶
func (e *HashEngine) Initialize(quad Key128Quad)
Initialize initializes the hash engine e according to the provided initialization key quad
func (*HashEngine) InitializeRandom ¶
func (e *HashEngine) InitializeRandom() error
InitializeRandom initializes the hash engine e with a randomly generated initialization vector
type Hashable ¶
type Hashable interface { constraints.Integer | WideHash }
type Key128 ¶
type Key128 [4]uint32
Key128 represents a 128-bit AES key
func RandomKey128 ¶
RandomKey128 creates a 128-bit key with cryptographically strong RNG values
func (Key128) ToQuad ¶
func (key Key128) ToQuad() Key128Quad
ToQuad broadcast key to form a key quad
type Key128Quad ¶
type Key128Quad [4]Key128
Key128Quad represents a quad of 128-bit AES keys. Quads enable the full potential of the four-lane hardware AES encryption/decryption support; otherwise the operations on quads are fully equivalent to four independent regular AES operations, just more efficient. No assumption is made about the correlation of the keys: it is up to the user to decide if the keys should be the same or different in a given application.
func RandomKey128Quad ¶
func RandomKey128Quad() (Key128Quad, error)
RandomKey128Quad creates a 128-bit key quad with cryptographically strong RNG values
type WideHash ¶
type WideHash [2 * 4]uint64
func HashCombineWide ¶
func HashCombineWide(e *HashEngine, hashes ...WideHash) WideHash
HashCombineWide combines multiple WideHash values into a new one
func HashWide ¶
func HashWide[T Hashable](e *HashEngine, v T) WideHash
func HashWideSlice ¶
func HashWideSlice[T Hashable](e *HashEngine, in []T) WideHash