Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
a49911c
check in work in progress
pratapsingh1729 Mar 10, 2026
f3e9cb1
update CLAUDE.md
pratapsingh1729 Mar 10, 2026
536e8e7
resolve issues to do with concating ikm atoms
pratapsingh1729 Mar 10, 2026
e0c148b
fix I1
pratapsingh1729 Mar 10, 2026
36e6b86
resolve I10 superfluous issue
pratapsingh1729 Mar 11, 2026
aaed64a
resolve I9 multi-hint calls
pratapsingh1729 Mar 11, 2026
bc28a19
resolve I11
pratapsingh1729 Mar 11, 2026
e78b603
where clauses and note about wildcards
pratapsingh1729 Mar 11, 2026
7db5a20
check in implementation plan
pratapsingh1729 Mar 11, 2026
81bc6ef
update impl plan
pratapsingh1729 Mar 11, 2026
0e9ef20
kdf_group: mark steps 2, 3, 4 complete in progress checklist
pratapsingh1729 Mar 11, 2026
ff761e7
kdf_group step 1: add --only-parse flag to CmdArgs/Main
pratapsingh1729 Mar 11, 2026
de2acb4
kdf_group steps 2-4: AST types, parser, pretty-printer
pratapsingh1729 Mar 11, 2026
0c37cba
kdf_group steps 5-6: parse test files + verification
pratapsingh1729 Mar 11, 2026
8f8798c
kdf_group step 7: TypingBase — ModBody._kdfGroups, KDFGroupDef, looku…
pratapsingh1729 Mar 11, 2026
e52c393
kdf_group step 8: Typing — DeclKDFGroup elaboration, tryHint, CKDF re…
pratapsingh1729 Mar 11, 2026
313bfed
kdf_group step 9: LabelChecking — bare NT_KDF case
pratapsingh1729 Mar 11, 2026
4611f6c
kdf_group step 10-11: SMT unchanged, end-to-end compilation clean
pratapsingh1729 Mar 11, 2026
af50164
kdf_group: mark steps 7-11 complete in implementation plan
pratapsingh1729 Mar 11, 2026
b76dbdd
kdf_group: fix parser issues found during test verification
pratapsingh1729 Mar 11, 2026
ef3a79f
PathResolution: register kdf_group name and resolve DH localities
pratapsingh1729 Mar 12, 2026
d67d9f6
kdf_group: name kdfkey @ locality, fix name resolution
pratapsingh1729 Mar 12, 2026
47466b1
Parse.hs: support KDF<rule_refs; nks; j>(...) in name expressions
pratapsingh1729 Mar 12, 2026
3907e59
Thread kdf_group rule refs through KDFName for SecName integration
pratapsingh1729 Mar 12, 2026
48159cd
kdf_group: allow kdfkey names at multiple localities
pratapsingh1729 Mar 12, 2026
af40259
commit progress
pratapsingh1729 Mar 12, 2026
7a4d016
work on port
pratapsingh1729 Mar 12, 2026
db2b38e
SecName(KDF<...>(...)) syntax
pratapsingh1729 Mar 17, 2026
4f01a53
Merge branch 'kdf-groups-expts' into worktree-agent-a12914f9
pratapsingh1729 Mar 17, 2026
62760ee
Remove runtime args from KDFName: KDF<G.L<i>; kdfkey; 0> is now arg-free
pratapsingh1729 Mar 17, 2026
47eaa50
Remove InfoWildcard (_) from kdf_group info position
pratapsingh1729 Mar 17, 2026
1e1dac3
remove extraneous self field in KDFGroupRuleBody
pratapsingh1729 Mar 17, 2026
8b3c9e9
new and updated tests
pratapsingh1729 Mar 17, 2026
f3c9241
remove worktree from CLAUDE.md
pratapsingh1729 Mar 17, 2026
9e09099
simplify kdf_odh_decl_argument test a bit
pratapsingh1729 Mar 17, 2026
687c2bd
kdf_group args: add formal parameters to kdf/odh rule declarations
pratapsingh1729 Mar 17, 2026
745da46
parameter in where clause test
pratapsingh1729 Mar 18, 2026
a096313
tweak to parameter in where clause test
pratapsingh1729 Mar 18, 2026
1bfcf09
tweak to parameter in where clause test
pratapsingh1729 Mar 18, 2026
ed383a7
kdf_group where clause: support arbitrary Props (not just index equal…
pratapsingh1729 Mar 18, 2026
4b2c306
Parse: allow function-wrapped expressions in kdf_group salt position
pratapsingh1729 Mar 18, 2026
66dff0f
indices in functions
pratapsingh1729 Mar 18, 2026
ad05702
unlabeled test
pratapsingh1729 Mar 18, 2026
93a0ca3
support no hint kdf call
pratapsingh1729 Mar 18, 2026
51721a3
wireguard port parses but fails to typecheck. Currently it derives Da…
pratapsingh1729 Mar 18, 2026
b6ad417
add --no-color-output flag for plain-text error output
pratapsingh1729 Mar 18, 2026
73fe2d2
update CLAUDE.md
pratapsingh1729 Mar 19, 2026
9539731
KDFName carries exactly one rule ref
pratapsingh1729 Mar 19, 2026
41e4250
checkpoint: partially fixed up typechecking logic
pratapsingh1729 Mar 19, 2026
984d608
fix flow axiom generation
pratapsingh1729 Mar 19, 2026
c6e29c2
cleanup tryHint a bit
pratapsingh1729 Mar 20, 2026
aa0be4e
remove G. qualifier from tests
pratapsingh1729 Mar 20, 2026
6bfc7b3
update kdf-enc to remove G. qualifier
pratapsingh1729 Mar 20, 2026
0819026
update kdf-corr to remove G. qualifier
pratapsingh1729 Mar 20, 2026
3626cfd
remove namespace qualification in kdf groups
pratapsingh1729 Mar 20, 2026
0ebe838
update docs to remove qualifier
pratapsingh1729 Mar 20, 2026
0cd8645
add spans to kdf group members
pratapsingh1729 Mar 20, 2026
6c1485d
support KDF<...> syntax in salt and IKM names
pratapsingh1729 Mar 24, 2026
160ef79
make kdf-enc test use IKM too
pratapsingh1729 Mar 24, 2026
24772b4
update tests for no nametype
pratapsingh1729 Mar 24, 2026
a81b611
add soundness validation of kdf_group rules at declaration time
pratapsingh1729 Mar 25, 2026
b2bde1f
validate name kinds in kdf calls and KDF<> annotations against group …
pratapsingh1729 Mar 25, 2026
d5511c8
remove NameType field from KDFName AST node
pratapsingh1729 Mar 25, 2026
ef0108f
add wrong arg tests
pratapsingh1729 Mar 26, 2026
de58364
port all success tests except unauth_dh
pratapsingh1729 Mar 26, 2026
1eba062
update unauth_dh.owl
pratapsingh1729 Mar 26, 2026
96f8372
rename to _kgrBody
pratapsingh1729 Mar 26, 2026
59f4caa
cleanup rename
pratapsingh1729 Mar 26, 2026
72e29b5
cleanup extraneous
pratapsingh1729 Mar 26, 2026
a44d6bd
cleanup tests/wip dir
pratapsingh1729 Mar 26, 2026
d8bbbdb
more cleanup
pratapsingh1729 Mar 26, 2026
e4e4478
check all args public if no rule applies
pratapsingh1729 Mar 26, 2026
c0ec75a
two more tests
pratapsingh1729 Mar 26, 2026
0d8ee34
both DH keys must be local, outputs must be uniform
pratapsingh1729 Mar 26, 2026
df38181
disjointness check, but not sure if correct
pratapsingh1729 Mar 26, 2026
2206083
kdf_group -> kdf_scope
pratapsingh1729 Mar 27, 2026
7f9869c
multi-hint matching fix
pratapsingh1729 Mar 30, 2026
ad8d0bd
encode KDFName properly in SMT
pratapsingh1729 Mar 31, 2026
4f90757
proper out-of-bounds checking for ODH hints
pratapsingh1729 Mar 31, 2026
773048e
add cross-scope test, unclear whether it should work
pratapsingh1729 Mar 31, 2026
8aa237b
soup of decls version
pratapsingh1729 Apr 1, 2026
dd97e76
bugfix
pratapsingh1729 Apr 2, 2026
3df8e17
cross_dh_lemma maybe
pratapsingh1729 Apr 2, 2026
695e141
fix unsoundness when out-of-bounds check returns inconclusive
pratapsingh1729 Apr 9, 2026
dce2754
dh_combine -> dh_ss in odh decls
pratapsingh1729 Apr 9, 2026
30aef3c
start porting x3dh.owl
pratapsingh1729 Apr 14, 2026
ca4f09d
fix inconclusive in bob_x3dh, still have invalid encryption cases for…
pratapsingh1729 Apr 14, 2026
a3da605
out-of-band auth assumption for bob_x3dh
pratapsingh1729 Apr 14, 2026
3d55205
remove incorrect ODH disjointness check
pratapsingh1729 Apr 14, 2026
cc7486a
remove odh overlap test
pratapsingh1729 Apr 14, 2026
ec979ac
use dh_combine<name X,name Y>(...) syntax to remove need for explicit…
pratapsingh1729 Apr 14, 2026
01043d6
partially working port of x3dh, attempt at a junk secret for alice
pratapsingh1729 Apr 14, 2026
6327a76
add a mode to test without clearing the smt cache, to make the tests …
pratapsingh1729 Apr 14, 2026
63acd34
bob_x3dh typechecks, need to figure out how to fix the off-chain secr…
pratapsingh1729 Apr 15, 2026
e2318d0
x3dh that takes an explicit argument, TODO need authentication via ha…
pratapsingh1729 Apr 16, 2026
26b3e5f
small robustness checks, also add double_ratchet port (still WIP)
pratapsingh1729 Apr 16, 2026
903e89f
add kdf-scopes doc (generated with the assistance of AI but hand-audi…
pratapsingh1729 Apr 16, 2026
76374b5
doc name
pratapsingh1729 Apr 16, 2026
da625e1
self-disjointness check, causes x3dh to fail
pratapsingh1729 Apr 17, 2026
78c8b65
parsing issue
gancherj Apr 17, 2026
5247666
fix
gancherj Apr 17, 2026
0301576
allow general aexpr forms in salt/IKM in decls, process into atoms wh…
pratapsingh1729 Apr 17, 2026
a43eb16
some todos
gancherj Apr 18, 2026
0a4fdbd
refactor KDF scope decl checking to use the ReaderT env
pratapsingh1729 Apr 20, 2026
e8c5a86
fix path resolution issue where paths in KDF names were not being res…
pratapsingh1729 Apr 20, 2026
770d96c
fix variable shadowing issue in hpke, now have a pattern injectivity …
pratapsingh1729 Apr 20, 2026
721ab72
wg partial progress
pratapsingh1729 Apr 21, 2026
83c3172
check kdf rule components before processing them
pratapsingh1729 Apr 21, 2026
f036edd
todos in hpke
pratapsingh1729 Apr 21, 2026
efb9059
bad case in alice_send, fails due to missing kdf injectivity
pratapsingh1729 Apr 21, 2026
85bf50f
comment out lemma that doesn't work
pratapsingh1729 Apr 21, 2026
82e37ec
length axiom for KDF names
pratapsingh1729 Apr 22, 2026
5ce7523
add KDF ValueOf axioms connecting the KDF name expression to the gkdf…
pratapsingh1729 Apr 22, 2026
7c2f152
refactor to simplify away Rule vs RuleDecl distinction
pratapsingh1729 Apr 22, 2026
7247278
Fix typing rules for kdf
gancherj Apr 28, 2026
6c13e1c
tweaks
gancherj Apr 28, 2026
65baac5
basic auth for bob in x3dh, need to fix disjointness reasoning but ot…
pratapsingh1729 Apr 28, 2026
b09197a
fix unconcatIKM to allow vars
pratapsingh1729 Apr 29, 2026
8a7d24b
resolve
gancherj Apr 29, 2026
de972fd
remove guard on eph
gancherj Apr 29, 2026
eabc344
partial progress on wg
gancherj Apr 30, 2026
3d78705
bug fix todo
gancherj Apr 30, 2026
a3a7a20
fix nameExpInScope check
pratapsingh1729 Apr 30, 2026
2e3a798
wg work
gancherj May 7, 2026
6c5e7a1
wg init
gancherj May 7, 2026
2ed1385
manually write out kdf injectivity lemmas for wg init_stage_2, doesn'…
pratapsingh1729 May 7, 2026
586616e
use type to check secrecy of salt/ikm where necessary
pratapsingh1729 May 7, 2026
1606534
first attempt at adding explicit kdf_inj lemmas, currently in the typ…
pratapsingh1729 May 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
633 changes: 633 additions & 0 deletions docs/kdf-scopes.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion prelude.smt2
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@
:pattern (dh_combine (dhpk x) y)
:qid dh_combine_comm
)))

; Below two axioms are only sound if we have the "unique subgroup" property for the DH group
(assert (forall ((x Bits) (y Bits) (z Bits)) (!
(=> (and (IsExponent x) (IsExponent y) (= TRUE (is_group_elem z))
(= TRUE (eq (dh_combine z x) (dh_combine z y))))
Expand Down Expand Up @@ -330,7 +332,6 @@
; intersect. For soundness, this set must have measure zero

(declare-fun KDF (Bits Bits Bits Int Int) Bits)
(declare-fun KDFName (Bits Bits Bits Int Int) Name)

(assert (forall ((x Bits) (y Bits) (z Bits) (i Int) (j Int)) (!
(=>
Expand Down
99 changes: 71 additions & 28 deletions src/AST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ data KDFStrictness = KDFStrict | KDFPub | KDFUnstrict

data NameExpX =
NameConst ([Idx], [Idx]) Path [AExpr]
| KDFName AExpr AExpr AExpr [NameKind] Int NameType (Ignore Bool)
| KDFName [NameKind] Int (Ignore Bool) KDFScopeRuleRef
-- Ignore Bool is whether we trust that the name is well-formed
-- KDFScopeRuleRef identifies the kdf_scope rule that produced this name
deriving (Show, Generic, Typeable)


Expand Down Expand Up @@ -236,21 +237,16 @@ pHappened :: Path -> ([Idx], [Idx]) -> [AExpr] -> Prop
pHappened s ids xs = mkSpanned $ PHappened s ids xs


data KDFPos = KDF_SaltPos | KDF_IKMPos
deriving (Show, Generic, Typeable, Eq)

data NameTypeX =
NT_DH
| NT_Sig Ty
| NT_Nonce String
| NT_Nonce String
| NT_Enc Ty
| NT_StAEAD Ty (Bind (DataVar, DataVar) Prop) Path (Bind DataVar AExpr)
| NT_StAEAD Ty (Bind (DataVar, DataVar) Prop) Path (Bind DataVar AExpr)
| NT_PKE Ty
| NT_MAC Ty
| NT_App Path ([Idx], [Idx]) [AExpr]
| NT_KDF KDFPos
-- (Maybe (NameExp, Int, Int)) (Maybe (NameExp, Int, Int))
KDFBody
| NT_KDF -- bare kdfkey marker; no payload
deriving (Show, Generic, Typeable)


Expand Down Expand Up @@ -319,14 +315,37 @@ type ModuleExp = Spanned ModuleExpX
data DepBind a = DPDone a | DPVar Ty String (Bind DataVar (DepBind a))
deriving (Show, Generic, Typeable)

type KDFBody = Bind ((String, DataVar), (String, DataVar), (String, DataVar))
[Bind [IdxVar] (Prop, [(KDFStrictness, NameType)])]
-- New kdf_scope AST types

data KDFOutputSpec = KDFOutputSpec [(KDFStrictness, NameType)]
deriving (Show, Generic, Typeable)

data KDFScopeRuleBody = KDFScopeRuleBody {
_ksrbWhere :: Prop, -- PTrue when no where clause
_ksrbSalt :: AExpr,
_ksrbIkm :: AExpr,
_ksrbInfo :: AExpr,
_ksrbOutput :: KDFOutputSpec
} deriving (Show, Generic, Typeable)

data KDFScopeRuleX = KDFScopeRule {
_ksrIsODH :: Bool,
_ksrLabel :: String,
_ksrBody :: Bind (([IdxVar], [IdxVar]), [DataVar]) KDFScopeRuleBody
} deriving (Show, Generic, Typeable)

type KDFScopeRule = Spanned KDFScopeRuleX

data KDFScopeRuleRef = KDFScopeRuleRef {
_ksrrLabel :: String,
_ksrrIdxs :: ([Idx], [Idx]),
_ksrrArgs :: [AExpr]
} deriving (Show, Generic, Typeable)

-- Decls are surface syntax
data DeclX =
DeclName String (Bind ([IdxVar], [IdxVar]) NameDecl)
| DeclSMTOption String String
data DeclX =
DeclName String (Bind ([IdxVar], [IdxVar]) NameDecl)
| DeclSMTOption String String
| DeclDefHeader String (Bind ([IdxVar], [IdxVar]) Locality)
| DeclPredicate String (Bind ([IdxVar], [DataVar]) Prop)
| DeclFun String (Bind (([IdxVar], [IdxVar]), [DataVar]) AExpr)
Expand All @@ -336,17 +355,18 @@ data DeclX =
))
| DeclEnum String (Bind [IdxVar] [(String, Maybe Ty)]) -- Int is arity of indices
| DeclInclude String
| DeclCounter String (Bind ([IdxVar], [IdxVar]) Locality)
| DeclCounter String (Bind ([IdxVar], [IdxVar]) Locality)
| DeclStruct String (Bind [IdxVar] (DepBind ())) -- Int is arity of indices
| DeclODH String (Bind ([IdxVar], [IdxVar]) (NameExp, NameExp, KDFBody))
| DeclTy String (Maybe Ty)
| DeclNameType String (Bind (([IdxVar], [IdxVar]), [DataVar]) NameType)
| DeclDetFunc String DetFuncOps Int
| DeclTable String Ty Locality -- Only valid for localities without indices, for now
| DeclCorr (Bind ([IdxVar], [DataVar]) (Label, Label))
| DeclCorrGroup (Bind ([IdxVar], [DataVar]) [Label])
| DeclCorrGroup (Bind ([IdxVar], [DataVar]) [Label])
| DeclLocality String (Either Int Path)
| DeclModule String IsModuleType ModuleExp (Maybe ModuleExp)
| DeclModule String IsModuleType ModuleExp (Maybe ModuleExp)
| DeclKDFScope String [Decl]
| DeclKDFRule KDFScopeRuleX
deriving (Show, Generic, Typeable)

type Decl = Spanned DeclX
Expand Down Expand Up @@ -435,12 +455,8 @@ data ExprX =

type Expr = Spanned ExprX

type KDFSelector = (Int, [Idx])

data CryptOp =
CKDF [KDFSelector] [Either KDFSelector (String, ([Idx], [Idx]), KDFSelector)]
[NameKind]
Int
data CryptOp =
CKDF [KDFScopeRuleRef] [NameKind] Int
| CLemma BuiltinLemma
| CAEnc
| CADec
Expand Down Expand Up @@ -492,6 +508,10 @@ data FuncParam =
deriving (Show, Generic, Typeable)


makeLenses ''KDFScopeRuleBody
makeLenses ''KDFScopeRuleX
makeLenses ''KDFScopeRuleRef

-- LocallyNameless instances

$(makeClosedAlpha ''Position)
Expand Down Expand Up @@ -550,10 +570,25 @@ instance Subst Idx NameExpX
instance Subst AExpr NameExpX
instance Subst ResolvedPath NameExpX

instance Alpha KDFPos
instance Subst Idx KDFPos
instance Subst AExpr KDFPos
instance Subst ResolvedPath KDFPos
instance Alpha KDFOutputSpec
instance Subst Idx KDFOutputSpec
instance Subst AExpr KDFOutputSpec
instance Subst ResolvedPath KDFOutputSpec

instance Alpha KDFScopeRuleBody
instance Subst Idx KDFScopeRuleBody
instance Subst AExpr KDFScopeRuleBody
instance Subst ResolvedPath KDFScopeRuleBody

instance Alpha KDFScopeRuleX
instance Subst Idx KDFScopeRuleX
instance Subst AExpr KDFScopeRuleX
instance Subst ResolvedPath KDFScopeRuleX

instance Alpha KDFScopeRuleRef
instance Subst Idx KDFScopeRuleRef
instance Subst AExpr KDFScopeRuleRef
instance Subst ResolvedPath KDFScopeRuleRef

instance Alpha NameTypeX
instance Subst Idx NameTypeX
Expand Down Expand Up @@ -672,3 +707,11 @@ mkExistsIdx :: [IdxVar] -> Prop -> Prop
mkExistsIdx [] p = p
mkExistsIdx (x:xs) p = mkSpanned $ PQuantIdx Exists (ignore $ show x) $ bind x $ mkExistsIdx xs p

mkForallBv :: [DataVar] -> Prop -> Prop
mkForallBv [] p = p
mkForallBv (x:xs) p = mkSpanned $ PQuantBV Forall (ignore $ show x) $ bind x $ mkForallBv xs p

mkExistsBv :: [DataVar] -> Prop -> Prop
mkExistsBv [] p = p
mkExistsBv (x:xs) p = mkSpanned $ PQuantBV Exists (ignore $ show x) $ bind x $ mkExistsBv xs p

13 changes: 12 additions & 1 deletion src/CmdArgs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ data Flags = Flags {
_fDebugExtraction :: Bool,
_fExtractBufOpt :: Bool,
_fDoTests :: Bool,
_fTestWithSMTCache :: Bool,
_fLax :: Bool,
_fSkipRODisj :: Bool,
_fFilePath :: String,
_fLocalTypeError :: Bool,
_fLogTypecheck :: Bool,
_fOnlyCheck :: Maybe String,
_fOnlyParse :: Bool,
_fNoColor :: Bool,
_fFileContents :: String
}

Expand All @@ -48,6 +51,9 @@ parseArgs =
<*>
switch
( long "test" <> help "Do tests")
<*>
switch
( long "test-with-smtcache" <> help "Do tests without clearing the SMT cache" )
<*>
switch
( long "lax" <> help "Lax checking (skip some SMT queries)" )
Expand All @@ -62,6 +68,10 @@ parseArgs =
switch
( long "log-typecheck" <> help "Log typechecker progress" )
<*> option (Just <$> str) (long "only-check" <> help "Only check the given function" <> value Nothing)
<*> switch
( long "only-parse" <> help "Run parser only; print parsed module and exit" )
<*> switch
( long "no-color-output" <> help "Print errors without terminal colors (suitable for file output)" )
<*> (pure "")
where
extractAllFlag = switch (long "extract" <> short 'e' <> help "Extract all specs and code")
Expand All @@ -81,7 +91,8 @@ doParseArgs = do

postProcessFlags :: Flags -> Flags
postProcessFlags f =
f { _fCleanCache = _fCleanCache f || _fLogSMT f || _fDoTests f }
f { _fCleanCache = _fCleanCache f || _fLogSMT f || _fDoTests f,
_fDoTests = _fTestWithSMTCache f || _fDoTests f }

getHelpMessage :: String
getHelpMessage =
Expand Down
2 changes: 1 addition & 1 deletion src/Extraction/ConcreteAST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ instance Subst AExpr (CExpr t)
compatTys :: CTy -> CTy -> Bool
compatTys (CTName n1) (CTName n2) =
case (n1 ^. val, n2 ^. val) of
(KDFName _ _ _ nks1 i1 _ _, KDFName _ _ _ nks2 i2 _ _) ->
(KDFName nks1 i1 _ _, KDFName nks2 i2 _ _) ->
(nks1 !! i1) `aeq` (nks2 !! i2)
_ -> n1 `aeq` n2
compatTys (CTDH_PK _) (CTDH_PK _) = True
Expand Down
4 changes: 2 additions & 2 deletions src/Extraction/Concretify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ formatTyOfNameExp ne = do
fl <- fLenOfNameTy nt
sec <- secrecyOfNameTy nt
return $ FBuf sec $ Just fl
KDFName _ _ _ nks i _ _ -> do
KDFName nks i _ _ -> do
let nk = nks !! i
sec <- secrecyOfNameKind nk
FBuf sec . Just <$> fLenOfNameKind nk
Expand Down Expand Up @@ -748,7 +748,7 @@ tySigOfCall p = do


concretifyCryptOp :: [AExpr] -> CryptOp -> [CAExpr FormatTy] -> EM (CExpr FormatTy, [CLetBinding])
concretifyCryptOp resolvedArgs (CKDF _ _ nks nkidx) [salt, ikm, info] = do
concretifyCryptOp resolvedArgs (CKDF _ nks nkidx) [salt, ikm, info] = do
let nk = nks !! nkidx
kdfLen <- kdfLenOf nks
outLen <- fLenOfNameKind nk
Expand Down
29 changes: 1 addition & 28 deletions src/LabelChecking.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,34 +78,7 @@ nameDefFlows n nt = do
lv <- symLabel l
ln <- symLabel $ mkSpanned $ LName n
return $ sFlows lv ln
NT_KDF pos bnd -> do
ctr <- getFreshCtr
(((sx, x), (sy, y), (sz, z)), cases) <- liftCheck $ unbind bnd
-- TODO: below, we need to generealize
axs <- withSMTVars [x, y, z] $ do
axis <- forM [0 .. (length cases - 1)] $ \i -> do
(ixs, (p, nts)) <- liftCheck $ unbind $ cases !! i
axijs <- forM [0 .. (length nts - 1)] $ \j -> do
let (strictness, nt) = nts !! j
ne_axioms <- withSMTIndices (map (\i -> (i, IdxGhost)) ixs) $ do
nks <- liftCheck $ mapM (\(_, nt) -> getNameKind nt) nts
let ne = case pos of
KDF_SaltPos ->
mkSpanned $ KDFName (mkSpanned $ AEGet n) (aeVar' x) (aeVar' y) nks j nt (ignore True)
KDF_IKMPos ->
mkSpanned $ KDFName (aeVar' x) (mkSpanned $ AEGet n) (aeVar' y) nks j nt (ignore True)
nameDefFlows ne nt
ctr <- getFreshCtr
vp <- interpretProp p
return $ sForall (map (\i -> (SAtom $ cleanSMTIdent $ show i, indexSort)) ixs)
(sImpl vp ne_axioms)
[]
("ax_" ++ show ctr)
return $ sAnd axijs
return $ sAnd axis
let vx = SAtom (show x)
let vy = SAtom (show y)
return $ sForall [(vx, bitstringSort), (vy, bitstringSort)] axs [] ("kdfFlows_" ++ show ctr)
NT_KDF -> return $ SAtom "true" -- bare kdfkey marker; no flow axioms

smtLabelSetup :: Sym ()
smtLabelSetup = do
Expand Down
4 changes: 4 additions & 0 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Prettyprinter
import TypingBase
import System.FilePath
import CmdArgs
import Pretty
import System.Directory
import System.Process
import System.CPUTime
Expand Down Expand Up @@ -41,6 +42,9 @@ main = do
putStrLn $ "parse error: " ++ show err
exitFailure
Right ast -> do
when (args^.fOnlyParse) $ do
mapM_ (putStrLn . show . owlpretty) ast
exitSuccess
do
res <- typeCheckDecls (set fFileContents s args) ast
case res of
Expand Down
Loading