I've been working on some protocols that use a secure channel abstraction very much like the one described in the Tamarin book, and have run into some behavior around partial deconstructions that I don't understand. First, the secure channel abstraction:
rule SecureChannel_Send:
[ SecureSend(~cid, S, R, m) ]
--[ SecureChannel_Out(~cid, S, R, m),
SecureChannel_Message(m) ]->
[ SecureMessage(~cid, S, R, m) ]
rule SecureChannel_Receive:
[ SecureMessage(~cid, S, R, m) ]
--[ SecureChannel_In(~cid, S, R, m) ]->
[ SecureReceive(~cid, S, R, m) ]
/*
This rule models a compromised sender on a secure channel,
where the adversary can inject messages.
*/
rule SecureChannel_Compromised_Inject:
[ In(<~cid, S, R, m>) ]
--[ Reveal(S, 'SecureChannel'),
SecureChannel_Injected(~cid, S, R, m),
SecureChannel_InjectedMessage(m) ]->
[ SecureMessage(~cid, S, R, m) ]
/*
This rule models the interception of a message on a secure
channel.
*/
rule SecureChannel_Compromised_Intercept:
[ SecureMessage(~cid, S, R, m) ]
--[ Reveal(R, 'SecureChannel'),
SecureChannel_Intercepted(~cid, S, R, m),
SecureChannel_InterceptedMessage(m) ]->
[ Out(~cid),
Out(S),
Out(R),
Out(m) ]
What's happening is that, in some (but not all) protocols where all the communication (other than explicit reveals of keys and such to the adversary) is carried out using SecureSend and SecureReceive facts, I am seeing partial deconstructions— sometimes many of them—that cause Tamarin to spend an enormous amount of time in precomputation. But when I run with --auto-sources, Tamarin generates a sources lemma that boils down to generating actions on some (but not all) rules that use SecureReceive(cid, S, R, m), of the form AUTO_IN_FACT_...(cid, s, R, M), corresponding AUTO_OUT_FACT... actions on the SecureChannel_Receive rule (all of which are redundant with the existing SecureChannel_In(~cid, S, R, m) action) , and a lemma that says that the AUTO_IN_FACTs must be preceded by corresponding AUTO_OUT_FACTs but does not, in any way, mention adversary knowledge. This eliminates all the partial deconstructions.
If I replace the multiple AUTO_IN_FACT_...(cid, s, R, M)actions that --auto-sources generates with a single IN_SECURE_CHANNEL(cid, S, R, m)action in all the same locations (of course, replacing the cid, S, R, m variables with the appropriate local ones), eliminate all the AUTO_OUT_FACT... actions, and replace the very long lemma it generates with a short lemma that says that IN_SECURE_CHANNEL(cid, s, R, m) must be preceded by SecureChannel_In(~cid, S, R, m), that also eliminates all the partial deconstructions.
However, the lack of adversary knowledge in the lemma and the fact that there were partial deconstructions in the first place confuse me, because the SecureChannel_Receive rule is the only possible source of a SecureReceive(cid, S, R, m)linear fact, and if a partial deconstruction arose with respect to the original source of any fresh values mentioned in a SecureReceive, I would not expect that partial deconstruction to be resolved without mentioning adversary knowledge in the sources lemma. Meanwhile, my theory with 27 rules and restrictions (including the secure channel rules above) and 60 cases takes over 9 minutes of precomputation to find 840 partial deconstructions that are cut to 0 by seemingly just telling Tamarin "hey, this rule that is the only possible rule that can generate this fact is actually the one that generated this fact", without saying anything about adversary knowledge.
I feel like I must be missing something about "what makes a partial deconstruction". I'd appreciate any insight anybody might be able to share.
-Dan