ML-KEM: fixed-width wire types #
VCVio's key and ciphertext types wrapped in subtypes that fix their encoded sizes, so that
decode ∘ encode = id holds. The Encoded* fields are ByteArray only up to unfolding, so
tBytes/uBytes/vBytes cast them explicitly. Each decode* is split into a plain decode*Val
and a well-formedness theorem; proving the round trip under the subtype directly exceeds
maxRecDepth.
def
Cryptlib.Primitives.KEM.FIPS203.tBytes
(ps : MLKEM.ParameterSet)
(x : (encoding ps).EncodedTHat)
:
x : encoding.EncodedTHat, as a plain ByteArray.
Equations
- Cryptlib.Primitives.KEM.FIPS203.tBytes ps x = cast ⋯ x
Instances For
def
Cryptlib.Primitives.KEM.FIPS203.bytesT
(ps : MLKEM.ParameterSet)
(x : ByteArray)
:
(encoding ps).EncodedTHat
The reverse of tBytes.
Equations
- Cryptlib.Primitives.KEM.FIPS203.bytesT ps x = cast ⋯ x
Instances For
x : encoding.EncodedU, as a plain ByteArray.
Equations
- Cryptlib.Primitives.KEM.FIPS203.uBytes ps x = cast ⋯ x
Instances For
def
Cryptlib.Primitives.KEM.FIPS203.bytesU
(ps : MLKEM.ParameterSet)
(x : ByteArray)
:
(encoding ps).EncodedU
Equations
- Cryptlib.Primitives.KEM.FIPS203.bytesU ps x = cast ⋯ x
Instances For
x : encoding.EncodedV, as a plain ByteArray.
Equations
- Cryptlib.Primitives.KEM.FIPS203.vBytes ps x = cast ⋯ x
Instances For
def
Cryptlib.Primitives.KEM.FIPS203.bytesV
(ps : MLKEM.ParameterSet)
(x : ByteArray)
:
(encoding ps).EncodedV
Equations
- Cryptlib.Primitives.KEM.FIPS203.bytesV ps x = cast ⋯ x
Instances For
@[reducible, inline]
An encapsulation key whose tHatEncoded is 384 * k bytes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[reducible, inline]
A decapsulation key whose two encoded polynomial vectors are 384 * k bytes each.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[reducible, inline]
A ciphertext whose uEncoded/vEncoded are 32 * du * k/32 * dv bytes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Cryptlib.Primitives.KEM.FIPS203.decodePublicKey
(ps : MLKEM.ParameterSet)
(v : Vector UInt8 (params ps).publicKeyBytes)
:
Equations
Instances For
theorem
Cryptlib.Primitives.KEM.FIPS203.decode_encode_pub
(ps : MLKEM.ParameterSet)
(pk : PublicKey ps)
:
def
Cryptlib.Primitives.KEM.FIPS203.encodePrivateKey
(ps : MLKEM.ParameterSet)
(sk : PrivateKey ps)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Cryptlib.Primitives.KEM.FIPS203.decodePrivateKey
(ps : MLKEM.ParameterSet)
(v : Vector UInt8 (params ps).secretKeyBytes)
:
Option (PrivateKey ps)
Equations
Instances For
theorem
Cryptlib.Primitives.KEM.FIPS203.decode_encode_priv
(ps : MLKEM.ParameterSet)
(sk : PrivateKey ps)
:
def
Cryptlib.Primitives.KEM.FIPS203.decodeCiphertext
(ps : MLKEM.ParameterSet)
(v : Vector UInt8 (params ps).ciphertextBytes)
: