Admitted.
Definition setkey_enc_loop_body :=
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd (Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 0) tint) (tptr tuint)) tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd (Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 7) tint) (tptr tuint))
tuint))
(Ssequence
(Sset _rcon
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_RCON (tarray tuint 10)) (Etempvar _i tuint)
(tptr tuint)) tuint))
(Ssequence
(Sset _b0__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb (tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr (Etempvar _rk7 tuint)
(Econst_int (Int.repr 8) tint) tuint)
(Econst_int (Int.repr 255) tint) tuint)
(tptr tuchar)) tuchar) tuint))
(Ssequence
(Sset _b1__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb (tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr (Etempvar _rk7 tuint)
(Econst_int (Int.repr 16) tint)
tuint)
(Econst_int (Int.repr 255) tint) tuint)
(tptr tuchar)) tuchar) tuint))
(Ssequence
(Sset _b2__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb (tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr (Etempvar _rk7 tuint)
(Econst_int (Int.repr 24) tint)
tuint)
(Econst_int (Int.repr 255) tint)
tuint) (tptr tuchar)) tuchar) tuint))
(Ssequence
(Sset _b3__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb (tarray tuchar 256))
(Ebinop Oand (Etempvar _rk7 tuint)
(Econst_int (Int.repr 255) tint)
tuint) (tptr tuchar)) tuchar)
tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 8) tint)
(tptr tuint)) tuint)
(Ebinop Oxor
(Ebinop Oxor
(Ebinop Oxor
(Ebinop Oxor
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rcon tuint) tuint)
(Etempvar _b0__1 tuint) tuint)
(Ebinop Oshl
(Etempvar _b1__1 tuint)
(Econst_int (Int.repr 8) tint)
tuint) tuint)
(Ebinop Oshl (Etempvar _b2__1 tuint)
(Econst_int (Int.repr 16) tint)
tuint) tuint)
(Ebinop Oshl (Etempvar _b3__1 tuint)
(Econst_int (Int.repr 24) tint)
tuint) tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 1) tint)
(tptr tuint)) tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 8) tint)
(tptr tuint)) tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 9) tint)
(tptr tuint)) tuint)
(Ebinop Oxor (Etempvar _rk0 tuint)
(Etempvar _rk7 tuint) tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 2) tint)
(tptr tuint)) tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 9) tint)
(tptr tuint)) tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 10) tint)
(tptr tuint)) tuint)
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rk7 tuint)
tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 3) tint)
(tptr tuint)) tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 10) tint)
(tptr tuint)) tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 11) tint)
(tptr tuint))
tuint)
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rk7 tuint)
tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 4) tint)
(tptr tuint))
tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 11) tint)
(tptr tuint))
tuint))
(Ssequence
(Sset _b0__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb
(tarray tuchar 256))
(Ebinop Oand
(Etempvar _rk7 tuint)
(Econst_int (Int.repr 255) tint)
tuint)
(tptr tuchar))
tuchar)
tuint))
(Ssequence
(Sset _b1__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb
(tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr
(Etempvar _rk7 tuint)
(Econst_int (Int.repr 8) tint)
tuint)
(Econst_int (Int.repr 255) tint)
tuint)
(tptr tuchar))
tuchar)
tuint))
(Ssequence
(Sset _b2__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb
(tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr
(Etempvar _rk7 tuint)
(Econst_int (Int.repr 16) tint)
tuint)
(Econst_int (Int.repr 255) tint)
tuint)
(tptr tuchar))
tuchar)
tuint))
(Ssequence
(Sset _b3__1
(Ecast
(Ederef
(Ebinop Oadd
(Efield
(Evar _tables (Tstruct _aes_tables_struct noattr))
_FSb
(tarray tuchar 256))
(Ebinop Oand
(Ebinop Oshr
(Etempvar _rk7 tuint)
(Econst_int (Int.repr 24) tint)
tuint)
(Econst_int (Int.repr 255) tint)
tuint)
(tptr tuchar))
tuchar)
tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 12) tint)
(tptr tuint))
tuint)
(Ebinop Oxor
(Ebinop Oxor
(Ebinop Oxor
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _b0__1 tuint)
tuint)
(Ebinop Oshl
(Etempvar _b1__1 tuint)
(Econst_int (Int.repr 8) tint)
tuint)
tuint)
(Ebinop Oshl
(Etempvar _b2__1 tuint)
(Econst_int (Int.repr 16) tint)
tuint)
tuint)
(Ebinop Oshl
(Etempvar _b3__1 tuint)
(Econst_int (Int.repr 24) tint)
tuint)
tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 5) tint)
(tptr tuint))
tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 12) tint)
(tptr tuint))
tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 13) tint)
(tptr tuint))
tuint)
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rk7 tuint)
tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 6) tint)
(tptr tuint))
tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 13) tint)
(tptr tuint))
tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 14) tint)
(tptr tuint))
tuint)
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rk7 tuint)
tuint))
(Ssequence
(Sset _rk0
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 7) tint)
(tptr tuint))
tuint))
(Ssequence
(Sset _rk7
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 14) tint)
(tptr tuint))
tuint))
(Ssequence
(Sassign
(Ederef
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 15) tint)
(tptr tuint))
tuint)
(Ebinop Oxor
(Etempvar _rk0 tuint)
(Etempvar _rk7 tuint)
tuint))
(Sset _RK
(Ebinop Oadd
(Etempvar _RK (tptr tuint))
(Econst_int (Int.repr 8) tint)
(tptr tuint)))))))))))))))))))))))))))))))))))).

Lemma setkey_enc_loop_body_lemma:
forall
(Espec : OracleKind) (ctx key : val) (ctx_sh key_sh : share)
(key_chars : list Z) (init_done : Z) (ish : share) (gv: globals)
(SH : writable_share ctx_sh) (SH0 : readable_share key_sh) (SH1 : readable_share ish)
(H : Zlength key_chars = 32) (H0 : init_done = 1) (i : Z)
(H1 : 0 <= i < 7),
semax (func_tycontext f_mbedtls_aes_setkey_enc Vprog Gprog [])
(PROP ( )
LOCAL (temp _i (Vint (Int.repr i));
temp _RK
(offset_val (i * 32) (field_address t_struct_aesctx [StructField _buf] ctx));
gvars gv)
SEP (field_at ctx_sh t_struct_aesctx [StructField _nr] (Vint (Int.repr 14)) ctx;
field_at ctx_sh t_struct_aesctx [StructField _rk]
(field_address t_struct_aesctx [StructField _buf] ctx) ctx;
field_at ctx_sh t_struct_aesctx [StructField _buf]
(map Vint
(pow_fun GrowKeyByOne (Z.to_nat (i * 8)) (key_bytes_to_key_words key_chars)) ++
repeat_op_table (60 - i * 8) Vundef id) ctx;
data_at key_sh (tarray tuchar (4 * 8)) (map Vint (map Int.repr key_chars)) key;
data_at ish tint (Vint (Int.repr init_done)) (gv _aes_init_done);
tables_initialized (gv _tables)))
setkey_enc_loop_body
(normal_ret_assert
(PROP ()
LOCAL (temp _i (Vint (Int.repr i));
temp _RK
(offset_val ((i + 1) * 32)
(field_address t_struct_aesctx [StructField _buf] ctx));
gvars gv)
SEP (field_at ctx_sh t_struct_aesctx [StructField _nr]
(Vint (Int.repr 14)) ctx;
field_at ctx_sh t_struct_aesctx [StructField _rk]
(field_address t_struct_aesctx [StructField _buf] ctx) ctx;
field_at ctx_sh t_struct_aesctx [StructField _buf]
(map Vint
(pow_fun GrowKeyByOne (Z.to_nat ((i + 1) * 8))
(key_bytes_to_key_words key_chars)) ++
repeat_op_table (60 - (i + 1) * 8) Vundef id) ctx;
data_at key_sh (tarray tuchar (4 * 8)) (map Vint (map Int.repr key_chars))
key; data_at ish tint (Vint (Int.repr init_done)) (gv _aes_init_done);
tables_initialized (gv _tables)))).