Tls
include tls_picotls
module tls_lower_intf(cid,bytes) = {
action send(c:cid,data:bytes)
action recv(c:cid,data:bytes)
}
cid : the type of connection identifiers
bytes : the type of byte arrays
lower : the interface to the underlying transport
extens : the type of lists of extensions
exten_ser : serializer for extensions
module tls_intf(cid,index,bytes,lower,extens,hextens,exten_ser) = {
Transfers connection data to application
action recv(c:cid,data:bytes)
action send(c:cid,data:bytes)
action alert(c:cid,data:bytes)
action session_established(c:cid)
action key_material_export(c:cid,label:bytes,context:bytes,length:index)
returns (key:bytes)
action create(c:cid, is_server : bool, e : extens)
action destroy(c:cid)
specification {
relation open(C:cid)
relation established(C:cid)
after init {
open(C) := false;
established(C) := false;
}
around create {
require ~open(c);
...
open(c) := true;
}
around destroy {
require open(c);
...
open(c) := false;
established(c) := false;
}
before recv {
require open(c);
}
before send {
require open(c) & established(c);
}
before session_established {
require open(c) & ~established(c);
established(c) := true
}
before key_material_export {
require open(c) & established(c);
}
invariant established(C) -> open(C)
}
implementation {
instance impl : tls_gnutls(cid,index,bytes,extens,hextens,exten_ser,lower,this)
}
}