File: crypton.cabal

package info (click to toggle)
haskell-crypton 0.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,380 kB
  • sloc: ansic: 22,092; haskell: 18,717; makefile: 6
file content (529 lines) | stat: -rw-r--r-- 14,577 bytes parent folder | download
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
cabal-version:      1.18
name:               crypton
version:            0.34
license:            BSD3
license-file:       LICENSE
copyright:          Vincent Hanquez <vincent@snarc.org>
maintainer:         Kazu Yamamoto <kazu@iij.ad.jp>
author:             Vincent Hanquez <vincent@snarc.org>
stability:          experimental
tested-with:        ghc ==9.2.2 ghc ==9.0.2 ghc ==8.10.7 ghc ==8.8.4
homepage:           https://github.com/kazu-yamamoto/crypton
bug-reports:        https://github.com/kazu-yamamoto/crypton/issues
synopsis:           Cryptography Primitives sink
description:
    A repository of cryptographic primitives.
    .
    * Symmetric ciphers: AES, DES, 3DES, CAST5, Blowfish, Twofish, Camellia, RC4, Salsa, XSalsa, ChaCha.
    .
    * Hash: SHA1, SHA2, SHA3, SHAKE, MD2, MD4, MD5, Keccak, Skein, Ripemd, Tiger, Whirlpool, Blake2
    .
    * MAC: HMAC, KMAC, Poly1305
    .
    * Asymmetric crypto: DSA, RSA, DH, ECDH, ECDSA, ECC, Curve25519, Curve448, Ed25519, Ed448
    .
    * Key Derivation Function: PBKDF2, Scrypt, HKDF, Argon2, BCrypt, BCryptPBKDF
    .
    * Cryptographic Random generation: System Entropy, Deterministic Random Generator
    .
    * Data related: Anti-Forensic Information Splitter (AFIS)
    .
    If anything cryptographic related is missing from here, submit
    a pull request to have it added. This package strives to be a
    cryptographic kitchen sink that provides cryptography for everyone.
    .
    Evaluate the security related to your requirements before using.
    .
    Read "Crypto.Tutorial" for a quick start guide.

category:           Cryptography
build-type:         Simple
extra-source-files:
    cbits/*.h
    cbits/aes/*.h
    cbits/ed25519/*.h
    cbits/decaf/include/*.h
    cbits/decaf/include/decaf/*.h
    cbits/decaf/include/arch_32/*.h
    cbits/decaf/include/arch_ref64/*.h
    cbits/decaf/p448/arch_32/*.h
    cbits/decaf/p448/arch_ref64/*.h
    cbits/decaf/p448/*.h
    cbits/decaf/ed448goldilocks/decaf_tables.c
    cbits/decaf/ed448goldilocks/decaf.c
    cbits/include32/p256/*.h
    cbits/include64/p256/*.h
    cbits/blake2/ref/*.h
    cbits/blake2/sse/*.h
    cbits/argon2/*.h
    cbits/argon2/*.c
    cbits/aes/x86ni_impl.c
    cbits/crypton_hash_prefix.c
    tests/*.hs

extra-doc-files:
    README.md
    CHANGELOG.md

source-repository head
    type:     git
    location: https://github.com/kazu-yamamoto/crypton

flag support_aesni
    description:
        allow compilation with AESNI on system and architecture that supports it

    manual:      True

flag support_rdrand
    description:
        allow compilation with RDRAND on system and architecture that supports it

    manual:      True

flag support_pclmuldq
    description:
        Allow compilation with pclmuldq on architecture that supports it

    manual:      True

flag support_sse
    description: Use SSE optimized version of (BLAKE2, ARGON2)
    default:     False
    manual:      True

flag integer-gmp
    description: Whether or not to use GMP for some functions
    manual:      True

flag support_deepseq
    description: add deepseq instances for cryptographic types
    manual:      True

flag old_toolchain_inliner
    description:
        use -fgnu89-inline to workaround an old compiler / linker / glibc issue.

    default:     False
    manual:      True

flag check_alignment
    description:
        extra check on alignment in C layers, which cause lowlevel assert errors. for debugging only.

    default:     False
    manual:      True

flag use_target_attributes
    description:
        use GCC / clang function attributes instead of global target options.

    manual:      True

library
    exposed-modules:
        Crypto.Cipher.AES
        Crypto.Cipher.AESGCMSIV
        Crypto.Cipher.Blowfish
        Crypto.Cipher.CAST5
        Crypto.Cipher.Camellia
        Crypto.Cipher.ChaCha
        Crypto.Cipher.ChaChaPoly1305
        Crypto.Cipher.DES
        Crypto.Cipher.RC4
        Crypto.Cipher.Salsa
        Crypto.Cipher.TripleDES
        Crypto.Cipher.Twofish
        Crypto.Cipher.Types
        Crypto.Cipher.Utils
        Crypto.Cipher.XSalsa
        Crypto.ConstructHash.MiyaguchiPreneel
        Crypto.Data.AFIS
        Crypto.Data.Padding
        Crypto.ECC
        Crypto.ECC.Edwards25519
        Crypto.Error
        Crypto.MAC.CMAC
        Crypto.MAC.Poly1305
        Crypto.MAC.HMAC
        Crypto.MAC.KeyedBlake2
        Crypto.MAC.KMAC
        Crypto.Number.Basic
        Crypto.Number.F2m
        Crypto.Number.Generate
        Crypto.Number.ModArithmetic
        Crypto.Number.Nat
        Crypto.Number.Prime
        Crypto.Number.Serialize
        Crypto.Number.Serialize.LE
        Crypto.Number.Serialize.Internal
        Crypto.Number.Serialize.Internal.LE
        Crypto.KDF.Argon2
        Crypto.KDF.PBKDF2
        Crypto.KDF.Scrypt
        Crypto.KDF.BCrypt
        Crypto.KDF.BCryptPBKDF
        Crypto.KDF.HKDF
        Crypto.Hash
        Crypto.Hash.IO
        Crypto.Hash.Algorithms
        Crypto.OTP
        Crypto.PubKey.Curve25519
        Crypto.PubKey.Curve448
        Crypto.PubKey.MaskGenFunction
        Crypto.PubKey.DH
        Crypto.PubKey.DSA
        Crypto.PubKey.ECC.Generate
        Crypto.PubKey.ECC.Prim
        Crypto.PubKey.ECC.DH
        Crypto.PubKey.ECC.ECDSA
        Crypto.PubKey.ECC.P256
        Crypto.PubKey.ECC.Types
        Crypto.PubKey.ECDSA
        Crypto.PubKey.ECIES
        Crypto.PubKey.Ed25519
        Crypto.PubKey.Ed448
        Crypto.PubKey.EdDSA
        Crypto.PubKey.RSA
        Crypto.PubKey.RSA.PKCS15
        Crypto.PubKey.RSA.Prim
        Crypto.PubKey.RSA.PSS
        Crypto.PubKey.RSA.OAEP
        Crypto.PubKey.RSA.Types
        Crypto.PubKey.Rabin.OAEP
        Crypto.PubKey.Rabin.Basic
        Crypto.PubKey.Rabin.Modified
        Crypto.PubKey.Rabin.RW
        Crypto.PubKey.Rabin.Types
        Crypto.Random
        Crypto.Random.Types
        Crypto.Random.Entropy
        Crypto.Random.EntropyPool
        Crypto.Random.Entropy.Unsafe
        Crypto.System.CPU
        Crypto.Tutorial

    cc-options:       -std=gnu99
    c-sources:
        cbits/crypton_chacha.c
        cbits/crypton_salsa.c
        cbits/crypton_xsalsa.c
        cbits/crypton_rc4.c
        cbits/crypton_cpu.c
        cbits/p256/p256.c
        cbits/p256/p256_ec.c
        cbits/crypton_blake2s.c
        cbits/crypton_blake2sp.c
        cbits/crypton_blake2b.c
        cbits/crypton_blake2bp.c
        cbits/crypton_poly1305.c
        cbits/crypton_sha1.c
        cbits/crypton_sha256.c
        cbits/crypton_sha512.c
        cbits/crypton_sha3.c
        cbits/crypton_md2.c
        cbits/crypton_md4.c
        cbits/crypton_md5.c
        cbits/crypton_ripemd.c
        cbits/crypton_skein256.c
        cbits/crypton_skein512.c
        cbits/crypton_tiger.c
        cbits/crypton_whirlpool.c
        cbits/crypton_scrypt.c
        cbits/crypton_pbkdf2.c
        cbits/ed25519/ed25519.c
        cbits/argon2/argon2.c

    other-modules:
        Crypto.Cipher.AES.Primitive
        Crypto.Cipher.Blowfish.Box
        Crypto.Cipher.Blowfish.Primitive
        Crypto.Cipher.CAST5.Primitive
        Crypto.Cipher.Camellia.Primitive
        Crypto.Cipher.DES.Primitive
        Crypto.Cipher.Twofish.Primitive
        Crypto.Cipher.Types.AEAD
        Crypto.Cipher.Types.Base
        Crypto.Cipher.Types.Block
        Crypto.Cipher.Types.GF
        Crypto.Cipher.Types.Stream
        Crypto.Cipher.Types.Utils
        Crypto.Error.Types
        Crypto.Number.Compat
        Crypto.Hash.Types
        Crypto.Hash.Blake2
        Crypto.Hash.Blake2s
        Crypto.Hash.Blake2sp
        Crypto.Hash.Blake2b
        Crypto.Hash.Blake2bp
        Crypto.Hash.SHA1
        Crypto.Hash.SHA224
        Crypto.Hash.SHA256
        Crypto.Hash.SHA384
        Crypto.Hash.SHA512
        Crypto.Hash.SHA512t
        Crypto.Hash.SHA3
        Crypto.Hash.SHAKE
        Crypto.Hash.Keccak
        Crypto.Hash.MD2
        Crypto.Hash.MD4
        Crypto.Hash.MD5
        Crypto.Hash.RIPEMD160
        Crypto.Hash.Skein256
        Crypto.Hash.Skein512
        Crypto.Hash.Tiger
        Crypto.Hash.Whirlpool
        Crypto.Random.Entropy.Source
        Crypto.Random.Entropy.Backend
        Crypto.Random.ChaChaDRG
        Crypto.Random.SystemDRG
        Crypto.Random.Probabilistic
        Crypto.PubKey.Internal
        Crypto.PubKey.ElGamal
        Crypto.ECC.Simple.Types
        Crypto.ECC.Simple.Prim
        Crypto.Internal.Builder
        Crypto.Internal.ByteArray
        Crypto.Internal.Compat
        Crypto.Internal.CompatPrim
        Crypto.Internal.DeepSeq
        Crypto.Internal.Imports
        Crypto.Internal.Nat
        Crypto.Internal.Words
        Crypto.Internal.WordArray

    default-language: Haskell2010
    include-dirs:
        cbits cbits/ed25519 cbits/decaf/include cbits/decaf/p448
        cbits/argon2

    ghc-options:      -Wall -fwarn-tabs -optc-O3
    build-depends:
        bytestring,
        memory >=0.14.18,
        basement >=0.0.6,
        ghc-prim

    if impl(ghc <8.8)
        buildable: False

    else
        build-depends: base

    if os(linux)
        extra-libraries: pthread

    if flag(old_toolchain_inliner)
        cc-options: -fgnu89-inline

    if (arch(x86_64) || arch(aarch64))
        include-dirs: cbits/include64

    else
        include-dirs: cbits/include32

    if (arch(x86_64) || arch(aarch64))
        c-sources:
            cbits/decaf/p448/arch_ref64/f_impl.c
            cbits/decaf/p448/f_generic.c
            cbits/decaf/p448/f_arithmetic.c
            cbits/decaf/utils.c
            cbits/decaf/ed448goldilocks/scalar.c
            cbits/decaf/ed448goldilocks/decaf_all.c
            cbits/decaf/ed448goldilocks/eddsa.c

        include-dirs: cbits/decaf/include/arch_ref64 cbits/decaf/p448/arch_ref64

    else
        c-sources:
            cbits/decaf/p448/arch_32/f_impl.c
            cbits/decaf/p448/f_generic.c
            cbits/decaf/p448/f_arithmetic.c
            cbits/decaf/utils.c
            cbits/decaf/ed448goldilocks/scalar.c
            cbits/decaf/ed448goldilocks/decaf_all.c
            cbits/decaf/ed448goldilocks/eddsa.c

        include-dirs: cbits/decaf/include/arch_32 cbits/decaf/p448/arch_32

    if (arch(x86_64) || arch(aarch64))
        c-sources: cbits/curve25519/curve25519-donna-c64.c

    else
        c-sources: cbits/curve25519/curve25519-donna.c

    if (arch(i386) || arch(x86_64))
        cpp-options: -DARCH_IS_LITTLE_ENDIAN

    if arch(i386)
        cpp-options: -DARCH_X86

    if arch(x86_64)
        cpp-options: -DARCH_X86_64

    if ((flag(support_rdrand) && (arch(i386) || arch(x86_64))) && !os(windows))
        cpp-options:   -DSUPPORT_RDRAND
        c-sources:     cbits/crypton_rdrand.c
        other-modules: Crypto.Random.Entropy.RDRand

    if ((flag(support_aesni) && ((os(linux) || os(freebsd)) || os(osx))) && (arch(i386) || arch(x86_64)))
        cc-options: -DWITH_AESNI
        c-sources:
            cbits/aes/x86ni.c
            cbits/aes/generic.c
            cbits/aes/gf.c
            cbits/crypton_aes.c

        if !flag(use_target_attributes)
            cc-options: -mssse3 -maes

        if flag(support_pclmuldq)
            cc-options: -DWITH_PCLMUL

            if !flag(use_target_attributes)
                cc-options: -msse4.1 -mpclmul

    else
        c-sources:
            cbits/aes/generic.c
            cbits/aes/gf.c
            cbits/crypton_aes.c

    if (arch(x86_64) || flag(support_sse))
        c-sources:
            cbits/blake2/sse/blake2s.c
            cbits/blake2/sse/blake2sp.c
            cbits/blake2/sse/blake2b.c
            cbits/blake2/sse/blake2bp.c

        include-dirs: cbits/blake2/sse

    else
        c-sources:
            cbits/blake2/ref/blake2s-ref.c
            cbits/blake2/ref/blake2sp-ref.c
            cbits/blake2/ref/blake2b-ref.c
            cbits/blake2/ref/blake2bp-ref.c

        include-dirs: cbits/blake2/ref

    if (arch(x86_64) || flag(support_sse))
        cpp-options: -DSUPPORT_SSE

        if arch(i386)
            cc-options: -msse2

    if os(windows)
        cpp-options:     -DWINDOWS
        other-modules:   Crypto.Random.Entropy.Windows
        extra-libraries: advapi32
        build-depends:   Win32

    else
        other-modules: Crypto.Random.Entropy.Unix

    if (impl(ghc >=0) && flag(integer-gmp))
        build-depends: integer-gmp

    if flag(support_deepseq)
        cpp-options:   -DWITH_DEEPSEQ_SUPPORT
        build-depends: deepseq

    if flag(check_alignment)
        cc-options: -DWITH_ASSERT_ALIGNMENT

    if flag(use_target_attributes)
        cc-options: -DWITH_TARGET_ATTRIBUTES

test-suite test-crypton
    type:             exitcode-stdio-1.0
    main-is:          Tests.hs
    hs-source-dirs:   tests
    other-modules:
        BlockCipher
        ChaCha
        BCrypt
        BCryptPBKDF
        ECC
        ECC.Edwards25519
        ECDSA
        Hash
        Imports
        KAT_AES.KATCBC
        KAT_AES.KATECB
        KAT_AES.KATGCM
        KAT_AES.KATCCM
        KAT_AES.KATOCB3
        KAT_AES.KATXTS
        KAT_AES
        KAT_AESGCMSIV
        KAT_AFIS
        KAT_Argon2
        KAT_Blowfish
        KAT_CAST5
        KAT_Camellia
        KAT_Curve25519
        KAT_Curve448
        KAT_DES
        KAT_Ed25519
        KAT_Ed448
        KAT_EdDSA
        KAT_Blake2
        KAT_CMAC
        KAT_HKDF
        KAT_HMAC
        KAT_KMAC
        KAT_MiyaguchiPreneel
        KAT_PBKDF2
        KAT_OTP
        KAT_PubKey.DSA
        KAT_PubKey.ECC
        KAT_PubKey.ECDSA
        KAT_PubKey.OAEP
        KAT_PubKey.PSS
        KAT_PubKey.P256
        KAT_PubKey.RSA
        KAT_PubKey.Rabin
        KAT_PubKey
        KAT_RC4
        KAT_Scrypt
        KAT_TripleDES
        KAT_Twofish
        ChaChaPoly1305
        Number
        Number.F2m
        Padding
        Poly1305
        Salsa
        Utils
        XSalsa

    default-language: Haskell2010
    ghc-options:
        -Wall -fno-warn-orphans -fno-warn-missing-signatures -rtsopts

    build-depends:
        base >=0 && <10,
        bytestring,
        memory,
        tasty,
        tasty-quickcheck,
        tasty-hunit,
        tasty-kat,
        crypton

benchmark bench-crypton
    type:             exitcode-stdio-1.0
    main-is:          Bench.hs
    hs-source-dirs:   benchs
    other-modules:    Number.F2m
    default-language: Haskell2010
    ghc-options:      -Wall -fno-warn-missing-signatures
    build-depends:
        base,
        bytestring,
        deepseq,
        memory,
        gauge,
        random,
        crypton