Mihael Bakes
SaarlandUniversity,MPI-SWS
Matteo Maei
SaarlandUniversity
Dominique Unruh
SaarlandUniversity
July 26,2010
Abstrat
Inreasing attention has reently been given to the formal veriation of the soure ode of
ryptographi protools. The standard approah is to use symboli abstrations of ryptography
that makethe analysisamenabletoautomation. Thisleavesthe possibility ofattaksthat exploit
the mathematial properties of the ryptographi algorithms themselves. In this paper, we show
howtoonduttheprotoolanalysisonthesoureodelevel(F#inourase)inaomputationally
soundway,i.e.,takingintoaountryptographiseuritydenitions.
We build upon the prominent F7 veriation framework (Bengtson et al., CSF 2008) whih
omprisesaseuritytype-hekerforF#protoolimplementationsusingsymboliidealizationsand
theonurrentlambdaalulusRCFtomodelaorefragmentofF#.
Toleverage thispriorwork, wegiveonditionsunderwhihsymboliseurityofRCFprograms
usingryptographiidealizationsimpliesomputationalseurityofthesameprogramsusing
rypto-graphialgorithms. CombinedwithF7,thisyieldsaomputationallysound,automatedveriation
ofF#odeontainingpubli-keyenryptionsandsignatures.
For the atualomputationalsoundness proof, we use theCoSP framework(Bakes, Hofheinz,
andUnruh,CCS2009). WethusinheritthemodularityofCoSP,whihallowsfor easilyextending
ourprooftootherryptographiprimitives.
Contents
1 Introdution 2
1.1 Ourtehniques . . . 3
1.2 Relatedwork . . . 6
1.3 Notation. . . 6
2 RCF (review) 6
2.1 Syntaxandsemantis . . . 7
3 CoSPFramework (review) 9
4 TheDolev-Yao library 12
4.1 Thelibrary . . . 12
4.2 Dolev-Yaotransitionrelation . . . 13
5 Computationalsoundness 15
5.1 Denitions. . . 15
5.2 Symb.vs.omputationalexeution 17
5.3 Comp.soundnessoftheDY-library 24
5.4 Enryptionandsignatures . . . 25
6 The sealing-based library 29
6.1 DynamiSealing . . . 29
6.2 MappingDY-termsintoSB-terms 32
6.3 Preservationofsafety . . . 34
6.4 Computationalsoundness . . . 40
7 Conlusions 41
Proofs ofseurity protools are known to beerror-proneand, owing to thedistributed-system aspets
ofmultipleinterleavedprotoolruns,diultforhumanstogenerate. Hene,worktowardsthe
automa-tion of suh proofs started soon after the rst protools were developed. From the start, the atual
ryptographi operations in suh proofs were idealized into so-alled symboli or Dolev-Yao models,
following[DY83, EG83, Mer83℄(see,e.g.,[KMM94,Sh96,AG97,Low96,Pau98,BMV04℄). This
ideal-izationsimplies proofs byfreeingthem from ryptographidetails suh asomputationalrestritions,
probabilistibehavior,anderrorprobabilities. Unfortunately,theseidealizationsalsoabstratawayfrom
thealgebraipropertiesaryptographialgorithmmayexhibit. Thereforeasymbolianalysismay
over-lookattaksbasedontheseproperties. Inotherwords,symboliseuritydoesnotimplyomputational
seurity. Inordertoremovethislimitation,[AR02℄introduedtheoneptofomputationalsoundness.
We all a symboli abstration omputationally sound when symboli seurity implies omputational
seurity. Aomputationalsoundnessresultallowsustogetthebestoftwoworlds: Theanalysisanbe
performed(possibly automatially)using symboliabstrations,but thenal resultshold withrespet
totherealistiseuritymodelsusedbyryptographers.
Adrawbakommontotheexistingomputationalsoundnessresults,is,however,thattheyworkon
abstrat protool representations(e.g., the applied
π
-alulus[AF01℄). That is, although the analysis takesintoaounttheatualryptographialgorithms,itstillabstratsawayfromtheatualprotoolim-plementation. Thus,evenifweprovetheprotoolseure,theimplementationthatislaterdeployedmay
ontainimplementation errorsthat introduenewvulnerabilities. Toavoidthis issue, reentworkhas
takledtheproblemofverifyingseuritydiretlyonthesoureode,e.g.,[GLP05a,BFGT06,BBF
+
08℄.
Yet,thisveriationisagainbasedonsymboliidealizations.
Thus,weareleftwiththehoiebetweenveriationtehniquesthatabstratawayfromthe
rypto-graphialgorithms,andveriationtehniquesthatabstratfromtheprotoolimplementation. Tolose
thisgap,weneedaomputationalsoundnessresultthat appliesdiretly toprotoolimplementations.
Our result. We present a omputational soundness result for F# ode. For this, we use the RCF
alulus proposed by [BBF
+
08℄ as semantis for (a ore fragment of) F#. RCF allows for enoding
implementation in F# by oering a lambda-abstration onstrutor that allows for reasoning about
higher-order languages. Moreover,it supports onurrenyprimitives, indutive datastrutures,
reur-sion, and an expressive treatment of symboli ryptography using sealing mehanisms. Furthermore,
RCFsupportsverygeneraltrae-based seurityproperties thatare expressedin rst-orderlogi, using
assumptionsandassertions. (Previous omputationalsoundnessresultsarerestritedtoalulilikethe
applied
π
-alulus whih lak these features.) We speify aryptographi librarythat internally uses symboliabstrations,andprovethat ifaprotoolissymboliallyseurewhenlinkedtothat library,itis omputationally seure when using atual ryptographialgorithms. Ourapproah enablesthe use
of existing symboli veriationtools,suh asthetype-hekerF7 [BBF
+
08℄. Therequirementto use
thesetoolsinpartiularruledoutpotentialhangestotheRCFsemantisthatwouldhavesimpliedto
establishaomputationalsoundnessresult. Westress,however,thatourresultdoesnotdependonany
partiularsymboliveriationtehnique.
Wehavederivedomputationalsoundnessforenryptions anddigitalsignatures. Ourresultis,
how-ever, extensible: most of our theorems are parametri in the set of ryptographiprimitives and the
remainingtheorems anbeeasily extended. Furthermore,bybasingon theso-alledCoSP framework
[BHU09℄, our proof solely onerns the semantis of RCFprograms and does not involve any
rypto-graphi arguments; thus extending our proofs to additional ryptographi abstrations supported by
CoSPdoesnotrequireadeepknowledgeofryptography,whihmakessuh anextensionaessibleto
CoSP (Setion 3). Themain ideaofourworkistoredue omputationalsoundnessofRCFto
om-putational soundness in the CoSP framework [BHU09℄. Thus, we rst give an overview of the ideas
underlying CoSP. All denitions in CoSP are relative to asymboli model that speies a set of
on-strutors and destrutors that symbolially represent omputational operations, and a omputational
implementation thatspeiesryptographialgorithmsfortheseonstrutorsanddestrutors. InCoSP,
aprotool is representedbyan innitetree that desribestheprotool asalabeled transition system.
SuhaCoSPprotoolontainsationsforperformingabstratomputations(applyingonstrutorsand
destrutorstomessages)andforommuniatingwithanadversary. ACoSPprotoolisendowedwithtwo
semantis,asymboliexeutionandaomputationalexeution. Inthesymboliexeution,messagesare
representedbyterms. Inthe omputationalexeution, messagesare bitstrings,and theomputational
implementationisusedinsteadofapplyingonstrutorsanddestrutors. A omputational
implementa-tionis omputationally sound ifanysymbolially seureCoSP protool is alsoomputationally seure.
The advantage of expressing omputational soundness results in CoSP is that the protool model in
CoSPis verygeneral. Hene the semantisofother alulianbeembeddedtherein, thus transferring
theomputationalsoundnessresultsfromCoSPtothesealuli.
DY library (Setions 4,5). Toapply CoSPtoRCF,werstdene alibrary
σ
M
DY
that enodesan arbitrary symboli model. This library internally represents all messages as terms in some datatype.Manipulationofthese termsispossibleonlythroughthelibrary,neithertheprogramnortheadversary
andiretlymanipulatemessages.
σ
M
DY
alsoprovidesfuntionsforsendingandreeivingmessages. Given thelibraryσ
M
DY
, weandene anotionof symboliseurity. A programA
ontainsertaineventsand seuritypoliiesspeiedin rst-orderlogi. WeallA
robustly→
-σ
M
DY
-safe iftheseuritypoliiesare satisedineverystepoftheexeutionwhenA
runsin parallelwithanarbitraryopponentandislinked tothelibraryσ
M
DY
.Next,wespeifyaprobabilistiomputationalsemantisforRCFprograms
A
. Inthesesemantis,we speifyanalgorithm(theomputationalRCF-exeution)thatexeutesA
. Ineahstepoftheexeution, theadversaryisaskedwhat redutionruleto applytoA
. Lettingtheadversarymakethesesheduling deisionsresolvesthenon-determinismintheRCFprogramandsimultaneouslymakesourresultstrongerby making the worst-ase assumption that the adversary has total ontrol over the sheduling. All
messages are represented as bitstrings, and any invoation of
σ
M
DY
is replaed by the orresponding omputationfromtheomputationalimplementation. NotiethatintheomputationalRCF-exeution,theadversaryisnotlimitedtoinvokinglibraryroutines;sinemessagesarebitstrings,theadversaryan
performarbitrarypolynomial-timeoperationsonthem. Ifallseuritypoliiesaresatisedin eahstep
oftheomputationalRCF-exeution,weall
A
robustlyomputationallysafe. Ourgoalis to showthat, ifan RCFprogram is robustly→
-σ
M
DY
-safe,then it is robustly omputa-tionallysafe. Toprovethis,weintroduetwointermediatesemantis.•
Theredutionrelation : ThissemantisisverysimilartotheoriginalsemantisofRCF,exeptthat all invoations of
σ
M
DY
are internalized, i.e., symboli ryptographi operations are atomi operationswithrespetto . Thisleadstothenotionofrobust -σ
M
DY
-safety.•
The symboli RCF-exeutionSExec
: This semantis is dened by taking the denition of theomputationalRCF-exeution,andbyreplaingallomputationaloperationsbytheorresponding
symbolioperations. That is, thesymboliandthe omputationalRCF-exeution are essentially
the samealgorithm, oneoperatingon terms, the other doingthe orresponding operations from
theomputationalimplementation. This leadstothenotionofrobust
SExec
-safety. In therst step (f. Figure1), we show that robust→
-σ
M
DY
-safetyimplies robust -σ
M
DY
-safety. This proofisfairlystraightforward,beause justinternalizesthedenition ofσ
M
DY
. Intheseondstep,weshowthatrobust -σ
M
DY
-safetyimpliesrobustSExec
-safety. Thersttehnial diulty herelies in thefat that robust -σ
M
rob.
→
-σ
M
DY
-safety rob. -σ
M
DY
-safetyrob.omputationalsafety rob.
SExec
-safety 1.2.
3.
Figure1: Mainstepsoftheomputationalsoundnessproof
SExec
-adversary,wehavetoonstrutanRCF-programQ
thatperformsthesameationswhenrunningin parallelwith
A
. Theseond diultyliesin thefatthat thelogifordesribingseurityproperties isquitegeneral. Inpartiular,itallowsforexpressingfatsabouttheatualodeofσ
M
DY
(e.g.,theode ofonefuntionisasubtermoftheodeofanother). Sinethelibraryσ
M
DY
isnotpresentinthesymboli RCF-exeution,weneed to identify riteriathat ensurethat the poliies do notdepend on theatualodeof
σ
M
DY
.In the third step, we use the fat that the symboli and the omputational RCF-exeution of
A
have essentially the same denition, exept that one performs symboli and the other omputationaloperations. Thus,ifweexpresstheseexeutionsbyalabeledtransitionsystemthattreatsoperationson
messagesasatomisteps, weget thesametransitionsystem forbothexeutions, onlywithadierent
interpretation of these atomisteps. This transition systemis aCoSPprotool
Π
A
, andthe symboliandtheomputationalexeutionofthatprotoolareequivalenttothesymboli andtheomputational
RCF-exeution of
A
. Thus, assuming a omputational soundness result in CoSP, we get that robustSExec
-safetyimpliesrobustomputationalsafety. Combiningthiswiththeprevioussteps,wehavethatrobust
→
-σ
M
DY
-safetyimpliesrobustomputationalsafety(Theorem1).Notethat thisargumentationis fullygeneri, itdoesnotdepend onanypartiularsymbolimodel.
One we haveanew omputationalsoundness result in CoSP, this diretly translates into aresultfor
RCF.Note further that no atual ryptographiproofs need to be done; allryptographi details are
outsouredtoCoSP.Thelibrary
σ
M
DY
isverysimilarinspirittotheoneusedin[BFG10℄,webelievethat theveriationtehniquesusedtherean beappliedto robust→
-σ
M
DY
-safetyaswell.Enryptionand signatures(Setion 5.4). Ourresultssofararefullygeneri. IntheCoSP
frame-work,aomputationalsoundnessresultexistsforpubli-keyenryption andsignatures. Combiningthis
result with our generi result, weget aself-ontainedomputational soundness result for enryptions
andsignaturesinRCF(Theorem2). TheresultintheCoSPframework imposesertainrestritionson
theuseoftheryptographiprimitives(e.g.,oneisnotallowedto sendseretkeysaround). Toensure
thatthese restritionsaremet, weintrodueawrapper-library
σ
Highlevel
forσ
M
DY
. Aprogramthat only invokesfuntionsfromσ
Highlevel
isguaranteedtosatisfytheserestritions.Sealing-based library (Setion 6). In the library
σ
M
DY
, we have internally represented symboli ryptographyastermsinsomedatatype. AnalternativeapproahisusedintheF7veriationframework[BBF
+
08℄ foranalyzing RCF/F#-ode. Inthis approah, alibrarybased onseals isused. Roughly,a
seal onsistsofamutablerefereneandaessorfuntions. An enryption keypair, e.g.,ismodeledas
a sealed map. The enryption keyis a funtion that insertsthe plaintext into that map and returns
theindexoftheplaintext. Thederyptionkeyisafuntion thatretrievestheplaintextgiventheindex.
Seals haveproven well-suited for seurityanalysis by type-heking, sine they allow for polymorphi
types. Wepresentasealing-basedlibrary
σS
modelingenryptionsandsignatures. Weshowthatrobust safetywithrespettoσS
impliesrobust -σ
M
DY
-safetybyprovingtheexisteneofasimulationbetween exeutions with respet to the two libraries. Combined with Theorem2, this immediately returns aomputationalsoundnessresultforthesealing-basedlibrary(Theorem4). Theadvantageofthis result
is that programs using
σS
an be analyzed using the F7 type-heker, sine the library itself is type-hekedwithpolymorphitypingannotations1
.
Note that this part of our paper is spei to the ase of enryptions and signatures. Webelieve,
however,thattheproofanbeeasilyextended tootherprimitivesonaase-by-asebasis. Furthermore
1
tosealstoseuritywithrespettoaterm-basedabstrationthatisonsiderablysimplerbeauseitdoes
notrelyonasharedstate.
Restritions. Webrieydisussthelimitationsofourresultandexplainwhytheyarepresent.
Seurity properties. We only onsider safety properties (desribed by authorization poliies) that
are eiently deidable (in the sense that for any given trae, it is eiently deidable whether the
safetypropertyis fullled). Both therestritionto safetyproperties(as opposed tolivenessproperties)
and the restritionto eientlydeidable properties 2
are stateof the art in omputational soundness
results. Computationalsoundnessresultsforpropertiesbasedonobservationalequivaleneexist[CLC08℄;
applyingtheseto RCFwouldonstituteaninterestingextension toourwork.
Protool onditions. We impose ertain onditionson our protools. Most prominently, weforbid
to enrypt orsend seret keys. (As a side eet, this also avoids so-alled key-yles.) Again, these
onditionsarestateoftheartin omputationalsoundnessresults,and, ifremovedthere,theyanalso
beremovedfromourresult.
Authorization poliies. Construtors that representryptographioperations (suh as enryptions)
maynotourin theformulaeusedto express authorizationproperties. This isdue to thefat thata
statementsuh as
∃xyz.c
=
enc
(x, y, z)
doesnothaveasensibleomputational interpretation(there is noeientwaytohekit). Sine ourtreatmentisgeneri,alsoonstrutors thatrepresentharmlessprimitivessuhaspairsareexludedfrom authorizationpoliies; allowingthemshould bepossiblebut
wouldonsiderably ompliateourtreatment. Webelieve,however,thatdisallowingtheseonstrutors
in authorization poliies doesnot onstitute a big restrition. In most ases, an authorization poliy
will dene high-levelrules (suh asif
P
haspaid forx
, thenP
maydownloadx
). Statements about theatualformatof messages(e.g.,m
isapair)will onlybe usedduring thesymboli veriationof thehigh-level properties, e.g.,aspart ofarenement type. We donotimpose any restritionsonthesymboliveriationtehniques;arbitraryformulaeanbeusedthere aslongastheydonotappearin
thenalauthorizationpoliy.
Networkhannels. Weassumethat thereis onlyasinglepublinetworkhannel (i.e.,onlyasingle
hannel to the adversary). This is donefor simpliity only, our resultsould be easily extended to a
settingwithmorehannels. Or,onemightemulate severalhannelsbyaddingaheaderto allmessages
sentoverthepublihannel.
Assumptionsandassertionsin libraries. Oneisnotallowedtoaddassumptionsandassertions(i.e.,
authorization poliies) in the ode of thesymbolilibraries themselves. This is, however, notreally a
restritionsineonemayuseawrapperlibrarythat addstheseassumptionsandassertions.
Alternativeapproahes. Webrieydisussseveralpossiblealternativestoourapproahandexplain
theirdiulties.
Using CryptoVerif. Insteadof doinga symboliseurity veriation andthen applying a
omputa-tional soundness result, one ould perform the analysis diretly in the omputational setting using a
toolsuhasCryptoVerif [Bla06℄. CryptoVerifisatoolthat performsaseurityanalysis diretlyin the
omputational model. Tofollowthis approahin our setting, onewould haveto desribeanenoding
of RCF into CryptoVerif's alulus. Although this an easily be done for a fragment of RCF, many
featuresofRCFsuhasreursion,authorizationpoliiesin rst-orderlogi,andonurreny 3
are
prob-ablybeyond what CryptoVerif an handle. Also,CryptoVerif's approah probablydoesnotsale well
toomplexprograms. Finally,oneneedsto provethat theenodingof RCFintoCryptoVerif preserves
allrequiredseurityproperties; suh aproofmightbe notmuhsimplerthantheproofs inthepresent
paper. [BCFZ08℄pursue thisapproah;theydonot,however,provetheirenodingsound.
2
Byeiently deidableproperties,wedonotmeanthatit anbeeientlydeided whetheraprotool guarantees
thatthepropertyissatised,weonlymeanthatitanbeeientlydeidedwhether inagivenexeution,the property
wassatised.
3
CryptoVerifdoessupportonurrenynatively,butitsmodelofonurrenyassumesauniformrandomhoieineah
Reduingtotheapplied
π
-alulus. Analternativeapproahtoobtainomputationalsoundnesswould betoembedF#into theapplied pi-alulusandto exploit theomputationalsoundnessresultfortheapplied pi-alulus established in [BHU09℄. However,establishing this embedding would arguably not
beeasierthanourapproah: itrequirestoenodedatastrutures,reursion,thesealingmehanism,and
assertions/assumptions into the applied pi-alulus, inluding the whole FOL/F logi. Moreover, the
orretnessoftheenodinghastobeproventwieonesymbolially(theproofwouldfollowthesame
linesastheproofin [BFGT06℄)andonewithrespetto theomputationalsemantis.
Removingequalitytestsonlambda-expressions. Alargepartofthetehnialdiultiesinourproofs
stem from the fat that RCF allows to do syntati equality tests on lambda-abstrations. It is not,
however,easily possibletoremovethese tests: Ifwehange thesemantisofRCF,ourresultsbeome
inompatiblewithexistingtoolsliketheF7framework.Asyntatirestritionthatdisallowsomparisons
oflambda-abstrationsdoesnotseemtobepossibleeither;whihvariablesareinstantiatedwith
lambda-abstrationsonlybeomeslearatruntime.
1.2 Related work
TheproblemofomputationalsoundnesswasrstaddressedbyAbadiandRogawayin[AR02℄forpassive
adversaries and symmetri enryption. The protool language and seurity properties handled there
were extendedin [AJ01, Lau01, HLM03, BCK05, ABW06℄, but still apply onlyto passiveadversaries.
Subsequentworksstudied omputational soundnessagainstativeattaks(e.g., f. [BPW07,BPW03a,
BPW03b,BP04,SBB
+
06,Lau04,MW04,JLM05,BHU09℄). Reentworksalsofousedonomputational
soundnessinthesenseofobservationalequivaleneofryptographirealizationsofproesses(e.g.,[AF06,
CLC08,CL08℄). Alltheseworksdonottakletheomputationalsoundnessofprotoolimplementations.
Conurrentlywiththeannounementofthis work atFCC2009,[Fou09℄reported independentworkin
progressonatypesystemforRCFthatentailsomputationalsoundness.
The analysis of thesoure ode of protool implementationshasreently reeived inreasing
atten-tion. Goubault-LarreqandParrennesdevelopedastatianalysistehnique[GLP05b℄basedonpointer
analysis andlauseresolution forryptographiprotoolsimplementedin C.Theanalysisis limitedto
serey properties. Chaki and Datta reentlyproposed atehnique[CD09℄ basedon software model
heking for the automated veriation of serey and authentiation properties of protools
imple-mentedin C.Theanalysisprovidesseurityproofsforaboundednumberofsessionsandis eetivein
disoveringattaks. ItwasusedtoheksereyandauthentiationpropertiesoftheSSLhandshake
pro-toolforongurationsof uptothree serversand threelients. Bhargavanet al.proposed atehnique
[BFGT06, BCFZ08℄ for the veriation of F# protool implementations by automatially extrating
ProVerifmodels[Bla01℄. Theanalysisprovidesseurityproofsand,despiteitsnon-ompositionalnature,
salesremarkablywelland was suessfullyused to verify implementations ofreal-worldryptographi
protools suh as TLS [BCFZ08℄. None of these analysis tehniques enjoys omputational soundness
guarantees. [BCFZ08℄also proposesanembedding ofF#into thealulusof CryptoVerif. The
embed-dingisnot,however,proventobesound;also,aordingto[BCFZ08℄,itisdiulttoanalyzereursive
funtionswithCryptoVerif.
1.3 Notation
Givenaterm
t
,wewritet{t
′
/x}
fortheresultofsubstitutingallfreeourrenesof
x
byt
′
. Weassume
thatsubstitutionsareaptureavoiding,i.e.,boundnamesarerenamedwhenneessary. Wewrite
t
fora listt1, . . . , t
n
wherethelengthn
ofthelistisleftimpliit. GivensetsP, C
oflogialformulae,wewriteP
⊢
C
iforallF
∈
C
,F
isentailedbyP
.2 RCF (review)
ThissetionoutlinestheRenedConurrentFPC[BBF
+
08℄,asimpleorealulusextendingtheFixed
a, b, c
nameh
onstrutorM, N
::=
valuex, y, z
variable()
unitλx.A
funtion(M, N)
pairh M
onstrutorappliationA, B
::=
expressionM
valueM N
funtion appliationM
=
N
syntatiequalitylet
x
=
A
in
B
letlet
(x, y) =
M
in
A
pairsplitmatch
M
with
h x
then
A
else
B
onstrutormathνa.A
restritionA
B
forka!M
transmissionofM
onhannela
a?
reeivemessageohannelassume
F
assumptionofformulaF
assert
F
assertionofformulaF
Figure2: Syntaxof RCFvaluesandexpressions
Strut Refl
A
≡
A
Strut Trans
A
≡
A
′′
,
if
A
≡
A
′
and
A
′
≡
A
′′
Strut Let
let
x
=
A
in
B
≡
let
x
=
A
′
in
B,
ifA
≡
A
′
Strut Res
νa.A
≡
νa.A
′
,
if
A
≡
A
′
Strut Fork 1
A
B
≡
A
′
B,
if
A
≡
A
′
Strut Fork 2
B
A
≡
B
A
′
,
if
A
≡
A
′
Strut Fork ()
()
A
≡
A
Strut Msg ()a!M
≡
a!M
()
Strut Assume()
assume
C
≡
assume
C
()
Strut Res Fork1A
′
(νa.A)
≡
νa.A
′
A,
ifa
6∈
fn
(A
′
)
Strut Res Fork2
νa.A
A
′
≡
νa.A
A
′
,
ifa
6∈
fn
(A
′
)
Strut Res Let
let
x
=
νa.A
in
B
≡
νa.
let
x
=
A
in
B,
ifa
6∈
fn
(B)
Strut Fork Asso(A
A
′
)
A
′′
≡
A
(A
′
A
′′
)
Strut Fork Comm
(A
A
′
)
A
′′
≡
(A
′
A)
A
′′
Strut Fork Let
let
x
= (A
A
′
)
in
B
≡
A
(
let
x
=
A
′
in
B)
Figure3: Struturalequivalenerelation
A
≡
A
′
expressiveenoughtoenodealargepartofF#[BBF
+
08℄.
2.1 Syntax and semantis
The set of values is omposed of names, variables, unit, funtions, pairs, and type onstrutors (f.
Figure2). Namesaregeneratedatrun-timeandareonlyusedashannelidentiers,whilevariablesare
plae-holders for values. Unit, funtions, and pairsare standard. WhileRCForiginally inludes only
threetypeonstrutors(namely,introdutionformsforunionandreursivetypes),weextendthesyntax
ofthealulusto anarbitrarysetofonstrutors.
Conditionalsareenodedusingthefollowingsyntatisugar:
true
:=
inl
()
,false
:=
inr
()
,andif
M
=
N
then
A
else
B
abbreviateslet
y
= (M
=
N)
in match
y
with inl
x
then
A
else
B
forsomefreshx, y
.Anexpression representsaonurrentomputationthatmayreduetoavalue,ormaydiverge. The
semantisofexpressions is dened by astrutural equivalene relation
≡
4and aredution relation
→
. 4Theequivalenerelation
≡
onsideredinthispaperistheextensionoftheheatingrelationA
⇛
B
proposedin[BBF+
08 ℄
whereallheatingrulesaremadesymmetri. InAppendixA,weprovethatmakingtheheatingrelationsymmetriissound,
RedFun
(λx.A)
N
→
A
{
N/x
}
RedSplit
let
(x
1
, x
2
) = (N
1
, N
2
)
in
A
→
A
{
N
1
/x
1}{
N
2
/x
2}
RedMath
match
M
with
h x
then
A
else
B
→
A
{
N/x
}
ifM
=
h N
B
otherwiseRedEq
M
=
N
→
true
ifM
=
N
false
otherwiseRedComm
a!M
a?
→
M
RedAssert
assert
C
→
()
RedLetVal
let
x
=
M
in
A
→
A
{
M/x
}
RedLetlet
x
=
A
in
B
→
let
x
=
A
′
in
B,
if
A
→
A
′
RedRes
νa.A
→
νa.A
′
,
if
A
→
A
′
RedFork 1
A
B
→
A
′
B,
if
A
→
A
′
RedFork 2
B
A
→
B
A
′
,
if
A
→
A
′
RedStrut
A
→
A
′
,
if
A
≡
B, B
→
B
′
, B
′
≡
A
′
Figure4: Redutionrelation
A
→
A
′
Theformerenablesonvenientrearrangementsofexpressions,whilethelatterdesribesthesemantisof
RCFommands.
Valuesareirreduible. Thesemantisoffuntionappliations,onditionals,letommands,pairsplits,
andonstrutormathesisstandard. Intuitively,therestrition
νa.A
generatesagloballyfreshhannela
that anonly beused inA
and thenamea
is bound inA
. TheexpressionA
B
evaluatesA
andB
in parallel, and returnsthe resultofB
(the result ofA
is disarded). Theexpressiona!M
outputsM
onhannela
andreduesto theunitvalue()
. Theevaluationofa?
bloksuntilsomemessageM
isavailableonhannel
a
,removesM
fromthehannel,andthenreturnsM
.The expressions
assume
F
andassert
F
represent logial assumptions and assertionsfor modeling seuritypoliies. Theintendedmeaningisthatatanypointoftheexeution,theassertionsareentailedbytheassumptions. Theformulae
F
arespeiedin FOL/F[BBF+
08℄,avariantof rst-orderlogi.
Morepreisely, theformulae
F
ourring in an RCF-expressionsare formulaein the logi FOL/F, a variant of rst order logi extended with the onept of syntati funtion symbols. For syntatifuntion symbols
f
6=
f
′
, we have the additional axioms
⊢
(f
(x) =
f
(x
′
))
⇒
x
=
x
′
(F Injetive)
and
⊢
f
(x)
6=
f
′
(x
′
)
(F Distint). All syntatielements of RCF exept for variables (e.g.,lambda-abstrations,names,onstrutors)areenodedas(possiblynullary)syntatifuntionsymbolsin
FOL/F-formulae. RCF-variablesareidentiedwithFOL/F-variables. Fordetails,see[BBF
+
08℄.
Theequivalenerelation
≡
introdueanormalformforRCF-expressions,astruture. Astrutureis anexpressionoftheformS
:=
νa.
Π
i
∈
[1
,m
]
assume
F
i
Π
j
∈
[1
,n
]c
j
!M
j
Π
k
∈
[1
,o
]L
k
{e
k
}
where
e
k
is any expression apart from a let, restrition, fork, message send, or an assumption andL
:=
{} |
let
x
=
L
in
B
. Notiethat anyexpressionisstruturallyequivalenttoastruture.The FOL/F-formulae
F
i
in Sweall theative assumptions, andanyFOL/F-formulaF
withe
i
=
assert
F
forsomei
wealltheativeassertionsofS. WeannowformalizethefatthattheassumptionsfollowfromtheassertionsintheexeutionofanRCFexpression:
RCFexpressions an be transformedby strutural equivaleneinto anormalform, whih is alled
astruture andonsistsof asequeneofrestritionsfollowedbyaparallel omposition ofassumptions,
outputs,andlets. Theseassumptionsandtheassertionsreadytobereduedarealledative. Intuitively,
anexpressionissafeifallativeassertionsareentailedbytheativeassumptions.
An expression
A
is→
-safeiffor allstruturesSsuhthatA
→
∗
S,wehave thatSisstatiallysafe.
⋄
When reasoning about implementations of ryptographi protools, we are interested in the safety of
programsexeutedinparallelwithanarbitraryattaker. Thispropertyisalled robustsafety.
Denition2(Opponentsand robust
→
-safety) An expressionO
isan opponentif and onlyifO
is losed andO
ontains no assertions. A losed expressionA
is robustly→
-safe if and only if theappliation
O A
is→
-safe forall opponentsO
.⋄
Thenotionofrobust
→
-safetyisthesameastherobustsafetydenedin[BBF+
08℄. Robust
→
-safety anbeautomatiallyveriedusingtheF7typeheker.Inthefollowing,wewillsometimesneedtorestritourattentiontoprogramsthatonlyuseaertain
subsetofthesetofallonstrutors. Forthis,weassumethattheset ofRCFonstrutorsispartitioned
intopubli onstrutors andprivate onstrutors. Privateonstrutorsareusuallyusedinside alibrary.
Notehowever,thatthesemantisofRCFtreatsprivateandpublionstrutorsinthesameway. AnRCF
expressionthatdoesnotontainprivateonstrutors(neitherinonstrutorappliationsnorin
pattern-mathes)isalled p-free. WeallanRCF-expression
A
mp-free (formath-private-onstrutor-free) iA
=
C[h1t1, . . . , h
n
t
n
]
whereh
i
are private onstrutors andC
is aontext that doesnot ontain subterms of the formmatch
·
with
h
·
then
·
else
for private onstrutorsh
. (That is, amp-free expressionmayhavepattern mathesusingprivateonstrutorsonlybelowprivateonstrutors.) WeallanRCF-expressionpureifitdoesnotontainassumptions,assertions,outputs(
M
!N
),inputs(M
?
), orforks(M
N
).Furthermore,weallaFOL/F-funtionsymbolforbidden ifitisthefuntion symbolrepresentingan
RCF-lambda-abstration 5
oraprivateRCF-onstrutor.
3 CoSP Framework (review)
TheomputationalsoundnessproofdevelopedinthispaperfollowsCoSP[BHU09℄,ageneralframework
forondutingomputationalsoundnessproofsofsymboliryptographyandforembeddingtheseproofs
into proessaluli. CoSPenablesprovingomputationalsoundness resultsin aoneptuallymodular
andgeneriway: everyomputationalsoundnessproofforaryptographiabstrationphrasedinCoSP
automatiallyholdsforallembeddedaluli,andtheproessofembeddingproessaluliisoneptually
deoupledfromomputationalsoundnessproofs.
CoSPprovidesageneralsymbolimodelforexpressingryptographiabstrations.Werstintrodue
someentraloneptssuhasonstrutors,destrutors,anddedutionrelations.
Denition3 (CoSPterms) Aonstrutor
f
isasymbolwitha(possiblyzero)arity. Wewritef
/n
∈
C
todenote thatC
ontainsaonstrutorf
witharityn
. Anonen
isasymbolwith zeroarity. Amessage typeT
overC
andN
is a set of terms over onstrutorsC
and nonesN
. A destrutord
of arityn
, writtend
/n
, overamessage typeT
isa partial mapT
n
→
T
. If
d
isundenedont
1, . . . ,
tn
, wewrited
(
t
1, . . . ,
tn
) =
⊥
.⋄
Tounifythenotationsforonstrutors,destrutors,andnones,wedenethepartialfuntion
eval
f
:
T
n
→
T
asfollows: If
f
isaonstrutorornone,eval
f
(
t
1, . . . ,
tn
) :=
f
(
t
1, . . . ,
tn
)
iff
(
t
1, . . . ,
tn
)
∈
T
andeval
f
(
t
1, . . . ,
tn
) :=
⊥
otherwise. Iff
isadestrutor,eval
f
(
t
1, . . . ,
tn
) :=
f
(
t
1, . . . ,
tn
)
iff
(
t
1, . . . ,
tn
)
6=
⊥
and
eval
f
(
t
1, . . . ,
tn
) :=
⊥
otherwise. A dedution relation⊢
CoSP
between2
T
and
T
formalizes whih terms an be dedued from otherterms. The intuition of
S
⊢
CoSP
m
forS
⊆
T
andm
∈
T
is that thetermm
anbededued from the termsinS
.5
InRCF,every onstrut fromthe language (inludinglambda-abstrations) isrepresented inFOL/Fformulaebya
speialfuntionsymbol;seethefullversionof[BBF
+
Denition4(Dedution relation) A dedution relation
⊢
CoSP
over a message typeT
isa relation between2
T
and
T
.⋄
Theonstrutors,destrutors,andnones,togetherwiththemessagetypeandthededutionrelation
formasymboli model. SuhasymbolimodeldesribesapartiularDolev-Yao-styletheory.
Denition5 (Symbolimodel) A symboli model
M
= (
C
,
N
,
T
,
D
,
⊢
CoSP
)
onsists of a set of on-strutorsC
,aset of nonesN
,amessagetypeT
overC
andN
withN
⊆
T
,a setof destrutorsD
overT
,andadedution relation⊢
CoSP
overT
.⋄
ACoSP protool
Π
isdened asatreewith labellednodesandedges. Wedistinguishomputationnodes,whihdesribeonstrutorappliations,destrutorsappliations,andnonereations,output and
inputnodes,whihdesribeommuniation,andontrolnodes,whihallowtheadversarytoinuenethe
ontrolowoftheprotool. Computationandoutputnodesrefertoearlieromputationandinputnodes;
themessagesomputedattheseearliernodesarethentakenasargumentsbytheonstrutor/destrutor
appliationsorsenttotheadversary.
For CoSP protools, both a symboli and a omputational exeution are dened by traversing
the tree. In the symboliexeution, the omputation nodes operate on terms, and the input/output
nodesreeive/send termsto the(symboli) adversary. Thesuessorsofontrol nodes arehosen
non-deterministially. In the omputational exeution, the omputation nodes operate on bitstrings
(us-ing aomputationalimplementation
Impl
), and theinput/output nodesreeive/send bitstringsto the (polynomial-time)adversary. Theadversaryhoosesthesuessorsofontrolnodes.Denition6 (CoSPprotool) A CoSPprotool
Π
is a tree with a distinguished rootand labels onboth edges andnodes. Eah node hasaunique identier
ν
andoneof the following types: 6•
Computation nodes areannotatedwith aonstrutor, destrutors, ornonef
/n
together withtheidentiers of
n
(not neessarily distint) nodes. Computation nodes have exatly two suessors; the orresponding edgesarelabeledwithyes
andno
,respetively.•
Output nodes are annotated with the identier of one node. An output node has exatly onesuessor.
•
Inputnodeshaveno furtherannotation. An inputnode has exatlyone suessor.•
Controlnodesareannotatedwithabitstringl
. Aontrolnodehasatleastoneanduptoountablymany suessorsannotatedwith distintbitstrings
l
′
∈ {0,
1}
∗
. (Weall
l
the out-metadataandl
′
the in-metadata.)
If a node
ν
ontains an identierν
′
in its annotation, then
ν
′
has to be on the path from the root to
ν
(inluding the root, exludingν
), andν
′
mustbe a omputationnode or input node. In ase
ν
′
isa
omputationnode,the pathfrom
ν
′
to
ν
has toadditionally go throughthe outgoingedgeofν
′
withlabel
yes
.⋄
Denition7(Symboliexeution) Leta symboli model
(
C
,
N
,
T
,
D
,
⊢
CoSP
)
and aCoSP protoolΠ
begiven. A fulltraeisa(nite)listof tuples(S
i
, ν
i
, f
i
)
suhthatthe followingonditionshold:•
Corretstart:S1
=
∅
,ν1
isthe rootofΠ
,f1
isatotallyundenedpartialfuntion mappingnodeidentierstoterms.
•
Valid transition: For every two onseutive tuples(S, ν, f
)
and(S
′
, ν
′
, f
′
)
in the list, let
ν
˜
bethe node identiersinthe annotationofν
anddene˜
t
throught
˜
j
:=
f
(˜
ν
j
)
. Wehave:If
ν
is a omputation node with onstrutor, destrutor or nonef
, thenS
′
=
S
. Ifm
:=
eval
f
(˜
t)
6=
⊥
,ν
′
isthe
yes
-suessorofν
inΠ
,andf
′
=
f
(ν
:=
m)
. Ifm
=
⊥
,thenν
′
isthe
no
-suessorofν
andf
′
=
f
.If
ν
is an input node, thenS
′
=
S
andν
′
isthe suessor of
ν
inΠ
and there exists anm
withS
⊢
CoSP
m
andf
′
=
f
(ν
:=
m)
.If
ν
isanoutput node,thenS
′
=
S
∪ {
˜
t1}
,ν
′
isthe suessor of
ν
inΠ
andf
′
=
f
.6
Note in [BHU09℄, there is an additional type of node, the non-deterministi node. We have omitted the
Alist of node identiers
(ν
i
)
isa nodetraeif thereisafulltraewiththese node identiers.⋄
Denition8(Computational implementation) Let a symboli model
M
= (
C
,
N
,
T
,
D
,
⊢
CoSP
)
be given. A omputational implementation ofM
is a family of funtionsImpl = (Impl
x
)
x
∈
C
∪
D
∪
N
suh thatImpl
f
forf
/n
∈
C
∪
D
is apartial deterministi funtion N×
({0,
1}
∗
)
n
→ {0,
1}
∗
, and
Impl
n
forn
∈
N
isatotalprobabilistifuntion withdomainNandrange
{0,
1}
∗
(i.e.,itspeiesaprobability
dis-tribution onbitstringsthat depends onitsargument). The rstargumentof
Impl
f
andImpl
n
represents the seurityparameter.Allfuntions
Impl
f
havetobeomputablein deterministipolynomial-time, andallImpl
n
havetobeomputableinprobabilisti polynomial-time.
⋄
Denition9(Computational exeution) Letasymbolimodel
M
= (
C
,
N
,
T
,
D
,
⊢
CoSP
)
, a omputa-tional implementationImpl
ofM
,anda CoSPprotoolΠ
begiven. Let aprobabilisti polynomial-timeinterative mahine
E
(theadversary) be given (polynomial-time in the sense that the number of steps in all ativations are bounded in the length of the rst input ofE
),and letp
be a polynomial. We de-neaprobability distributionNodes
p
M
,
Impl
,
Π
,E
(k)
,the omputationalnodetrae, on(nite)listsofnode identiers (ν
i
) aording tothe following probabilisti algorithm (both the algorithm andE
are run on inputk
):•
Initial state:ν1
:=
ν
is the root ofΠ
. Letf
be an initially empty partial funtion from nodeidentierstobitstrings, andlet
n
beaninitially emptypartialfuntion fromN
tobitstrings.•
Fori
= 2,
3, . . .
do the following:Let
ν
˜
bethe node identiersinthe annotation ofν
.m
˜
j
:=
f
(˜
ν
j
)
. Proeeddepending onthe typeof nodeν
:∗
Ifν
is aomputation node with nonen
∈
N
: Letm
′
:=
n(N
)
if
n(N
)
6=
⊥
and samplem
′
aording to
Impl
n
(k)
otherwise. Letν
′
be the yes-suessor of
ν
,f
′
:=
f
(ν
:=
m
′
)
,
and
n
′
:=
n(N
:=
m
′
)
. Let
ν
:=
ν
′
,
f
:=
f
′
and
n
:=
n
′
.
∗
Ifν
isa omputation node with onstrutor or destrutorf
, thenm
′
:= Impl
f
(k,
m)
˜
. Ifm
′
6=
⊥
, then
ν
′
is the
yes
-suessor ofν
, ifm
′
=
⊥
, then
ν
′
isthe
no
-suessor ofν
. Letf
′
:=
f
(ν
:=
m
′
)
. Letν
:=
ν
′
and
f
:=
f
′
.
∗
Ifν
isan inputnode,ask for abitstringm
fromE
. Abortthe loop ifE
halts. Letν
′
be
the suessor of
ν
. Letf
:=
f
(ν
:=
m)
andν
:=
ν
′
.
∗
Ifν
is anoutput node,sendm1
˜
toE
. Abort the loop ifE
halts. Letν
′
bethe suessor
of
ν
. Letν
:=
ν
′
.
∗
Ifν
is aontrol node, annotated with out-metadatal
, sendl
toE
. Abort the loop ifE
halts. Upon reeiving an answer
l
′
,let
ν
′
be the suessor of
ν
along the edge labeledl
′
(orthe lexiographially smallest edgeif thereisno edgewith label
l
′
). Let
ν
:=
ν
′
.
Let
ν
i
:=
ν
.Let
len
bethe number ofnodes fromthe roottoν
plusthe total lengthofall bitstringsinthe rangeoff
. Iflen
> p(k)
,stop.⋄
Denition10 (Trae property) A trae property
℘
is an eiently deidable and prex-losed set of (nite)listsof node identiers.Let
M
= (
C
,
N
,
T
,
D
,
⊢
CoSP
)
beasymbolimodelandΠ
aCoSPprotool. ThenΠ
symboliallysatises atrae property℘
ieverynode traeofΠ
isin℘
.Let
Impl
be a omputational implementation ofM
and letΠ
be a CoSP protool. Then(Π,
Impl)
omputationallysatisesatraeproperty
℘
ifor allprobabilistipolynomial-timeinterativemahinesE
andall polynomialsp
,Nodes
p
M
,
Impl
,
Π
,E
(k)
∈
℘
withoverwhelmingprobability.⋄
Denition11 (Computational soundness) A omputational implementation
Impl
of a symbolimodel
M
= (
C
,
N
,
T
,
D
,
⊢
CoSP
)
is omputationally sound for a lassP
of CoSP protools i for every trae property℘
andfor every eient CoSPprotoolΠ
,we have that(Π,
Impl)
omputationallyIn this paper, we do not restrit our attention to a spei symboli library. We instead provide a
omputational soundness result for any symboli library fullling ertain onditions that we detailin
thissetion.
4.1 The library
WerstdeneageneralDolev-Yaomodel,whihisasymboli modelsubjettoertainnatural
restri-tions.
Denition12 (DY Model) We say that a symboli model
M
= (
C
,
D
,
N
,
T
,
⊢
CoSP
)
is a DY model ifN
=
N
E
⊎
N
P
forountablyinniteN
E,
N
P
,andequals
/2
∈
D
whereequals
(x, x) :=
x
andequals
(x, y) :=
⊥
for
x
6=
y
, and⊢
CoSP
is the smallest relation suh thatm
∈
S
⇒
S
⊢
CoSP
m
,n
∈
NE
⇒
S
⊢
CoSP
n
, and suh that for any onstrutor or destrutorf
/n
∈
C
∪
D
and for anyt
1, . . . ,
tn
∈
T
satisfying∀i
∈
[1, n].S
⊢
CoSP
ti
and⊥ 6=
eval
f
(
t
1, . . . ,
tn
)
∈
T
,wehaveS
⊢
CoSP
f
(
t
1, . . . ,
tn
)
.⋄
Inthefollowing,wewillonlyreasonaboutDYmodels. Intuitively,inaDYlibraryeahCoSPtermmis
representedby
message
M
,wheremessage
isaprivateonstrutorthattagsallvalueswhihthelibrary operateson andM
is anenodingof m. CoSPonstrutors arerepresentedbyRCFonstrutors and nonesarerepresentedbyRCFnames. Foreahonstrutoranddestrutorf
,thelibraryexportsafun-tion
lib
f
suhthatσ
M
DY
(
lib
f
) (
message
M1, . . . ,
message
M
n
)
returnssome message
M
ifeval
f
(
m
1, . . . ,
mn
)
returnsm
,ornone
ifeval
f(
m
1, . . . ,
m
n
)
returns⊥
. Inaddition,thelibraryexportsafuntionnonce
that piksafreshname(tobeusedasanone)andfuntionssend
andrecv
forsendingandreeivingtermsoftheform
message
M
overapublihannel.For example, if we have a symboli model ontaining enryptions and deryptions (suh as the
one presented in Setion5.4), we would represent a iphertext with key
ek
(k)
and randomnessr
asmessage
(
enc
(
ek
(k), m, r))
. Thederyptionfuntioninthelibrarywouldthenbedenedbyσ
M
DY
(
lib
dec) :=
λx.
match
x
with
(
message
(
dk
(y)),
message
(
enc
(
ek
(y), z, w)))
then some
(
message
(z))
else none
. A nonewouldberepresentedas
message
(
nonce
(λx.a!x))
forsomefreshnamea
. 7InsteadofgivingadenitionthatisspeitoapartiularDYmodel,wewillgiveageneraldenition
ofaDYlibraryforaDYmodel. Inthefollowing,weassumeanarbitraryembedding
ι
oftermsT
into the set of losed RCF values. We further assume a xed namea
chan
used internally by the library for ommuniation and we assume that there is a value-ontextC
ι
[]
(a value with a hole) suh that{C
ι
[a] :
a
6=
a
chan
isaname}
=
ι(
N
)
.Denition13 (DY Library) A DY library for
M
= (
C
,
D
,
N
,
T
,
⊢
CoSP
)
is a substitutionσ
M
DY
from variables toRCFfuntionssatisfying the following onditions:•
Letmessage
beaprivateonstrutor.•
dom
σ
M
DY
=
{
lib
f
|
f
∈
C
∪
D
} ∪ {
nonce
,
send
,
recv
}
.•
σ
M
DY
(
lib
f
)
is a pure funtion suh that the following holds for allm
1, . . . ,
m
n
∈
T
: Ifm
:=
eval
f
(
m
1, . . . ,
m
n
)
6=
⊥
,thenσ
M
DY
(
lib
f
) (
message
ι(
m
1), . . . ,
message
ι(
m
n
))
→
∗
some message
ι(
m
)
.If
m
=
⊥
, thenσ
M
DY
(
lib
f
) (
message
ι(
m
1), . . . ,
message
ι(
m
n
))
→
∗
none
. In all other ases,σ
M
DY
(
lib
f
) (. . .)
isstuk.•
σ
M
DY
(
nonce
) =
fun
_→
νa.
message
C
ι
[a]
.•
σ
M
DY
(
send
) = (
fun
x
→
(
match
x
with message
_then
a
chan
!
message
x
else
stuck
))
. Herestuck
isa puredivergingRCF expression.•
σ
M
DY
(
recv
) =
fun
_→
a
chan
?
•
fv
(range(σ
M
DY
)) =
∅
andfn
(range(σ
M
DY
)) =
achan
.•
For any variablex
∈
dom
σ
M
DY
, andany mp-free valueM
6=
x
, we haveσ
M
DY
(x)
6=
M σ
DY
M
. (We allasubstitutionsatisfying thisonditionondition equality-friendly.)⋄
7Therequirement that
σ
M
DY
is equality-friendlyis a tehnial ondition to ensure that the outome of equality-testsin aprogram exeution doesnotdepend onthe internal ode of thelibraryfuntions.Forexample,ifwehadthat
σ
M
DY
(
lib
f
1
) = (λx.σ
M
DY
(
lib
f
2
)x)
,the testlib
f
1
= (λx.
lib
f
2
x)
wouldsueedin aprogramlinkedtoσ
M
DY
. Toavoidsuhdependeniesontheinternalodeofthelibrary,weintrodue equality-friendliness. Note that equality-friendliness is only neessary beause RCF allows syntatiequalitytestsonlambda-abstrations.
Equality-friendliness an be enfored, e.g., by requiring that all
σ(f
)
are expressions of the formλx.(
magic
;
A)
forsomeRCFexpressionA
wheremagic
:= (λz.
match
z
with message
y
then
()
else
())
.Tointerfaeanexpression
A
withalibraryσ
M
DY
,weusetheexpressionAσ
M
DY
. Wewillonlyonsider programsA
suh thatfn
(A) =
∅
andfv
(A)
⊆
dom
σ
M
DY
. Inσ
M
DY
,allmessagesM
are protetedby theprivateonstrutormessage
. However,ifanopponent wouldbeallowedtoperformapatternmathonmessage
,heouldgettheinternalrepresentationofM
andthus, e.g.,extrattheplaintextfromanenryption. Similarly,anadversaryapplyingmessage
ouldprodue invalid messages. Thus, when using
σ
M
DY
, wehave to restrit ourselvesto p-free opponents. Thefollowingvariantofrobust→
-safetymodelsthis.Denition14 (Robust
→
-σ
-safety) Letσ
beasubstitution. WeallanRCFexpressionaσ
-opponent ifv
(O)
⊆
dom
σ
andO
isp-freeandontainsneitherassertionsnorassumptions anda
chan
∈
/
fn
(O)
. An RCF expressionA
withfv
(A)
⊆
dom
σ
is robustly→
-σ
-safeitheappliation(O A)σ
is→
-safefor all
σ
-opponentsO
.⋄
Notethatin ontrasttoDenition 2,weexpliitlyapplythesubstitution
σ
representingthelibrary totheopponent. Thisis beauseap-freeopponenthasto invokelibraryfuntions inordertoperformenryptions,outputs,et. Furthermore,wewillalsoneedthattheprogramsweanalyzeoperateonterms
tagged by
message
onlythroughthelibrary. Inorderto enfore this(andother invariantsthat willbeusedinvarious loationsin theproofs)weintroduethefollowingwell-formednessondition:
Denition15 Let
A
be an RCF expression andM
= (
C
,
N
,
T
,
D
,
⊢)
a DY model. We sayM
⊢
A
ifv
(A)
⊆ {
lib
f
:
f
∈
C
∪
D
} ∪ {
nonce
,
send
,
recv
}
anda
chan
∈
/
fn
(A)
andA
is p-free and theFOL/F-formulaein
A
do notontainforbidden funtion symbols.⋄
4.2 Dolev-Yao transition relation
The COSP framework assumesthe atomiity of ryptographioperations. In general,however,
Dolev-Yao libraries may dene these operationsby a sequeneof ommands, whih may lead to non-atomi
omputations. For this reason, a onvenient tool for the embedding of a language in COSP is the
denition of a symboli semantis where ryptographi operations are exeuted atomially. This is
ahieved by dening anew redutionrelation
A
B
(f. Figure5), whih diersfrom the standard redutionrelationA
→
B
inthat ryptographioperationsareatomiallyperformed.Usingthe denition of , we anreformulate thenotion ofsafety. Our formulationis justied by
Lemma1below.
Denition16 ( -
σ
-Safety) A struture S is statiallyσ
-safe iP σ
⊢
Cσ
whereP
are the ative assumptions andC
the ativeassertionsofS.An expression
A
is -σ
-safeiffor allSsuhthatA
∗
Swe havethatSisstatially
σ
-safe.⋄
InontrasttoDenition14,whendeningrobustsafetywithrespetto ,wetonotapply
σ
tothe opponentortheprogram,beauseσ
ishard-odedinto :Denition17 (Robust -
σ
-safety) AnRCF expressionA
withfv
(A)
⊆
dom
σ
is robustly -σ
-safe ithe appliationO A
is -σ
-safe for allσ
-opponentsO
.⋄
Aneessaryingredientfortheomputationalsoundnessresultistheproofthatifaprogramis
→
-safe thenitisalso -σ
(λx.A)N
A
{
N/x
}
let
(x
1
, x
2
) = (N
1
, N
2
)
in
A
A
{
N
1
/x
1
, N
2
/x
2
}
match
M
with
h x
then
A
else
B
(
A
{
N/x
}
ifM
=
h N
forsomeN
B
otherwiseM
=
N
(
true
ifM
=
N
false
otherwisea!M
a?
M
assert
C
()
let
x
=
M
in
A
A
{
M/x
}
A
A
′
⇒
let
x
=
A
in
B
let
x
=
A
′
in
B
A
A
′
⇒
νa.A
νa.A
′
A
A
′
⇒
(A
B)
(A
′
B)
A
A
′
⇒
(B
A)
(B
A
′
)
A
≡
B
B
′
≡
A
′
=
⇒
A
A
′
send
(
message
M
)
a
chan
!
message
M
recv
N
a
chan
?
nonce
M
νa.
message
C
ι
[a]
σ
DY
M
(
lib
f
)
M
→
∗
N
=
⇒
lib
f
M
N
(
lib
f
∈
dom
σ
M
DY\{
send
,
recv
,
nonce
}
)
Figure5: Redutionrelation
A
B
Lemma1 Let
A
be p-free. IfAσ
M
DY
is→
-safe thenA
is -σ
M
DY
-safe.Proof. Bydenitionof
→
-safetyand -σ
M
DY
-safety,weonlyhavetoshowthatA
∗
B
implies
Aσ
M
DY
→
∗
Bσ
M
DY
. The proof is by strutural indution on the derivation ofA
∗
B
. The base ase is when
A
=
B
andno redutionstepisapplied, andtheproofis straightforward. Theindution asesarealsostraightforward,exeptfortheequality,math,andlibraryfuntionappliationrules.
Equality. Sine
→
testsM σ
M
DY
=
N σ
M
DY
while testsM
=
N
, we have to prove thatM σ
M
DY
=
N σ
M
DY
⇔
M
=
N
. The⇐
diretion isstraightforward. Forprovingthe⇒
diretion,weatually prove thatM
6=
N
⇒
M σ
M
DY
6=
N σ
M
DY
.Sine
A
is p-free,weaneasilysee thatB
is mp-free andthereforeM
andN
are mp-free. Now weproeedbystrutural indutiononM
. Werstreasononthebase ases:M
=
a
TheonlyinterestingaseiswhenN
=
x
. ByDenition 13,range
σ
M
DY
isasetoffuntions,heneσ
M
DY
(x)
6=
a
.M
= ()
Analogoustothepreviousitem.M
=
x
Theprooffollowsbyobservingthatσ
M
DY
isequality-friendly.Wenowreasonontheindution ases:
M
=
h M
′
&
N
=
h
′
N
′
&
h
6=
h
′
Welearlyhave
M σ
M
DY
6=
N σ
M
DY
.M
=
h M
′
&
N
=
h N
′
If
h
isapublionstrutor, thentheproof followsdiretly from theindution hypothesis. Ifh
isaprivateonstrutor, then we donotknowwhetherM
′
and
N
′
aremp-free
ornot. Wedo know,however,that theyare losed(byan inspetionof the -semantisand by
Denition 13). Therefore