/*
 * Modeled from ISO/IEC 9798
 * Modeler: Cas Cremers, Dec. 2010
 *
 * ccf
 * mutual
 * three-pass
 * 
 * Unidirectional key version.
 * 
 * Modeling notes:
 *
 * - The keyed CCF (f_kab(x)) is modeled as f(x,kab)
 */
hashfunction f;

protocol isoiec-9798-4-4-udkey(A,B)
{
	role A
	{
		fresh Ra: Nonce;
		var Rb: Nonce;
		var Text1,Text4,Text5: Ticket;
		fresh Text2,Text3: Ticket;

		recv_1(B,A, Rb, Text1 );
		claim(A,Running,B,Ra,Rb,Text2);
		send_2(A,B, Ra, Text3, f(Ra,Rb,Text2, k(A,B) ) );
		recv_3(B,A, Text5, f(Rb,Ra,Text4, k(B,A) ) );

		claim(A,Commit,B,Ra,Rb,Text2,Text4);
		claim(A,Alive);
		claim(A,Weakagree);
	}
	role B
	{
		var Ra: Nonce;
		fresh Rb: Nonce;
		fresh Text1,Text4,Text5: Ticket;
		var Text2,Text3: Ticket;

		send_1(B,A, Rb, Text1 );
		recv_2(A,B, Ra, Text3, f(Ra,Rb,Text2, k(A,B) ) );
		claim(B,Running,A,Ra,Rb,Text2,Text4);
		send_3(B,A, Text5, f(Rb,Ra,Text4, k(B,A) ) );

		claim(B,Commit,A,Ra,Rb,Text2);
		claim(B,Alive);
		claim(B,Weakagree);
	}
}

