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