file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FStar.UInt16.fst | FStar.UInt16.div | val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c)) | val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c)) | let div a b = Mk (div (v a) (v b)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 61,
"start_col": 0,
"start_line": 61
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t{FStar.UInt16.v b <> 0} -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"FStar.UInt16.v",
"FStar.UInt16.Mk",
"FStar.UInt.div",
"FStar.UInt16.n"
] | [] | false | false | false | false | false | let div a b =
| Mk (div (v a) (v b)) | false |
FStar.UInt16.fst | FStar.UInt16.mul_mod | val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c)) | val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c)) | let mul_mod a b = Mk (mul_mod (v a) (v b)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 42,
"end_line": 59,
"start_col": 0,
"start_line": 59
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.mul_mod",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let mul_mod a b =
| Mk (mul_mod (v a) (v b)) | false |
Ast.fst | Ast.switch_case_prune_actions | val switch_case_prune_actions (s: switch_case) : Tot switch_case | val switch_case_prune_actions (s: switch_case) : Tot switch_case | let rec field'_prune_actions
(f: field')
: Tot field'
= match f with
| AtomicField a -> AtomicField (atomic_field_prune_actions a)
| RecordField r i -> RecordField (record_prune_actions r) i
| SwitchCaseField s i -> SwitchCaseField (switch_case_prune_actions s) i
and field_prune_actions
(f: field)
: Tot field
= { f with v = field'_prune_actions f.v }
and record_prune_actions (r: record) : Tot record =
match r with
| [] -> []
| f :: r' -> field_prune_actions f :: record_prune_actions r'
and case_prune_actions (c: case) : Tot case =
match c with
| Case e f -> Case e (field_prune_actions f)
| DefaultCase f -> DefaultCase (field_prune_actions f)
and cases_prune_actions (l: list case) : Tot (list case) =
match l with
| [] -> []
| c :: l' -> case_prune_actions c :: cases_prune_actions l'
and switch_case_prune_actions (s: switch_case) : Tot switch_case =
let (e, l) = s in
(e, cases_prune_actions l) | {
"file_name": "src/3d/Ast.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 1279,
"start_col": 0,
"start_line": 1249
} | (*
Copyright 2019 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 Ast
(* The source abstract syntax for the 3d frontend to EverParse *)
open FStar.All
let reserved_prefix = "___"
//redefining either because we need to serialize to Json
[@@ PpxDerivingYoJson ]
type either a b =
| Inl of a
| Inr of b
/// pos: Source locations
type pos = {
filename: string;
line:int;
col:int
}
noeq
type comments_buffer_t = {
push: string & pos & pos -> ML unit;
flush: unit -> ML (list string);
flush_until: pos -> ML (list string);
}
#push-options "--warn_error -272" //top-level effect; ok
let comments_buffer : comments_buffer_t =
let buffer : ref (list (string & pos & pos)) = FStar.ST.alloc [] in
let buffer_comment (c, s, p) =
let c = String.substring c 2 (String.length c - 2) in
buffer := (c, s, p) :: !buffer
in
let flush_comments () =
let cs = !buffer in
buffer := [];
(List.rev cs) |> List.map (fun (c, _, _) -> c)
in
let flush_until pos : ML (list string) =
let cs = !buffer in
let preceding, following =
List.partition (fun (c, _, end_pos) ->
Options.debug_print_string
(Printf.sprintf "Requesting comments until line %d,\nAt line %d we have comment (*%s*)\n"
pos.line
end_pos.line
c);
end_pos.line <= pos.line) cs
in
buffer := following;
preceding |> List.map (fun (c, _, _) -> c)
in
{
push = buffer_comment;
flush = flush_comments;
flush_until = flush_until
}
#pop-options
let string_of_pos p =
Printf.sprintf "%s:(%d,%d)" p.filename p.line p.col
/// range: A source extent
let range = pos * pos
/// comment: A list of line comments, i.e., a list of strings
let comments = list string
let string_of_range r =
let p, q = r in
if p.filename = q.filename
then Printf.sprintf "%s:(%d,%d--%d,%d)"
p.filename p.line p.col q.line q.col
else Printf.sprintf "%s -- %s"
(string_of_pos p)
(string_of_pos q)
let dummy_pos = {
filename="";
line=0;
col=0;
}
noeq
type with_meta_t 'a = {
v:'a;
range:range;
comments: comments
}
(* Override the json serializers for with_meta_t to
avoid polluting the generated JSON with ranges everywhere *)
let with_meta_t_of_yojson (#a #b #c:Type) (f:(a -> b)) (x:a)
: ML c
= failwith "No reading yojson"
let with_meta_t_to_yojson (f:('a -> 'b)) (x:with_meta_t 'a)
: 'b
= f x.v
let with_range_and_comments (x:'a) r c : with_meta_t 'a = {
v = x;
range = r;
comments = c
}
let with_range (x:'a) (r:range) : with_meta_t 'a = with_range_and_comments x r []
[@@ PpxDerivingYoJson ]
type ident' = {
modul_name : option string;
name : string
}
[@@ PpxDerivingYoJson ]
let ident = with_meta_t ident'
let ident_to_string i = Printf.sprintf "%s%s"
(match i.v.modul_name with
| None -> ""
| Some m -> m ^ ".")
i.v.name
let ident_name i = i.v.name
exception Error of string
let error #a msg (r:range) : ML a =
raise (Error (Printf.sprintf "%s: (Error) %s\n" (string_of_pos (fst r)) msg))
let warning msg (r:range) : ML unit =
FStar.IO.print_string (Printf.sprintf "%s: (Warning) %s\n" (string_of_pos (fst r)) msg)
let check_reserved_identifier (i:ident) =
let open FStar.String in
let s = i.v.name in
if length s >= 3
&& sub s 0 3 = reserved_prefix
then error "Identifiers cannot begin with \"___\"" i.range
[@@ PpxDerivingYoJson ]
type integer_type =
| UInt8
| UInt16
| UInt32
| UInt64
let parse_int_suffix (i:string) : string * option integer_type =
let l = String.length i in
if l >= 2
then let suffix = String.sub i (l - 2) 2 in
let prefix = String.sub i 0 (l - 2) in
match suffix with
| "uy" -> prefix, Some UInt8
| "us" -> prefix, Some UInt16
| "ul" -> prefix, Some UInt32
| "uL" -> prefix, Some UInt64
| _ -> i, None
else i, None
let smallest_integer_type_of r (i:int) : ML integer_type =
if FStar.UInt.fits i 8 then UInt8
else if FStar.UInt.fits i 16 then UInt16
else if FStar.UInt.fits i 32 then UInt32
else if FStar.UInt.fits i 64 then UInt64
else error (Printf.sprintf
"Integer %d is too large for all supported fixed-width types"
i)
r
let integer_type_lub (t1 t2: integer_type) : Tot integer_type =
match t1, t2 with
| UInt64, _
| _, UInt64 -> UInt64
| _, UInt32
| UInt32, _ -> UInt32
| _, UInt16
| UInt16, _ -> UInt16
| UInt8, UInt8 -> UInt8
let integer_type_leq (t1 t2: integer_type) : bool =
integer_type_lub t1 t2 = t2
let maybe_as_integer_typ (i:ident) : Tot (option integer_type) =
if i.v.modul_name <> None
then None
else
match i.v.name with
| "UINT8" -> Some UInt8
| "UINT16" -> Some UInt16
| "UINT32" -> Some UInt32
| "UINT64" -> Some UInt64
| "UINT8BE" -> Some UInt8
| "UINT16BE" -> Some UInt16
| "UINT32BE" -> Some UInt32
| "UINT64BE" -> Some UInt64
| _ -> None
let as_integer_typ (i:ident) : ML integer_type =
match maybe_as_integer_typ i with
| None -> error ("Unknown integer type: " ^ ident_to_string i) i.range
| Some t -> t
/// Bit order for bitfields
[@@ PpxDerivingYoJson ]
type bitfield_bit_order =
| LSBFirst (* Least-significant bit first (MSVC default) *)
| MSBFirst (* Most-significant bit first (necessary for many IETF protocols) *)
let maybe_bit_order_of (i:ident) : Pure (option bitfield_bit_order)
(requires True)
(ensures (fun y ->
Some? y == Some? (maybe_as_integer_typ i)
))
= if i.v.modul_name <> None
then None
else
match i.v.name with
| "UINT8" -> Some LSBFirst
| "UINT16" -> Some LSBFirst
| "UINT32" -> Some LSBFirst
| "UINT64" -> Some LSBFirst
| "UINT8BE" -> Some MSBFirst
| "UINT16BE" -> Some MSBFirst
| "UINT32BE" -> Some MSBFirst
| "UINT64BE" -> Some MSBFirst
| _ -> None
let bit_order_of (i:ident) : ML bitfield_bit_order =
match maybe_bit_order_of i with
| None -> error ("Unknown integer type: " ^ ident_to_string i) i.range
| Some t -> t
/// Integer, hex and boolean constants
[@@ PpxDerivingYoJson ]
type constant =
| Unit
| Int : integer_type -> int -> constant
| XInt: integer_type -> string -> constant //hexadecimal constants
| Bool of bool
/// Operators supported in refinement expressions
[@@ PpxDerivingYoJson ]
type op =
| Eq
| Neq
| And
| Or
| Not
| Plus of option integer_type
| Minus of option integer_type
| Mul of option integer_type
| Division of option integer_type
| Remainder of option integer_type
| BitwiseAnd of option integer_type
| BitwiseXor of option integer_type
| BitwiseOr of option integer_type
| BitwiseNot of option integer_type
| ShiftRight of option integer_type
| ShiftLeft of option integer_type
| LT of option integer_type
| GT of option integer_type
| LE of option integer_type
| GE of option integer_type
| IfThenElse
| BitFieldOf: sz: int -> order: bitfield_bit_order -> op //BitFieldOf_n(i, from, to); the integer is the size of i in bits
| SizeOf
| Cast : from:option integer_type -> to:integer_type -> op
| Ext of string
//OffsetOf ?
/// Expressions used in refinements
/// Expressions have no binding structure
/// Names are represented using concrete identifiers, i.e., strings
/// We enforce that all names are unique in a scope, i.e., no shadowing allowed
[@@ PpxDerivingYoJson ]
noeq
type expr' =
| Constant of constant
| Identifier of ident
| Static of expr //the guard of a #if; must be made from compile-time constants only
| This
| App : op -> list expr -> expr'
and expr = with_meta_t expr'
/// A non-pointer type in the AST (see typ below) may be
/// - A spec type, i.e. a type that has an interpretation in 3d, that 3d understands
/// - An output type, may be used as the type of the parse tree constructed as part of actions
/// This includes structs and unions, and actions support assignment to fields of output types
/// - An extern type, an abstract, uninterpreted type
[@@ PpxDerivingYoJson ]
type t_kind =
| KindSpec
| KindOutput
| KindExtern
/// Syntax for output expressions
///
/// Output expressions may appear as type parameters or as lhs of assignment actions
[@@ PpxDerivingYoJson ]
noeq
type out_expr' =
| OE_id : ident -> out_expr'
| OE_star : out_expr -> out_expr'
| OE_addrof : out_expr -> out_expr'
| OE_deref : out_expr -> ident -> out_expr' //deref a field
| OE_dot : out_expr -> ident -> out_expr' //read a field
/// Output expressions maintain metadata
/// (base type, type of the expr and its bitwidth, in case the expression is of a bitfield type)
///
/// where base type is the type of the base identifier,
/// and type of the output expression
///
/// The metadata is initially None after parsing,
/// and is populated after typechecking (in Binding.fst)
///
/// It is used during emitting F* and C code
/// For each output expression, we emit an action (external function call)
/// whose signature requires all this
///
/// TODO: could we also store the source string for pretty printing?
and out_expr_meta_t = {
out_expr_base_t : typ;
out_expr_t : typ;
out_expr_bit_width : option int;
}
and out_expr = { out_expr_node: with_meta_t out_expr';
out_expr_meta: option out_expr_meta_t }
/// A type parameter is either an expression or an output expression
and typ_param = either expr out_expr
/// Types: all types are named and fully instantiated to expressions only
/// i.e., no type-parameterized types
///
/// The t_kind field maintains the kind
///
/// It is set during the desugaring phase, the parser always sets it to KindSpec
/// We could move it to the parser itself
///
/// Keeping this makes it easy to check whether a type is an output type or an extern type
/// Alternatively we would have to carry some environment along
and typ' =
| Type_app : ident -> t_kind -> list typ_param -> typ'
| Pointer : typ -> typ'
and typ = with_meta_t typ'
let field_typ = t:typ { Type_app? t.v }
[@@ PpxDerivingYoJson ]
noeq
type atomic_action =
| Action_return of expr
| Action_abort
| Action_field_pos_64
| Action_field_pos_32
| Action_field_ptr
| Action_field_ptr_after: sz:expr -> write_to:out_expr -> atomic_action
| Action_deref of ident
| Action_assignment : lhs:out_expr -> rhs:expr -> atomic_action
| Action_call : f:ident -> args:list expr -> atomic_action
noeq
[@@ PpxDerivingYoJson ]
type action' =
| Atomic_action of atomic_action
| Action_seq : hd:atomic_action -> tl:action -> action'
| Action_ite : hd:expr -> then_:action -> else_:option action -> action'
| Action_let : i:ident -> a:atomic_action -> k:action -> action'
| Action_act : action -> action'
and action = with_meta_t action'
open FStar.List.Tot
let sequence_non_failing_actions (a0:action{Action_act? a0.v}) (a1:action {Action_act? a1.v})
: a:action{Action_act? a.v}
= let rec seq (a0:action) =
let w a =
with_range_and_comments a
a1.range
(a0.comments @ a1.comments)
in
let Action_act a1 = a1.v in
match a0.v with
| Atomic_action a ->
w (Action_seq a a1)
| Action_seq a0 tl ->
w (Action_seq a0 (seq tl))
| Action_ite hd th el ->
let th = seq th in
let el =
match el with
| None -> Some a1
| Some el -> Some (seq el)
in
w (Action_ite hd th el)
| Action_let i a k ->
w (Action_let i a (seq k))
| Action_act a ->
seq a
in
let res = seq a0 in
with_range_and_comments (Action_act res)
res.range
res.comments
[@@ PpxDerivingYoJson ]
type qualifier =
| Immutable
| Mutable
/// Parameters: Type definitions can be parameterized by values
/// Parameters have a name and are always annoted with their type
[@@ PpxDerivingYoJson ]
type param = typ & ident & qualifier
[@@ PpxDerivingYoJson ]
noeq
type bitfield_attr' = {
bitfield_width : int;
bitfield_identifier : int;
bitfield_type : typ;
bitfield_from : int;
bitfield_to: int
}
and bitfield_attr = with_meta_t bitfield_attr'
[@@ PpxDerivingYoJson ]
let field_bitwidth_t = either (with_meta_t int) bitfield_attr
[@@ PpxDerivingYoJson ]
type array_qualifier =
| ByteArrayByteSize //[
| ArrayByteSize //[:byte-size
| ArrayByteSizeAtMost //[:byte-size-single-element-array-at-most
| ArrayByteSizeSingleElementArray //[:byte-size-single-element-array
[@@ PpxDerivingYoJson ]
noeq
type field_array_t =
| FieldScalar
| FieldArrayQualified of (expr & array_qualifier) //array size in bytes, the qualifier indicates whether this is a variable-length suffix or not
| FieldString of (option expr)
| FieldConsumeAll // [:consume-all]
[@@ PpxDerivingYoJson ]
noeq
type probe_call = {
probe_fn:option ident;
probe_length:expr;
probe_dest:ident
}
[@@ PpxDerivingYoJson ]
noeq
type atomic_field' = {
field_dependence:bool; //computed; whether or not the rest of the struct depends on this field
field_ident:ident; //name of the field
field_type:typ; //type of the field
field_array_opt: field_array_t;
field_constraint:option expr; //refinement constraint
field_bitwidth:option field_bitwidth_t; //bits used for the field; elaborate from Inl to Inr
field_action:option (action & bool); //bool indicates if the action depends on the field value
field_probe:option probe_call; //set in case this field has to be probed then validated
}
and atomic_field = with_meta_t atomic_field'
and field' =
| AtomicField of atomic_field
| RecordField : record -> ident -> field'
| SwitchCaseField : switch_case -> ident -> field'
and field = with_meta_t field'
and record = list field
and case =
| Case : expr -> field -> case
| DefaultCase : field -> case
and switch_case = expr & list case
[@@ PpxDerivingYoJson ]
type attribute =
| Entrypoint
| Aligned
/// Typedefs are given 2 names by convention and can be tagged as an
/// "entrypoint" for the validator
///
/// E.g.,
/// typedef [entrypoint] struct _T { ... } T, *PTR_T;
[@@ PpxDerivingYoJson ]
noeq
type typedef_names = {
typedef_name: ident;
typedef_abbrev: ident;
typedef_ptr_abbrev: ident;
typedef_attributes: list attribute
}
[@@ PpxDerivingYoJson ]
let enum_case = ident & option (either int ident)
/// Specification of output types
///
/// Output types contain atomic fields with optional bitwidths for bitfield types,
/// but they may also contain anonymous structs and unions
[@@ PpxDerivingYoJson ]
noeq
type out_field =
| Out_field_named: ident -> typ -> bit_width:option int -> out_field
| Out_field_anon : list out_field -> is_union:bool -> out_field
[@@ PpxDerivingYoJson ]
noeq
type out_typ = {
out_typ_names : typedef_names;
out_typ_fields : list out_field;
out_typ_is_union : bool; //TODO: unclear if this field is needed
}
/// A 3d specification a list of declarations
/// - Define: macro definitions for constants
/// - TypeAbbrev: macro definition of types
/// - Enum: enumerated type using existing constants or newly defined constants
/// - Record: a struct with refinements
/// - CaseType: an untagged union
///
/// - OutputType: an output type definition
/// no validators are generated for these types,
/// they are used only in the parse trees construction in the actions
/// - ExternType: An abstract type declaration
/// - ExternFn: An abstract function declaration, may be used in the actions
[@@ PpxDerivingYoJson ]
noeq
type decl' =
| ModuleAbbrev: ident -> ident -> decl'
| Define: ident -> option typ -> constant -> decl'
| TypeAbbrev: typ -> ident -> decl'
| Enum: typ -> ident -> list enum_case -> decl'
| Record: names:typedef_names -> params:list param -> where:option expr -> fields:record -> decl'
| CaseType: typedef_names -> list param -> switch_case -> decl'
| OutputType : out_typ -> decl'
| ExternType : typedef_names -> decl'
| ExternFn : ident -> typ -> list param -> decl'
| ExternProbe : ident -> decl'
[@@ PpxDerivingYoJson ]
noeq
type decl = {
d_decl : with_meta_t decl';
d_exported : bool
}
let mk_decl (d:decl') r c (is_exported:bool) : decl =
{ d_decl = with_range_and_comments d r c;
d_exported = is_exported }
let decl_with_v (d:decl) (v:decl') : decl =
{ d with d_decl = { d.d_decl with v = v } }
[@@ PpxDerivingYoJson ]
noeq
type type_refinement = {
includes:list string;
type_map:list (ident * option ident)
}
[@@ PpxDerivingYoJson ]
let prog = list decl & option type_refinement
////////////////////////////////////////////////////////////////////////////////
// Utilities
////////////////////////////////////////////////////////////////////////////////
(** Entrypoint and export definitions *)
let has_entrypoint (l:list attribute) : Tot bool =
Some? (List.Tot.tryFind (function Entrypoint -> true | _ -> false) l)
let is_entrypoint_or_export d = match d.d_decl.v with
| Record names _ _ _
| CaseType names _ _ ->
if has_entrypoint (names.typedef_attributes)
then true
else d.d_exported
| _ -> d.d_exported
let is_entrypoint d = match d.d_decl.v with
| Record names _ _ _
| CaseType names _ _ ->
has_entrypoint (names.typedef_attributes)
| _ -> false
(** Determine if there are output type expressions: which cases in
TranslateForInterpreter introduce the Output_type_expr constructor?
*)
/// Matches translate_action_assignment, translate_action_field_ptr_after
let out_expr_is_out_type_expr (lhs: out_expr) : Tot bool =
match lhs.out_expr_node.v with
| OE_star ({out_expr_node = {v=OE_id i}}) -> false
| _ -> true
/// Matches translate_atomic_action
let atomic_action_has_out_expr (a: atomic_action) : Tot bool =
match a with
| Action_field_ptr_after _ write_to
| Action_assignment write_to _
-> out_expr_is_out_type_expr write_to
| _ -> false
/// Matches translate_action
let rec action_has_out_expr (a: action) : Tot bool =
match a.v with
| Atomic_action a -> atomic_action_has_out_expr a
| Action_seq hd tl ->
if atomic_action_has_out_expr hd
then true
else action_has_out_expr tl
| Action_ite _ then_ (Some else_) ->
if action_has_out_expr then_
then true
else action_has_out_expr else_
| Action_ite _ then_ None ->
action_has_out_expr then_
| Action_let _ a k ->
if atomic_action_has_out_expr a
then true
else action_has_out_expr k
| Action_act a ->
action_has_out_expr a
let field_action_has_out_expr
(f: option (action & bool))
: Tot bool
= match f with
| None -> false
| Some (a, _) -> action_has_out_expr a
/// Matches translate_atomic_field
let atomic_field_has_out_expr (f: atomic_field) : Tot bool =
let sf = f.v in
field_action_has_out_expr sf.field_action
/// Matches field_as_grouped_fields
let rec field_has_out_expr (f: field) : Tot bool =
match f.v with
| AtomicField af ->
atomic_field_has_out_expr af
| RecordField fs _ ->
record_has_out_expr fs
| SwitchCaseField sw _ ->
switch_case_has_out_expr sw
and record_has_out_expr (fs: record) : Tot bool =
match fs with
| [] -> false
| f :: fs' ->
if field_has_out_expr f
then true
else record_has_out_expr fs'
and switch_case_has_out_expr (sw: switch_case) : Tot bool =
let (_, c) = sw in
cases_have_out_expr c
and cases_have_out_expr (cs: list case) : Tot bool =
match cs with
| [] -> false
| c :: cs ->
if case_has_out_expr c
then true
else cases_have_out_expr cs
and case_has_out_expr (c: case) : Tot bool =
match c with
| Case _ f
| DefaultCase f
->
field_has_out_expr f
/// Matches parse_field
let decl_has_out_expr (d: decl) : Tot bool =
match d.d_decl.v with
| Record _ _ _ ast_fields ->
record_has_out_expr ast_fields
| CaseType _ _ switch_case ->
switch_case_has_out_expr switch_case
| _ -> false
(** Equality on expressions and types **)
/// eq_expr partially decides equality on expressions, by requiring
/// syntactic equality
let rec eq_expr (e1 e2:expr) : Tot bool (decreases e1) =
match e1.v, e2.v with
| Constant i, Constant j -> i = j
| Identifier i, Identifier j -> i.v = j.v
| This, This -> true
| App op1 es1, App op2 es2 ->
op1 = op2
&& eq_exprs es1 es2
| _ -> false
and eq_exprs (es1 es2:list expr) : Tot bool =
match es1, es2 with
| [], [] -> true
| hd1::es1, hd2::es2 -> eq_expr hd1 hd2 && eq_exprs es1 es2
| _ -> false
let eq_idents (i1 i2:ident) : Tot bool =
i1.v.modul_name = i2.v.modul_name && i1.v.name = i2.v.name
/// eq_typ: syntactic equalty of types
let rec eq_out_expr (o1 o2:out_expr) : bool =
match o1.out_expr_node.v, o2.out_expr_node.v with
| OE_id i1, OE_id i2 -> eq_idents i1 i2
| OE_star o1, OE_star o2
| OE_addrof o1, OE_addrof o2 -> eq_out_expr o1 o2
| OE_deref o1 i1, OE_deref o2 i2
| OE_dot o1 i1, OE_dot o2 i2 -> eq_idents i1 i2 && eq_out_expr o1 o2
| _ -> false
let eq_typ_param (p1 p2:typ_param) : bool =
match p1, p2 with
| Inl e1, Inl e2 -> eq_expr e1 e2
| Inr o1, Inr o2 -> eq_out_expr o1 o2
| _ -> false
let rec eq_typ_params (ps1 ps2:list typ_param) : bool =
match ps1, ps2 with
| [], [] -> true
| p1::ps1, p2::ps2 -> eq_typ_param p1 p2 && eq_typ_params ps1 ps2
| _ -> false
let rec eq_typ (t1 t2:typ) : Tot bool =
match t1.v, t2.v with
| Type_app hd1 k1 ps1, Type_app hd2 k2 ps2 ->
eq_idents hd1 hd2
&& k1 = k2
&& eq_typ_params ps1 ps2
| Pointer t1, Pointer t2 ->
eq_typ t1 t2
| _ -> false
(** Common AST constants and builders **)
let dummy_range = dummy_pos, dummy_pos
let with_dummy_range x = with_range x dummy_range
let to_ident' x = {modul_name=None;name=x}
let mk_prim_t x = with_dummy_range (Type_app (with_dummy_range (to_ident' x)) KindSpec [])
let tbool = mk_prim_t "Bool"
let tunit = mk_prim_t "unit"
let tuint8 = mk_prim_t "UINT8"
let tuint8be = mk_prim_t "UINT8BE"
let puint8 = mk_prim_t "PUINT8"
let tuint16 = mk_prim_t "UINT16"
let tuint32 = mk_prim_t "UINT32"
let tuint64 = mk_prim_t "UINT64"
let tcopybuffer = mk_prim_t "EVERPARSE_COPY_BUFFER_T"
let tunknown = mk_prim_t "?"
let unit_atomic_field rng =
let dummy_identifier = with_range (to_ident' "_empty_") rng in
let f = {
field_dependence=false;
field_ident=dummy_identifier;
field_type=tunit;
field_array_opt=FieldScalar;
field_constraint=None;
field_bitwidth=None;
field_action=None;
field_probe=None
} in
with_range f rng
let map_opt (f:'a -> ML 'b) (o:option 'a) : ML (option 'b) =
match o with
| None -> None
| Some x -> Some (f x)
////////////////////////////////////////////////////////////////////////////////
// Substitutions
////////////////////////////////////////////////////////////////////////////////
module H = Hashtable
let subst = H.t ident' expr
let mk_subst (s:list (ident * expr)) : ML subst =
let h = H.create 10 in
List.iter (fun (i, e) -> H.insert h i.v e) s;
h
let apply (s:subst) (id:ident) : ML expr =
match H.try_find s id.v with
| None -> with_range (Identifier id) id.range
| Some e -> e
let rec subst_expr (s:subst) (e:expr) : ML expr =
match e.v with
| Constant _
| This -> e
| Identifier i -> apply s i
| Static e -> { e with v = Static (subst_expr s e) }
| App op es -> {e with v = App op (List.map (subst_expr s) es)}
let subst_atomic_action (s:subst) (aa:atomic_action) : ML atomic_action =
match aa with
| Action_return e -> Action_return (subst_expr s e)
| Action_assignment lhs rhs -> Action_assignment lhs (subst_expr s rhs)
| Action_call f args -> Action_call f (List.map (subst_expr s) args)
| _ -> aa //action mutable identifiers are not subject to substitution
let rec subst_action (s:subst) (a:action) : ML action =
match a.v with
| Atomic_action aa -> {a with v = Atomic_action (subst_atomic_action s aa)}
| Action_seq hd tl -> {a with v = Action_seq (subst_atomic_action s hd) (subst_action s tl) }
| Action_ite hd then_ else_ -> {a with v = Action_ite (subst_expr s hd) (subst_action s then_) (subst_action_opt s else_) }
| Action_let i aa k -> {a with v = Action_let i (subst_atomic_action s aa) (subst_action s k) }
| Action_act a -> {a with v = Action_act (subst_action s a) }
and subst_action_opt (s:subst) (a:option action) : ML (option action) =
match a with
| None -> None
| Some a -> Some (subst_action s a)
//No need to substitute in output expressions
let subst_out_expr (s:subst) (o:out_expr) : out_expr = o
let subst_typ_param (s:subst) (p:typ_param) : ML typ_param =
match p with
| Inl e -> Inl (subst_expr s e)
| Inr oe -> Inr (subst_out_expr s oe)
let rec subst_typ (s:subst) (t:typ) : ML typ =
match t.v with
| Type_app hd k ps -> { t with v = Type_app hd k (List.map (subst_typ_param s) ps) }
| Pointer t -> {t with v = Pointer (subst_typ s t) }
let subst_field_array (s:subst) (f:field_array_t) : ML field_array_t =
match f with
| FieldScalar -> f
| FieldArrayQualified (e, q) -> FieldArrayQualified (subst_expr s e, q)
| FieldString sz -> FieldString (map_opt (subst_expr s) sz)
| FieldConsumeAll -> f
let rec subst_field (s:subst) (ff:field) : ML field =
match ff.v with
| AtomicField f -> {ff with v = AtomicField (subst_atomic_field s f)}
| RecordField f i -> {ff with v = RecordField (subst_record s f) i}
| SwitchCaseField f i -> {ff with v = SwitchCaseField (subst_switch_case s f) i}
and subst_atomic_field (s:subst) (f:atomic_field) : ML atomic_field =
let sf = f.v in
let a =
match sf.field_action with
| None -> None
| Some (a, b) -> Some (subst_action s a, b)
in
let sf = {
sf with
field_type = subst_typ s sf.field_type;
field_array_opt = subst_field_array s sf.field_array_opt;
field_constraint = map_opt (subst_expr s) sf.field_constraint;
field_action = a
} in
{ f with v = sf }
and subst_record (s:subst) (f:record) : ML record
= List.map (subst_field s) f
and subst_case (s:subst) (c:case) : ML case =
match c with
| Case e f -> Case (subst_expr s e) (subst_field s f)
| DefaultCase f -> DefaultCase (subst_field s f)
and subst_switch_case (s:subst) (sc:switch_case) : ML switch_case =
subst_expr s (fst sc), List.map (subst_case s) (snd sc)
let subst_params (s:subst) (p:list param) : ML (list param) =
List.map (fun (t, i, q) -> subst_typ s t, i, q) p
let subst_decl' (s:subst) (d:decl') : ML decl' =
match d with
| ModuleAbbrev _ _ -> d
| Define i None _ -> d
| Define i (Some t) c -> Define i (Some (subst_typ s t)) c
| TypeAbbrev t i -> TypeAbbrev (subst_typ s t) i
| Enum t i is -> Enum (subst_typ s t) i is
| Record names params where fields ->
Record names (subst_params s params) (map_opt (subst_expr s) where) (List.map (subst_field s) fields)
| CaseType names params cases ->
CaseType names (subst_params s params) (subst_switch_case s cases)
| OutputType _
| ExternType _
| ExternFn _ _ _
| ExternProbe _ -> d
let subst_decl (s:subst) (d:decl) : ML decl = decl_with_v d (subst_decl' s d.d_decl.v)
(*** Printing the source AST; for debugging only **)
let print_constant (c:constant) =
let print_tag = function
| UInt8 -> "uy"
| UInt16 -> "us"
| UInt32 -> "ul"
| UInt64 -> "uL"
in
match c with
| Unit -> "()"
| Int tag i -> Printf.sprintf "%d%s" i (print_tag tag)
| XInt tag x ->
let tag = print_tag tag in
if String.length x >= 2
&& String.sub x (String.length x - 2) 2 = tag
then x
else Printf.sprintf "%s%s" x tag
| Bool b -> Printf.sprintf "%b" b
let print_ident (i:ident) = ident_to_string i
let print_integer_type = function
| UInt8 -> "UINT8"
| UInt16 -> "UINT16"
| UInt32 -> "UINT32"
| UInt64 -> "UINT64"
let print_bitfield_bit_order = function
| LSBFirst -> "LSBFirst"
| MSBFirst -> "MSBFirst"
let print_op = function
| Eq -> "="
| Neq -> "!="
| And -> "&&"
| Or -> "||"
| Not -> "!"
| Plus _ -> "+"
| Minus _ -> "-"
| Mul _ -> "*"
| Division _ -> "/"
| Remainder _ -> "%"
| BitwiseAnd _ -> "&"
| BitwiseOr _ -> "|"
| BitwiseXor _ -> "^"
| BitwiseNot _ -> "~"
| ShiftLeft _ -> "<<"
| ShiftRight _ -> ">>"
| LT _ -> "<"
| GT _ -> ">"
| LE _ -> "<="
| GE _ -> ">="
| IfThenElse -> "ifthenelse"
| BitFieldOf i o -> Printf.sprintf "bitfield_of(%d, %s)" i (print_bitfield_bit_order o)
| SizeOf -> "sizeof"
| Cast _ t -> "(" ^ print_integer_type t ^ ")"
| Ext s -> s
let rec print_expr (e:expr) : Tot string =
match e.v with
| Constant c ->
print_constant c
| Identifier i ->
print_ident i
| This ->
"this"
| Static e ->
Printf.sprintf "static(%s)" (print_expr e)
| App Eq [e1; e2] ->
Printf.sprintf "(%s = %s)" (print_expr e1) (print_expr e2)
| App And [e1; e2] ->
Printf.sprintf "(%s && %s)" (print_expr e1) (print_expr e2)
| App Or [e1; e2] ->
Printf.sprintf "(%s || %s)" (print_expr e1) (print_expr e2)
| App Not [e1] ->
Printf.sprintf "(! %s)" (print_expr e1)
| App (BitwiseNot _) [e1] ->
Printf.sprintf "(~ %s)" (print_expr e1)
| App (Plus _) [e1; e2]
| App (Minus _) [e1; e2]
| App (Mul _) [e1; e2]
| App (Division _) [e1; e2]
| App (Remainder _) [e1; e2]
| App (BitwiseAnd _) [e1; e2]
| App (BitwiseOr _) [e1; e2]
| App (BitwiseXor _) [e1; e2]
| App (ShiftLeft _) [e1; e2]
| App (ShiftRight _) [e1; e2]
| App (LT _) [e1; e2]
| App (GT _) [e1; e2]
| App (LE _) [e1; e2]
| App (GE _) [e1; e2] ->
let op = App?._0 e.v in
Printf.sprintf "(%s %s %s)" (print_expr e1) (print_op op) (print_expr e2)
| App SizeOf [e1] ->
Printf.sprintf "(sizeof %s)" (print_expr e1)
| App (Cast i j) [e] ->
Printf.sprintf "%s %s" (print_op (Cast i j)) (print_expr e)
| App (Ext s) es ->
Printf.sprintf "%s(%s)" (print_op (Ext s)) (String.concat ", " (print_exprs es))
| App op es ->
Printf.sprintf "(?? %s %s)" (print_op op) (String.concat ", " (print_exprs es))
and print_exprs (es:list expr) : Tot (list string) =
match es with
| [] -> []
| hd::tl -> print_expr hd :: print_exprs tl
let rec print_out_expr o : ML string =
match o.out_expr_node.v with
| OE_id i -> ident_to_string i
| OE_star o -> Printf.sprintf "*(%s)" (print_out_expr o)
| OE_addrof o -> Printf.sprintf "&(%s)" (print_out_expr o)
| OE_deref o i -> Printf.sprintf "(%s)->(%s)" (print_out_expr o) (ident_to_string i)
| OE_dot o i -> Printf.sprintf "(%s).(%s)" (print_out_expr o) (ident_to_string i)
let print_typ_param p : ML string =
match p with
| Inl e -> print_expr e
| Inr o -> print_out_expr o
let rec print_typ t : ML string =
match t.v with
| Type_app i _k ps ->
begin
match ps with
| [] -> ident_to_string i
| _ ->
Printf.sprintf "%s(%s)"
(ident_to_string i)
(String.concat ", " (List.map print_typ_param ps))
end
| Pointer t ->
Printf.sprintf "(pointer %s)"
(print_typ t)
let typ_as_integer_type (t:typ) : ML integer_type =
match t.v with
| Type_app i _k [] -> as_integer_typ i
| _ -> error ("Expected an integer type; got: " ^ (print_typ t)) t.range
let bit_order_of_typ (t:typ) : ML bitfield_bit_order =
match t.v with
| Type_app i _k [] -> bit_order_of i
| _ -> error ("Expected an integer type; got: " ^ (print_typ t)) t.range
let print_qual = function
| Mutable -> "mutable"
| Immutable -> ""
let print_params (ps:list param) =
match ps with
| [] -> ""
| _ ->
Printf.sprintf "(%s)"
(String.concat ", "
(ps |> List.map
(fun (t, p, q) ->
Printf.sprintf "%s%s %s"
(print_qual q)
(print_typ t)
(print_ident p))))
let print_opt (o:option 'a) (f:'a -> string) : string =
match o with
| None -> ""
| Some x -> f x
let print_bitfield (bf:option field_bitwidth_t) =
match bf with
| None -> ""
| Some (Inl x) -> Printf.sprintf ": %d " x.v
| Some (Inr {v=a}) ->
Printf.sprintf ": (|width=%d, id=%d, type=%s, from=%d, to=%d|) "
a.bitfield_width a.bitfield_identifier
(print_typ a.bitfield_type)
a.bitfield_from a.bitfield_to
let rec print_field (f:field) : ML string =
let field =
match f.v with
| AtomicField f -> print_atomic_field f
| RecordField f i -> Printf.sprintf "%s %s" (print_record f) i.v.name
| SwitchCaseField f i -> Printf.sprintf "%s %s" (print_switch_case f) i.v. name
in
match f.comments with
| [] -> field
| comms -> Printf.sprintf "//%s\n%s" (String.concat "; " comms) field
and print_record (f:record) : ML string =
List.map print_field f |>
String.concat ";\n"
and print_atomic_field (f:atomic_field) : ML string =
let print_array eq : Tot string =
match eq with
| FieldScalar -> ""
| FieldArrayQualified (e, q) ->
begin match q with
| ByteArrayByteSize -> Printf.sprintf "[%s]" (print_expr e)
| ArrayByteSize -> Printf.sprintf "[:byte-size %s]" (print_expr e)
| ArrayByteSizeAtMost -> Printf.sprintf "[:byte-size-single-element-array-at-most %s]" (print_expr e)
| ArrayByteSizeSingleElementArray -> Printf.sprintf "[:byte-size-single-element-array %s]" (print_expr e)
end
| FieldString None -> Printf.sprintf "[::zeroterm]"
| FieldString (Some sz) -> Printf.sprintf "[:zeroterm-byte-size-at-most %s]" (print_expr sz)
| FieldConsumeAll -> Printf.sprintf "[:consume-all]"
in
let sf = f.v in
Printf.sprintf "%s%s %s%s%s%s%s;"
(if sf.field_dependence then "dependent " else "")
(print_typ sf.field_type)
(print_ident sf.field_ident)
(print_bitfield sf.field_bitwidth)
(print_array sf.field_array_opt)
(print_opt sf.field_constraint (fun e -> Printf.sprintf "{%s}" (print_expr e)))
(print_opt sf.field_probe
(fun p -> Printf.sprintf "probe %s (length=%s, destination=%s)"
(print_opt p.probe_fn print_ident)
(print_expr p.probe_length)
(print_ident p.probe_dest)))
and print_switch_case (s:switch_case) : ML string =
let head, cases = s in
let print_case (c:case) : ML string =
match c with
| Case e f ->
Printf.sprintf "case %s: %s;"
(print_expr e)
(print_field f)
| DefaultCase f ->
Printf.sprintf "default: %s;"
(print_field f)
in
Printf.sprintf "switch (%s) {\n
%s\n\
}"
(print_expr head)
(String.concat "\n" (List.map print_case cases))
let print_decl' (d:decl') : ML string =
match d with
| ModuleAbbrev i m -> Printf.sprintf "module %s = %s" (print_ident i) (print_ident m)
| Define i None c ->
Printf.sprintf "#define %s %s;" (print_ident i) (print_constant c)
| Define i (Some t) c ->
Printf.sprintf "#define %s : %s %s;" (print_ident i) (print_typ t) (print_constant c)
| TypeAbbrev t i ->
Printf.sprintf "typedef %s %s;" (print_typ t) (print_ident i)
| Enum t i ls ->
let print_enum_case (i, jopt) =
match jopt with
| None -> print_ident i
| Some (Inl j) -> Printf.sprintf "%s = %d" (print_ident i) j
| Some (Inr j) -> Printf.sprintf "%s = %s" (print_ident i) (print_ident j)
in
Printf.sprintf "%s enum %s {\n\
%s \n\
}"
(print_typ t)
(ident_to_string i)
(String.concat ",\n" (List.map print_enum_case ls))
| Record td params wopt fields ->
Printf.sprintf "typedef struct %s%s%s {\n\
%s \n\
} %s, *%s"
(ident_to_string td.typedef_name)
(print_params params)
(match wopt with | None -> "" | Some e -> " where " ^ print_expr e)
(String.concat "\n" (List.map print_field fields))
(ident_to_string td.typedef_abbrev)
(ident_to_string td.typedef_ptr_abbrev)
| CaseType td params switch_case ->
Printf.sprintf "casetype %s%s {\n\
%s \n\
} %s, *%s"
(ident_to_string td.typedef_name)
(print_params params)
(print_switch_case switch_case)
(ident_to_string td.typedef_abbrev)
(ident_to_string td.typedef_ptr_abbrev)
| OutputType out_t -> "Printing for output types is TBD"
| ExternType _ -> "Printing for extern types is TBD"
| ExternFn _ _ _
| ExternProbe _ -> "Printing for extern functions is TBD"
let print_decl (d:decl) : ML string =
match d.d_decl.comments with
| [] -> print_decl' d.d_decl.v
| cs -> Printf.sprintf "/* %s */\n%s"
(String.concat "\n" cs)
(print_decl' d.d_decl.v)
let print_decls (ds:list decl) : ML string =
List.map print_decl ds
|> String.concat "\n"
type weak_kind =
| WeakKindWeak
| WeakKindStrongPrefix
| WeakKindConsumesAll
let print_weak_kind (k: weak_kind) : Tot string =
match k with
| WeakKindConsumesAll -> "WeakKindConsumesAll"
| WeakKindStrongPrefix -> "WeakKindStrongPrefix"
| WeakKindWeak -> "WeakKindWeak"
let weak_kind_glb (w1 w2: weak_kind) : Tot weak_kind =
if w1 = w2
then w1
else WeakKindWeak
let field_tag_equal (f0 f1:field) =
match f0.v, f1.v with
| AtomicField _, AtomicField _
| RecordField _ _, RecordField _ _
| SwitchCaseField _ _, SwitchCaseField _ _ -> true
| _ -> false
(* Pruning actions out of the surface ast (to generate validators checking Z3 test cases) *)
let atomic_field'_prune_actions
(a: atomic_field')
: Tot atomic_field'
= { a with field_action = None }
let atomic_field_prune_actions
(a: atomic_field)
: Tot atomic_field
= { a with v = atomic_field'_prune_actions a.v } | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.ST.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Ast.fst"
} | [
{
"abbrev": true,
"full_module": "Hashtable",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"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
}
] | {
"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"
} | false | s: Ast.switch_case -> Ast.switch_case | Prims.Tot | [
"total"
] | [
"field'_prune_actions",
"field_prune_actions",
"record_prune_actions",
"case_prune_actions",
"cases_prune_actions",
"switch_case_prune_actions"
] | [
"Ast.switch_case",
"Ast.expr",
"Prims.list",
"Ast.case",
"FStar.Pervasives.Native.Mktuple2",
"Ast.cases_prune_actions"
] | [
"mutual recursion"
] | false | false | false | true | false | let rec switch_case_prune_actions (s: switch_case) : Tot switch_case =
| let e, l = s in
(e, cases_prune_actions l) | false |
FStar.UInt16.fst | FStar.UInt16.lognot | val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z)) | val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z)) | let lognot x = Mk (lognot (v x)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 71,
"start_col": 0,
"start_line": 71
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.lognot",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let lognot x =
| Mk (lognot (v x)) | false |
Message.fst | Message.message | val message : Prims.string | let message = "Hello World!\n" | {
"file_name": "examples/dependencies/Message.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | (*
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 Message | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Message.fst"
} | [
{
"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
}
] | {
"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"
} | false | Prims.string | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let message =
| "Hello World!\n" | false |
|
FStar.UInt16.fst | FStar.UInt16.logand | val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z)) | val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z)) | let logand x y = Mk (logand (v x) (v y)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 65,
"start_col": 0,
"start_line": 65
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.UInt16.t -> y: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.logand",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let logand x y =
| Mk (logand (v x) (v y)) | false |
Ast.fst | Ast.cases_prune_actions | val cases_prune_actions (l: list case) : Tot (list case) | val cases_prune_actions (l: list case) : Tot (list case) | let rec field'_prune_actions
(f: field')
: Tot field'
= match f with
| AtomicField a -> AtomicField (atomic_field_prune_actions a)
| RecordField r i -> RecordField (record_prune_actions r) i
| SwitchCaseField s i -> SwitchCaseField (switch_case_prune_actions s) i
and field_prune_actions
(f: field)
: Tot field
= { f with v = field'_prune_actions f.v }
and record_prune_actions (r: record) : Tot record =
match r with
| [] -> []
| f :: r' -> field_prune_actions f :: record_prune_actions r'
and case_prune_actions (c: case) : Tot case =
match c with
| Case e f -> Case e (field_prune_actions f)
| DefaultCase f -> DefaultCase (field_prune_actions f)
and cases_prune_actions (l: list case) : Tot (list case) =
match l with
| [] -> []
| c :: l' -> case_prune_actions c :: cases_prune_actions l'
and switch_case_prune_actions (s: switch_case) : Tot switch_case =
let (e, l) = s in
(e, cases_prune_actions l) | {
"file_name": "src/3d/Ast.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 1279,
"start_col": 0,
"start_line": 1249
} | (*
Copyright 2019 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 Ast
(* The source abstract syntax for the 3d frontend to EverParse *)
open FStar.All
let reserved_prefix = "___"
//redefining either because we need to serialize to Json
[@@ PpxDerivingYoJson ]
type either a b =
| Inl of a
| Inr of b
/// pos: Source locations
type pos = {
filename: string;
line:int;
col:int
}
noeq
type comments_buffer_t = {
push: string & pos & pos -> ML unit;
flush: unit -> ML (list string);
flush_until: pos -> ML (list string);
}
#push-options "--warn_error -272" //top-level effect; ok
let comments_buffer : comments_buffer_t =
let buffer : ref (list (string & pos & pos)) = FStar.ST.alloc [] in
let buffer_comment (c, s, p) =
let c = String.substring c 2 (String.length c - 2) in
buffer := (c, s, p) :: !buffer
in
let flush_comments () =
let cs = !buffer in
buffer := [];
(List.rev cs) |> List.map (fun (c, _, _) -> c)
in
let flush_until pos : ML (list string) =
let cs = !buffer in
let preceding, following =
List.partition (fun (c, _, end_pos) ->
Options.debug_print_string
(Printf.sprintf "Requesting comments until line %d,\nAt line %d we have comment (*%s*)\n"
pos.line
end_pos.line
c);
end_pos.line <= pos.line) cs
in
buffer := following;
preceding |> List.map (fun (c, _, _) -> c)
in
{
push = buffer_comment;
flush = flush_comments;
flush_until = flush_until
}
#pop-options
let string_of_pos p =
Printf.sprintf "%s:(%d,%d)" p.filename p.line p.col
/// range: A source extent
let range = pos * pos
/// comment: A list of line comments, i.e., a list of strings
let comments = list string
let string_of_range r =
let p, q = r in
if p.filename = q.filename
then Printf.sprintf "%s:(%d,%d--%d,%d)"
p.filename p.line p.col q.line q.col
else Printf.sprintf "%s -- %s"
(string_of_pos p)
(string_of_pos q)
let dummy_pos = {
filename="";
line=0;
col=0;
}
noeq
type with_meta_t 'a = {
v:'a;
range:range;
comments: comments
}
(* Override the json serializers for with_meta_t to
avoid polluting the generated JSON with ranges everywhere *)
let with_meta_t_of_yojson (#a #b #c:Type) (f:(a -> b)) (x:a)
: ML c
= failwith "No reading yojson"
let with_meta_t_to_yojson (f:('a -> 'b)) (x:with_meta_t 'a)
: 'b
= f x.v
let with_range_and_comments (x:'a) r c : with_meta_t 'a = {
v = x;
range = r;
comments = c
}
let with_range (x:'a) (r:range) : with_meta_t 'a = with_range_and_comments x r []
[@@ PpxDerivingYoJson ]
type ident' = {
modul_name : option string;
name : string
}
[@@ PpxDerivingYoJson ]
let ident = with_meta_t ident'
let ident_to_string i = Printf.sprintf "%s%s"
(match i.v.modul_name with
| None -> ""
| Some m -> m ^ ".")
i.v.name
let ident_name i = i.v.name
exception Error of string
let error #a msg (r:range) : ML a =
raise (Error (Printf.sprintf "%s: (Error) %s\n" (string_of_pos (fst r)) msg))
let warning msg (r:range) : ML unit =
FStar.IO.print_string (Printf.sprintf "%s: (Warning) %s\n" (string_of_pos (fst r)) msg)
let check_reserved_identifier (i:ident) =
let open FStar.String in
let s = i.v.name in
if length s >= 3
&& sub s 0 3 = reserved_prefix
then error "Identifiers cannot begin with \"___\"" i.range
[@@ PpxDerivingYoJson ]
type integer_type =
| UInt8
| UInt16
| UInt32
| UInt64
let parse_int_suffix (i:string) : string * option integer_type =
let l = String.length i in
if l >= 2
then let suffix = String.sub i (l - 2) 2 in
let prefix = String.sub i 0 (l - 2) in
match suffix with
| "uy" -> prefix, Some UInt8
| "us" -> prefix, Some UInt16
| "ul" -> prefix, Some UInt32
| "uL" -> prefix, Some UInt64
| _ -> i, None
else i, None
let smallest_integer_type_of r (i:int) : ML integer_type =
if FStar.UInt.fits i 8 then UInt8
else if FStar.UInt.fits i 16 then UInt16
else if FStar.UInt.fits i 32 then UInt32
else if FStar.UInt.fits i 64 then UInt64
else error (Printf.sprintf
"Integer %d is too large for all supported fixed-width types"
i)
r
let integer_type_lub (t1 t2: integer_type) : Tot integer_type =
match t1, t2 with
| UInt64, _
| _, UInt64 -> UInt64
| _, UInt32
| UInt32, _ -> UInt32
| _, UInt16
| UInt16, _ -> UInt16
| UInt8, UInt8 -> UInt8
let integer_type_leq (t1 t2: integer_type) : bool =
integer_type_lub t1 t2 = t2
let maybe_as_integer_typ (i:ident) : Tot (option integer_type) =
if i.v.modul_name <> None
then None
else
match i.v.name with
| "UINT8" -> Some UInt8
| "UINT16" -> Some UInt16
| "UINT32" -> Some UInt32
| "UINT64" -> Some UInt64
| "UINT8BE" -> Some UInt8
| "UINT16BE" -> Some UInt16
| "UINT32BE" -> Some UInt32
| "UINT64BE" -> Some UInt64
| _ -> None
let as_integer_typ (i:ident) : ML integer_type =
match maybe_as_integer_typ i with
| None -> error ("Unknown integer type: " ^ ident_to_string i) i.range
| Some t -> t
/// Bit order for bitfields
[@@ PpxDerivingYoJson ]
type bitfield_bit_order =
| LSBFirst (* Least-significant bit first (MSVC default) *)
| MSBFirst (* Most-significant bit first (necessary for many IETF protocols) *)
let maybe_bit_order_of (i:ident) : Pure (option bitfield_bit_order)
(requires True)
(ensures (fun y ->
Some? y == Some? (maybe_as_integer_typ i)
))
= if i.v.modul_name <> None
then None
else
match i.v.name with
| "UINT8" -> Some LSBFirst
| "UINT16" -> Some LSBFirst
| "UINT32" -> Some LSBFirst
| "UINT64" -> Some LSBFirst
| "UINT8BE" -> Some MSBFirst
| "UINT16BE" -> Some MSBFirst
| "UINT32BE" -> Some MSBFirst
| "UINT64BE" -> Some MSBFirst
| _ -> None
let bit_order_of (i:ident) : ML bitfield_bit_order =
match maybe_bit_order_of i with
| None -> error ("Unknown integer type: " ^ ident_to_string i) i.range
| Some t -> t
/// Integer, hex and boolean constants
[@@ PpxDerivingYoJson ]
type constant =
| Unit
| Int : integer_type -> int -> constant
| XInt: integer_type -> string -> constant //hexadecimal constants
| Bool of bool
/// Operators supported in refinement expressions
[@@ PpxDerivingYoJson ]
type op =
| Eq
| Neq
| And
| Or
| Not
| Plus of option integer_type
| Minus of option integer_type
| Mul of option integer_type
| Division of option integer_type
| Remainder of option integer_type
| BitwiseAnd of option integer_type
| BitwiseXor of option integer_type
| BitwiseOr of option integer_type
| BitwiseNot of option integer_type
| ShiftRight of option integer_type
| ShiftLeft of option integer_type
| LT of option integer_type
| GT of option integer_type
| LE of option integer_type
| GE of option integer_type
| IfThenElse
| BitFieldOf: sz: int -> order: bitfield_bit_order -> op //BitFieldOf_n(i, from, to); the integer is the size of i in bits
| SizeOf
| Cast : from:option integer_type -> to:integer_type -> op
| Ext of string
//OffsetOf ?
/// Expressions used in refinements
/// Expressions have no binding structure
/// Names are represented using concrete identifiers, i.e., strings
/// We enforce that all names are unique in a scope, i.e., no shadowing allowed
[@@ PpxDerivingYoJson ]
noeq
type expr' =
| Constant of constant
| Identifier of ident
| Static of expr //the guard of a #if; must be made from compile-time constants only
| This
| App : op -> list expr -> expr'
and expr = with_meta_t expr'
/// A non-pointer type in the AST (see typ below) may be
/// - A spec type, i.e. a type that has an interpretation in 3d, that 3d understands
/// - An output type, may be used as the type of the parse tree constructed as part of actions
/// This includes structs and unions, and actions support assignment to fields of output types
/// - An extern type, an abstract, uninterpreted type
[@@ PpxDerivingYoJson ]
type t_kind =
| KindSpec
| KindOutput
| KindExtern
/// Syntax for output expressions
///
/// Output expressions may appear as type parameters or as lhs of assignment actions
[@@ PpxDerivingYoJson ]
noeq
type out_expr' =
| OE_id : ident -> out_expr'
| OE_star : out_expr -> out_expr'
| OE_addrof : out_expr -> out_expr'
| OE_deref : out_expr -> ident -> out_expr' //deref a field
| OE_dot : out_expr -> ident -> out_expr' //read a field
/// Output expressions maintain metadata
/// (base type, type of the expr and its bitwidth, in case the expression is of a bitfield type)
///
/// where base type is the type of the base identifier,
/// and type of the output expression
///
/// The metadata is initially None after parsing,
/// and is populated after typechecking (in Binding.fst)
///
/// It is used during emitting F* and C code
/// For each output expression, we emit an action (external function call)
/// whose signature requires all this
///
/// TODO: could we also store the source string for pretty printing?
and out_expr_meta_t = {
out_expr_base_t : typ;
out_expr_t : typ;
out_expr_bit_width : option int;
}
and out_expr = { out_expr_node: with_meta_t out_expr';
out_expr_meta: option out_expr_meta_t }
/// A type parameter is either an expression or an output expression
and typ_param = either expr out_expr
/// Types: all types are named and fully instantiated to expressions only
/// i.e., no type-parameterized types
///
/// The t_kind field maintains the kind
///
/// It is set during the desugaring phase, the parser always sets it to KindSpec
/// We could move it to the parser itself
///
/// Keeping this makes it easy to check whether a type is an output type or an extern type
/// Alternatively we would have to carry some environment along
and typ' =
| Type_app : ident -> t_kind -> list typ_param -> typ'
| Pointer : typ -> typ'
and typ = with_meta_t typ'
let field_typ = t:typ { Type_app? t.v }
[@@ PpxDerivingYoJson ]
noeq
type atomic_action =
| Action_return of expr
| Action_abort
| Action_field_pos_64
| Action_field_pos_32
| Action_field_ptr
| Action_field_ptr_after: sz:expr -> write_to:out_expr -> atomic_action
| Action_deref of ident
| Action_assignment : lhs:out_expr -> rhs:expr -> atomic_action
| Action_call : f:ident -> args:list expr -> atomic_action
noeq
[@@ PpxDerivingYoJson ]
type action' =
| Atomic_action of atomic_action
| Action_seq : hd:atomic_action -> tl:action -> action'
| Action_ite : hd:expr -> then_:action -> else_:option action -> action'
| Action_let : i:ident -> a:atomic_action -> k:action -> action'
| Action_act : action -> action'
and action = with_meta_t action'
open FStar.List.Tot
let sequence_non_failing_actions (a0:action{Action_act? a0.v}) (a1:action {Action_act? a1.v})
: a:action{Action_act? a.v}
= let rec seq (a0:action) =
let w a =
with_range_and_comments a
a1.range
(a0.comments @ a1.comments)
in
let Action_act a1 = a1.v in
match a0.v with
| Atomic_action a ->
w (Action_seq a a1)
| Action_seq a0 tl ->
w (Action_seq a0 (seq tl))
| Action_ite hd th el ->
let th = seq th in
let el =
match el with
| None -> Some a1
| Some el -> Some (seq el)
in
w (Action_ite hd th el)
| Action_let i a k ->
w (Action_let i a (seq k))
| Action_act a ->
seq a
in
let res = seq a0 in
with_range_and_comments (Action_act res)
res.range
res.comments
[@@ PpxDerivingYoJson ]
type qualifier =
| Immutable
| Mutable
/// Parameters: Type definitions can be parameterized by values
/// Parameters have a name and are always annoted with their type
[@@ PpxDerivingYoJson ]
type param = typ & ident & qualifier
[@@ PpxDerivingYoJson ]
noeq
type bitfield_attr' = {
bitfield_width : int;
bitfield_identifier : int;
bitfield_type : typ;
bitfield_from : int;
bitfield_to: int
}
and bitfield_attr = with_meta_t bitfield_attr'
[@@ PpxDerivingYoJson ]
let field_bitwidth_t = either (with_meta_t int) bitfield_attr
[@@ PpxDerivingYoJson ]
type array_qualifier =
| ByteArrayByteSize //[
| ArrayByteSize //[:byte-size
| ArrayByteSizeAtMost //[:byte-size-single-element-array-at-most
| ArrayByteSizeSingleElementArray //[:byte-size-single-element-array
[@@ PpxDerivingYoJson ]
noeq
type field_array_t =
| FieldScalar
| FieldArrayQualified of (expr & array_qualifier) //array size in bytes, the qualifier indicates whether this is a variable-length suffix or not
| FieldString of (option expr)
| FieldConsumeAll // [:consume-all]
[@@ PpxDerivingYoJson ]
noeq
type probe_call = {
probe_fn:option ident;
probe_length:expr;
probe_dest:ident
}
[@@ PpxDerivingYoJson ]
noeq
type atomic_field' = {
field_dependence:bool; //computed; whether or not the rest of the struct depends on this field
field_ident:ident; //name of the field
field_type:typ; //type of the field
field_array_opt: field_array_t;
field_constraint:option expr; //refinement constraint
field_bitwidth:option field_bitwidth_t; //bits used for the field; elaborate from Inl to Inr
field_action:option (action & bool); //bool indicates if the action depends on the field value
field_probe:option probe_call; //set in case this field has to be probed then validated
}
and atomic_field = with_meta_t atomic_field'
and field' =
| AtomicField of atomic_field
| RecordField : record -> ident -> field'
| SwitchCaseField : switch_case -> ident -> field'
and field = with_meta_t field'
and record = list field
and case =
| Case : expr -> field -> case
| DefaultCase : field -> case
and switch_case = expr & list case
[@@ PpxDerivingYoJson ]
type attribute =
| Entrypoint
| Aligned
/// Typedefs are given 2 names by convention and can be tagged as an
/// "entrypoint" for the validator
///
/// E.g.,
/// typedef [entrypoint] struct _T { ... } T, *PTR_T;
[@@ PpxDerivingYoJson ]
noeq
type typedef_names = {
typedef_name: ident;
typedef_abbrev: ident;
typedef_ptr_abbrev: ident;
typedef_attributes: list attribute
}
[@@ PpxDerivingYoJson ]
let enum_case = ident & option (either int ident)
/// Specification of output types
///
/// Output types contain atomic fields with optional bitwidths for bitfield types,
/// but they may also contain anonymous structs and unions
[@@ PpxDerivingYoJson ]
noeq
type out_field =
| Out_field_named: ident -> typ -> bit_width:option int -> out_field
| Out_field_anon : list out_field -> is_union:bool -> out_field
[@@ PpxDerivingYoJson ]
noeq
type out_typ = {
out_typ_names : typedef_names;
out_typ_fields : list out_field;
out_typ_is_union : bool; //TODO: unclear if this field is needed
}
/// A 3d specification a list of declarations
/// - Define: macro definitions for constants
/// - TypeAbbrev: macro definition of types
/// - Enum: enumerated type using existing constants or newly defined constants
/// - Record: a struct with refinements
/// - CaseType: an untagged union
///
/// - OutputType: an output type definition
/// no validators are generated for these types,
/// they are used only in the parse trees construction in the actions
/// - ExternType: An abstract type declaration
/// - ExternFn: An abstract function declaration, may be used in the actions
[@@ PpxDerivingYoJson ]
noeq
type decl' =
| ModuleAbbrev: ident -> ident -> decl'
| Define: ident -> option typ -> constant -> decl'
| TypeAbbrev: typ -> ident -> decl'
| Enum: typ -> ident -> list enum_case -> decl'
| Record: names:typedef_names -> params:list param -> where:option expr -> fields:record -> decl'
| CaseType: typedef_names -> list param -> switch_case -> decl'
| OutputType : out_typ -> decl'
| ExternType : typedef_names -> decl'
| ExternFn : ident -> typ -> list param -> decl'
| ExternProbe : ident -> decl'
[@@ PpxDerivingYoJson ]
noeq
type decl = {
d_decl : with_meta_t decl';
d_exported : bool
}
let mk_decl (d:decl') r c (is_exported:bool) : decl =
{ d_decl = with_range_and_comments d r c;
d_exported = is_exported }
let decl_with_v (d:decl) (v:decl') : decl =
{ d with d_decl = { d.d_decl with v = v } }
[@@ PpxDerivingYoJson ]
noeq
type type_refinement = {
includes:list string;
type_map:list (ident * option ident)
}
[@@ PpxDerivingYoJson ]
let prog = list decl & option type_refinement
////////////////////////////////////////////////////////////////////////////////
// Utilities
////////////////////////////////////////////////////////////////////////////////
(** Entrypoint and export definitions *)
let has_entrypoint (l:list attribute) : Tot bool =
Some? (List.Tot.tryFind (function Entrypoint -> true | _ -> false) l)
let is_entrypoint_or_export d = match d.d_decl.v with
| Record names _ _ _
| CaseType names _ _ ->
if has_entrypoint (names.typedef_attributes)
then true
else d.d_exported
| _ -> d.d_exported
let is_entrypoint d = match d.d_decl.v with
| Record names _ _ _
| CaseType names _ _ ->
has_entrypoint (names.typedef_attributes)
| _ -> false
(** Determine if there are output type expressions: which cases in
TranslateForInterpreter introduce the Output_type_expr constructor?
*)
/// Matches translate_action_assignment, translate_action_field_ptr_after
let out_expr_is_out_type_expr (lhs: out_expr) : Tot bool =
match lhs.out_expr_node.v with
| OE_star ({out_expr_node = {v=OE_id i}}) -> false
| _ -> true
/// Matches translate_atomic_action
let atomic_action_has_out_expr (a: atomic_action) : Tot bool =
match a with
| Action_field_ptr_after _ write_to
| Action_assignment write_to _
-> out_expr_is_out_type_expr write_to
| _ -> false
/// Matches translate_action
let rec action_has_out_expr (a: action) : Tot bool =
match a.v with
| Atomic_action a -> atomic_action_has_out_expr a
| Action_seq hd tl ->
if atomic_action_has_out_expr hd
then true
else action_has_out_expr tl
| Action_ite _ then_ (Some else_) ->
if action_has_out_expr then_
then true
else action_has_out_expr else_
| Action_ite _ then_ None ->
action_has_out_expr then_
| Action_let _ a k ->
if atomic_action_has_out_expr a
then true
else action_has_out_expr k
| Action_act a ->
action_has_out_expr a
let field_action_has_out_expr
(f: option (action & bool))
: Tot bool
= match f with
| None -> false
| Some (a, _) -> action_has_out_expr a
/// Matches translate_atomic_field
let atomic_field_has_out_expr (f: atomic_field) : Tot bool =
let sf = f.v in
field_action_has_out_expr sf.field_action
/// Matches field_as_grouped_fields
let rec field_has_out_expr (f: field) : Tot bool =
match f.v with
| AtomicField af ->
atomic_field_has_out_expr af
| RecordField fs _ ->
record_has_out_expr fs
| SwitchCaseField sw _ ->
switch_case_has_out_expr sw
and record_has_out_expr (fs: record) : Tot bool =
match fs with
| [] -> false
| f :: fs' ->
if field_has_out_expr f
then true
else record_has_out_expr fs'
and switch_case_has_out_expr (sw: switch_case) : Tot bool =
let (_, c) = sw in
cases_have_out_expr c
and cases_have_out_expr (cs: list case) : Tot bool =
match cs with
| [] -> false
| c :: cs ->
if case_has_out_expr c
then true
else cases_have_out_expr cs
and case_has_out_expr (c: case) : Tot bool =
match c with
| Case _ f
| DefaultCase f
->
field_has_out_expr f
/// Matches parse_field
let decl_has_out_expr (d: decl) : Tot bool =
match d.d_decl.v with
| Record _ _ _ ast_fields ->
record_has_out_expr ast_fields
| CaseType _ _ switch_case ->
switch_case_has_out_expr switch_case
| _ -> false
(** Equality on expressions and types **)
/// eq_expr partially decides equality on expressions, by requiring
/// syntactic equality
let rec eq_expr (e1 e2:expr) : Tot bool (decreases e1) =
match e1.v, e2.v with
| Constant i, Constant j -> i = j
| Identifier i, Identifier j -> i.v = j.v
| This, This -> true
| App op1 es1, App op2 es2 ->
op1 = op2
&& eq_exprs es1 es2
| _ -> false
and eq_exprs (es1 es2:list expr) : Tot bool =
match es1, es2 with
| [], [] -> true
| hd1::es1, hd2::es2 -> eq_expr hd1 hd2 && eq_exprs es1 es2
| _ -> false
let eq_idents (i1 i2:ident) : Tot bool =
i1.v.modul_name = i2.v.modul_name && i1.v.name = i2.v.name
/// eq_typ: syntactic equalty of types
let rec eq_out_expr (o1 o2:out_expr) : bool =
match o1.out_expr_node.v, o2.out_expr_node.v with
| OE_id i1, OE_id i2 -> eq_idents i1 i2
| OE_star o1, OE_star o2
| OE_addrof o1, OE_addrof o2 -> eq_out_expr o1 o2
| OE_deref o1 i1, OE_deref o2 i2
| OE_dot o1 i1, OE_dot o2 i2 -> eq_idents i1 i2 && eq_out_expr o1 o2
| _ -> false
let eq_typ_param (p1 p2:typ_param) : bool =
match p1, p2 with
| Inl e1, Inl e2 -> eq_expr e1 e2
| Inr o1, Inr o2 -> eq_out_expr o1 o2
| _ -> false
let rec eq_typ_params (ps1 ps2:list typ_param) : bool =
match ps1, ps2 with
| [], [] -> true
| p1::ps1, p2::ps2 -> eq_typ_param p1 p2 && eq_typ_params ps1 ps2
| _ -> false
let rec eq_typ (t1 t2:typ) : Tot bool =
match t1.v, t2.v with
| Type_app hd1 k1 ps1, Type_app hd2 k2 ps2 ->
eq_idents hd1 hd2
&& k1 = k2
&& eq_typ_params ps1 ps2
| Pointer t1, Pointer t2 ->
eq_typ t1 t2
| _ -> false
(** Common AST constants and builders **)
let dummy_range = dummy_pos, dummy_pos
let with_dummy_range x = with_range x dummy_range
let to_ident' x = {modul_name=None;name=x}
let mk_prim_t x = with_dummy_range (Type_app (with_dummy_range (to_ident' x)) KindSpec [])
let tbool = mk_prim_t "Bool"
let tunit = mk_prim_t "unit"
let tuint8 = mk_prim_t "UINT8"
let tuint8be = mk_prim_t "UINT8BE"
let puint8 = mk_prim_t "PUINT8"
let tuint16 = mk_prim_t "UINT16"
let tuint32 = mk_prim_t "UINT32"
let tuint64 = mk_prim_t "UINT64"
let tcopybuffer = mk_prim_t "EVERPARSE_COPY_BUFFER_T"
let tunknown = mk_prim_t "?"
let unit_atomic_field rng =
let dummy_identifier = with_range (to_ident' "_empty_") rng in
let f = {
field_dependence=false;
field_ident=dummy_identifier;
field_type=tunit;
field_array_opt=FieldScalar;
field_constraint=None;
field_bitwidth=None;
field_action=None;
field_probe=None
} in
with_range f rng
let map_opt (f:'a -> ML 'b) (o:option 'a) : ML (option 'b) =
match o with
| None -> None
| Some x -> Some (f x)
////////////////////////////////////////////////////////////////////////////////
// Substitutions
////////////////////////////////////////////////////////////////////////////////
module H = Hashtable
let subst = H.t ident' expr
let mk_subst (s:list (ident * expr)) : ML subst =
let h = H.create 10 in
List.iter (fun (i, e) -> H.insert h i.v e) s;
h
let apply (s:subst) (id:ident) : ML expr =
match H.try_find s id.v with
| None -> with_range (Identifier id) id.range
| Some e -> e
let rec subst_expr (s:subst) (e:expr) : ML expr =
match e.v with
| Constant _
| This -> e
| Identifier i -> apply s i
| Static e -> { e with v = Static (subst_expr s e) }
| App op es -> {e with v = App op (List.map (subst_expr s) es)}
let subst_atomic_action (s:subst) (aa:atomic_action) : ML atomic_action =
match aa with
| Action_return e -> Action_return (subst_expr s e)
| Action_assignment lhs rhs -> Action_assignment lhs (subst_expr s rhs)
| Action_call f args -> Action_call f (List.map (subst_expr s) args)
| _ -> aa //action mutable identifiers are not subject to substitution
let rec subst_action (s:subst) (a:action) : ML action =
match a.v with
| Atomic_action aa -> {a with v = Atomic_action (subst_atomic_action s aa)}
| Action_seq hd tl -> {a with v = Action_seq (subst_atomic_action s hd) (subst_action s tl) }
| Action_ite hd then_ else_ -> {a with v = Action_ite (subst_expr s hd) (subst_action s then_) (subst_action_opt s else_) }
| Action_let i aa k -> {a with v = Action_let i (subst_atomic_action s aa) (subst_action s k) }
| Action_act a -> {a with v = Action_act (subst_action s a) }
and subst_action_opt (s:subst) (a:option action) : ML (option action) =
match a with
| None -> None
| Some a -> Some (subst_action s a)
//No need to substitute in output expressions
let subst_out_expr (s:subst) (o:out_expr) : out_expr = o
let subst_typ_param (s:subst) (p:typ_param) : ML typ_param =
match p with
| Inl e -> Inl (subst_expr s e)
| Inr oe -> Inr (subst_out_expr s oe)
let rec subst_typ (s:subst) (t:typ) : ML typ =
match t.v with
| Type_app hd k ps -> { t with v = Type_app hd k (List.map (subst_typ_param s) ps) }
| Pointer t -> {t with v = Pointer (subst_typ s t) }
let subst_field_array (s:subst) (f:field_array_t) : ML field_array_t =
match f with
| FieldScalar -> f
| FieldArrayQualified (e, q) -> FieldArrayQualified (subst_expr s e, q)
| FieldString sz -> FieldString (map_opt (subst_expr s) sz)
| FieldConsumeAll -> f
let rec subst_field (s:subst) (ff:field) : ML field =
match ff.v with
| AtomicField f -> {ff with v = AtomicField (subst_atomic_field s f)}
| RecordField f i -> {ff with v = RecordField (subst_record s f) i}
| SwitchCaseField f i -> {ff with v = SwitchCaseField (subst_switch_case s f) i}
and subst_atomic_field (s:subst) (f:atomic_field) : ML atomic_field =
let sf = f.v in
let a =
match sf.field_action with
| None -> None
| Some (a, b) -> Some (subst_action s a, b)
in
let sf = {
sf with
field_type = subst_typ s sf.field_type;
field_array_opt = subst_field_array s sf.field_array_opt;
field_constraint = map_opt (subst_expr s) sf.field_constraint;
field_action = a
} in
{ f with v = sf }
and subst_record (s:subst) (f:record) : ML record
= List.map (subst_field s) f
and subst_case (s:subst) (c:case) : ML case =
match c with
| Case e f -> Case (subst_expr s e) (subst_field s f)
| DefaultCase f -> DefaultCase (subst_field s f)
and subst_switch_case (s:subst) (sc:switch_case) : ML switch_case =
subst_expr s (fst sc), List.map (subst_case s) (snd sc)
let subst_params (s:subst) (p:list param) : ML (list param) =
List.map (fun (t, i, q) -> subst_typ s t, i, q) p
let subst_decl' (s:subst) (d:decl') : ML decl' =
match d with
| ModuleAbbrev _ _ -> d
| Define i None _ -> d
| Define i (Some t) c -> Define i (Some (subst_typ s t)) c
| TypeAbbrev t i -> TypeAbbrev (subst_typ s t) i
| Enum t i is -> Enum (subst_typ s t) i is
| Record names params where fields ->
Record names (subst_params s params) (map_opt (subst_expr s) where) (List.map (subst_field s) fields)
| CaseType names params cases ->
CaseType names (subst_params s params) (subst_switch_case s cases)
| OutputType _
| ExternType _
| ExternFn _ _ _
| ExternProbe _ -> d
let subst_decl (s:subst) (d:decl) : ML decl = decl_with_v d (subst_decl' s d.d_decl.v)
(*** Printing the source AST; for debugging only **)
let print_constant (c:constant) =
let print_tag = function
| UInt8 -> "uy"
| UInt16 -> "us"
| UInt32 -> "ul"
| UInt64 -> "uL"
in
match c with
| Unit -> "()"
| Int tag i -> Printf.sprintf "%d%s" i (print_tag tag)
| XInt tag x ->
let tag = print_tag tag in
if String.length x >= 2
&& String.sub x (String.length x - 2) 2 = tag
then x
else Printf.sprintf "%s%s" x tag
| Bool b -> Printf.sprintf "%b" b
let print_ident (i:ident) = ident_to_string i
let print_integer_type = function
| UInt8 -> "UINT8"
| UInt16 -> "UINT16"
| UInt32 -> "UINT32"
| UInt64 -> "UINT64"
let print_bitfield_bit_order = function
| LSBFirst -> "LSBFirst"
| MSBFirst -> "MSBFirst"
let print_op = function
| Eq -> "="
| Neq -> "!="
| And -> "&&"
| Or -> "||"
| Not -> "!"
| Plus _ -> "+"
| Minus _ -> "-"
| Mul _ -> "*"
| Division _ -> "/"
| Remainder _ -> "%"
| BitwiseAnd _ -> "&"
| BitwiseOr _ -> "|"
| BitwiseXor _ -> "^"
| BitwiseNot _ -> "~"
| ShiftLeft _ -> "<<"
| ShiftRight _ -> ">>"
| LT _ -> "<"
| GT _ -> ">"
| LE _ -> "<="
| GE _ -> ">="
| IfThenElse -> "ifthenelse"
| BitFieldOf i o -> Printf.sprintf "bitfield_of(%d, %s)" i (print_bitfield_bit_order o)
| SizeOf -> "sizeof"
| Cast _ t -> "(" ^ print_integer_type t ^ ")"
| Ext s -> s
let rec print_expr (e:expr) : Tot string =
match e.v with
| Constant c ->
print_constant c
| Identifier i ->
print_ident i
| This ->
"this"
| Static e ->
Printf.sprintf "static(%s)" (print_expr e)
| App Eq [e1; e2] ->
Printf.sprintf "(%s = %s)" (print_expr e1) (print_expr e2)
| App And [e1; e2] ->
Printf.sprintf "(%s && %s)" (print_expr e1) (print_expr e2)
| App Or [e1; e2] ->
Printf.sprintf "(%s || %s)" (print_expr e1) (print_expr e2)
| App Not [e1] ->
Printf.sprintf "(! %s)" (print_expr e1)
| App (BitwiseNot _) [e1] ->
Printf.sprintf "(~ %s)" (print_expr e1)
| App (Plus _) [e1; e2]
| App (Minus _) [e1; e2]
| App (Mul _) [e1; e2]
| App (Division _) [e1; e2]
| App (Remainder _) [e1; e2]
| App (BitwiseAnd _) [e1; e2]
| App (BitwiseOr _) [e1; e2]
| App (BitwiseXor _) [e1; e2]
| App (ShiftLeft _) [e1; e2]
| App (ShiftRight _) [e1; e2]
| App (LT _) [e1; e2]
| App (GT _) [e1; e2]
| App (LE _) [e1; e2]
| App (GE _) [e1; e2] ->
let op = App?._0 e.v in
Printf.sprintf "(%s %s %s)" (print_expr e1) (print_op op) (print_expr e2)
| App SizeOf [e1] ->
Printf.sprintf "(sizeof %s)" (print_expr e1)
| App (Cast i j) [e] ->
Printf.sprintf "%s %s" (print_op (Cast i j)) (print_expr e)
| App (Ext s) es ->
Printf.sprintf "%s(%s)" (print_op (Ext s)) (String.concat ", " (print_exprs es))
| App op es ->
Printf.sprintf "(?? %s %s)" (print_op op) (String.concat ", " (print_exprs es))
and print_exprs (es:list expr) : Tot (list string) =
match es with
| [] -> []
| hd::tl -> print_expr hd :: print_exprs tl
let rec print_out_expr o : ML string =
match o.out_expr_node.v with
| OE_id i -> ident_to_string i
| OE_star o -> Printf.sprintf "*(%s)" (print_out_expr o)
| OE_addrof o -> Printf.sprintf "&(%s)" (print_out_expr o)
| OE_deref o i -> Printf.sprintf "(%s)->(%s)" (print_out_expr o) (ident_to_string i)
| OE_dot o i -> Printf.sprintf "(%s).(%s)" (print_out_expr o) (ident_to_string i)
let print_typ_param p : ML string =
match p with
| Inl e -> print_expr e
| Inr o -> print_out_expr o
let rec print_typ t : ML string =
match t.v with
| Type_app i _k ps ->
begin
match ps with
| [] -> ident_to_string i
| _ ->
Printf.sprintf "%s(%s)"
(ident_to_string i)
(String.concat ", " (List.map print_typ_param ps))
end
| Pointer t ->
Printf.sprintf "(pointer %s)"
(print_typ t)
let typ_as_integer_type (t:typ) : ML integer_type =
match t.v with
| Type_app i _k [] -> as_integer_typ i
| _ -> error ("Expected an integer type; got: " ^ (print_typ t)) t.range
let bit_order_of_typ (t:typ) : ML bitfield_bit_order =
match t.v with
| Type_app i _k [] -> bit_order_of i
| _ -> error ("Expected an integer type; got: " ^ (print_typ t)) t.range
let print_qual = function
| Mutable -> "mutable"
| Immutable -> ""
let print_params (ps:list param) =
match ps with
| [] -> ""
| _ ->
Printf.sprintf "(%s)"
(String.concat ", "
(ps |> List.map
(fun (t, p, q) ->
Printf.sprintf "%s%s %s"
(print_qual q)
(print_typ t)
(print_ident p))))
let print_opt (o:option 'a) (f:'a -> string) : string =
match o with
| None -> ""
| Some x -> f x
let print_bitfield (bf:option field_bitwidth_t) =
match bf with
| None -> ""
| Some (Inl x) -> Printf.sprintf ": %d " x.v
| Some (Inr {v=a}) ->
Printf.sprintf ": (|width=%d, id=%d, type=%s, from=%d, to=%d|) "
a.bitfield_width a.bitfield_identifier
(print_typ a.bitfield_type)
a.bitfield_from a.bitfield_to
let rec print_field (f:field) : ML string =
let field =
match f.v with
| AtomicField f -> print_atomic_field f
| RecordField f i -> Printf.sprintf "%s %s" (print_record f) i.v.name
| SwitchCaseField f i -> Printf.sprintf "%s %s" (print_switch_case f) i.v. name
in
match f.comments with
| [] -> field
| comms -> Printf.sprintf "//%s\n%s" (String.concat "; " comms) field
and print_record (f:record) : ML string =
List.map print_field f |>
String.concat ";\n"
and print_atomic_field (f:atomic_field) : ML string =
let print_array eq : Tot string =
match eq with
| FieldScalar -> ""
| FieldArrayQualified (e, q) ->
begin match q with
| ByteArrayByteSize -> Printf.sprintf "[%s]" (print_expr e)
| ArrayByteSize -> Printf.sprintf "[:byte-size %s]" (print_expr e)
| ArrayByteSizeAtMost -> Printf.sprintf "[:byte-size-single-element-array-at-most %s]" (print_expr e)
| ArrayByteSizeSingleElementArray -> Printf.sprintf "[:byte-size-single-element-array %s]" (print_expr e)
end
| FieldString None -> Printf.sprintf "[::zeroterm]"
| FieldString (Some sz) -> Printf.sprintf "[:zeroterm-byte-size-at-most %s]" (print_expr sz)
| FieldConsumeAll -> Printf.sprintf "[:consume-all]"
in
let sf = f.v in
Printf.sprintf "%s%s %s%s%s%s%s;"
(if sf.field_dependence then "dependent " else "")
(print_typ sf.field_type)
(print_ident sf.field_ident)
(print_bitfield sf.field_bitwidth)
(print_array sf.field_array_opt)
(print_opt sf.field_constraint (fun e -> Printf.sprintf "{%s}" (print_expr e)))
(print_opt sf.field_probe
(fun p -> Printf.sprintf "probe %s (length=%s, destination=%s)"
(print_opt p.probe_fn print_ident)
(print_expr p.probe_length)
(print_ident p.probe_dest)))
and print_switch_case (s:switch_case) : ML string =
let head, cases = s in
let print_case (c:case) : ML string =
match c with
| Case e f ->
Printf.sprintf "case %s: %s;"
(print_expr e)
(print_field f)
| DefaultCase f ->
Printf.sprintf "default: %s;"
(print_field f)
in
Printf.sprintf "switch (%s) {\n
%s\n\
}"
(print_expr head)
(String.concat "\n" (List.map print_case cases))
let print_decl' (d:decl') : ML string =
match d with
| ModuleAbbrev i m -> Printf.sprintf "module %s = %s" (print_ident i) (print_ident m)
| Define i None c ->
Printf.sprintf "#define %s %s;" (print_ident i) (print_constant c)
| Define i (Some t) c ->
Printf.sprintf "#define %s : %s %s;" (print_ident i) (print_typ t) (print_constant c)
| TypeAbbrev t i ->
Printf.sprintf "typedef %s %s;" (print_typ t) (print_ident i)
| Enum t i ls ->
let print_enum_case (i, jopt) =
match jopt with
| None -> print_ident i
| Some (Inl j) -> Printf.sprintf "%s = %d" (print_ident i) j
| Some (Inr j) -> Printf.sprintf "%s = %s" (print_ident i) (print_ident j)
in
Printf.sprintf "%s enum %s {\n\
%s \n\
}"
(print_typ t)
(ident_to_string i)
(String.concat ",\n" (List.map print_enum_case ls))
| Record td params wopt fields ->
Printf.sprintf "typedef struct %s%s%s {\n\
%s \n\
} %s, *%s"
(ident_to_string td.typedef_name)
(print_params params)
(match wopt with | None -> "" | Some e -> " where " ^ print_expr e)
(String.concat "\n" (List.map print_field fields))
(ident_to_string td.typedef_abbrev)
(ident_to_string td.typedef_ptr_abbrev)
| CaseType td params switch_case ->
Printf.sprintf "casetype %s%s {\n\
%s \n\
} %s, *%s"
(ident_to_string td.typedef_name)
(print_params params)
(print_switch_case switch_case)
(ident_to_string td.typedef_abbrev)
(ident_to_string td.typedef_ptr_abbrev)
| OutputType out_t -> "Printing for output types is TBD"
| ExternType _ -> "Printing for extern types is TBD"
| ExternFn _ _ _
| ExternProbe _ -> "Printing for extern functions is TBD"
let print_decl (d:decl) : ML string =
match d.d_decl.comments with
| [] -> print_decl' d.d_decl.v
| cs -> Printf.sprintf "/* %s */\n%s"
(String.concat "\n" cs)
(print_decl' d.d_decl.v)
let print_decls (ds:list decl) : ML string =
List.map print_decl ds
|> String.concat "\n"
type weak_kind =
| WeakKindWeak
| WeakKindStrongPrefix
| WeakKindConsumesAll
let print_weak_kind (k: weak_kind) : Tot string =
match k with
| WeakKindConsumesAll -> "WeakKindConsumesAll"
| WeakKindStrongPrefix -> "WeakKindStrongPrefix"
| WeakKindWeak -> "WeakKindWeak"
let weak_kind_glb (w1 w2: weak_kind) : Tot weak_kind =
if w1 = w2
then w1
else WeakKindWeak
let field_tag_equal (f0 f1:field) =
match f0.v, f1.v with
| AtomicField _, AtomicField _
| RecordField _ _, RecordField _ _
| SwitchCaseField _ _, SwitchCaseField _ _ -> true
| _ -> false
(* Pruning actions out of the surface ast (to generate validators checking Z3 test cases) *)
let atomic_field'_prune_actions
(a: atomic_field')
: Tot atomic_field'
= { a with field_action = None }
let atomic_field_prune_actions
(a: atomic_field)
: Tot atomic_field
= { a with v = atomic_field'_prune_actions a.v } | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.ST.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Ast.fst"
} | [
{
"abbrev": true,
"full_module": "Hashtable",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"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
}
] | {
"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"
} | false | l: Prims.list Ast.case -> Prims.list Ast.case | Prims.Tot | [
"total"
] | [
"field'_prune_actions",
"field_prune_actions",
"record_prune_actions",
"case_prune_actions",
"cases_prune_actions",
"switch_case_prune_actions"
] | [
"Prims.list",
"Ast.case",
"Prims.Nil",
"Prims.Cons",
"Ast.case_prune_actions",
"Ast.cases_prune_actions"
] | [
"mutual recursion"
] | false | false | false | true | false | let rec cases_prune_actions (l: list case) : Tot (list case) =
| match l with
| [] -> []
| c :: l' -> case_prune_actions c :: cases_prune_actions l' | false |
FStar.UInt16.fst | FStar.UInt16.logxor | val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z)) | val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z)) | let logxor x y = Mk (logxor (v x) (v y)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 67,
"start_col": 0,
"start_line": 67
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.UInt16.t -> y: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.logxor",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let logxor x y =
| Mk (logxor (v x) (v y)) | false |
FStar.UInt16.fst | FStar.UInt16.logor | val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z)) | val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z)) | let logor x y = Mk (logor (v x) (v y)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 69,
"start_col": 0,
"start_line": 69
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.UInt16.t -> y: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.logor",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let logor x y =
| Mk (logor (v x) (v y)) | false |
FStar.UInt16.fst | FStar.UInt16.shift_left | val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c)) | val shift_left (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (UInt32.v s) = v c)) | let shift_left a s = Mk (shift_left (v a) (UInt32.v s)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 55,
"end_line": 77,
"start_col": 0,
"start_line": 77
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y))
let lognot x = Mk (lognot (v x))
let shift_right a s = Mk (shift_right (v a) (UInt32.v s))
#push-options "--z3rlimit 80 --fuel 1" //AR: working around the interleaving semantics of pragmas | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 80,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt32.t",
"FStar.UInt16.Mk",
"FStar.UInt.shift_left",
"FStar.UInt16.n",
"FStar.UInt16.v",
"FStar.UInt32.v"
] | [] | false | false | false | false | false | let shift_left a s =
| Mk (shift_left (v a) (UInt32.v s)) | false |
FStar.UInt16.fst | FStar.UInt16.mul_underspec | val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c)) | val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c)) | let mul_underspec a b = Mk (mul_underspec (v a) (v b)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 54,
"end_line": 57,
"start_col": 0,
"start_line": 57
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt16.Mk",
"FStar.UInt.mul_underspec",
"FStar.UInt16.n",
"FStar.UInt16.v"
] | [] | false | false | false | false | false | let mul_underspec a b =
| Mk (mul_underspec (v a) (v b)) | false |
FStar.UInt16.fst | FStar.UInt16.rem | val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c)) | val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c)) | let rem a b = Mk (mod (v a) (v b)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 63,
"start_col": 0,
"start_line": 63
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t{FStar.UInt16.v b <> 0} -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.int",
"FStar.UInt16.v",
"FStar.UInt16.Mk",
"FStar.UInt.mod",
"FStar.UInt16.n"
] | [] | false | false | false | false | false | let rem a b =
| Mk (mod (v a) (v b)) | false |
Hacl.Impl.Ed25519.RecoverX.fst | Hacl.Impl.Ed25519.RecoverX.recover_x_step_3 | val recover_x_step_3: tmp:lbuffer uint64 15ul -> Stack unit
(requires fun h -> live h tmp /\ F51.mul_inv_t h (gsub tmp 0ul 5ul))
(ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
(let x2 = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let x = x2 `SC.fpow` ((SC.prime + 3) / 8) in
let x = if ((x `SC.fmul` x) `SC.fsub` x2) <> 0 then (x `SC.fmul` SE.modp_sqrt_m1) else x in
F51.fevalh h1 (gsub tmp 5ul 5ul) == x)) | val recover_x_step_3: tmp:lbuffer uint64 15ul -> Stack unit
(requires fun h -> live h tmp /\ F51.mul_inv_t h (gsub tmp 0ul 5ul))
(ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
(let x2 = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let x = x2 `SC.fpow` ((SC.prime + 3) / 8) in
let x = if ((x `SC.fmul` x) `SC.fsub` x2) <> 0 then (x `SC.fmul` SE.modp_sqrt_m1) else x in
F51.fevalh h1 (gsub tmp 5ul 5ul) == x)) | let recover_x_step_3 tmp =
let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in // x
let t0 = sub tmp 10ul 5ul in
Hacl.Impl.Ed25519.Pow2_252m2.pow2_252m2 x3 x2; // x3 = x2^((prime + 3) / 8)
fsquare t0 x3; // t0 = x3 * x3
fdifference t0 t0 x2; // t0 = t0 - x2
reduce_513 t0;
reduce t0;
let t0_is_0 = is_0 t0 in
if t0_is_0 then () else mul_modp_sqrt_m1 x3 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.RecoverX.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 180,
"start_col": 0,
"start_line": 170
} | module Hacl.Impl.Ed25519.RecoverX
module ST = FStar.HyperStack.ST
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
module SE = Spec.Ed25519
#reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
inline_for_extraction noextract
let elemB = lbuffer uint64 5ul
val is_0: x:elemB -> Stack bool
(requires fun h -> live h x /\ F51.as_nat h x == F51.fevalh h x)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.fevalh h0 x == SC.zero)))
[@CInline]
let is_0 x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 =^ 0uL &&
u64_to_UInt64 x1 =^ 0uL &&
u64_to_UInt64 x2 =^ 0uL &&
u64_to_UInt64 x3 =^ 0uL &&
u64_to_UInt64 x4 =^ 0uL)
inline_for_extraction noextract
val gte_q: x:elemB -> Stack bool
(requires fun h -> live h x /\
F51.felem_fits h x (1, 1, 1, 1, 1))
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.as_nat h0 x >= SC.prime)))
let gte_q x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 >=^ 0x7ffffffffffeduL &&
u64_to_UInt64 x1 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x2 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x3 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x4 =^ 0x7ffffffffffffuL)
val mul_modp_sqrt_m1: x:elemB -> Stack unit
(requires fun h -> live h x /\ F51.mul_inv_t h x)
(ensures fun h0 _ h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == F51.fevalh h0 x `SC.fmul` SE.modp_sqrt_m1)
[@CInline]
let mul_modp_sqrt_m1 x =
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00061b274a0ea0b0,
u64 0x0000d5a5fc8f189d,
u64 0x0007ef5e9cbd0c60,
u64 0x00078595a6804c9e,
u64 0x0002b8324804fc1d) in
push_frame();
let sqrt_m1 = create 5ul (u64 0) in
make_u64_5 sqrt_m1 x0 x1 x2 x3 x4;
assert_norm (S51.as_nat5 (x0, x1, x2, x3, x4) == SE.modp_sqrt_m1);
fmul x x sqrt_m1;
pop_frame()
inline_for_extraction noextract
val x_mod_2: x:felem -> Stack uint64
(requires fun h -> live h x)
(ensures fun h0 z h1 -> h0 == h1 /\ v z < 2 /\
v z == F51.as_nat h0 x % 2)
let x_mod_2 x =
let x0 = x.(0ul) in
let z = x0 &. u64 1 in
mod_mask_lemma x0 1ul;
Lib.IntTypes.Compatibility.uintv_extensionality (u64 1) (mod_mask #U64 1ul);
z
inline_for_extraction noextract
val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one))))
let recover_x_step_1 x2 y =
push_frame();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y; // y2 = y * y
times_d dyy y2; // dyy = d * y2
fsum dyy dyy one; // dyy = (d * y2) + one
reduce_513 dyy;
inverse dyyi dyy; // dyyi = modp_inv ((d * y2) + one)
fdifference x2 y2 one; // x2 = y2 - one
fmul x2 x2 dyyi; // x2 = (y2 - one) * dyyi
reduce x2;
pop_frame()
inline_for_extraction noextract
val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2))
let recover_x_step_2 x sign x2 =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x2_is_0 = is_0 x2 in
if x2_is_0 then begin
if u64_to_UInt64 sign =^ 0uL then (make_zero x; u8 1) else u8 0 end
else u8 2
inline_for_extraction noextract
val recover_x_step_3: tmp:lbuffer uint64 15ul -> Stack unit
(requires fun h -> live h tmp /\ F51.mul_inv_t h (gsub tmp 0ul 5ul))
(ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
(let x2 = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let x = x2 `SC.fpow` ((SC.prime + 3) / 8) in
let x = if ((x `SC.fmul` x) `SC.fsub` x2) <> 0 then (x `SC.fmul` SE.modp_sqrt_m1) else x in
F51.fevalh h1 (gsub tmp 5ul 5ul) == x)) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.Compatibility.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Pow2_252m2.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.RecoverX.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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"
} | false | tmp: Lib.Buffer.lbuffer Lib.IntTypes.uint64 15ul -> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Prims.unit",
"Prims.bool",
"Hacl.Impl.Ed25519.RecoverX.mul_modp_sqrt_m1",
"Hacl.Impl.Ed25519.RecoverX.is_0",
"Hacl.Bignum25519.reduce",
"Hacl.Bignum25519.reduce_513",
"Hacl.Bignum25519.fdifference",
"Hacl.Bignum25519.fsquare",
"Hacl.Impl.Ed25519.Pow2_252m2.pow2_252m2",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub"
] | [] | false | true | false | false | false | let recover_x_step_3 tmp =
| let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in
let t0 = sub tmp 10ul 5ul in
Hacl.Impl.Ed25519.Pow2_252m2.pow2_252m2 x3 x2;
fsquare t0 x3;
fdifference t0 t0 x2;
reduce_513 t0;
reduce t0;
let t0_is_0 = is_0 t0 in
if t0_is_0 then () else mul_modp_sqrt_m1 x3 | false |
FStar.UInt16.fst | FStar.UInt16.shift_right | val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c)) | val shift_right (a:t) (s:UInt32.t) : Pure t
(requires (UInt32.v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (UInt32.v s) = v c)) | let shift_right a s = Mk (shift_right (v a) (UInt32.v s)) | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 57,
"end_line": 73,
"start_col": 0,
"start_line": 73
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y))
let lognot x = Mk (lognot (v x)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt16.t | Prims.Pure | [] | [] | [
"FStar.UInt16.t",
"FStar.UInt32.t",
"FStar.UInt16.Mk",
"FStar.UInt.shift_right",
"FStar.UInt16.n",
"FStar.UInt16.v",
"FStar.UInt32.v"
] | [] | false | false | false | false | false | let shift_right a s =
| Mk (shift_right (v a) (UInt32.v s)) | false |
FStar.UInt16.fst | FStar.UInt16.lemma_sub_msbs | val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b)))) | val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b)))) | let lemma_sub_msbs a b
= from_vec_propriety (to_vec (v a)) 1;
from_vec_propriety (to_vec (v b)) 1;
from_vec_propriety (to_vec (v (sub_mod a b))) 1 | {
"file_name": "ulib/FStar.UInt16.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 82,
"start_col": 0,
"start_line": 79
} | (*
Copyright 2008-2019 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.UInt16
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
type t : eqtype =
| Mk: v:uint_t n -> t
let v x = x.v
irreducible
let uint_to_t x = Mk x
let uv_inv _ = ()
let vu_inv _ = ()
let v_inj _ _ = ()
let zero = uint_to_t 0
let one = uint_to_t 1
let add a b = Mk (add (v a) (v b))
let add_underspec a b = Mk (add_underspec (v a) (v b))
let add_mod a b = Mk (add_mod (v a) (v b))
let sub a b = Mk (sub (v a) (v b))
let sub_underspec a b = Mk (sub_underspec (v a) (v b))
let sub_mod a b = Mk (sub_mod (v a) (v b))
let mul a b = Mk (mul (v a) (v b))
let mul_underspec a b = Mk (mul_underspec (v a) (v b))
let mul_mod a b = Mk (mul_mod (v a) (v b))
let div a b = Mk (div (v a) (v b))
let rem a b = Mk (mod (v a) (v b))
let logand x y = Mk (logand (v x) (v y))
let logxor x y = Mk (logxor (v x) (v y))
let logor x y = Mk (logor (v x) (v y))
let lognot x = Mk (lognot (v x))
let shift_right a s = Mk (shift_right (v a) (UInt32.v s))
#push-options "--z3rlimit 80 --fuel 1" //AR: working around the interleaving semantics of pragmas
let shift_left a s = Mk (shift_left (v a) (UInt32.v s)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt16.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 80,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt16.t -> b: FStar.UInt16.t
-> FStar.Pervasives.Lemma
(ensures
FStar.UInt.msb (FStar.UInt16.v a) = FStar.UInt.msb (FStar.UInt16.v b) ==>
(FStar.UInt16.v a < FStar.UInt16.v b <==>
FStar.UInt.msb (FStar.UInt16.v (FStar.UInt16.sub_mod a b)))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.UInt16.t",
"FStar.UInt.from_vec_propriety",
"FStar.UInt16.n",
"FStar.UInt.to_vec",
"FStar.UInt16.v",
"FStar.UInt16.sub_mod",
"Prims.unit"
] | [] | true | false | true | false | false | let lemma_sub_msbs a b =
| from_vec_propriety (to_vec (v a)) 1;
from_vec_propriety (to_vec (v b)) 1;
from_vec_propriety (to_vec (v (sub_mod a b))) 1 | false |
Hacl.Impl.Ed25519.RecoverX.fst | Hacl.Impl.Ed25519.RecoverX.recover_x_step_4 | val recover_x_step_4: tmp:lbuffer uint64 15ul -> Stack bool
(requires fun h -> live h tmp /\
F51.mul_inv_t h (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h (gsub tmp 5ul 5ul))
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
F51.fevalh h0 (gsub tmp 5ul 5ul) == F51.fevalh h1 (gsub tmp 5ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
(let u = F51.fevalh h0 (gsub tmp 5ul 5ul) in
let v = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let y = (u `SC.fmul` u) `SC.fsub` v in
(z <==> y == SC.zero))) | val recover_x_step_4: tmp:lbuffer uint64 15ul -> Stack bool
(requires fun h -> live h tmp /\
F51.mul_inv_t h (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h (gsub tmp 5ul 5ul))
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
F51.fevalh h0 (gsub tmp 5ul 5ul) == F51.fevalh h1 (gsub tmp 5ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
(let u = F51.fevalh h0 (gsub tmp 5ul 5ul) in
let v = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let y = (u `SC.fmul` u) `SC.fsub` v in
(z <==> y == SC.zero))) | let recover_x_step_4 tmp =
let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in
let t0 = sub tmp 10ul 5ul in
fsquare t0 x3; // t0 = x3 * x3
fdifference t0 t0 x2; // t0 - x2
reduce_513 t0;
reduce t0;
is_0 t0 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.RecoverX.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 9,
"end_line": 206,
"start_col": 0,
"start_line": 198
} | module Hacl.Impl.Ed25519.RecoverX
module ST = FStar.HyperStack.ST
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
module SE = Spec.Ed25519
#reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
inline_for_extraction noextract
let elemB = lbuffer uint64 5ul
val is_0: x:elemB -> Stack bool
(requires fun h -> live h x /\ F51.as_nat h x == F51.fevalh h x)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.fevalh h0 x == SC.zero)))
[@CInline]
let is_0 x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 =^ 0uL &&
u64_to_UInt64 x1 =^ 0uL &&
u64_to_UInt64 x2 =^ 0uL &&
u64_to_UInt64 x3 =^ 0uL &&
u64_to_UInt64 x4 =^ 0uL)
inline_for_extraction noextract
val gte_q: x:elemB -> Stack bool
(requires fun h -> live h x /\
F51.felem_fits h x (1, 1, 1, 1, 1))
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.as_nat h0 x >= SC.prime)))
let gte_q x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 >=^ 0x7ffffffffffeduL &&
u64_to_UInt64 x1 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x2 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x3 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x4 =^ 0x7ffffffffffffuL)
val mul_modp_sqrt_m1: x:elemB -> Stack unit
(requires fun h -> live h x /\ F51.mul_inv_t h x)
(ensures fun h0 _ h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == F51.fevalh h0 x `SC.fmul` SE.modp_sqrt_m1)
[@CInline]
let mul_modp_sqrt_m1 x =
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00061b274a0ea0b0,
u64 0x0000d5a5fc8f189d,
u64 0x0007ef5e9cbd0c60,
u64 0x00078595a6804c9e,
u64 0x0002b8324804fc1d) in
push_frame();
let sqrt_m1 = create 5ul (u64 0) in
make_u64_5 sqrt_m1 x0 x1 x2 x3 x4;
assert_norm (S51.as_nat5 (x0, x1, x2, x3, x4) == SE.modp_sqrt_m1);
fmul x x sqrt_m1;
pop_frame()
inline_for_extraction noextract
val x_mod_2: x:felem -> Stack uint64
(requires fun h -> live h x)
(ensures fun h0 z h1 -> h0 == h1 /\ v z < 2 /\
v z == F51.as_nat h0 x % 2)
let x_mod_2 x =
let x0 = x.(0ul) in
let z = x0 &. u64 1 in
mod_mask_lemma x0 1ul;
Lib.IntTypes.Compatibility.uintv_extensionality (u64 1) (mod_mask #U64 1ul);
z
inline_for_extraction noextract
val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one))))
let recover_x_step_1 x2 y =
push_frame();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y; // y2 = y * y
times_d dyy y2; // dyy = d * y2
fsum dyy dyy one; // dyy = (d * y2) + one
reduce_513 dyy;
inverse dyyi dyy; // dyyi = modp_inv ((d * y2) + one)
fdifference x2 y2 one; // x2 = y2 - one
fmul x2 x2 dyyi; // x2 = (y2 - one) * dyyi
reduce x2;
pop_frame()
inline_for_extraction noextract
val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2))
let recover_x_step_2 x sign x2 =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x2_is_0 = is_0 x2 in
if x2_is_0 then begin
if u64_to_UInt64 sign =^ 0uL then (make_zero x; u8 1) else u8 0 end
else u8 2
inline_for_extraction noextract
val recover_x_step_3: tmp:lbuffer uint64 15ul -> Stack unit
(requires fun h -> live h tmp /\ F51.mul_inv_t h (gsub tmp 0ul 5ul))
(ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
(let x2 = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let x = x2 `SC.fpow` ((SC.prime + 3) / 8) in
let x = if ((x `SC.fmul` x) `SC.fsub` x2) <> 0 then (x `SC.fmul` SE.modp_sqrt_m1) else x in
F51.fevalh h1 (gsub tmp 5ul 5ul) == x))
let recover_x_step_3 tmp =
let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in // x
let t0 = sub tmp 10ul 5ul in
Hacl.Impl.Ed25519.Pow2_252m2.pow2_252m2 x3 x2; // x3 = x2^((prime + 3) / 8)
fsquare t0 x3; // t0 = x3 * x3
fdifference t0 t0 x2; // t0 = t0 - x2
reduce_513 t0;
reduce t0;
let t0_is_0 = is_0 t0 in
if t0_is_0 then () else mul_modp_sqrt_m1 x3
inline_for_extraction noextract
val recover_x_step_4: tmp:lbuffer uint64 15ul -> Stack bool
(requires fun h -> live h tmp /\
F51.mul_inv_t h (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h (gsub tmp 5ul 5ul))
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
F51.fevalh h0 (gsub tmp 5ul 5ul) == F51.fevalh h1 (gsub tmp 5ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
(let u = F51.fevalh h0 (gsub tmp 5ul 5ul) in
let v = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let y = (u `SC.fmul` u) `SC.fsub` v in
(z <==> y == SC.zero))) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.Compatibility.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Pow2_252m2.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.RecoverX.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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"
} | false | tmp: Lib.Buffer.lbuffer Lib.IntTypes.uint64 15ul -> FStar.HyperStack.ST.Stack Prims.bool | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Ed25519.RecoverX.is_0",
"Prims.bool",
"Prims.unit",
"Hacl.Bignum25519.reduce",
"Hacl.Bignum25519.reduce_513",
"Hacl.Bignum25519.fdifference",
"Hacl.Bignum25519.fsquare",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub"
] | [] | false | true | false | false | false | let recover_x_step_4 tmp =
| let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in
let t0 = sub tmp 10ul 5ul in
fsquare t0 x3;
fdifference t0 t0 x2;
reduce_513 t0;
reduce t0;
is_0 t0 | false |
Hacl.Test.HMAC_DRBG.fst | Hacl.Test.HMAC_DRBG.test_one | val test_one (vec: vector) : Stack unit (requires fun _ -> True) (ensures fun _ _ _ -> True) | val test_one (vec: vector) : Stack unit (requires fun _ -> True) (ensures fun _ _ _ -> True) | let test_one (vec:vector) : Stack unit (requires fun _ -> True) (ensures fun _ _ _ -> True) =
let a,
LB entropy_input_len entropy_input,
LB nonce_len nonce,
LB personalization_string_len personalization_string,
LB entropy_input_reseed_len entropy_input_reseed,
LB additional_input_reseed_len additional_input_reseed,
(LB additional_input_1_len additional_input_1,
LB additional_input_2_len additional_input_2),
LB returned_bits_len returned_bits = vec
in
B.recall entropy_input;
B.recall nonce;
B.recall personalization_string;
B.recall entropy_input_reseed;
B.recall additional_input_reseed;
B.recall additional_input_1;
B.recall additional_input_2;
B.recall returned_bits;
// We need to check this at runtime because Low*-ized vectors don't carry any refinements
if not (Spec.HMAC_DRBG.is_supported_alg a &&
min_length a <=. entropy_input_len &&
entropy_input_len <=. max_length &&
min_length a /. 2ul <=. nonce_len &&
nonce_len <=. max_length &&
personalization_string_len <=. max_personalization_string_length &&
min_length a <=. entropy_input_reseed_len &&
entropy_input_reseed_len <=. max_length &&
additional_input_reseed_len <=. max_additional_input_length &&
additional_input_1_len <=. max_additional_input_length &&
additional_input_2_len <=. max_additional_input_length &&
0ul <. returned_bits_len &&
returned_bits_len <=. max_output_length)
then C.exit (-1l)
else
begin
push_frame();
let output = B.alloca (u8 0) returned_bits_len in
let st = alloca a in
instantiate a st
entropy_input_len entropy_input
nonce_len nonce
personalization_string_len personalization_string;
reseed a st
entropy_input_reseed_len entropy_input_reseed
additional_input_reseed_len additional_input_reseed;
let ok = generate a output st returned_bits_len
additional_input_1_len additional_input_1
in
if ok then
let ok = generate a output st returned_bits_len
additional_input_2_len additional_input_2
in
if ok then
let ok = compare_and_print returned_bits output returned_bits_len in
if ok then ()
else C.exit 1l
else C.exit 1l
else C.exit 1l;
pop_frame()
end | {
"file_name": "code/tests/Hacl.Test.HMAC_DRBG.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 7,
"end_line": 112,
"start_col": 0,
"start_line": 52
} | module Hacl.Test.HMAC_DRBG
open FStar.HyperStack.ST
open Test.Lowstarize
open Lib.IntTypes
open Hacl.HMAC_DRBG
open Spec.HMAC_DRBG.Test.Vectors
module D = Spec.Hash.Definitions
module L = Test.Lowstarize
module B = LowStar.Buffer
#set-options "--fuel 0 --ifuel 0 --z3rlimit 100"
(* FStar.Reflection only supports up to 8-tuples *)
noextract
let vectors_tmp = List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[vectors_low] (lowstarize_toplevel "vectors_tmp" "vectors_low")
// Cheap alternative to friend Lib.IntTypes needed because Test.Lowstarize uses UInt8.t
assume val declassify_uint8: squash (uint8 == UInt8.t)
let vec8 = L.lbuffer UInt8.t
let vector = D.hash_alg & vec8 & vec8 & vec8 & vec8 & vec8 & (vec8 & vec8) & vec8
// This could replace TestLib.compare_and_print
val compare_and_print: b1:B.buffer UInt8.t -> b2:B.buffer UInt8.t -> len:UInt32.t
-> Stack bool
(requires fun h0 -> B.live h0 b1 /\ B.live h0 b2 /\ B.length b1 == v len /\ B.length b2 == v len)
(ensures fun h0 _ h1 -> B.modifies B.loc_none h0 h1)
let compare_and_print b1 b2 len =
push_frame();
LowStar.Printf.(printf "Expected: %xuy\n" len b1 done);
LowStar.Printf.(printf "Computed: %xuy\n" len b2 done);
let b = Lib.ByteBuffer.lbytes_eq #len b1 b2 in
if b then
LowStar.Printf.(printf "PASS\n" done)
else
LowStar.Printf.(printf "FAIL\n" done);
pop_frame();
b | {
"checked_file": "/",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.HMAC_DRBG.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"LowStar.Printf.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Hacl.HMAC_DRBG.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"C.String.fsti.checked",
"C.Loops.fst.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.HMAC_DRBG.fst"
} | [
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Test.Lowstarize",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Spec.HMAC_DRBG.Test.Vectors",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HMAC_DRBG",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"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
}
] | {
"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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vec: Hacl.Test.HMAC_DRBG.vector -> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Test.HMAC_DRBG.vector",
"Spec.Hash.Definitions.hash_alg",
"FStar.UInt32.t",
"LowStar.Buffer.buffer",
"FStar.UInt8.t",
"Prims.l_and",
"Prims.eq2",
"LowStar.Monotonic.Buffer.len",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.recallable",
"Prims.op_Negation",
"Prims.op_AmpAmp",
"Spec.HMAC_DRBG.is_supported_alg",
"Lib.IntTypes.op_Less_Equals_Dot",
"Lib.IntTypes.U32",
"Hacl.HMAC_DRBG.min_length",
"Hacl.HMAC_DRBG.max_length",
"Lib.IntTypes.op_Slash_Dot",
"FStar.UInt32.__uint_to_t",
"Hacl.HMAC_DRBG.max_personalization_string_length",
"Hacl.HMAC_DRBG.max_additional_input_length",
"Lib.IntTypes.op_Less_Dot",
"Hacl.HMAC_DRBG.max_output_length",
"C.exit",
"FStar.Int32.__int_to_t",
"Prims.unit",
"Prims.bool",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Test.HMAC_DRBG.compare_and_print",
"Hacl.HMAC_DRBG.generate",
"Hacl.HMAC_DRBG.reseed",
"Hacl.HMAC_DRBG.instantiate",
"Hacl.HMAC_DRBG.state",
"Hacl.HMAC_DRBG.alloca",
"LowStar.Monotonic.Buffer.mbuffer",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"Prims.b2t",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Buffer.alloca",
"Lib.IntTypes.uint8",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame",
"LowStar.Monotonic.Buffer.recall",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_True"
] | [] | false | true | false | false | false | let test_one (vec: vector) : Stack unit (requires fun _ -> True) (ensures fun _ _ _ -> True) =
| let
a,
LB entropy_input_len entropy_input,
LB nonce_len nonce,
LB personalization_string_len personalization_string,
LB entropy_input_reseed_len entropy_input_reseed,
LB additional_input_reseed_len additional_input_reseed,
(LB additional_input_1_len additional_input_1, LB additional_input_2_len additional_input_2),
LB returned_bits_len returned_bits =
vec
in
B.recall entropy_input;
B.recall nonce;
B.recall personalization_string;
B.recall entropy_input_reseed;
B.recall additional_input_reseed;
B.recall additional_input_1;
B.recall additional_input_2;
B.recall returned_bits;
if
not (Spec.HMAC_DRBG.is_supported_alg a && min_length a <=. entropy_input_len &&
entropy_input_len <=. max_length &&
min_length a /. 2ul <=. nonce_len &&
nonce_len <=. max_length &&
personalization_string_len <=. max_personalization_string_length &&
min_length a <=. entropy_input_reseed_len &&
entropy_input_reseed_len <=. max_length &&
additional_input_reseed_len <=. max_additional_input_length &&
additional_input_1_len <=. max_additional_input_length &&
additional_input_2_len <=. max_additional_input_length &&
0ul <. returned_bits_len &&
returned_bits_len <=. max_output_length)
then C.exit (-1l)
else
(push_frame ();
let output = B.alloca (u8 0) returned_bits_len in
let st = alloca a in
instantiate a
st
entropy_input_len
entropy_input
nonce_len
nonce
personalization_string_len
personalization_string;
reseed a
st
entropy_input_reseed_len
entropy_input_reseed
additional_input_reseed_len
additional_input_reseed;
let ok = generate a output st returned_bits_len additional_input_1_len additional_input_1 in
if ok
then
let ok = generate a output st returned_bits_len additional_input_2_len additional_input_2 in
if ok
then
let ok = compare_and_print returned_bits output returned_bits_len in
if ok then () else C.exit 1l
else C.exit 1l
else C.exit 1l;
pop_frame ()) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.ws | val ws : a: Spec.Hash.Definitions.sha2_alg ->
b: Spec.SHA2.block_w a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.word a | let ws = ws_aux | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16) | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
b: Spec.SHA2.block_w a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.word a | Prims.Tot | [
"total"
] | [] | [
"Spec.SHA2.Lemmas.ws_aux"
] | [] | false | false | false | false | false | let ws =
| ws_aux | false |
|
Hacl.P256.PrecompTable.fst | Hacl.P256.PrecompTable.precomp_g_pow2_192_table_w4 | val precomp_g_pow2_192_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_g_pow2_192_table_lseq_w4 /\ recallable x} | val precomp_g_pow2_192_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_g_pow2_192_table_lseq_w4 /\ recallable x} | let precomp_g_pow2_192_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_g_pow2_192_table_lseq_w4 /\ recallable x} =
createL_global precomp_g_pow2_192_table_list_w4 | {
"file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 276,
"start_col": 0,
"start_line": 274
} | module Hacl.P256.PrecompTable
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module LE = Lib.Exponentiation
module SE = Spec.Exponentiation
module SPT = Hacl.Spec.PrecompBaseTable
module SPT256 = Hacl.Spec.PrecompBaseTable256
module SPTK = Hacl.Spec.P256.PrecompTable
module S = Spec.P256
module SL = Spec.P256.Lemmas
open Hacl.Impl.P256.Point
include Hacl.Impl.P256.Group
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let proj_point_to_list p =
SPTK.proj_point_to_list_lemma p;
SPTK.proj_point_to_list p
let lemma_refl x =
SPTK.proj_point_to_list_lemma x
//-----------------
inline_for_extraction noextract
let proj_g_pow2_64 : S.proj_point =
[@inline_let]
let rX : S.felem = 0x000931f4ae428a4ad81ee0aa89cf5247ce85d4dd696c61b4bb9d4761e57b7fbe in
[@inline_let]
let rY : S.felem = 0x7e88e5e6a142d5c2269f21a158e82ab2c79fcecb26e397b96fd5b9fbcd0a69a5 in
[@inline_let]
let rZ : S.felem = 0x02626dc2dd5e06cd19de5e6afb6c5dbdd3e41dc1472e7b8ef11eb0662e41c44b in
(rX, rY, rZ)
val lemma_proj_g_pow2_64_eval : unit ->
Lemma (SE.exp_pow2 S.mk_p256_concrete_ops S.base_point 64 == proj_g_pow2_64)
let lemma_proj_g_pow2_64_eval () =
SPT256.exp_pow2_rec_is_exp_pow2 S.mk_p256_concrete_ops S.base_point 64;
let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops S.base_point 64) in
normalize_term_spec (SPT256.exp_pow2_rec S.mk_p256_concrete_ops S.base_point 64);
let rX : S.felem = 0x000931f4ae428a4ad81ee0aa89cf5247ce85d4dd696c61b4bb9d4761e57b7fbe in
let rY : S.felem = 0x7e88e5e6a142d5c2269f21a158e82ab2c79fcecb26e397b96fd5b9fbcd0a69a5 in
let rZ : S.felem = 0x02626dc2dd5e06cd19de5e6afb6c5dbdd3e41dc1472e7b8ef11eb0662e41c44b in
assert_norm (qX == rX /\ qY == rY /\ qZ == rZ)
inline_for_extraction noextract
let proj_g_pow2_128 : S.proj_point =
[@inline_let]
let rX : S.felem = 0x04c3aaf6c6c00704e96eda89461d63fd2c97ee1e6786fc785e6afac7aa92f9b1 in
[@inline_let]
let rY : S.felem = 0x14f1edaeb8e9c8d4797d164a3946c7ff50a7c8cd59139a4dbce354e6e4df09c3 in
[@inline_let]
let rZ : S.felem = 0x80119ced9a5ce83c4e31f8de1a38f89d5f9ff9f637dca86d116a4217f83e55d2 in
(rX, rY, rZ)
val lemma_proj_g_pow2_128_eval : unit ->
Lemma (SE.exp_pow2 S.mk_p256_concrete_ops proj_g_pow2_64 64 == proj_g_pow2_128)
let lemma_proj_g_pow2_128_eval () =
SPT256.exp_pow2_rec_is_exp_pow2 S.mk_p256_concrete_ops proj_g_pow2_64 64;
let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_64 64) in
normalize_term_spec (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_64 64);
let rX : S.felem = 0x04c3aaf6c6c00704e96eda89461d63fd2c97ee1e6786fc785e6afac7aa92f9b1 in
let rY : S.felem = 0x14f1edaeb8e9c8d4797d164a3946c7ff50a7c8cd59139a4dbce354e6e4df09c3 in
let rZ : S.felem = 0x80119ced9a5ce83c4e31f8de1a38f89d5f9ff9f637dca86d116a4217f83e55d2 in
assert_norm (qX == rX /\ qY == rY /\ qZ == rZ)
inline_for_extraction noextract
let proj_g_pow2_192 : S.proj_point =
[@inline_let]
let rX : S.felem = 0xc762a9c8ae1b2f7434ff8da70fe105e0d4f188594989f193de0dbdbf5f60cb9a in
[@inline_let]
let rY : S.felem = 0x1eddaf51836859e1369f1ae8d9ab02e4123b6f151d9b796e297a38fa5613d9bc in
[@inline_let]
let rZ : S.felem = 0xcb433ab3f67815707e398dc7910cc4ec6ea115360060fc73c35b53dce02e2c72 in
(rX, rY, rZ)
val lemma_proj_g_pow2_192_eval : unit ->
Lemma (SE.exp_pow2 S.mk_p256_concrete_ops proj_g_pow2_128 64 == proj_g_pow2_192)
let lemma_proj_g_pow2_192_eval () =
SPT256.exp_pow2_rec_is_exp_pow2 S.mk_p256_concrete_ops proj_g_pow2_128 64;
let qX, qY, qZ = normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_128 64) in
normalize_term_spec (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_128 64);
let rX : S.felem = 0xc762a9c8ae1b2f7434ff8da70fe105e0d4f188594989f193de0dbdbf5f60cb9a in
let rY : S.felem = 0x1eddaf51836859e1369f1ae8d9ab02e4123b6f151d9b796e297a38fa5613d9bc in
let rZ : S.felem = 0xcb433ab3f67815707e398dc7910cc4ec6ea115360060fc73c35b53dce02e2c72 in
assert_norm (qX == rX /\ qY == rY /\ qZ == rZ)
// let proj_g_pow2_64 : S.proj_point =
// normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops S.base_point 64)
// let proj_g_pow2_128 : S.proj_point =
// normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_64 64)
// let proj_g_pow2_192 : S.proj_point =
// normalize_term (SPT256.exp_pow2_rec S.mk_p256_concrete_ops proj_g_pow2_128 64)
inline_for_extraction noextract
let proj_g_pow2_64_list : SPTK.point_list =
normalize_term (SPTK.proj_point_to_list proj_g_pow2_64)
inline_for_extraction noextract
let proj_g_pow2_128_list : SPTK.point_list =
normalize_term (SPTK.proj_point_to_list proj_g_pow2_128)
inline_for_extraction noextract
let proj_g_pow2_192_list : SPTK.point_list =
normalize_term (SPTK.proj_point_to_list proj_g_pow2_192)
let proj_g_pow2_64_lseq : LSeq.lseq uint64 12 =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64);
Seq.seq_of_list proj_g_pow2_64_list
let proj_g_pow2_128_lseq : LSeq.lseq uint64 12 =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128);
Seq.seq_of_list proj_g_pow2_128_list
let proj_g_pow2_192_lseq : LSeq.lseq uint64 12 =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192);
Seq.seq_of_list proj_g_pow2_192_list
val proj_g_pow2_64_lemma: unit ->
Lemma (S.to_aff_point proj_g_pow2_64 == pow_point (pow2 64) g_aff)
let proj_g_pow2_64_lemma () =
lemma_proj_g_pow2_64_eval ();
SPT256.a_pow2_64_lemma S.mk_p256_concrete_ops S.base_point
val proj_g_pow2_128_lemma: unit ->
Lemma (S.to_aff_point proj_g_pow2_128 == pow_point (pow2 128) g_aff)
let proj_g_pow2_128_lemma () =
lemma_proj_g_pow2_128_eval ();
lemma_proj_g_pow2_64_eval ();
SPT256.a_pow2_128_lemma S.mk_p256_concrete_ops S.base_point
val proj_g_pow2_192_lemma: unit ->
Lemma (S.to_aff_point proj_g_pow2_192 == pow_point (pow2 192) g_aff)
let proj_g_pow2_192_lemma () =
lemma_proj_g_pow2_192_eval ();
lemma_proj_g_pow2_128_eval ();
lemma_proj_g_pow2_64_eval ();
SPT256.a_pow2_192_lemma S.mk_p256_concrete_ops S.base_point
let proj_g_pow2_64_lseq_lemma () =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_64);
proj_g_pow2_64_lemma ();
SPTK.proj_point_to_list_lemma proj_g_pow2_64
let proj_g_pow2_128_lseq_lemma () =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_128);
proj_g_pow2_128_lemma ();
SPTK.proj_point_to_list_lemma proj_g_pow2_128
let proj_g_pow2_192_lseq_lemma () =
normalize_term_spec (SPTK.proj_point_to_list proj_g_pow2_192);
proj_g_pow2_192_lemma ();
SPTK.proj_point_to_list_lemma proj_g_pow2_192
let mk_proj_g_pow2_64 () =
createL proj_g_pow2_64_list
let mk_proj_g_pow2_128 () =
createL proj_g_pow2_128_list
let mk_proj_g_pow2_192 () =
createL proj_g_pow2_192_list
//----------------
/// window size = 4; precomputed table = [[0]G, [1]G, ..., [15]G]
inline_for_extraction noextract
let precomp_basepoint_table_list_w4: x:list uint64{FStar.List.Tot.length x = 192} =
normalize_term (SPT.precomp_base_table_list mk_p256_precomp_base_table S.base_point 15)
let precomp_basepoint_table_lseq_w4 : LSeq.lseq uint64 192 =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table S.base_point 15);
Seq.seq_of_list precomp_basepoint_table_list_w4
let precomp_basepoint_table_lemma_w4 () =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table S.base_point 15);
SPT.precomp_base_table_lemma mk_p256_precomp_base_table S.base_point 16 precomp_basepoint_table_lseq_w4
let precomp_basepoint_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_basepoint_table_lseq_w4 /\ recallable x} =
createL_global precomp_basepoint_table_list_w4
/// window size = 4; precomputed table = [[0]([pow2 64]G), [1]([pow2 64]G), ..., [15]([pow2 64]G)]
inline_for_extraction noextract
let precomp_g_pow2_64_table_list_w4: x:list uint64{FStar.List.Tot.length x = 192} =
normalize_term (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_64 15)
let precomp_g_pow2_64_table_lseq_w4 : LSeq.lseq uint64 192 =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_64 15);
Seq.seq_of_list precomp_g_pow2_64_table_list_w4
let precomp_g_pow2_64_table_lemma_w4 () =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_64 15);
SPT.precomp_base_table_lemma mk_p256_precomp_base_table
proj_g_pow2_64 16 precomp_g_pow2_64_table_lseq_w4;
proj_g_pow2_64_lemma ()
let precomp_g_pow2_64_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_g_pow2_64_table_lseq_w4 /\ recallable x} =
createL_global precomp_g_pow2_64_table_list_w4
/// window size = 4; precomputed table = [[0]([pow2 128]G), [1]([pow2 128]G),...,[15]([pow2 128]G)]
inline_for_extraction noextract
let precomp_g_pow2_128_table_list_w4: x:list uint64{FStar.List.Tot.length x = 192} =
normalize_term (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_128 15)
let precomp_g_pow2_128_table_lseq_w4 : LSeq.lseq uint64 192 =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_128 15);
Seq.seq_of_list precomp_g_pow2_128_table_list_w4
let precomp_g_pow2_128_table_lemma_w4 () =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_128 15);
SPT.precomp_base_table_lemma mk_p256_precomp_base_table
proj_g_pow2_128 16 precomp_g_pow2_64_table_lseq_w4;
proj_g_pow2_128_lemma ()
let precomp_g_pow2_128_table_w4:
x:glbuffer uint64 192ul{witnessed x precomp_g_pow2_128_table_lseq_w4 /\ recallable x} =
createL_global precomp_g_pow2_128_table_list_w4
/// window size = 4; precomputed table = [[0]([pow2 192]G), [1]([pow2 192]G),...,[15]([pow2 192]G)]
inline_for_extraction noextract
let precomp_g_pow2_192_table_list_w4: x:list uint64{FStar.List.Tot.length x = 192} =
normalize_term (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_192 15)
let precomp_g_pow2_192_table_lseq_w4 : LSeq.lseq uint64 192 =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_192 15);
Seq.seq_of_list precomp_g_pow2_192_table_list_w4
let precomp_g_pow2_192_table_lemma_w4 () =
normalize_term_spec (SPT.precomp_base_table_list mk_p256_precomp_base_table proj_g_pow2_192 15);
SPT.precomp_base_table_lemma mk_p256_precomp_base_table
proj_g_pow2_192 16 precomp_g_pow2_64_table_lseq_w4;
proj_g_pow2_192_lemma () | {
"checked_file": "/",
"dependencies": [
"Spec.P256.Lemmas.fsti.checked",
"Spec.P256.fst.checked",
"Spec.Exponentiation.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Exponentiation.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.PrecompBaseTable256.fsti.checked",
"Hacl.Spec.PrecompBaseTable.fsti.checked",
"Hacl.Spec.P256.PrecompTable.fsti.checked",
"Hacl.Impl.P256.Point.fsti.checked",
"Hacl.Impl.P256.Group.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.P256.PrecompTable.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.P256.Lemmas",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.P256.PrecompTable",
"short_module": "SPTK"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.PrecompBaseTable256",
"short_module": "SPT256"
},
{
"abbrev": true,
"full_module": "Lib.Exponentiation",
"short_module": "LE"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Group",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Point",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.P256.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.PrecompBaseTable",
"short_module": "SPT"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Exponentiation.Definitions",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Spec.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Lib.Exponentiation.Definition",
"short_module": "LE"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.P256",
"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
}
] | {
"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"
} | false | x:
Lib.Buffer.glbuffer Lib.IntTypes.uint64 192ul
{ Lib.Buffer.witnessed x Hacl.P256.PrecompTable.precomp_g_pow2_192_table_lseq_w4 /\
Lib.Buffer.recallable x } | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_global",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Hacl.P256.PrecompTable.precomp_g_pow2_192_table_list_w4",
"Lib.Buffer.glbuffer",
"Lib.IntTypes.size",
"FStar.Pervasives.normalize_term",
"Lib.IntTypes.size_nat",
"FStar.List.Tot.Base.length",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Prims.l_and",
"Lib.Buffer.witnessed",
"Hacl.P256.PrecompTable.precomp_g_pow2_192_table_lseq_w4",
"Lib.Buffer.recallable",
"Lib.Buffer.CONST"
] | [] | false | false | false | false | false | let precomp_g_pow2_192_table_w4:x:
glbuffer uint64 192ul {witnessed x precomp_g_pow2_192_table_lseq_w4 /\ recallable x} =
| createL_global precomp_g_pow2_192_table_list_w4 | false |
Hacl.Impl.Ed25519.RecoverX.fst | Hacl.Impl.Ed25519.RecoverX.recover_x_step_2 | val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2)) | val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2)) | let recover_x_step_2 x sign x2 =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x2_is_0 = is_0 x2 in
if x2_is_0 then begin
if u64_to_UInt64 sign =^ 0uL then (make_zero x; u8 1) else u8 0 end
else u8 2 | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.RecoverX.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 155,
"start_col": 0,
"start_line": 149
} | module Hacl.Impl.Ed25519.RecoverX
module ST = FStar.HyperStack.ST
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
module SE = Spec.Ed25519
#reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
inline_for_extraction noextract
let elemB = lbuffer uint64 5ul
val is_0: x:elemB -> Stack bool
(requires fun h -> live h x /\ F51.as_nat h x == F51.fevalh h x)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.fevalh h0 x == SC.zero)))
[@CInline]
let is_0 x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 =^ 0uL &&
u64_to_UInt64 x1 =^ 0uL &&
u64_to_UInt64 x2 =^ 0uL &&
u64_to_UInt64 x3 =^ 0uL &&
u64_to_UInt64 x4 =^ 0uL)
inline_for_extraction noextract
val gte_q: x:elemB -> Stack bool
(requires fun h -> live h x /\
F51.felem_fits h x (1, 1, 1, 1, 1))
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.as_nat h0 x >= SC.prime)))
let gte_q x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 >=^ 0x7ffffffffffeduL &&
u64_to_UInt64 x1 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x2 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x3 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x4 =^ 0x7ffffffffffffuL)
val mul_modp_sqrt_m1: x:elemB -> Stack unit
(requires fun h -> live h x /\ F51.mul_inv_t h x)
(ensures fun h0 _ h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == F51.fevalh h0 x `SC.fmul` SE.modp_sqrt_m1)
[@CInline]
let mul_modp_sqrt_m1 x =
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00061b274a0ea0b0,
u64 0x0000d5a5fc8f189d,
u64 0x0007ef5e9cbd0c60,
u64 0x00078595a6804c9e,
u64 0x0002b8324804fc1d) in
push_frame();
let sqrt_m1 = create 5ul (u64 0) in
make_u64_5 sqrt_m1 x0 x1 x2 x3 x4;
assert_norm (S51.as_nat5 (x0, x1, x2, x3, x4) == SE.modp_sqrt_m1);
fmul x x sqrt_m1;
pop_frame()
inline_for_extraction noextract
val x_mod_2: x:felem -> Stack uint64
(requires fun h -> live h x)
(ensures fun h0 z h1 -> h0 == h1 /\ v z < 2 /\
v z == F51.as_nat h0 x % 2)
let x_mod_2 x =
let x0 = x.(0ul) in
let z = x0 &. u64 1 in
mod_mask_lemma x0 1ul;
Lib.IntTypes.Compatibility.uintv_extensionality (u64 1) (mod_mask #U64 1ul);
z
inline_for_extraction noextract
val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one))))
let recover_x_step_1 x2 y =
push_frame();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y; // y2 = y * y
times_d dyy y2; // dyy = d * y2
fsum dyy dyy one; // dyy = (d * y2) + one
reduce_513 dyy;
inverse dyyi dyy; // dyyi = modp_inv ((d * y2) + one)
fdifference x2 y2 one; // x2 = y2 - one
fmul x2 x2 dyyi; // x2 = (y2 - one) * dyyi
reduce x2;
pop_frame()
inline_for_extraction noextract
val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2)) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.Compatibility.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Pow2_252m2.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.RecoverX.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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"
} | false |
x: Hacl.Impl.Ed25519.RecoverX.elemB ->
sign: Lib.IntTypes.uint64 ->
x2: Hacl.Impl.Ed25519.RecoverX.elemB
-> FStar.HyperStack.ST.Stack Lib.IntTypes.uint8 | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Ed25519.RecoverX.elemB",
"Lib.IntTypes.uint64",
"FStar.UInt64.op_Equals_Hat",
"Lib.RawIntTypes.u64_to_UInt64",
"FStar.UInt64.__uint_to_t",
"Lib.IntTypes.u8",
"Lib.IntTypes.uint8",
"Prims.unit",
"Hacl.Bignum25519.make_zero",
"Prims.bool",
"Hacl.Impl.Ed25519.RecoverX.is_0"
] | [] | false | true | false | false | false | let recover_x_step_2 x sign x2 =
| let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x2_is_0 = is_0 x2 in
if x2_is_0
then
if u64_to_UInt64 sign =^ 0uL
then
(make_zero x;
u8 1)
else u8 0
else u8 2 | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.shuffle_core | val shuffle_core : a: Spec.Hash.Definitions.sha2_alg ->
block: Spec.SHA2.block_w a ->
hash: Spec.Hash.Definitions.words_state a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.words_state a | let shuffle_core = shuffle_core_ | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 56,
"start_col": 0,
"start_line": 56
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
block: Spec.SHA2.block_w a ->
hash: Spec.Hash.Definitions.words_state a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.words_state a | Prims.Tot | [
"total"
] | [] | [
"Spec.SHA2.Lemmas.shuffle_core_"
] | [] | false | false | false | false | false | let shuffle_core =
| shuffle_core_ | false |
|
Pulse.Lib.Stick.fst | Pulse.Lib.Stick.intro_stick | val intro_stick
(hyp concl: vprop)
(v: vprop)
(f_elim: unit -> (
stt_ghost unit
(v ** hyp)
(fun _ -> concl)
))
: stt_ghost unit
v
(fun _ -> stick hyp concl) | val intro_stick
(hyp concl: vprop)
(v: vprop)
(f_elim: unit -> (
stt_ghost unit
(v ** hyp)
(fun _ -> concl)
))
: stt_ghost unit
v
(fun _ -> stick hyp concl) | let intro_stick p q v f =
T.intro_trade p q v f | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Stick.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 23,
"end_line": 39,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2023 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 Pulse.Lib.Stick
open Pulse.Lib.Pervasives
module T = Pulse.Lib.Trade
(* This lemma needed to typecheck the definitions below. *)
let emp_unit_left (p:vprop)
: Lemma (emp ** p == p)
[SMTPat (emp ** p)]
= elim_vprop_equiv (vprop_equiv_unit p)
(* This module is just a special case of trades. The tactic
instantiates the implicit InvList to [] everywhere. We do not
even need to use the Pulse checker for it. *)
let stick (p q : vprop) =
T.trade p q
let elim_stick p q =
T.elim_trade_ghost p q | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Trade.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.Stick.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.Trade",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"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
}
] | {
"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"
} | false |
hyp: Pulse.Lib.Core.vprop ->
concl: Pulse.Lib.Core.vprop ->
v: Pulse.Lib.Core.vprop ->
f_elim: (_: Prims.unit -> Pulse.Lib.Core.stt_ghost Prims.unit (v ** hyp) (fun _ -> concl))
-> Pulse.Lib.Core.stt_ghost Prims.unit v (fun _ -> Pulse.Lib.Stick.stick hyp concl) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Prims.unit",
"Pulse.Lib.Core.stt_ghost",
"Pulse.Lib.Core.op_Star_Star",
"Pulse.Lib.Trade.intro_trade",
"Pulse.Lib.InvList.invlist_empty",
"Pulse.Lib.Stick.stick"
] | [] | false | false | false | false | false | let intro_stick p q v f =
| T.intro_trade p q v f | false |
Hacl.Impl.P256.Point.fst | Hacl.Impl.P256.Point.to_aff_point | val to_aff_point: res:aff_point -> p:point -> Stack unit
(requires fun h ->
live h p /\ live h res /\ eq_or_disjoint p res /\
point_inv h p)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_aff_point_nat h1 res == S.to_aff_point (from_mont_point (as_point_nat h0 p))) | val to_aff_point: res:aff_point -> p:point -> Stack unit
(requires fun h ->
live h p /\ live h res /\ eq_or_disjoint p res /\
point_inv h p)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_aff_point_nat h1 res == S.to_aff_point (from_mont_point (as_point_nat h0 p))) | let to_aff_point res p =
push_frame ();
let zinv = create_felem () in
let px = getx p in
let py = gety p in
let pz = getz p in
let x = aff_getx res in
let y = aff_gety res in
FI.finv zinv pz;
fmul x px zinv;
fmul y py zinv;
from_mont x x;
from_mont y y;
pop_frame () | {
"file_name": "code/ecdsap256/Hacl.Impl.P256.Point.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 102,
"start_col": 0,
"start_line": 87
} | module Hacl.Impl.P256.Point
open FStar.Mul
open FStar.HyperStack.All
open FStar.HyperStack
module ST = FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.P256.Bignum
open Hacl.Impl.P256.Field
open Hacl.Impl.P256.Constants
module S = Spec.P256
module SM = Hacl.Spec.P256.Montgomery
module FI = Hacl.Impl.P256.Finv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Create a point
let create_aff_point () =
create 8ul (u64 0)
let create_point () =
create 12ul (u64 0)
[@CInline]
let make_base_point p =
let x = getx p in
let y = gety p in
let z = getz p in
make_g_x x;
make_g_y y;
make_fone z
[@CInline]
let make_point_at_inf p =
let x = getx p in
let y = gety p in
let z = getz p in
make_fzero x;
make_fone y;
make_fzero z
/// Check if a point is a point-at-infinity
(* https://crypto.stackexchange.com/questions/43869/point-at-infinity-and-error-handling*)
val lemma_mont_is_point_at_inf: p:S.proj_point{let (_, _, z) = p in z < S.prime} ->
Lemma (S.is_point_at_inf p == S.is_point_at_inf (from_mont_point p))
let lemma_mont_is_point_at_inf p =
let px, py, pz = p in
SM.lemma_from_mont_zero pz
[@CInline]
let is_point_at_inf p =
let h0 = ST.get () in
lemma_mont_is_point_at_inf (as_point_nat h0 p);
let pz = getz p in
bn_is_zero_mask4 pz
[@CInline]
let is_point_at_inf_vartime p =
let h0 = ST.get () in
lemma_mont_is_point_at_inf (as_point_nat h0 p);
let pz = getz p in
bn_is_zero_vartime4 pz
/// Create a copy of a point
let copy_point res p =
copy res p
/// Point conversion between Projective and Affine coordinates representations | {
"checked_file": "/",
"dependencies": [
"Spec.P256.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.P256.Montgomery.fsti.checked",
"Hacl.Impl.P256.Finv.fsti.checked",
"Hacl.Impl.P256.Field.fsti.checked",
"Hacl.Impl.P256.Constants.fst.checked",
"Hacl.Impl.P256.Bignum.fsti.checked",
"Hacl.Bignum.Base.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Impl.P256.Point.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Impl.P256.Finv",
"short_module": "FI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.P256.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Field",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "BD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.P256.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"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
}
] | {
"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"
} | false | res: Hacl.Impl.P256.Point.aff_point -> p: Hacl.Impl.P256.Point.point
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.P256.Point.aff_point",
"Hacl.Impl.P256.Point.point",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.P256.Field.from_mont",
"Hacl.Impl.P256.Field.fmul",
"Hacl.Impl.P256.Finv.finv",
"Hacl.Impl.P256.Bignum.felem",
"Hacl.Impl.P256.Point.aff_gety",
"Hacl.Impl.P256.Point.aff_getx",
"Hacl.Impl.P256.Point.getz",
"Hacl.Impl.P256.Point.gety",
"Hacl.Impl.P256.Point.getx",
"Hacl.Impl.P256.Bignum.create_felem",
"FStar.HyperStack.ST.push_frame"
] | [] | false | true | false | false | false | let to_aff_point res p =
| push_frame ();
let zinv = create_felem () in
let px = getx p in
let py = gety p in
let pz = getz p in
let x = aff_getx res in
let y = aff_gety res in
FI.finv zinv pz;
fmul x px zinv;
fmul y py zinv;
from_mont x x;
from_mont y y;
pop_frame () | false |
Pulse.Typing.Combinators.fst | Pulse.Typing.Combinators.mk_bind | val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True) | val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True) | let rec mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st {
st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True) =
let _, x = px in
let b = nvar_as_binder px (comp_res c1) in
let fail_bias (#a:Type) tag
: T.TacH a (requires fun _ -> True) (ensures fun _ r -> FStar.Tactics.Result.Failed? r)
= let open Pulse.PP in
fail_doc g (Some e1.range)
[text "Cannot compose computations in this " ^/^ text tag ^/^ text " block:";
prefix 4 1 (text "This computation has effect: ") (pp (effect_annot_of_comp c1));
prefix 4 1 (text "The continuation has effect: ") (pp (effect_annot_of_comp c2))]
in
match c1, c2 with
| C_ST _, C_ST _ ->
mk_bind_st_st g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_STGhost _, C_STGhost _ ->
mk_bind_ghost_ghost g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_STAtomic inames1 obs1 sc1, C_STAtomic inames2 obs2 sc2 ->
if at_most_one_observable obs1 obs2
then (
mk_bind_atomic_atomic g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
)
else if bias_towards_continuation
then fail_bias "atomic"
else (
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
)
| C_STAtomic inames _ _, C_ST _ ->
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_ST _, C_STAtomic inames _ _ ->
if bias_towards_continuation
then fail_bias "atomic"
else (
let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_STAtomic_ST _ c2) in
let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in
(| t, c, d |)
)
| C_STGhost _, C_STAtomic _ Neutral _ -> (
match try_lift_ghost_atomic d_e1 with
| Some d_e1 ->
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| None ->
if bias_towards_continuation
then fail_bias "atomic"
else (
let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_Neutral_Ghost _ c2) in
let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in
(| t, c, d |)
)
)
| C_STAtomic _ Neutral _, C_STGhost _ -> (
if bias_towards_continuation
then (
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
)
else (
match try_lift_ghost_atomic d_e2 with
| Some d_e2 ->
let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in
(| t, c, d |)
| None ->
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
)
)
| C_STGhost _, C_ST _
| C_STGhost _, C_STAtomic _ _ _ ->
let d_e1 = lift_ghost_atomic d_e1 in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_ST _, C_STGhost _
| C_STAtomic _ _ _, C_STGhost _ ->
if bias_towards_continuation
then fail_bias "ghost"
else (
let d_e2 = lift_ghost_atomic d_e2 in
let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in
(| t, c, d |)
) | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 387,
"start_col": 0,
"start_line": 273
} | (*
Copyright 2023 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 Pulse.Typing.Combinators
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
assume
val invert_forall_typing
(#g #u #b #body:_)
(d:tot_typing g (tm_forall_sl u b body) tm_vprop)
(x:var { None? (lookup g x) /\ ~ (x `Set.mem` freevars body) })
: GTot (
tot_typing g b.binder_ty (tm_type u) &
tot_typing (push_binding g x ppname_default b.binder_ty) (open_term body x) tm_vprop
)
assume
val construct_forall_typing
(#g #u #b #body:_)
(x:var { None? (lookup g x) /\ ~ (x `Set.mem` freevars body) })
(dt:tot_typing g b.binder_ty (tm_type u))
(db:tot_typing (push_binding g x ppname_default b.binder_ty) (open_term body x) tm_vprop)
: GTot (tot_typing g (tm_forall_sl u b body) tm_vprop)
let rec vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)
: GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &
(tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))
(decreases v)
= match v with
| VE_Refl _ _ -> (fun x -> x), (fun x -> x)
| VE_Sym _ _ _ v' ->
let f, g = vprop_equiv_typing v' in
g, f
| VE_Trans g t0 t2 t1 v02 v21 ->
let f02, f20 = vprop_equiv_typing v02 in
let f21, f12 = vprop_equiv_typing v21 in
(fun x -> f21 (f02 x)),
(fun x -> f20 (f12 x))
| VE_Ctxt g s0 s1 s0' s1' v0 v1 ->
let f0, f0' = vprop_equiv_typing v0 in
let f1, f1' = vprop_equiv_typing v1 in
let ff (x:tot_typing g (tm_star s0 s1) tm_vprop)
: tot_typing g (tm_star s0' s1') tm_vprop
= let s0_typing = star_typing_inversion_l x in
let s1_typing = star_typing_inversion_r x in
let s0'_typing, s1'_typing = f0 s0_typing, f1 s1_typing in
star_typing s0'_typing s1'_typing
in
let gg (x:tot_typing g (tm_star s0' s1') tm_vprop)
: tot_typing g (tm_star s0 s1) tm_vprop
= let s0'_typing = star_typing_inversion_l x in
let s1'_typing = star_typing_inversion_r x in
star_typing (f0' s0'_typing) (f1' s1'_typing)
in
ff, gg
| VE_Unit g t ->
let fwd (x:tot_typing g (tm_star tm_emp t) tm_vprop)
: tot_typing g t tm_vprop
= let r = star_typing_inversion_r x in
r
in
let bk (x:tot_typing g t tm_vprop)
: tot_typing g (tm_star tm_emp t) tm_vprop
= star_typing emp_typing x
in
fwd, bk
| VE_Comm g t0 t1 ->
let f t0 t1 (x:tot_typing g (tm_star t0 t1) tm_vprop)
: tot_typing g (tm_star t1 t0) tm_vprop
= let tt0 = star_typing_inversion_l x in
let tt1 = star_typing_inversion_r x in
star_typing tt1 tt0
in
f t0 t1, f t1 t0
| VE_Assoc g t0 t1 t2 ->
let fwd (x:tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop)
: tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop
= let tt0 = star_typing_inversion_l x in
let tt12 = star_typing_inversion_r x in
let tt1 = star_typing_inversion_l tt12 in
let tt2 = star_typing_inversion_r tt12 in
star_typing (star_typing tt0 tt1) tt2
in
let bk (x : tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop)
: tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop
= let tt01 = star_typing_inversion_l x in
let tt2 = star_typing_inversion_r x in
let tt0 = star_typing_inversion_l tt01 in
let tt1 = star_typing_inversion_r tt01 in
star_typing tt0 (star_typing tt1 tt2)
in
fwd, bk
| VE_Ext g t0 t1 token ->
let d1, d2 = vprop_eq_typing_inversion g t0 t1 token in
(fun _ -> d2),
(fun _ -> d1)
| VE_Fa g x u b t0 t1 d ->
let d0, d1 = vprop_equiv_typing d in
(fun fa0_typing ->
let b_typing, t0_typing = invert_forall_typing fa0_typing x in
let t1_typing = d0 t0_typing in
construct_forall_typing #g #u x b_typing t1_typing),
(fun fa1_typing ->
let b_typing, t1_typing = invert_forall_typing fa1_typing x in
let t0_typing = d1 t1_typing in
construct_forall_typing #g #u #b #t0 x b_typing t0_typing)
#push-options "--z3rlimit_factor 8 --ifuel 1 --fuel 2 --query_stats"
let bind_t (case_c1 case_c2:comp_st -> bool) =
(g:env) ->
(pre:term) ->
(e1:st_term) ->
(e2:st_term) ->
(c1:comp_st{ case_c1 c1 }) ->
(c2:comp_st{ case_c2 c2 }) ->
(px:nvar { ~ (Set.mem (snd px) (dom g)) }) ->
(d_e1:st_typing g e1 c1) ->
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1))) ->
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2) ->
(res_typing:universe_of g (comp_res c2) (comp_u c2)) ->
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop) ->
(bias_towards_continuation:bool) ->
T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True)
let mk_bind_st_st
: bind_t C_ST? C_ST?
= fun g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing _ ->
let _, x = px in
let b = nvar_as_binder px (comp_res c1) in
let bc = Bind_comp g x c1 c2 res_typing x post_typing in
(| _, _, T_Bind _ e1 e2 _ _ b _ _ d_e1 d_c1res d_e2 bc |)
let inames_of (c:comp_st) : term =
match c with
| C_ST _
| C_STGhost _ -> tm_emp_inames
| C_STAtomic inames _ _ -> inames
let with_inames (c:comp_st) (i:term) =
match c with
| C_ST _ -> c
| C_STGhost sc -> C_STGhost sc
| C_STAtomic _ obs sc -> C_STAtomic i obs sc
let weaken_comp_inames (#g:env) (#e:st_term) (#c:comp_st) (d_e:st_typing g e c) (new_inames:term)
: T.Tac (c':comp_st { with_inames c new_inames == c' } &
st_typing g e c')
= match c with
| C_ST _
| C_STGhost _ -> (| c, d_e |)
| C_STAtomic inames obs sc ->
let d_e = T_Sub _ _ _ _ d_e (STS_AtomicInvs _ sc inames new_inames obs obs (check_prop_validity _ _ (tm_inames_subset_typing _ _ _))) in
(| with_inames c new_inames, d_e |)
let st_ghost_as_atomic (c:comp_st { C_STGhost? c }) =
C_STAtomic tm_emp_inames Neutral (st_comp_of_comp c)
let try_lift_ghost_atomic (#g:env) (#e:st_term) (#c:comp_st { C_STGhost? c }) (d:st_typing g e c)
: T.Tac (option (st_typing g e (st_ghost_as_atomic c)))
= let w = try_get_non_informative_witness g (comp_u c) (comp_res c) in
match w with
| None -> None
| Some w ->
let d = T_Lift _ _ _ _ d (Lift_Ghost_Neutral _ c w) in
Some d
let lift_ghost_atomic (#g:env) (#e:st_term) (#c:comp_st { C_STGhost? c }) (d:st_typing g e c)
: T.Tac (st_typing g e (st_ghost_as_atomic c))
= let w = try_lift_ghost_atomic d in
match w with
| None ->
let open Pulse.PP in
let t = comp_res c in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some d ->
d
let mk_bind_ghost_ghost
: bind_t C_STGhost? C_STGhost?
= fun g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing _ ->
let _, x = px in
let b = nvar_as_binder px (comp_res c1) in
let bc = Bind_comp g x c1 c2 res_typing x post_typing in
(| _, _, T_Bind _ e1 e2 _ _ b _ _ d_e1 d_c1res d_e2 bc |)
#push-options "--query_stats"
let mk_bind_atomic_atomic
: bind_t C_STAtomic? C_STAtomic?
= fun g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_k ->
let _, x = px in
let b = nvar_as_binder px (comp_res c1) in
let C_STAtomic inames1 obs1 sc1 = c1 in
let C_STAtomic inames2 obs2 sc2 = c2 in
if at_most_one_observable obs1 obs2
then (
if eq_tm inames1 inames2
then begin
let bc = Bind_comp g x c1 c2 res_typing x post_typing in
(| _, _, T_Bind _ e1 e2 _ _ b _ _ d_e1 d_c1res d_e2 bc |)
end
else if bias_k
then (
let d_e1 = T_Sub _ _ _ _ d_e1 (STS_AtomicInvs _ sc1 inames1 inames2 obs1 obs1 (check_prop_validity _ _ (tm_inames_subset_typing _ _ _))) in
let c1 = C_STAtomic inames2 obs1 sc1 in
let bc = Bind_comp g x c1 c2 res_typing x post_typing in
(| _, _, T_Bind _ e1 e2 _ _ b _ _ d_e1 d_c1res d_e2 bc |)
)
else begin
let new_inames = tm_join_inames inames1 inames2 in
let d_e1 = T_Sub _ _ _ _ d_e1 (STS_AtomicInvs _ sc1 inames1 new_inames obs1 obs1 (check_prop_validity _ _ (tm_inames_subset_typing _ _ _))) in
let d_e2 = T_Sub _ _ _ _ d_e2 (STS_AtomicInvs _ sc2 inames2 new_inames obs2 obs2 (check_prop_validity _ _ (tm_inames_subset_typing _ _ _))) in
let c1 = C_STAtomic new_inames obs1 sc1 in
let c2 = C_STAtomic new_inames obs2 sc2 in
let bc = Bind_comp g x c1 c2 res_typing x post_typing in
(| _, _, T_Bind _ e1 e2 _ _ b _ _ d_e1 d_c1res d_e2 bc |)
end
)
else (
T.fail "Should have been handled separately"
) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Result.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Typing.Combinators.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 8,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
pre: Pulse.Syntax.Base.term ->
e1: Pulse.Syntax.Base.st_term ->
e2: Pulse.Syntax.Base.st_term ->
c1: Pulse.Syntax.Base.comp_st ->
c2: Pulse.Syntax.Base.comp_st ->
px:
Pulse.Syntax.Base.nvar
{~(FStar.Set.mem (FStar.Pervasives.Native.snd px) (Pulse.Typing.Env.dom g))} ->
d_e1: Pulse.Typing.st_typing g e1 c1 ->
d_c1res:
Pulse.Typing.tot_typing g
(Pulse.Syntax.Base.comp_res c1)
(Pulse.Syntax.Pure.tm_type (Pulse.Syntax.Base.comp_u c1)) ->
d_e2:
Pulse.Typing.st_typing (Pulse.Typing.Env.push_binding g
(FStar.Pervasives.Native.snd px)
(FStar.Pervasives.Native.fst px)
(Pulse.Syntax.Base.comp_res c1))
(Pulse.Syntax.Naming.open_st_term_nv e2 px)
c2 ->
res_typing:
Pulse.Typing.universe_of g (Pulse.Syntax.Base.comp_res c2) (Pulse.Syntax.Base.comp_u c2) ->
post_typing:
Pulse.Typing.tot_typing (Pulse.Typing.Env.push_binding g
(FStar.Pervasives.Native.snd px)
(FStar.Pervasives.Native.fst px)
(Pulse.Syntax.Base.comp_res c2))
(Pulse.Syntax.Naming.open_term_nv (Pulse.Syntax.Base.comp_post c2) px)
Pulse.Syntax.Base.tm_vprop ->
bias_towards_continuation: Prims.bool
-> FStar.Tactics.Effect.TacH
(FStar.Pervasives.dtuple3 Pulse.Syntax.Base.st_term
(fun _ ->
c:
Pulse.Syntax.Base.comp_st
{ Pulse.Syntax.Base.st_comp_of_comp c ==
Pulse.Typing.Combinators.st_comp_with_pre (Pulse.Syntax.Base.st_comp_of_comp c2) pre /\
(bias_towards_continuation ==>
Pulse.Syntax.Base.effect_annot_of_comp c ==
Pulse.Syntax.Base.effect_annot_of_comp c2) })
(fun t c -> Pulse.Typing.st_typing g t c)) | FStar.Tactics.Effect.TacH | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Pulse.Syntax.Base.nvar",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"Pulse.Syntax.Base.var",
"FStar.Pervasives.Native.snd",
"Pulse.Syntax.Base.ppname",
"Pulse.Typing.Env.dom",
"Pulse.Typing.st_typing",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Pure.tm_type",
"Pulse.Syntax.Base.comp_u",
"Pulse.Typing.Env.push_binding",
"FStar.Pervasives.Native.fst",
"Pulse.Syntax.Naming.open_st_term_nv",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Naming.open_term_nv",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Base.tm_vprop",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.comp",
"Pulse.Syntax.Base.st_comp",
"Pulse.Typing.Combinators.mk_bind_st_st",
"FStar.Pervasives.dtuple3",
"Prims.l_and",
"Prims.eq2",
"Pulse.Syntax.Base.st_comp_of_comp",
"Pulse.Typing.Combinators.st_comp_with_pre",
"Prims.l_imp",
"Pulse.Syntax.Base.effect_annot",
"Pulse.Syntax.Base.effect_annot_of_comp",
"Pulse.Typing.Combinators.mk_bind_ghost_ghost",
"Pulse.Syntax.Base.observability",
"Pulse.Typing.at_most_one_observable",
"Pulse.Typing.Combinators.mk_bind_atomic_atomic",
"Pulse.Typing.Combinators.mk_bind",
"Pulse.Syntax.Base.C_ST",
"Pulse.Typing.T_Lift",
"Pulse.Typing.Lift_STAtomic_ST",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Typing.Combinators.st_ghost_as_atomic",
"Pulse.Syntax.Base.C_STGhost",
"Pulse.Typing.Lift_Neutral_Ghost",
"FStar.Pervasives.Native.option",
"Pulse.Typing.Combinators.try_lift_ghost_atomic",
"Pulse.Typing.Combinators.lift_ghost_atomic",
"Prims.string",
"FStar.Stubs.Tactics.Types.proofstate",
"Prims.l_True",
"FStar.Stubs.Tactics.Result.__result",
"FStar.Stubs.Tactics.Result.uu___is_Failed",
"Pulse.Typing.Env.fail_doc",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Pulse.Syntax.Base.__proj__Mkst_term__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"FStar.Stubs.Pprint.op_Hat_Slash_Hat",
"Pulse.PP.text",
"Prims.Nil",
"FStar.Stubs.Pprint.prefix",
"Pulse.PP.pp",
"Pulse.PP.pp_effect_annot",
"Pulse.Syntax.Base.binder",
"Pulse.Typing.Combinators.nvar_as_binder",
"Pulse.Syntax.Base.comp_pre",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Pulse.Syntax.Naming.freevars_st",
"Pulse.Syntax.Naming.open_term",
"Pulse.Syntax.Naming.freevars"
] | [
"recursion"
] | false | true | false | false | false | let rec mk_bind
(g: env)
(pre: term)
(e1 e2: st_term)
(c1 c2: comp_st)
(px: nvar{~(Set.mem (snd px) (dom g))})
(d_e1: st_typing g e1 c1)
(d_c1res: tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2: st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing: universe_of g (comp_res c2) (comp_u c2))
(post_typing:
tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation: bool)
: T.TacH
(t: st_term &
c:
comp_st
{ st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires
fun _ ->
let _, x = px in
comp_pre c1 == pre /\ None? (lookup g x) /\ (~(x `Set.mem` (freevars_st e2))) /\
open_term (comp_post c1) x == comp_pre c2 /\ (~(x `Set.mem` (freevars (comp_post c2)))))
(ensures fun _ _ -> True) =
| let _, x = px in
let b = nvar_as_binder px (comp_res c1) in
let fail_bias (#a: Type) tag
: T.TacH a (requires fun _ -> True) (ensures fun _ r -> FStar.Tactics.Result.Failed? r) =
let open Pulse.PP in
fail_doc g
(Some e1.range)
[
text "Cannot compose computations in this " ^/^ text tag ^/^ text " block:";
prefix 4 1 (text "This computation has effect: ") (pp (effect_annot_of_comp c1));
prefix 4 1 (text "The continuation has effect: ") (pp (effect_annot_of_comp c2))
]
in
match c1, c2 with
| C_ST _, C_ST _ ->
mk_bind_st_st g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
| C_STGhost _, C_STGhost _ ->
mk_bind_ghost_ghost g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
| C_STAtomic inames1 obs1 sc1, C_STAtomic inames2 obs2 sc2 ->
if at_most_one_observable obs1 obs2
then
(mk_bind_atomic_atomic g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation)
else
if bias_towards_continuation
then fail_bias "atomic"
else
(let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation)
| C_STAtomic inames _ _, C_ST _ ->
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_ST _, C_STAtomic inames _ _ ->
if bias_towards_continuation
then fail_bias "atomic"
else
(let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_STAtomic_ST _ c2) in
let (| t , c , d |) =
mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
in
(| t, c, d |))
| C_STGhost _, C_STAtomic _ Neutral _ ->
(match try_lift_ghost_atomic d_e1 with
| Some d_e1 ->
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| None ->
if bias_towards_continuation
then fail_bias "atomic"
else
(let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_Neutral_Ghost _ c2) in
let (| t , c , d |) =
mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
in
(| t, c, d |)))
| C_STAtomic _ Neutral _, C_STGhost _ ->
(if bias_towards_continuation
then
(let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation)
else
(match try_lift_ghost_atomic d_e2 with
| Some d_e2 ->
let (| t , c , d |) =
mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
in
(| t, c, d |)
| None ->
let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation))
| C_STGhost _, C_ST _
| C_STGhost _, C_STAtomic _ _ _ ->
let d_e1 = lift_ghost_atomic d_e1 in
mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation
| C_ST _, C_STGhost _
| C_STAtomic _ _ _, C_STGhost _ ->
if bias_towards_continuation
then fail_bias "ghost"
else
(let d_e2 = lift_ghost_atomic d_e2 in
let (| t , c , d |) =
mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing
bias_towards_continuation
in
(| t, c, d |)) | false |
Pulse.Lib.Stick.fst | Pulse.Lib.Stick.elim_stick | val elim_stick
(hyp concl: vprop)
: stt_ghost unit
((stick hyp concl) ** hyp)
(fun _ -> concl) | val elim_stick
(hyp concl: vprop)
: stt_ghost unit
((stick hyp concl) ** hyp)
(fun _ -> concl) | let elim_stick p q =
T.elim_trade_ghost p q | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Stick.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 36,
"start_col": 0,
"start_line": 35
} | (*
Copyright 2023 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 Pulse.Lib.Stick
open Pulse.Lib.Pervasives
module T = Pulse.Lib.Trade
(* This lemma needed to typecheck the definitions below. *)
let emp_unit_left (p:vprop)
: Lemma (emp ** p == p)
[SMTPat (emp ** p)]
= elim_vprop_equiv (vprop_equiv_unit p)
(* This module is just a special case of trades. The tactic
instantiates the implicit InvList to [] everywhere. We do not
even need to use the Pulse checker for it. *)
let stick (p q : vprop) =
T.trade p q | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Trade.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.Stick.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.Trade",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"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
}
] | {
"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"
} | false | hyp: Pulse.Lib.Core.vprop -> concl: Pulse.Lib.Core.vprop
-> Pulse.Lib.Core.stt_ghost Prims.unit (Pulse.Lib.Stick.stick hyp concl ** hyp) (fun _ -> concl) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.Trade.elim_trade_ghost",
"Pulse.Lib.InvList.invlist_empty",
"Pulse.Lib.Core.stt_ghost",
"Prims.unit",
"Pulse.Lib.Core.op_Star_Star",
"Pulse.Lib.Stick.stick"
] | [] | false | false | false | false | false | let elim_stick p q =
| T.elim_trade_ghost p q | false |
Pulse.Lib.Stick.fst | Pulse.Lib.Stick.emp_unit_left | val emp_unit_left (p: vprop) : Lemma (emp ** p == p) [SMTPat (emp ** p)] | val emp_unit_left (p: vprop) : Lemma (emp ** p == p) [SMTPat (emp ** p)] | let emp_unit_left (p:vprop)
: Lemma (emp ** p == p)
[SMTPat (emp ** p)]
= elim_vprop_equiv (vprop_equiv_unit p) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Stick.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 41,
"end_line": 26,
"start_col": 0,
"start_line": 23
} | (*
Copyright 2023 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 Pulse.Lib.Stick
open Pulse.Lib.Pervasives
module T = Pulse.Lib.Trade | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Trade.fsti.checked",
"Pulse.Lib.Pervasives.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.Stick.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.Trade",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"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
}
] | {
"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"
} | false | p: Pulse.Lib.Core.vprop
-> FStar.Pervasives.Lemma (ensures Pulse.Lib.Core.emp ** p == p)
[SMTPat (Pulse.Lib.Core.emp ** p)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.Core.elim_vprop_equiv",
"Pulse.Lib.Core.op_Star_Star",
"Pulse.Lib.Core.emp",
"Pulse.Lib.Core.vprop_equiv_unit",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | true | false | true | false | false | let emp_unit_left (p: vprop) : Lemma (emp ** p == p) [SMTPat (emp ** p)] =
| elim_vprop_equiv (vprop_equiv_unit p) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.shuffle_aux | val shuffle_aux (a: sha2_alg) (hash: words_state a) (block: block_w a) : Tot (words_state a) | val shuffle_aux (a: sha2_alg) (hash: words_state a) (block: block_w a) : Tot (words_state a) | let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 60,
"start_col": 0,
"start_line": 59
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_ | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
hash: Spec.Hash.Definitions.words_state a ->
block: Spec.SHA2.block_w a
-> Spec.Hash.Definitions.words_state a | Prims.Tot | [
"total"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.words_state",
"Spec.SHA2.block_w",
"Spec.Loops.repeat_range",
"Spec.SHA2.size_k_w",
"Spec.SHA2.Lemmas.shuffle_core"
] | [] | false | false | false | false | false | let shuffle_aux (a: sha2_alg) (hash: words_state a) (block: block_w a) : Tot (words_state a) =
| Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash | false |
Steel.ST.CancellableSpinLock.fst | Steel.ST.CancellableSpinLock.new_cancellable_lock | val new_cancellable_lock (v:vprop)
: STT (cancellable_lock v) v (fun _ -> emp) | val new_cancellable_lock (v:vprop)
: STT (cancellable_lock v) v (fun _ -> emp) | let new_cancellable_lock v =
let r = alloc true in
intro_exists true (lock_inv_pred r v);
let l = new_lock (lock_inv r v) in
return ({lref = r; llock = l}) | {
"file_name": "lib/steel/Steel.ST.CancellableSpinLock.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 32,
"end_line": 46,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2021 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.
Author: Aseem Rastogi
*)
module Steel.ST.CancellableSpinLock
open Steel.ST.Effect
open Steel.ST.Util
open Steel.FractionalPermission
open Steel.ST.Reference
open Steel.ST.SpinLock
module G = FStar.Ghost
[@@__reduce__]
let lock_inv_pred (r:ref bool) (v:vprop) : bool -> vprop =
fun b -> pts_to r full_perm b `star` (if b then v else emp)
[@@__reduce__]
let lock_inv (r:ref bool) (v:vprop) : vprop = exists_ (lock_inv_pred r v)
noeq
type cancellable_lock (v:vprop) = {
lref : ref bool;
llock : lock (lock_inv lref v)
} | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.SpinLock.fsti.checked",
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Effect.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.CancellableSpinLock.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": false,
"full_module": "Steel.ST.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"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
}
] | {
"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"
} | false | v: Steel.Effect.Common.vprop
-> Steel.ST.Effect.STT (Steel.ST.CancellableSpinLock.cancellable_lock v) | Steel.ST.Effect.STT | [] | [] | [
"Steel.Effect.Common.vprop",
"Steel.ST.Util.return",
"Steel.ST.CancellableSpinLock.cancellable_lock",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"FStar.Algebra.CommMonoid.Equiv.__proj__CM__item__unit",
"Steel.Effect.Common.req",
"Steel.Effect.Common.rm",
"Steel.ST.CancellableSpinLock.Mkcancellable_lock",
"Steel.ST.SpinLock.lock",
"Steel.ST.CancellableSpinLock.lock_inv",
"Steel.ST.SpinLock.new_lock",
"Prims.unit",
"Steel.ST.Util.intro_exists",
"Prims.bool",
"Steel.ST.CancellableSpinLock.lock_inv_pred",
"Steel.ST.Reference.ref",
"Steel.ST.Reference.alloc"
] | [] | false | true | false | false | false | let new_cancellable_lock v =
| let r = alloc true in
intro_exists true (lock_inv_pred r v);
let l = new_lock (lock_inv r v) in
return ({ lref = r; llock = l }) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_3_7_11_body | val va_wp_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 56,
"start_col": 0,
"start_line": 47
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
msg: Vale.PPC64LE.Decls.va_operand_vec_opr ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_operand_vec_opr",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.PPC64LE.Decls.va_is_dst_vec_opr",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Machine_s.pow2_64",
"Prims.l_Forall",
"Vale.PPC64LE.Decls.va_value_vec_opr",
"Vale.PPC64LE.Memory.nat64",
"Prims.l_imp",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_eval_vec_opr",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_reg",
"Vale.PPC64LE.Decls.va_upd_operand_vec_opr"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\
(l_and (l_and (0 <= i) (i < 15)) (i `op_Modulus` 4 == 3) /\ msg == i + 1 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0)
in_b
offset
1
(va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\
(forall (va_x_msg: va_value_vec_opr) (va_x_r4: nat64).
let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0) in
va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b
offset
(va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16) ==>
va_k va_sM (()))) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.ws_aux | val ws_aux (a: sha2_alg) (b: block_w a) (t: counter{t < size_k_w a}) : Tot (word a) | val ws_aux (a: sha2_alg) (b: block_w a) (t: counter{t < size_k_w a}) : Tot (word a) | let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16) | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 27,
"end_line": 29,
"start_col": 0,
"start_line": 19
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *) | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
b: Spec.SHA2.block_w a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.word a | Prims.Tot | [
"total"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.SHA2.block_w",
"Spec.SHA2.counter",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.SHA2.size_k_w",
"Spec.Hash.Definitions.block_word_length",
"Spec.SHA2.op_String_Access",
"Spec.Hash.Definitions.word",
"Prims.bool",
"Spec.SHA2.op_Plus_Dot",
"Spec.SHA2._sigma0",
"Spec.SHA2._sigma1",
"Spec.SHA2.Lemmas.ws_aux",
"Prims.op_Subtraction"
] | [
"recursion"
] | false | false | false | false | false | let rec ws_aux (a: sha2_alg) (b: block_w a) (t: counter{t < size_k_w a}) : Tot (word a) =
| if t < block_word_length a
then b.[ t ]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_aux | val update_aux (a: sha2_alg) (hash: words_state a) (block: bytes{S.length block = block_length a})
: Tot (words_state a) | val update_aux (a: sha2_alg) (hash: words_state a) (block: bytes{S.length block = block_length a})
: Tot (words_state a) | let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1 | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 128,
"start_col": 0,
"start_line": 125
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
hash: Spec.Hash.Definitions.words_state a ->
block:
Spec.Hash.Definitions.bytes
{FStar.Seq.Base.length block = Spec.Hash.Definitions.block_length a}
-> Spec.Hash.Definitions.words_state a | Prims.Tot | [
"total"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Definitions.block_length",
"Lib.Sequence.map2",
"Spec.Hash.Definitions.word",
"Spec.Hash.Definitions.state_word_length",
"Spec.SHA2.op_Plus_Dot",
"Lib.Sequence.lseq",
"Spec.SHA2.Lemmas.shuffle_aux",
"Spec.Hash.Definitions.block_word_length",
"Spec.Hash.Definitions.words_of_bytes"
] | [] | false | false | false | false | false | let update_aux (a: sha2_alg) (hash: words_state a) (block: bytes{S.length block = block_length a})
: Tot (words_state a) =
| let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1 | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.shuffle_core_ | val shuffle_core_
(a: sha2_alg)
(block: block_w a)
(hash: words_state a)
(t: counter{t < size_k_w a})
: Tot (words_state a) | val shuffle_core_
(a: sha2_alg)
(block: block_w a)
(hash: words_state a)
(t: counter{t < size_k_w a})
: Tot (words_state a) | let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 17,
"end_line": 53,
"start_col": 0,
"start_line": 35
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
block: Spec.SHA2.block_w a ->
hash: Spec.Hash.Definitions.words_state a ->
t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}
-> Spec.Hash.Definitions.words_state a | Prims.Tot | [
"total"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.SHA2.block_w",
"Spec.Hash.Definitions.words_state",
"Spec.SHA2.counter",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.SHA2.size_k_w",
"FStar.Seq.Base.seq_of_list",
"Spec.Hash.Definitions.word",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"Prims.Cons",
"Spec.SHA2.op_Plus_Dot",
"Prims.Nil",
"Prims._assert",
"FStar.Seq.Base.length",
"Spec.SHA2.k0",
"Spec.SHA2._Sigma0",
"Spec.SHA2._Maj",
"Spec.SHA2._Sigma1",
"Spec.SHA2._Ch",
"Spec.SHA2.op_String_Access",
"Spec.SHA2.Lemmas.ws",
"Prims.nat",
"Prims.op_LessThanOrEqual"
] | [] | false | false | false | false | false | let shuffle_core_
(a: sha2_alg)
(block: block_w a)
(hash: words_state a)
(t: counter{t < size_k_w a})
: Tot (words_state a) =
| assert (7 <= S.length hash);
let a0 = hash.[ 0 ] in
let b0 = hash.[ 1 ] in
let c0 = hash.[ 2 ] in
let d0 = hash.[ 3 ] in
let e0 = hash.[ 4 ] in
let f0 = hash.[ 5 ] in
let g0 = hash.[ 6 ] in
let h0 = hash.[ 7 ] in
assert (S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[ t ] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
assert (t < S.length (k0 a));
let l = [t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l | false |
Hacl.Impl.Ed25519.RecoverX.fst | Hacl.Impl.Ed25519.RecoverX.recover_x_ | val recover_x_:
x:elemB
-> y:elemB
-> sign:uint64{v sign = 0 \/ v sign = 1}
-> tmp:lbuffer uint64 15ul ->
Stack bool
(requires fun h ->
live h tmp /\ live h x /\ live h y /\
disjoint x y /\ disjoint tmp x /\ disjoint tmp y /\
F51.mul_inv_t h x /\
F51.felem_fits h y (1, 1, 1, 1, 1)
)
(ensures fun h0 z h1 -> modifies (loc x |+| loc tmp) h0 h1 /\
(z ==> F51.mul_inv_t h1 x) /\
(let res = SE.recover_x (F51.as_nat h0 y) (uint_v #U64 sign <> 0) in
(Some? res <==> z) /\
(Some? res ==> F51.fevalh h1 x == Some?.v res))
) | val recover_x_:
x:elemB
-> y:elemB
-> sign:uint64{v sign = 0 \/ v sign = 1}
-> tmp:lbuffer uint64 15ul ->
Stack bool
(requires fun h ->
live h tmp /\ live h x /\ live h y /\
disjoint x y /\ disjoint tmp x /\ disjoint tmp y /\
F51.mul_inv_t h x /\
F51.felem_fits h y (1, 1, 1, 1, 1)
)
(ensures fun h0 z h1 -> modifies (loc x |+| loc tmp) h0 h1 /\
(z ==> F51.mul_inv_t h1 x) /\
(let res = SE.recover_x (F51.as_nat h0 y) (uint_v #U64 sign <> 0) in
(Some? res <==> z) /\
(Some? res ==> F51.fevalh h1 x == Some?.v res))
) | let recover_x_ x y sign tmp =
let x2 = sub tmp 0ul 5ul in
let open Lib.RawIntTypes in
let open FStar.UInt8 in
let h0 = ST.get() in
let b = gte_q y in
let res =
if b then false
else (
(**) FStar.Math.Lemmas.small_mod (F51.as_nat h0 y) SC.prime;
recover_x_step_1 x2 y;
let z = recover_x_step_2 x sign x2 in
if (u8_to_UInt8 z =^ 0uy) then false
else if (u8_to_UInt8 z =^ 1uy) then true
else (
recover_x_step_3 tmp;
let z = recover_x_step_4 tmp in
let h1 = ST.get() in
if z = false then false
else (
recover_x_step_5 x y sign tmp;
true)
)
) in
res | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.RecoverX.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 6,
"end_line": 299,
"start_col": 0,
"start_line": 274
} | module Hacl.Impl.Ed25519.RecoverX
module ST = FStar.HyperStack.ST
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
module SE = Spec.Ed25519
#reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
inline_for_extraction noextract
let elemB = lbuffer uint64 5ul
val is_0: x:elemB -> Stack bool
(requires fun h -> live h x /\ F51.as_nat h x == F51.fevalh h x)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.fevalh h0 x == SC.zero)))
[@CInline]
let is_0 x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 =^ 0uL &&
u64_to_UInt64 x1 =^ 0uL &&
u64_to_UInt64 x2 =^ 0uL &&
u64_to_UInt64 x3 =^ 0uL &&
u64_to_UInt64 x4 =^ 0uL)
inline_for_extraction noextract
val gte_q: x:elemB -> Stack bool
(requires fun h -> live h x /\
F51.felem_fits h x (1, 1, 1, 1, 1))
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.as_nat h0 x >= SC.prime)))
let gte_q x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 >=^ 0x7ffffffffffeduL &&
u64_to_UInt64 x1 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x2 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x3 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x4 =^ 0x7ffffffffffffuL)
val mul_modp_sqrt_m1: x:elemB -> Stack unit
(requires fun h -> live h x /\ F51.mul_inv_t h x)
(ensures fun h0 _ h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == F51.fevalh h0 x `SC.fmul` SE.modp_sqrt_m1)
[@CInline]
let mul_modp_sqrt_m1 x =
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00061b274a0ea0b0,
u64 0x0000d5a5fc8f189d,
u64 0x0007ef5e9cbd0c60,
u64 0x00078595a6804c9e,
u64 0x0002b8324804fc1d) in
push_frame();
let sqrt_m1 = create 5ul (u64 0) in
make_u64_5 sqrt_m1 x0 x1 x2 x3 x4;
assert_norm (S51.as_nat5 (x0, x1, x2, x3, x4) == SE.modp_sqrt_m1);
fmul x x sqrt_m1;
pop_frame()
inline_for_extraction noextract
val x_mod_2: x:felem -> Stack uint64
(requires fun h -> live h x)
(ensures fun h0 z h1 -> h0 == h1 /\ v z < 2 /\
v z == F51.as_nat h0 x % 2)
let x_mod_2 x =
let x0 = x.(0ul) in
let z = x0 &. u64 1 in
mod_mask_lemma x0 1ul;
Lib.IntTypes.Compatibility.uintv_extensionality (u64 1) (mod_mask #U64 1ul);
z
inline_for_extraction noextract
val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one))))
let recover_x_step_1 x2 y =
push_frame();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y; // y2 = y * y
times_d dyy y2; // dyy = d * y2
fsum dyy dyy one; // dyy = (d * y2) + one
reduce_513 dyy;
inverse dyyi dyy; // dyyi = modp_inv ((d * y2) + one)
fdifference x2 y2 one; // x2 = y2 - one
fmul x2 x2 dyyi; // x2 = (y2 - one) * dyyi
reduce x2;
pop_frame()
inline_for_extraction noextract
val recover_x_step_2: x:elemB -> sign:uint64 -> x2:elemB -> Stack uint8
(requires fun h ->
live h x2 /\ live h x /\ disjoint x x2 /\
F51.mul_inv_t h x /\ F51.fevalh h x2 == F51.as_nat h x2)
(ensures fun h0 z h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
(if F51.fevalh h0 x2 = 0 then (
if v sign = 0 then F51.fevalh h1 x = 0 /\ z == u8 1
else h0 == h1 /\ z == u8 0)
else h0 == h1 /\ z == u8 2))
let recover_x_step_2 x sign x2 =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x2_is_0 = is_0 x2 in
if x2_is_0 then begin
if u64_to_UInt64 sign =^ 0uL then (make_zero x; u8 1) else u8 0 end
else u8 2
inline_for_extraction noextract
val recover_x_step_3: tmp:lbuffer uint64 15ul -> Stack unit
(requires fun h -> live h tmp /\ F51.mul_inv_t h (gsub tmp 0ul 5ul))
(ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
(let x2 = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let x = x2 `SC.fpow` ((SC.prime + 3) / 8) in
let x = if ((x `SC.fmul` x) `SC.fsub` x2) <> 0 then (x `SC.fmul` SE.modp_sqrt_m1) else x in
F51.fevalh h1 (gsub tmp 5ul 5ul) == x))
let recover_x_step_3 tmp =
let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in // x
let t0 = sub tmp 10ul 5ul in
Hacl.Impl.Ed25519.Pow2_252m2.pow2_252m2 x3 x2; // x3 = x2^((prime + 3) / 8)
fsquare t0 x3; // t0 = x3 * x3
fdifference t0 t0 x2; // t0 = t0 - x2
reduce_513 t0;
reduce t0;
let t0_is_0 = is_0 t0 in
if t0_is_0 then () else mul_modp_sqrt_m1 x3
inline_for_extraction noextract
val recover_x_step_4: tmp:lbuffer uint64 15ul -> Stack bool
(requires fun h -> live h tmp /\
F51.mul_inv_t h (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h (gsub tmp 5ul 5ul))
(ensures fun h0 z h1 -> modifies (loc tmp) h0 h1 /\
F51.fevalh h0 (gsub tmp 0ul 5ul) == F51.fevalh h1 (gsub tmp 0ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 0ul 5ul) /\
F51.fevalh h0 (gsub tmp 5ul 5ul) == F51.fevalh h1 (gsub tmp 5ul 5ul) /\
F51.mul_inv_t h1 (gsub tmp 5ul 5ul) /\
(let u = F51.fevalh h0 (gsub tmp 5ul 5ul) in
let v = F51.fevalh h0 (gsub tmp 0ul 5ul) in
let y = (u `SC.fmul` u) `SC.fsub` v in
(z <==> y == SC.zero)))
let recover_x_step_4 tmp =
let x2 = sub tmp 0ul 5ul in
let x3 = sub tmp 5ul 5ul in
let t0 = sub tmp 10ul 5ul in
fsquare t0 x3; // t0 = x3 * x3
fdifference t0 t0 x2; // t0 - x2
reduce_513 t0;
reduce t0;
is_0 t0
inline_for_extraction noextract
val recover_x_step_5:
x:elemB
-> y:elemB
-> sign:uint64{v sign = 0 \/ v sign = 1}
-> tmp:lbuffer uint64 15ul ->
Stack unit
(requires fun h ->
live h x /\ live h tmp /\ live h y /\
disjoint x y /\ disjoint tmp x /\ disjoint tmp y /\
F51.mul_inv_t h (gsub tmp 5ul 5ul) /\
(let y = F51.as_nat h y in
let sign = (uint_v #U64 sign <> 0) in
let x = F51.fevalh h (gsub tmp 5ul 5ul) in
let x2 = F51.fevalh h (gsub tmp 0ul 5ul) in
((x `SC.fmul` x) `SC.fsub` x2) == SC.zero /\
SE.recover_x y sign ==
(if ((x `SC.fmul` x) `SC.fsub` x2) <> SC.zero then None
else (
let x =
if (x % 2 = 1) <> sign then (SC.prime - x) % SC.prime else x in
Some x))))
(ensures fun h0 _ h1 -> modifies (loc x |+| loc tmp) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == Some?.v (SE.recover_x (F51.as_nat h0 y) (uint_v #U64 sign <> 0)))
let recover_x_step_5 x y sign tmp =
let x3 = sub tmp 5ul 5ul in
let t0 = sub tmp 10ul 5ul in
reduce x3;
let x0 = x_mod_2 x3 in
let open Lib.RawIntTypes in
let open FStar.UInt64 in
if not (u64_to_UInt64 x0 =^ u64_to_UInt64 sign) then (
let h0 = ST.get () in
make_zero t0;
fdifference x3 t0 x3; // x3 = (-x) % prime
reduce_513 x3;
reduce x3;
(**) assert_norm (SC.prime % SC.prime = SC.zero % SC.prime);
(**) FStar.Math.Lemmas.mod_add_both SC.prime SC.zero (- (F51.fevalh h0 x3)) SC.prime);
copy x x3
inline_for_extraction noextract
val recover_x_:
x:elemB
-> y:elemB
-> sign:uint64{v sign = 0 \/ v sign = 1}
-> tmp:lbuffer uint64 15ul ->
Stack bool
(requires fun h ->
live h tmp /\ live h x /\ live h y /\
disjoint x y /\ disjoint tmp x /\ disjoint tmp y /\
F51.mul_inv_t h x /\
F51.felem_fits h y (1, 1, 1, 1, 1)
)
(ensures fun h0 z h1 -> modifies (loc x |+| loc tmp) h0 h1 /\
(z ==> F51.mul_inv_t h1 x) /\
(let res = SE.recover_x (F51.as_nat h0 y) (uint_v #U64 sign <> 0) in
(Some? res <==> z) /\
(Some? res ==> F51.fevalh h1 x == Some?.v res))
) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.Compatibility.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Pow2_252m2.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.RecoverX.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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"
} | false |
x: Hacl.Impl.Ed25519.RecoverX.elemB ->
y: Hacl.Impl.Ed25519.RecoverX.elemB ->
sign: Lib.IntTypes.uint64{Lib.IntTypes.v sign = 0 \/ Lib.IntTypes.v sign = 1} ->
tmp: Lib.Buffer.lbuffer Lib.IntTypes.uint64 15ul
-> FStar.HyperStack.ST.Stack Prims.bool | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Ed25519.RecoverX.elemB",
"Lib.IntTypes.uint64",
"Prims.l_or",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.Buffer.lbuffer",
"FStar.UInt32.__uint_to_t",
"Prims.bool",
"FStar.UInt8.op_Equals_Hat",
"Lib.RawIntTypes.u8_to_UInt8",
"FStar.UInt8.__uint_to_t",
"Prims.unit",
"Hacl.Impl.Ed25519.RecoverX.recover_x_step_5",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Ed25519.RecoverX.recover_x_step_4",
"Hacl.Impl.Ed25519.RecoverX.recover_x_step_3",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Hacl.Impl.Ed25519.RecoverX.recover_x_step_2",
"Lib.IntTypes.uint8",
"Hacl.Impl.Ed25519.RecoverX.recover_x_step_1",
"FStar.Math.Lemmas.small_mod",
"Hacl.Impl.Ed25519.Field51.as_nat",
"Spec.Curve25519.prime",
"Hacl.Impl.Ed25519.RecoverX.gte_q",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub"
] | [] | false | true | false | false | false | let recover_x_ x y sign tmp =
| let x2 = sub tmp 0ul 5ul in
let open Lib.RawIntTypes in
let open FStar.UInt8 in
let h0 = ST.get () in
let b = gte_q y in
let res =
if b
then false
else
(FStar.Math.Lemmas.small_mod (F51.as_nat h0 y) SC.prime;
recover_x_step_1 x2 y;
let z = recover_x_step_2 x sign x2 in
if (u8_to_UInt8 z =^ 0uy)
then false
else
if (u8_to_UInt8 z =^ 1uy)
then true
else
(recover_x_step_3 tmp;
let z = recover_x_step_4 tmp in
let h1 = ST.get () in
if z = false
then false
else
(recover_x_step_5 x y sign tmp;
true)))
in
res | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_is_update_pre | val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block) | val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block) | let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2) | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 146,
"start_col": 0,
"start_line": 132
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} -> | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
hash: Spec.Hash.Definitions.words_state a ->
block:
Spec.Hash.Definitions.bytes
{FStar.Seq.Base.length block = Spec.Hash.Definitions.block_length a}
-> FStar.Pervasives.Lemma
(ensures Spec.SHA2.update a hash block == Spec.SHA2.Lemmas.update_aux a hash block) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Definitions.block_length",
"Prims._assert",
"FStar.Seq.Base.equal",
"Spec.Hash.Definitions.word",
"Prims.unit",
"FStar.Classical.forall_intro",
"Prims.nat",
"Prims.op_LessThan",
"Prims.eq2",
"FStar.Seq.Base.index",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Lib.Sequence.to_seq",
"Spec.Hash.Definitions.state_word_length",
"Lib.Sequence.index",
"Spec.SHA2.op_Plus_Dot",
"FStar.Seq.Base.seq",
"Prims.l_and",
"Prims.l_Forall",
"Prims.l_imp",
"Spec.Loops.seq_map2",
"Lib.Sequence.lseq",
"Lib.Sequence.map2",
"FStar.Pervasives.reveal_opaque",
"Spec.Hash.Definitions.update_t",
"Spec.SHA2.update",
"Spec.SHA2.Lemmas.shuffle_is_shuffle_pre",
"Spec.SHA2.shuffle",
"Spec.Hash.Definitions.block_word_length",
"Spec.Hash.Definitions.words_of_bytes"
] | [] | false | false | true | false | false | let update_is_update_pre a hash block =
| let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 ( +. ) hash hash_1 in
let s2 = Spec.Loops.seq_map2 ( +. ) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i: nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i) =
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in
Classical.forall_intro aux;
assert (s1 `Seq.equal` s2) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_multi_update | val update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a)
: Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input)) | val update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a)
: Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input)) | let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 7,
"end_line": 264,
"start_col": 0,
"start_line": 247
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.md_alg ->
h: Spec.Hash.Definitions.words_state a ->
input: Spec.Hash.Definitions.bytes_block a
-> FStar.Pervasives.Lemma
(ensures Spec.Agile.Hash.update_multi a h () input == Spec.Agile.Hash.update a h input) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.md_alg",
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.bytes_block",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Prims._assert",
"Prims.eq2",
"Prims.bool",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.uint8",
"Lib.UpdateMulti.mk_update_multi",
"Spec.Hash.Definitions.block_length",
"Spec.Agile.Hash.update",
"Prims.unit",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.empty",
"FStar.Pervasives.Native.tuple2",
"Lib.UpdateMulti.split_block",
"Spec.Agile.Hash.update_multi",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a)
: Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input)) =
| let h1 = Spec.Agile.Hash.update_multi a h () input in
assert (h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0
then assert (h1 == h)
else
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert (rem `Seq.equal` Seq.empty);
assert (block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert (h1 == h3) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_1_3 | val va_wp_Loop_rounds_1_3 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_1_3 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 844,
"start_col": 0,
"start_line": 834
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_1_3 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2))
((va_get_vec 0 va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\
(forall (va_x_v1: quad32) (va_x_v2: quad32) (va_x_v3: quad32).
let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0)) in
va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2))
((va_get_vec 3 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==>
va_k va_sM (()))) | false |
Hacl.Impl.Ed25519.RecoverX.fst | Hacl.Impl.Ed25519.RecoverX.recover_x_step_1 | val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one)))) | val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one)))) | let recover_x_step_1 x2 y =
push_frame();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y; // y2 = y * y
times_d dyy y2; // dyy = d * y2
fsum dyy dyy one; // dyy = (d * y2) + one
reduce_513 dyy;
inverse dyyi dyy; // dyyi = modp_inv ((d * y2) + one)
fdifference x2 y2 one; // x2 = y2 - one
fmul x2 x2 dyyi; // x2 = (y2 - one) * dyyi
reduce x2;
pop_frame() | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.RecoverX.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 134,
"start_col": 0,
"start_line": 116
} | module Hacl.Impl.Ed25519.RecoverX
module ST = FStar.HyperStack.ST
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module SC = Spec.Curve25519
module SE = Spec.Ed25519
#reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
inline_for_extraction noextract
let elemB = lbuffer uint64 5ul
val is_0: x:elemB -> Stack bool
(requires fun h -> live h x /\ F51.as_nat h x == F51.fevalh h x)
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.fevalh h0 x == SC.zero)))
[@CInline]
let is_0 x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 =^ 0uL &&
u64_to_UInt64 x1 =^ 0uL &&
u64_to_UInt64 x2 =^ 0uL &&
u64_to_UInt64 x3 =^ 0uL &&
u64_to_UInt64 x4 =^ 0uL)
inline_for_extraction noextract
val gte_q: x:elemB -> Stack bool
(requires fun h -> live h x /\
F51.felem_fits h x (1, 1, 1, 1, 1))
(ensures fun h0 b h1 -> h0 == h1 /\
(b <==> (F51.as_nat h0 x >= SC.prime)))
let gte_q x =
let open Lib.RawIntTypes in
let open FStar.UInt64 in
let x0 = x.(0ul) in
let x1 = x.(1ul) in
let x2 = x.(2ul) in
let x3 = x.(3ul) in
let x4 = x.(4ul) in
(u64_to_UInt64 x0 >=^ 0x7ffffffffffeduL &&
u64_to_UInt64 x1 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x2 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x3 =^ 0x7ffffffffffffuL &&
u64_to_UInt64 x4 =^ 0x7ffffffffffffuL)
val mul_modp_sqrt_m1: x:elemB -> Stack unit
(requires fun h -> live h x /\ F51.mul_inv_t h x)
(ensures fun h0 _ h1 -> modifies (loc x) h0 h1 /\
F51.mul_inv_t h1 x /\
F51.fevalh h1 x == F51.fevalh h0 x `SC.fmul` SE.modp_sqrt_m1)
[@CInline]
let mul_modp_sqrt_m1 x =
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00061b274a0ea0b0,
u64 0x0000d5a5fc8f189d,
u64 0x0007ef5e9cbd0c60,
u64 0x00078595a6804c9e,
u64 0x0002b8324804fc1d) in
push_frame();
let sqrt_m1 = create 5ul (u64 0) in
make_u64_5 sqrt_m1 x0 x1 x2 x3 x4;
assert_norm (S51.as_nat5 (x0, x1, x2, x3, x4) == SE.modp_sqrt_m1);
fmul x x sqrt_m1;
pop_frame()
inline_for_extraction noextract
val x_mod_2: x:felem -> Stack uint64
(requires fun h -> live h x)
(ensures fun h0 z h1 -> h0 == h1 /\ v z < 2 /\
v z == F51.as_nat h0 x % 2)
let x_mod_2 x =
let x0 = x.(0ul) in
let z = x0 &. u64 1 in
mod_mask_lemma x0 1ul;
Lib.IntTypes.Compatibility.uintv_extensionality (u64 1) (mod_mask #U64 1ul);
z
inline_for_extraction noextract
val recover_x_step_1: x2:elemB -> y:elemB -> Stack unit
(requires fun h ->
live h x2 /\ live h y /\ disjoint x2 y /\
F51.mul_inv_t h y)
(ensures fun h0 _ h1 -> modifies (loc x2) h0 h1 /\
F51.fevalh h1 x2 == F51.as_nat h1 x2 /\
F51.mul_inv_t h1 x2 /\
(let y = F51.fevalh h0 y in
let x2 = F51.fevalh h1 x2 in
let y2 = y `SC.fmul` y in
x2 == (y2 `SC.fsub` SC.one) `SC.fmul` (SC.finv ((SE.d `SC.fmul` y2) `SC.fadd` SC.one)))) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.IntTypes.Compatibility.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Pow2_252m2.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.RecoverX.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Spec.Curve25519",
"short_module": "SC"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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"
} | false | x2: Hacl.Impl.Ed25519.RecoverX.elemB -> y: Hacl.Impl.Ed25519.RecoverX.elemB
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Ed25519.RecoverX.elemB",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Bignum25519.reduce",
"Hacl.Bignum25519.fmul",
"Hacl.Bignum25519.fdifference",
"Hacl.Bignum25519.inverse",
"Hacl.Bignum25519.reduce_513",
"Hacl.Bignum25519.fsum",
"Hacl.Bignum25519.times_d",
"Hacl.Bignum25519.fsquare",
"Hacl.Bignum25519.make_one",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Lib.Buffer.create",
"Lib.IntTypes.u64",
"Lib.Buffer.lbuffer",
"FStar.HyperStack.ST.push_frame"
] | [] | false | true | false | false | false | let recover_x_step_1 x2 y =
| push_frame ();
let tmp = create 20ul (u64 0) in
let one = sub tmp 0ul 5ul in
let y2 = sub tmp 5ul 5ul in
let dyyi = sub tmp 10ul 5ul in
let dyy = sub tmp 15ul 5ul in
make_one one;
fsquare y2 y;
times_d dyy y2;
fsum dyy dyy one;
reduce_513 dyy;
inverse dyyi dyy;
fdifference x2 y2 one;
fmul x2 x2 dyyi;
reduce x2;
pop_frame () | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_5_7 | val va_wp_Loop_rounds_5_7 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_5_7 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 885,
"start_col": 0,
"start_line": 875
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_5_7 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6))
((va_get_vec 4 va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\
(forall (va_x_v5: quad32) (va_x_v6: quad32) (va_x_v7: quad32).
let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0)) in
va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6))
((va_get_vec 7 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==>
va_k va_sM (()))) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_last_224_256 | val update_last_224_256:
hash:words_state SHA2_256 ->
prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_256 ->
input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_256 /\
Seq.length input <= block_length SHA2_256 } ->
Lemma
(ensures Spec.Hash.Incremental.Definitions.update_last SHA2_256 hash prevlen input ==
Spec.Hash.Incremental.Definitions.update_last SHA2_224 hash prevlen input) | val update_last_224_256:
hash:words_state SHA2_256 ->
prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_256 ->
input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_256 /\
Seq.length input <= block_length SHA2_256 } ->
Lemma
(ensures Spec.Hash.Incremental.Definitions.update_last SHA2_256 hash prevlen input ==
Spec.Hash.Incremental.Definitions.update_last SHA2_224 hash prevlen input) | let update_last_224_256 hash prevlen input =
let update_multi_224_256 (hash:words_state SHA2_256) (blocks:bytes_blocks SHA2_256):
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks))
[ SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks) ]
=
update_multi_224_256 hash blocks
in
() | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 4,
"end_line": 307,
"start_col": 0,
"start_line": 297
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
#push-options "--fuel 1"
let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end
#pop-options
let rec update_multi_224_256 hash blocks =
let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert(hash1 == hash2);
update_multi_224_256 hash1 blocks_end
end | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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"
} | false |
hash: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_256 ->
prevlen: Spec.Hash.Incremental.Definitions.prev_length_t Spec.Hash.Definitions.SHA2_256 ->
input:
Spec.Hash.Definitions.bytes
{ Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input + prevlen)
Spec.Hash.Definitions.SHA2_256 /\
FStar.Seq.Base.length input <=
Spec.Hash.Definitions.block_length Spec.Hash.Definitions.SHA2_256 }
-> FStar.Pervasives.Lemma
(ensures
Spec.Hash.Incremental.Definitions.update_last Spec.Hash.Definitions.SHA2_256
hash
prevlen
input ==
Spec.Hash.Incremental.Definitions.update_last Spec.Hash.Definitions.SHA2_224
hash
prevlen
input) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Incremental.Definitions.prev_length_t",
"Spec.Hash.Definitions.bytes",
"Prims.l_and",
"Prims.b2t",
"Spec.Hash.Definitions.less_than_max_input_length",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Prims.op_LessThanOrEqual",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.bytes_blocks",
"Prims.unit",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.word",
"Prims.l_or",
"Prims.nat",
"Spec.Hash.Definitions.state_word_length",
"Spec.Hash.Definitions.SHA2_224",
"Spec.Agile.Hash.update_multi",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil",
"Spec.SHA2.Lemmas.update_multi_224_256"
] | [] | false | false | true | false | false | let update_last_224_256 hash prevlen input =
| let update_multi_224_256 (hash: words_state SHA2_256) (blocks: bytes_blocks SHA2_256)
: Lemma
(ensures
(Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks))
[SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks)] =
update_multi_224_256 hash blocks
in
() | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_9_11 | val va_wp_Loop_rounds_9_11 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_9_11 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 926,
"start_col": 0,
"start_line": 916
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_9_11 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10))
((va_get_vec 8 va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\
(forall (va_x_v9: quad32) (va_x_v10: quad32) (va_x_v11: quad32).
let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 va_s0)) in
va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10))
((va_get_vec 11 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==>
va_k va_sM (()))) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_multi_384_512 | val update_multi_384_512: hash:words_state SHA2_512 -> blocks:bytes_blocks SHA2_512 ->
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_384 hash () blocks))
(decreases (Seq.length blocks)) | val update_multi_384_512: hash:words_state SHA2_512 -> blocks:bytes_blocks SHA2_512 ->
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_384 hash () blocks))
(decreases (Seq.length blocks)) | let rec update_multi_384_512 hash blocks =
let a = SHA2_512 in
let a' = SHA2_384 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_384_512 hash block1;
assert(hash1 == hash2);
update_multi_384_512 hash1 blocks_end
end | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 7,
"end_line": 434,
"start_col": 0,
"start_line": 408
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
#push-options "--fuel 1"
let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end
#pop-options
let rec update_multi_224_256 hash blocks =
let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert(hash1 == hash2);
update_multi_224_256 hash1 blocks_end
end
#push-options "--z3rlimit 50"
let update_last_224_256 hash prevlen input =
let update_multi_224_256 (hash:words_state SHA2_256) (blocks:bytes_blocks SHA2_256):
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks))
[ SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks) ]
=
update_multi_224_256 hash blocks
in
()
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_384_512 hash block =
assert_norm (words_state SHA2_384 == words_state SHA2_512);
let rec ws_384_512 (b: block_w SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma
(ensures (ws SHA2_384 b t == ws SHA2_512 b t))
[ SMTPat (ws SHA2_512 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_512 == block_w SHA2_384);
assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_512 == _sigma0 SHA2_384)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op384_512; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));
assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));
norm_spec steps (_sigma0 SHA2_512);
norm_spec steps (_sigma0 SHA2_384);
norm_spec steps (_sigma1 SHA2_512);
norm_spec steps (_sigma1 SHA2_384);
// assert_norm (word_add_mod SHA2_512 == word_add_mod SHA2_384);
if t < block_word_length SHA2_512 then
()
else begin
ws_384_512 b (t - 16);
ws_384_512 b (t - 15);
ws_384_512 b (t - 7);
ws_384_512 b (t - 2)
end
in
let shuffle_core_384_512 (block:block_w SHA2_512) (hash:words_state SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))
[ SMTPat (shuffle_core SHA2_512 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_384_512 (hash:words_state SHA2_512) (block:block_w SHA2_512):
Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))
[ SMTPat (shuffle SHA2_512 hash block) ]
=
shuffle_is_shuffle_pre SHA2_384 hash block;
shuffle_is_shuffle_pre SHA2_512 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_384 == words_state SHA2_512)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) == words_of_bytes SHA2_384 #(block_word_length SHA2_384));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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"
} | false |
hash: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_512 ->
blocks: Spec.Hash.Definitions.bytes_blocks Spec.Hash.Definitions.SHA2_512
-> FStar.Pervasives.Lemma
(ensures
Spec.Agile.Hash.update_multi Spec.Hash.Definitions.SHA2_512 hash () blocks ==
Spec.Agile.Hash.update_multi Spec.Hash.Definitions.SHA2_384 hash () blocks)
(decreases FStar.Seq.Base.length blocks) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_512",
"Spec.Hash.Definitions.bytes_blocks",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Lemmas.update_multi_zero",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Seq.Base.seq",
"Spec.SHA2.Lemmas.update_multi_384_512",
"Prims.eq2",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.word",
"Prims.l_or",
"Prims.nat",
"Spec.Hash.Definitions.state_word_length",
"Spec.SHA2.Lemmas.update_384_512",
"Spec.Agile.Hash.update",
"Spec.SHA2.Lemmas.update_multi_update",
"Spec.Hash.Lemmas.update_multi_associative",
"FStar.Seq.Base.append",
"Prims.b2t",
"Prims.op_Modulus",
"Spec.Hash.Definitions.block_length",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Pervasives.Native.tuple2",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Properties.split",
"Prims.nonzero",
"FStar.Pervasives.assert_norm",
"Spec.Hash.Definitions.hash_alg",
"Spec.Hash.Definitions.SHA2_384"
] | [
"recursion"
] | false | false | true | false | false | let rec update_multi_384_512 hash blocks =
| let a = SHA2_512 in
let a' = SHA2_384 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0
then
(assert (blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash)
else
(assert (block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert (S.length block1 = block_length a);
assert (S.length blocks_end % block_length a = 0);
assert ((S.append block1 blocks_end) `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_384_512 hash block1;
assert (hash1 == hash2);
update_multi_384_512 hash1 blocks_end) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_multi_224_256 | val update_multi_224_256: hash:words_state SHA2_256 -> blocks:bytes_blocks SHA2_256 ->
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks)) | val update_multi_224_256: hash:words_state SHA2_256 -> blocks:bytes_blocks SHA2_256 ->
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks)) | let rec update_multi_224_256 hash blocks =
let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert(hash1 == hash2);
update_multi_224_256 hash1 blocks_end
end | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 7,
"end_line": 294,
"start_col": 0,
"start_line": 268
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
#push-options "--fuel 1"
let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end
#pop-options | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
hash: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_256 ->
blocks: Spec.Hash.Definitions.bytes_blocks Spec.Hash.Definitions.SHA2_256
-> FStar.Pervasives.Lemma
(ensures
Spec.Agile.Hash.update_multi Spec.Hash.Definitions.SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi Spec.Hash.Definitions.SHA2_224 hash () blocks)
(decreases FStar.Seq.Base.length blocks) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Definitions.bytes_blocks",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Lemmas.update_multi_zero",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Seq.Base.seq",
"Spec.SHA2.Lemmas.update_multi_224_256",
"Prims.eq2",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.word",
"Prims.l_or",
"Prims.nat",
"Spec.Hash.Definitions.state_word_length",
"Spec.SHA2.Lemmas.update_224_256",
"Spec.Agile.Hash.update",
"Spec.SHA2.Lemmas.update_multi_update",
"Spec.Hash.Lemmas.update_multi_associative",
"FStar.Seq.Base.append",
"Prims.b2t",
"Prims.op_Modulus",
"Spec.Hash.Definitions.block_length",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Pervasives.Native.tuple2",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Properties.split",
"Prims.nonzero",
"FStar.Pervasives.assert_norm",
"Spec.Hash.Definitions.hash_alg",
"Spec.Hash.Definitions.SHA2_224"
] | [
"recursion"
] | false | false | true | false | false | let rec update_multi_224_256 hash blocks =
| let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0
then
(assert (blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash)
else
(assert (block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert (S.length block1 = block_length a);
assert (S.length blocks_end % block_length a = 0);
assert ((S.append block1 blocks_end) `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert (hash1 == hash2);
update_multi_224_256 hash1 blocks_end) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_last_384_512 | val update_last_384_512:
hash:words_state SHA2_512 ->
prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_512 ->
input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_512 /\
Seq.length input <= block_length SHA2_512 } ->
Lemma
(ensures Spec.Hash.Incremental.Definitions.update_last SHA2_512 hash prevlen input ==
Spec.Hash.Incremental.Definitions.update_last SHA2_384 hash prevlen input) | val update_last_384_512:
hash:words_state SHA2_512 ->
prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_512 ->
input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_512 /\
Seq.length input <= block_length SHA2_512 } ->
Lemma
(ensures Spec.Hash.Incremental.Definitions.update_last SHA2_512 hash prevlen input ==
Spec.Hash.Incremental.Definitions.update_last SHA2_384 hash prevlen input) | let update_last_384_512 hash prevlen input =
let update_multi_384_512 (hash:words_state SHA2_512) (blocks:bytes_blocks SHA2_512):
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_384 hash () blocks))
(decreases (Seq.length blocks))
[ SMTPat (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks) ]
=
update_multi_384_512 hash blocks
in
() | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 4,
"end_line": 447,
"start_col": 0,
"start_line": 437
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
#push-options "--fuel 1"
let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end
#pop-options
let rec update_multi_224_256 hash blocks =
let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert(hash1 == hash2);
update_multi_224_256 hash1 blocks_end
end
#push-options "--z3rlimit 50"
let update_last_224_256 hash prevlen input =
let update_multi_224_256 (hash:words_state SHA2_256) (blocks:bytes_blocks SHA2_256):
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks))
[ SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks) ]
=
update_multi_224_256 hash blocks
in
()
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_384_512 hash block =
assert_norm (words_state SHA2_384 == words_state SHA2_512);
let rec ws_384_512 (b: block_w SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma
(ensures (ws SHA2_384 b t == ws SHA2_512 b t))
[ SMTPat (ws SHA2_512 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_512 == block_w SHA2_384);
assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_512 == _sigma0 SHA2_384)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op384_512; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));
assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));
norm_spec steps (_sigma0 SHA2_512);
norm_spec steps (_sigma0 SHA2_384);
norm_spec steps (_sigma1 SHA2_512);
norm_spec steps (_sigma1 SHA2_384);
// assert_norm (word_add_mod SHA2_512 == word_add_mod SHA2_384);
if t < block_word_length SHA2_512 then
()
else begin
ws_384_512 b (t - 16);
ws_384_512 b (t - 15);
ws_384_512 b (t - 7);
ws_384_512 b (t - 2)
end
in
let shuffle_core_384_512 (block:block_w SHA2_512) (hash:words_state SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))
[ SMTPat (shuffle_core SHA2_512 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_384_512 (hash:words_state SHA2_512) (block:block_w SHA2_512):
Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))
[ SMTPat (shuffle SHA2_512 hash block) ]
=
shuffle_is_shuffle_pre SHA2_384 hash block;
shuffle_is_shuffle_pre SHA2_512 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_384 == words_state SHA2_512)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) == words_of_bytes SHA2_384 #(block_word_length SHA2_384));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
let rec update_multi_384_512 hash blocks =
let a = SHA2_512 in
let a' = SHA2_384 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_384_512 hash block1;
assert(hash1 == hash2);
update_multi_384_512 hash1 blocks_end
end | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"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"
} | false |
hash: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_512 ->
prevlen: Spec.Hash.Incremental.Definitions.prev_length_t Spec.Hash.Definitions.SHA2_512 ->
input:
Spec.Hash.Definitions.bytes
{ Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input + prevlen)
Spec.Hash.Definitions.SHA2_512 /\
FStar.Seq.Base.length input <=
Spec.Hash.Definitions.block_length Spec.Hash.Definitions.SHA2_512 }
-> FStar.Pervasives.Lemma
(ensures
Spec.Hash.Incremental.Definitions.update_last Spec.Hash.Definitions.SHA2_512
hash
prevlen
input ==
Spec.Hash.Incremental.Definitions.update_last Spec.Hash.Definitions.SHA2_384
hash
prevlen
input) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_512",
"Spec.Hash.Incremental.Definitions.prev_length_t",
"Spec.Hash.Definitions.bytes",
"Prims.l_and",
"Prims.b2t",
"Spec.Hash.Definitions.less_than_max_input_length",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Prims.op_LessThanOrEqual",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.bytes_blocks",
"Prims.unit",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.word",
"Prims.l_or",
"Prims.nat",
"Spec.Hash.Definitions.state_word_length",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Agile.Hash.update_multi",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil",
"Spec.SHA2.Lemmas.update_multi_384_512"
] | [] | false | false | true | false | false | let update_last_384_512 hash prevlen input =
| let update_multi_384_512 (hash: words_state SHA2_512) (blocks: bytes_blocks SHA2_512)
: Lemma
(ensures
(Spec.Agile.Hash.update_multi SHA2_512 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_384 hash () blocks))
(decreases (Seq.length blocks))
[SMTPat (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks)] =
update_multi_384_512 hash blocks
in
() | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.parser_kind_prop | val parser_kind_prop (#a:Type) (k:parser_kind) (f:bare_parser a) : GTot Type0 | val parser_kind_prop (#a:Type) (k:parser_kind) (f:bare_parser a) : GTot Type0 | let parser_kind_prop = parser_kind_prop' | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 40,
"end_line": 8,
"start_col": 0,
"start_line": 8
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false | k: LowParse.Spec.Base.parser_kind -> f: LowParse.Spec.Base.bare_parser a -> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"LowParse.Spec.Base.parser_kind_prop'"
] | [] | false | false | false | false | true | let parser_kind_prop =
| parser_kind_prop' | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_13_15 | val va_wp_Loop_rounds_13_15 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_13_15 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 968,
"start_col": 0,
"start_line": 958
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_13_15 (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14))
((va_get_vec 12 va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\
(forall (va_x_v13: quad32) (va_x_v14: quad32) (va_x_v15: quad32).
let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13 va_s0)) in
va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14))
((va_get_vec 15 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==>
va_k va_sM (()))) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.parser_kind_prop_ext | val parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2)) | val parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2)) | let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2 | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 21,
"end_line": 24,
"start_col": 0,
"start_line": 16
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false |
k: LowParse.Spec.Base.parser_kind ->
f1: LowParse.Spec.Base.bare_parser t ->
f2: LowParse.Spec.Base.bare_parser t
-> FStar.Pervasives.Lemma
(requires
forall (input: LowParse.Bytes.bytes).
LowParse.Spec.Base.parse f1 input == LowParse.Spec.Base.parse f2 input)
(ensures
LowParse.Spec.Base.parser_kind_prop k f1 <==> LowParse.Spec.Base.parser_kind_prop k f2) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.bare_parser",
"LowParse.Spec.Base.injective_ext",
"Prims.unit",
"LowParse.Spec.Base.no_lookahead_ext",
"Prims.l_Forall",
"LowParse.Bytes.bytes",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"Prims.squash",
"Prims.l_iff",
"LowParse.Spec.Base.parser_kind_prop",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let parser_kind_prop_ext (#t: Type) (k: parser_kind) (f1 f2: bare_parser t)
: Lemma (requires (forall (input: bytes). parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2)) =
| no_lookahead_ext f1 f2;
injective_ext f1 f2 | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.shuffle_is_shuffle_pre | val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block) | val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block) | let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 120,
"start_col": 0,
"start_line": 66
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a -> | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 1,
"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": 25,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Hash.Definitions.sha2_alg ->
hash: Spec.Hash.Definitions.words_state a ->
block: Spec.SHA2.block_w a
-> FStar.Pervasives.Lemma
(ensures Spec.SHA2.shuffle a hash block == Spec.SHA2.Lemmas.shuffle_aux a hash block) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.words_state",
"Spec.SHA2.block_w",
"FStar.Pervasives.reveal_opaque",
"Spec.SHA2.shuffle",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Spec.SHA2.shuffle_pre",
"Spec.SHA2.Lemmas.shuffle_aux",
"Spec.SHA2.size_k_w",
"Spec.SHA2.Lemmas.shuffle_core",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.SHA2.shuffle_core_pre",
"Spec.SHA2.op_String_Access",
"Spec.Hash.Definitions.word",
"Spec.SHA2.k0",
"Spec.SHA2.ws_pre",
"FStar.Classical.forall_intro_2",
"Spec.SHA2.counter",
"Prims.l_True",
"Prims.squash",
"FStar.Seq.Base.index",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Spec.SHA2.k_w",
"FStar.Seq.Base.seq",
"Prims.op_Equality",
"FStar.Seq.Base.length",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Spec.SHA2.Lemmas.ws",
"Lib.LoopCombinators.repeati",
"Spec.SHA2.ws_pre_inner",
"FStar.Seq.Base.create",
"Spec.SHA2.to_word",
"Prims.int",
"Prims.bool",
"Prims.op_Subtraction",
"Lib.LoopCombinators.unfold_repeati",
"Prims.l_and",
"Spec.Loops.repeat_range",
"Lib.LoopCombinators.eq_repeati0",
"Spec.Loops.repeat_range_induction"
] | [] | false | false | true | false | false | let shuffle_is_shuffle_pre a hash block =
| let rec repeati_is_repeat_range
#a
(n: nat)
(f: (a -> i: nat{i < n} -> Tot a))
(f': (i: nat{i < n} -> a -> Tot a))
(i: nat{i <= n})
(acc0: a)
: Lemma (requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0) =
if i = 0
then (Lib.LoopCombinators.eq_repeati0 n f' acc0)
else
(Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i - 1);
repeati_is_repeat_range n f f' (i - 1) acc0)
in
let rec ws_is_ws_pre (i: nat{i <= size_k_w a})
: Lemma
(ensures
forall (j: nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[ j ]) =
if i = 0
then ()
else
(ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a)
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))
(i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i - 1) f acc0));
reveal_opaque (`%ws) ws)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre hash (i: counter{i < size_k_w a})
: Lemma
(shuffle_core a block hash i == shuffle_core_pre a (k0 a).[ i ] (ws_pre a block).[ i ] hash) =
ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a)
(shuffle_core a block)
(fun i h -> shuffle_core_pre a (k0 a).[ i ] (ws_pre a block).[ i ] h)
(size_k_w a)
hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_63_body | val va_wp_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 112,
"start_col": 0,
"start_line": 98
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
msg0: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg1: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg2: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg3: Vale.PPC64LE.Decls.va_operand_vec_opr ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_operand_vec_opr",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.PPC64LE.Decls.va_is_dst_vec_opr",
"Vale.PPC64LE.Decls.va_is_src_vec_opr",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Addition",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_eval_vec_opr",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Prims.op_Subtraction",
"Prims.l_Forall",
"Vale.PPC64LE.Decls.va_value_vec_opr",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA2.Wrapper.sigma256_0_1",
"Vale.SHA2.Wrapper.sigma256_0_0",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_operand_vec_opr"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\
(l_and (16 <= i) (i < 64) /\
(let j = i `op_Modulus` 16 in
msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus` 16 /\
msg3 == (j + 14) `op_Modulus` 16 /\
(va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block (i - 16) /\
(va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\
(va_eval_vec_opr va_s0 msg2).hi3 == ws_opaque block (i - 7) /\
(va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque block (i - 2))) /\
(forall (va_x_msg0: va_value_vec_opr) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0 va_x_msg0 va_s0))
in
va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in
let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in
(va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1)
(ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==>
va_k va_sM (()))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_60_63_a | val va_wp_Loop_rounds_60_63_a (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_60_63_a (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_60_63_a (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 54)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 55)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 56)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 59)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 60)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13
va_s0)))) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 1247,
"start_col": 0,
"start_line": 1230
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block))
//--
//-- Loop_rounds_16_59_b
val va_code_Loop_rounds_16_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 == ws_opaque block
(i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 7 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6
va_sM (va_update_vec 5 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_b (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4))
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
12))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5))) /\ (forall
(va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 8
va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_b : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_b i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_b (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_b i)) =
(va_QProc (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) (va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block))
//--
//-- Loop_rounds_16_59_c
val va_code_Loop_rounds_16_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6)) ((va_get_vec 3
va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 9 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12 va_s0).hi3 ==
ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 11)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10
va_sM (va_update_vec 9 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_c (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i))
((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
11))) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) (va_x_v12:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec
11 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_c : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_c i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_c (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_c i)) =
(va_QProc (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 12;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) (va_wp_Loop_rounds_16_59_c i block)
(va_wpProof_Loop_rounds_16_59_c i block))
//--
//-- Loop_rounds_16_59_d
val va_code_Loop_rounds_16_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (i == 28) (i == 44) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 12)) ((va_get_vec 1 va_s0).hi3 ==
ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
4))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 1))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 13
va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
14))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 13)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 4)) ((va_get_vec 13
va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 3)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13
va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_d (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (i == 28) (i == 44) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 12)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 6)))
((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 8 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 11
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block i))
((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 14))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 13))) /\ (forall
(va_x_v0:quad32) (va_x_v13:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 15
va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13 (va_upd_vec 0 va_x_v0 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 4))
((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 14 va_sM).hi3 == ws_opaque
block (i + 2))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 3)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_d : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_d i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_d i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 0]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_d (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_d i)) =
(va_QProc (va_code_Loop_rounds_16_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 0]) (va_wp_Loop_rounds_16_59_d i block)
(va_wpProof_Loop_rounds_16_59_d i block))
//--
//-- Loop_rounds_60_63_a
val va_code_Loop_rounds_60_63_a : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_a : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_a : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_a ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 54)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 55)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 56)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 59)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 60)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM
(va_update_vec 13 va_sM (va_update_ok va_sM va_s0)))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_60_63_a (block: block_w) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 54))
((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 55))
((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 56
))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 59))
((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 60))
((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\
(forall (va_x_v13: quad32)
(va_x_v14: quad32)
(va_x_v15: quad32)
(va_x_v25: quad32)
(va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13 va_s0))))
in
va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62))
((va_get_vec 15 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) ==>
va_k va_sM (()))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_a | val va_quick_Loop_rounds_0_59_a (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) | val va_quick_Loop_rounds_0_59_a (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) | let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 274,
"start_col": 0,
"start_line": 269
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_0_59_a",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_0_59_a (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
| (va_QProc (va_code_Loop_rounds_0_59_a i)
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6
])
(va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig)) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.serializer_parser_unique' | val serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires (
is_strong p1 /\
is_strong p2 /\
serializer_correct p1 s /\
serializer_correct p2 s /\
Some? (parse p1 x)
))
(ensures (
parse p1 x == parse p2 x
)) | val serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires (
is_strong p1 /\
is_strong p2 /\
serializer_correct p1 s /\
serializer_correct p2 s /\
Some? (parse p1 x)
))
(ensures (
parse p1 x == parse p2 x
)) | let serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires (
is_strong p1 /\
is_strong p2 /\
serializer_correct p1 s /\
serializer_correct p2 s /\
Some? (parse p1 x)
))
(ensures (
parse p1 x == parse p2 x
))
= serializer_correct_implies_complete p1 s;
let (Some (y, len)) = parse p1 x in
let x' = Seq.slice x 0 len in
assert (s y == x');
let len' = Seq.length x' in
assert (len == len');
assert (parse p1 x' == Some (y, len'));
assert (parse p2 x' == Some (y, len'));
assert (no_lookahead_on p2 x' x);
assert (no_lookahead_on_postcond p2 x' x);
assert (injective_postcond p2 x' x) | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 37,
"end_line": 128,
"start_col": 0,
"start_line": 99
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= ()
let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2
let is_weaker_than_correct
(k1: parser_kind)
(k2: parser_kind)
(#t: Type)
(f: bare_parser t)
: Lemma
(requires (parser_kind_prop k2 f /\ k1 `is_weaker_than` k2))
(ensures (parser_kind_prop k1 f))
= ()
let parse_injective
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
injective_precond p input1 input2
))
(ensures (
injective_postcond p input1 input2
))
= ()
let parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
))
= assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2)
let serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f))
= let prf
(s: bytes)
: Lemma
(requires (Some? (parse p s)))
(ensures (
Some? (parse p s) /\ (
let (Some (x, len)) = parse p s in
f x == Seq.slice s 0 len
)))
= let (Some (x, len)) = parse p s in
assert (injective_precond p (f x) s);
assert (injective_postcond p (f x) s)
in
Classical.forall_intro (Classical.move_requires prf) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false |
p1: LowParse.Spec.Base.parser k1 t ->
p2: LowParse.Spec.Base.parser k2 t ->
s: LowParse.Spec.Base.bare_serializer t ->
x: LowParse.Bytes.bytes
-> FStar.Pervasives.Lemma
(requires
LowParse.Spec.Base.is_strong p1 /\ LowParse.Spec.Base.is_strong p2 /\
LowParse.Spec.Base.serializer_correct p1 s /\ LowParse.Spec.Base.serializer_correct p2 s /\
Some? (LowParse.Spec.Base.parse p1 x))
(ensures LowParse.Spec.Base.parse p1 x == LowParse.Spec.Base.parse p2 x) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.bare_serializer",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.consumed_length",
"Prims._assert",
"LowParse.Spec.Base.injective_postcond",
"Prims.unit",
"LowParse.Spec.Base.no_lookahead_on_postcond",
"LowParse.Spec.Base.no_lookahead_on",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.parse",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Prims.nat",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice",
"LowParse.Spec.Base.serializer_correct_implies_complete",
"Prims.l_and",
"Prims.b2t",
"LowParse.Spec.Base.is_strong",
"LowParse.Spec.Base.serializer_correct",
"FStar.Pervasives.Native.uu___is_Some",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires
(is_strong p1 /\ is_strong p2 /\ serializer_correct p1 s /\ serializer_correct p2 s /\
Some? (parse p1 x))) (ensures (parse p1 x == parse p2 x)) =
| serializer_correct_implies_complete p1 s;
let Some (y, len) = parse p1 x in
let x' = Seq.slice x 0 len in
assert (s y == x');
let len' = Seq.length x' in
assert (len == len');
assert (parse p1 x' == Some (y, len'));
assert (parse p2 x' == Some (y, len'));
assert (no_lookahead_on p2 x' x);
assert (no_lookahead_on_postcond p2 x' x);
assert (injective_postcond p2 x' x) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.serializer_correct_implies_complete | val serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f)) | val serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f)) | let serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f))
= let prf
(s: bytes)
: Lemma
(requires (Some? (parse p s)))
(ensures (
Some? (parse p s) /\ (
let (Some (x, len)) = parse p s in
f x == Seq.slice s 0 len
)))
= let (Some (x, len)) = parse p s in
assert (injective_precond p (f x) s);
assert (injective_postcond p (f x) s)
in
Classical.forall_intro (Classical.move_requires prf) | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 54,
"end_line": 97,
"start_col": 0,
"start_line": 76
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= ()
let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2
let is_weaker_than_correct
(k1: parser_kind)
(k2: parser_kind)
(#t: Type)
(f: bare_parser t)
: Lemma
(requires (parser_kind_prop k2 f /\ k1 `is_weaker_than` k2))
(ensures (parser_kind_prop k1 f))
= ()
let parse_injective
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
injective_precond p input1 input2
))
(ensures (
injective_postcond p input1 input2
))
= ()
let parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
))
= assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false | p: LowParse.Spec.Base.parser k t -> f: LowParse.Spec.Base.bare_serializer t
-> FStar.Pervasives.Lemma (requires LowParse.Spec.Base.serializer_correct p f)
(ensures LowParse.Spec.Base.serializer_complete p f) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.bare_serializer",
"FStar.Classical.forall_intro",
"LowParse.Bytes.bytes",
"Prims.l_imp",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.parse",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"FStar.Seq.Base.slice",
"Prims.logical",
"FStar.Classical.move_requires",
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Prims._assert",
"LowParse.Spec.Base.injective_postcond",
"LowParse.Spec.Base.injective_precond",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.serializer_correct",
"LowParse.Spec.Base.serializer_complete"
] | [] | false | false | true | false | false | let serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma (requires (serializer_correct p f)) (ensures (serializer_complete p f)) =
| let prf (s: bytes)
: Lemma (requires (Some? (parse p s)))
(ensures
(Some? (parse p s) /\
(let Some (x, len) = parse p s in
f x == Seq.slice s 0 len))) =
let Some (x, len) = parse p s in
assert (injective_precond p (f x) s);
assert (injective_postcond p (f x) s)
in
Classical.forall_intro (Classical.move_requires prf) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.serialize_not_fail | val serialize_not_fail
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(k.parser_kind_metadata <> Some ParserKindMetadataFail)
[SMTPat (serialize s x)] | val serialize_not_fail
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(k.parser_kind_metadata <> Some ParserKindMetadataFail)
[SMTPat (serialize s x)] | let serialize_not_fail
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(k.parser_kind_metadata <> Some ParserKindMetadataFail)
[SMTPat (serialize s x)]
= assert (Some? (parse p (serialize s x))) | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 42,
"end_line": 155,
"start_col": 0,
"start_line": 146
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= ()
let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2
let is_weaker_than_correct
(k1: parser_kind)
(k2: parser_kind)
(#t: Type)
(f: bare_parser t)
: Lemma
(requires (parser_kind_prop k2 f /\ k1 `is_weaker_than` k2))
(ensures (parser_kind_prop k1 f))
= ()
let parse_injective
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
injective_precond p input1 input2
))
(ensures (
injective_postcond p input1 input2
))
= ()
let parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
))
= assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2)
let serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f))
= let prf
(s: bytes)
: Lemma
(requires (Some? (parse p s)))
(ensures (
Some? (parse p s) /\ (
let (Some (x, len)) = parse p s in
f x == Seq.slice s 0 len
)))
= let (Some (x, len)) = parse p s in
assert (injective_precond p (f x) s);
assert (injective_postcond p (f x) s)
in
Classical.forall_intro (Classical.move_requires prf)
let serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires (
is_strong p1 /\
is_strong p2 /\
serializer_correct p1 s /\
serializer_correct p2 s /\
Some? (parse p1 x)
))
(ensures (
parse p1 x == parse p2 x
))
= serializer_correct_implies_complete p1 s;
let (Some (y, len)) = parse p1 x in
let x' = Seq.slice x 0 len in
assert (s y == x');
let len' = Seq.length x' in
assert (len == len');
assert (parse p1 x' == Some (y, len'));
assert (parse p2 x' == Some (y, len'));
assert (no_lookahead_on p2 x' x);
assert (no_lookahead_on_postcond p2 x' x);
assert (injective_postcond p2 x' x)
let serialize_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(let x = Seq.length (serialize s x) in
k.parser_kind_low <= x /\ (
match k.parser_kind_high with
| None -> True
| Some y -> x <= y
))
[SMTPat (Seq.length (serialize s x))]
= assert (Some? (parse p (serialize s x))) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false | s: LowParse.Spec.Base.serializer p -> x: t
-> FStar.Pervasives.Lemma
(ensures
Mkparser_kind'?.parser_kind_metadata k <>
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserKindMetadataFail)
[SMTPat (LowParse.Spec.Base.serialize s x)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"Prims._assert",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.Base.parse",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.op_disEquality",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_kind_metadata_some",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_metadata",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserKindMetadataFail",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"LowParse.Bytes.bytes",
"Prims.Nil"
] | [] | true | false | true | false | false | let serialize_not_fail (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t)
: Lemma (k.parser_kind_metadata <> Some ParserKindMetadataFail) [SMTPat (serialize s x)] =
| assert (Some? (parse p (serialize s x))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_b | val va_quick_Loop_rounds_0_59_b (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) | val va_quick_Loop_rounds_0_59_b (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) | let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 419,
"start_col": 0,
"start_line": 414
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_0_59_b",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_0_59_b (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
| (va_QProc (va_code_Loop_rounds_0_59_b i)
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6
])
(va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_3_7_11_body | val va_quick_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) | val va_quick_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) | let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 17,
"end_line": 69,
"start_col": 0,
"start_line": 65
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
msg: Vale.PPC64LE.Decls.va_operand_vec_opr ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_3_7_11_body i msg) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_operand_vec_opr",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_3_7_11_body",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_mod_vec_opr",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_3_7_11_body",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_3_7_11_body",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_3_7_11_body
(i: nat)
(msg: va_operand_vec_opr)
(in_b: buffer128)
(offset: nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
| (va_QProc (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset)
(va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset)) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.serialize_length | val serialize_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(let x = Seq.length (serialize s x) in
k.parser_kind_low <= x /\ (
match k.parser_kind_high with
| None -> True
| Some y -> x <= y
))
[SMTPat (Seq.length (serialize s x))] | val serialize_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(let x = Seq.length (serialize s x) in
k.parser_kind_low <= x /\ (
match k.parser_kind_high with
| None -> True
| Some y -> x <= y
))
[SMTPat (Seq.length (serialize s x))] | let serialize_length
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(x: t)
: Lemma
(let x = Seq.length (serialize s x) in
k.parser_kind_low <= x /\ (
match k.parser_kind_high with
| None -> True
| Some y -> x <= y
))
[SMTPat (Seq.length (serialize s x))]
= assert (Some? (parse p (serialize s x))) | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 42,
"end_line": 144,
"start_col": 0,
"start_line": 130
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= ()
let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2
let is_weaker_than_correct
(k1: parser_kind)
(k2: parser_kind)
(#t: Type)
(f: bare_parser t)
: Lemma
(requires (parser_kind_prop k2 f /\ k1 `is_weaker_than` k2))
(ensures (parser_kind_prop k1 f))
= ()
let parse_injective
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
injective_precond p input1 input2
))
(ensures (
injective_postcond p input1 input2
))
= ()
let parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
))
= assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2)
let serializer_correct_implies_complete
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(f: bare_serializer t)
: Lemma
(requires (serializer_correct p f))
(ensures (serializer_complete p f))
= let prf
(s: bytes)
: Lemma
(requires (Some? (parse p s)))
(ensures (
Some? (parse p s) /\ (
let (Some (x, len)) = parse p s in
f x == Seq.slice s 0 len
)))
= let (Some (x, len)) = parse p s in
assert (injective_precond p (f x) s);
assert (injective_postcond p (f x) s)
in
Classical.forall_intro (Classical.move_requires prf)
let serializer_parser_unique'
(#k1: parser_kind)
(#t: Type)
(p1: parser k1 t)
(#k2: parser_kind)
(p2: parser k2 t)
(s: bare_serializer t)
(x: bytes)
: Lemma
(requires (
is_strong p1 /\
is_strong p2 /\
serializer_correct p1 s /\
serializer_correct p2 s /\
Some? (parse p1 x)
))
(ensures (
parse p1 x == parse p2 x
))
= serializer_correct_implies_complete p1 s;
let (Some (y, len)) = parse p1 x in
let x' = Seq.slice x 0 len in
assert (s y == x');
let len' = Seq.length x' in
assert (len == len');
assert (parse p1 x' == Some (y, len'));
assert (parse p2 x' == Some (y, len'));
assert (no_lookahead_on p2 x' x);
assert (no_lookahead_on_postcond p2 x' x);
assert (injective_postcond p2 x' x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false | s: LowParse.Spec.Base.serializer p -> x: t
-> FStar.Pervasives.Lemma
(ensures
(let x = FStar.Seq.Base.length (LowParse.Spec.Base.serialize s x) in
Mkparser_kind'?.parser_kind_low k <= x /\
((match Mkparser_kind'?.parser_kind_high k with
| FStar.Pervasives.Native.None #_ -> Prims.l_True
| FStar.Pervasives.Native.Some #_ y -> x <= y)
<:
Prims.logical))) [SMTPat (FStar.Seq.Base.length (LowParse.Spec.Base.serialize s x))] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"Prims._assert",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.Base.parse",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_and",
"Prims.op_LessThanOrEqual",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high",
"Prims.nat",
"Prims.logical",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | true | false | true | false | false | let serialize_length (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (x: t)
: Lemma
(let x = Seq.length (serialize s x) in
k.parser_kind_low <= x /\
(match k.parser_kind_high with
| None -> True
| Some y -> x <= y)) [SMTPat (Seq.length (serialize s x))] =
| assert (Some? (parse p (serialize s x))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_c | val va_quick_Loop_rounds_0_59_c (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_c i)) | val va_quick_Loop_rounds_0_59_c (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_c i)) | let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 564,
"start_col": 0,
"start_line": 559
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_0_59_c",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_0_59_c (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
| (va_QProc (va_code_Loop_rounds_0_59_c i)
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6
])
(va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig)) | false |
LowParse.Spec.Base.fst | LowParse.Spec.Base.parse_strong_prefix | val parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
)) | val parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
)) | let parse_strong_prefix
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
k.parser_kind_subkind == Some ParserStrong /\ (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
Seq.slice input1 0 consumed `Seq.equal` Seq.slice input2 0 consumed
| _ -> False
)))
(ensures (
match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
parse p input2 == Some (x, consumed)
| _ -> False
))
= assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2) | {
"file_name": "src/lowparse/LowParse.Spec.Base.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 45,
"end_line": 74,
"start_col": 0,
"start_line": 51
} | module LowParse.Spec.Base
include LowParse.Bytes
module Seq = FStar.Seq
module U8 = FStar.UInt8
module U32 = FStar.UInt32
let parser_kind_prop = parser_kind_prop'
let parser_kind_prop_equiv
(#t: Type) (k: parser_kind) (f: bare_parser t)
: Lemma
(parser_kind_prop k f <==> parser_kind_prop' k f)
= ()
let parser_kind_prop_ext
(#t: Type)
(k: parser_kind)
(f1 f2: bare_parser t)
: Lemma
(requires (forall (input: bytes) . parse f1 input == parse f2 input))
(ensures (parser_kind_prop k f1 <==> parser_kind_prop k f2))
= no_lookahead_ext f1 f2;
injective_ext f1 f2
let is_weaker_than_correct
(k1: parser_kind)
(k2: parser_kind)
(#t: Type)
(f: bare_parser t)
: Lemma
(requires (parser_kind_prop k2 f /\ k1 `is_weaker_than` k2))
(ensures (parser_kind_prop k1 f))
= ()
let parse_injective
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(input1: bytes)
(input2: bytes)
: Lemma
(requires (
injective_precond p input1 input2
))
(ensures (
injective_postcond p input1 input2
))
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Bytes.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "LowParse.Spec.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Bytes",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"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
}
] | {
"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"
} | false | p: LowParse.Spec.Base.parser k t -> input1: LowParse.Bytes.bytes -> input2: LowParse.Bytes.bytes
-> FStar.Pervasives.Lemma
(requires
Mkparser_kind'?.parser_kind_subkind k ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong /\
((match LowParse.Spec.Base.parse p input1 with
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ _ consumed) ->
consumed <= FStar.Seq.Base.length input2 /\
FStar.Seq.Base.equal (FStar.Seq.Base.slice input1 0 consumed)
(FStar.Seq.Base.slice input2 0 consumed)
| _ -> Prims.l_False)
<:
Prims.logical))
(ensures
((match LowParse.Spec.Base.parse p input1 with
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed) ->
consumed <= FStar.Seq.Base.length input2 /\
LowParse.Spec.Base.parse p input2 == FStar.Pervasives.Native.Some (x, consumed)
| _ -> Prims.l_False)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Bytes.bytes",
"Prims._assert",
"LowParse.Spec.Base.injective_postcond",
"Prims.unit",
"LowParse.Spec.Base.no_lookahead_on",
"Prims.l_and",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Base.parse",
"LowParse.Spec.Base.consumed_length",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.slice",
"FStar.Pervasives.Native.tuple2",
"Prims.l_False",
"Prims.logical",
"Prims.squash",
"FStar.Pervasives.Native.Mktuple2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let parse_strong_prefix (#k: parser_kind) (#t: Type) (p: parser k t) (input1 input2: bytes)
: Lemma
(requires
(k.parser_kind_subkind == Some ParserStrong /\
(match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\
(Seq.slice input1 0 consumed) `Seq.equal` (Seq.slice input2 0 consumed)
| _ -> False)))
(ensures
(match parse p input1 with
| Some (x, consumed) ->
consumed <= Seq.length input2 /\ parse p input2 == Some (x, consumed)
| _ -> False)) =
| assert (no_lookahead_on p input1 input2);
assert (injective_postcond p input1 input2) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_63_body | val va_quick_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) | val va_quick_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) | let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 129,
"start_col": 0,
"start_line": 124
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
msg0: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg1: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg2: Vale.PPC64LE.Decls.va_operand_vec_opr ->
msg3: Vale.PPC64LE.Decls.va_operand_vec_opr ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_operand_vec_opr",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_63_body",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_mod_vec_opr",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_63_body",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_16_63_body",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_63_body
(i: nat)
(msg0 msg1 msg2 msg3: va_operand_vec_opr)
(block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
| (va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)
([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0])
(va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_60_63_b | val va_quick_Loop_rounds_60_63_b (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_60_63_b ())) | val va_quick_Loop_rounds_60_63_b (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_60_63_b ())) | let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 57,
"end_line": 813,
"start_col": 0,
"start_line": 808
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_b ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_b",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_60_63_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_60_63_b",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_60_63_b (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
| (va_QProc (va_code_Loop_rounds_60_63_b ())
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6
])
(va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_a | val va_wp_Loop_rounds_0_59_a
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_0_59_a
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 10,
"end_line": 258,
"start_col": 0,
"start_line": 199
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_0_59_a
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
(i `op_Division` 4 + 1)
1
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2)))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\
(forall (va_x_r6: nat64) (va_x_v16: quad32) (va_x_v17: quad32) (va_x_v18: quad32)
(va_x_v19: quad32) (va_x_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(va_upd_vec 19
va_x_v19
(va_upd_vec 18
va_x_v18
(va_upd_vec 17
va_x_v17
(va_upd_vec 16 va_x_v16 (va_upd_reg 6 va_x_r6 va_s0)))
))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5)
)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==>
va_k va_sM (()))) | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_384_512 | val update_384_512: st:words_state SHA2_512 ->
block:bytes{Seq.length block = block_length SHA2_512} ->
Lemma
(ensures (Spec.Agile.Hash.(update SHA2_512 st block == update SHA2_384 st block))) | val update_384_512: st:words_state SHA2_512 ->
block:bytes{Seq.length block = block_length SHA2_512} ->
Lemma
(ensures (Spec.Agile.Hash.(update SHA2_512 st block == update SHA2_384 st block))) | let update_384_512 hash block =
assert_norm (words_state SHA2_384 == words_state SHA2_512);
let rec ws_384_512 (b: block_w SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma
(ensures (ws SHA2_384 b t == ws SHA2_512 b t))
[ SMTPat (ws SHA2_512 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_512 == block_w SHA2_384);
assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_512 == _sigma0 SHA2_384)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op384_512; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));
assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));
norm_spec steps (_sigma0 SHA2_512);
norm_spec steps (_sigma0 SHA2_384);
norm_spec steps (_sigma1 SHA2_512);
norm_spec steps (_sigma1 SHA2_384);
// assert_norm (word_add_mod SHA2_512 == word_add_mod SHA2_384);
if t < block_word_length SHA2_512 then
()
else begin
ws_384_512 b (t - 16);
ws_384_512 b (t - 15);
ws_384_512 b (t - 7);
ws_384_512 b (t - 2)
end
in
let shuffle_core_384_512 (block:block_w SHA2_512) (hash:words_state SHA2_512) (t:counter{t < size_k_w SHA2_512}):
Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))
[ SMTPat (shuffle_core SHA2_512 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_384_512 (hash:words_state SHA2_512) (block:block_w SHA2_512):
Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))
[ SMTPat (shuffle SHA2_512 hash block) ]
=
shuffle_is_shuffle_pre SHA2_384 hash block;
shuffle_is_shuffle_pre SHA2_512 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_384 == words_state SHA2_512)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) == words_of_bytes SHA2_384 #(block_word_length SHA2_384));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 404,
"start_col": 0,
"start_line": 311
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2)
#push-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 200"
let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update
#pop-options
#push-options "--fuel 1"
let update_multi_update (a: md_alg) (h: words_state a) (input: bytes_block a): Lemma
(ensures (Spec.Agile.Hash.update_multi a h () input) == (Spec.Agile.Hash.update a h input))
=
let h1 = Spec.Agile.Hash.update_multi a h () input in
assert(h1 == Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h input);
if S.length input = 0 then
begin
assert(h1 == h)
end
else
begin
let block, rem = Lib.UpdateMulti.split_block (block_length a) input 1 in
let h2 = Spec.Agile.Hash.update a h block in
assert(rem `Seq.equal` Seq.empty);
assert(block `Seq.equal` input);
let h3 = Lib.UpdateMulti.mk_update_multi (block_length a) (Spec.Agile.Hash.update a) h2 rem in
assert(h1 == h3)
end
#pop-options
let rec update_multi_224_256 hash blocks =
let a = SHA2_256 in
let a' = SHA2_224 in
assert_norm (words_state a == words_state a');
if S.length blocks = 0 then
begin
assert(blocks `S.equal` S.empty);
Spec.Hash.Lemmas.update_multi_zero a hash;
Spec.Hash.Lemmas.update_multi_zero a' hash
end
else
begin
assert(block_length a = block_length a');
let block1, blocks_end = S.split blocks (block_length a) in
assert(S.length block1 = block_length a);
assert(S.length blocks_end % block_length a = 0);
assert(S.append block1 blocks_end `S.equal` blocks);
update_multi_associative a hash block1 blocks_end;
update_multi_associative a' hash block1 blocks_end;
update_multi_update a hash block1;
update_multi_update a' hash block1;
let hash1 = Spec.Agile.Hash.update a hash block1 in
let hash2 = Spec.Agile.Hash.update a' hash block1 in
update_224_256 hash block1;
assert(hash1 == hash2);
update_multi_224_256 hash1 blocks_end
end
#push-options "--z3rlimit 50"
let update_last_224_256 hash prevlen input =
let update_multi_224_256 (hash:words_state SHA2_256) (blocks:bytes_blocks SHA2_256):
Lemma
(ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==
Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))
(decreases (Seq.length blocks))
[ SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks) ]
=
update_multi_224_256 hash blocks
in
() | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"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": 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": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
st: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_512 ->
block:
Spec.Hash.Definitions.bytes
{ FStar.Seq.Base.length block =
Spec.Hash.Definitions.block_length Spec.Hash.Definitions.SHA2_512 }
-> FStar.Pervasives.Lemma
(ensures
Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_512 st block ==
Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_384 st block) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_512",
"Spec.Hash.Definitions.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Definitions.block_length",
"FStar.Pervasives.reveal_opaque",
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.update_t",
"Spec.SHA2.update",
"Prims.unit",
"Spec.SHA2.block_w",
"Spec.SHA2.shuffle",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Spec.Hash.Definitions.word_length",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Hash.Definitions.block_word_length",
"Spec.Hash.Definitions.word",
"Spec.Hash.Definitions.words_of_bytes",
"FStar.Seq.Base.seq",
"Prims.nat",
"Prims.l_Forall",
"Prims.squash",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Spec.Loops.seq_map2",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil",
"Prims.bool",
"FStar.Seq.Properties.tail",
"Prims.l_True",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.state_word_length",
"Spec.SHA2.Lemmas.shuffle_is_shuffle_pre",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Spec.Loops.repeat_range",
"Prims.op_Addition",
"Spec.SHA2.counter",
"Spec.SHA2.size_k_w",
"Spec.SHA2.Lemmas.shuffle_core",
"Spec.SHA2.Lemmas.ws",
"FStar.Pervasives.norm_spec",
"Spec.SHA2._sigma1",
"Spec.SHA2._sigma0",
"Prims._assert",
"FStar.Pervasives.norm",
"Prims.list",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops",
"FStar.Pervasives.simplify",
"FStar.Pervasives.delta_only",
"Prims.string"
] | [] | false | false | true | false | false | let update_384_512 hash block =
| assert_norm (words_state SHA2_384 == words_state SHA2_512);
let rec ws_384_512 (b: block_w SHA2_512) (t: counter{t < size_k_w SHA2_512})
: Lemma (ensures (ws SHA2_384 b t == ws SHA2_512 b t)) [SMTPat (ws SHA2_512 b t)] =
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_512 == block_w SHA2_384);
assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);
let steps =
[
iota;
primops;
simplify;
delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t; `%__proj__Mkops__item__e5; `%op384_512;
`%__proj__Mkops__item__e3; `%__proj__Mkops__item__e4; `%Spec.SHA2.op_Hat_Dot;
`%Spec.SHA2.op_Greater_Greater_Dot; `%Spec.SHA2.op_Greater_Greater_Greater_Dot
]
]
in
assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));
assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));
norm_spec steps (_sigma0 SHA2_512);
norm_spec steps (_sigma0 SHA2_384);
norm_spec steps (_sigma1 SHA2_512);
norm_spec steps (_sigma1 SHA2_384);
if t < block_word_length SHA2_512
then ()
else
(ws_384_512 b (t - 16);
ws_384_512 b (t - 15);
ws_384_512 b (t - 7);
ws_384_512 b (t - 2))
in
let shuffle_core_384_512
(block: block_w SHA2_512)
(hash: words_state SHA2_512)
(t: counter{t < size_k_w SHA2_512})
: Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))
[SMTPat (shuffle_core SHA2_512 block hash t)] =
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f
(#a: Type)
(min: nat)
(max: nat{min <= max})
(f g: (a -> i: nat{i < max} -> Tot a))
(x: a)
: Lemma (requires (forall x (i: nat{i < max}). {:pattern f x i\/g x i} f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x)] =
if min = max then () else repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_384_512 (hash: words_state SHA2_512) (block: block_w SHA2_512)
: Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))
[SMTPat (shuffle SHA2_512 hash block)] =
shuffle_is_shuffle_pre SHA2_384 hash block;
shuffle_is_shuffle_pre SHA2_512 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_384 == words_state SHA2_512)
in
let rec seq_map2_f
(#a #b #c: Type)
(f g: (a -> b -> Tot c))
(s: S.seq a)
(s': S.seq b {S.length s = S.length s'})
: Lemma (requires (forall x y. {:pattern f x y\/g x y} f x y == g x y))
(ensures (let open Spec.Loops in seq_map2 f s s' == seq_map2 g s s'))
(decreases (S.length s))
[SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s')] =
if S.length s = 0 then () else seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) ==
words_of_bytes SHA2_384 #(block_word_length SHA2_384));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_c | val va_wp_Loop_rounds_0_59_c
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_0_59_c
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 10,
"end_line": 548,
"start_col": 0,
"start_line": 489
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_0_59_c
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
(i `op_Division` 4 + 1)
1
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)
((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2)))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\
(forall (va_x_r6: nat64) (va_x_v16: quad32) (va_x_v17: quad32) (va_x_v18: quad32)
(va_x_v19: quad32) (va_x_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(va_upd_vec 19
va_x_v19
(va_upd_vec 18
va_x_v18
(va_upd_vec 17
va_x_v17
(va_upd_vec 16 va_x_v16 (va_upd_reg 6 va_x_r6 va_s0)))
))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5)
)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==>
va_k va_sM (()))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_d | val va_quick_Loop_rounds_0_59_d (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_d i)) | val va_quick_Loop_rounds_0_59_d (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_d i)) | let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 709,
"start_col": 0,
"start_line": 704
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_0_59_d",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_0_59_d (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
| (va_QProc (va_code_Loop_rounds_0_59_d i)
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6
])
(va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig)) | false |
Hacl.HKDF.fst | Hacl.HKDF.mk_extract | val mk_extract:
a: fixed_len_alg ->
hmac: Hacl.HMAC.compute_st a ->
extract_st a | val mk_extract:
a: fixed_len_alg ->
hmac: Hacl.HMAC.compute_st a ->
extract_st a | let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 30,
"start_col": 0,
"start_line": 29
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.Hash.Definitions.fixed_len_alg -> hmac: Hacl.HMAC.compute_st a -> Hacl.HKDF.extract_st a | Prims.Tot | [
"total"
] | [] | [
"Spec.Hash.Definitions.fixed_len_alg",
"Hacl.HMAC.compute_st",
"LowStar.Buffer.buffer",
"Lib.IntTypes.uint8",
"Lib.IntTypes.pub_uint32",
"Prims.unit"
] | [] | false | false | false | false | false | let mk_extract a hmac prk salt saltlen ikm ikmlen =
| hmac prk salt saltlen ikm ikmlen | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_60_63_b | val va_wp_Loop_rounds_60_63_b
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_60_63_b
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 91,
"end_line": 797,
"start_col": 0,
"start_line": 758
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validSrcAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_60_63_b
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
16
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 60)
((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\
(forall (va_x_r6: nat64) (va_x_v16: quad32) (va_x_v17: quad32) (va_x_v18: quad32)
(va_x_v19: quad32) (va_x_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(va_upd_vec 19
va_x_v19
(va_upd_vec 18
va_x_v18
(va_upd_vec 17
va_x_v17
(va_upd_vec 16 va_x_v16 (va_upd_reg 6 va_x_r6 va_s0)))
))))))))
in
va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM)
(va_get_vec 17 va_sM)
(va_get_vec 18 va_sM)
(va_get_vec 19 va_sM)
(va_get_vec 20 va_sM)
(va_get_vec 21 va_sM)
(va_get_vec 22 va_sM)
(va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==>
va_k va_sM (()))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_a | val va_wp_Loop_rounds_16_59_a
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_16_59_a
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 1022,
"start_col": 0,
"start_line": 1006
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Prims.op_Subtraction",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Prims.op_Addition",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_16_59_a
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 ==
ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15)))
((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11)))
((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 3)))
((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1))) /\
(forall (va_x_v1: quad32)
(va_x_v2: quad32)
(va_x_v3: quad32)
(va_x_v4: quad32)
(va_x_v25: quad32)
(va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 4
va_x_v4
(va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 va_s0)))))
in
va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) ==>
va_k va_sM (()))) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_1_3 | val va_quick_Loop_rounds_1_3 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) | val va_quick_Loop_rounds_1_3 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) | let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 854,
"start_col": 0,
"start_line": 852
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_1_3 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_1_3",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_1_3",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_1_3",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_1_3 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
| (va_QProc (va_code_Loop_rounds_1_3 ())
([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block)
(va_wpProof_Loop_rounds_1_3 block)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_b | val va_wp_Loop_rounds_0_59_b
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_0_59_b
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 10,
"end_line": 403,
"start_col": 0,
"start_line": 344
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_0_59_b
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
(i `op_Division` 4 + 1)
1
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)
((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2)))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\
(forall (va_x_r6: nat64) (va_x_v16: quad32) (va_x_v17: quad32) (va_x_v18: quad32)
(va_x_v19: quad32) (va_x_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(va_upd_vec 19
va_x_v19
(va_upd_vec 18
va_x_v18
(va_upd_vec 17
va_x_v17
(va_upd_vec 16 va_x_v16 (va_upd_reg 6 va_x_r6 va_s0)))
))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5)
)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==>
va_k va_sM (()))) | false |
Hacl.HKDF.fst | Hacl.HKDF.expand_sha2_256 | val expand_sha2_256: expand_st SHA2_256 | val expand_sha2_256: expand_st SHA2_256 | let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 172,
"start_col": 0,
"start_line": 171
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame () | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.expand_st Spec.Hash.Definitions.SHA2_256 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_expand",
"Spec.Hash.Definitions.SHA2_256",
"Hacl.HMAC.compute_sha2_256",
"Hacl.HKDF.expand_st"
] | [] | false | false | false | true | false | let expand_sha2_256:expand_st SHA2_256 =
| mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256 | false |
Spec.SHA2.Lemmas.fst | Spec.SHA2.Lemmas.update_224_256 | val update_224_256: st:words_state SHA2_256 ->
block:bytes{Seq.length block = block_length SHA2_256} ->
Lemma
(ensures (Spec.Agile.Hash.(update SHA2_256 st block == update SHA2_224 st block))) | val update_224_256: st:words_state SHA2_256 ->
block:bytes{Seq.length block = block_length SHA2_256} ->
Lemma
(ensures (Spec.Agile.Hash.(update SHA2_256 st block == update SHA2_224 st block))) | let update_224_256 hash block =
assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma
(ensures (ws SHA2_224 b t == ws SHA2_256 b t))
[ SMTPat (ws SHA2_256 b t) ]
=
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
(*
* The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)
*
* This is a bit suboptimal, since assert_norm is a heavy hammer,
* it also ends up unfolding `==`, which means the equality is not
* reduced in F*, rather the query for proving equality of two
* lambda terms reaches Z3 -- once that happens we are at the mercy of
* hashconsing etc. to prove the equality
*
* Instead, if we do controlled normalization, we can prove the equality
* within F*
*)
let steps = [iota; primops; simplify; delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;
`%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;
`%__proj__Mkops__item__e4;
`%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;
`%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
// assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);
if t < block_word_length SHA2_256 then
()
else begin
ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2)
end
in
let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):
Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[ SMTPat (shuffle_core SHA2_256 block hash t) ]
=
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):
Lemma
(requires (forall x (i: nat { i < max }). {:pattern f x i \/ g x i } f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]
=
if min = max then
()
else
repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):
Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[ SMTPat (shuffle SHA2_256 hash block) ]
=
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a:Type) (#b:Type) (#c:Type)
(f g:(a -> b -> Tot c))
(s:S.seq a) (s':S.seq b{S.length s = S.length s'}):
Lemma
(requires (forall x y. {:pattern f x y \/ g x y} f x y == g x y))
(ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))
(decreases (S.length s))
[ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]
=
if S.length s = 0 then
()
else
seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update | {
"file_name": "specs/lemmas/Spec.SHA2.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 242,
"start_col": 0,
"start_line": 149
} | module Spec.SHA2.Lemmas
open Lib.IntTypes
module C = Spec.SHA2.Constants
module S = FStar.Seq
open Spec.Hash.Definitions
open Spec.SHA2
open Spec.Hash.Lemmas
friend Spec.SHA2
friend Spec.Agile.Hash
#set-options "--z3rlimit 25 --fuel 0 --ifuel 0"
(* Scheduling function *)
(* Recursive Version *)
let rec ws_aux (a:sha2_alg) (b:block_w a) (t:counter{t < size_k_w a}): Tot (word a) =
if t < block_word_length a then b.[t]
else
let t16 = ws_aux a b (t - 16) in
let t15 = ws_aux a b (t - 15) in
let t7 = ws_aux a b (t - 7) in
let t2 = ws_aux a b (t - 2) in
let s1 = _sigma1 a t2 in
let s0 = _sigma0 a t15 in
(s1 +. t7 +. s0 +. t16)
[@"opaque_to_smt"]
let ws = ws_aux
(* Core shuffling function *)
let shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =
(**) assert(7 <= S.length hash);
let a0 = hash.[0] in
let b0 = hash.[1] in
let c0 = hash.[2] in
let d0 = hash.[3] in
let e0 = hash.[4] in
let f0 = hash.[5] in
let g0 = hash.[6] in
let h0 = hash.[7] in
(**) assert(S.length (k0 a) = size_k_w a);
let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in
let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in
(**) assert(t < S.length (k0 a));
let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in
assert_norm (List.Tot.length l = 8);
S.seq_of_list l
[@"opaque_to_smt"]
let shuffle_core = shuffle_core_
(* Full shuffling function *)
let shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =
Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash
#push-options "--max_fuel 1 --max_ifuel 0"
val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->
Lemma (shuffle a hash block == shuffle_aux a hash block)
let shuffle_is_shuffle_pre a hash block =
let rec repeati_is_repeat_range #a (n:nat)
(f:a -> (i:nat{i < n}) -> Tot a)
(f': (i:nat{i < n}) -> a -> Tot a)
(i:nat{i <= n})
(acc0:a)
: Lemma
(requires forall x i. f x i == f' i x)
(ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)
= if i = 0 then (
Lib.LoopCombinators.eq_repeati0 n f' acc0
) else (
Spec.Loops.repeat_range_induction 0 i f acc0;
Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);
repeati_is_repeat_range n f f' (i-1) acc0
)
in
let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma
(ensures forall (j:nat{j < i}).
ws a block j ==
(Lib.LoopCombinators.repeati i
(ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0))).[j]
)
= if i = 0 then ()
else (
ws_is_ws_pre (i - 1);
Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)
(Seq.create (size_k_w a) (to_word a 0)) (i - 1);
let f = ws_pre_inner a block in
let acc0 = Seq.create (size_k_w a) (to_word a 0) in
assert (Lib.LoopCombinators.repeati i f acc0 ==
f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));
reveal_opaque (`%ws) ws
)
in
let ws = ws_pre a block in
let k = k0 a in
let shuffle_core_is_shuffle_core_pre
hash
(i:counter{i < size_k_w a})
: Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)
= ws_is_ws_pre (size_k_w a);
reveal_opaque (`%ws_pre) ws_pre;
reveal_opaque (`%shuffle_core) shuffle_core;
reveal_opaque (`%shuffle_core_pre) shuffle_core_pre
in
Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;
repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;
assert (shuffle_pre a hash block == shuffle_aux a hash block);
reveal_opaque (`%shuffle) shuffle
#pop-options
(* Compression function *)
let update_aux (a:sha2_alg) (hash:words_state a) (block:bytes{S.length block = block_length a}): Tot (words_state a) =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle_aux a hash block_w in
Lib.Sequence.map2 ( +. ) (hash <: Lib.Sequence.lseq (word a) (state_word_length a)) hash_1
val update_is_update_pre: a:sha2_alg -> hash:words_state a -> block:bytes{S.length block = block_length a} ->
Lemma (update a hash block == update_aux a hash block)
let update_is_update_pre a hash block =
let block_w = words_of_bytes a #(block_word_length a) block in
let hash_1 = shuffle a hash block_w in
shuffle_is_shuffle_pre a hash block_w;
let hash:Lib.Sequence.lseq (word a) (state_word_length a) = hash in
reveal_opaque (`%update) update;
let s1 = Lib.Sequence.map2 (+.) hash hash_1 in
let s2 = Spec.Loops.seq_map2 (+.) hash hash_1 in
assert (Seq.length s1 == Seq.length s2);
let aux (i:nat{i < Seq.length s1}) : Lemma (Seq.index s1 i == Seq.index s2 i)
=
// Need Lib.Sequence.index in the context for map2's postcondition to trigger
assert (Lib.Sequence.index s1 i == ( +. ) (Seq.index hash i) (Seq.index hash_1 i))
in Classical.forall_intro aux;
assert (s1 `Seq.equal` s2) | {
"checked_file": "/",
"dependencies": [
"Spec.SHA2.Constants.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.SHA2.fst.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA2.Lemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Spec.SHA2.Constants",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"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": 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": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
st: Spec.Hash.Definitions.words_state Spec.Hash.Definitions.SHA2_256 ->
block:
Spec.Hash.Definitions.bytes
{ FStar.Seq.Base.length block =
Spec.Hash.Definitions.block_length Spec.Hash.Definitions.SHA2_256 }
-> FStar.Pervasives.Lemma
(ensures
Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_256 st block ==
Spec.Agile.Hash.update Spec.Hash.Definitions.SHA2_224 st block) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.words_state",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Definitions.bytes",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"Spec.Hash.Definitions.block_length",
"FStar.Pervasives.reveal_opaque",
"Spec.Hash.Definitions.sha2_alg",
"Spec.Hash.Definitions.update_t",
"Spec.SHA2.update",
"Prims.unit",
"Spec.SHA2.block_w",
"Spec.SHA2.shuffle",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Spec.Hash.Definitions.word_length",
"Spec.Hash.Definitions.SHA2_224",
"Spec.Hash.Definitions.block_word_length",
"Spec.Hash.Definitions.word",
"Spec.Hash.Definitions.words_of_bytes",
"FStar.Seq.Base.seq",
"Prims.nat",
"Prims.l_Forall",
"Prims.squash",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Spec.Loops.seq_map2",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil",
"Prims.bool",
"FStar.Seq.Properties.tail",
"Prims.l_True",
"Lib.Sequence.seq",
"Spec.Hash.Definitions.state_word_length",
"Spec.SHA2.Lemmas.shuffle_is_shuffle_pre",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Spec.Loops.repeat_range",
"Prims.op_Addition",
"Spec.SHA2.counter",
"Spec.SHA2.size_k_w",
"Spec.SHA2.Lemmas.shuffle_core",
"Spec.SHA2.Lemmas.ws",
"FStar.Pervasives.norm_spec",
"Spec.SHA2._sigma1",
"Spec.SHA2._sigma0",
"Prims._assert",
"FStar.Pervasives.norm",
"Prims.list",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops",
"FStar.Pervasives.simplify",
"FStar.Pervasives.delta_only",
"Prims.string"
] | [] | false | false | true | false | false | let update_224_256 hash block =
| assert_norm (words_state SHA2_224 == words_state SHA2_256);
let rec ws_224_256 (b: block_w SHA2_256) (t: counter{t < size_k_w SHA2_256})
: Lemma (ensures (ws SHA2_224 b t == ws SHA2_256 b t)) [SMTPat (ws SHA2_256 b t)] =
reveal_opaque (`%ws) ws;
assert_norm (block_w SHA2_256 == block_w SHA2_224);
assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);
let steps =
[
iota;
primops;
simplify;
delta_only [
`%_sigma0; `%_sigma1; `%op0; `%word; `%word_t; `%__proj__Mkops__item__e5; `%op224_256;
`%__proj__Mkops__item__e3; `%__proj__Mkops__item__e4; `%Spec.SHA2.op_Hat_Dot;
`%Spec.SHA2.op_Greater_Greater_Dot; `%Spec.SHA2.op_Greater_Greater_Greater_Dot
]
]
in
assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));
assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));
norm_spec steps (_sigma0 SHA2_256);
norm_spec steps (_sigma0 SHA2_224);
norm_spec steps (_sigma1 SHA2_256);
norm_spec steps (_sigma1 SHA2_224);
if t < block_word_length SHA2_256
then ()
else
(ws_224_256 b (t - 16);
ws_224_256 b (t - 15);
ws_224_256 b (t - 7);
ws_224_256 b (t - 2))
in
let shuffle_core_224_256
(block: block_w SHA2_256)
(hash: words_state SHA2_256)
(t: counter{t < size_k_w SHA2_256})
: Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))
[SMTPat (shuffle_core SHA2_256 block hash t)] =
reveal_opaque (`%shuffle_core) shuffle_core
in
let rec repeat_range_f
(#a: Type)
(min: nat)
(max: nat{min <= max})
(f g: (a -> i: nat{i < max} -> Tot a))
(x: a)
: Lemma (requires (forall x (i: nat{i < max}). {:pattern f x i\/g x i} f x i == g x i))
(ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))
(decreases (max - min))
[SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x)] =
if min = max then () else repeat_range_f (min + 1) max f g (f x min)
in
let shuffle_224_256 (hash: words_state SHA2_256) (block: block_w SHA2_256)
: Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))
[SMTPat (shuffle SHA2_256 hash block)] =
shuffle_is_shuffle_pre SHA2_224 hash block;
shuffle_is_shuffle_pre SHA2_256 hash block;
reveal_opaque (`%shuffle) shuffle;
assert_norm (words_state SHA2_224 == words_state SHA2_256)
in
let rec seq_map2_f
(#a #b #c: Type)
(f g: (a -> b -> Tot c))
(s: S.seq a)
(s': S.seq b {S.length s = S.length s'})
: Lemma (requires (forall x y. {:pattern f x y\/g x y} f x y == g x y))
(ensures (let open Spec.Loops in seq_map2 f s s' == seq_map2 g s s'))
(decreases (S.length s))
[SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s')] =
if S.length s = 0 then () else seq_map2_f f g (S.tail s) (S.tail s')
in
assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) ==
words_of_bytes SHA2_224 #(block_word_length SHA2_224));
reveal_opaque (`%shuffle) shuffle;
reveal_opaque (`%update) update | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_13_15 | val va_quick_Loop_rounds_13_15 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ())) | val va_quick_Loop_rounds_13_15 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ())) | let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 980,
"start_col": 0,
"start_line": 977
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_13_15 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_13_15",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_13_15",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_13_15",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_13_15 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ())) =
| (va_QProc (va_code_Loop_rounds_13_15 ())
([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block)
(va_wpProof_Loop_rounds_13_15 block)) | false |
Hacl.HKDF.fst | Hacl.HKDF.extract_sha2_512 | val extract_sha2_512: extract_st SHA2_512 | val extract_sha2_512: extract_st SHA2_512 | let extract_sha2_512: extract_st SHA2_512 =
mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 187,
"start_col": 0,
"start_line": 186
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384
let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.extract_st Spec.Hash.Definitions.SHA2_512 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_extract",
"Spec.Hash.Definitions.SHA2_512",
"Hacl.HMAC.compute_sha2_512",
"Hacl.HKDF.extract_st"
] | [] | false | false | false | true | false | let extract_sha2_512:extract_st SHA2_512 =
| mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512 | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_b | val va_quick_Loop_rounds_16_59_b (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_b i)) | val va_quick_Loop_rounds_16_59_b (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_b i)) | let va_quick_Loop_rounds_16_59_b (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_b i)) =
(va_QProc (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) (va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 1091,
"start_col": 0,
"start_line": 1087
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block))
//--
//-- Loop_rounds_16_59_b
val va_code_Loop_rounds_16_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 == ws_opaque block
(i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 7 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6
va_sM (va_update_vec 5 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_b (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4))
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
12))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5))) /\ (forall
(va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 8
va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_b : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_b i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_16_59_b",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_59_b (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_b i)) =
| (va_QProc (va_code_Loop_rounds_16_59_b i)
([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block)) | false |
Hacl.HKDF.fst | Hacl.HKDF.extract_sha2_256 | val extract_sha2_256: extract_st SHA2_256 | val extract_sha2_256: extract_st SHA2_256 | let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 175,
"start_col": 0,
"start_line": 174
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.extract_st Spec.Hash.Definitions.SHA2_256 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_extract",
"Spec.Hash.Definitions.SHA2_256",
"Hacl.HMAC.compute_sha2_256",
"Hacl.HKDF.extract_st"
] | [] | false | false | false | true | false | let extract_sha2_256:extract_st SHA2_256 =
| mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256 | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.add | val add : a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly | let add = Vale.Math.Poly2_s.add | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 37,
"start_col": 0,
"start_line": 37
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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"
} | false | a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly | Prims.Tot | [
"total"
] | [] | [
"Vale.Math.Poly2_s.add"
] | [] | false | false | false | true | false | let add =
| Vale.Math.Poly2_s.add | false |
|
Hacl.HKDF.fst | Hacl.HKDF.expand_blake2s_32 | val expand_blake2s_32: expand_st Blake2S | val expand_blake2s_32: expand_st Blake2S | let expand_blake2s_32: expand_st Blake2S =
mk_expand Blake2S Hacl.HMAC.compute_blake2s_32 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 190,
"start_col": 0,
"start_line": 189
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384
let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512
let extract_sha2_512: extract_st SHA2_512 =
mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.expand_st Spec.Hash.Definitions.Blake2S | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_expand",
"Spec.Hash.Definitions.Blake2S",
"Hacl.HMAC.compute_blake2s_32",
"Hacl.HKDF.expand_st"
] | [] | false | false | false | true | false | let expand_blake2s_32:expand_st Blake2S =
| mk_expand Blake2S Hacl.HMAC.compute_blake2s_32 | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_9_11 | val va_quick_Loop_rounds_9_11 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) | val va_quick_Loop_rounds_9_11 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) | let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 937,
"start_col": 0,
"start_line": 935
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_9_11 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_9_11",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_9_11",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_9_11",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_9_11 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
| (va_QProc (va_code_Loop_rounds_9_11 ())
([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block)
(va_wpProof_Loop_rounds_9_11 block)) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_codegen_success_Load_two_lsb | val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool | val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool | let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 62,
"start_col": 0,
"start_line": 60
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_ZeroXmm",
"Vale.X64.InsVector.va_codegen_success_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Load_two_lsb dst =
| (va_pbool_and (va_codegen_success_ZeroXmm dst)
(va_pbool_and (va_codegen_success_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))
) | false |
Hacl.HKDF.fst | Hacl.HKDF.extract_sha2_384 | val extract_sha2_384: extract_st SHA2_384 | val extract_sha2_384: extract_st SHA2_384 | let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 181,
"start_col": 0,
"start_line": 180
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.extract_st Spec.Hash.Definitions.SHA2_384 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_extract",
"Spec.Hash.Definitions.SHA2_384",
"Hacl.HMAC.compute_sha2_384",
"Hacl.HKDF.extract_st"
] | [] | false | false | false | true | false | let extract_sha2_384:extract_st SHA2_384 =
| mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384 | false |
Hacl.HKDF.fst | Hacl.HKDF.expand_sha2_384 | val expand_sha2_384: expand_st SHA2_384 | val expand_sha2_384: expand_st SHA2_384 | let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 178,
"start_col": 0,
"start_line": 177
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.expand_st Spec.Hash.Definitions.SHA2_384 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_expand",
"Spec.Hash.Definitions.SHA2_384",
"Hacl.HMAC.compute_sha2_384",
"Hacl.HKDF.expand_st"
] | [] | false | false | false | true | false | let expand_sha2_384:expand_st SHA2_384 =
| mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384 | false |
Hacl.HKDF.fst | Hacl.HKDF.hmac_input_fits | val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a) | val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a) | let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> () | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 18,
"end_line": 56,
"start_col": 0,
"start_line": 34
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.Hash.Definitions.fixed_len_alg
-> FStar.Pervasives.Lemma
(ensures
Spec.Hash.Definitions.less_than_max_input_length (Prims.pow2 32 +
Spec.Hash.Definitions.block_length a)
a) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Hash.Definitions.fixed_len_alg",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Prims.pow2",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.MD5",
"FStar.Pervasives.Native.__proj__Some__item__v",
"Prims.pos",
"Spec.Hash.Definitions.max_input_length",
"Spec.Hash.Definitions.SHA1",
"Spec.Hash.Definitions.SHA2_224",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Hash.Definitions.SHA2_512",
"Spec.Hash.Definitions.Blake2S",
"Spec.Hash.Definitions.Blake2B",
"Prims.unit",
"FStar.Pervasives.allow_inversion"
] | [] | false | false | true | false | false | let hmac_input_fits a =
| allow_inversion fixed_len_alg;
match a with
| MD5 -> assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 -> assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 -> assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 -> assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 -> assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 -> assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S -> assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B -> assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> () | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_c | val va_quick_Loop_rounds_16_59_c (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_c i)) | val va_quick_Loop_rounds_16_59_c (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_c i)) | let va_quick_Loop_rounds_16_59_c (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_c i)) =
(va_QProc (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 12;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) (va_wp_Loop_rounds_16_59_c i block)
(va_wpProof_Loop_rounds_16_59_c i block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 1147,
"start_col": 0,
"start_line": 1143
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block))
//--
//-- Loop_rounds_16_59_b
val va_code_Loop_rounds_16_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 == ws_opaque block
(i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 7 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6
va_sM (va_update_vec 5 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_b (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4))
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
12))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5))) /\ (forall
(va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 8
va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_b : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_b i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_b (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_b i)) =
(va_QProc (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) (va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block))
//--
//-- Loop_rounds_16_59_c
val va_code_Loop_rounds_16_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6)) ((va_get_vec 3
va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 9 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12 va_s0).hi3 ==
ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 11)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10
va_sM (va_update_vec 9 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_c (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i))
((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
11))) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) (va_x_v12:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec
11 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_c : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_c i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k
((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_16_59_c",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_59_c (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_c i)) =
| (va_QProc (va_code_Loop_rounds_16_59_c i)
([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_16_59_c i block)
(va_wpProof_Loop_rounds_16_59_c i block)) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_code_Load_0xc2_msb | val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code | val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code | let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 99,
"start_col": 0,
"start_line": 97
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_ZeroXmm",
"Vale.X64.InsVector.va_code_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Load_0xc2_msb dst =
| (va_Block (va_CCons (va_code_ZeroXmm dst)
(va_CCons (va_code_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11))
(va_CNil ())))) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_code_Load_two_lsb | val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code | val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code | let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 57,
"start_col": 0,
"start_line": 55
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_ZeroXmm",
"Vale.X64.InsVector.va_code_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Load_two_lsb dst =
| (va_Block (va_CCons (va_code_ZeroXmm dst)
(va_CCons (va_code_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_code_Load_one_lsb | val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code | val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code | let va_code_Load_one_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 169,
"start_col": 0,
"start_line": 167
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\
va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Load_0xc2_msb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0
3254779904) == 13979173243358019584);
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904;
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11) in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (())))
val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Load_0xc2_msb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) =
(va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst))
//--
//-- Load_one_lsb | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_ZeroXmm",
"Vale.X64.InsVector.va_code_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Load_one_lsb dst =
| (va_Block (va_CCons (va_code_ZeroXmm dst)
(va_CCons (va_code_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_codegen_success_Handle_ctr32 | val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool | val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool | let va_codegen_success_Handle_ctr32 () =
(va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11))
(va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm
0)) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Load_two_lsb (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm
5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm
11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd
(va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and
(va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm
15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm
13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14)
(va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm
1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_ttrue ()))))))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 75,
"end_line": 251,
"start_col": 0,
"start_line": 231
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\
va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Load_0xc2_msb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0
3254779904) == 13979173243358019584);
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904;
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11) in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (())))
val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Load_0xc2_msb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) =
(va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst))
//--
//-- Load_one_lsb
[@ "opaque_to_smt"]
let va_code_Load_one_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_one_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_one_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_one_lsb) (va_code_Load_one_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 1 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 1 0) == 1);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 1 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_one_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Handle_ctr32
val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Handle_ctr32 () =
(va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons
(va_code_Load_one_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10)
(va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CNil
()))))))))))))))))))))
val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_InitPshufbMask",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.InsVector.va_codegen_success_VPshufb",
"Vale.AES.X64.AESopt.va_codegen_success_Load_one_lsb",
"Vale.X64.InsVector.va_codegen_success_VPaddd",
"Vale.AES.X64.AESopt.va_codegen_success_Load_two_lsb",
"Vale.X64.InsVector.va_codegen_success_VPxor",
"Vale.X64.Decls.va_op_opr128_xmm",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Handle_ctr32 () =
| (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11))
(va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10)
(va_op_xmm_xmm 6)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_Load_two_lsb (va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11)
(va_op_xmm_xmm 6)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12)
(va_op_xmm_xmm 10)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10)
(va_op_xmm_xmm 10)
(va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13)
(va_op_xmm_xmm 11)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 11)
(va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10)
(va_op_xmm_xmm 10)
(va_op_opr128_xmm 15))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14
)
(va_op_xmm_xmm 12)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm
12)
(va_op_xmm_xmm 12)
(va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm
11)
(va_op_xmm_xmm 11)
(va_op_opr128_xmm 15))
(va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm
1)
(va_op_xmm_xmm 13)
(va_op_xmm_xmm 5))
(va_pbool_and (va_codegen_success_VPshufb
(va_op_xmm_xmm 13)
(va_op_xmm_xmm 13)
(va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPshufb
(va_op_xmm_xmm 14)
(va_op_xmm_xmm 14)
(va_op_xmm_xmm 0))
(va_pbool_and (va_codegen_success_VPshufb
(va_op_xmm_xmm 1)
(va_op_xmm_xmm 1)
(va_op_xmm_xmm 0))
(va_ttrue ()))))))))))))))))
))) | false |
Hacl.HKDF.fst | Hacl.HKDF.extract_blake2s_32 | val extract_blake2s_32: extract_st Blake2S | val extract_blake2s_32: extract_st Blake2S | let extract_blake2s_32: extract_st Blake2S =
mk_extract Blake2S Hacl.HMAC.compute_blake2s_32 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 193,
"start_col": 0,
"start_line": 192
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384
let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512
let extract_sha2_512: extract_st SHA2_512 =
mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512
let expand_blake2s_32: expand_st Blake2S =
mk_expand Blake2S Hacl.HMAC.compute_blake2s_32 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.extract_st Spec.Hash.Definitions.Blake2S | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_extract",
"Spec.Hash.Definitions.Blake2S",
"Hacl.HMAC.compute_blake2s_32",
"Hacl.HKDF.extract_st"
] | [] | false | false | false | true | false | let extract_blake2s_32:extract_st Blake2S =
| mk_extract Blake2S Hacl.HMAC.compute_blake2s_32 | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_code_Handle_ctr32 | val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code | val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code | let va_code_Handle_ctr32 () =
(va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons
(va_code_Load_one_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10)
(va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons
(va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons
(va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CNil
())))))))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 227,
"start_col": 0,
"start_line": 209
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\
va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Load_0xc2_msb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0
3254779904) == 13979173243358019584);
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904;
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11) in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (())))
val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Load_0xc2_msb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) =
(va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst))
//--
//-- Load_one_lsb
[@ "opaque_to_smt"]
let va_code_Load_one_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_one_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_one_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_one_lsb) (va_code_Load_one_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 1 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 1 0) == 1);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 1 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_one_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Handle_ctr32
val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsVector.va_code_InitPshufbMask",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.InsVector.va_code_VPshufb",
"Vale.AES.X64.AESopt.va_code_Load_one_lsb",
"Vale.X64.InsVector.va_code_VPaddd",
"Vale.AES.X64.AESopt.va_code_Load_two_lsb",
"Vale.X64.InsVector.va_code_VPxor",
"Vale.X64.Decls.va_op_opr128_xmm",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Handle_ctr32 () =
| (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0))
(va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 5))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5))
(va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 11)
(va_op_xmm_xmm 6)
(va_op_xmm_xmm 5))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 12)
(va_op_xmm_xmm 10)
(va_op_xmm_xmm 5))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 10)
(va_op_xmm_xmm 10)
(va_op_xmm_xmm 0))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 13)
(va_op_xmm_xmm 11)
(va_op_xmm_xmm 5))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 11)
(va_op_xmm_xmm 0))
(va_CCons (va_code_VPxor (va_op_xmm_xmm 10)
(va_op_xmm_xmm 10)
(va_op_opr128_xmm 15))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 14)
(va_op_xmm_xmm 12)
(va_op_xmm_xmm 5))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm 12)
(va_op_xmm_xmm 12)
(va_op_xmm_xmm 0))
(va_CCons (va_code_VPxor (va_op_xmm_xmm 11)
(va_op_xmm_xmm 11)
(va_op_opr128_xmm 15))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm
1)
(va_op_xmm_xmm 13)
(va_op_xmm_xmm 5))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm
13)
(va_op_xmm_xmm 13)
(va_op_xmm_xmm 0))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm
14)
(va_op_xmm_xmm 14)
(va_op_xmm_xmm 0))
(va_CCons (va_code_VPshufb (va_op_xmm_xmm
1)
(va_op_xmm_xmm 1)
(va_op_xmm_xmm 0))
(va_CNil ())))))))))))))
))))))) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_wp_Load_0xc2_msb | val va_wp_Load_0xc2_msb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Load_0xc2_msb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 97,
"end_line": 140,
"start_col": 0,
"start_line": 135
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\
va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Load_0xc2_msb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0
3254779904) == 13979173243358019584);
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904;
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11) in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
dst: Vale.X64.Decls.va_operand_xmm ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.X64.Decls.va_is_dst_xmm",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.l_Forall",
"Vale.X64.Decls.va_value_xmm",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_eval_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_operand_xmm"
] | [] | false | false | false | true | true | let va_wp_Load_0xc2_msb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\
(forall (va_x_dst: va_value_xmm) (va_x_r11: nat64) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0))
in
va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==>
va_k va_sM (()))) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_codegen_success_Load_one_lsb | val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool | val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool | let va_codegen_success_Load_one_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 174,
"start_col": 0,
"start_line": 172
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool
[@ "opaque_to_smt"]
let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\
va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@"opaque_to_smt"]
let va_lemma_Load_0xc2_msb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0
3254779904) == 13979173243358019584);
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904;
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11) in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (())))
val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Load_0xc2_msb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) =
(va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst))
//--
//-- Load_one_lsb
[@ "opaque_to_smt"]
let va_code_Load_one_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_ZeroXmm",
"Vale.X64.InsVector.va_codegen_success_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Load_one_lsb dst =
| (va_pbool_and (va_codegen_success_ZeroXmm dst)
(va_pbool_and (va_codegen_success_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))
) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_d | val va_quick_Loop_rounds_16_59_d (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_d i)) | val va_quick_Loop_rounds_16_59_d (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_d i)) | let va_quick_Loop_rounds_16_59_d (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_d i)) =
(va_QProc (va_code_Loop_rounds_16_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 0]) (va_wp_Loop_rounds_16_59_d i block)
(va_wpProof_Loop_rounds_16_59_d i block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 1202,
"start_col": 0,
"start_line": 1198
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block))
//--
//-- Loop_rounds_16_59_b
val va_code_Loop_rounds_16_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 == ws_opaque block
(i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 7 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6
va_sM (va_update_vec 5 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_b (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4))
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
12))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5))) /\ (forall
(va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 8
va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_b : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_b i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_b (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_b i)) =
(va_QProc (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) (va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block))
//--
//-- Loop_rounds_16_59_c
val va_code_Loop_rounds_16_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6)) ((va_get_vec 3
va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 9 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12 va_s0).hi3 ==
ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 11)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10
va_sM (va_update_vec 9 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_c (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i))
((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
11))) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) (va_x_v12:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec
11 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_c : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_c i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_c (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_c i)) =
(va_QProc (va_code_Loop_rounds_16_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 12;
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9]) (va_wp_Loop_rounds_16_59_c i block)
(va_wpProof_Loop_rounds_16_59_c i block))
//--
//-- Loop_rounds_16_59_d
val va_code_Loop_rounds_16_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (i == 28) (i == 44) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 12)) ((va_get_vec 1 va_s0).hi3 ==
ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
4))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 1))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 13
va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
14))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 13)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 4)) ((va_get_vec 13
va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 3)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13
va_sM (va_update_vec 0 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_d (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (i == 28) (i == 44) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 12)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 6)))
((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 8 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 11
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block i))
((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 14))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 13))) /\ (forall
(va_x_v0:quad32) (va_x_v13:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 15
va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13 (va_upd_vec 0 va_x_v0 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 4))
((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 14 va_sM).hi3 == ws_opaque
block (i + 2))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 3)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_d : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_d i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_d i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 0]) va_s0 va_k
((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_d i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_d",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_16_59_d",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_59_d (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_d i)) =
| (va_QProc (va_code_Loop_rounds_16_59_d i)
([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 0])
(va_wp_Loop_rounds_16_59_d i block)
(va_wpProof_Loop_rounds_16_59_d i block)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_5_7 | val va_quick_Loop_rounds_5_7 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) | val va_quick_Loop_rounds_5_7 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) | let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 895,
"start_col": 0,
"start_line": 893
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_5_7 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_5_7",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_5_7",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_5_7",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_5_7 (block: block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
| (va_QProc (va_code_Loop_rounds_5_7 ())
([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block)
(va_wpProof_Loop_rounds_5_7 block)) | false |
Vale.AES.X64.AESopt.fst | Vale.AES.X64.AESopt.va_codegen_success_Load_0xc2_msb | val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool | val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool | let va_codegen_success_Load_0xc2_msb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 72,
"end_line": 105,
"start_col": 0,
"start_line": 103
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let add = Vale.Math.Poly2_s.add
#reset-options "--z3rlimit 30"
//-- finish_aes_encrypt_le
val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32)
-> Lemma
(requires (Vale.AES.AES_s.is_aes_key_LE alg key))
(ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg
input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)))
let finish_aes_encrypt_le alg input_LE key =
Vale.AES.AES_s.aes_encrypt_LE_reveal ();
Vale.AES.AES_s.eval_cipher_reveal ();
()
//--
//-- Load_two_lsb
[@ "opaque_to_smt"]
let va_code_Load_two_lsb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
[@ "opaque_to_smt"]
let va_codegen_success_Load_two_lsb dst =
(va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2
0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ())))
[@"opaque_to_smt"]
let va_lemma_Load_two_lsb va_b0 va_s0 dst =
va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in
let va_b3 = va_tl va_b1 in
Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0;
assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2);
let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11)
in
let va_b6 = va_tl va_b3 in
let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in
let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Load_two_lsb dst va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Load_0xc2_msb
val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code
[@ "opaque_to_smt"]
let va_code_Load_0xc2_msb dst =
(va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1
(va_op_reg_opr64_reg64 rR11)) (va_CNil ()))))
val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.AESopt.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"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
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsVector.va_codegen_success_ZeroXmm",
"Vale.X64.InsVector.va_codegen_success_PinsrqImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Load_0xc2_msb dst =
| (va_pbool_and (va_codegen_success_ZeroXmm dst)
(va_pbool_and (va_codegen_success_PinsrqImm dst
13979173243358019584
1
(va_op_reg_opr64_reg64 rR11))
(va_ttrue ()))) | false |
Hacl.HKDF.fst | Hacl.HKDF.expand_sha2_512 | val expand_sha2_512: expand_st SHA2_512 | val expand_sha2_512: expand_st SHA2_512 | let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 184,
"start_col": 0,
"start_line": 183
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.expand_st Spec.Hash.Definitions.SHA2_512 | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_expand",
"Spec.Hash.Definitions.SHA2_512",
"Hacl.HMAC.compute_sha2_512",
"Hacl.HKDF.expand_st"
] | [] | false | false | false | true | false | let expand_sha2_512:expand_st SHA2_512 =
| mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512 | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_0_59_d | val va_wp_Loop_rounds_0_59_d
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_0_59_d
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 10,
"end_line": 693,
"start_col": 0,
"start_line": 634
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_0_59_d
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
(i `op_Division` 4 + 1)
1
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)
((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2)))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\
(forall (va_x_r6: nat64) (va_x_v16: quad32) (va_x_v17: quad32) (va_x_v18: quad32)
(va_x_v19: quad32) (va_x_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(va_upd_vec 19
va_x_v19
(va_upd_vec 18
va_x_v18
(va_upd_vec 17
va_x_v17
(va_upd_vec 16 va_x_v16 (va_upd_reg 6 va_x_r6 va_s0)))
))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5)
)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==>
va_k va_sM (()))) | false |
Hacl.HKDF.fst | Hacl.HKDF.expand_blake2b_32 | val expand_blake2b_32: expand_st Blake2B | val expand_blake2b_32: expand_st Blake2B | let expand_blake2b_32: expand_st Blake2B =
mk_expand Blake2B Hacl.HMAC.compute_blake2b_32 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 196,
"start_col": 0,
"start_line": 195
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384
let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512
let extract_sha2_512: extract_st SHA2_512 =
mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512
let expand_blake2s_32: expand_st Blake2S =
mk_expand Blake2S Hacl.HMAC.compute_blake2s_32
let extract_blake2s_32: extract_st Blake2S =
mk_extract Blake2S Hacl.HMAC.compute_blake2s_32 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.expand_st Spec.Hash.Definitions.Blake2B | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_expand",
"Spec.Hash.Definitions.Blake2B",
"Hacl.HMAC.compute_blake2b_32",
"Hacl.HKDF.expand_st"
] | [] | false | false | false | true | false | let expand_blake2b_32:expand_st Blake2B =
| mk_expand Blake2B Hacl.HMAC.compute_blake2b_32 | false |
Hacl.HKDF.fst | Hacl.HKDF.extract_blake2b_32 | val extract_blake2b_32: extract_st Blake2B | val extract_blake2b_32: extract_st Blake2B | let extract_blake2b_32: extract_st Blake2B =
mk_extract Blake2B Hacl.HMAC.compute_blake2b_32 | {
"file_name": "code/hkdf/Hacl.HKDF.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 199,
"start_col": 0,
"start_line": 198
} | module Hacl.HKDF
open FStar.Seq
module B = Lib.Buffer
module LB = LowStar.Buffer
open Spec.Hash.Definitions
open Spec.Agile.HKDF
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.Buffer
friend Spec.Agile.HKDF
friend Lib.IntTypes
module Seq = Lib.Sequence
// TODO: proofs break mysteriously when not befriending Lib.IntTypes and
// declassifying uint8; investigate
// assume val declassify8: squash (uint8 == UInt8.t)
module ST = FStar.HyperStack.ST
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
let mk_extract a hmac prk salt saltlen ikm ikmlen =
hmac prk salt saltlen ikm ikmlen
val hmac_input_fits: a:fixed_len_alg -> Lemma
((pow2 32 + block_length a) `less_than_max_input_length` a)
let hmac_input_fits a =
allow_inversion fixed_len_alg;
match a with
| MD5 ->
assert_norm (pow2 32 + block_length MD5 <= Some?.v (max_input_length MD5))
| SHA1 ->
assert_norm (pow2 32 + block_length SHA1 <= Some?.v (max_input_length SHA1))
| SHA2_224 ->
assert_norm (pow2 32 + block_length SHA2_224 <= Some?.v (max_input_length SHA2_224))
| SHA2_256 ->
assert_norm (pow2 32 + block_length SHA2_256 <= Some?.v (max_input_length SHA2_256))
| SHA2_384 ->
assert_norm (pow2 32 + block_length SHA2_384 <= Some?.v (max_input_length SHA2_384))
| SHA2_512 ->
assert_norm (pow2 32 + block_length SHA2_512 <= Some?.v (max_input_length SHA2_512))
| Blake2S ->
assert_norm (pow2 32 + block_length Blake2S <= Some?.v (max_input_length Blake2S))
| Blake2B ->
assert_norm (pow2 32 + block_length Blake2B <= Some?.v (max_input_length Blake2B))
| SHA3_224 -> ()
| SHA3_256 -> ()
| SHA3_384 -> ()
| SHA3_512 -> ()
#push-options "--z3rlimit 300"
let mk_expand a hmac okm prk prklen info infolen len =
let tlen = Hash.Definitions.hash_len a in
let n = len /. tlen in
Math.Lemmas.lemma_div_mod (v len) (v tlen);
hmac_input_fits a;
[@inline_let]
let okm: B.lbuffer uint8 len = okm in
[@inline_let]
let prk: B.lbuffer uint8 prklen = prk in
[@inline_let]
let info: B.lbuffer uint8 infolen = info in
let output: B.lbuffer uint8 (n *! tlen) = B.sub okm 0ul (n *! tlen) in
push_frame ();
let text = B.create (tlen +! infolen +! 1ul) (u8 0) in
let text0: B.lbuffer uint8 (infolen +! 1ul) = B.sub text tlen (infolen +! 1ul) in
let tag = B.sub text 0ul tlen in
let ctr = B.sub text (tlen +! infolen) 1ul in
B.copy (B.sub text tlen infolen) info;
[@inline_let]
let a_spec = a_spec a in
[@inline_let]
let refl h (i:size_nat{i <= v n}) : GTot (a_spec i) =
if i = 0 then FStar.Seq.empty #uint8 else B.as_seq h tag
in
[@inline_let]
let footprint (i:size_nat{i <= v n}) :
GTot LB.(l:loc{loc_disjoint l (B.loc output) /\
address_liveness_insensitive_locs `loc_includes` l}) =
LB.loc_union (B.loc tag) (B.loc ctr)
in
[@inline_let]
let spec h0 : GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1) & Seq.lseq uint8 (v tlen)) =
expand_loop a (B.as_seq h0 prk) (B.as_seq h0 info) (v n)
in
let h0 = ST.get () in
B.fill_blocks h0 tlen n output a_spec refl footprint spec (fun i ->
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (i +! 1ul);
let h1 = ST.get() in
if i = 0ul then
begin
Seq.eq_intro
(B.as_seq h1 text0)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (FStar.Seq.empty @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 0 (FStar.Seq.empty #uint8) in B.as_seq h2 tag == t)
end
else
begin
Seq.eq_intro
(B.as_seq h1 text)
(refl h1 (v i) @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
// let h2 = ST.get() in
// assert (B.as_seq h2 tag ==
// Spec.Agile.HMAC.hmac a (B.as_seq h0 prk)
// (B.as_seq h1 tag @| B.as_seq h0 info @| Seq.create 1 (u8 (v i + 1))));
// assert (let _, t = spec h0 (v i) (B.as_seq h tag) in B.as_seq h2 tag == t)
end;
Seq.unfold_generate_blocks
(v tlen) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8) (v i);
//assert (v (i *! tlen) + v tlen <= v (n *! tlen));
B.copy (B.sub output (i *! tlen) tlen) tag
// let h3 = ST.get() in
// assert (
// footprint (v i + 1) `LB.loc_includes` footprint (v i) /\
// LB.modifies (LB.loc_union (footprint (v i + 1)) (B.loc block)) h h3);
//assert (
// let s, b = spec h0 (v i) (refl h (v i)) in
// refl h3 (v i + 1) == s /\ as_seq h3 block == b)
);
let h1 = ST.get () in
if n *! tlen <. len then
begin
ctr.(0ul) <- Lib.IntTypes.cast U8 PUB (n +! 1ul);
let h2 = ST.get() in
if n = 0ul then
begin
Seq.eq_intro
(B.as_seq h2 text0)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text0 (infolen +! 1ul)
end
else
begin
Seq.eq_intro
(B.as_seq h2 text)
(refl h1 (v n) @| B.as_seq h0 info @| Seq.create 1 (u8 (v n + 1)));
hmac tag prk prklen text (tlen +! infolen +! 1ul)
end;
let block = B.sub okm (n *! tlen) (len -! (n *! tlen)) in
B.copy block (B.sub tag 0ul (len -! (n *! tlen)))
end;
let h4 = ST.get() in
assert (
let tag', output' =
Seq.generate_blocks (v tlen) (v n) (v n) a_spec (spec h0) (FStar.Seq.empty #uint8)
in
Seq.equal
(B.as_seq h4 okm)
(output' @| Seq.sub (B.as_seq h4 tag) 0 (v len - v n * v tlen)));
pop_frame ()
let expand_sha2_256: expand_st SHA2_256 =
mk_expand SHA2_256 Hacl.HMAC.compute_sha2_256
let extract_sha2_256: extract_st SHA2_256 =
mk_extract SHA2_256 Hacl.HMAC.compute_sha2_256
let expand_sha2_384: expand_st SHA2_384 =
mk_expand SHA2_384 Hacl.HMAC.compute_sha2_384
let extract_sha2_384: extract_st SHA2_384 =
mk_extract SHA2_384 Hacl.HMAC.compute_sha2_384
let expand_sha2_512: expand_st SHA2_512 =
mk_expand SHA2_512 Hacl.HMAC.compute_sha2_512
let extract_sha2_512: extract_st SHA2_512 =
mk_extract SHA2_512 Hacl.HMAC.compute_sha2_512
let expand_blake2s_32: expand_st Blake2S =
mk_expand Blake2S Hacl.HMAC.compute_blake2s_32
let extract_blake2s_32: extract_st Blake2S =
mk_extract Blake2S Hacl.HMAC.compute_blake2s_32
let expand_blake2b_32: expand_st Blake2B =
mk_expand Blake2B Hacl.HMAC.compute_blake2b_32 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"Spec.Agile.HKDF.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fst.checked",
"Lib.Buffer.fsti.checked",
"Hacl.HMAC.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.HKDF.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "LB"
},
{
"abbrev": true,
"full_module": "Lib.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"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": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.HKDF.extract_st Spec.Hash.Definitions.Blake2B | Prims.Tot | [
"total"
] | [] | [
"Hacl.HKDF.mk_extract",
"Spec.Hash.Definitions.Blake2B",
"Hacl.HMAC.compute_blake2b_32",
"Hacl.HKDF.extract_st"
] | [] | false | false | false | true | false | let extract_blake2b_32:extract_st Blake2B =
| mk_extract Blake2B Hacl.HMAC.compute_blake2b_32 | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_a | val va_quick_Loop_rounds_16_59_a (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_a i)) | val va_quick_Loop_rounds_16_59_a (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_a i)) | let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 1036,
"start_col": 0,
"start_line": 1032
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> block: Vale.SHA.PPC64LE.SHA_helpers.block_w
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_wpProof_Loop_rounds_16_59_a",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_59_a (i: nat) (block: block_w)
: (va_quickCode unit (va_code_Loop_rounds_16_59_a i)) =
| (va_QProc (va_code_Loop_rounds_16_59_a i)
([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block)) | false |
Vale.SHA.PPC64LE.Rounds.Core.fsti | Vale.SHA.PPC64LE.Rounds.Core.va_wp_Loop_rounds_16_59_c | val va_wp_Loop_rounds_16_59_c
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_16_59_c
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_16_59_c (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 4))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7
va_s0).hi3 == ws_opaque block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i))
((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
11))) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) (va_x_v12:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec
11 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
4)) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 1133,
"start_col": 0,
"start_line": 1117
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
val va_code_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_3_7_11_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> in_b:buffer128 -> offset:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_3_7_11_body i msg) va_s0 /\
va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) /\ va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr msg va_sM va_s0)))))
[@ va_qattr]
let va_wp_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg va_s0 /\ va_get_ok va_s0 /\ (l_and (l_and (0 <= i) (i < 15)) (i
`op_Modulus` 4 == 3) /\ msg == i + 1 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b offset 1 (va_get_mem_layout va_s0)
Secret /\ va_get_reg 4 va_s0 + 16 < pow2_64) /\ (forall (va_x_msg:va_value_vec_opr)
(va_x_r4:nat64) . let va_sM = va_upd_reg 4 va_x_r4 (va_upd_operand_vec_opr msg va_x_msg va_s0)
in va_get_ok va_sM /\ (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM)) /\ va_get_reg 4
va_sM == va_get_reg 4 va_s0 + 16) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_3_7_11_body : i:nat -> msg:va_operand_vec_opr -> in_b:buffer128 ->
offset:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_3_7_11_body i msg)
([va_Mod_reg 4; va_mod_vec_opr msg]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_3_7_11_body (i:nat) (msg:va_operand_vec_opr) (in_b:buffer128) (offset:nat)
: (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(va_QProc (va_code_Loop_rounds_3_7_11_body i msg) ([va_Mod_reg 4; va_mod_vec_opr msg])
(va_wp_Loop_rounds_3_7_11_body i msg in_b offset) (va_wpProof_Loop_rounds_3_7_11_body i msg
in_b offset))
//--
//-- Loop_rounds_16_63_body
val va_code_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr ->
msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_code
val va_codegen_success_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> Tot va_pbool
val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->
msg3:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque
block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32
(ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\ (va_eval_vec_opr va_sM
msg0).hi3 == ws_opaque block i) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25
va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_is_src_vec_opr msg2 va_s0 /\
va_is_src_vec_opr msg3 va_s0 /\ va_get_ok va_s0 /\ (l_and (16 <= i) (i < 64) /\ (let j = i
`op_Modulus` 16 in msg0 == j /\ msg1 == (j + 1) `op_Modulus` 16 /\ msg2 == (j + 9) `op_Modulus`
16 /\ msg3 == (j + 14) `op_Modulus` 16 /\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block
(i - 16) /\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\ (va_eval_vec_opr
va_s0 msg2).hi3 == ws_opaque block (i - 7) /\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque
block (i - 2))) /\ (forall (va_x_msg0:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32) .
let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr msg0
va_x_msg0 va_s0)) in va_get_ok va_sM /\ (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15))
in let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 ==
add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block
(i - 7)) /\ (va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_63_body : i:nat -> msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr
-> msg2:va_operand_vec_opr -> msg3:va_operand_vec_opr -> block:block_w -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_63_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(msg2:va_operand_vec_opr) (msg3:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(va_QProc (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) ([va_Mod_vec 26; va_Mod_vec 25;
va_mod_vec_opr msg0]) (va_wp_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block)
(va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block))
//--
//-- Loop_rounds_0_59_a
val va_code_Loop_rounds_0_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_a : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_a (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(va_QProc (va_code_Loop_rounds_0_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_a i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_b
val va_code_Loop_rounds_0_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_b : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_b (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(va_QProc (va_code_Loop_rounds_0_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_b i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_c
val va_code_Loop_rounds_0_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6
va_s0 + 16 < pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks
= Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_c : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_c (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(va_QProc (va_code_Loop_rounds_0_59_c i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_c i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig))
//--
//-- Loop_rounds_0_59_d
val va_code_Loop_rounds_0_59_d : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_0_59_d : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19
va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6
va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 <
pow2_64 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6
va_s0) k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3)))) /\ (forall (va_x_r6:nat64)
(va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16
va_x_v16 (va_upd_reg 6 va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM ==
va_get_reg 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0
va_sM) k_b in (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) ==> va_k va_sM
(())))
val va_wpProof_Loop_rounds_0_59_d : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_59_d i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_59_d (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(va_QProc (va_code_Loop_rounds_0_59_d i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_0_59_d i k_b block hash_orig)
(va_wpProof_Loop_rounds_0_59_d i k_b block hash_orig))
//--
//-- Loop_rounds_60_63_b
val va_code_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_60_63_b : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_60_63_b : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_60_63_b ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 60 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 60))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
60) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 61))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 62)) ((va_get_vec 15
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 63) /\ l_and (l_and ((va_get_vec 24
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 61) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 62)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 63))) /\ (forall (va_x_r6:nat64) (va_x_v16:quad32)
(va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (va_upd_vec 19
va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_reg 6
va_x_r6 va_s0))))))))))) in va_get_ok va_sM /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_60_63_b : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_60_63_b k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_60_63_b (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_60_63_b ())) =
(va_QProc (va_code_Loop_rounds_60_63_b ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;
va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6]) (va_wp_Loop_rounds_60_63_b k_b block hash_orig)
(va_wpProof_Loop_rounds_60_63_b k_b block hash_orig))
//--
//-- Loop_rounds_1_3
val va_code_Loop_rounds_1_3 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_1_3 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_1_3 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_3 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 0 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 0 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)
((va_get_vec 2 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ va_state_eq va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_1_3 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 0 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 0 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 0 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v3:quad32) . let va_sM = va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1) ((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_3 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_3 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_3 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_3 ())) =
(va_QProc (va_code_Loop_rounds_1_3 ()) ([va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1])
(va_wp_Loop_rounds_1_3 block) (va_wpProof_Loop_rounds_1_3 block))
//--
//-- Loop_rounds_5_7
val va_code_Loop_rounds_5_7 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_5_7 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_5_7 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_5_7 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 4 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 4 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 5 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)
((va_get_vec 6 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ va_state_eq va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_5_7 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 4 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 4 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 4 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) /\ (forall (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5
va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_5_7 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_5_7 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7;
va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_5_7 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_5_7 ())) =
(va_QProc (va_code_Loop_rounds_5_7 ()) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5])
(va_wp_Loop_rounds_5_7 block) (va_wpProof_Loop_rounds_5_7 block))
//--
//-- Loop_rounds_9_11
val va_code_Loop_rounds_9_11 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_9_11 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_9_11 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_9_11 ()) va_s0 /\ va_get_ok va_s0 /\ l_and
(l_and ((va_get_vec 8 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 8 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 9 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)
((va_get_vec 10 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ va_state_eq va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_9_11 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 8 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 8 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 8 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) /\ (forall (va_x_v9:quad32) (va_x_v10:quad32)
(va_x_v11:quad32) . let va_sM = va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9
va_x_v9 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_9_11 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_9_11 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11;
va_Mod_vec 10; va_Mod_vec 9]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_9_11 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_9_11 ())) =
(va_QProc (va_code_Loop_rounds_9_11 ()) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9])
(va_wp_Loop_rounds_9_11 block) (va_wpProof_Loop_rounds_9_11 block))
//--
//-- Loop_rounds_13_15
val va_code_Loop_rounds_13_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_13_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_13_15 : va_b0:va_code -> va_s0:va_state -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_13_15 ()) va_s0 /\ va_get_ok va_s0 /\
l_and (l_and ((va_get_vec 12 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 12 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12
va_s0).lo0 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and ((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ va_state_eq va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_ok va_sM
va_s0))))))
[@ va_qattr]
let va_wp_Loop_rounds_13_15 (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ l_and (l_and ((va_get_vec 12 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 12 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 12 va_s0).lo0 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ (forall (va_x_v13:quad32) (va_x_v14:quad32)
(va_x_v15:quad32) . let va_sM = va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13
va_x_v13 va_s0)) in va_get_ok va_sM /\ l_and (l_and ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_13_15 : block:block_w -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_13_15 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_13_15 (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_13_15 ()))
=
(va_QProc (va_code_Loop_rounds_13_15 ()) ([va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13])
(va_wp_Loop_rounds_13_15 block) (va_wpProof_Loop_rounds_13_15 block))
//--
//-- Loop_rounds_16_59_a
val va_code_Loop_rounds_16_59_a : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_a : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3
== ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque
block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 10
va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque
block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 1)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 2
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2
va_sM (va_update_vec 1 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_a (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 16) (i == 32)) (i == 48) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block i)
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque
block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 4
va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 == ws_opaque block (i -
11))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 ==
ws_opaque block (i - 5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec
13 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i -
1))) /\ (forall (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32)
(va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25
va_x_v25 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1
va_x_v1 va_s0))))) in va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 1 va_sM).hi3 ==
ws_opaque block (i + 1)) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3
va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))
==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_a : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_a i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_a (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_a i)) =
(va_QProc (va_code_Loop_rounds_16_59_a i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1]) (va_wp_Loop_rounds_16_59_a i block)
(va_wpProof_Loop_rounds_16_59_a i block))
//--
//-- Loop_rounds_16_59_b
val va_code_Loop_rounds_16_59_b : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_b : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4)) ((va_get_vec 1
va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 == ws_opaque block
(i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 7 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i -
6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6
va_sM (va_update_vec 5 va_sM (va_update_ok va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_59_b (i:nat) (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (l_or (i == 20) (i == 36)) (i == 52) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == ws_opaque block (i - 4))
((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 3 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
12))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 14 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 15 va_s0).hi3 == ws_opaque block (i - 5))) /\ (forall
(va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 8
va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 va_s0))))) in
va_get_ok va_sM /\ l_and (l_and (l_and ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 4)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_59_b : i:nat -> block:block_w -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_59_b i block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec
26; va_Mod_vec 25; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_59_b (i:nat) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_59_b i)) =
(va_QProc (va_code_Loop_rounds_16_59_b i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5]) (va_wp_Loop_rounds_16_59_b i block)
(va_wpProof_Loop_rounds_16_59_b i block))
//--
//-- Loop_rounds_16_59_c
val va_code_Loop_rounds_16_59_c : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_59_c : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 24) (i == 40)) (i == 56) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 6)) ((va_get_vec 3
va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3))) ((va_get_vec 7 va_s0).hi3 == ws_opaque
block (i - 1))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block i)) ((va_get_vec 9 va_s0).hi3 ==
ws_opaque block (i - 15))) ((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13))) ((va_get_vec 12 va_s0).hi3 ==
ws_opaque block (i - 12))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 11)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 1)) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 4)) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10
va_sM (va_update_vec 9 va_sM (va_update_ok va_sM va_s0))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.Core.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"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
}
] | {
"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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_or",
"Prims.eq2",
"Prims.int",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Prims.op_Subtraction",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Prims.op_Addition",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_16_59_c
(i: nat)
(block: block_w)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(l_or (l_or (i == 24) (i == 40)) (i == 56) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 2 va_s0).hi3 ==
ws_opaque block (i - 6))
((va_get_vec 3 va_s0).hi3 == ws_opaque block (i - 5)))
((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 4)))
((va_get_vec 5 va_s0).hi3 == ws_opaque block (i - 3)))
((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 1)))
((va_get_vec 8 va_s0).hi3 == ws_opaque block i))
((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 15)))
((va_get_vec 10 va_s0).hi3 == ws_opaque block (i - 14)))
((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 13)))
((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 12)))
((va_get_vec 13 va_s0).hi3 == ws_opaque block (i - 11))) /\
(forall (va_x_v9: quad32)
(va_x_v10: quad32)
(va_x_v11: quad32)
(va_x_v12: quad32)
(va_x_v25: quad32)
(va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 12
va_x_v12
(va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 va_s0)))))
in
va_get_ok va_sM /\
l_and (l_and (l_and ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 1))
((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 3)))
((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 4)) ==>
va_k va_sM (()))) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.