val lserialize_keyExchangeAlgorithm_key:LL.serializer32 serialize_keyExchangeAlgorithm_key
val lserialize_keyExchangeAlgorithm_key:LL.serializer32 serialize_keyExchangeAlgorithm_key
let lserialize_keyExchangeAlgorithm_key : LL.serializer32 serialize_keyExchangeAlgorithm_key =
  LL.serializer32_of_leaf_writer_strong_constant_size write_keyExchangeAlgorithm_key 1ul ()
module MiTLS.Parsers.KeyExchangeAlgorithm

(* This file has been automatically generated by EverParse. *)
open FStar.Bytes
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module LP = LowParse.Spec
module LT = LowParse.TacLib
module LS = LowParse.SLow
module LSZ = LowParse.SLow
module LPI = LowParse.Spec.AllIntegers
module LL = LowParse.Low
module L = FStar.List.Tot
module B = LowStar.Buffer
module BY = FStar.Bytes
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST

#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection' --z3rlimit 16 --z3cliopt smt.arith.nl=false --max_fuel 2 --max_ifuel 2"

[@LT.Norm] inline_for_extraction let keyExchangeAlgorithm_enum : LP.enum keyExchangeAlgorithm U8.t =
  [@inline_let] let e = [
    Dh_anon, 0z;
    Dhe, 1z;
    Ecdhe, 2z;
    Rsa, 3z;
  ] in
  [@inline_let] let _ =
    assert_norm (L.noRepeats (LP.list_map fst e))
  in
  [@inline_let] let _ = 
    assert_norm (L.noRepeats (LP.list_map snd e))
  in e

noextract let keyExchangeAlgorithm_repr_parser = LPI.parse_u8

noextract let keyExchangeAlgorithm_repr_serializer = LPI.serialize_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_parser32 = LS.parse32_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_serializer32 = LS.serialize32_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_size32 = LSZ.size32_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_validator = (LL.validate_u8 ())

inline_for_extraction noextract let keyExchangeAlgorithm_repr_jumper = LL.jump_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_reader = LL.read_u8

inline_for_extraction noextract let keyExchangeAlgorithm_repr_writer = LL.write_u8

inline_for_extraction let synth_keyExchangeAlgorithm (x: LP.enum_key keyExchangeAlgorithm_enum) : Tot keyExchangeAlgorithm = x

inline_for_extraction let synth_keyExchangeAlgorithm_inv (x: keyExchangeAlgorithm) : Tot (LP.enum_key keyExchangeAlgorithm_enum) =
  [@inline_let] let _ : squash (LP.list_mem x (LP.list_map fst keyExchangeAlgorithm_enum)) =
    _ by (LP.synth_maybe_enum_key_inv_unknown_tac x)
  in
  x

let lemma_synth_keyExchangeAlgorithm_inj () : Lemma
  (LP.synth_injective synth_keyExchangeAlgorithm) = ()

let lemma_synth_keyExchangeAlgorithm_inv () : Lemma
  (LP.synth_inverse synth_keyExchangeAlgorithm synth_keyExchangeAlgorithm_inv) = ()

noextract let parse_keyExchangeAlgorithm_key : LP.parser _ (LP.enum_key keyExchangeAlgorithm_enum) =
  LP.parse_enum_key keyExchangeAlgorithm_repr_parser keyExchangeAlgorithm_enum

noextract let serialize_keyExchangeAlgorithm_key : LP.serializer parse_keyExchangeAlgorithm_key =
  LP.serialize_enum_key keyExchangeAlgorithm_repr_parser keyExchangeAlgorithm_repr_serializer keyExchangeAlgorithm_enum

noextract let keyExchangeAlgorithm_parser : LP.parser _ keyExchangeAlgorithm =
  lemma_synth_keyExchangeAlgorithm_inj ();
  parse_keyExchangeAlgorithm_key `LP.parse_synth` synth_keyExchangeAlgorithm

noextract let keyExchangeAlgorithm_serializer : LP.serializer keyExchangeAlgorithm_parser =
  lemma_synth_keyExchangeAlgorithm_inj ();
  lemma_synth_keyExchangeAlgorithm_inv ();
  LP.serialize_synth _ synth_keyExchangeAlgorithm serialize_keyExchangeAlgorithm_key synth_keyExchangeAlgorithm_inv ()

let keyExchangeAlgorithm_bytesize (x:keyExchangeAlgorithm) : GTot nat = Seq.length (keyExchangeAlgorithm_serializer x)

let keyExchangeAlgorithm_bytesize_eq x = ()

let parse32_keyExchangeAlgorithm_key : LS.parser32 parse_keyExchangeAlgorithm_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_enum_key_tac keyExchangeAlgorithm_repr_parser32 keyExchangeAlgorithm_enum)

let keyExchangeAlgorithm_parser32 : LS.parser32 keyExchangeAlgorithm_parser =
  lemma_synth_keyExchangeAlgorithm_inj ();
  LS.parse32_synth _ synth_keyExchangeAlgorithm (fun x->synth_keyExchangeAlgorithm x) parse32_keyExchangeAlgorithm_key ()

let serialize32_keyExchangeAlgorithm_key : LS.serializer32 serialize_keyExchangeAlgorithm_key =
  FStar.Tactics.synth_by_tactic (LS.serialize32_enum_key_gen_tac
    keyExchangeAlgorithm_repr_serializer32 keyExchangeAlgorithm_enum)

let keyExchangeAlgorithm_serializer32 : LS.serializer32 keyExchangeAlgorithm_serializer =
  lemma_synth_keyExchangeAlgorithm_inj ();
  lemma_synth_keyExchangeAlgorithm_inv ();
  LS.serialize32_synth _ synth_keyExchangeAlgorithm _ serialize32_keyExchangeAlgorithm_key synth_keyExchangeAlgorithm_inv (fun x->synth_keyExchangeAlgorithm_inv x) ()

let keyExchangeAlgorithm_size32 =
  [@inline_let] let _ = assert_norm (LSZ.size32_constant_precond keyExchangeAlgorithm_serializer 1ul) in
  LSZ.size32_constant keyExchangeAlgorithm_serializer 1ul ()

[@@ (LT.postprocess_with LT.pp_norm_tac)]
inline_for_extraction let validate_keyExchangeAlgorithm_key : LL.validator parse_keyExchangeAlgorithm_key =
    LL.mk_validate_enum_key keyExchangeAlgorithm_repr_validator keyExchangeAlgorithm_repr_reader keyExchangeAlgorithm_enum

let keyExchangeAlgorithm_validator =
  lemma_synth_keyExchangeAlgorithm_inj ();
  LL.validate_synth validate_keyExchangeAlgorithm_key synth_keyExchangeAlgorithm ()

[@@ (LT.postprocess_with LT.pp_norm_tac) ]
inline_for_extraction let read_keyExchangeAlgorithm_key : LL.leaf_reader parse_keyExchangeAlgorithm_key =
  LL.mk_read_enum_key keyExchangeAlgorithm_repr_reader keyExchangeAlgorithm_enum

let keyExchangeAlgorithm_reader =
 [@inline_let] let _ = lemma_synth_keyExchangeAlgorithm_inj () in
 LL.read_synth' parse_keyExchangeAlgorithm_key synth_keyExchangeAlgorithm read_keyExchangeAlgorithm_key ()

inline_for_extraction let write_keyExchangeAlgorithm_key : LL.leaf_writer_strong serialize_keyExchangeAlgorithm_key =
  LL.write_enum_key keyExchangeAlgorithm_repr_writer keyExchangeAlgorithm_enum (_ by (LP.enum_repr_of_key_tac keyExchangeAlgorithm_enum))
/
prims.fst.checked LowStar.Buffer.fst.checked LowParse.TacLib.fst.checked LowParse.Spec.AllIntegers.fst.checked LowParse.Spec.fst.checked LowParse.SLow.fst.checked LowParse.Low.fst.checked FStar.UInt8.fsti.checked FStar.UInt64.fsti.checked FStar.UInt32.fsti.checked FStar.UInt16.fsti.checked FStar.Tactics.Effect.fsti.checked FStar.Tactics.fst.checked FStar.Seq.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.HyperStack.ST.fsti.checked FStar.HyperStack.fst.checked FStar.Bytes.fsti.checked
MiTLS.Parsers.KeyExchangeAlgorithm.fst
LowParse.Low.Base.serializer32 MiTLS.Parsers.KeyExchangeAlgorithm.serialize_keyExchangeAlgorithm_key
LowParse.Low.Base.serializer32_of_leaf_writer_strong_constant_size LowParse.Spec.Combinators.parse_filter_kind LowParse.Spec.Int.parse_u8_kind LowParse.Spec.Enum.enum_key MiTLS.Parsers.KeyExchangeAlgorithm.keyExchangeAlgorithm FStar.UInt8.t MiTLS.Parsers.KeyExchangeAlgorithm.keyExchangeAlgorithm_enum MiTLS.Parsers.KeyExchangeAlgorithm.parse_keyExchangeAlgorithm_key MiTLS.Parsers.KeyExchangeAlgorithm.serialize_keyExchangeAlgorithm_key MiTLS.Parsers.KeyExchangeAlgorithm.write_keyExchangeAlgorithm_key FStar.UInt32.__uint_to_t
let lserialize_keyExchangeAlgorithm_key:LL.serializer32 serialize_keyExchangeAlgorithm_key =
  
LL.serializer32_of_leaf_writer_strong_constant_size write_keyExchangeAlgorithm_key 1ul ()