Check out the new USENIX Web site. next up previous
Next: Related Work Up: Formal Specification Previous: Annotations

STP

 
process STP[self : 0..MAXUID]

constant

MAXUID,

MAXTID,

MAXSEQ,

MAXCERT,

MAXSIGN,

MAXHASH,

MAXKEY

input

self_cert : array [0..MAXUID] of 0..MAXCERT

function

Sign(0..MAXKEY, integer) returns 0..MAXSIGN,

Verify(0..MAXKEY, integer) returns 0..MAXSIGN,

Hash(integer) returns 0..MAXHASH,

Unique(0..MAXTID) returns boolean,

Id(0..MAXCERT) returns 0..MAXUID,

Key(0..MAXCERT) returns 0..MAXKEY,

SelfKey(0..MAXCERT) returns 0..MAXKEY

variable

msgtype : set {T-start, T-accept, T-data, T-token, T-commit, T-abort, T-fault},

state : set {null, sending, receiving, ready, committed, aborted},

t_state : array [0..MAXTID] of state init null,

t_other : array [0..MAXTID] of 0..MAXUID,

t_key : array [0..MAXTID] of 0..MAXKEY,

t_data : array [0..MAXTID, 0..MAXSEQ] of integer,

t_seq : array [0..MAXTID] of 0..MAXSEQ,

t_context : array [0..MAXTID] of 0..MAXHASH,

cert : 0..MAXCERT,

data : integer,

sign : 0..MAXSIGN,

context : 0..MAXHASH,

valid : boolean

parameter

tid : 0..MAXTID

begin

(t_state[tid] = null tex2html_wrap_inline869 Unique(tid)) tex2html_wrap_inline871 {Action 0}

t_other[tid] := any;

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-starttex2html_wrap_inline873tidtex2html_wrap_inline873t_other[tid]);

send T-start(tid, sign, cert) to t_other[tid];

tex2html_wrap_inline865 rcv T-start(tid, sign, cert) tex2html_wrap_inline871 {Action 1}

valid := (sign = Verify(Key(cert), T-starttex2html_wrap_inline873tidtex2html_wrap_inline873self) tex2html_wrap_inline869 t_state[tid] = null);

if true tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid) tex2html_wrap_inline887

t_state[tid], t_seq[tid], t_context[tid] := receiving, 0, 0;

t_other[tid], t_key[tid] := Id(cert), Key(cert);

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-accepttex2html_wrap_inline873tid);

send T-accept(tid, sign, cert) to t_other[tid];

fi

tex2html_wrap_inline865 rcv T-accept(tid, sign, cert) tex2html_wrap_inline871 {Action 2}

valid := (sign = Verify(Key(cert), T-accepttex2html_wrap_inline873tid) tex2html_wrap_inline869 t_state[tid] = null);

if (tex2html_wrap_inline903 valid tex2html_wrap_inline905 tex2html_wrap_inline903 (Id(cert) = t_other[tid])) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 Id(cert) = t_other[tid]) tex2html_wrap_inline887

t_state[tid], t_seq[tid], t_context[tid] := sending, 0, 0;

t_key[tid] := Key(cert);

fi

tex2html_wrap_inline865 (t_state[tid] = sending) tex2html_wrap_inline871 {Action 3}

cert := self_cert[t_other[tid]];

if true tex2html_wrap_inline887

data := any;

sign := Sign(SelfKey(cert), T-datatex2html_wrap_inline873tidtex2html_wrap_inline873datatex2html_wrap_inline873t_context[tid]);

send T-data(tid, data, t_context[tid], sign) to t_other[tid];

t_data[tid, t_seq[tid]] := data;

t_context[tid] := Hash(datatex2html_wrap_inline873t_context[tid]);

t_seq[tid] := t_seq[tid] + 1;

tex2html_wrap_inline865 true tex2html_wrap_inline887

sign := Sign(SelfKey(cert), T-tokentex2html_wrap_inline873tidtex2html_wrap_inline873t_context[tid]);

send T-token(tid, t_context[tid], sign) to t_other[tid];

t_state[tid] := receiving;

tex2html_wrap_inline865 true tex2html_wrap_inline887

sign = Sign(SelfKey(cert), T-aborttex2html_wrap_inline873tid);

send T-abort(tid, sign) to t_other[tid];

t_state[tid] := aborted;

tex2html_wrap_inline865 true tex2html_wrap_inline887

sign = Sign(SelfKey(cert), T-committex2html_wrap_inline873tidtex2html_wrap_inline873t_context[tid]);

send T-commit(tid, t_context[tid], sign) to t_other[tid];

t_state[tid] := ready;

fi

tex2html_wrap_inline865 rcv T-data(tid, data, context, sign) tex2html_wrap_inline871 {Action 4}

valid := (sign = Verify(t_key[tid], T-datatex2html_wrap_inline873tidtex2html_wrap_inline873datatex2html_wrap_inline873context) tex2html_wrap_inline869 t_state[tid] = receiving);

if (tex2html_wrap_inline903 valid tex2html_wrap_inline905 tex2html_wrap_inline903 (context = t_context[tid])) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 context = t_context[tid]) tex2html_wrap_inline887

t_data[tid, t_seq[tid]] := data;

t_context[tid] := Hash(datatex2html_wrap_inline873t_context[tid]);

t_seq[tid] := t_seq[tid] + 1;

fi

tex2html_wrap_inline865 rcv T-token(tid, context, sign) tex2html_wrap_inline871 {Action 5}

valid := (sign = Verify(t_key[tid], T-tokentex2html_wrap_inline873tidtex2html_wrap_inline873context) tex2html_wrap_inline869 t_state[tid] = receiving);

if (tex2html_wrap_inline903 valid) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 tex2html_wrap_inline903 (context = t_context[tid])) tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-aborttex2html_wrap_inline873tid);

send T-abort(tid, sign) to t_other[tid];

t_state[tid] := aborted;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 context = t_context[tid]) tex2html_wrap_inline887

t_state[tid] := sending;

fi

tex2html_wrap_inline865 rcv T-commit(tid, context, sign) tex2html_wrap_inline871 {Action 6}

valid := (sign = Verify(t_key[tid], T-committex2html_wrap_inline873tidtex2html_wrap_inline873context)

tex2html_wrap_inline869 tex2html_wrap_inline903 (t_state[tid] = sending tex2html_wrap_inline905 t_state[tid] = null));

if (tex2html_wrap_inline903 valid) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 t_state[tid] = aborted) tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-aborttex2html_wrap_inline873tid);

send T-abort(tid, sign) to t_other[tid];

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 t_state[tid] = committed) tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-committex2html_wrap_inline873tidtex2html_wrap_inline8730);

send T-commit(tid, 0, sign) to t_other[tid];

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 t_state[tid] = ready) tex2html_wrap_inline887

t_state[tid] := committed;

tex2html_wrap_inline865 (valid tex2html_wrap_inline869 t_state[tid] = receiving) tex2html_wrap_inline887

if true tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-aborttex2html_wrap_inline873tid);

send T-abort(tid, sign) to t_other[tid];

t_state[tid] := aborted;

tex2html_wrap_inline865 (context = t_context[tid]) tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-committex2html_wrap_inline873tidtex2html_wrap_inline8730);

send T-commit(tid, 0, sign) to t_other[tid];

t_state[tid] := committed;

fi

fi

tex2html_wrap_inline865 rcv T-abort(tid, sign) tex2html_wrap_inline871 {Action 7}

valid := (sign = Verify(t_key[tid], T-aborttex2html_wrap_inline873tid)

tex2html_wrap_inline869 tex2html_wrap_inline903 (t_state[tid] = null tex2html_wrap_inline905 t_state[tid] = committed));

if (tex2html_wrap_inline903 valid) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (valid) tex2html_wrap_inline887

t_state[tid] := aborted;

fi

tex2html_wrap_inline865 rcv T-fault(tid) tex2html_wrap_inline871 {Action 8}

if (t_state[tid] = null tex2html_wrap_inline905 t_state[tid] = committed tex2html_wrap_inline905 t_state[tid] = aborted) tex2html_wrap_inline887

skip;

tex2html_wrap_inline865 (t_state[tid] = sending tex2html_wrap_inline905 t_state[tid] = receiving) tex2html_wrap_inline887

t_state[tid] := aborted;

tex2html_wrap_inline865 (t_state[tid] = ready) tex2html_wrap_inline887

cert := self_cert[t_other[tid]];

sign := Sign(SelfKey(cert), T-committex2html_wrap_inline873tidtex2html_wrap_inline873t_context[tid]);

send T-commit(tid, t_context[tid], sign) to t_other[tid];

fi

end


next up previous
Next: Related Work Up: Formal Specification Previous: Annotations

Douglas H. Steves
Sun May 4 15:10:15 CDT 1997