(* Handshake protocol.
   Simplified from Delaune, Jacquemard, LSV-04-1 

Termination problem:

Rule 12: attacker_guess:encrypt(x_42,y_43),v_44 & attacker_guess:y_43,v_45 -> attacker_guess:x_42,decrypt(v_44,v_45)

v_93 <> encrypt(v_90,v_92) & attacker_guess:v_89,v_90 & attacker_guess:v_91,v_92 & attacker_guess:encrypt(v_89,v_91),v_93 -> bad:

v_167 <> encrypt(encrypt(v_163,v_165),v_168) & attacker_guess:v_162,v_163 & attacker_guess:v_164,v_165 & attacker_guess:encrypt(encrypt(v_162,v_164),y_166),v_167 & attacker_guess:y_166,v_168 -> bad:

etc leads to a loop...

Or with another selection function

attacker_guess:x_115,v_116 & attacker_guess:y_117,v_118 & attacker_guess:y_117,v_119 -> attacker_guess:x_115,decrypt(encrypt(v_116,v_118),v_119)
a

leads to a similar loop...

*)

(* shared-key encryption as equation *)

fun encrypt/2.
fun decrypt/2.
equation decrypt(encrypt(x,y),y) = x.

free c.
private free pw.
weaksecret pw.

process
	new pw;
	new N;
	out(c, encrypt(N, pw))

(* EXPECTPV
RESULT Weak secret pw_1 is true.
0.012s (user 0.000s + system 0.012s), max rss 7940K
END *)
