scyther/gui/Protocols/IKE/ikev1-psk-a.cpp
Cas Cremers 34d7cba293 Added IKE base models.
Modelers: Adrian Kyburz and Cas Cremers
2012-11-15 11:48:14 +01:00

95 lines
2.2 KiB
C++

/**********************************************************************
* @protocol Internet Key Exchange Protocol (IKEv1)
* @reference RFC 2409,
* Boyd C. and Mathuria A., Protocols for Authentication
* and Key Agreement
* @variant Pre-shared key authentication (aggressive mode)
**********************************************************************/
/**
* MACRO DEFINITIONS
* Needs preprocessing by cpp before fed to scyther
*/
#define __IKEV1_PSK__
#ifndef __ORACLE__
#include "common.h"
#endif
#define HASH_Ii prf(k(I,R), Ni, Nr, g(i), Gr, Ci, Cr, list, I)
#define HASH_Ir prf(k(R,I), Ni, Nr, Gi, g(r), Ci, Cr, list, I)
#define HASH_Ri prf(k(I,R), Ni, Nr, Gr, g(i), Cr, Ci, list, R)
#define HASH_Rr prf(k(R,I), Ni, Nr, g(r), Gi, Cr, Ci, list, R)
usertype String;
const list, algo: String;
/**
* This role serves as an "oracle" to ensure the executability of the
* protocol by taking care of the problems that arise from our way of
* modelling Diffie-Hellman keys.
*/
protocol @executability(O) {
#define Gi g(i)
#define Gr g(r)
role O {
var i, r, Ni, Nr, Ci, Cr: Nonce;
var I, R: Agent;
// msg 2
recv_!O1( O, O, HASH_Rr );
send_!O2( O, O, HASH_Ri );
// msg 3
recv_!O3( O, O, HASH_Ii );
send_!O4( O, O, HASH_Ir );
}
#undef Gi
#undef Gr
}
protocol ikev1-psk-a(I, R)
{
role I {
fresh i, Ni, Ci: Nonce;
var Nr, Cr: Nonce;
var Gr: Ticket;
send_1( I, R, Ci, list, g(i), Ni, I );
recv_!2( R, I, Ci, Cr, algo, Gr, Nr, R, HASH_Ri );
claim( I, Running, R, Ni, Nr, g(i), Gr, Ci, Cr );
send_!3( I, R, Ci, Cr, HASH_Ii );
/* SECURITY CLAIMS */
claim( I, SKR, SKi );
claim( I, Alive );
claim( I, Weakagree );
claim( I, Commit, R, Ni, Nr, g(i), Gr, Ci, Cr );
}
role R {
fresh r, Nr, Cr: Nonce;
var Ni, Ci: Nonce;
var Gi: Ticket;
recv_1( I, R, Ci, list, Gi, Ni, I );
claim( R, Running, I, Ni, Nr, Gi, g(r), Ci, Cr );
send_!2( R, I, Ci, Cr, algo, g(r), Nr, R, HASH_Rr );
recv_!3( I, R, Ci, Cr, HASH_Ir );
/* SECURITY CLAIMS */
claim( R, SKR, SKr );
claim( R, Alive );
claim( R, Weakagree );
claim( R, Commit, I, Ni, Nr, Gi, g(r), Ci, Cr );
}
}