1Name:                cryptonite
2version:             0.28
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.RSA
174                     Crypto.PubKey.RSA.PKCS15
175                     Crypto.PubKey.RSA.Prim
176                     Crypto.PubKey.RSA.PSS
177                     Crypto.PubKey.RSA.OAEP
178                     Crypto.PubKey.RSA.Types
179                     Crypto.PubKey.Rabin.OAEP
180                     Crypto.PubKey.Rabin.Basic
181                     Crypto.PubKey.Rabin.Modified
182                     Crypto.PubKey.Rabin.RW
183                     Crypto.PubKey.Rabin.Types
184                     Crypto.Random
185                     Crypto.Random.Types
186                     Crypto.Random.Entropy
187                     Crypto.Random.EntropyPool
188                     Crypto.Random.Entropy.Unsafe
189                     Crypto.System.CPU
190                     Crypto.Tutorial
191  Other-modules:     Crypto.Cipher.AES.Primitive
192                     Crypto.Cipher.Blowfish.Box
193                     Crypto.Cipher.Blowfish.Primitive
194                     Crypto.Cipher.CAST5.Primitive
195                     Crypto.Cipher.Camellia.Primitive
196                     Crypto.Cipher.DES.Primitive
197                     Crypto.Cipher.Twofish.Primitive
198                     Crypto.Cipher.Types.AEAD
199                     Crypto.Cipher.Types.Base
200                     Crypto.Cipher.Types.Block
201                     Crypto.Cipher.Types.GF
202                     Crypto.Cipher.Types.Stream
203                     Crypto.Cipher.Types.Utils
204                     Crypto.Error.Types
205                     Crypto.Number.Compat
206                     Crypto.Hash.Types
207                     Crypto.Hash.Blake2
208                     Crypto.Hash.Blake2s
209                     Crypto.Hash.Blake2sp
210                     Crypto.Hash.Blake2b
211                     Crypto.Hash.Blake2bp
212                     Crypto.Hash.SHA1
213                     Crypto.Hash.SHA224
214                     Crypto.Hash.SHA256
215                     Crypto.Hash.SHA384
216                     Crypto.Hash.SHA512
217                     Crypto.Hash.SHA512t
218                     Crypto.Hash.SHA3
219                     Crypto.Hash.SHAKE
220                     Crypto.Hash.Keccak
221                     Crypto.Hash.MD2
222                     Crypto.Hash.MD4
223                     Crypto.Hash.MD5
224                     Crypto.Hash.RIPEMD160
225                     Crypto.Hash.Skein256
226                     Crypto.Hash.Skein512
227                     Crypto.Hash.Tiger
228                     Crypto.Hash.Whirlpool
229                     Crypto.Random.Entropy.Source
230                     Crypto.Random.Entropy.Backend
231                     Crypto.Random.ChaChaDRG
232                     Crypto.Random.SystemDRG
233                     Crypto.Random.Probabilistic
234                     Crypto.PubKey.Internal
235                     Crypto.PubKey.ElGamal
236                     Crypto.ECC.Simple.Types
237                     Crypto.ECC.Simple.Prim
238                     Crypto.Internal.ByteArray
239                     Crypto.Internal.Compat
240                     Crypto.Internal.CompatPrim
241                     Crypto.Internal.DeepSeq
242                     Crypto.Internal.Imports
243                     Crypto.Internal.Nat
244                     Crypto.Internal.Words
245                     Crypto.Internal.WordArray
246  if impl(ghc < 8.0)
247    Buildable: False
248  else
249    Build-depends:   base
250
251  Build-depends:     bytestring
252                   , memory >= 0.14.18
253                   , basement >= 0.0.6
254                   , ghc-prim
255  ghc-options:       -Wall -fwarn-tabs -optc-O3
256  if os(linux)
257    extra-libraries: pthread
258  default-language:  Haskell2010
259  cc-options:        -std=gnu99
260  if flag(old_toolchain_inliner)
261    cc-options:      -fgnu89-inline
262  C-sources:         cbits/cryptonite_chacha.c
263                   , cbits/cryptonite_salsa.c
264                   , cbits/cryptonite_xsalsa.c
265                   , cbits/cryptonite_rc4.c
266                   , cbits/cryptonite_cpu.c
267                   , cbits/p256/p256.c
268                   , cbits/p256/p256_ec.c
269                   , cbits/cryptonite_blake2s.c
270                   , cbits/cryptonite_blake2sp.c
271                   , cbits/cryptonite_blake2b.c
272                   , cbits/cryptonite_blake2bp.c
273                   , cbits/cryptonite_poly1305.c
274                   , cbits/cryptonite_sha1.c
275                   , cbits/cryptonite_sha256.c
276                   , cbits/cryptonite_sha512.c
277                   , cbits/cryptonite_sha3.c
278                   , cbits/cryptonite_md2.c
279                   , cbits/cryptonite_md4.c
280                   , cbits/cryptonite_md5.c
281                   , cbits/cryptonite_ripemd.c
282                   , cbits/cryptonite_skein256.c
283                   , cbits/cryptonite_skein512.c
284                   , cbits/cryptonite_tiger.c
285                   , cbits/cryptonite_whirlpool.c
286                   , cbits/cryptonite_scrypt.c
287                   , cbits/cryptonite_pbkdf2.c
288                   , cbits/ed25519/ed25519.c
289  include-dirs:      cbits
290                   , cbits/ed25519
291                   , cbits/decaf/include
292                   , cbits/decaf/p448
293
294  if arch(x86_64) || arch(aarch64)
295    include-dirs:      cbits/include64
296  else
297    include-dirs:      cbits/include32
298
299  if arch(x86_64) || arch(aarch64)
300    C-sources:         cbits/decaf/p448/arch_ref64/f_impl.c
301                     , cbits/decaf/p448/f_generic.c
302                     , cbits/decaf/p448/f_arithmetic.c
303                     , cbits/decaf/utils.c
304                     , cbits/decaf/ed448goldilocks/scalar.c
305                     , cbits/decaf/ed448goldilocks/decaf_all.c
306                     , cbits/decaf/ed448goldilocks/eddsa.c
307
308    include-dirs:      cbits/decaf/include/arch_ref64
309                     , cbits/decaf/p448/arch_ref64
310  else
311    C-sources:         cbits/decaf/p448/arch_32/f_impl.c
312                     , cbits/decaf/p448/f_generic.c
313                     , cbits/decaf/p448/f_arithmetic.c
314                     , cbits/decaf/utils.c
315                     , cbits/decaf/ed448goldilocks/scalar.c
316                     , cbits/decaf/ed448goldilocks/decaf_all.c
317                     , cbits/decaf/ed448goldilocks/eddsa.c
318
319    include-dirs:      cbits/decaf/include/arch_32
320                     , cbits/decaf/p448/arch_32
321
322  if arch(x86_64) || arch(aarch64)
323    C-sources: cbits/curve25519/curve25519-donna-c64.c
324  else
325    C-sources: cbits/curve25519/curve25519-donna.c
326
327  -- FIXME armel or mispel is also little endian.
328  -- might be a good idea to also add a runtime autodetect mode.
329  -- ARCH_ENDIAN_UNKNOWN
330  if (arch(i386) || arch(x86_64))
331    CPP-options: -DARCH_IS_LITTLE_ENDIAN
332
333  if arch(i386)
334    CPP-options: -DARCH_X86
335
336  if arch(x86_64)
337    CPP-options: -DARCH_X86_64
338
339  if flag(support_rdrand) && (arch(i386) || arch(x86_64)) && !os(windows)
340    CPP-options:    -DSUPPORT_RDRAND
341    Other-modules:  Crypto.Random.Entropy.RDRand
342    c-sources:      cbits/cryptonite_rdrand.c
343
344  if flag(support_aesni) && (os(linux) || os(freebsd) || os(osx)) && (arch(i386) || arch(x86_64))
345    CC-options:     -DWITH_AESNI
346    if !flag(use_target_attributes)
347      CC-options:     -mssse3 -maes
348    if flag(support_pclmuldq)
349      CC-options:   -DWITH_PCLMUL
350      if !flag(use_target_attributes)
351        CC-options:     -msse4.1 -mpclmul
352    C-sources:       cbits/aes/x86ni.c
353                   , cbits/aes/generic.c
354                   , cbits/aes/gf.c
355                   , cbits/cryptonite_aes.c
356  else
357    C-sources:       cbits/aes/generic.c
358                   , cbits/aes/gf.c
359                   , cbits/cryptonite_aes.c
360
361  if arch(x86_64) || flag(support_sse)
362    C-sources:      cbits/blake2/sse/blake2s.c
363                  , cbits/blake2/sse/blake2sp.c
364                  , cbits/blake2/sse/blake2b.c
365                  , cbits/blake2/sse/blake2bp.c
366    include-dirs: cbits/blake2/sse
367  else
368    C-sources:      cbits/blake2/ref/blake2s-ref.c
369                  , cbits/blake2/ref/blake2sp-ref.c
370                  , cbits/blake2/ref/blake2b-ref.c
371                  , cbits/blake2/ref/blake2bp-ref.c
372    include-dirs: cbits/blake2/ref
373
374  if arch(x86_64) || flag(support_sse)
375    CPP-options:    -DSUPPORT_SSE
376    if arch(i386)
377      CC-options:   -msse2
378
379  C-sources:      cbits/argon2/argon2.c
380  include-dirs:   cbits/argon2
381
382  if os(windows)
383    cpp-options:    -DWINDOWS
384    Build-Depends:  Win32
385    Other-modules:  Crypto.Random.Entropy.Windows
386    extra-libraries: advapi32
387  else
388    Other-modules:  Crypto.Random.Entropy.Unix
389
390  if impl(ghc) && flag(integer-gmp)
391    Build-depends:   integer-gmp
392
393  if flag(support_deepseq)
394    CPP-options:     -DWITH_DEEPSEQ_SUPPORT
395    Build-depends:   deepseq
396  if flag(check_alignment)
397    cc-options:     -DWITH_ASSERT_ALIGNMENT
398  if flag(use_target_attributes)
399    cc-options:     -DWITH_TARGET_ATTRIBUTES
400
401Test-Suite test-cryptonite
402  type:              exitcode-stdio-1.0
403  hs-source-dirs:    tests
404  Main-is:           Tests.hs
405  Other-modules:     BlockCipher
406                     ChaCha
407                     BCrypt
408                     BCryptPBKDF
409                     ECC
410                     ECC.Edwards25519
411                     ECDSA
412                     Hash
413                     Imports
414                     KAT_AES.KATCBC
415                     KAT_AES.KATECB
416                     KAT_AES.KATGCM
417                     KAT_AES.KATCCM
418                     KAT_AES.KATOCB3
419                     KAT_AES.KATXTS
420                     KAT_AES
421                     KAT_AESGCMSIV
422                     KAT_AFIS
423                     KAT_Argon2
424                     KAT_Blowfish
425                     KAT_CAST5
426                     KAT_Camellia
427                     KAT_Curve25519
428                     KAT_Curve448
429                     KAT_DES
430                     KAT_Ed25519
431                     KAT_Ed448
432                     KAT_CMAC
433                     KAT_HKDF
434                     KAT_HMAC
435                     KAT_KMAC
436                     KAT_MiyaguchiPreneel
437                     KAT_PBKDF2
438                     KAT_OTP
439                     KAT_PubKey.DSA
440                     KAT_PubKey.ECC
441                     KAT_PubKey.ECDSA
442                     KAT_PubKey.OAEP
443                     KAT_PubKey.PSS
444                     KAT_PubKey.P256
445                     KAT_PubKey.RSA
446                     KAT_PubKey.Rabin
447                     KAT_PubKey
448                     KAT_RC4
449                     KAT_Scrypt
450                     KAT_TripleDES
451                     KAT_Twofish
452                     ChaChaPoly1305
453                     Number
454                     Number.F2m
455                     Padding
456                     Poly1305
457                     Salsa
458                     Utils
459                     XSalsa
460  Build-Depends:     base >= 0 && < 10
461                   , bytestring
462                   , memory
463                   , tasty
464                   , tasty-quickcheck
465                   , tasty-hunit
466                   , tasty-kat
467                   , cryptonite
468  ghc-options:       -Wall -fno-warn-orphans -fno-warn-missing-signatures -rtsopts
469  default-language:  Haskell2010
470
471Benchmark bench-cryptonite
472  type:              exitcode-stdio-1.0
473  hs-source-dirs:    benchs
474  Main-is:           Bench.hs
475  Other-modules:     Number.F2m
476  Build-Depends:     base
477                   , bytestring
478                   , deepseq
479                   , memory
480                   , gauge
481                   , random
482                   , cryptonite
483  ghc-options:       -Wall -fno-warn-missing-signatures
484  default-language:  Haskell2010
485