packages feed

lol-apps 0.2.0.1 → 0.2.0.2

raw patch · 4 files changed

+16/−69 lines, 4 filesdep −QuickCheckdep −arithmoidep −constraintsdep ~deepseqPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: QuickCheck, arithmoi, constraints, criterion, random, repa, test-framework-quickcheck2, transformers, vector

Dependency ranges changed: deepseq

API changes (from Hackage documentation)

- Crypto.Lol.Applications.SymmSHE: addScalar :: forall t m m' zp zq. (AddScalarCtx t m' zp zq) => zp -> CT m zp (Cyc t m' zq) -> CT m zp (Cyc t m' zq)
- Crypto.Lol.Applications.SymmSHE: instance (GHC.Classes.Eq zp, Crypto.Lol.Applications.SymmSHE.MulScalarCtx t m' zp zq, Crypto.Lol.FactoredDefs.Divides m m', Crypto.Lol.Applications.SymmSHE.ToSDCtx t m' zp zq) => Algebra.Additive.C (Crypto.Lol.Applications.SymmSHE.CT m zp (Crypto.Lol.Cyclotomic.Cyc.Cyc t m' zq))
- Crypto.Lol.Applications.SymmSHE: mulScalar :: (MulScalarCtx t m' zp zq) => zp -> CT m zp (Cyc t m' zq) -> CT m zp (Cyc t m' zq)
- Crypto.Lol.Applications.SymmSHE: type AddScalarCtx t m' zp zq = (Lift' zp, Reduce (LiftOf zp) zq, CElt t zp, CElt t (LiftOf zp), ToSDCtx t m' zp zq)
- Crypto.Lol.Applications.SymmSHE: type MulScalarCtx t m' zp zq = (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq)
+ Crypto.Lol.Applications.SymmSHE: instance (Crypto.Lol.Prelude.Lift' zp, Crypto.Lol.Prelude.Reduce (Crypto.Lol.Prelude.LiftOf zp) zq, Crypto.Lol.FactoredDefs.Fact m', Crypto.Lol.Cyclotomic.Cyc.CElt t zq, GHC.Classes.Eq zp, Crypto.Lol.FactoredDefs.Divides m m', Crypto.Lol.Applications.SymmSHE.ToSDCtx t m' zp zq) => Algebra.Additive.C (Crypto.Lol.Applications.SymmSHE.CT m zp (Crypto.Lol.Cyclotomic.Cyc.Cyc t m' zq))
- Crypto.Lol.Applications.SymmSHE: type AddPublicCtx t m m' zp zq = (AddScalarCtx t m' zp zq, m `Divides` m')
+ Crypto.Lol.Applications.SymmSHE: type AddPublicCtx t m m' zp zq = (Lift' zp, Reduce (LiftOf zp) zq, CElt t zp, CElt t (LiftOf zp), ToSDCtx t m' zp zq, m `Divides` m')
- Crypto.Lol.Applications.SymmSHE: type MulPublicCtx t m m' zp zq = (MulScalarCtx t m' zp zq, m `Divides` m', CElt t zp, CElt t (LiftOf zp))
+ Crypto.Lol.Applications.SymmSHE: type MulPublicCtx t m m' zp zq = (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq, m `Divides` m', CElt t zp, CElt t (LiftOf zp))

Files

CHANGES.md view
@@ -1,6 +1,10 @@ Changelog for lol project ================================ +0.2.0.2+----+ * Removed unnecessary dependencies.+ 0.2.0.1 ----  * Fixed compile error in KHPRFTests.
Crypto/Lol/Applications/SymmSHE.hs view
@@ -36,7 +36,7 @@ , encrypt , errorTerm, errorTermUnrestricted, decrypt, decryptUnrestricted -- * Arithmetic with public values-, addScalar, addPublic, mulScalar, mulPublic+, addPublic, mulPublic -- * Modulus switching , rescaleLinearCT, modSwitchPT -- * Key switching@@ -50,7 +50,7 @@ -- * Constraint synonyms , GenSKCtx, EncryptCtx, ToSDCtx, ErrorTermCtx , DecryptCtx, DecryptUCtx-, AddScalarCtx, AddPublicCtx, MulScalarCtx, MulPublicCtx, ModSwitchPTCtx+, AddPublicCtx, MulPublicCtx, ModSwitchPTCtx , KeySwitchCtx, KSHintCtx , GenTunnelInfoCtx, TunnelCtx , SwitchCtx, LWECtx -- these are internal, but exported for better docs@@ -359,21 +359,10 @@   in CT MSD k l $ P.fromCoeffs [c0,c1] + rescaleLinearMSD (switch hint c2')  ---------- Misc homomorphic operations ------------- | Constraint synonym for adding a public scalar to a ciphertext.-type AddScalarCtx t m' zp zq =-  (Lift' zp, Reduce (LiftOf zp) zq,-   CElt t zp, CElt t (LiftOf zp), ToSDCtx t m' zp zq) --- | Homomorphically add a public \(\mathbb{Z}_p\) value to an encrypted value.-addScalar :: forall t m m' zp zq . (AddScalarCtx t m' zp zq)-          => zp -> CT m zp (Cyc t m' zq) -> CT m zp (Cyc t m' zq)-addScalar b ct =-  let CT LSD k l c = toLSD ct-      b' = iterate mulG (scalarCyc $ b * recip l) !! k :: Cyc t m' zp-  in CT LSD k l $ c + (P.const $ reduce $ liftPow b')- -- | Constraint synonym for adding a public value to an encrypted value.-type AddPublicCtx t m m' zp zq = (AddScalarCtx t m' zp zq, m `Divides` m')+type AddPublicCtx t m m' zp zq = (Lift' zp, Reduce (LiftOf zp) zq,+   CElt t zp, CElt t (LiftOf zp), ToSDCtx t m' zp zq, m `Divides` m')  -- | Homomorphically add a public \( R_p \) value to an encrypted -- value.@@ -386,14 +375,9 @@       b' :: Cyc t m zq = reduce $ liftPow $ linv * (iterate mulG b !! k)   in CT LSD k l $ c + P.const (embed b') --- | Constraint synonym for multiplying a public scalar value with--- an encrypted value.-type MulScalarCtx t m' zp zq =-  (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq)- -- | Homomorphically multiply a public \(\mathbb{Z}_p\) value to an -- encrypted value.-mulScalar :: (MulScalarCtx t m' zp zq)+mulScalar :: (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq)   => zp -> CT m zp (Cyc t m' zq) -> CT m zp (Cyc t m' zq) mulScalar a (CT enc k l c) =   let a' = scalarCyc $ reduce $ lift a@@ -401,7 +385,8 @@  -- | Constraint synonym for multiplying a public value with an encrypted value. type MulPublicCtx t m m' zp zq =-  (MulScalarCtx t m' zp zq, m `Divides` m', CElt t zp, CElt t (LiftOf zp))+  (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq, m `Divides` m', +   CElt t zp, CElt t (LiftOf zp))  -- | Homomorphically multiply an encrypted value by a public \( R_p \) -- value.@@ -419,7 +404,8 @@  ---------- NumericPrelude instances ---------- -instance (Eq zp, MulScalarCtx t m' zp zq, m `Divides` m', ToSDCtx t m' zp zq)+instance (Lift' zp, Reduce (LiftOf zp) zq, Fact m', CElt t zq, -- mulScalar+          Eq zp, m `Divides` m', ToSDCtx t m' zp zq)          => Additive.C (CT m zp (Cyc t m' zq)) where    zero = CT LSD 0 one zero
lol-apps.cabal view
@@ -5,7 +5,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.2.0.1+version:             0.2.0.2 synopsis:            Lattice-based cryptographic applications using <https://hackage.haskell.org/package/lol lol>. homepage:            https://github.com/cpeikert/Lol Bug-Reports:         https://github.com/cpeikert/Lol/issues@@ -88,26 +88,15 @@   ghc-options:      -threaded -rtsopts    build-depends:-    arithmoi < 0.5,     base >= 4.9 && < 5,-    constraints < 0.10,-    deepseq < 1.5,-    DRBG < 0.6,     lol >= 0.6.0.0 && < 0.7,     lol-apps,     lol-cpp < 0.1,     lol-repa < 0.1,     lol-tests < 0.1,     MonadRandom < 0.6,-    mtl < 2.3,     numeric-prelude < 0.5,-    QuickCheck >= 2.8 && < 3.0,-    random < 1.2,---    repa < 3.5,-    singletons < 2.3,-    test-framework >= 0.8 &&  < 0.9,-    test-framework-quickcheck2 >= 0.3 && < 0.4,-    vector < 0.13+    test-framework >= 0.8 &&  < 0.9  Benchmark bench-apps   type:             exitcode-stdio-1.0@@ -124,11 +113,7 @@ --  ghc-options: -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000    build-depends:-    arithmoi < 0.5,     base >= 4.9 && < 5,-    containers < 0.6,-    criterion < 1.2,-    deepseq < 1.5,     DRBG < 0.6,     lol >= 0.6.0.0 && < 0.7,     lol-apps,@@ -137,11 +122,7 @@     lol-repa < 0.1,     MonadRandom < 0.6,     mtl < 2.3,-    numeric-prelude < 0.5,-    singletons < 2.3,-    transformers < 0.6,-    vector < 0.13,-    repa >=3.4 && < 3.5+    numeric-prelude < 0.5  executable homomprf   hs-source-dirs: examples@@ -153,7 +134,6 @@   ghc-options: -threaded -rtsopts -O2    build-depends:-    arithmoi < 0.5,     base >= 4.9 && < 5,     deepseq < 1.5,     DRBG < 0.6,@@ -176,7 +156,6 @@   ghc-options: -threaded -rtsopts -O2    build-depends:-    arithmoi < 0.5,     base >= 4.9 && < 5,     deepseq < 1.5,     lol >= 0.6.0.0 && < 0.7,@@ -195,7 +174,6 @@   ghc-options: -threaded -rtsopts -O2    build-depends:-    arithmoi < 0.5,     base >= 4.9 && < 5,     lol >= 0.6.0.0 && < 0.7,     lol-apps,
tests/SHETests.hs view
@@ -42,9 +42,7 @@   in testGroup (showType ptmr) $ ($ ptmr) <$> [    genTestArgs "DecU . Enc" prop_encDecU,    genTestArgs "AddPub"     prop_addPub,-   genTestArgs "MulScal"    prop_mulScal,    genTestArgs "MulPub"     prop_mulPub,-   genTestArgs "ScalarPub"  prop_addScalar,    genTestArgs "CTAdd"      prop_ctadd,    genTestArgs "CTAdd2"     prop_ctadd2,    genTestArgs "CTMul"      prop_ctmul,@@ -111,17 +109,6 @@       pt' = decryptUnrestricted sk ct'   return $ pt' == (a+pt) -prop_mulScal :: forall t m m' z zp zq . (z ~ LiftOf zp, _)-  => zp-     -> PT (Cyc t m zp)-     -> SK (Cyc t m' z)-     -> Test '(t,m,m',zp,zq)-prop_mulScal a pt sk = testIO $ do-  ct :: CT m zp (Cyc t m' zq) <- encrypt sk pt-  let ct' = mulScalar a ct-      pt' = decryptUnrestricted sk ct'-  return $ pt' == ((scalarCyc a) * pt)- prop_mulPub :: forall t m m' z zp zq . (z ~ LiftOf zp, _)   => Cyc t m zp      -> PT (Cyc t m zp)@@ -132,14 +119,6 @@   let ct' = mulPublic a ct       pt' = decryptUnrestricted sk ct'   return $ pt' == (a*pt)--prop_addScalar :: forall t m m' z zp zq . (z ~ LiftOf zp, _)-  => zp -> PT (Cyc t m zp) -> SK (Cyc t m' z) -> Test '(t,m,m',zp,zq)-prop_addScalar c pt sk = testIO $ do-  ct :: CT m zp (Cyc t m' zq) <- encrypt sk pt-  let ct' = addScalar c ct-      pt' = decryptUnrestricted sk ct'-  return $ pt' == ((scalarCyc c)+pt)  prop_ctadd :: forall t m m' z zp zq . (z ~ LiftOf zp, _)   => PT (Cyc t m zp)