POLYVAL, the GCM-SIV authenticator #
RFC 8452 §3: POLYVAL(H, X₁, …, Xₛ) = Σᵢ Xᵢ • H^(s-i+1) where a • b = a·b·x⁻¹²⁸, over
GF(2)[x] / (x¹²⁸ + x¹²⁷ + x¹²⁶ + x¹²¹ + 1). Field elements are little-endian Nats: byte j,
bit i is the coefficient of x^(8j+i).
A 16-byte string as a field element, little-endian per RFC 8452 §3.
Equations
- Cryptlib.Primitives.Cipher.Polyval.ofBytes v = Array.foldr (fun (b : UInt8) (acc : Nat) => acc <<< 8 ||| b.toNat) 0 v.toArray
Instances For
A field element as 16 little-endian bytes. Bits at or above x¹²⁸ are dropped.
Equations
- Cryptlib.Primitives.Cipher.Polyval.toBytes n = Vector.ofFn fun (i : Fin 16) => UInt8.ofNat (n >>> (8 * ↑i) % 256)
Instances For
Carry-less multiplication over GF(2), without reduction.
Equations
- Cryptlib.Primitives.Cipher.Polyval.clmul a b = List.foldl (fun (acc i : Nat) => if a.testBit i = true then acc ^^^ b <<< i else acc) 0 (List.range 128)
Instances For
Multiplication by x⁻¹²⁸, one division by x at a time; also reduces the input below
x¹²⁸.
Equations
- One or more equations did not get rendered due to their size.