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