packages feed

lol-0.5.0.2: lol.cabal

name:                lol
-- The package version.  See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
-- http://www.haskell.org/haskellwiki/Package_versioning_policy
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             0.5.0.2
synopsis:            A library for lattice cryptography.
homepage:            https://github.com/cpeikert/Lol
Bug-Reports:         https://github.com/cpeikert/Lol/issues
license:             GPL-2
license-file:        LICENSE
author:              Eric Crockett <ecrockett0@gmail.com>, Chris Peikert <cpeikert@alum.mit.edu>
maintainer:          Eric Crockett <ecrockett0@gmail.com>
copyright:           Eric Crockett, Chris Peikert
category:            Crypto
stability:           experimental
build-type:          Simple
extra-source-files:  README, CHANGES.md,
                     benchmarks/CycBenches.hs,
                     benchmarks/TensorBenches.hs,
                     benchmarks/UCycBenches.hs,
                     benchmarks/ZqBenches.hs,
                     tests/CycTests.hs,
                     tests/TensorTests.hs,
                     tests/ZqTests.hs,
                     utils/Apply.hs,
                     utils/Apply/Cyc.hs,
                     utils/Apply/Zq.hs,
                     utils/Benchmarks.hs,
                     utils/GenArgs.hs,
                     utils/GenArgs/Zq.hs,
                     utils/Tests.hs,
                     utils/TestTypes.hs,
                     utils/Utils.hs,
                     Crypto/Lol/Cyclotomic/Tensor/CTensor/*.h,
                     Crypto/Lol/Cyclotomic/Tensor/CTensor/*.cpp
cabal-version:       >= 1.10
description:
    Λ ∘ λ (Lol) is a general-purpose library for ring-based lattice cryptography.
    For a detailed description of interfaces and functionality, see
    <https://eprint.iacr.org/2015/1134 Λ ∘ λ: A Functional Library for Lattice Cryptography>.
    For example cryptographic applications, see <https://hackage.haskell.org/package/lol-apps lol-apps>.
source-repository head
  type: git
  location: https://github.com/cpeikert/Lol

-- For information on compiling C with cabal: http://blog.ezyang.com/2010/06/setting-up-cabal-the-ffi-and-c2hs/

Flag llvm
  Description:  Compile via LLVM. This produces much better object code,
                but you need to have the LLVM compiler installed.
  -- If you enable this and get errors like "Error: can't resolve `.rodata' {.rodata section}"
  -- then GHC doesn't like your version of LLVM!
  Default:      False

Flag opt
  Description: Turn on library optimizations
  Default:     True

library
  default-language:   Haskell2010
  ghc-options: -fwarn-dodgy-imports
  cc-options: -std=c++11
  Include-dirs: Crypto/Lol/Cyclotomic/Tensor/CTensor
  -- Due to #12152, the file containing the definition of `Zq::q` must be linked first,
  -- otherwise dynamic linking (`cabal repl` or `stack ghci`) results in the error:
  -- "Loading temp shared object failed: /tmp/ghc54651_0/libghc_1.so: undefined symbol _ZN2Zq1qE"
  -- For `cabal repl`, we can simply reorder the list so that the file that should be linked
  -- first comes first in the list. However `stack ghci` always links alphabetically,
  -- so we really just have to define `Zq::q` in the first file alphabetically.
  C-sources: Crypto/Lol/Cyclotomic/Tensor/CTensor/common.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/crt.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/g.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/l.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/mul.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/norm.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/random.cpp,
             Crypto/Lol/Cyclotomic/Tensor/CTensor/zq.cpp

  if flag(llvm)
    ghc-options: -fllvm -optlo-O3

  -- ghc optimizations
  if flag(opt)
    -- makes lift much faster!
    ghc-options: -funfolding-use-threshold1000
  exposed-modules:
    Crypto.Lol
    Crypto.Lol.Types
    Crypto.Lol.Factored
    Crypto.Lol.Reflects
    Crypto.Lol.CRTrans
    Crypto.Lol.Gadget
    Crypto.Lol.Prelude

    Crypto.Lol.Cyclotomic.Cyc
    Crypto.Lol.Cyclotomic.UCyc
    Crypto.Lol.Cyclotomic.RescaleCyc
    Crypto.Lol.Cyclotomic.Linear

    Crypto.Lol.RLWE.Continuous
    Crypto.Lol.RLWE.Discrete
    Crypto.Lol.RLWE.RLWR

    Crypto.Lol.Cyclotomic.Tensor
    Crypto.Lol.Cyclotomic.Tensor.CTensor
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor

    Crypto.Lol.Types.Random
    Crypto.Lol.Types.FiniteField
    Crypto.Lol.Types.IrreducibleChar2
    Crypto.Lol.Types.Proto
    Crypto.Lol.Types.RRq
    Crypto.Lol.Types.ZPP
    Crypto.Lol.Types.ZqBasic

    Crypto.Proto.RLWE
    Crypto.Proto.RLWE.Rq
    Crypto.Proto.RLWE.Kq
    Crypto.Proto.RLWE.SampleCont
    Crypto.Proto.RLWE.SampleDisc
    Crypto.Proto.RLWE.SampleRLWR

  other-modules:

    Crypto.Lol.PosBin
    Crypto.Lol.FactoredDefs
    Crypto.Lol.PosBinDefs
    Crypto.Lol.GaussRandom
    Crypto.Lol.Types.ZmStar
    Crypto.Lol.Types.Complex
    Crypto.Lol.Types.Numeric
    Crypto.Lol.Types.IZipVector
    Crypto.Lol.Cyclotomic.CRTSentinel
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor.CRT
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor.Extension
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor.Dec
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor.GL
    Crypto.Lol.Cyclotomic.Tensor.RepaTensor.RTCommon
    Crypto.Lol.Cyclotomic.Tensor.CTensor.Extension
    Crypto.Lol.Cyclotomic.Tensor.CTensor.Backend

  build-depends:
    arithmoi >= 0.4.1.3 && <0.5,
    base>=4.8 && <5,
    binary,
    bytestring,
    constraints,
    containers >= 0.5.6.2 && < 0.6,
    crypto-api,
    data-default >= 0.3.0 && < 0.8,
    deepseq >= 1.4.1.1 && <1.5,
    monadcryptorandom,
    MonadRandom >= 0.2 && < 0.5,
    mtl >= 2.2.1 && < 2.3,
    numeric-prelude >= 0.4.2 && < 0.5,
    QuickCheck >= 2.8 && < 2.9,
    protocol-buffers,
    protocol-buffers-descriptor,
    random >= 1.1 && < 1.2,
    reflection >= 1.5.1 && < 2.2,
    repa==3.4.*,
    singletons >= 1.1.2.1 && < 2.2,
    th-desugar >= 1.5.4 && < 1.7,
    tagged-transformer >= 0.7 && < 0.9,
    template-haskell  >=  2.2.0.0,
    transformers >= 0.4.2.0 && < 0.6,
    vector==0.11.*,
    vector-th-unbox >= 0.2.1.0 && < 0.3

  other-extensions: TemplateHaskell

test-suite test-lol
  type:               exitcode-stdio-1.0
  hs-source-dirs:     tests,utils
  default-language:   Haskell2010
  main-is:            Main.hs

  ghc-options: -threaded -rtsopts

  build-depends:
    arithmoi,
    base,
    constraints,
    deepseq,
    DRBG,
    lol,
    MonadRandom,
    mtl,
    QuickCheck >= 2.8 && < 2.9,
    random,
    repa,
    singletons,
    test-framework >= 0.8 && < 0.9,
    test-framework-quickcheck2 >= 0.3 && < 0.4,
    vector

Benchmark bench-lol
  type:               exitcode-stdio-1.0
  hs-source-dirs:     benchmarks,utils
  default-language:   Haskell2010
  main-is:            Main.hs

  if flag(llvm)
    ghc-options: -fllvm -optlo-O3
  ghc-options: -O2
  -- ghc-options: -ddump-to-file -ddump-simpl
  -- ghc-options: -dsuppress-coercions -dsuppress-type-applications -dsuppress-uniques -dsuppress-module-prefixes

  build-depends:
    ansi-terminal,
    arithmoi,
    base,
    containers,
    criterion,
    deepseq,
    DRBG,
    lol,
    MonadRandom,
    mtl,
    singletons,
    statistics,
    transformers,
    vector,
    repa