File: raaz.cabal

package info (click to toggle)
haskell-raaz 0.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 844 kB
  • sloc: haskell: 5,045; ansic: 1,885; makefile: 18
file content (409 lines) | stat: -rw-r--r-- 13,560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
name:    raaz
version: 0.2.0

synopsis: The raaz cryptographic library.

description: Raaz is a cryptographic library for Haskell. The library
  is designed with a special emphasis on using the type system of
  Haskell to eliminate a large set of vulnerabilities like buffer
  overflows, timing attacks etc. It also strives to achieve this
  safety with no compromise on performance.

homepage: http://github.com/raaz-crypto/raaz

license:      BSD3
license-file: LICENSE
author:       Piyush P Kurur
maintainer:   ppk@cse.iitk.ac.in

category:      Codec, Raaz
build-type:    Simple
cabal-version: >=1.10

extra-source-files: CHANGELOG.md
                  , README.md
                  , Releasing.md
                  , Reviewing.md

bug-reports: https://github.com/raaz-crypto/raaz/issues

-- List of platform specific source files.
extra-source-files: entropy/urandom/Raaz/Entropy.hs
                    entropy/arc4random/Raaz/Entropy.hs
                    entropy/getrandom/Raaz/Entropy.hs
                    entropy/windows/Raaz/Entropy.hsc
                    -- The man page in markdown and its
                    -- makefile. Needs pandoc to build
                    mans/raaz.1.md
                    mans/Makefile
source-repository head
  type: git
  location: https://github.com/raaz-crypto/raaz

------------------------- Flags -------------------------------------------------------------

flag opt-native
     Description: Use optimisation for the platform on which it is being built. Do not enable this
        when cross compiling as it can break the implementation. Also tested only with gcc.
     Default: False
     Manual: True

flag vector128
     Description: Make use of vector instructions with size being 128. Do not enable this unless you have reasons
       to. It is better to use opt-native and opt-vectorise and let gcc have a go at the portable implementation
     Default: False
     Manual: True

flag vector256
     Description: Make use of gcc vector instructions with size being 256. Do not enable this unless you have reasons
       to. It is better to use opt-native and opt-vectorise and let gcc have a go at the portable implementation.
     Default: False
     Manual: True

flag vector512
     Description: Make use of gcc vector instructions with size being 512.
     Default: False
     Manual: True
flag avx2
     Description: Support avx2 optimisations. Warning: enable only if you are sure of support.
     Default: False
     Manual: True

flag linux-getrandom
     Description: Use the getrandom for system entropy instead of /dev/urandom. Available only on linux kernel > 3.17.
     Default: False
     Manual: True

flag liquidhaskell
     Description: Use liquid haskell form verifying properties. Only for developers.
     Default: False
     Manual: True

----------------------------- The library -----------------------------------------------------

library
  default-language: Haskell2010
  ghc-options: -Wall
  hs-source-dirs: .
  exposed-modules: Raaz
                 , Raaz.Core
                 , Raaz.Core.ByteSource
                 , Raaz.Core.CpuSupports
               --  , Raaz.Core.DH
                 , Raaz.Core.Encode
                 , Raaz.Core.Memory
                 , Raaz.Core.MonoidalAction
                 , Raaz.Core.Parse.Applicative
                 , Raaz.Core.Primitives
                 , Raaz.Core.Types
                 , Raaz.Core.Util
                 , Raaz.Core.Transfer
                 --
                 -- Cryptographic hashes
                 --
                 , Raaz.Hash
                 , Raaz.Hash.Internal
                 , Raaz.Hash.Blake2
                 , Raaz.Hash.Blake2.Implementation.CPortable
                 , Raaz.Hash.Sha1
                 , Raaz.Hash.Sha1.Implementation.CPortable
                 , Raaz.Hash.Sha224
                 , Raaz.Hash.Sha224.Implementation.CPortable
                 , Raaz.Hash.Sha256
                 , Raaz.Hash.Sha256.Implementation.CPortable
                 , Raaz.Hash.Sha384
                 , Raaz.Hash.Sha384.Implementation.CPortable
                 , Raaz.Hash.Sha512
                 , Raaz.Hash.Sha512.Implementation.CPortable
                 --
                 -- Ciphers
                 --
                 , Raaz.Cipher
                 , Raaz.Cipher.Internal
                 , Raaz.Cipher.AES
                 , Raaz.Cipher.AES.CBC.Implementation.CPortable
                 , Raaz.Cipher.ChaCha20
                 , Raaz.Cipher.ChaCha20.Implementation.CPortable
		 --
		 -- Randomness
		 --
                 , Raaz.Random
  other-modules: Raaz.Core.Constants
               , Raaz.Core.Encode.Internal
               , Raaz.Core.Encode.Base16
               , Raaz.Core.Encode.Base64
               , Raaz.Core.Util.ByteString
               , Raaz.Core.Types.Aligned
               , Raaz.Core.Types.Pointer
               , Raaz.Core.Types.Tuple
               , Raaz.Core.Types.Equality
               , Raaz.Core.Types.Endian
               , Raaz.Core.Types.Describe
               , Raaz.Core.Types.Copying
               --
               -- Hashes
               --
               , Raaz.Hash.Internal.HMAC
               , Raaz.Hash.Blake2.Internal
               , Raaz.Hash.Blake2.Recommendation
               , Raaz.Hash.Sha.Util
               , Raaz.Hash.Sha1.Internal
               , Raaz.Hash.Sha1.Recommendation
               , Raaz.Hash.Sha256.Recommendation
               , Raaz.Hash.Sha256.Internal
               , Raaz.Hash.Sha224.Recommendation
               , Raaz.Hash.Sha224.Internal
               , Raaz.Hash.Sha384.Recommendation
               , Raaz.Hash.Sha384.Internal
               , Raaz.Hash.Sha512.Recommendation
               , Raaz.Hash.Sha512.Internal
               --
               -- Internal modules from cipher
               --
               , Raaz.Cipher.AES.Internal
               , Raaz.Cipher.AES.Recommendation
               , Raaz.Cipher.ChaCha20.Internal
               , Raaz.Cipher.ChaCha20.Recommendation
               --
               -- Internal module for randomness
               --
               , Raaz.Random.ChaCha20PRG
               , Raaz.Entropy
               , Paths_raaz
  build-depends: base                           >= 4.6  &&  < 4.11
               , bytestring                     >= 0.9  &&  < 0.11
               , deepseq                        >= 1.1  &&  < 1.5
               , vector                         >= 0.7.1 && < 0.13
  if impl(ghc < 8)
    -- 'transformers' needed for "Control.Monad.IO.Class" only
    -- starting with base-4.9 we don't need 'transformers' anymore
    build-depends: transformers

  c-sources: cbits/raaz/core/endian.c
           -- hash implementations
           , cbits/raaz/hash/blake2/blake2b/portable.c
           , cbits/raaz/hash/blake2/blake2s/portable.c
           , cbits/raaz/hash/sha1/portable.c
           , cbits/raaz/hash/sha256/portable.c
           , cbits/raaz/hash/sha512/portable.c
           -- ciphers
           , cbits/raaz/cipher/aes/common.c
           , cbits/raaz/cipher/aes/cportable.c
           -- chacha20
           , cbits/raaz/cipher/chacha20/cportable.c
           -- memory management
           , cbits/raaz/core/memory.c
           -- cpu support
           , cbits/raaz/core/cpusupports.c
  include-dirs: cbits
  includes: raaz/core/endian.h
  install-includes: cbits/raaz/core/endian.h
                  , cbits/raaz/hash/blake2/common.h
                  , cbits/raaz/hash/blake2/blake2b/constants.h
                  , cbits/raaz/hash/blake2/blake2s/constants.h
                  , cbits/raaz/cipher/aes/common.h
                  , cbits/raaz/cipher/aes/cportable.h
                  , cbits/raaz/cipher/chacha20/common.h

  --------------------------- Options for vector instructions ---------------------------------
  if flag(opt-native)
    cc-options: -march=native

  if arch(x86_64)
    cc-options: -DARCH_X86_64

  if flag(vector128)
     cpp-options: -DHAVE_VECTOR_128
     cc-options:  -DHAVE_VECTOR_128
     exposed-modules: Raaz.Cipher.ChaCha20.Implementation.Vector128
     c-sources: cbits/raaz/cipher/chacha20/vector128.c

  if flag(vector256)
     cpp-options: -DHAVE_VECTOR_256
     cc-options:  -DHAVE_VECTOR_256
     exposed-modules: Raaz.Cipher.ChaCha20.Implementation.Vector256
     c-sources: cbits/raaz/cipher/chacha20/vector256.c

  if flag(avx2)
     cpp-options: -DHAVE_VECTOR_256
     cc-options:  -DHAVE_AVX2  -DHAVE_VECTOR_256
     if !flag(opt-native)
        cc-options: -mavx2
  if flag(vector512)
     cpp-options: -DHAVE_VECTOR_512
     cc-options:  -DHAVE_VECTOR_512

  ----------------------- System specific configurations ----------------------------------


  if os(linux)
     cc-options: -DPLATFORM_LINUX
  if os(osx)
     cc-options: -DPLATFORM_OSX
  if os(openbsd)
     cc-options: -DPLATFORM_OPENBSD
  if os(windows)
     cc-options: -DPLATFORM_WINDOWS -DUNICODE
     cpp-options: -DPLATFORM_WINDOWS
     extra-libraries: Advapi32, Kernel32
     build-tools: hsc2hs

  --------------------- Entropy ----------------------------------------------

  if os(openbsd) || os(netbsd)
    -- Entropy for openbsd using arc4random
    hs-source-dirs: entropy/arc4random
  else
    if os(linux) && flag(linux-getrandom)
        -- Use getentropy on linux
        hs-source-dirs: entropy/getrandom
    if os(windows)
        -- Use CryptGenRandom
        hs-source-dirs: entropy/windows
    else
        -- Entropy for generic posix by reading /dev/urandom
        hs-source-dirs: entropy/urandom


---------------------------- Executables -------------------------------------------------

executable raaz
  default-language: Haskell2010
  hs-source-dirs: bin
  main-is: Main.hs
  other-modules: Command.Checksum
               , Command.Rand
               , Command.CpuInfo
               , Usage
  build-depends: base
               , optparse-applicative >= 0.10.0
               , raaz
  if impl(ghc < 8)
    -- 'transformers' needed for "Control.Monad.IO.Class" only
    -- starting with base-4.9 we don't need 'transformers' anymore
    build-depends: transformers

---------------------------- Test suit -----------------------------------------------------

test-Suite spec
  default-language: Haskell2010
  type: exitcode-stdio-1.0
  hs-source-dirs: spec
  main-is: Spec.hs

  if flag(vector128)
     cpp-options: -DHAVE_VECTOR_128

  if flag(vector256)
     cpp-options:  -DHAVE_VECTOR_256
  if flag(vector512)
     cpp-options: -DHAVE_VECTOR_512

  if !os(windows)
     cpp-options: -DHAVE_DEV_NULL

  ghc-options: -Wall

  other-modules: Common
               , Common.Cipher
               , Common.Hash
               , Common.Imports
               , Common.Instances
               , Common.Utils
               , Raaz.Cipher.AESSpec
               , Raaz.Cipher.ChaCha20Spec
               , Raaz.Core.ByteSourceSpec
               , Raaz.Core.EncodeSpec
               , Raaz.Core.MemorySpec
               , Raaz.Core.Types.WordSpec
               , Raaz.Core.Util.ByteStringSpec
               , Raaz.RandomSpec
               , Raaz.Hash.Sha1Spec
               , Raaz.Hash.Sha224Spec
               , Raaz.Hash.Sha256Spec
               , Raaz.Hash.Sha384Spec
               , Raaz.Hash.Sha512Spec
               , Raaz.Hash.Blake2Spec


  build-depends: base
               , bytestring
               , HUnit                          >= 1.2
               , QuickCheck                     >= 2.4
               , hspec
               , transformers
               , raaz
               , vector

-------------------------- Liquid haskell verification -------------------------------------

test-Suite liquidspec
  hs-source-dirs: liquid
  default-language: Haskell2010
  main-is: LiquidSpec.hs
  type: exitcode-stdio-1.0
  build-depends: base


  if flag(liquidhaskell)
    build-depends: liquidhaskell                >=0.8
                 , directory
                 , filepath
    buildable: True
  else
    buildable: False

---------------------------------------------- Bench marks -----------------------------------------

benchmark blaze-vs-write
  hs-source-dirs: benchmarks
  default-language: Haskell2010
  main-is: BlazeVsWrite.hs
  type: exitcode-stdio-1.0
  build-depends: base
               , blaze-builder
               , bytestring
               , criterion >= 1.0
               , raaz


---------------------------------------------- Cipher implemntation benchmarks ----------------------

benchmark bench-ciphers
  hs-source-dirs: benchmarks
  default-language: Haskell2010
  if flag(vector128)
     cpp-options: -DHAVE_VECTOR_128
  if flag(vector256) || flag(avx2)
     cpp-options: -DHAVE_VECTOR_256
  if flag(vector512)
     cpp-options: -DHAVE_VECTOR_512

  main-is: Cipher.hs
  type: exitcode-stdio-1.0
  build-depends: base
               , blaze-builder
               , bytestring
               , criterion >= 1.0
               , raaz

-------------------------------- Benchmarking all primitives --------------------------------

benchmark primitives
  hs-source-dirs: benchmarks
  default-language: Haskell2010
  if flag(vector128)
     cpp-options: -DHAVE_VECTOR_128
  if flag(vector256) || flag(avx2)
     cpp-options: -DHAVE_VECTOR_256
  if flag(vector512)
     cpp-options: -DHAVE_VECTOR_512

  main-is: BenchPrimitives.hs
  type: exitcode-stdio-1.0
  build-depends: base
               , blaze-builder
               , bytestring
               , criterion >= 1.0
               , pretty
               , raaz