1Name:                cryptonite
2version:             0.27
3Synopsis:            Cryptography Primitives sink
4Description:
5    A repository of cryptographic primitives.
6    .
7    * Symmetric ciphers: AES, DES, 3DES, CAST5, Blowfish, Twofish, Camellia, RC4, Salsa, XSalsa, ChaCha.
8    .
9    * Hash: SHA1, SHA2, SHA3, SHAKE, MD2, MD4, MD5, Keccak, Skein, Ripemd, Tiger, Whirlpool, Blake2
10    .
11    * MAC: HMAC, KMAC, Poly1305
12    .
13    * Asymmetric crypto: DSA, RSA, DH, ECDH, ECDSA, ECC, Curve25519, Curve448, Ed25519, Ed448
14    .
15    * Key Derivation Function: PBKDF2, Scrypt, HKDF, Argon2, BCrypt, BCryptPBKDF
16    .
17    * Cryptographic Random generation: System Entropy, Deterministic Random Generator
18    .
19    * Data related: Anti-Forensic Information Splitter (AFIS)
20    .
21    If anything cryptographic related is missing from here, submit
22    a pull request to have it added. This package strives to be a
23    cryptographic kitchen sink that provides cryptography for everyone.
24    .
25    Evaluate the security related to your requirements before using.
26    .
27    Read "Crypto.Tutorial" for a quick start guide.
28License:             BSD3
29License-file:        LICENSE
30Copyright:           Vincent Hanquez <vincent@snarc.org>
31Author:              Vincent Hanquez <vincent@snarc.org>
32Maintainer:          vincent@snarc.org
33Category:            Cryptography
34Stability:           experimental
35Build-Type:          Simple
36Homepage:            https://github.com/haskell-crypto/cryptonite
37Bug-reports:         https://github.com/haskell-crypto/cryptonite/issues
38Cabal-Version:       1.18
39tested-with:         GHC==8.8.2, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2
40extra-doc-files:     README.md CHANGELOG.md
41extra-source-files:  cbits/*.h
42                     cbits/aes/*.h
43                     cbits/ed25519/*.h
44                     cbits/decaf/include/*.h
45                     cbits/decaf/include/decaf/*.h
46                     cbits/decaf/include/arch_32/*.h
47                     cbits/decaf/include/arch_ref64/*.h
48                     cbits/decaf/p448/arch_32/*.h
49                     cbits/decaf/p448/arch_ref64/*.h
50                     cbits/decaf/p448/*.h
51                     cbits/decaf/ed448goldilocks/decaf_tables.c
52                     cbits/decaf/ed448goldilocks/decaf.c
53                     cbits/include32/p256/*.h
54                     cbits/include64/p256/*.h
55                     cbits/blake2/ref/*.h
56                     cbits/blake2/sse/*.h
57                     cbits/argon2/*.h
58                     cbits/argon2/*.c
59                     cbits/aes/x86ni_impl.c
60                     tests/*.hs
61
62source-repository head
63  type: git
64  location: https://github.com/haskell-crypto/cryptonite
65
66Flag support_aesni
67  Description:       allow compilation with AESNI on system and architecture that supports it
68  Default:           True
69  Manual:            True
70
71Flag support_rdrand
72  Description:       allow compilation with RDRAND on system and architecture that supports it
73  Default:           True
74  Manual:            True
75
76Flag support_pclmuldq
77  Description:       Allow compilation with pclmuldq on architecture that supports it
78  Default:           False
79  Manual:            True
80
81Flag support_sse
82  Description:       Use SSE optimized version of (BLAKE2, ARGON2)
83  Default:           False
84  Manual:            True
85
86Flag integer-gmp
87  Description:       Whether or not to use GMP for some functions
88  Default:           True
89  Manual:            True
90
91Flag support_deepseq
92  Description:       add deepseq instances for cryptographic types
93  Default:           True
94  Manual:            True
95
96Flag old_toolchain_inliner
97  Description:       use -fgnu89-inline to workaround an old compiler / linker / glibc issue.
98  Default:           False
99  Manual:            True
100
101Flag check_alignment
102  Description:       extra check on alignment in C layers, which cause lowlevel assert errors. for debugging only.
103  Default:           False
104  Manual:            True
105
106Flag use_target_attributes
107  Description:       use GCC / clang function attributes instead of global target options.
108  Default:           True
109  Manual:            True
110
111Library
112  Exposed-modules:   Crypto.Cipher.AES
113                     Crypto.Cipher.AESGCMSIV
114                     Crypto.Cipher.Blowfish
115                     Crypto.Cipher.CAST5
116                     Crypto.Cipher.Camellia
117                     Crypto.Cipher.ChaCha
118                     Crypto.Cipher.ChaChaPoly1305
119                     Crypto.Cipher.DES
120                     Crypto.Cipher.RC4
121                     Crypto.Cipher.Salsa
122                     Crypto.Cipher.TripleDES
123                     Crypto.Cipher.Twofish
124                     Crypto.Cipher.Types
125                     Crypto.Cipher.Utils
126                     Crypto.Cipher.XSalsa
127                     Crypto.ConstructHash.MiyaguchiPreneel
128                     Crypto.Data.AFIS
129                     Crypto.Data.Padding
130                     Crypto.ECC
131                     Crypto.ECC.Edwards25519
132                     Crypto.Error
133                     Crypto.MAC.CMAC
134                     Crypto.MAC.Poly1305
135                     Crypto.MAC.HMAC
136                     Crypto.MAC.KMAC
137                     Crypto.Number.Basic
138                     Crypto.Number.F2m
139                     Crypto.Number.Generate
140                     Crypto.Number.ModArithmetic
141                     Crypto.Number.Nat
142                     Crypto.Number.Prime
143                     Crypto.Number.Serialize
144                     Crypto.Number.Serialize.LE
145                     Crypto.Number.Serialize.Internal
146                     Crypto.Number.Serialize.Internal.LE
147                     Crypto.KDF.Argon2
148                     Crypto.KDF.PBKDF2
149                     Crypto.KDF.Scrypt
150                     Crypto.KDF.BCrypt
151                     Crypto.KDF.BCryptPBKDF
152                     Crypto.KDF.HKDF
153                     Crypto.Hash
154                     Crypto.Hash.IO
155                     Crypto.Hash.Algorithms
156                     Crypto.OTP
157                     Crypto.PubKey.Curve25519
158                     Crypto.PubKey.Curve448
159                     Crypto.PubKey.MaskGenFunction
160                     Crypto.PubKey.DH
161                     Crypto.PubKey.DSA
162                     Crypto.PubKey.ECC.Generate
163                     Crypto.PubKey.ECC.Prim
164                     Crypto.PubKey.ECC.DH
165                     Crypto.PubKey.ECC.ECDSA
166                     Crypto.PubKey.ECC.P256
167                     Crypto.PubKey.ECC.Types
168                     Crypto.PubKey.ECDSA
169                     Crypto.PubKey.ECIES
170                     Crypto.PubKey.Ed25519
171                     Crypto.PubKey.Ed448
172                     Crypto.PubKey.RSA
173                     Crypto.PubKey.RSA.PKCS15
174                     Crypto.PubKey.RSA.Prim
175                     Crypto.PubKey.RSA.PSS
176                     Crypto.PubKey.RSA.OAEP
177                     Crypto.PubKey.RSA.Types
178                     Crypto.PubKey.Rabin.OAEP
179                     Crypto.PubKey.Rabin.Basic
180                     Crypto.PubKey.Rabin.Modified
181                     Crypto.PubKey.Rabin.RW
182                     Crypto.PubKey.Rabin.Types
183                     Crypto.Random
184                     Crypto.Random.Types
185                     Crypto.Random.Entropy
186                     Crypto.Random.EntropyPool
187                     Crypto.Random.Entropy.Unsafe
188                     Crypto.System.CPU
189                     Crypto.Tutorial
190  Other-modules:     Crypto.Cipher.AES.Primitive
191                     Crypto.Cipher.Blowfish.Box
192                     Crypto.Cipher.Blowfish.Primitive
193                     Crypto.Cipher.CAST5.Primitive
194                     Crypto.Cipher.Camellia.Primitive
195                     Crypto.Cipher.DES.Primitive
196                     Crypto.Cipher.Twofish.Primitive
197                     Crypto.Cipher.Types.AEAD
198                     Crypto.Cipher.Types.Base
199                     Crypto.Cipher.Types.Block
200                     Crypto.Cipher.Types.GF
201                     Crypto.Cipher.Types.Stream
202                     Crypto.Cipher.Types.Utils
203                     Crypto.Error.Types
204                     Crypto.Number.Compat
205                     Crypto.Hash.Types
206                     Crypto.Hash.Blake2
207                     Crypto.Hash.Blake2s
208                     Crypto.Hash.Blake2sp
209                     Crypto.Hash.Blake2b
210                     Crypto.Hash.Blake2bp
211                     Crypto.Hash.SHA1
212                     Crypto.Hash.SHA224
213                     Crypto.Hash.SHA256
214                     Crypto.Hash.SHA384
215                     Crypto.Hash.SHA512
216                     Crypto.Hash.SHA512t
217                     Crypto.Hash.SHA3
218                     Crypto.Hash.SHAKE
219                     Crypto.Hash.Keccak
220                     Crypto.Hash.MD2
221                     Crypto.Hash.MD4
222                     Crypto.Hash.MD5
223                     Crypto.Hash.RIPEMD160
224                     Crypto.Hash.Skein256
225                     Crypto.Hash.Skein512
226                     Crypto.Hash.Tiger
227                     Crypto.Hash.Whirlpool
228                     Crypto.Random.Entropy.Source
229                     Crypto.Random.Entropy.Backend
230                     Crypto.Random.ChaChaDRG
231                     Crypto.Random.SystemDRG
232                     Crypto.Random.Probabilistic
233                     Crypto.PubKey.Internal
234                     Crypto.PubKey.ElGamal
235                     Crypto.ECC.Simple.Types
236                     Crypto.ECC.Simple.Prim
237                     Crypto.Internal.ByteArray
238                     Crypto.Internal.Compat
239                     Crypto.Internal.CompatPrim
240                     Crypto.Internal.DeepSeq
241                     Crypto.Internal.Imports
242                     Crypto.Internal.Nat
243                     Crypto.Internal.Words
244                     Crypto.Internal.WordArray
245  if impl(ghc < 8.0)
246    Buildable: False
247  else
248    Build-depends:   base
249
250  Build-depends:     bytestring
251                   , memory >= 0.14.18
252                   , basement >= 0.0.6
253                   , ghc-prim
254  ghc-options:       -Wall -fwarn-tabs -optc-O3
255  if os(linux)
256    extra-libraries: pthread
257  default-language:  Haskell2010
258  cc-options:        -std=gnu99
259  if flag(old_toolchain_inliner)
260    cc-options:      -fgnu89-inline
261  C-sources:         cbits/cryptonite_chacha.c
262                   , cbits/cryptonite_salsa.c
263                   , cbits/cryptonite_xsalsa.c
264                   , cbits/cryptonite_rc4.c
265                   , cbits/cryptonite_cpu.c
266                   , cbits/p256/p256.c
267                   , cbits/p256/p256_ec.c
268                   , cbits/cryptonite_blake2s.c
269                   , cbits/cryptonite_blake2sp.c
270                   , cbits/cryptonite_blake2b.c
271                   , cbits/cryptonite_blake2bp.c
272                   , cbits/cryptonite_poly1305.c
273                   , cbits/cryptonite_sha1.c
274                   , cbits/cryptonite_sha256.c
275                   , cbits/cryptonite_sha512.c
276                   , cbits/cryptonite_sha3.c
277                   , cbits/cryptonite_md2.c
278                   , cbits/cryptonite_md4.c
279                   , cbits/cryptonite_md5.c
280                   , cbits/cryptonite_ripemd.c
281                   , cbits/cryptonite_skein256.c
282                   , cbits/cryptonite_skein512.c
283                   , cbits/cryptonite_tiger.c
284                   , cbits/cryptonite_whirlpool.c
285                   , cbits/cryptonite_scrypt.c
286                   , cbits/cryptonite_pbkdf2.c
287                   , cbits/ed25519/ed25519.c
288  include-dirs:      cbits
289                   , cbits/ed25519
290                   , cbits/decaf/include
291                   , cbits/decaf/p448
292
293  if arch(x86_64) || arch(aarch64)
294    include-dirs:      cbits/include64
295  else
296    include-dirs:      cbits/include32
297
298  if arch(x86_64) || arch(aarch64)
299    C-sources:         cbits/decaf/p448/arch_ref64/f_impl.c
300                     , cbits/decaf/p448/f_generic.c
301                     , cbits/decaf/p448/f_arithmetic.c
302                     , cbits/decaf/utils.c
303                     , cbits/decaf/ed448goldilocks/scalar.c
304                     , cbits/decaf/ed448goldilocks/decaf_all.c
305                     , cbits/decaf/ed448goldilocks/eddsa.c
306
307    include-dirs:      cbits/decaf/include/arch_ref64
308                     , cbits/decaf/p448/arch_ref64
309  else
310    C-sources:         cbits/decaf/p448/arch_32/f_impl.c
311                     , cbits/decaf/p448/f_generic.c
312                     , cbits/decaf/p448/f_arithmetic.c
313                     , cbits/decaf/utils.c
314                     , cbits/decaf/ed448goldilocks/scalar.c
315                     , cbits/decaf/ed448goldilocks/decaf_all.c
316                     , cbits/decaf/ed448goldilocks/eddsa.c
317
318    include-dirs:      cbits/decaf/include/arch_32
319                     , cbits/decaf/p448/arch_32
320
321  if arch(x86_64) || arch(aarch64)
322    C-sources: cbits/curve25519/curve25519-donna-c64.c
323  else
324    C-sources: cbits/curve25519/curve25519-donna.c
325
326  -- FIXME armel or mispel is also little endian.
327  -- might be a good idea to also add a runtime autodetect mode.
328  -- ARCH_ENDIAN_UNKNOWN
329  if (arch(i386) || arch(x86_64))
330    CPP-options: -DARCH_IS_LITTLE_ENDIAN
331
332  if arch(i386)
333    CPP-options: -DARCH_X86
334
335  if arch(x86_64)
336    CPP-options: -DARCH_X86_64
337
338  if flag(support_rdrand) && (arch(i386) || arch(x86_64)) && !os(windows)
339    CPP-options:    -DSUPPORT_RDRAND
340    Other-modules:  Crypto.Random.Entropy.RDRand
341    c-sources:      cbits/cryptonite_rdrand.c
342
343  if flag(support_aesni) && (os(linux) || os(freebsd) || os(osx)) && (arch(i386) || arch(x86_64))
344    CC-options:     -DWITH_AESNI
345    if !flag(use_target_attributes)
346      CC-options:     -mssse3 -maes
347    if flag(support_pclmuldq)
348      CC-options:   -DWITH_PCLMUL
349      if !flag(use_target_attributes)
350        CC-options:     -msse4.1 -mpclmul
351    C-sources:       cbits/aes/x86ni.c
352                   , cbits/aes/generic.c
353                   , cbits/aes/gf.c
354                   , cbits/cryptonite_aes.c
355  else
356    C-sources:       cbits/aes/generic.c
357                   , cbits/aes/gf.c
358                   , cbits/cryptonite_aes.c
359
360  if arch(x86_64) || flag(support_sse)
361    C-sources:      cbits/blake2/sse/blake2s.c
362                  , cbits/blake2/sse/blake2sp.c
363                  , cbits/blake2/sse/blake2b.c
364                  , cbits/blake2/sse/blake2bp.c
365    include-dirs: cbits/blake2/sse
366  else
367    C-sources:      cbits/blake2/ref/blake2s-ref.c
368                  , cbits/blake2/ref/blake2sp-ref.c
369                  , cbits/blake2/ref/blake2b-ref.c
370                  , cbits/blake2/ref/blake2bp-ref.c
371    include-dirs: cbits/blake2/ref
372
373  if arch(x86_64) || flag(support_sse)
374    CPP-options:    -DSUPPORT_SSE
375    if arch(i386)
376      CC-options:   -msse2
377
378  C-sources:      cbits/argon2/argon2.c
379  include-dirs:   cbits/argon2
380
381  if os(windows)
382    cpp-options:    -DWINDOWS
383    Build-Depends:  Win32
384    Other-modules:  Crypto.Random.Entropy.Windows
385    extra-libraries: advapi32
386  else
387    Other-modules:  Crypto.Random.Entropy.Unix
388
389  if impl(ghc) && flag(integer-gmp)
390    Build-depends:   integer-gmp
391
392  if flag(support_deepseq)
393    CPP-options:     -DWITH_DEEPSEQ_SUPPORT
394    Build-depends:   deepseq
395  if flag(check_alignment)
396    cc-options:     -DWITH_ASSERT_ALIGNMENT
397  if flag(use_target_attributes)
398    cc-options:     -DWITH_TARGET_ATTRIBUTES
399
400Test-Suite test-cryptonite
401  type:              exitcode-stdio-1.0
402  hs-source-dirs:    tests
403  Main-is:           Tests.hs
404  Other-modules:     BlockCipher
405                     ChaCha
406                     BCrypt
407                     BCryptPBKDF
408                     ECC
409                     ECC.Edwards25519
410                     ECDSA
411                     Hash
412                     Imports
413                     KAT_AES.KATCBC
414                     KAT_AES.KATECB
415                     KAT_AES.KATGCM
416                     KAT_AES.KATCCM
417                     KAT_AES.KATOCB3
418                     KAT_AES.KATXTS
419                     KAT_AES
420                     KAT_AESGCMSIV
421                     KAT_AFIS
422                     KAT_Argon2
423                     KAT_Blowfish
424                     KAT_CAST5
425                     KAT_Camellia
426                     KAT_Curve25519
427                     KAT_Curve448
428                     KAT_DES
429                     KAT_Ed25519
430                     KAT_Ed448
431                     KAT_CMAC
432                     KAT_HKDF
433                     KAT_HMAC
434                     KAT_KMAC
435                     KAT_MiyaguchiPreneel
436                     KAT_PBKDF2
437                     KAT_OTP
438                     KAT_PubKey.DSA
439                     KAT_PubKey.ECC
440                     KAT_PubKey.ECDSA
441                     KAT_PubKey.OAEP
442                     KAT_PubKey.PSS
443                     KAT_PubKey.P256
444                     KAT_PubKey.RSA
445                     KAT_PubKey.Rabin
446                     KAT_PubKey
447                     KAT_RC4
448                     KAT_Scrypt
449                     KAT_TripleDES
450                     KAT_Twofish
451                     ChaChaPoly1305
452                     Number
453                     Number.F2m
454                     Padding
455                     Poly1305
456                     Salsa
457                     Utils
458                     XSalsa
459  Build-Depends:     base >= 0 && < 10
460                   , bytestring
461                   , memory
462                   , tasty
463                   , tasty-quickcheck
464                   , tasty-hunit
465                   , tasty-kat
466                   , cryptonite
467  ghc-options:       -Wall -fno-warn-orphans -fno-warn-missing-signatures -rtsopts
468  default-language:  Haskell2010
469
470Benchmark bench-cryptonite
471  type:              exitcode-stdio-1.0
472  hs-source-dirs:    benchs
473  Main-is:           Bench.hs
474  Other-modules:     Number.F2m
475  Build-Depends:     base
476                   , bytestring
477                   , deepseq
478                   , memory
479                   , gauge
480                   , random
481                   , cryptonite
482  ghc-options:       -Wall -fno-warn-missing-signatures
483  default-language:  Haskell2010
484