effect
stringclasses
48 values
original_source_type
stringlengths
0
23k
opens_and_abbrevs
listlengths
2
92
isa_cross_project_example
bool
1 class
source_definition
stringlengths
9
57.9k
partial_definition
stringlengths
7
23.3k
is_div
bool
2 classes
is_type
null
is_proof
bool
2 classes
completed_definiton
stringlengths
1
250k
dependencies
dict
effect_flags
sequencelengths
0
2
ideal_premises
sequencelengths
0
236
mutual_with
sequencelengths
0
11
file_context
stringlengths
0
407k
interleaved
bool
1 class
is_simply_typed
bool
2 classes
file_name
stringlengths
5
48
vconfig
dict
is_simple_lemma
null
source_type
stringlengths
10
23k
proof_features
sequencelengths
0
1
name
stringlengths
8
95
source
dict
verbose_type
stringlengths
1
7.42k
source_range
dict
Prims.Tot
val test8_plaintext_shake128:lbytes 83
[ { "abbrev": true, "full_module": "Lib.PrintSequence", "short_module": "PS" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let test8_plaintext_shake128 : lbytes 83 = let l = List.Tot.map u8_from_UInt8 [ 0x24uy; 0x69uy; 0xf1uy; 0x01uy; 0xc9uy; 0xb4uy; 0x99uy; 0xa9uy; 0x30uy; 0xa9uy; 0x7euy; 0xf1uy; 0xb3uy; 0x46uy; 0x73uy; 0xecuy; 0x74uy; 0x39uy; 0x3fuy; 0xd9uy; 0xfauy; 0xf6uy; 0x58uy; 0xe3uy; 0x1fuy; 0x06uy; 0xeeuy; 0x0buy; 0x29uy; 0xa2uy; 0x2buy; 0x62uy; 0x37uy; 0x80uy; 0xbauy; 0x7buy; 0xdfuy; 0xeduy; 0x86uy; 0x20uy; 0x15uy; 0x1cuy; 0xc4uy; 0x44uy; 0x4euy; 0xbeuy; 0x33uy; 0x39uy; 0xe6uy; 0xd2uy; 0xa2uy; 0x23uy; 0xbfuy; 0xbfuy; 0xb4uy; 0xaduy; 0x2cuy; 0xa0uy; 0xe0uy; 0xfauy; 0x0duy; 0xdfuy; 0xbbuy; 0xdfuy; 0x3buy; 0x05uy; 0x7auy; 0x4fuy; 0x26uy; 0xd0uy; 0xb2uy; 0x16uy; 0xbcuy; 0x87uy; 0x63uy; 0xcauy; 0x8duy; 0x8auy; 0x35uy; 0xffuy; 0x2duy; 0x2duy; 0x01uy ] in assert_norm (List.Tot.length l == 83); of_list l
val test8_plaintext_shake128:lbytes 83 let test8_plaintext_shake128:lbytes 83 =
false
null
false
let l = List.Tot.map u8_from_UInt8 [ 0x24uy; 0x69uy; 0xf1uy; 0x01uy; 0xc9uy; 0xb4uy; 0x99uy; 0xa9uy; 0x30uy; 0xa9uy; 0x7euy; 0xf1uy; 0xb3uy; 0x46uy; 0x73uy; 0xecuy; 0x74uy; 0x39uy; 0x3fuy; 0xd9uy; 0xfauy; 0xf6uy; 0x58uy; 0xe3uy; 0x1fuy; 0x06uy; 0xeeuy; 0x0buy; 0x29uy; 0xa2uy; 0x2buy; 0x62uy; 0x37uy; 0x80uy; 0xbauy; 0x7buy; 0xdfuy; 0xeduy; 0x86uy; 0x20uy; 0x15uy; 0x1cuy; 0xc4uy; 0x44uy; 0x4euy; 0xbeuy; 0x33uy; 0x39uy; 0xe6uy; 0xd2uy; 0xa2uy; 0x23uy; 0xbfuy; 0xbfuy; 0xb4uy; 0xaduy; 0x2cuy; 0xa0uy; 0xe0uy; 0xfauy; 0x0duy; 0xdfuy; 0xbbuy; 0xdfuy; 0x3buy; 0x05uy; 0x7auy; 0x4fuy; 0x26uy; 0xd0uy; 0xb2uy; 0x16uy; 0xbcuy; 0x87uy; 0x63uy; 0xcauy; 0x8duy; 0x8auy; 0x35uy; 0xffuy; 0x2duy; 0x2duy; 0x01uy ] in assert_norm (List.Tot.length l == 83); of_list l
{ "checked_file": "Spec.SHA3.Test.fst.checked", "dependencies": [ "Spec.SHA3.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.PrintSequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.List.fst.checked", "FStar.IO.fst.checked" ], "interface_file": false, "source_file": "Spec.SHA3.Test.fst" }
[ "total" ]
[ "Lib.Sequence.of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "FStar.List.Tot.Base.map", "FStar.UInt8.t", "Lib.RawIntTypes.u8_from_UInt8", "Prims.Cons", "FStar.UInt8.__uint_to_t", "Prims.Nil" ]
[]
module Spec.SHA3.Test open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module PS = Lib.PrintSequence #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// Test1_SHA3 let test1_plaintext : lbytes 0 = let l = List.Tot.map u8_from_UInt8 [] in assert_norm (List.Tot.length l == 0); of_list l let test1_expected_sha3_224 : lbytes 28 = let l = List.Tot.map u8_from_UInt8 [ 0x6buy; 0x4euy; 0x03uy; 0x42uy; 0x36uy; 0x67uy; 0xdbuy; 0xb7uy; 0x3buy; 0x6euy; 0x15uy; 0x45uy; 0x4fuy; 0x0euy; 0xb1uy; 0xabuy; 0xd4uy; 0x59uy; 0x7fuy; 0x9auy; 0x1buy; 0x07uy; 0x8euy; 0x3fuy; 0x5buy; 0x5auy; 0x6buy; 0xc7uy ] in assert_norm (List.Tot.length l == 28); of_list l let test1_expected_sha3_256 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0xa7uy; 0xffuy; 0xc6uy; 0xf8uy; 0xbfuy; 0x1euy; 0xd7uy; 0x66uy; 0x51uy; 0xc1uy; 0x47uy; 0x56uy; 0xa0uy; 0x61uy; 0xd6uy; 0x62uy; 0xf5uy; 0x80uy; 0xffuy; 0x4duy; 0xe4uy; 0x3buy; 0x49uy; 0xfauy; 0x82uy; 0xd8uy; 0x0auy; 0x4buy; 0x80uy; 0xf8uy; 0x43uy; 0x4auy ] in assert_norm (List.Tot.length l == 32); of_list l let test1_expected_sha3_384 : lbytes 48 = let l = List.Tot.map u8_from_UInt8 [ 0x0cuy; 0x63uy; 0xa7uy; 0x5buy; 0x84uy; 0x5euy; 0x4fuy; 0x7duy; 0x01uy; 0x10uy; 0x7duy; 0x85uy; 0x2euy; 0x4cuy; 0x24uy; 0x85uy; 0xc5uy; 0x1auy; 0x50uy; 0xaauy; 0xaauy; 0x94uy; 0xfcuy; 0x61uy; 0x99uy; 0x5euy; 0x71uy; 0xbbuy; 0xeeuy; 0x98uy; 0x3auy; 0x2auy; 0xc3uy; 0x71uy; 0x38uy; 0x31uy; 0x26uy; 0x4auy; 0xdbuy; 0x47uy; 0xfbuy; 0x6buy; 0xd1uy; 0xe0uy; 0x58uy; 0xd5uy; 0xf0uy; 0x04uy ] in assert_norm (List.Tot.length l == 48); of_list l let test1_expected_sha3_512 : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0xa6uy; 0x9fuy; 0x73uy; 0xccuy; 0xa2uy; 0x3auy; 0x9auy; 0xc5uy; 0xc8uy; 0xb5uy; 0x67uy; 0xdcuy; 0x18uy; 0x5auy; 0x75uy; 0x6euy; 0x97uy; 0xc9uy; 0x82uy; 0x16uy; 0x4fuy; 0xe2uy; 0x58uy; 0x59uy; 0xe0uy; 0xd1uy; 0xdcuy; 0xc1uy; 0x47uy; 0x5cuy; 0x80uy; 0xa6uy; 0x15uy; 0xb2uy; 0x12uy; 0x3auy; 0xf1uy; 0xf5uy; 0xf9uy; 0x4cuy; 0x11uy; 0xe3uy; 0xe9uy; 0x40uy; 0x2cuy; 0x3auy; 0xc5uy; 0x58uy; 0xf5uy; 0x00uy; 0x19uy; 0x9duy; 0x95uy; 0xb6uy; 0xd3uy; 0xe3uy; 0x01uy; 0x75uy; 0x85uy; 0x86uy; 0x28uy; 0x1duy; 0xcduy; 0x26uy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test2_SHA3 let test2_plaintext : lbytes 3 = let l = List.Tot.map u8_from_UInt8 [ 0x61uy; 0x62uy; 0x63uy ] in assert_norm (List.Tot.length l == 3); of_list l let test2_expected_sha3_224 : lbytes 28 = let l = List.Tot.map u8_from_UInt8 [ 0xe6uy; 0x42uy; 0x82uy; 0x4cuy; 0x3fuy; 0x8cuy; 0xf2uy; 0x4auy; 0xd0uy; 0x92uy; 0x34uy; 0xeeuy; 0x7duy; 0x3cuy; 0x76uy; 0x6fuy; 0xc9uy; 0xa3uy; 0xa5uy; 0x16uy; 0x8duy; 0x0cuy; 0x94uy; 0xaduy; 0x73uy; 0xb4uy; 0x6fuy; 0xdfuy ] in assert_norm (List.Tot.length l == 28); of_list l let test2_expected_sha3_256 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x3auy; 0x98uy; 0x5duy; 0xa7uy; 0x4fuy; 0xe2uy; 0x25uy; 0xb2uy; 0x04uy; 0x5cuy; 0x17uy; 0x2duy; 0x6buy; 0xd3uy; 0x90uy; 0xbduy; 0x85uy; 0x5fuy; 0x08uy; 0x6euy; 0x3euy; 0x9duy; 0x52uy; 0x5buy; 0x46uy; 0xbfuy; 0xe2uy; 0x45uy; 0x11uy; 0x43uy; 0x15uy; 0x32uy ] in assert_norm (List.Tot.length l == 32); of_list l let test2_expected_sha3_384 : lbytes 48 = let l = List.Tot.map u8_from_UInt8 [ 0xecuy; 0x01uy; 0x49uy; 0x82uy; 0x88uy; 0x51uy; 0x6fuy; 0xc9uy; 0x26uy; 0x45uy; 0x9fuy; 0x58uy; 0xe2uy; 0xc6uy; 0xaduy; 0x8duy; 0xf9uy; 0xb4uy; 0x73uy; 0xcbuy; 0x0fuy; 0xc0uy; 0x8cuy; 0x25uy; 0x96uy; 0xdauy; 0x7cuy; 0xf0uy; 0xe4uy; 0x9buy; 0xe4uy; 0xb2uy; 0x98uy; 0xd8uy; 0x8cuy; 0xeauy; 0x92uy; 0x7auy; 0xc7uy; 0xf5uy; 0x39uy; 0xf1uy; 0xeduy; 0xf2uy; 0x28uy; 0x37uy; 0x6duy; 0x25uy ] in assert_norm (List.Tot.length l == 48); of_list l let test2_expected_sha3_512 : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0xb7uy; 0x51uy; 0x85uy; 0x0buy; 0x1auy; 0x57uy; 0x16uy; 0x8auy; 0x56uy; 0x93uy; 0xcduy; 0x92uy; 0x4buy; 0x6buy; 0x09uy; 0x6euy; 0x08uy; 0xf6uy; 0x21uy; 0x82uy; 0x74uy; 0x44uy; 0xf7uy; 0x0duy; 0x88uy; 0x4fuy; 0x5duy; 0x02uy; 0x40uy; 0xd2uy; 0x71uy; 0x2euy; 0x10uy; 0xe1uy; 0x16uy; 0xe9uy; 0x19uy; 0x2auy; 0xf3uy; 0xc9uy; 0x1auy; 0x7euy; 0xc5uy; 0x76uy; 0x47uy; 0xe3uy; 0x93uy; 0x40uy; 0x57uy; 0x34uy; 0x0buy; 0x4cuy; 0xf4uy; 0x08uy; 0xd5uy; 0xa5uy; 0x65uy; 0x92uy; 0xf8uy; 0x27uy; 0x4euy; 0xecuy; 0x53uy; 0xf0uy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test3_SHA3 let test3_plaintext : lbytes 56 = let l = List.Tot.map u8_from_UInt8 [ 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ] in assert_norm (List.Tot.length l == 56); of_list l let test3_expected_sha3_224 : lbytes 28 = let l = List.Tot.map u8_from_UInt8 [ 0x8auy; 0x24uy; 0x10uy; 0x8buy; 0x15uy; 0x4auy; 0xdauy; 0x21uy; 0xc9uy; 0xfduy; 0x55uy; 0x74uy; 0x49uy; 0x44uy; 0x79uy; 0xbauy; 0x5cuy; 0x7euy; 0x7auy; 0xb7uy; 0x6euy; 0xf2uy; 0x64uy; 0xeauy; 0xd0uy; 0xfcuy; 0xceuy; 0x33uy ] in assert_norm (List.Tot.length l == 28); of_list l let test3_expected_sha3_256 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x41uy; 0xc0uy; 0xdbuy; 0xa2uy; 0xa9uy; 0xd6uy; 0x24uy; 0x08uy; 0x49uy; 0x10uy; 0x03uy; 0x76uy; 0xa8uy; 0x23uy; 0x5euy; 0x2cuy; 0x82uy; 0xe1uy; 0xb9uy; 0x99uy; 0x8auy; 0x99uy; 0x9euy; 0x21uy; 0xdbuy; 0x32uy; 0xdduy; 0x97uy; 0x49uy; 0x6duy; 0x33uy; 0x76uy ] in assert_norm (List.Tot.length l == 32); of_list l let test3_expected_sha3_384 : lbytes 48 = let l = List.Tot.map u8_from_UInt8 [ 0x99uy; 0x1cuy; 0x66uy; 0x57uy; 0x55uy; 0xebuy; 0x3auy; 0x4buy; 0x6buy; 0xbduy; 0xfbuy; 0x75uy; 0xc7uy; 0x8auy; 0x49uy; 0x2euy; 0x8cuy; 0x56uy; 0xa2uy; 0x2cuy; 0x5cuy; 0x4duy; 0x7euy; 0x42uy; 0x9buy; 0xfduy; 0xbcuy; 0x32uy; 0xb9uy; 0xd4uy; 0xaduy; 0x5auy; 0xa0uy; 0x4auy; 0x1fuy; 0x07uy; 0x6euy; 0x62uy; 0xfeuy; 0xa1uy; 0x9euy; 0xefuy; 0x51uy; 0xacuy; 0xd0uy; 0x65uy; 0x7cuy; 0x22uy ] in assert_norm (List.Tot.length l == 48); of_list l let test3_expected_sha3_512 : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0x04uy; 0xa3uy; 0x71uy; 0xe8uy; 0x4euy; 0xcfuy; 0xb5uy; 0xb8uy; 0xb7uy; 0x7cuy; 0xb4uy; 0x86uy; 0x10uy; 0xfcuy; 0xa8uy; 0x18uy; 0x2duy; 0xd4uy; 0x57uy; 0xceuy; 0x6fuy; 0x32uy; 0x6auy; 0x0fuy; 0xd3uy; 0xd7uy; 0xecuy; 0x2fuy; 0x1euy; 0x91uy; 0x63uy; 0x6duy; 0xeeuy; 0x69uy; 0x1fuy; 0xbeuy; 0x0cuy; 0x98uy; 0x53uy; 0x02uy; 0xbauy; 0x1buy; 0x0duy; 0x8duy; 0xc7uy; 0x8cuy; 0x08uy; 0x63uy; 0x46uy; 0xb5uy; 0x33uy; 0xb4uy; 0x9cuy; 0x03uy; 0x0duy; 0x99uy; 0xa2uy; 0x7duy; 0xafuy; 0x11uy; 0x39uy; 0xd6uy; 0xe7uy; 0x5euy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test4_SHA3 let test4_plaintext : lbytes 112 = let l = List.Tot.map u8_from_UInt8 [ 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ] in assert_norm (List.Tot.length l == 112); of_list l let test4_expected_sha3_224 : lbytes 28 = let l = List.Tot.map u8_from_UInt8 [ 0x54uy; 0x3euy; 0x68uy; 0x68uy; 0xe1uy; 0x66uy; 0x6cuy; 0x1auy; 0x64uy; 0x36uy; 0x30uy; 0xdfuy; 0x77uy; 0x36uy; 0x7auy; 0xe5uy; 0xa6uy; 0x2auy; 0x85uy; 0x07uy; 0x0auy; 0x51uy; 0xc1uy; 0x4cuy; 0xbfuy; 0x66uy; 0x5cuy; 0xbcuy ] in assert_norm (List.Tot.length l == 28); of_list l let test4_expected_sha3_256 : lbytes 32 = let l = List.Tot.map u8_from_UInt8 [ 0x91uy; 0x6fuy; 0x60uy; 0x61uy; 0xfeuy; 0x87uy; 0x97uy; 0x41uy; 0xcauy; 0x64uy; 0x69uy; 0xb4uy; 0x39uy; 0x71uy; 0xdfuy; 0xdbuy; 0x28uy; 0xb1uy; 0xa3uy; 0x2duy; 0xc3uy; 0x6cuy; 0xb3uy; 0x25uy; 0x4euy; 0x81uy; 0x2buy; 0xe2uy; 0x7auy; 0xaduy; 0x1duy; 0x18uy ] in assert_norm (List.Tot.length l == 32); of_list l let test4_expected_sha3_384 : lbytes 48 = let l = List.Tot.map u8_from_UInt8 [ 0x79uy; 0x40uy; 0x7duy; 0x3buy; 0x59uy; 0x16uy; 0xb5uy; 0x9cuy; 0x3euy; 0x30uy; 0xb0uy; 0x98uy; 0x22uy; 0x97uy; 0x47uy; 0x91uy; 0xc3uy; 0x13uy; 0xfbuy; 0x9euy; 0xccuy; 0x84uy; 0x9euy; 0x40uy; 0x6fuy; 0x23uy; 0x59uy; 0x2duy; 0x04uy; 0xf6uy; 0x25uy; 0xdcuy; 0x8cuy; 0x70uy; 0x9buy; 0x98uy; 0xb4uy; 0x3buy; 0x38uy; 0x52uy; 0xb3uy; 0x37uy; 0x21uy; 0x61uy; 0x79uy; 0xaauy; 0x7fuy; 0xc7uy ] in assert_norm (List.Tot.length l == 48); of_list l let test4_expected_sha3_512 : lbytes 64 = let l = List.Tot.map u8_from_UInt8 [ 0xafuy; 0xebuy; 0xb2uy; 0xefuy; 0x54uy; 0x2euy; 0x65uy; 0x79uy; 0xc5uy; 0x0cuy; 0xaduy; 0x06uy; 0xd2uy; 0xe5uy; 0x78uy; 0xf9uy; 0xf8uy; 0xdduy; 0x68uy; 0x81uy; 0xd7uy; 0xdcuy; 0x82uy; 0x4duy; 0x26uy; 0x36uy; 0x0fuy; 0xeeuy; 0xbfuy; 0x18uy; 0xa4uy; 0xfauy; 0x73uy; 0xe3uy; 0x26uy; 0x11uy; 0x22uy; 0x94uy; 0x8euy; 0xfcuy; 0xfduy; 0x49uy; 0x2euy; 0x74uy; 0xe8uy; 0x2euy; 0x21uy; 0x89uy; 0xeduy; 0x0fuy; 0xb4uy; 0x40uy; 0xd1uy; 0x87uy; 0xf3uy; 0x82uy; 0x27uy; 0x0cuy; 0xb4uy; 0x55uy; 0xf2uy; 0x1duy; 0xd1uy; 0x85uy ] in assert_norm (List.Tot.length l == 64); of_list l /// Test5_SHAKE128 let test5_plaintext_shake128 : lbytes 0 = let l = List.Tot.map u8_from_UInt8 [] in assert_norm (List.Tot.length l == 0); of_list l let test5_expected_shake128 : lbytes 16 = let l = List.Tot.map u8_from_UInt8 [ 0x7fuy; 0x9cuy; 0x2buy; 0xa4uy; 0xe8uy; 0x8fuy; 0x82uy; 0x7duy; 0x61uy; 0x60uy; 0x45uy; 0x50uy; 0x76uy; 0x05uy; 0x85uy; 0x3euy ] in assert_norm (List.Tot.length l == 16); of_list l /// Test6_SHAKE128 let test6_plaintext_shake128 : lbytes 14 = let l = List.Tot.map u8_from_UInt8 [ 0x52uy; 0x97uy; 0x7euy; 0x53uy; 0x2buy; 0xccuy; 0xdbuy; 0x89uy; 0xdfuy; 0xefuy; 0xf7uy; 0xe9uy; 0xe4uy; 0xaduy ] in assert_norm (List.Tot.length l == 14); of_list l let test6_expected_shake128 : lbytes 16 = let l = List.Tot.map u8_from_UInt8 [ 0xfbuy; 0xfbuy; 0xa5uy; 0xc1uy; 0xe1uy; 0x79uy; 0xdfuy; 0x14uy; 0x69uy; 0xfcuy; 0xc8uy; 0x58uy; 0x8auy; 0xe5uy; 0xd2uy; 0xccuy ] in assert_norm (List.Tot.length l == 16); of_list l /// Test7_SHAKE128 let test7_plaintext_shake128 : lbytes 34 = let l = List.Tot.map u8_from_UInt8 [ 0x4auy; 0x20uy; 0x6auy; 0x5buy; 0x8auy; 0xa3uy; 0x58uy; 0x6cuy; 0x06uy; 0x67uy; 0xa4uy; 0x00uy; 0x20uy; 0xd6uy; 0x5fuy; 0xf5uy; 0x11uy; 0xd5uy; 0x2buy; 0x73uy; 0x2euy; 0xf7uy; 0xa0uy; 0xc5uy; 0x69uy; 0xf1uy; 0xeeuy; 0x68uy; 0x1auy; 0x4fuy; 0xc3uy; 0x62uy; 0x00uy; 0x65uy ] in assert_norm (List.Tot.length l == 34); of_list l let test7_expected_shake128 : lbytes 16 = let l = List.Tot.map u8_from_UInt8 [ 0x7buy; 0xb4uy; 0x33uy; 0x75uy; 0x2buy; 0x98uy; 0xf9uy; 0x15uy; 0xbeuy; 0x51uy; 0x82uy; 0xbcuy; 0x1fuy; 0x09uy; 0x66uy; 0x48uy ] in assert_norm (List.Tot.length l == 16); of_list l /// Test8_SHAKE128
false
false
Spec.SHA3.Test.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val test8_plaintext_shake128:lbytes 83
[]
Spec.SHA3.Test.test8_plaintext_shake128
{ "file_name": "specs/tests/Spec.SHA3.Test.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 83
{ "end_col": 11, "end_line": 343, "start_col": 42, "start_line": 328 }
Prims.GTot
val bytes_equal (b1 b2: bytes) : GTot Type0
[ { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let bytes_equal (b1 b2: bytes) : GTot Type0 = Seq.length b1 == Seq.length b2 /\ (forall (i: nat { i < Seq.length b1 } ) . {:pattern (Seq.index b1 i); (Seq.index b2 i) } U8.v (Seq.index b1 i) == U8.v (Seq.index b2 i))
val bytes_equal (b1 b2: bytes) : GTot Type0 let bytes_equal (b1 b2: bytes) : GTot Type0 =
false
null
false
Seq.length b1 == Seq.length b2 /\ (forall (i: nat{i < Seq.length b1}). {:pattern (Seq.index b1 i); (Seq.index b2 i)} U8.v (Seq.index b1 i) == U8.v (Seq.index b2 i))
{ "checked_file": "LowParse.Bytes.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "LowParse.Bytes.fst" }
[ "sometrivial" ]
[ "LowParse.Bytes.bytes", "Prims.l_and", "Prims.eq2", "Prims.nat", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "Prims.l_Forall", "Prims.b2t", "Prims.op_LessThan", "FStar.UInt.uint_t", "FStar.UInt8.n", "FStar.UInt8.v", "FStar.Seq.Base.index" ]
[]
module LowParse.Bytes module Seq = FStar.Seq module U8 = FStar.UInt8
false
false
LowParse.Bytes.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bytes_equal (b1 b2: bytes) : GTot Type0
[]
LowParse.Bytes.bytes_equal
{ "file_name": "src/lowparse/LowParse.Bytes.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
b1: LowParse.Bytes.bytes -> b2: LowParse.Bytes.bytes -> Prims.GTot Type0
{ "end_col": 138, "end_line": 8, "start_col": 2, "start_line": 7 }
FStar.Pervasives.Lemma
val bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2)) [SMTPat (b1 `bytes_equal` b2)]
[ { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2)) [SMTPat (b1 `bytes_equal` b2)] = assert (b1 `Seq.equal` b2)
val bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2)) [SMTPat (b1 `bytes_equal` b2)] let bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2)) [SMTPat (b1 `bytes_equal` b2)] =
false
null
true
assert (b1 `Seq.equal` b2)
{ "checked_file": "LowParse.Bytes.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "LowParse.Bytes.fst" }
[ "lemma" ]
[ "LowParse.Bytes.bytes", "Prims._assert", "FStar.Seq.Base.equal", "LowParse.Bytes.byte", "Prims.unit", "LowParse.Bytes.bytes_equal", "Prims.squash", "Prims.eq2", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
module LowParse.Bytes module Seq = FStar.Seq module U8 = FStar.UInt8 let bytes_equal (b1 b2: bytes) : GTot Type0 = Seq.length b1 == Seq.length b2 /\ (forall (i: nat { i < Seq.length b1 } ) . {:pattern (Seq.index b1 i); (Seq.index b2 i) } U8.v (Seq.index b1 i) == U8.v (Seq.index b2 i)) let bytes_equal_intro (b1 b2: bytes) : Lemma (requires ( Seq.length b1 == Seq.length b2 /\ (forall (i: nat { i < Seq.length b1 } ) . U8.v (Seq.index b1 i) == U8.v (Seq.index b2 i)) )) (ensures (bytes_equal b1 b2)) [SMTPat (bytes_equal b1 b2)] = () let bytes_equal_refl (b1 b2: bytes) : Lemma (requires (b1 == b2)) (ensures (b1 `bytes_equal` b2)) [SMTPat (bytes_equal b1 b2)] = () let bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2))
false
false
LowParse.Bytes.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bytes_equal_elim (b1 b2: bytes) : Lemma (requires (b1 `bytes_equal` b2)) (ensures (b1 == b2)) [SMTPat (b1 `bytes_equal` b2)]
[]
LowParse.Bytes.bytes_equal_elim
{ "file_name": "src/lowparse/LowParse.Bytes.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
b1: LowParse.Bytes.bytes -> b2: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (requires LowParse.Bytes.bytes_equal b1 b2) (ensures b1 == b2) [SMTPat (LowParse.Bytes.bytes_equal b1 b2)]
{ "end_col": 28, "end_line": 29, "start_col": 2, "start_line": 29 }
FStar.Tactics.Effect.Tac
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let collect_app = collect_app' []
let collect_app =
true
null
false
collect_app' []
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "" ]
[ "FStar.Reflection.V2.Formula.collect_app'", "Prims.Nil", "FStar.Reflection.V2.Data.argv" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args)
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val collect_app : t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac (FStar.Tactics.NamedView.term * Prims.list FStar.Reflection.V2.Data.argv)
[]
FStar.Reflection.V2.Formula.collect_app
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac (FStar.Tactics.NamedView.term * Prims.list FStar.Reflection.V2.Data.argv)
{ "end_col": 41, "end_line": 46, "start_col": 26, "start_line": 46 }
FStar.Tactics.Effect.Tac
val inspect_unascribe (t: term) : Tac term_view
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv
val inspect_unascribe (t: term) : Tac term_view let rec inspect_unascribe (t: term) : Tac term_view =
true
null
false
match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Tactics.NamedView.term", "FStar.Pervasives.Native.option", "Prims.bool", "FStar.Reflection.V2.Formula.inspect_unascribe", "FStar.Tactics.NamedView.term_view", "FStar.Tactics.NamedView.comp", "FStar.Tactics.NamedView.named_term_view", "FStar.Tactics.NamedView.inspect" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views /////
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val inspect_unascribe (t: term) : Tac term_view
[ "recursion" ]
FStar.Reflection.V2.Formula.inspect_unascribe
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term_view
{ "end_col": 12, "end_line": 37, "start_col": 2, "start_line": 33 }
Prims.Tot
val mk_Forall (typ pred: term) : Tot formula
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit)))
val mk_Forall (typ pred: term) : Tot formula let mk_Forall (typ pred: term) : Tot formula =
false
null
false
let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0 }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit)))
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "total" ]
[ "FStar.Tactics.NamedView.term", "FStar.Reflection.V2.Formula.Forall", "FStar.Tactics.NamedView.pack", "FStar.Tactics.NamedView.Tv_App", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Tactics.NamedView.Tv_BVar", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Tactics.NamedView.bv", "FStar.Tactics.NamedView.pack_bv", "FStar.Reflection.V2.Data.Mkbv_view", "FStar.Sealed.seal", "FStar.Reflection.Types.typ", "FStar.Reflection.V2.Data.as_ppname", "FStar.Reflection.V2.Formula.formula" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None"
false
true
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val mk_Forall (typ pred: term) : Tot formula
[]
FStar.Reflection.V2.Formula.mk_Forall
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
typ: FStar.Tactics.NamedView.term -> pred: FStar.Tactics.NamedView.term -> FStar.Reflection.V2.Formula.formula
{ "end_col": 68, "end_line": 77, "start_col": 56, "start_line": 73 }
FStar.Tactics.Effect.Tac
val namedv_to_string (namedv: namedv) : Tac string
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let namedv_to_string (namedv : namedv) : Tac string = let namedvv = inspect_namedv namedv in unseal namedvv.ppname
val namedv_to_string (namedv: namedv) : Tac string let namedv_to_string (namedv: namedv) : Tac string =
true
null
false
let namedvv = inspect_namedv namedv in unseal namedvv.ppname
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Tactics.NamedView.namedv", "FStar.Tactics.Unseal.unseal", "Prims.string", "FStar.Reflection.V2.Data.__proj__Mknamedv_view__item__ppname", "FStar.Tactics.NamedView.inspect_namedv" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t // Badly named, this only means it always returns a formula even if not properly // squashed at the top-level. let term_as_formula_total (t:term) : Tac formula = term_as_formula' (maybe_unsquash_term t) let formula_as_term_view (f:formula) : Tot term_view = let mk_app' tv args = List.Tot.Base.fold_left (fun tv a -> Tv_App (pack tv) a) tv args in let e = Q_Explicit in let i = Q_Implicit in match f with | True_ -> Tv_FVar (pack_fv true_qn) | False_ -> Tv_FVar (pack_fv false_qn) | Comp (Eq None) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(l,e);(r,e)] | Comp (Eq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(t,i);(l,e);(r,e)] | Comp (BoolEq None) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(l,e);(r,e)] | Comp (BoolEq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(t,i);(l,e);(r,e)] | Comp Lt l r -> mk_app' (Tv_FVar (pack_fv lt_qn)) [(l,e);(r,e)] | Comp Le l r -> mk_app' (Tv_FVar (pack_fv lte_qn)) [(l,e);(r,e)] | Comp Gt l r -> mk_app' (Tv_FVar (pack_fv gt_qn)) [(l,e);(r,e)] | Comp Ge l r -> mk_app' (Tv_FVar (pack_fv gte_qn)) [(l,e);(r,e)] | And p q -> mk_app' (Tv_FVar (pack_fv and_qn)) [(p,e);(q,e)] | Or p q -> mk_app' (Tv_FVar (pack_fv or_qn)) [(p,e);(q,e)] | Implies p q -> mk_app' (Tv_FVar (pack_fv imp_qn)) [(p,e);(q,e)] | Not p -> mk_app' (Tv_FVar (pack_fv not_qn)) [(p,e)] | Iff p q -> mk_app' (Tv_FVar (pack_fv iff_qn)) [(p,e);(q,e)] | Forall b sort t -> Tv_Unknown // TODO: decide on meaning of this | Exists b sort t -> Tv_Unknown // TODO: ^ | App p q -> Tv_App p (q, Q_Explicit) | Name b -> Tv_Var b | FV fv -> Tv_FVar fv | IntLit i -> Tv_Const (C_Int i) | F_Unknown -> Tv_Unknown let formula_as_term (f:formula) : Tot term = pack (formula_as_term_view f)
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val namedv_to_string (namedv: namedv) : Tac string
[]
FStar.Reflection.V2.Formula.namedv_to_string
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
namedv: FStar.Tactics.NamedView.namedv -> FStar.Tactics.Effect.Tac Prims.string
{ "end_col": 25, "end_line": 220, "start_col": 61, "start_line": 218 }
FStar.Tactics.Effect.Tac
val collect_app' (args: list argv) (t: term) : Tac (term * list argv) (decreases t)
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args)
val collect_app' (args: list argv) (t: term) : Tac (term * list argv) (decreases t) let rec collect_app' (args: list argv) (t: term) : Tac (term * list argv) (decreases t) =
true
null
false
match inspect_unascribe t with | Tv_App l r -> collect_app' (r :: args) l | _ -> (t, args)
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "" ]
[ "Prims.list", "FStar.Reflection.V2.Data.argv", "FStar.Tactics.NamedView.term", "FStar.Reflection.V2.Formula.collect_app'", "Prims.Cons", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.NamedView.named_term_view", "FStar.Pervasives.Native.Mktuple2", "FStar.Tactics.NamedView.term_view", "FStar.Reflection.V2.Formula.inspect_unascribe" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term)
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val collect_app' (args: list argv) (t: term) : Tac (term * list argv) (decreases t)
[ "recursion" ]
FStar.Reflection.V2.Formula.collect_app'
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
args: Prims.list FStar.Reflection.V2.Data.argv -> t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac (FStar.Tactics.NamedView.term * Prims.list FStar.Reflection.V2.Data.argv)
{ "end_col": 20, "end_line": 44, "start_col": 4, "start_line": 41 }
Prims.Tot
val mk_Exists (typ pred: term) : Tot formula
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit)))
val mk_Exists (typ pred: term) : Tot formula let mk_Exists (typ pred: term) : Tot formula =
false
null
false
let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0 }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit)))
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "total" ]
[ "FStar.Tactics.NamedView.term", "FStar.Reflection.V2.Formula.Exists", "FStar.Tactics.NamedView.pack", "FStar.Tactics.NamedView.Tv_App", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Tactics.NamedView.Tv_BVar", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Tactics.NamedView.bv", "FStar.Tactics.NamedView.pack_bv", "FStar.Reflection.V2.Data.Mkbv_view", "FStar.Sealed.seal", "FStar.Reflection.Types.typ", "FStar.Reflection.V2.Data.as_ppname", "FStar.Reflection.V2.Formula.formula" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit)))
false
true
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val mk_Exists (typ pred: term) : Tot formula
[]
FStar.Reflection.V2.Formula.mk_Exists
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
typ: FStar.Tactics.NamedView.term -> pred: FStar.Tactics.NamedView.term -> FStar.Reflection.V2.Formula.formula
{ "end_col": 68, "end_line": 83, "start_col": 56, "start_line": 79 }
FStar.Tactics.Effect.Tac
val term_as_formula_total (t: term) : Tac formula
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let term_as_formula_total (t:term) : Tac formula = term_as_formula' (maybe_unsquash_term t)
val term_as_formula_total (t: term) : Tac formula let term_as_formula_total (t: term) : Tac formula =
true
null
false
term_as_formula' (maybe_unsquash_term t)
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Tactics.NamedView.term", "FStar.Reflection.V2.Formula.term_as_formula'", "FStar.Reflection.V2.Derived.maybe_unsquash_term", "FStar.Reflection.V2.Formula.formula" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t // Badly named, this only means it always returns a formula even if not properly // squashed at the top-level.
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val term_as_formula_total (t: term) : Tac formula
[]
FStar.Reflection.V2.Formula.term_as_formula_total
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Reflection.V2.Formula.formula
{ "end_col": 44, "end_line": 175, "start_col": 4, "start_line": 175 }
Prims.Tot
val formula_as_term (f: formula) : Tot term
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let formula_as_term (f:formula) : Tot term = pack (formula_as_term_view f)
val formula_as_term (f: formula) : Tot term let formula_as_term (f: formula) : Tot term =
false
null
false
pack (formula_as_term_view f)
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "total" ]
[ "FStar.Reflection.V2.Formula.formula", "FStar.Tactics.NamedView.pack", "FStar.Reflection.V2.Formula.formula_as_term_view", "FStar.Tactics.NamedView.term" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t // Badly named, this only means it always returns a formula even if not properly // squashed at the top-level. let term_as_formula_total (t:term) : Tac formula = term_as_formula' (maybe_unsquash_term t) let formula_as_term_view (f:formula) : Tot term_view = let mk_app' tv args = List.Tot.Base.fold_left (fun tv a -> Tv_App (pack tv) a) tv args in let e = Q_Explicit in let i = Q_Implicit in match f with | True_ -> Tv_FVar (pack_fv true_qn) | False_ -> Tv_FVar (pack_fv false_qn) | Comp (Eq None) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(l,e);(r,e)] | Comp (Eq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(t,i);(l,e);(r,e)] | Comp (BoolEq None) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(l,e);(r,e)] | Comp (BoolEq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(t,i);(l,e);(r,e)] | Comp Lt l r -> mk_app' (Tv_FVar (pack_fv lt_qn)) [(l,e);(r,e)] | Comp Le l r -> mk_app' (Tv_FVar (pack_fv lte_qn)) [(l,e);(r,e)] | Comp Gt l r -> mk_app' (Tv_FVar (pack_fv gt_qn)) [(l,e);(r,e)] | Comp Ge l r -> mk_app' (Tv_FVar (pack_fv gte_qn)) [(l,e);(r,e)] | And p q -> mk_app' (Tv_FVar (pack_fv and_qn)) [(p,e);(q,e)] | Or p q -> mk_app' (Tv_FVar (pack_fv or_qn)) [(p,e);(q,e)] | Implies p q -> mk_app' (Tv_FVar (pack_fv imp_qn)) [(p,e);(q,e)] | Not p -> mk_app' (Tv_FVar (pack_fv not_qn)) [(p,e)] | Iff p q -> mk_app' (Tv_FVar (pack_fv iff_qn)) [(p,e);(q,e)] | Forall b sort t -> Tv_Unknown // TODO: decide on meaning of this | Exists b sort t -> Tv_Unknown // TODO: ^ | App p q -> Tv_App p (q, Q_Explicit) | Name b -> Tv_Var b | FV fv -> Tv_FVar fv | IntLit i -> Tv_Const (C_Int i) | F_Unknown -> Tv_Unknown
false
true
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val formula_as_term (f: formula) : Tot term
[]
FStar.Reflection.V2.Formula.formula_as_term
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
f: FStar.Reflection.V2.Formula.formula -> FStar.Tactics.NamedView.term
{ "end_col": 33, "end_line": 216, "start_col": 4, "start_line": 216 }
FStar.Tactics.Effect.Tac
val term_as_formula (t: term) : Tac formula
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t
val term_as_formula (t: term) : Tac formula let term_as_formula (t: term) : Tac formula =
true
null
false
match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Tactics.NamedView.term", "FStar.Reflection.V2.Derived.unsquash_term", "FStar.Reflection.V2.Formula.F_Unknown", "FStar.Reflection.V2.Formula.formula", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Formula.term_as_formula'" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val term_as_formula (t: term) : Tac formula
[]
FStar.Reflection.V2.Formula.term_as_formula
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Reflection.V2.Formula.formula
{ "end_col": 26, "end_line": 170, "start_col": 4, "start_line": 167 }
Prims.Tot
val formula_as_term_view (f: formula) : Tot term_view
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let formula_as_term_view (f:formula) : Tot term_view = let mk_app' tv args = List.Tot.Base.fold_left (fun tv a -> Tv_App (pack tv) a) tv args in let e = Q_Explicit in let i = Q_Implicit in match f with | True_ -> Tv_FVar (pack_fv true_qn) | False_ -> Tv_FVar (pack_fv false_qn) | Comp (Eq None) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(l,e);(r,e)] | Comp (Eq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(t,i);(l,e);(r,e)] | Comp (BoolEq None) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(l,e);(r,e)] | Comp (BoolEq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(t,i);(l,e);(r,e)] | Comp Lt l r -> mk_app' (Tv_FVar (pack_fv lt_qn)) [(l,e);(r,e)] | Comp Le l r -> mk_app' (Tv_FVar (pack_fv lte_qn)) [(l,e);(r,e)] | Comp Gt l r -> mk_app' (Tv_FVar (pack_fv gt_qn)) [(l,e);(r,e)] | Comp Ge l r -> mk_app' (Tv_FVar (pack_fv gte_qn)) [(l,e);(r,e)] | And p q -> mk_app' (Tv_FVar (pack_fv and_qn)) [(p,e);(q,e)] | Or p q -> mk_app' (Tv_FVar (pack_fv or_qn)) [(p,e);(q,e)] | Implies p q -> mk_app' (Tv_FVar (pack_fv imp_qn)) [(p,e);(q,e)] | Not p -> mk_app' (Tv_FVar (pack_fv not_qn)) [(p,e)] | Iff p q -> mk_app' (Tv_FVar (pack_fv iff_qn)) [(p,e);(q,e)] | Forall b sort t -> Tv_Unknown // TODO: decide on meaning of this | Exists b sort t -> Tv_Unknown // TODO: ^ | App p q -> Tv_App p (q, Q_Explicit) | Name b -> Tv_Var b | FV fv -> Tv_FVar fv | IntLit i -> Tv_Const (C_Int i) | F_Unknown -> Tv_Unknown
val formula_as_term_view (f: formula) : Tot term_view let formula_as_term_view (f: formula) : Tot term_view =
false
null
false
let mk_app' tv args = List.Tot.Base.fold_left (fun tv a -> Tv_App (pack tv) a) tv args in let e = Q_Explicit in let i = Q_Implicit in match f with | True_ -> Tv_FVar (pack_fv true_qn) | False_ -> Tv_FVar (pack_fv false_qn) | Comp (Eq None) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(l, e); (r, e)] | Comp (Eq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(t, i); (l, e); (r, e)] | Comp (BoolEq None) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(l, e); (r, e)] | Comp (BoolEq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(t, i); (l, e); (r, e)] | Comp Lt l r -> mk_app' (Tv_FVar (pack_fv lt_qn)) [(l, e); (r, e)] | Comp Le l r -> mk_app' (Tv_FVar (pack_fv lte_qn)) [(l, e); (r, e)] | Comp Gt l r -> mk_app' (Tv_FVar (pack_fv gt_qn)) [(l, e); (r, e)] | Comp Ge l r -> mk_app' (Tv_FVar (pack_fv gte_qn)) [(l, e); (r, e)] | And p q -> mk_app' (Tv_FVar (pack_fv and_qn)) [(p, e); (q, e)] | Or p q -> mk_app' (Tv_FVar (pack_fv or_qn)) [(p, e); (q, e)] | Implies p q -> mk_app' (Tv_FVar (pack_fv imp_qn)) [(p, e); (q, e)] | Not p -> mk_app' (Tv_FVar (pack_fv not_qn)) [(p, e)] | Iff p q -> mk_app' (Tv_FVar (pack_fv iff_qn)) [(p, e); (q, e)] | Forall b sort t -> Tv_Unknown | Exists b sort t -> Tv_Unknown | App p q -> Tv_App p (q, Q_Explicit) | Name b -> Tv_Var b | FV fv -> Tv_FVar fv | IntLit i -> Tv_Const (C_Int i) | F_Unknown -> Tv_Unknown
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[ "total" ]
[ "FStar.Reflection.V2.Formula.formula", "FStar.Tactics.NamedView.Tv_FVar", "FStar.Reflection.V2.Builtins.pack_fv", "FStar.Reflection.Const.true_qn", "FStar.Reflection.Const.false_qn", "FStar.Tactics.NamedView.term", "FStar.Reflection.Const.eq2_qn", "Prims.Cons", "FStar.Reflection.V2.Data.argv", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "Prims.Nil", "FStar.Reflection.Types.typ", "FStar.Reflection.Const.eq1_qn", "FStar.Reflection.Const.lt_qn", "FStar.Reflection.Const.lte_qn", "FStar.Reflection.Const.gt_qn", "FStar.Reflection.Const.gte_qn", "FStar.Reflection.Const.and_qn", "FStar.Reflection.Const.or_qn", "FStar.Reflection.Const.imp_qn", "FStar.Reflection.Const.not_qn", "FStar.Reflection.Const.iff_qn", "FStar.Tactics.NamedView.bv", "FStar.Tactics.NamedView.Tv_Unknown", "FStar.Tactics.NamedView.Tv_App", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Tactics.NamedView.namedv", "FStar.Tactics.NamedView.Tv_Var", "FStar.Reflection.Types.fv", "Prims.int", "FStar.Tactics.NamedView.Tv_Const", "FStar.Reflection.V2.Data.C_Int", "FStar.Tactics.NamedView.term_view", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Tactics.NamedView.named_term_view", "Prims.list", "FStar.List.Tot.Base.fold_left", "FStar.Tactics.NamedView.pack" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t // Badly named, this only means it always returns a formula even if not properly // squashed at the top-level. let term_as_formula_total (t:term) : Tac formula = term_as_formula' (maybe_unsquash_term t)
false
true
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val formula_as_term_view (f: formula) : Tot term_view
[]
FStar.Reflection.V2.Formula.formula_as_term_view
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
f: FStar.Reflection.V2.Formula.formula -> FStar.Tactics.NamedView.term_view
{ "end_col": 18, "end_line": 213, "start_col": 54, "start_line": 177 }
FStar.Tactics.Effect.Tac
val formula_to_string (f: formula) : Tac string
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let formula_to_string (f:formula) : Tac string = match f with | True_ -> "True_" | False_ -> "False_" | Comp (Eq mt) l r -> "Eq" ^ (match mt with | None -> "" | Some t -> " (" ^ term_to_string t ^ ")") ^ " (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp (BoolEq mt) l r -> "BoolEq" ^ (match mt with | None -> "" | Some t -> " (" ^ term_to_string t ^ ")") ^ " (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Lt l r -> "Lt (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Le l r -> "Le (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Gt l r -> "Gt (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Ge l r -> "Ge (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | And p q -> "And (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Or p q -> "Or (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Implies p q -> "Implies (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Not p -> "Not (" ^ term_to_string p ^ ")" | Iff p q -> "Iff (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Forall bs _sort t -> "Forall <bs> (" ^ term_to_string t ^ ")" | Exists bs _sort t -> "Exists <bs> (" ^ term_to_string t ^ ")" | App p q -> "App (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Name bv -> "Name (" ^ namedv_to_string bv ^ ")" | FV fv -> "FV (" ^ flatten_name (inspect_fv fv) ^ ")" | IntLit i -> "Int " ^ string_of_int i | F_Unknown -> "?"
val formula_to_string (f: formula) : Tac string let formula_to_string (f: formula) : Tac string =
true
null
false
match f with | True_ -> "True_" | False_ -> "False_" | Comp (Eq mt) l r -> "Eq" ^ (match mt with | None -> "" | Some t -> " (" ^ term_to_string t ^ ")") ^ " (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp (BoolEq mt) l r -> "BoolEq" ^ (match mt with | None -> "" | Some t -> " (" ^ term_to_string t ^ ")") ^ " (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Lt l r -> "Lt (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Le l r -> "Le (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Gt l r -> "Gt (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | Comp Ge l r -> "Ge (" ^ term_to_string l ^ ") (" ^ term_to_string r ^ ")" | And p q -> "And (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Or p q -> "Or (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Implies p q -> "Implies (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Not p -> "Not (" ^ term_to_string p ^ ")" | Iff p q -> "Iff (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Forall bs _sort t -> "Forall <bs> (" ^ term_to_string t ^ ")" | Exists bs _sort t -> "Exists <bs> (" ^ term_to_string t ^ ")" | App p q -> "App (" ^ term_to_string p ^ ") (" ^ term_to_string q ^ ")" | Name bv -> "Name (" ^ namedv_to_string bv ^ ")" | FV fv -> "FV (" ^ flatten_name (inspect_fv fv) ^ ")" | IntLit i -> "Int " ^ string_of_int i | F_Unknown -> "?"
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Reflection.V2.Formula.formula", "Prims.string", "FStar.Pervasives.Native.option", "FStar.Reflection.Types.typ", "FStar.Tactics.NamedView.term", "Prims.op_Hat", "FStar.Tactics.V2.Builtins.term_to_string", "FStar.Tactics.NamedView.bv", "FStar.Tactics.NamedView.namedv", "FStar.Reflection.V2.Formula.namedv_to_string", "FStar.Reflection.Types.fv", "FStar.Reflection.V2.Derived.flatten_name", "FStar.Reflection.V2.Builtins.inspect_fv", "Prims.int", "Prims.string_of_int" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin] let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???") // Unsquashing let term_as_formula (t:term) : Tac formula = match unsquash_term t with | None -> F_Unknown | Some t -> term_as_formula' t // Badly named, this only means it always returns a formula even if not properly // squashed at the top-level. let term_as_formula_total (t:term) : Tac formula = term_as_formula' (maybe_unsquash_term t) let formula_as_term_view (f:formula) : Tot term_view = let mk_app' tv args = List.Tot.Base.fold_left (fun tv a -> Tv_App (pack tv) a) tv args in let e = Q_Explicit in let i = Q_Implicit in match f with | True_ -> Tv_FVar (pack_fv true_qn) | False_ -> Tv_FVar (pack_fv false_qn) | Comp (Eq None) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(l,e);(r,e)] | Comp (Eq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq2_qn)) [(t,i);(l,e);(r,e)] | Comp (BoolEq None) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(l,e);(r,e)] | Comp (BoolEq (Some t)) l r -> mk_app' (Tv_FVar (pack_fv eq1_qn)) [(t,i);(l,e);(r,e)] | Comp Lt l r -> mk_app' (Tv_FVar (pack_fv lt_qn)) [(l,e);(r,e)] | Comp Le l r -> mk_app' (Tv_FVar (pack_fv lte_qn)) [(l,e);(r,e)] | Comp Gt l r -> mk_app' (Tv_FVar (pack_fv gt_qn)) [(l,e);(r,e)] | Comp Ge l r -> mk_app' (Tv_FVar (pack_fv gte_qn)) [(l,e);(r,e)] | And p q -> mk_app' (Tv_FVar (pack_fv and_qn)) [(p,e);(q,e)] | Or p q -> mk_app' (Tv_FVar (pack_fv or_qn)) [(p,e);(q,e)] | Implies p q -> mk_app' (Tv_FVar (pack_fv imp_qn)) [(p,e);(q,e)] | Not p -> mk_app' (Tv_FVar (pack_fv not_qn)) [(p,e)] | Iff p q -> mk_app' (Tv_FVar (pack_fv iff_qn)) [(p,e);(q,e)] | Forall b sort t -> Tv_Unknown // TODO: decide on meaning of this | Exists b sort t -> Tv_Unknown // TODO: ^ | App p q -> Tv_App p (q, Q_Explicit) | Name b -> Tv_Var b | FV fv -> Tv_FVar fv | IntLit i -> Tv_Const (C_Int i) | F_Unknown -> Tv_Unknown let formula_as_term (f:formula) : Tot term = pack (formula_as_term_view f) private let namedv_to_string (namedv : namedv) : Tac string = let namedvv = inspect_namedv namedv in unseal namedvv.ppname
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val formula_to_string (f: formula) : Tac string
[]
FStar.Reflection.V2.Formula.formula_to_string
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
f: FStar.Reflection.V2.Formula.formula -> FStar.Tactics.Effect.Tac Prims.string
{ "end_col": 22, "end_line": 251, "start_col": 4, "start_line": 223 }
FStar.Tactics.Effect.Tac
val term_as_formula' (t: term) : Tac formula
[ { "abbrev": false, "full_module": "FStar.Tactics.NamedView", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Common", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Data", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Derived", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2.Builtins", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Const", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let term_as_formula' (t:term) : Tac formula = match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> // Cannot use `when` clauses when verifying! let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv // TODO: l_Forall // ...or should we just try to drop all squashes? // TODO: b2t at this point ? | Tv_App h0 t -> begin let (h, ts) = collect_app h0 in let h = un_uinst h in match inspect h, ts@[t] with | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit); (a3, Q_Explicit)] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Explicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 // Non-annotated comparisons else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a1, Q_Implicit); (a2, Q_Explicit)] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [(a, Q_Explicit)] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then begin if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) end else App h0 (fst t) | _ -> App h0 (fst t) end | Tv_Const (C_Int i) -> IntLit i (* Not formulas. *) | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown (* Other constants? *) | Tv_Const _ -> F_Unknown (* Should not occur, we're using inspect *) | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???")
val term_as_formula' (t: term) : Tac formula let term_as_formula' (t: term) : Tac formula =
true
null
false
match inspect_unascribe t with | Tv_Var n -> Name n | Tv_FVar fv | Tv_UInst fv _ -> let qn = inspect_fv fv in if qn = true_qn then True_ else if qn = false_qn then False_ else FV fv | Tv_App h0 t -> let h, ts = collect_app h0 in let h = un_uinst h in (match inspect h, ts @ [t] with | Tv_FVar fv, [a1, Q_Implicit ; a2, Q_Explicit ; a3, Q_Explicit] -> let qn = inspect_fv fv in if qn = eq2_qn then Comp (Eq (Some a1)) a2 a3 else if qn = eq1_qn then Comp (BoolEq (Some a1)) a2 a3 else if qn = lt_qn then Comp Lt a2 a3 else if qn = lte_qn then Comp Le a2 a3 else if qn = gt_qn then Comp Gt a2 a3 else if qn = gte_qn then Comp Ge a2 a3 else App h0 (fst t) | Tv_FVar fv, [a1, Q_Explicit ; a2, Q_Explicit] -> let qn = inspect_fv fv in if qn = imp_qn then Implies a1 a2 else if qn = and_qn then And a1 a2 else if qn = iff_qn then Iff a1 a2 else if qn = or_qn then Or a1 a2 else if qn = eq2_qn then Comp (Eq None) a1 a2 else if qn = eq1_qn then Comp (BoolEq None) a1 a2 else App h0 (fst t) | Tv_FVar fv, [a1, Q_Implicit ; a2, Q_Explicit] -> let qn = inspect_fv fv in if qn = forall_qn then mk_Forall a1 a2 else if qn = exists_qn then mk_Exists a1 a2 else App h0 (fst t) | Tv_FVar fv, [a, Q_Explicit] -> let qn = inspect_fv fv in if qn = not_qn then Not a else if qn = b2t_qn then if term_eq a (`false) then False_ else if term_eq a (`true) then True_ else App h0 (fst t) else App h0 (fst t) | _ -> App h0 (fst t)) | Tv_Const (C_Int i) -> IntLit i | Tv_Let _ _ _ _ _ | Tv_Match _ _ _ | Tv_Type _ | Tv_Abs _ _ | Tv_Arrow _ _ | Tv_Uvar _ _ | Tv_Unknown | Tv_Unsupp | Tv_Refine _ _ -> F_Unknown | Tv_Const _ -> F_Unknown | Tv_BVar _ -> F_Unknown | _ -> raise (TacticFailure "???")
{ "checked_file": "FStar.Reflection.V2.Formula.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.Builtins.fsti.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.Common.fsti.checked", "FStar.Reflection.V2.Derived.fst.checked", "FStar.Reflection.V2.Data.fsti.checked", "FStar.Reflection.V2.Builtins.fsti.checked", "FStar.Reflection.Types.fsti.checked", "FStar.Reflection.Const.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Reflection.V2.Formula.fst" }
[]
[ "FStar.Tactics.NamedView.term", "FStar.Tactics.NamedView.namedv", "FStar.Reflection.V2.Formula.Name", "FStar.Reflection.V2.Formula.formula", "FStar.Reflection.Types.fv", "Prims.op_Equality", "Prims.list", "Prims.string", "FStar.Reflection.Const.true_qn", "FStar.Reflection.V2.Formula.True_", "Prims.bool", "FStar.Reflection.Const.false_qn", "FStar.Reflection.V2.Formula.False_", "FStar.Reflection.V2.Formula.FV", "FStar.Reflection.Types.name", "FStar.Reflection.V2.Builtins.inspect_fv", "FStar.Reflection.V2.Data.universes", "FStar.Reflection.V2.Data.argv", "FStar.Reflection.Types.term", "FStar.Reflection.Const.eq2_qn", "FStar.Reflection.V2.Formula.Comp", "FStar.Reflection.V2.Formula.Eq", "FStar.Pervasives.Native.Some", "FStar.Reflection.Types.typ", "FStar.Reflection.Const.eq1_qn", "FStar.Reflection.V2.Formula.BoolEq", "FStar.Reflection.Const.lt_qn", "FStar.Reflection.V2.Formula.Lt", "FStar.Reflection.Const.lte_qn", "FStar.Reflection.V2.Formula.Le", "FStar.Reflection.Const.gt_qn", "FStar.Reflection.V2.Formula.Gt", "FStar.Reflection.Const.gte_qn", "FStar.Reflection.V2.Formula.Ge", "FStar.Reflection.V2.Formula.App", "FStar.Pervasives.Native.fst", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.Const.imp_qn", "FStar.Reflection.V2.Formula.Implies", "FStar.Reflection.Const.and_qn", "FStar.Reflection.V2.Formula.And", "FStar.Reflection.Const.iff_qn", "FStar.Reflection.V2.Formula.Iff", "FStar.Reflection.Const.or_qn", "FStar.Reflection.V2.Formula.Or", "FStar.Pervasives.Native.None", "FStar.Reflection.Const.forall_qn", "FStar.Reflection.V2.Formula.mk_Forall", "FStar.Reflection.Const.exists_qn", "FStar.Reflection.V2.Formula.mk_Exists", "FStar.Reflection.Const.not_qn", "FStar.Reflection.V2.Formula.Not", "FStar.Reflection.Const.b2t_qn", "FStar.Reflection.V2.Builtins.term_eq", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.NamedView.named_term_view", "FStar.Pervasives.Native.Mktuple2", "FStar.List.Tot.Base.op_At", "Prims.Cons", "Prims.Nil", "FStar.Tactics.NamedView.inspect", "FStar.Reflection.V2.Derived.un_uinst", "FStar.Reflection.V2.Formula.collect_app", "Prims.int", "FStar.Reflection.V2.Formula.IntLit", "FStar.Tactics.NamedView.simple_binder", "FStar.Reflection.V2.Formula.F_Unknown", "FStar.Pervasives.Native.option", "FStar.Tactics.NamedView.match_returns_ascription", "FStar.Tactics.NamedView.branch", "FStar.Tactics.NamedView.universe", "FStar.Tactics.NamedView.binder", "FStar.Tactics.NamedView.comp", "Prims.nat", "FStar.Reflection.Types.ctx_uvar_and_subst", "FStar.Reflection.V2.Data.vconst", "FStar.Tactics.NamedView.bv", "FStar.Tactics.Effect.raise", "FStar.Tactics.Common.TacticFailure", "FStar.Tactics.NamedView.term_view", "FStar.Reflection.V2.Formula.inspect_unascribe" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Reflection.V2.Formula open FStar.List.Tot.Base open FStar.Reflection.Types open FStar.Reflection.Const open FStar.Reflection.V2.Builtins open FStar.Reflection.V2.Derived open FStar.Reflection.V2.Data open FStar.Tactics.Common open FStar.Tactics.Effect open FStar.Tactics.V2.Builtins open FStar.Tactics.NamedView ///// Helpers (we cannot use the ones in Tactics.V2.Derived, those are for named views ///// private let rec inspect_unascribe (t:term) : Tac term_view = match inspect t with | Tv_AscribedT t _ _ _ | Tv_AscribedC t _ _ _ -> inspect_unascribe t | tv -> tv private let rec collect_app' (args : list argv) (t : term) : Tac (term * list argv) (decreases t) = match inspect_unascribe t with | Tv_App l r -> collect_app' (r::args) l | _ -> (t, args) private let collect_app = collect_app' [] ///// [@@plugin] noeq type comparison = | Eq of option typ (* Propositional equality (eq2), maybe annotated *) | BoolEq of option typ (* Decidable, boolean equality (eq), maybe annotated *) | Lt | Le | Gt | Ge (* Orderings, at type `int` (and subtypes) *) [@@plugin] noeq type formula = | True_ : formula | False_ : formula | Comp : comparison -> term -> term -> formula | And : term -> term -> formula | Or : term -> term -> formula | Not : term -> formula | Implies: term -> term -> formula | Iff : term -> term -> formula | Forall : bv -> typ -> term -> formula | Exists : bv -> typ -> term -> formula | App : term -> term -> formula | Name : namedv -> formula | FV : fv -> formula | IntLit : int -> formula | F_Unknown : formula // Also a baked-in "None" let mk_Forall (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Forall b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) let mk_Exists (typ : term) (pred : term) : Tot formula = let b = pack_bv ({ ppname = as_ppname "x"; sort = seal typ; index = 0; }) in Exists b typ (pack (Tv_App pred (pack (Tv_BVar b), Q_Explicit))) [@@plugin]
false
false
FStar.Reflection.V2.Formula.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val term_as_formula' (t: term) : Tac formula
[]
FStar.Reflection.V2.Formula.term_as_formula'
{ "file_name": "ulib/FStar.Reflection.V2.Formula.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Reflection.V2.Formula.formula
{ "end_col": 38, "end_line": 163, "start_col": 4, "start_line": 87 }
Prims.Tot
val prediction_pre_rel (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (pre: VSig.vale_pre_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_pre_rel_t code args
[ { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args = fun (h0:mem_roots args) -> LSig.(to_low_pre #max_arity #arg_reg pre args h0)
val prediction_pre_rel (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (pre: VSig.vale_pre_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_pre_rel_t code args let prediction_pre_rel (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (pre: VSig.vale_pre_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_pre_rel_t code args =
false
null
false
fun (h0: mem_roots args) -> let open LSig in to_low_pre #max_arity #arg_reg pre args h0
{ "checked_file": "Vale.AsLowStar.Wrapper.fsti.checked", "dependencies": [ "Vale.X64.StateLemmas.fsti.checked", "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.MemoryAdapters.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Lemmas.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Interop.X64.fsti.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Interop.fsti.checked", "Vale.AsLowStar.ValeSig.fst.checked", "Vale.AsLowStar.LowStarSig.fst.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Vale.AsLowStar.Wrapper.fsti" }
[ "total" ]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.AsLowStar.ValeSig.vale_pre_tl", "Prims.Nil", "Vale.Interop.Base.td", "Vale.X64.Decls.va_code", "Vale.Interop.X64.arg_list", "Vale.Interop.Base.mem_roots", "Vale.AsLowStar.LowStarSig.to_low_pre", "Prims.prop", "Vale.Interop.X64.prediction_pre_rel_t" ]
[]
module Vale.AsLowStar.Wrapper open Vale.X64.MemoryAdapters open Vale.Interop.Base module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module ME = Vale.X64.Memory module SI = Vale.X64.Stack_i module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module I = Vale.Interop module V = Vale.X64.Decls module VS = Vale.X64.State module IX64 = Vale.Interop.X64 module VSig = Vale.AsLowStar.ValeSig module LSig = Vale.AsLowStar.LowStarSig module SL = Vale.X64.StateLemmas module VL = Vale.X64.Lemmas module ST = FStar.HyperStack.ST open FStar.Mul open FStar.Calc [@__reduce__] let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args
false
false
Vale.AsLowStar.Wrapper.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val prediction_pre_rel (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (pre: VSig.vale_pre_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_pre_rel_t code args
[]
Vale.AsLowStar.Wrapper.prediction_pre_rel
{ "file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Wrapper.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pre: Vale.AsLowStar.ValeSig.vale_pre_tl [] -> code: Vale.X64.Decls.va_code -> args: Vale.Interop.X64.arg_list -> Vale.Interop.X64.prediction_pre_rel_t code args
{ "end_col": 53, "end_line": 35, "start_col": 2, "start_line": 34 }
Prims.Tot
val prediction_post_rel (#max_arity: nat) (post: VSig.vale_post_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_post_rel_t code args
[ { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let prediction_post_rel (#max_arity:nat) (post:VSig.vale_post_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_post_rel_t code args = fun (h0:mem_roots args) (_s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) (s1:BS.machine_state) -> let rax, fuel, mem = rax_fuel_mem in exists h1. h1 == hs_of_mem mem /\ mem_roots_p h1 args /\ LSig.(to_low_post post args h0 rax h1)
val prediction_post_rel (#max_arity: nat) (post: VSig.vale_post_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_post_rel_t code args let prediction_post_rel (#max_arity: nat) (post: VSig.vale_post_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_post_rel_t code args =
false
null
false
fun (h0: mem_roots args) (_s0: BS.machine_state) (rax_fuel_mem: (UInt64.t & nat & interop_heap)) (s1: BS.machine_state) -> let rax, fuel, mem = rax_fuel_mem in exists h1. h1 == hs_of_mem mem /\ mem_roots_p h1 args /\ LSig.(to_low_post post args h0 rax h1)
{ "checked_file": "Vale.AsLowStar.Wrapper.fsti.checked", "dependencies": [ "Vale.X64.StateLemmas.fsti.checked", "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.MemoryAdapters.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Lemmas.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Interop.X64.fsti.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Interop.fsti.checked", "Vale.AsLowStar.ValeSig.fst.checked", "Vale.AsLowStar.LowStarSig.fst.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Vale.AsLowStar.Wrapper.fsti" }
[ "total" ]
[ "Prims.nat", "Vale.AsLowStar.ValeSig.vale_post_tl", "Prims.Nil", "Vale.Interop.Base.td", "Vale.X64.Decls.va_code", "Vale.Interop.X64.arg_list", "Vale.Interop.Base.mem_roots", "Vale.X64.Machine_Semantics_s.machine_state", "FStar.Pervasives.Native.tuple3", "FStar.UInt64.t", "Vale.Interop.Heap_s.interop_heap", "Prims.l_Exists", "FStar.Monotonic.HyperStack.mem", "Vale.Interop.Base.mem_roots_p", "Prims.l_and", "Prims.eq2", "Vale.Interop.Heap_s.hs_of_mem", "Vale.AsLowStar.LowStarSig.to_low_post", "Prims.prop", "Vale.Interop.X64.prediction_post_rel_t" ]
[]
module Vale.AsLowStar.Wrapper open Vale.X64.MemoryAdapters open Vale.Interop.Base module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module ME = Vale.X64.Memory module SI = Vale.X64.Stack_i module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module I = Vale.Interop module V = Vale.X64.Decls module VS = Vale.X64.State module IX64 = Vale.Interop.X64 module VSig = Vale.AsLowStar.ValeSig module LSig = Vale.AsLowStar.LowStarSig module SL = Vale.X64.StateLemmas module VL = Vale.X64.Lemmas module ST = FStar.HyperStack.ST open FStar.Mul open FStar.Calc [@__reduce__] let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args = fun (h0:mem_roots args) -> LSig.(to_low_pre #max_arity #arg_reg pre args h0) [@__reduce__] let prediction_post_rel (#max_arity:nat) (post:VSig.vale_post_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_post_rel_t code args
false
false
Vale.AsLowStar.Wrapper.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val prediction_post_rel (#max_arity: nat) (post: VSig.vale_post_tl []) (code: V.va_code) (args: IX64.arg_list) : IX64.prediction_post_rel_t code args
[]
Vale.AsLowStar.Wrapper.prediction_post_rel
{ "file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Wrapper.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
post: Vale.AsLowStar.ValeSig.vale_post_tl [] -> code: Vale.X64.Decls.va_code -> args: Vale.Interop.X64.arg_list -> Vale.Interop.X64.prediction_post_rel_t code args
{ "end_col": 42, "end_line": 54, "start_col": 2, "start_line": 45 }
Prims.Tot
val post_rel_generic (#max_arity: nat) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (post: VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code))
[ { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec post_rel_generic (#max_arity:nat) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (post:VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code)) = match dom with | [] -> prediction_post_rel #max_arity post (coerce code) args | hd::tl -> fun (x:td_as_type hd) -> post_rel_generic #max_arity code tl IX64.(x ++ args) (elim_1 post x)
val post_rel_generic (#max_arity: nat) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (post: VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code)) let rec post_rel_generic (#max_arity: nat) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (post: VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code)) =
false
null
false
match dom with | [] -> prediction_post_rel #max_arity post (coerce code) args | hd :: tl -> fun (x: td_as_type hd) -> post_rel_generic #max_arity code tl IX64.(x ++ args) (elim_1 post x)
{ "checked_file": "Vale.AsLowStar.Wrapper.fsti.checked", "dependencies": [ "Vale.X64.StateLemmas.fsti.checked", "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.MemoryAdapters.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Lemmas.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Interop.X64.fsti.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Interop.fsti.checked", "Vale.AsLowStar.ValeSig.fst.checked", "Vale.AsLowStar.LowStarSig.fst.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Vale.AsLowStar.Wrapper.fsti" }
[ "total" ]
[ "Prims.nat", "Vale.X64.Decls.va_code", "Prims.list", "Vale.Interop.Base.td", "Vale.Interop.Base.arg", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.List.Tot.Base.length", "Vale.AsLowStar.ValeSig.vale_post_tl", "Vale.AsLowStar.Wrapper.prediction_post_rel", "Vale.Interop.Base.coerce", "Vale.Interop.Base.td_as_type", "Vale.AsLowStar.Wrapper.post_rel_generic", "Vale.Interop.X64.op_Plus_Plus", "Vale.Interop.Base.elim_1", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_fuel", "Prims.prop", "Vale.Interop.X64.rel_gen_t", "Vale.Interop.X64.prediction_post_rel_t", "Vale.X64.Machine_Semantics_s.code" ]
[]
module Vale.AsLowStar.Wrapper open Vale.X64.MemoryAdapters open Vale.Interop.Base module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module ME = Vale.X64.Memory module SI = Vale.X64.Stack_i module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module I = Vale.Interop module V = Vale.X64.Decls module VS = Vale.X64.State module IX64 = Vale.Interop.X64 module VSig = Vale.AsLowStar.ValeSig module LSig = Vale.AsLowStar.LowStarSig module SL = Vale.X64.StateLemmas module VL = Vale.X64.Lemmas module ST = FStar.HyperStack.ST open FStar.Mul open FStar.Calc [@__reduce__] let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args = fun (h0:mem_roots args) -> LSig.(to_low_pre #max_arity #arg_reg pre args h0) [@__reduce__] let prediction_post_rel (#max_arity:nat) (post:VSig.vale_post_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_post_rel_t code args = fun (h0:mem_roots args) (_s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) (s1:BS.machine_state) -> let rax, fuel, mem = rax_fuel_mem in exists h1. h1 == hs_of_mem mem /\ mem_roots_p h1 args /\ LSig.(to_low_post post args h0 rax h1) val vale_lemma_as_prediction (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (code:V.va_code) (args:IX64.arg_list) (pre:VSig.vale_pre_tl []) (post:VSig.vale_post_tl []) (v:VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction max_arity arg_reg regs_modified xmms_modified (coerce code) args (prediction_pre_rel #max_arity #arg_reg pre (coerce code) args) (prediction_post_rel #max_arity post (coerce code) args) // //////////////////////////////////////////////////////////////////////////////// // //Wrap abstract // //////////////////////////////////////////////////////////////////////////////// [@__reduce__] let rec pre_rel_generic (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (pre:VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code)) = match dom with | [] -> prediction_pre_rel #max_arity #arg_reg pre (coerce code) args | hd::tl -> fun (x:td_as_type hd) -> pre_rel_generic #max_arity #arg_reg code tl IX64.(x ++ args) (elim_1 pre x) [@__reduce__] let rec post_rel_generic (#max_arity:nat) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (post:VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code))
false
false
Vale.AsLowStar.Wrapper.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val post_rel_generic (#max_arity: nat) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (post: VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code))
[ "recursion" ]
Vale.AsLowStar.Wrapper.post_rel_generic
{ "file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Wrapper.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
code: Vale.X64.Decls.va_code -> dom: Prims.list Vale.Interop.Base.td -> args: Prims.list Vale.Interop.Base.arg {FStar.List.Tot.Base.length dom + FStar.List.Tot.Base.length args <= 20} -> post: Vale.AsLowStar.ValeSig.vale_post_tl dom -> Vale.Interop.X64.rel_gen_t code dom args (Vale.Interop.X64.prediction_post_rel_t (Vale.Interop.Base.coerce code))
{ "end_col": 72, "end_line": 110, "start_col": 2, "start_line": 105 }
Prims.Tot
val pre_rel_generic (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (pre: VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code))
[ { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec pre_rel_generic (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (pre:VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code)) = match dom with | [] -> prediction_pre_rel #max_arity #arg_reg pre (coerce code) args | hd::tl -> fun (x:td_as_type hd) -> pre_rel_generic #max_arity #arg_reg code tl IX64.(x ++ args) (elim_1 pre x)
val pre_rel_generic (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (pre: VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code)) let rec pre_rel_generic (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (pre: VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code)) =
false
null
false
match dom with | [] -> prediction_pre_rel #max_arity #arg_reg pre (coerce code) args | hd :: tl -> fun (x: td_as_type hd) -> pre_rel_generic #max_arity #arg_reg code tl IX64.(x ++ args) (elim_1 pre x)
{ "checked_file": "Vale.AsLowStar.Wrapper.fsti.checked", "dependencies": [ "Vale.X64.StateLemmas.fsti.checked", "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.MemoryAdapters.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Lemmas.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Interop.X64.fsti.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Interop.fsti.checked", "Vale.AsLowStar.ValeSig.fst.checked", "Vale.AsLowStar.LowStarSig.fst.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Vale.AsLowStar.Wrapper.fsti" }
[ "total" ]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.X64.Decls.va_code", "Prims.list", "Vale.Interop.Base.td", "Vale.Interop.Base.arg", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.List.Tot.Base.length", "Vale.AsLowStar.ValeSig.vale_pre_tl", "Vale.AsLowStar.Wrapper.prediction_pre_rel", "Vale.Interop.Base.coerce", "Vale.Interop.Base.td_as_type", "Vale.AsLowStar.Wrapper.pre_rel_generic", "Vale.Interop.X64.op_Plus_Plus", "Vale.Interop.Base.elim_1", "Vale.X64.Decls.va_state", "Prims.prop", "Vale.Interop.X64.rel_gen_t", "Vale.Interop.X64.prediction_pre_rel_t", "Vale.X64.Machine_Semantics_s.code" ]
[]
module Vale.AsLowStar.Wrapper open Vale.X64.MemoryAdapters open Vale.Interop.Base module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module ME = Vale.X64.Memory module SI = Vale.X64.Stack_i module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module I = Vale.Interop module V = Vale.X64.Decls module VS = Vale.X64.State module IX64 = Vale.Interop.X64 module VSig = Vale.AsLowStar.ValeSig module LSig = Vale.AsLowStar.LowStarSig module SL = Vale.X64.StateLemmas module VL = Vale.X64.Lemmas module ST = FStar.HyperStack.ST open FStar.Mul open FStar.Calc [@__reduce__] let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args = fun (h0:mem_roots args) -> LSig.(to_low_pre #max_arity #arg_reg pre args h0) [@__reduce__] let prediction_post_rel (#max_arity:nat) (post:VSig.vale_post_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_post_rel_t code args = fun (h0:mem_roots args) (_s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) (s1:BS.machine_state) -> let rax, fuel, mem = rax_fuel_mem in exists h1. h1 == hs_of_mem mem /\ mem_roots_p h1 args /\ LSig.(to_low_post post args h0 rax h1) val vale_lemma_as_prediction (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (code:V.va_code) (args:IX64.arg_list) (pre:VSig.vale_pre_tl []) (post:VSig.vale_post_tl []) (v:VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction max_arity arg_reg regs_modified xmms_modified (coerce code) args (prediction_pre_rel #max_arity #arg_reg pre (coerce code) args) (prediction_post_rel #max_arity post (coerce code) args) // //////////////////////////////////////////////////////////////////////////////// // //Wrap abstract // //////////////////////////////////////////////////////////////////////////////// [@__reduce__] let rec pre_rel_generic (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (pre:VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code))
false
false
Vale.AsLowStar.Wrapper.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val pre_rel_generic (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (pre: VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code))
[ "recursion" ]
Vale.AsLowStar.Wrapper.pre_rel_generic
{ "file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Wrapper.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
code: Vale.X64.Decls.va_code -> dom: Prims.list Vale.Interop.Base.td -> args: Prims.list Vale.Interop.Base.arg {FStar.List.Tot.Base.length dom + FStar.List.Tot.Base.length args <= 20} -> pre: Vale.AsLowStar.ValeSig.vale_pre_tl dom -> Vale.Interop.X64.rel_gen_t code dom args (Vale.Interop.X64.prediction_pre_rel_t (Vale.Interop.Base.coerce code))
{ "end_col": 79, "end_line": 94, "start_col": 2, "start_line": 89 }
Prims.Tot
val mk_prediction (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (#regs_modified: (MS.reg_64 -> bool)) (#xmms_modified: (MS.reg_xmm -> bool)) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (#pre: VSig.vale_pre_tl dom) (#post: VSig.vale_post_tl dom) (v: VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post)
[ { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Calc", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "Vale.X64.Lemmas", "short_module": "VL" }, { "abbrev": true, "full_module": "Vale.X64.StateLemmas", "short_module": "SL" }, { "abbrev": true, "full_module": "Vale.AsLowStar.LowStarSig", "short_module": "LSig" }, { "abbrev": true, "full_module": "Vale.AsLowStar.ValeSig", "short_module": "VSig" }, { "abbrev": true, "full_module": "Vale.Interop.X64", "short_module": "IX64" }, { "abbrev": true, "full_module": "Vale.X64.State", "short_module": "VS" }, { "abbrev": true, "full_module": "Vale.X64.Decls", "short_module": "V" }, { "abbrev": true, "full_module": "Vale.Interop", "short_module": "I" }, { "abbrev": true, "full_module": "Vale.Interop.Assumptions", "short_module": "IA" }, { "abbrev": true, "full_module": "Vale.X64.Machine_s", "short_module": "MS" }, { "abbrev": true, "full_module": "Vale.X64.Stack_i", "short_module": "SI" }, { "abbrev": true, "full_module": "Vale.X64.Memory", "short_module": "ME" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "LowStar.BufferView.Down", "short_module": "DV" }, { "abbrev": true, "full_module": "LowStar.BufferView.Up", "short_module": "UV" }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "Vale.Interop.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.MemoryAdapters", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "Vale.AsLowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec mk_prediction (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (#pre:VSig.vale_pre_tl dom) (#post:VSig.vale_post_tl dom) (v:VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post) = let open IX64 in match dom with | [] -> vale_lemma_as_prediction #max_arity #arg_reg _ _ _ _ v | hd::tl -> fun (x:td_as_type hd) -> mk_prediction #max_arity #arg_reg code tl (x ++ args) #(elim_1 pre x) #(elim_1 post x) (VSig.elim_vale_sig_cons hd tl args pre post v x)
val mk_prediction (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (#regs_modified: (MS.reg_64 -> bool)) (#xmms_modified: (MS.reg_xmm -> bool)) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (#pre: VSig.vale_pre_tl dom) (#post: VSig.vale_post_tl dom) (v: VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post) let rec mk_prediction (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (#regs_modified: (MS.reg_64 -> bool)) (#xmms_modified: (MS.reg_xmm -> bool)) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (#pre: VSig.vale_pre_tl dom) (#post: VSig.vale_post_tl dom) (v: VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post) =
false
null
false
let open IX64 in match dom with | [] -> vale_lemma_as_prediction #max_arity #arg_reg _ _ _ _ v | hd :: tl -> fun (x: td_as_type hd) -> mk_prediction #max_arity #arg_reg code tl (x ++ args) #(elim_1 pre x) #(elim_1 post x) (VSig.elim_vale_sig_cons hd tl args pre post v x)
{ "checked_file": "Vale.AsLowStar.Wrapper.fsti.checked", "dependencies": [ "Vale.X64.StateLemmas.fsti.checked", "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.MemoryAdapters.fsti.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.Lemmas.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Interop.X64.fsti.checked", "Vale.Interop.Base.fst.checked", "Vale.Interop.Assumptions.fst.checked", "Vale.Interop.fsti.checked", "Vale.AsLowStar.ValeSig.fst.checked", "Vale.AsLowStar.LowStarSig.fst.checked", "prims.fst.checked", "LowStar.BufferView.Up.fsti.checked", "LowStar.BufferView.Down.fsti.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Vale.AsLowStar.Wrapper.fsti" }
[ "total" ]
[ "Prims.nat", "Vale.Interop.X64.arg_reg_relation", "Vale.X64.Machine_s.reg_64", "Prims.bool", "Vale.X64.Machine_s.reg_xmm", "Vale.X64.Decls.va_code", "Prims.list", "Vale.Interop.Base.td", "Vale.Interop.Base.arg", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.List.Tot.Base.length", "Vale.AsLowStar.ValeSig.vale_pre_tl", "Vale.AsLowStar.ValeSig.vale_post_tl", "Vale.AsLowStar.ValeSig.vale_sig_tl", "Vale.Interop.Base.coerce", "Vale.AsLowStar.Wrapper.vale_lemma_as_prediction", "Vale.Interop.Base.td_as_type", "Vale.AsLowStar.Wrapper.mk_prediction", "Vale.Interop.X64.op_Plus_Plus", "Vale.Interop.Base.elim_1", "Vale.X64.Decls.va_state", "Prims.prop", "Vale.X64.Decls.va_fuel", "Vale.AsLowStar.ValeSig.elim_vale_sig_cons", "Vale.Interop.X64.prediction_t", "Vale.X64.Machine_Semantics_s.code", "Vale.AsLowStar.Wrapper.pre_rel_generic", "Vale.AsLowStar.Wrapper.post_rel_generic" ]
[]
module Vale.AsLowStar.Wrapper open Vale.X64.MemoryAdapters open Vale.Interop.Base module B = LowStar.Buffer module BS = Vale.X64.Machine_Semantics_s module UV = LowStar.BufferView.Up module DV = LowStar.BufferView.Down module HS = FStar.HyperStack module ME = Vale.X64.Memory module SI = Vale.X64.Stack_i module MS = Vale.X64.Machine_s module IA = Vale.Interop.Assumptions module I = Vale.Interop module V = Vale.X64.Decls module VS = Vale.X64.State module IX64 = Vale.Interop.X64 module VSig = Vale.AsLowStar.ValeSig module LSig = Vale.AsLowStar.LowStarSig module SL = Vale.X64.StateLemmas module VL = Vale.X64.Lemmas module ST = FStar.HyperStack.ST open FStar.Mul open FStar.Calc [@__reduce__] let prediction_pre_rel (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (pre:VSig.vale_pre_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_pre_rel_t code args = fun (h0:mem_roots args) -> LSig.(to_low_pre #max_arity #arg_reg pre args h0) [@__reduce__] let prediction_post_rel (#max_arity:nat) (post:VSig.vale_post_tl []) (code:V.va_code) (args:IX64.arg_list) : IX64.prediction_post_rel_t code args = fun (h0:mem_roots args) (_s0:BS.machine_state) (rax_fuel_mem:(UInt64.t & nat & interop_heap)) (s1:BS.machine_state) -> let rax, fuel, mem = rax_fuel_mem in exists h1. h1 == hs_of_mem mem /\ mem_roots_p h1 args /\ LSig.(to_low_post post args h0 rax h1) val vale_lemma_as_prediction (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (code:V.va_code) (args:IX64.arg_list) (pre:VSig.vale_pre_tl []) (post:VSig.vale_post_tl []) (v:VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction max_arity arg_reg regs_modified xmms_modified (coerce code) args (prediction_pre_rel #max_arity #arg_reg pre (coerce code) args) (prediction_post_rel #max_arity post (coerce code) args) // //////////////////////////////////////////////////////////////////////////////// // //Wrap abstract // //////////////////////////////////////////////////////////////////////////////// [@__reduce__] let rec pre_rel_generic (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (pre:VSig.vale_pre_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_pre_rel_t (coerce code)) = match dom with | [] -> prediction_pre_rel #max_arity #arg_reg pre (coerce code) args | hd::tl -> fun (x:td_as_type hd) -> pre_rel_generic #max_arity #arg_reg code tl IX64.(x ++ args) (elim_1 pre x) [@__reduce__] let rec post_rel_generic (#max_arity:nat) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (post:VSig.vale_post_tl dom) : IX64.rel_gen_t code dom args (IX64.prediction_post_rel_t (coerce code)) = match dom with | [] -> prediction_post_rel #max_arity post (coerce code) args | hd::tl -> fun (x:td_as_type hd) -> post_rel_generic #max_arity code tl IX64.(x ++ args) (elim_1 post x) let rec mk_prediction (#max_arity:nat) (#arg_reg:IX64.arg_reg_relation max_arity) (#regs_modified:MS.reg_64 -> bool) (#xmms_modified:MS.reg_xmm -> bool) (code:V.va_code) (dom:list td) (args:list arg{List.length dom + List.length args <= 20}) (#pre:VSig.vale_pre_tl dom) (#post:VSig.vale_post_tl dom) (v:VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post)
false
false
Vale.AsLowStar.Wrapper.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val mk_prediction (#max_arity: nat) (#arg_reg: IX64.arg_reg_relation max_arity) (#regs_modified: (MS.reg_64 -> bool)) (#xmms_modified: (MS.reg_xmm -> bool)) (code: V.va_code) (dom: list td) (args: list arg {List.length dom + List.length args <= 20}) (#pre: VSig.vale_pre_tl dom) (#post: VSig.vale_post_tl dom) (v: VSig.vale_sig_tl regs_modified xmms_modified args (coerce code) pre post) : IX64.prediction_t max_arity arg_reg regs_modified xmms_modified (coerce code) dom args (pre_rel_generic #max_arity #arg_reg code dom args pre) (post_rel_generic #max_arity code dom args post)
[ "recursion" ]
Vale.AsLowStar.Wrapper.mk_prediction
{ "file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Wrapper.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
code: Vale.X64.Decls.va_code -> dom: Prims.list Vale.Interop.Base.td -> args: Prims.list Vale.Interop.Base.arg {FStar.List.Tot.Base.length dom + FStar.List.Tot.Base.length args <= 20} -> v: Vale.AsLowStar.ValeSig.vale_sig_tl regs_modified xmms_modified args (Vale.Interop.Base.coerce code) pre post -> Vale.Interop.X64.prediction_t max_arity arg_reg regs_modified xmms_modified (Vale.Interop.Base.coerce code) dom args (Vale.AsLowStar.Wrapper.pre_rel_generic code dom args pre) (Vale.AsLowStar.Wrapper.post_rel_generic code dom args post)
{ "end_col": 55, "end_line": 148, "start_col": 2, "start_line": 134 }
FStar.HyperStack.ST.Stack
val chacha20_decrypt: len:size_t -> out:lbuffer uint8 len -> cipher:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))
[ { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let chacha20_decrypt len out cipher key n ctr = Hacl.Impl.Chacha20.chacha20_decrypt len out cipher key n ctr
val chacha20_decrypt: len:size_t -> out:lbuffer uint8 len -> cipher:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)) let chacha20_decrypt len out cipher key n ctr =
true
null
false
Hacl.Impl.Chacha20.chacha20_decrypt len out cipher key n ctr
{ "checked_file": "Hacl.Chacha20.fst.checked", "dependencies": [ "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Chacha20.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Chacha20.fst" }
[]
[ "Lib.IntTypes.size_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Chacha20.chacha20_decrypt", "Prims.unit" ]
[]
module Hacl.Chacha20 open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer val chacha20_encrypt: len:size_t -> out:lbuffer uint8 len -> text:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)) let chacha20_encrypt len out text key n ctr = Hacl.Impl.Chacha20.chacha20_encrypt len out text key n ctr val chacha20_decrypt: len:size_t -> out:lbuffer uint8 len -> cipher:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))
false
false
Hacl.Chacha20.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val chacha20_decrypt: len:size_t -> out:lbuffer uint8 len -> cipher:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))
[]
Hacl.Chacha20.chacha20_decrypt
{ "file_name": "code/chacha20/Hacl.Chacha20.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Lib.IntTypes.size_t -> out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> cipher: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul -> ctr: Lib.IntTypes.size_t -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 62, "end_line": 40, "start_col": 2, "start_line": 40 }
FStar.HyperStack.ST.Stack
val chacha20_encrypt: len:size_t -> out:lbuffer uint8 len -> text:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
[ { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let chacha20_encrypt len out text key n ctr = Hacl.Impl.Chacha20.chacha20_encrypt len out text key n ctr
val chacha20_encrypt: len:size_t -> out:lbuffer uint8 len -> text:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)) let chacha20_encrypt len out text key n ctr =
true
null
false
Hacl.Impl.Chacha20.chacha20_encrypt len out text key n ctr
{ "checked_file": "Hacl.Chacha20.fst.checked", "dependencies": [ "Spec.Chacha20.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Chacha20.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Chacha20.fst" }
[]
[ "Lib.IntTypes.size_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Chacha20.chacha20_encrypt", "Prims.unit" ]
[]
module Hacl.Chacha20 open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer val chacha20_encrypt: len:size_t -> out:lbuffer uint8 len -> text:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
false
false
Hacl.Chacha20.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val chacha20_encrypt: len:size_t -> out:lbuffer uint8 len -> text:lbuffer uint8 len -> key:lbuffer uint8 32ul -> n:lbuffer uint8 12ul -> ctr:size_t -> Stack unit (requires fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out) (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\ as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
[]
Hacl.Chacha20.chacha20_encrypt
{ "file_name": "code/chacha20/Hacl.Chacha20.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Lib.IntTypes.size_t -> out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul -> ctr: Lib.IntTypes.size_t -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 60, "end_line": 23, "start_col": 2, "start_line": 23 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false
let is_valid_kem =
false
null
false
function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _, _ -> false
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "FStar.Pervasives.Native.tuple2", "Spec.Agile.DH.algorithm", "Spec.Hash.Definitions.hash_alg", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_valid_kem : _: (Spec.Agile.DH.algorithm * Spec.Hash.Definitions.hash_alg) -> Prims.bool
[]
Spec.Agile.HPKE.is_valid_kem
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: (Spec.Agile.DH.algorithm * Spec.Hash.Definitions.hash_alg) -> Prims.bool
{ "end_col": 16, "end_line": 25, "start_col": 19, "start_line": 22 }
Prims.Tot
val kem_dh_of_cs (cs: ciphersuite) : DH.algorithm
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c
val kem_dh_of_cs (cs: ciphersuite) : DH.algorithm let kem_dh_of_cs (cs: ciphersuite) : DH.algorithm =
false
null
false
let c, _, _, _ = cs in c
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs}
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val kem_dh_of_cs (cs: ciphersuite) : DH.algorithm
[]
Spec.Agile.HPKE.kem_dh_of_cs
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Spec.Agile.DH.algorithm
{ "end_col": 25, "end_line": 54, "start_col": 50, "start_line": 53 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_length_dkp_ikm (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_kem size_label_dkp_prk
let max_length_dkp_ikm (a: hash_algorithm) =
false
null
false
labeled_extract_max_length_ikm a size_suite_id_kem size_label_dkp_prk
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.labeled_extract_max_length_ikm", "Spec.Agile.HPKE.size_suite_id_kem", "Spec.Agile.HPKE.size_label_dkp_prk", "FStar.Pervasives.Native.option", "Prims.int" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a) let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret let max_length_psk_id (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash let max_length_info (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_info_hash
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_length_dkp_ikm : a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.max_length_dkp_ikm
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 113, "end_line": 339, "start_col": 44, "start_line": 339 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_length_info (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_info_hash
let max_length_info (a: hash_algorithm) =
false
null
false
labeled_extract_max_length_ikm a size_suite_id_hpke size_label_info_hash
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.labeled_extract_max_length_ikm", "Spec.Agile.HPKE.size_suite_id_hpke", "Spec.Agile.HPKE.size_label_info_hash", "FStar.Pervasives.Native.option", "Prims.int" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a) let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_length_info : a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.max_length_info
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 113, "end_line": 337, "start_col": 41, "start_line": 337 }
Prims.Tot
val pow2_61_1:_: unit{pow2 61 - 1 == 2305843009213693951}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951)
val pow2_61_1:_: unit{pow2 61 - 1 == 2305843009213693951} let pow2_61_1:_: unit{pow2 61 - 1 == 2305843009213693951} =
false
null
false
assert_norm (pow2 61 - 1 == 2305843009213693951)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.op_Subtraction", "Prims.pow2" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length)
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val pow2_61_1:_: unit{pow2 61 - 1 == 2305843009213693951}
[]
Spec.Agile.HPKE.pow2_61_1
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Prims.unit{Prims.pow2 61 - 1 == 2305843009213693951}
{ "end_col": 108, "end_line": 322, "start_col": 61, "start_line": 322 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let hash_algorithm = a:Hash.hash_alg{is_valid_hash a}
let hash_algorithm =
false
null
false
a: Hash.hash_alg{is_valid_hash a}
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Agile.HPKE.is_valid_hash" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val hash_algorithm : Type0
[]
Spec.Agile.HPKE.hash_algorithm
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 53, "end_line": 44, "start_col": 21, "start_line": 44 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs}
let ciphersuite_not_export_only =
false
null
false
cs: ciphersuite{is_valid_not_export_only_ciphersuite cs}
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Prims.b2t", "Spec.Agile.HPKE.is_valid_not_export_only_ciphersuite" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val ciphersuite_not_export_only : Type0
[]
Spec.Agile.HPKE.ciphersuite_not_export_only
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 89, "end_line": 73, "start_col": 34, "start_line": 73 }
Prims.Tot
val pow2_125_1:_: unit{pow2 125 - 1 == 42535295865117307932921825928971026431}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431)
val pow2_125_1:_: unit{pow2 125 - 1 == 42535295865117307932921825928971026431} let pow2_125_1:_: unit{pow2 125 - 1 == 42535295865117307932921825928971026431} =
false
null
false
assert_norm (pow2 125 - 1 == 42535295865117307932921825928971026431)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.op_Subtraction", "Prims.pow2" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length)
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val pow2_125_1:_: unit{pow2 125 - 1 == 42535295865117307932921825928971026431}
[]
Spec.Agile.HPKE.pow2_125_1
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Prims.unit{Prims.pow2 125 - 1 == 42535295865117307932921825928971026431}
{ "end_col": 149, "end_line": 323, "start_col": 82, "start_line": 323 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs}
let ciphersuite =
false
null
false
cs: (DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs}
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "FStar.Pervasives.Native.tuple4", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Agile.HPKE.is_valid_ciphersuite" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val ciphersuite : Type0
[]
Spec.Agile.HPKE.ciphersuite
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 100, "end_line": 50, "start_col": 18, "start_line": 50 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_length_psk_id (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash
let max_length_psk_id (a: hash_algorithm) =
false
null
false
labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.labeled_extract_max_length_ikm", "Spec.Agile.HPKE.size_suite_id_hpke", "Spec.Agile.HPKE.size_label_psk_id_hash", "FStar.Pervasives.Native.option", "Prims.int" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_length_psk_id : a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.max_length_psk_id
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 117, "end_line": 336, "start_col": 43, "start_line": 336 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret
let max_length_psk (a: hash_algorithm) =
false
null
false
labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.labeled_extract_max_length_ikm", "Spec.Agile.HPKE.size_suite_id_hpke", "Spec.Agile.HPKE.size_label_secret", "FStar.Pervasives.Native.option", "Prims.int" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_length_psk : a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.max_length_psk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 109, "end_line": 335, "start_col": 40, "start_line": 335 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false
let is_valid_aead =
false
null
false
function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.aead", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_valid_aead : _: Spec.Agile.HPKE.aead -> Prims.bool
[]
Spec.Agile.HPKE.is_valid_aead
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Agile.HPKE.aead -> Prims.bool
{ "end_col": 14, "end_line": 36, "start_col": 20, "start_line": 31 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false
let is_valid_hash =
false
null
false
function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Hash.Definitions.hash_alg", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_valid_hash : _: Spec.Hash.Definitions.hash_alg -> Prims.bool
[]
Spec.Agile.HPKE.is_valid_hash
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.hash_alg -> Prims.bool
{ "end_col": 14, "end_line": 42, "start_col": 20, "start_line": 38 }
Prims.Tot
val is_valid_ciphersuite (cs: DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash)
val is_valid_ciphersuite (cs: DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool let is_valid_ciphersuite (cs: DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool =
false
null
false
let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "FStar.Pervasives.Native.tuple4", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg", "Prims.op_AmpAmp", "Spec.Agile.HPKE.is_valid_kem", "FStar.Pervasives.Native.Mktuple2", "Spec.Agile.HPKE.is_valid_aead", "Spec.Agile.HPKE.is_valid_hash", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a}
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_valid_ciphersuite (cs: DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool
[]
Spec.Agile.HPKE.is_valid_ciphersuite
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: (((Spec.Agile.DH.algorithm * Spec.Agile.HPKE.hash_algorithm) * Spec.Agile.HPKE.aead) * Spec.Hash.Definitions.hash_alg) -> Prims.bool
{ "end_col": 83, "end_line": 48, "start_col": 91, "start_line": 46 }
Prims.Tot
val kem_hash_of_cs (cs: ciphersuite) : hash_algorithm
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h
val kem_hash_of_cs (cs: ciphersuite) : hash_algorithm let kem_hash_of_cs (cs: ciphersuite) : hash_algorithm =
false
null
false
let _, h, _, _ = cs in h
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val kem_hash_of_cs (cs: ciphersuite) : hash_algorithm
[]
Spec.Agile.HPKE.kem_hash_of_cs
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Spec.Agile.HPKE.hash_algorithm
{ "end_col": 25, "end_line": 58, "start_col": 54, "start_line": 57 }
Prims.Tot
val aead_of_cs (cs: ciphersuite) : aead
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a
val aead_of_cs (cs: ciphersuite) : aead let aead_of_cs (cs: ciphersuite) : aead =
false
null
false
let _, _, a, _ = cs in a
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val aead_of_cs (cs: ciphersuite) : aead
[]
Spec.Agile.HPKE.aead_of_cs
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Spec.Agile.HPKE.aead
{ "end_col": 25, "end_line": 62, "start_col": 40, "start_line": 61 }
Prims.Tot
val hash_of_cs (cs: ciphersuite) : hash_algorithm
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h
val hash_of_cs (cs: ciphersuite) : hash_algorithm let hash_of_cs (cs: ciphersuite) : hash_algorithm =
false
null
false
let _, _, _, h = cs in h
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.DH.algorithm", "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.aead", "Spec.Hash.Definitions.hash_alg" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val hash_of_cs (cs: ciphersuite) : hash_algorithm
[]
Spec.Agile.HPKE.hash_of_cs
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Spec.Agile.HPKE.hash_algorithm
{ "end_col": 25, "end_line": 66, "start_col": 50, "start_line": 65 }
Prims.Tot
val label_KEM:lbytes size_label_KEM
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_KEM : lbytes size_label_KEM = createL label_KEM_list
val label_KEM:lbytes size_label_KEM let label_KEM:lbytes size_label_KEM =
false
null
false
createL label_KEM_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_KEM_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_KEM:lbytes size_label_KEM
[]
Spec.Agile.HPKE.label_KEM
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_KEM
{ "end_col": 62, "end_line": 121, "start_col": 40, "start_line": 121 }
Prims.Tot
val label_eae_prk:lbytes size_label_eae_prk
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list
val label_eae_prk:lbytes size_label_eae_prk let label_eae_prk:lbytes size_label_eae_prk =
false
null
false
createL label_eae_prk_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_eae_prk_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_eae_prk:lbytes size_label_eae_prk
[]
Spec.Agile.HPKE.label_eae_prk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_eae_prk
{ "end_col": 74, "end_line": 110, "start_col": 48, "start_line": 110 }
Prims.Tot
val size_dh_serialized (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256
val size_dh_serialized (cs: ciphersuite) : size_nat let size_dh_serialized (cs: ciphersuite) : size_nat =
false
null
false
match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.HPKE.kem_dh_of_cs", "Spec.Agile.DH.size_public", "Spec.Agile.DH.DH_Curve25519", "Spec.Agile.DH.DH_P256", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_dh_serialized (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_dh_serialized
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 43, "end_line": 289, "start_col": 52, "start_line": 287 }
Prims.Tot
val label_version:lbytes size_label_version
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_version : lbytes size_label_version = createL label_version_list
val label_version:lbytes size_label_version let label_version:lbytes size_label_version =
false
null
false
createL label_version_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_version_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_version:lbytes size_label_version
[]
Spec.Agile.HPKE.label_version
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_version
{ "end_col": 74, "end_line": 99, "start_col": 48, "start_line": 99 }
Prims.Tot
val label_psk_id_hash:lbytes size_label_psk_id_hash
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list
val label_psk_id_hash:lbytes size_label_psk_id_hash let label_psk_id_hash:lbytes size_label_psk_id_hash =
false
null
false
createL label_psk_id_hash_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_psk_id_hash_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_psk_id_hash:lbytes size_label_psk_id_hash
[]
Spec.Agile.HPKE.label_psk_id_hash
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_psk_id_hash
{ "end_col": 86, "end_line": 154, "start_col": 56, "start_line": 154 }
Prims.Tot
val label_key_list:l: list uint8 {List.Tot.length l == size_label_key}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l
val label_key_list:l: list uint8 {List.Tot.length l == size_label_key} let label_key_list:l: list uint8 {List.Tot.length l == size_label_key} =
false
null
false
[@@ inline_let ]let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm (List.Tot.length l == size_label_key); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_key", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_key_list:l: list uint8 {List.Tot.length l == size_label_key}
[]
Spec.Agile.HPKE.label_key_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_key}
{ "end_col": 3, "end_line": 186, "start_col": 2, "start_line": 183 }
Prims.Tot
val label_shared_secret:lbytes size_label_shared_secret
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list
val label_shared_secret:lbytes size_label_shared_secret let label_shared_secret:lbytes size_label_shared_secret =
false
null
false
createL label_shared_secret_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_shared_secret_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_shared_secret:lbytes size_label_shared_secret
[]
Spec.Agile.HPKE.label_shared_secret
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_shared_secret
{ "end_col": 92, "end_line": 143, "start_col": 60, "start_line": 143 }
Prims.Tot
val size_kem_kdf (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs)
val size_kem_kdf (cs: ciphersuite) : size_nat let size_kem_kdf (cs: ciphersuite) : size_nat =
false
null
false
Hash.hash_length (kem_hash_of_cs cs)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Hash.Definitions.hash_length", "Spec.Agile.HPKE.kem_hash_of_cs", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_kem_kdf (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_kem_kdf
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 82, "end_line": 292, "start_col": 46, "start_line": 292 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg
let aead_alg_of (cs: ciphersuite_not_export_only) =
false
null
false
match aead_of_cs cs with | Seal alg -> alg
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite_not_export_only", "Spec.Agile.HPKE.aead_of_cs", "Spec.Agile.AEAD.alg" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs}
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val aead_alg_of : cs: Spec.Agile.HPKE.ciphersuite_not_export_only -> Spec.Agile.AEAD.alg
[]
Spec.Agile.HPKE.aead_alg_of
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite_not_export_only -> Spec.Agile.AEAD.alg
{ "end_col": 19, "end_line": 77, "start_col": 51, "start_line": 76 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length)
let labeled_extract_ikm_length_pred (a: hash_algorithm) (ikm_length: nat) =
false
null
false
HKDF.extract_ikm_length_pred a (size_label_version + ikm_length)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Prims.nat", "Spec.Agile.HKDF.extract_ikm_length_pred", "Prims.op_Addition", "Spec.Agile.HPKE.size_label_version", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val labeled_extract_ikm_length_pred : a: Spec.Agile.HPKE.hash_algorithm -> ikm_length: Prims.nat -> Prims.bool
[]
Spec.Agile.HPKE.labeled_extract_ikm_length_pred
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> ikm_length: Prims.nat -> Prims.bool
{ "end_col": 66, "end_line": 317, "start_col": 2, "start_line": 317 }
Prims.Tot
val label_exp:lbytes size_label_exp
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_exp : lbytes size_label_exp = createL label_exp_list
val label_exp:lbytes size_label_exp let label_exp:lbytes size_label_exp =
false
null
false
createL label_exp_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_exp_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_exp:lbytes size_label_exp
[]
Spec.Agile.HPKE.label_exp
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_exp
{ "end_col": 62, "end_line": 209, "start_col": 40, "start_line": 209 }
Prims.Tot
val size_label_version:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_version: size_nat = 7
val size_label_version:size_nat let size_label_version:size_nat =
false
null
false
7
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_version:size_nat
[]
Spec.Agile.HPKE.size_label_version
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 36, "end_line": 93, "start_col": 35, "start_line": 93 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a)
let labeled_extract_max_length_ikm (a: hash_algorithm) (size_suite_id size_local_label: size_nat) =
false
null
false
match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Lib.IntTypes.size_nat", "FStar.Pervasives.Native.None", "Prims.int", "Spec.Hash.Definitions.hash_alg", "FStar.Pervasives.Native.Some", "Prims.op_Subtraction", "FStar.Pervasives.Native.__proj__Some__item__v", "Prims.pos", "Spec.Hash.Definitions.max_input_length", "Spec.Agile.HPKE.size_label_version", "Spec.Hash.Definitions.block_length", "FStar.Pervasives.Native.option" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val labeled_extract_max_length_ikm : a: Spec.Agile.HPKE.hash_algorithm -> size_suite_id: Lib.IntTypes.size_nat -> size_local_label: Lib.IntTypes.size_nat -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.labeled_extract_max_length_ikm
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> size_suite_id: Lib.IntTypes.size_nat -> size_local_label: Lib.IntTypes.size_nat -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 143, "end_line": 328, "start_col": 2, "start_line": 326 }
Prims.Tot
val size_label_dkp_prk:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_dkp_prk: size_nat = 7
val size_label_dkp_prk:size_nat let size_label_dkp_prk:size_nat =
false
null
false
7
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_dkp_prk:size_nat
[]
Spec.Agile.HPKE.size_label_dkp_prk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 36, "end_line": 225, "start_col": 35, "start_line": 225 }
Prims.Tot
val size_label_eae_prk:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_eae_prk: size_nat = 7
val size_label_eae_prk:size_nat let size_label_eae_prk:size_nat =
false
null
false
7
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_eae_prk:size_nat
[]
Spec.Agile.HPKE.size_label_eae_prk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 36, "end_line": 104, "start_col": 35, "start_line": 104 }
Prims.Tot
val label_KEM_list:l: list uint8 {List.Tot.length l == size_label_KEM}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l
val label_KEM_list:l: list uint8 {List.Tot.length l == size_label_KEM} let label_KEM_list:l: list uint8 {List.Tot.length l == size_label_KEM} =
false
null
false
[@@ inline_let ]let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm (List.Tot.length l == size_label_KEM); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_KEM", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_KEM_list:l: list uint8 {List.Tot.length l == size_label_KEM}
[]
Spec.Agile.HPKE.label_KEM_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_KEM}
{ "end_col": 3, "end_line": 120, "start_col": 2, "start_line": 117 }
Prims.Tot
val size_kem_key (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs)
val size_kem_key (cs: ciphersuite) : size_nat let size_kem_key (cs: ciphersuite) : size_nat =
false
null
false
Hash.hash_length (kem_hash_of_cs cs)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Hash.Definitions.hash_length", "Spec.Agile.HPKE.kem_hash_of_cs", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_kem_key (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_kem_key
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 82, "end_line": 295, "start_col": 46, "start_line": 295 }
Prims.Tot
val label_info_hash_list:l: list uint8 {List.Tot.length l == size_label_info_hash}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l
val label_info_hash_list:l: list uint8 {List.Tot.length l == size_label_info_hash} let label_info_hash_list:l: list uint8 {List.Tot.length l == size_label_info_hash} =
false
null
false
[@@ inline_let ]let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm (List.Tot.length l == size_label_info_hash); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_info_hash", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_info_hash_list:l: list uint8 {List.Tot.length l == size_label_info_hash}
[]
Spec.Agile.HPKE.label_info_hash_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_info_hash}
{ "end_col": 3, "end_line": 164, "start_col": 2, "start_line": 161 }
Prims.Tot
val label_base_nonce_list:l: list uint8 {List.Tot.length l == size_label_base_nonce}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l
val label_base_nonce_list:l: list uint8 {List.Tot.length l == size_label_base_nonce} let label_base_nonce_list:l: list uint8 {List.Tot.length l == size_label_base_nonce} =
false
null
false
[@@ inline_let ]let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm (List.Tot.length l == size_label_base_nonce); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_base_nonce", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_base_nonce_list:l: list uint8 {List.Tot.length l == size_label_base_nonce}
[]
Spec.Agile.HPKE.label_base_nonce_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_base_nonce}
{ "end_col": 3, "end_line": 197, "start_col": 2, "start_line": 194 }
Prims.Tot
val size_aead_key (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs)
val size_aead_key (cs: ciphersuite) : size_nat let size_aead_key (cs: ciphersuite) : size_nat =
false
null
false
match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.HPKE.aead_of_cs", "Spec.Agile.AEAD.alg", "Spec.Agile.AEAD.key_length", "Spec.Agile.HPKE.aead_alg_of", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_aead_key (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_aead_key
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 46, "end_line": 270, "start_col": 2, "start_line": 268 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length)
let labeled_expand_info_length_pred (a: hash_algorithm) (info_length: nat) =
false
null
false
HKDF.expand_info_length_pred a (2 + size_label_version + info_length)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Prims.nat", "Spec.Agile.HKDF.expand_info_length_pred", "Prims.op_Addition", "Spec.Agile.HPKE.size_label_version", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val labeled_expand_info_length_pred : a: Spec.Agile.HPKE.hash_algorithm -> info_length: Prims.nat -> Prims.bool
[]
Spec.Agile.HPKE.labeled_expand_info_length_pred
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> info_length: Prims.nat -> Prims.bool
{ "end_col": 71, "end_line": 320, "start_col": 2, "start_line": 320 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let maybe_lte (n1: int) (n2: option int) = match n2 with | None -> true | Some n2 -> n1 <= n2
let maybe_lte (n1: int) (n2: option int) =
false
null
false
match n2 with | None -> true | Some n2 -> n1 <= n2
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.int", "FStar.Pervasives.Native.option", "Prims.op_LessThanOrEqual", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a) let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret let max_length_psk_id (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash let max_length_info (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_info_hash let max_length_exp_ctx (a:hash_algorithm) = labeled_expand_max_length_info a size_suite_id_hpke size_label_sec let max_length_dkp_ikm (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_kem size_label_dkp_prk /// Types
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val maybe_lte : n1: Prims.int -> n2: FStar.Pervasives.Native.option Prims.int -> Prims.bool
[]
Spec.Agile.HPKE.maybe_lte
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n1: Prims.int -> n2: FStar.Pervasives.Native.option Prims.int -> Prims.bool
{ "end_col": 23, "end_line": 346, "start_col": 2, "start_line": 344 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let exp_len (cs:ciphersuite) = l:size_nat{HKDF.expand_output_length_pred (hash_of_cs cs) l}
let exp_len (cs: ciphersuite) =
false
null
false
l: size_nat{HKDF.expand_output_length_pred (hash_of_cs cs) l}
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Lib.IntTypes.size_nat", "Prims.b2t", "Spec.Agile.HKDF.expand_output_length_pred", "Spec.Agile.HPKE.hash_of_cs" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a) let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret let max_length_psk_id (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash let max_length_info (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_info_hash let max_length_exp_ctx (a:hash_algorithm) = labeled_expand_max_length_info a size_suite_id_hpke size_label_sec let max_length_dkp_ikm (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_kem size_label_dkp_prk /// Types let maybe_lte (n1: int) (n2: option int) = match n2 with | None -> true | Some n2 -> n1 <= n2 type key_dh_public_s (cs:ciphersuite) = lbytes (size_dh_public cs) type key_dh_secret_s (cs:ciphersuite) = lbytes (size_dh_key cs) type key_kem_s (cs:ciphersuite) = lbytes (size_kem_key cs) type key_aead_s (cs:ciphersuite) = lbytes (size_aead_key cs) type nonce_aead_s (cs:ciphersuite) = lbytes (size_aead_nonce cs) type seq_aead_s (cs:ciphersuite) = n:nat{n <= max_seq cs} type exporter_secret_s (cs:ciphersuite) = lbytes (size_kdf cs) type psk_s (cs:ciphersuite) = b:bytes{Seq.length b >= 32 /\ Seq.length b `maybe_lte` (max_length_psk (hash_of_cs cs))} type psk_id_s (cs:ciphersuite) = b:bytes{Seq.length b >= 1 /\ Seq.length b `maybe_lte` (max_length_psk_id (hash_of_cs cs))} type info_s (cs:ciphersuite) = b:bytes{Seq.length b `maybe_lte` (max_length_info (hash_of_cs cs))} type exp_ctx_s (cs:ciphersuite) = b:bytes{Seq.length b `maybe_lte` (max_length_exp_ctx (hash_of_cs cs))} type dkp_ikm_s (cs:ciphersuite) = b:bytes{Seq.length b `maybe_lte` (max_length_dkp_ikm (kem_hash_of_cs cs)) /\ Seq.length b >= size_dh_key cs} // deserialize returns a serialized point, this is due to HPKE // using a different format (the extra byte) val deserialize_public_key: cs:ciphersuite -> pk:key_dh_public_s cs -> Tot (DH.serialized_point (kem_dh_of_cs cs)) val serialize_public_key: cs:ciphersuite -> pk:DH.serialized_point (kem_dh_of_cs cs) -> Tot (key_dh_public_s cs) // never returns None for Curve25519. val derive_key_pair: cs:ciphersuite -> ikm:dkp_ikm_s cs -> Tot (option (key_dh_secret_s cs & key_dh_public_s cs)) val encryption_context (cs:ciphersuite) : Type0
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val exp_len : cs: Spec.Agile.HPKE.ciphersuite -> Type0
[]
Spec.Agile.HPKE.exp_len
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Type0
{ "end_col": 91, "end_line": 381, "start_col": 31, "start_line": 381 }
Prims.Tot
val size_label_exp:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_exp: size_nat = 3
val size_label_exp:size_nat let size_label_exp:size_nat =
false
null
false
3
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_exp:size_nat
[]
Spec.Agile.HPKE.size_label_exp
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 32, "end_line": 203, "start_col": 31, "start_line": 203 }
Prims.Tot
val label_shared_secret_list:l: list uint8 {List.Tot.length l == size_label_shared_secret}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l
val label_shared_secret_list:l: list uint8 {List.Tot.length l == size_label_shared_secret} let label_shared_secret_list:l: list uint8 {List.Tot.length l == size_label_shared_secret} =
false
null
false
[@@ inline_let ]let l = [ u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74 ] in assert_norm (List.Tot.length l == size_label_shared_secret); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_shared_secret", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_shared_secret_list:l: list uint8 {List.Tot.length l == size_label_shared_secret}
[]
Spec.Agile.HPKE.label_shared_secret_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_shared_secret}
{ "end_col": 3, "end_line": 142, "start_col": 2, "start_line": 139 }
Prims.Tot
val size_label_KEM:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_KEM: size_nat = 3
val size_label_KEM:size_nat let size_label_KEM:size_nat =
false
null
false
3
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_KEM:size_nat
[]
Spec.Agile.HPKE.size_label_KEM
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 32, "end_line": 115, "start_col": 31, "start_line": 115 }
Prims.Tot
val size_label_secret:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_secret: size_nat = 6
val size_label_secret:size_nat let size_label_secret:size_nat =
false
null
false
6
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_secret:size_nat
[]
Spec.Agile.HPKE.size_label_secret
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 35, "end_line": 170, "start_col": 34, "start_line": 170 }
Prims.Tot
val label_version_list:l: list uint8 {List.Tot.length l == size_label_version}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l
val label_version_list:l: list uint8 {List.Tot.length l == size_label_version} let label_version_list:l: list uint8 {List.Tot.length l == size_label_version} =
false
null
false
[@@ inline_let ]let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm (List.Tot.length l == size_label_version); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_version", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_version_list:l: list uint8 {List.Tot.length l == size_label_version}
[]
Spec.Agile.HPKE.label_version_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_version}
{ "end_col": 3, "end_line": 98, "start_col": 2, "start_line": 95 }
Prims.Tot
val label_dkp_prk_list:l: list uint8 {List.Tot.length l == size_label_dkp_prk}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l
val label_dkp_prk_list:l: list uint8 {List.Tot.length l == size_label_dkp_prk} let label_dkp_prk_list:l: list uint8 {List.Tot.length l == size_label_dkp_prk} =
false
null
false
[@@ inline_let ]let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm (List.Tot.length l == size_label_dkp_prk); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_dkp_prk", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_dkp_prk_list:l: list uint8 {List.Tot.length l == size_label_dkp_prk}
[]
Spec.Agile.HPKE.label_dkp_prk_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_dkp_prk}
{ "end_col": 3, "end_line": 230, "start_col": 2, "start_line": 227 }
Prims.Tot
val size_kdf (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs)
val size_kdf (cs: ciphersuite) : size_nat let size_kdf (cs: ciphersuite) : size_nat =
false
null
false
Hash.hash_length (hash_of_cs cs)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Hash.Definitions.hash_length", "Spec.Agile.HPKE.hash_of_cs", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_kdf (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_kdf
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 74, "end_line": 298, "start_col": 42, "start_line": 298 }
Prims.Tot
val label_sk_list:l: list uint8 {List.Tot.length l == size_label_sk}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l
val label_sk_list:l: list uint8 {List.Tot.length l == size_label_sk} let label_sk_list:l: list uint8 {List.Tot.length l == size_label_sk} =
false
null
false
[@@ inline_let ]let l = [u8 0x73; u8 0x6b] in assert_norm (List.Tot.length l == size_label_sk); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_sk", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_sk_list:l: list uint8 {List.Tot.length l == size_label_sk}
[]
Spec.Agile.HPKE.label_sk_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_sk}
{ "end_col": 3, "end_line": 252, "start_col": 2, "start_line": 249 }
Prims.Tot
val size_label_HPKE:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_HPKE: size_nat = 4
val size_label_HPKE:size_nat let size_label_HPKE:size_nat =
false
null
false
4
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_HPKE:size_nat
[]
Spec.Agile.HPKE.size_label_HPKE
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 33, "end_line": 126, "start_col": 32, "start_line": 126 }
Prims.Tot
val size_label_key:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_key: size_nat = 3
val size_label_key:size_nat let size_label_key:size_nat =
false
null
false
3
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_key:size_nat
[]
Spec.Agile.HPKE.size_label_key
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 32, "end_line": 181, "start_col": 31, "start_line": 181 }
Prims.Tot
val size_label_base_nonce:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_base_nonce: size_nat = 10
val size_label_base_nonce:size_nat let size_label_base_nonce:size_nat =
false
null
false
10
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_base_nonce:size_nat
[]
Spec.Agile.HPKE.size_label_base_nonce
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 40, "end_line": 192, "start_col": 38, "start_line": 192 }
Prims.Tot
val size_label_sec:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_sec: size_nat = 3
val size_label_sec:size_nat let size_label_sec:size_nat =
false
null
false
3
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_sec:size_nat
[]
Spec.Agile.HPKE.size_label_sec
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 32, "end_line": 214, "start_col": 31, "start_line": 214 }
Prims.Tot
val size_aead_nonce (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12
val size_aead_nonce (cs: ciphersuite) : size_nat let size_aead_nonce (cs: ciphersuite) : size_nat =
false
null
false
assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.HPKE.aead_of_cs", "Spec.Agile.AEAD.alg", "Lib.IntTypes.size_nat", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Prims.op_Subtraction", "Prims.pow2" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_aead_nonce (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_aead_nonce
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 16, "end_line": 264, "start_col": 2, "start_line": 261 }
Prims.Tot
val size_suite_id_kem:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_suite_id_kem: size_nat = size_label_KEM + 2
val size_suite_id_kem:size_nat let size_suite_id_kem:size_nat =
false
null
false
size_label_KEM + 2
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.op_Addition", "Spec.Agile.HPKE.size_label_KEM" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_suite_id_kem:size_nat
[]
Spec.Agile.HPKE.size_suite_id_kem
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 52, "end_line": 306, "start_col": 34, "start_line": 306 }
Prims.Tot
val size_suite_id_hpke:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_suite_id_hpke: size_nat = size_label_HPKE + 6
val size_suite_id_hpke:size_nat let size_suite_id_hpke:size_nat =
false
null
false
size_label_HPKE + 6
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.op_Addition", "Spec.Agile.HPKE.size_label_HPKE" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_suite_id_hpke:size_nat
[]
Spec.Agile.HPKE.size_suite_id_hpke
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 54, "end_line": 309, "start_col": 35, "start_line": 309 }
Prims.Tot
val is_valid_not_export_only_ciphersuite (cs: ciphersuite) : bool
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true
val is_valid_not_export_only_ciphersuite (cs: ciphersuite) : bool let is_valid_not_export_only_ciphersuite (cs: ciphersuite) : bool =
false
null
false
match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.HPKE.aead_of_cs", "Spec.Agile.AEAD.alg", "Prims.bool" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_valid_not_export_only_ciphersuite (cs: ciphersuite) : bool
[]
Spec.Agile.HPKE.is_valid_not_export_only_ciphersuite
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Prims.bool
{ "end_col": 18, "end_line": 71, "start_col": 2, "start_line": 69 }
Prims.Tot
val label_HPKE_list:l: list uint8 {List.Tot.length l == size_label_HPKE}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l
val label_HPKE_list:l: list uint8 {List.Tot.length l == size_label_HPKE} let label_HPKE_list:l: list uint8 {List.Tot.length l == size_label_HPKE} =
false
null
false
[@@ inline_let ]let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm (List.Tot.length l == size_label_HPKE); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_HPKE", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_HPKE_list:l: list uint8 {List.Tot.length l == size_label_HPKE}
[]
Spec.Agile.HPKE.label_HPKE_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_HPKE}
{ "end_col": 3, "end_line": 131, "start_col": 2, "start_line": 128 }
Prims.Tot
val size_dh_key (cs: ciphersuite) : size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs)
val size_dh_key (cs: ciphersuite) : size_nat let size_dh_key (cs: ciphersuite) : size_nat =
false
null
false
DH.size_key (kem_dh_of_cs cs)
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.DH.size_key", "Spec.Agile.HPKE.kem_dh_of_cs", "Lib.IntTypes.size_nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_dh_key (cs: ciphersuite) : size_nat
[]
Spec.Agile.HPKE.size_dh_key
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Lib.IntTypes.size_nat
{ "end_col": 74, "end_line": 279, "start_col": 45, "start_line": 279 }
Prims.Tot
val label_eae_prk_list:l: list uint8 {List.Tot.length l == size_label_eae_prk}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l
val label_eae_prk_list:l: list uint8 {List.Tot.length l == size_label_eae_prk} let label_eae_prk_list:l: list uint8 {List.Tot.length l == size_label_eae_prk} =
false
null
false
[@@ inline_let ]let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm (List.Tot.length l == size_label_eae_prk); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_eae_prk", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_eae_prk_list:l: list uint8 {List.Tot.length l == size_label_eae_prk}
[]
Spec.Agile.HPKE.label_eae_prk_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_eae_prk}
{ "end_col": 3, "end_line": 109, "start_col": 2, "start_line": 106 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_length_exp_ctx (a:hash_algorithm) = labeled_expand_max_length_info a size_suite_id_hpke size_label_sec
let max_length_exp_ctx (a: hash_algorithm) =
false
null
false
labeled_expand_max_length_info a size_suite_id_hpke size_label_sec
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.hash_algorithm", "Spec.Agile.HPKE.labeled_expand_max_length_info", "Spec.Agile.HPKE.size_suite_id_hpke", "Spec.Agile.HPKE.size_label_sec", "FStar.Pervasives.Native.option", "Prims.int" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs) let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1 inline_for_extraction let size_suite_id_kem: size_nat = size_label_KEM + 2 inline_for_extraction let size_suite_id_hpke: size_nat = size_label_HPKE + 6 inline_for_extraction let size_mode_identifier: size_nat = 1 let size_ks_ctx (cs:ciphersuite): size_nat = size_mode_identifier + 2*(size_kdf cs) let labeled_extract_ikm_length_pred (a:hash_algorithm) (ikm_length:nat) = HKDF.extract_ikm_length_pred a (size_label_version + ikm_length) let labeled_expand_info_length_pred (a:hash_algorithm) (info_length:nat) = HKDF.expand_info_length_pred a (2 + size_label_version + info_length) let pow2_61_1 : _:unit{pow2 61 - 1 == 2305843009213693951} = assert_norm(pow2 61 - 1 == 2305843009213693951) let pow2_125_1 : _:unit{pow2 125 - 1 == 42535295865117307932921825928971026431} = assert_norm(pow2 125 - 1 == 42535295865117307932921825928971026431) let labeled_extract_max_length_ikm (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v(Hash.max_input_length a) - size_label_version - size_suite_id - size_local_label - Spec.Hash.Definitions.block_length a) let labeled_expand_max_length_info (a:hash_algorithm) (size_suite_id:size_nat) (size_local_label:size_nat) = match a with | Hash.SHA3_256 -> None | _ -> Some (Some?.v (Hash.max_input_length a) - Spec.Hash.Definitions.hash_length a - 2 - size_label_version - size_suite_id - size_local_label - 1 - Spec.Hash.Definitions.block_length a) let max_length_psk (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_secret let max_length_psk_id (a:hash_algorithm) = labeled_extract_max_length_ikm a size_suite_id_hpke size_label_psk_id_hash
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_length_exp_ctx : a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
[]
Spec.Agile.HPKE.max_length_exp_ctx
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Agile.HPKE.hash_algorithm -> FStar.Pervasives.Native.option Prims.int
{ "end_col": 110, "end_line": 338, "start_col": 44, "start_line": 338 }
Prims.Tot
val size_label_shared_secret:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_shared_secret: size_nat = 13
val size_label_shared_secret:size_nat let size_label_shared_secret:size_nat =
false
null
false
13
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_shared_secret:size_nat
[]
Spec.Agile.HPKE.size_label_shared_secret
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 43, "end_line": 137, "start_col": 41, "start_line": 137 }
Prims.Tot
val label_HPKE:lbytes size_label_HPKE
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list
val label_HPKE:lbytes size_label_HPKE let label_HPKE:lbytes size_label_HPKE =
false
null
false
createL label_HPKE_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_HPKE_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_HPKE:lbytes size_label_HPKE
[]
Spec.Agile.HPKE.label_HPKE
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_HPKE
{ "end_col": 65, "end_line": 132, "start_col": 42, "start_line": 132 }
Prims.Tot
val size_label_psk_id_hash:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_psk_id_hash: size_nat = 11
val size_label_psk_id_hash:size_nat let size_label_psk_id_hash:size_nat =
false
null
false
11
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_psk_id_hash:size_nat
[]
Spec.Agile.HPKE.size_label_psk_id_hash
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 41, "end_line": 148, "start_col": 39, "start_line": 148 }
Prims.Tot
val label_secret:lbytes size_label_secret
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_secret : lbytes size_label_secret = createL label_secret_list
val label_secret:lbytes size_label_secret let label_secret:lbytes size_label_secret =
false
null
false
createL label_secret_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_secret_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_secret:lbytes size_label_secret
[]
Spec.Agile.HPKE.label_secret
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_secret
{ "end_col": 71, "end_line": 176, "start_col": 46, "start_line": 176 }
Prims.Tot
val label_info_hash:lbytes size_label_info_hash
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list
val label_info_hash:lbytes size_label_info_hash let label_info_hash:lbytes size_label_info_hash =
false
null
false
createL label_info_hash_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_info_hash_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_info_hash:lbytes size_label_info_hash
[]
Spec.Agile.HPKE.label_info_hash
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_info_hash
{ "end_col": 80, "end_line": 165, "start_col": 52, "start_line": 165 }
Prims.Tot
val size_label_info_hash:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_info_hash: size_nat = 9
val size_label_info_hash:size_nat let size_label_info_hash:size_nat =
false
null
false
9
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_info_hash:size_nat
[]
Spec.Agile.HPKE.size_label_info_hash
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 38, "end_line": 159, "start_col": 37, "start_line": 159 }
Prims.Tot
val label_psk_id_hash_list:l: list uint8 {List.Tot.length l == size_label_psk_id_hash}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l
val label_psk_id_hash_list:l: list uint8 {List.Tot.length l == size_label_psk_id_hash} let label_psk_id_hash_list:l: list uint8 {List.Tot.length l == size_label_psk_id_hash} =
false
null
false
[@@ inline_let ]let l = [ u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68 ] in assert_norm (List.Tot.length l == size_label_psk_id_hash); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_psk_id_hash", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_psk_id_hash_list:l: list uint8 {List.Tot.length l == size_label_psk_id_hash}
[]
Spec.Agile.HPKE.label_psk_id_hash_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_psk_id_hash}
{ "end_col": 3, "end_line": 153, "start_col": 2, "start_line": 150 }
Prims.Tot
val label_secret_list:l: list uint8 {List.Tot.length l == size_label_secret}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l
val label_secret_list:l: list uint8 {List.Tot.length l == size_label_secret} let label_secret_list:l: list uint8 {List.Tot.length l == size_label_secret} =
false
null
false
[@@ inline_let ]let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm (List.Tot.length l == size_label_secret); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_secret", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_secret_list:l: list uint8 {List.Tot.length l == size_label_secret}
[]
Spec.Agile.HPKE.label_secret_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_secret}
{ "end_col": 3, "end_line": 175, "start_col": 2, "start_line": 172 }
Prims.Tot
val label_key:lbytes size_label_key
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_key : lbytes size_label_key = createL label_key_list
val label_key:lbytes size_label_key let label_key:lbytes size_label_key =
false
null
false
createL label_key_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_key_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_key:lbytes size_label_key
[]
Spec.Agile.HPKE.label_key
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_key
{ "end_col": 62, "end_line": 187, "start_col": 40, "start_line": 187 }
Prims.Tot
val label_base_nonce:lbytes size_label_base_nonce
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list
val label_base_nonce:lbytes size_label_base_nonce let label_base_nonce:lbytes size_label_base_nonce =
false
null
false
createL label_base_nonce_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_base_nonce_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_base_nonce:lbytes size_label_base_nonce
[]
Spec.Agile.HPKE.label_base_nonce
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_base_nonce
{ "end_col": 83, "end_line": 198, "start_col": 54, "start_line": 198 }
Prims.Tot
val label_sec:lbytes size_label_sec
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_sec : lbytes size_label_sec = createL label_sec_list
val label_sec:lbytes size_label_sec let label_sec:lbytes size_label_sec =
false
null
false
createL label_sec_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_sec_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_sec:lbytes size_label_sec
[]
Spec.Agile.HPKE.label_sec
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_sec
{ "end_col": 62, "end_line": 220, "start_col": 40, "start_line": 220 }
Prims.Tot
val label_dkp_prk:lbytes size_label_dkp_prk
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list
val label_dkp_prk:lbytes size_label_dkp_prk let label_dkp_prk:lbytes size_label_dkp_prk =
false
null
false
createL label_dkp_prk_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_dkp_prk_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_dkp_prk:lbytes size_label_dkp_prk
[]
Spec.Agile.HPKE.label_dkp_prk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_dkp_prk
{ "end_col": 74, "end_line": 231, "start_col": 48, "start_line": 231 }
Prims.Tot
val label_sk:lbytes size_label_sk
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_sk : lbytes size_label_sk = createL label_sk_list
val label_sk:lbytes size_label_sk let label_sk:lbytes size_label_sk =
false
null
false
createL label_sk_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_sk_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_sk:lbytes size_label_sk
[]
Spec.Agile.HPKE.label_sk
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_sk
{ "end_col": 59, "end_line": 253, "start_col": 38, "start_line": 253 }
Prims.Tot
val label_candidate:lbytes size_label_candidate
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_candidate : lbytes size_label_candidate = createL label_candidate_list
val label_candidate:lbytes size_label_candidate let label_candidate:lbytes size_label_candidate =
false
null
false
createL label_candidate_list
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Lib.Sequence.createL", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.label_candidate_list" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate);
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_candidate:lbytes size_label_candidate
[]
Spec.Agile.HPKE.label_candidate
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) Spec.Agile.HPKE.size_label_candidate
{ "end_col": 80, "end_line": 242, "start_col": 52, "start_line": 242 }
Prims.Tot
val size_label_candidate:size_nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let size_label_candidate: size_nat = 9
val size_label_candidate:size_nat let size_label_candidate:size_nat =
false
null
false
9
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate"
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_label_candidate:size_nat
[]
Spec.Agile.HPKE.size_label_candidate
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Prims.nat{n <= Prims.pow2 32 - 1}
{ "end_col": 38, "end_line": 236, "start_col": 37, "start_line": 236 }
Prims.Tot
val label_exp_list:l: list uint8 {List.Tot.length l == size_label_exp}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l
val label_exp_list:l: list uint8 {List.Tot.length l == size_label_exp} let label_exp_list:l: list uint8 {List.Tot.length l == size_label_exp} =
false
null
false
[@@ inline_let ]let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm (List.Tot.length l == size_label_exp); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_exp", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_exp_list:l: list uint8 {List.Tot.length l == size_label_exp}
[]
Spec.Agile.HPKE.label_exp_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_exp}
{ "end_col": 3, "end_line": 208, "start_col": 2, "start_line": 205 }
Prims.Tot
val max_seq (cs: ciphersuite) : nat
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let max_seq (cs:ciphersuite): nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8*(size_aead_nonce cs)) - 1
val max_seq (cs: ciphersuite) : nat let max_seq (cs: ciphersuite) : nat =
false
null
false
match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> pow2 (8 * (size_aead_nonce cs)) - 1
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Spec.Agile.HPKE.ciphersuite", "Spec.Agile.HPKE.aead_of_cs", "Spec.Agile.AEAD.alg", "Prims.op_Subtraction", "Prims.pow2", "FStar.Mul.op_Star", "Spec.Agile.HPKE.size_aead_nonce", "Prims.nat" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3 let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l let label_sec : lbytes size_label_sec = createL label_sec_list // generated: "dkp_prk" inline_for_extraction let size_label_dkp_prk: size_nat = 7 let label_dkp_prk_list : l:list uint8{List.Tot.length l == size_label_dkp_prk} = [@inline_let] let l = [u8 0x64; u8 0x6b; u8 0x70; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_dkp_prk); l let label_dkp_prk : lbytes size_label_dkp_prk = createL label_dkp_prk_list // generated: "candidate" inline_for_extraction let size_label_candidate: size_nat = 9 let label_candidate_list : l:list uint8{List.Tot.length l == size_label_candidate} = [@inline_let] let l = [u8 0x63; u8 0x61; u8 0x6e; u8 0x64; u8 0x69; u8 0x64; u8 0x61; u8 0x74; u8 0x65] in assert_norm(List.Tot.length l == size_label_candidate); l let label_candidate : lbytes size_label_candidate = createL label_candidate_list // generated: "sk" inline_for_extraction let size_label_sk: size_nat = 2 let label_sk_list : l:list uint8{List.Tot.length l == size_label_sk} = [@inline_let] let l = [u8 0x73; u8 0x6b] in assert_norm(List.Tot.length l == size_label_sk); l let label_sk : lbytes size_label_sk = createL label_sk_list /// /// Constants sizes /// inline_for_extraction let size_aead_nonce (cs:ciphersuite): size_nat = assert_norm (8 * 12 <= pow2 64 - 1); match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> 12 inline_for_extraction let size_aead_key (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.key_length (aead_alg_of cs) inline_for_extraction let size_aead_tag (cs:ciphersuite): size_nat = match aead_of_cs cs with | ExportOnly -> 0 | Seal _ -> AEAD.tag_length (aead_alg_of cs) inline_for_extraction let size_dh_key (cs:ciphersuite): size_nat = DH.size_key (kem_dh_of_cs cs) inline_for_extraction let size_dh_public (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 + 1 // Need the additional byte for representation inline_for_extraction let size_dh_serialized (cs:ciphersuite): size_nat = match kem_dh_of_cs cs with | DH.DH_Curve25519 -> DH.size_public DH.DH_Curve25519 | DH.DH_P256 -> DH.size_public DH.DH_P256 inline_for_extraction let size_kem_kdf (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kem_key (cs:ciphersuite): size_nat = Hash.hash_length (kem_hash_of_cs cs) inline_for_extraction let size_kdf (cs:ciphersuite): size_nat = Hash.hash_length (hash_of_cs cs)
false
true
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val max_seq (cs: ciphersuite) : nat
[]
Spec.Agile.HPKE.max_seq
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
cs: Spec.Agile.HPKE.ciphersuite -> Prims.nat
{ "end_col": 47, "end_line": 303, "start_col": 2, "start_line": 301 }
Prims.Tot
val label_sec_list:l: list uint8 {List.Tot.length l == size_label_sec}
[ { "abbrev": true, "full_module": "Spec.Agile.HKDF", "short_module": "HKDF" }, { "abbrev": true, "full_module": "Spec.Agile.Hash", "short_module": "Hash" }, { "abbrev": true, "full_module": "Spec.Agile.AEAD", "short_module": "AEAD" }, { "abbrev": true, "full_module": "Spec.Agile.DH", "short_module": "DH" }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let label_sec_list : l:list uint8{List.Tot.length l == size_label_sec} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm(List.Tot.length l == size_label_sec); l
val label_sec_list:l: list uint8 {List.Tot.length l == size_label_sec} let label_sec_list:l: list uint8 {List.Tot.length l == size_label_sec} =
false
null
false
[@@ inline_let ]let l = [u8 0x73; u8 0x65; u8 0x63] in assert_norm (List.Tot.length l == size_label_sec); l
{ "checked_file": "Spec.Agile.HPKE.fsti.checked", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HKDF.fsti.checked", "Spec.Agile.Hash.fsti.checked", "Spec.Agile.DH.fst.checked", "Spec.Agile.AEAD.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HPKE.fsti" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.nat", "FStar.List.Tot.Base.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Agile.HPKE.size_label_sec", "Prims.list", "Prims.Cons", "Lib.IntTypes.u8", "Prims.Nil" ]
[]
module Spec.Agile.HPKE open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence module DH = Spec.Agile.DH module AEAD = Spec.Agile.AEAD module Hash = Spec.Agile.Hash module HKDF = Spec.Agile.HKDF #set-options "--z3rlimit 20 --fuel 0 --ifuel 1" type mode = | Base | PSK | Auth | AuthPSK let is_valid_kem = function | DH.DH_Curve25519, Hash.SHA2_256 | DH.DH_P256, Hash.SHA2_256 -> true | _,_ -> false noeq type aead = | Seal: alg:AEAD.alg -> aead | ExportOnly let is_valid_aead = function | Seal AEAD.AES128_GCM | Seal AEAD.AES256_GCM | Seal AEAD.CHACHA20_POLY1305 | ExportOnly -> true | _ -> false let is_valid_hash = function | Hash.SHA2_256 | Hash.SHA2_384 | Hash.SHA2_512 -> true | _ -> false let hash_algorithm = a:Hash.hash_alg{is_valid_hash a} let is_valid_ciphersuite (cs:DH.algorithm & hash_algorithm & aead & Hash.hash_alg) : bool = let kem_dh, kem_hash, aead, hash = cs in (is_valid_kem (kem_dh, kem_hash)) && (is_valid_aead aead) && (is_valid_hash hash) let ciphersuite = cs:(DH.algorithm & hash_algorithm & aead & Hash.hash_alg){is_valid_ciphersuite cs} inline_for_extraction let kem_dh_of_cs (cs:ciphersuite) : DH.algorithm = let (c,_,_,_) = cs in c inline_for_extraction let kem_hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,h,_,_) = cs in h inline_for_extraction let aead_of_cs (cs:ciphersuite) : aead = let (_,_,a,_) = cs in a inline_for_extraction let hash_of_cs (cs:ciphersuite) : hash_algorithm = let (_,_,_,h) = cs in h let is_valid_not_export_only_ciphersuite (cs:ciphersuite) : bool = match aead_of_cs cs with | ExportOnly -> false | Seal _ -> true let ciphersuite_not_export_only = cs:ciphersuite{is_valid_not_export_only_ciphersuite cs} inline_for_extraction let aead_alg_of (cs:ciphersuite_not_export_only) = match aead_of_cs cs with | Seal alg -> alg /// Constants for HPKE labels /// /// The code for the following constants was generated /// with the script make_hpke_constants.py. Ultimately, /// this should be rewritten in Meta-F*. The idea is to /// write a tactic `mk_label` that inspects a string /// character by character, and generates the proper /// definition. It could be used as follows: /// %splice [label_version] (mk_label "HPKE-v1") /// Inspiration can be taken from Test.Lowstarize.fst. // generated: "HPKE-v1" inline_for_extraction let size_label_version: size_nat = 7 let label_version_list : l:list uint8{List.Tot.length l == size_label_version} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45; u8 0x2d; u8 0x76; u8 0x31] in assert_norm(List.Tot.length l == size_label_version); l let label_version : lbytes size_label_version = createL label_version_list // generated: "eae_prk" inline_for_extraction let size_label_eae_prk: size_nat = 7 let label_eae_prk_list : l:list uint8{List.Tot.length l == size_label_eae_prk} = [@inline_let] let l = [u8 0x65; u8 0x61; u8 0x65; u8 0x5f; u8 0x70; u8 0x72; u8 0x6b] in assert_norm(List.Tot.length l == size_label_eae_prk); l let label_eae_prk : lbytes size_label_eae_prk = createL label_eae_prk_list // generated: "KEM" inline_for_extraction let size_label_KEM: size_nat = 3 let label_KEM_list : l:list uint8{List.Tot.length l == size_label_KEM} = [@inline_let] let l = [u8 0x4b; u8 0x45; u8 0x4d] in assert_norm(List.Tot.length l == size_label_KEM); l let label_KEM : lbytes size_label_KEM = createL label_KEM_list // generated: "HPKE" inline_for_extraction let size_label_HPKE: size_nat = 4 let label_HPKE_list : l:list uint8{List.Tot.length l == size_label_HPKE} = [@inline_let] let l = [u8 0x48; u8 0x50; u8 0x4b; u8 0x45] in assert_norm(List.Tot.length l == size_label_HPKE); l let label_HPKE : lbytes size_label_HPKE = createL label_HPKE_list // generated: "shared_secret" inline_for_extraction let size_label_shared_secret: size_nat = 13 let label_shared_secret_list : l:list uint8{List.Tot.length l == size_label_shared_secret} = [@inline_let] let l = [u8 0x73; u8 0x68; u8 0x61; u8 0x72; u8 0x65; u8 0x64; u8 0x5f; u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_shared_secret); l let label_shared_secret : lbytes size_label_shared_secret = createL label_shared_secret_list // generated: "psk_id_hash" inline_for_extraction let size_label_psk_id_hash: size_nat = 11 let label_psk_id_hash_list : l:list uint8{List.Tot.length l == size_label_psk_id_hash} = [@inline_let] let l = [u8 0x70; u8 0x73; u8 0x6b; u8 0x5f; u8 0x69; u8 0x64; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_psk_id_hash); l let label_psk_id_hash : lbytes size_label_psk_id_hash = createL label_psk_id_hash_list // generated: "info_hash" inline_for_extraction let size_label_info_hash: size_nat = 9 let label_info_hash_list : l:list uint8{List.Tot.length l == size_label_info_hash} = [@inline_let] let l = [u8 0x69; u8 0x6e; u8 0x66; u8 0x6f; u8 0x5f; u8 0x68; u8 0x61; u8 0x73; u8 0x68] in assert_norm(List.Tot.length l == size_label_info_hash); l let label_info_hash : lbytes size_label_info_hash = createL label_info_hash_list // generated: "secret" inline_for_extraction let size_label_secret: size_nat = 6 let label_secret_list : l:list uint8{List.Tot.length l == size_label_secret} = [@inline_let] let l = [u8 0x73; u8 0x65; u8 0x63; u8 0x72; u8 0x65; u8 0x74] in assert_norm(List.Tot.length l == size_label_secret); l let label_secret : lbytes size_label_secret = createL label_secret_list // generated: "key" inline_for_extraction let size_label_key: size_nat = 3 let label_key_list : l:list uint8{List.Tot.length l == size_label_key} = [@inline_let] let l = [u8 0x6b; u8 0x65; u8 0x79] in assert_norm(List.Tot.length l == size_label_key); l let label_key : lbytes size_label_key = createL label_key_list // generated: "base_nonce" inline_for_extraction let size_label_base_nonce: size_nat = 10 let label_base_nonce_list : l:list uint8{List.Tot.length l == size_label_base_nonce} = [@inline_let] let l = [u8 0x62; u8 0x61; u8 0x73; u8 0x65; u8 0x5f; u8 0x6e; u8 0x6f; u8 0x6e; u8 0x63; u8 0x65] in assert_norm(List.Tot.length l == size_label_base_nonce); l let label_base_nonce : lbytes size_label_base_nonce = createL label_base_nonce_list // generated: "exp" inline_for_extraction let size_label_exp: size_nat = 3 let label_exp_list : l:list uint8{List.Tot.length l == size_label_exp} = [@inline_let] let l = [u8 0x65; u8 0x78; u8 0x70] in assert_norm(List.Tot.length l == size_label_exp); l let label_exp : lbytes size_label_exp = createL label_exp_list // generated: "sec" inline_for_extraction let size_label_sec: size_nat = 3
false
false
Spec.Agile.HPKE.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val label_sec_list:l: list uint8 {List.Tot.length l == size_label_sec}
[]
Spec.Agile.HPKE.label_sec_list
{ "file_name": "specs/Spec.Agile.HPKE.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) {FStar.List.Tot.Base.length l == Spec.Agile.HPKE.size_label_sec}
{ "end_col": 3, "end_line": 219, "start_col": 2, "start_line": 216 }