# 1 "skeme-rekey.cpp"
# 1 "<command-line>"
# 1 "skeme-rekey.cpp"
# 19 "skeme-rekey.cpp"
# 1 "common.h" 1




 hashfunction prf, KDF;






hashfunction g, h;
# 97 "common.h"
protocol @oracle (DH, SWAP) {







 role DH {
  var i, r: Nonce;

  recv_!DH1( DH, DH, h(g(r),i) );
  send_!DH2( DH, DH, h(g(i),r) );
 }




 role SWAP {
  var i, r, Ni, Nr: Nonce;
# 147 "common.h"
  var I, R: Agent;


  recv_!SWAP1( SWAP, SWAP, KDF(k(I,R),prf(k(I,R), Ni, Nr, R, I)) );
  send_!SWAP2( SWAP, SWAP, KDF(k(R,I),prf(k(R,I), Ni, Nr, R, I)) );

 }


}
# 20 "skeme-rekey.cpp" 2







protocol @executability(O) {


 role O {
  var Ni, Nr: Nonce;
  var I, R: Agent;


  recv_!O1( O, O, prf(k(R,I), Ni, Nr, R, I) );
  send_!O2( O, O, prf(k(I,R), Ni, Nr, R, I) );


  recv_!O3( O, O, prf(k(I,R), Nr, Ni, I, R) );
  send_!O4( O, O, prf(k(R,I), Nr, Ni, I, R) );

 }


}

protocol skeme-rekey(I, R)
{
 role I {
  fresh Ni: Nonce;
  var Nr: Nonce;

  send_1( I, R, Ni );
  recv_!2( R, I, Nr, prf(k(I,R), Ni, Nr, R, I) );
  send_!3( I, R, prf(k(I,R), Nr, Ni, I, R) );


  claim( I, SKR, KDF(k(I,R),prf(k(I,R), Ni, Nr, R, I)) );

  claim( I, Alive );
  claim( I, Weakagree );

 }

 role R {
  fresh Nr: Nonce;
  var Ni: Nonce;

  recv_1( I, R, Ni );
  send_!2( R, I, Nr, prf(k(I,R), Ni, Nr, R, I) );
  recv_!3( I, R, prf(k(I,R), Nr, Ni, I, R) );


  claim( R, SKR, KDF(k(R,I),prf(k(R,I), Ni, Nr, R, I)) );

  claim( R, Alive );
  claim( R, Weakagree );

 }
}
