crypton
Cryptography Primitives
https://github.com/kazu-yamamoto/crypton
| Version on this page: | 2.1.12@rev:1 |
| LTS Haskell 24.70: | 1.0.6 |
| Stackage Nightly 2026-12-06: | 2.1.12@rev:1 |
| Latest on Hackage: | 2.3.1 |
crypton-2.1.12@sha256:271c135fba198480b79f0b305a85d4d33b97e7da2e64a186e21e5d9e592c36b6,38136Module documentation for 2.1.12
- Crypto
- Crypto.Cipher
- 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
- Crypto.Data
- Crypto.Debug
- Crypto.ECC
- Crypto.Error
- Crypto.Hash
- Crypto.KDF
- Crypto.KEM
- Crypto.MAC
- Crypto.Number
- Crypto.OTP
- Crypto.PubKey
- Crypto.PubKey.Curve25519
- Crypto.PubKey.Curve448
- Crypto.PubKey.DH
- Crypto.PubKey.DSA
- Crypto.PubKey.ECC
- Crypto.PubKey.ECDSA
- Crypto.PubKey.ECIES
- Crypto.PubKey.Ed25519
- Crypto.PubKey.Ed448
- Crypto.PubKey.EdDSA
- Crypto.PubKey.ElGamal
- Crypto.PubKey.MLDSA
- Crypto.PubKey.MLKEM
- Crypto.PubKey.MaskGenFunction
- Crypto.PubKey.RSA
- Crypto.PubKey.Rabin
- Crypto.Random
- Crypto.System
- Crypto.Tutorial
- Crypto.Cipher
crypton
crypton is a fork from cryptonite with the original author’s permission.
crypton is a low-level cryptography library. To achieve high
performance, it utilizes C and assembly language to define FFI
bindings, structuring them in a way that makes them easy to use.
Side channels
AES is where this matters most, and which implementation runs is decided at runtime from what the processor has.
On x86-64 with AES-NI and carry-less multiply, and on AArch64 with the ARMv8 cryptographic extension, AES and GHASH are instructions rather than tables. crypton’s AES and AES-GCM then make no branch and no memory access that depends on the key or on the data: the secrets stay in vector registers and never reach one a branch can test, which the generated code is checked against. Every x86-64 part since about 2010 and every AArch64 part in ordinary use has these.
Where neither is present crypton falls back to a table-driven AES, which indexes a 256-byte substitution table with data derived from the key and the input. That is not constant time, and on a machine where an attacker can observe the cache it is open to a timing attack. The fallback exists so that the library builds and runs everywhere; it is not meant for a setting where that matters.
Crypto.System.CPU.processorOptions says which is in use. AESNI in that
list means the instruction path, and PCLMUL that GHASH has its instruction
too; without AESNI it is the tables. The list also reports RDRAND, which
is unrelated to this.
ghci> import Crypto.System.CPU
ghci> processorOptions
[AESNI,PCLMUL]
RSA is the other place to know about, and there the choice is the caller’s.
The private key operations in Crypto.PubKey.RSA.PKCS15, .OAEP and .PSS
take a Maybe Blinder, and Nothing is no harder to write than the safe
form:
decrypt :: Maybe Blinder -> PrivateKey -> ByteString -> ...
decryptSafer :: MonadRandom m => PrivateKey -> ByteString -> m ...
The exponent itself is not what is at risk. expSafe keeps the value of an
exponent out of the work it does, so the private exponent does not leak
through the exponentiation. What a blinder covers is the other side: without
one, the operation runs on the ciphertext the caller was handed, so how long
it takes depends on a number an attacker may have chosen and can vary. That
is what a remote timing attack on RSA needs. With a blinder the input is
multiplied by a random value first and the result divided out afterwards, so
the timing carries nothing an attacker can steer.
decryptSafer and signSafer generate the blinder themselves and are the
ones to reach for. Pass Nothing only where the input is not attacker
controlled and you have decided that it is not.
The RSA rows in the tables below are the unblinded path. A blinder costs one more exponentiation, by the public exponent, which is the cheap direction: measured on the M4, signing goes from about 460 to about 476 microseconds, under four per cent.
Performance
The algorithms a TLS connection uses, measured against the last release before the rewrite and against OpenSSL on the same machine. Throughput is over 16 KiB messages; the public key operations are one operation each; every figure is the best of several runs, and crypton and OpenSSL are run alternately so that neither gets the quieter machine.
Bulk encryption and hashing are measured through crypton’s C layer, as
openssl speed measures OpenSSL’s. The public key operations are measured
through crypton’s Haskell API, since that is where ECDSA and RSA live and it
is what a program actually calls; the Haskell layer adds well under a
microsecond, which the X25519 and ECDH P-256 rows confirm by agreeing with a
C-level measurement to within a percent. Both releases of crypton are built
the same way – -optc-O3, which is what each asks for – and by
cabal build, since a copy of the sources compiled by hand does not measure
what a program linking the library gets, and leaves out whole implementations
without saying so. Each column of a table comes from one run on the machine
named above it.
x86-64
An AMD EPYC 7763, which has AES-NI, PCLMULQDQ, AVX2, ADX, VAES, VPCLMULQDQ and the SHA extensions, against OpenSSL 4.0.3.
Throughput in MB/s, higher is better:
| crypton 1.1.5 | crypton 2.1.5 | OpenSSL | 2.1.5 / OpenSSL | |
|---|---|---|---|---|
| AES-128-GCM | 1362 | 6038 | 4055 | 1.49 |
| AES-256-GCM | 1093 | 5462 | 3770 | 1.45 |
| ChaCha20-Poly1305 | 399 | 2211 | 2229 | 0.99 |
| SHA-1 | 727 | 1678 | 1673 | 1.00 |
| SHA-256 | 290 | 1585 | 1579 | 1.00 |
| SHA-512 | 463 | 804 | 751 | 1.07 |
| SHA3-256 | 109 | 424 | 425 | 1.00 |
Time per operation in microseconds, lower is better:
| crypton 1.1.5 | crypton 2.1.5 | OpenSSL | OpenSSL / 2.1.5 | |
|---|---|---|---|---|
| X25519 | 45.31 | 28.41 | 36.48 | 1.28 |
| ECDH P-256 | 165.4 | 51.14 | 51.65 | 1.01 |
| ECDH P-384 | 2278 | 165.0 | 847.5 | 5.13 |
| Ed25519 sign | 30.03 | 18.62 | 33.71 | 1.81 |
| Ed25519 verify | 48.05 | 47.66 | 110.6 | 2.32 |
| ECDSA P-256 sign | 81.70 | 18.96 | 21.87 | 1.15 |
| ECDSA P-256 verify | 233.3 | 70.47 | 67.52 | 0.96 |
| ECDSA P-384 sign | 2264 | 303.4 | 890.1 | 2.93 |
| ECDSA P-384 verify | 2676 | 471.4 | 721.5 | 1.53 |
| RSA-2048 sign/decrypt | 759.4 | 612.0 | 659.4 | 1.08 |
| RSA-2048 verify/encrypt | 33.56 | 30.21 | 18.86 | 0.62 |
AArch64
An Apple M4, which has the AES, PMULL, SHA-1, SHA-2, SHA-512 and SHA-3 instructions, against OpenSSL 4.0.3.
Throughput in MB/s, higher is better:
| crypton 1.1.5 | crypton 2.1.5 | OpenSSL | 2.1.5 / OpenSSL | |
|---|---|---|---|---|
| AES-128-GCM | 127 | 12422 | 10846 | 1.15 |
| AES-256-GCM | 98 | 9721 | 9197 | 1.06 |
| ChaCha20-Poly1305 | 771 | 2319 | 2250 | 1.03 |
| SHA-1 | 1209 | 3389 | 3361 | 1.01 |
| SHA-256 | 474 | 3400 | 3362 | 1.01 |
| SHA-512 | 730 | 1880 | 1883 | 1.00 |
| SHA3-256 | 550 | 1075 | 1065 | 1.01 |
Time per operation in microseconds, lower is better:
| crypton 1.1.5 | crypton 2.1.5 | OpenSSL | OpenSSL / 2.1.5 | |
|---|---|---|---|---|
| X25519 | 18.27 | 12.22 | 15.53 | 1.27 |
| ECDH P-256 | 68.70 | 20.43 | 24.77 | 1.21 |
| ECDH P-384 | 3328 | 73.50 | 372.6 | 5.07 |
| Ed25519 sign | 13.58 | 7.75 | 13.23 | 1.71 |
| Ed25519 verify | 18.28 | 18.17 | 34.76 | 1.91 |
| ECDSA P-256 sign | 31.97 | 6.55 | 10.92 | 1.67 |
| ECDSA P-256 verify | 95.63 | 26.80 | 32.68 | 1.22 |
| ECDSA P-384 sign | 3219 | 124.1 | 394.2 | 3.18 |
| ECDSA P-384 verify | 3870 | 203.1 | 326.5 | 1.61 |
| RSA-2048 sign/decrypt | 447.9 | 460.1 | 319.9 | 0.70 |
| RSA-2048 verify/encrypt | 18.23 | 15.12 | 8.405 | 0.56 |
What the numbers say
There are two changes behind the 1.1.5 column and the 2.1.5 one, not a single steady improvement.
The first, in 2.0.0, was a rewrite: the bulk algorithms moved into C, the
curves other than P-256 moved out of Haskell Integer arithmetic, and
everything that touches a secret was made to take the same time whatever the
secret is. 1.1.5 had no AArch64 code of its own at all, which is why AES-GCM
there is close to a hundred times what it was, and on x86-64 it had AES-NI
and nothing else.
The second, from 2.1.0 onwards, is assembly, for the operations where C cannot reach. Which of the two a row owes its gain to is not the same everywhere: ECDSA P-384 signing took nineteenfold from the rewrite and a further fifth from the assembly, while X25519 waited for the assembly entirely and ECDH P-384 is almost all of it.
Most of that assembly is not crypton’s. The prime curves, the inverse modulo
a group order, X25519, and RSA’s Montgomery multiplication on x86-64 go
through s2n-bignum, vendored in
cbits/s2n. Every routine in it carries a machine-checked proof in
HOL-Light that it computes what it says, and is written in a constant-time
style. It is Apache-2.0 OR ISC OR MIT-0, and crypton takes it under ISC.
That licence is why any of this was possible. The obvious assembly to reach
for is OpenSSL’s and BoringSSL’s ecp_nistz256, and it cannot be used here:
it is Apache-2.0 only, and Intel and CloudFlare hold copyright in it besides
OpenSSL, so nobody is in a position to relicense it.
Where crypton is behind, which is now the RSA rows on both architectures and ECDSA P-256 verification on x86-64, there is one reason. The AES-GCM rows were the other half of this section until 2.1.5; they are ahead on both machines now, and what the instructions do is still worth setting out.
RSA. 2.0.0 made signing slower than 1.1.5 on purpose: its modular
exponentiation stopped indexing a table with the bits of the exponent, and
hiding the exponent is what the difference bought. On x86-64 that cost is
more than repaid – s2n-bignum’s Montgomery multiplication is twice the C’s,
because the C cannot form the two carry chains ADCX and ADOX give, and
2.1.5 signs in less than 1.1.5 took while keeping what 2.0.0 gained. On
AArch64 there is nothing to use: s2n-bignum has no generic routine for it,
and the same five that help on x86-64 measure level with the C there, so the
C stays and the gap with it. No portable C closes that gap either – the
measurements are in
#275. Verification
does not move much either way: its exponent is 65537, seventeen bits, and
there is no exponentiation to speak of.
The wide AES instructions. VAES and VPCLMULQDQ do two blocks where
AES-NI and PCLMULQDQ do one, and four in their 512-bit form. crypton uses
the 256-bit form where the processor has it, which is Zen 3 and Ice Lake
onwards, and the 512-bit form where that is worth having, which is Ice Lake and
Zen 5 onwards. There was nothing to borrow: the wide AES-GCM in OpenSSL,
BoringSSL and AWS-LC is Apache-2.0 and s2n-bignum has no GCM, so both files are
crypton’s own.
Having the 256-bit one is where the 1.49 in the x86-64 table comes from, and
it is narrower than it sounds. The EPYC 7763 is Zen 3: VAES and VPCLMULQDQ,
no AVX-512. OpenSSL’s x86-64 AES-GCM is aesni-gcm-x86_64.pl, which is
128-bit – its vaesencs are the VEX encoding of AESENC on xmm, and
there is not one ymm in the file – or aes-gcm-avx512.pl, which wants
AVX512VAES. There is no rung between them, so on this processor OpenSSL
takes a block at a time where crypton takes two. The same idea as theirs,
one step further down the feature ladder; not a better one.
The 512-bit path arrived after 2.1.2, so it is in the 2.1.5 column – but neither machine in the tables above has AVX-512, so neither column shows it. On the runners that do, measured over 16 KiB in MB/s: an EPYC 9V45 (Zen 5) goes from 9616 to 14268 with it, a Xeon 6973P-C from 8095 to 9848, a Xeon 8573C from 6983 to 8447. OpenSSL on those machines is ahead still – 25760 on the first of them – because it interleaves the GHASH with the AES where crypton does them in turn. Zen 4 keeps the 256-bit path: its 512-bit instructions are two passes through a 256-bit datapath, so the wider encoding buys nothing there and costs a little.
AArch64 has no counterpart to any of these: one AES block and one GHASH multiplication at a time is all the instruction set offers. Its AES-GCM rows were 0.85 and 0.87 until 2.1.5, for that reason. What closed it was not width but the GHASH’s representation – H is twisted once at key setup so that GCM’s bit reflection is already undone, which turns a reduction of some twenty-five shifts and XORs into two PMULL and six EOR and makes Karatsuba worth taking. The scheme is ARM’s, from the BSD-3-Clause part of AArch64cryptolib, written out in crypton’s own intrinsics. The AES there is ahead of OpenSSL’s and always was; it was the GHASH beside it that was behind.
One row wants a word of its own: crypton’s Ed25519.sign derives the public
key from the secret key every time it signs, so that a caller who passes a
public key that does not match cannot be made to leak the private one. That
costs a second scalar multiplication, which OpenSSL’s signing does not pay –
and the row is still 1.71 on AArch64 and 1.81 on x86-64, so the safety is had
for nothing here rather than paid for.
SHA-1 is in the tables because a number of protocols and file formats still ask for it, not because it is a good choice for anything new. The algorithms that nothing should ask for any more – MD5, 3DES, RC4, CBC mode – are left out.
Changes
CHANGELOG for crypton
2.1.12
Fixes from a security review, backported from 2.2.6.
- fix(scrypt): refuse n < 2, non-positive r or p, and overflowing sizes #370
- fix(aes): keep the AArch64 one-shot GCM loops from wrapping near 4 GiB #370
- fix(gcmsiv): give Nothing for a tag that is not 16 bytes #370
- fix(pbkdf2): refuse iteration counts the C cannot take in the fast path #370
- fix(p256): negating the point at infinity gives the point at infinity #370
- fix(p256): a zero scalar lifts to the point at infinity #370
- fix: lengths of 4 GiB or more in ChaChaDRG and Argon2 #370
- fix(gcm): refuse incremental input past 2^36 - 32 bytes #370
- fix: doubling in GF(2^n) without branching on secret bits #370
- fix(hash): feed every hash update through updateBlocks #370
2.1.11
crypton runs again on x86-64 processors without AVX2. From 2.1.8 the
whole library was compiled with -mavx2 -mbmi2, so a program built on a
machine with AVX2 was killed on one without. This is the fix 2.2.1 made.
- fix: stop raising the x86-64 baseline for the whole library #351
- fix: ask the processor before using the ML-KEM and ML-DSA backends #351
2.1.10
- build: ask the processor for AES-NI on every x86 system, not four of them #307
- fix: ask one place which ARMv8 instruction sets the machine has #307
2.1.9
- feat(rsa): PKCS#1 v1.5 operations that take a digest, and ones that take a DigestInfo #305
- feat(dsa): sign and verify over a digest #305
- feat(elgamal): sign and verify over a digest #305
- feat(rabin): Rabin-Williams and Modified Rabin sign and verify over a digest #305
2.1.8
- chore: stop hiding foldl’ from Prelude #294
- chore: ask for hidden visibility only where the format has it #295
- feat: ML-KEM and ML-DSA, through mlkem-native and mldsa-native #297
2.1.7
RSA-PSS verification was accepting an encoding RFC 8017 says to refuse. It is a conformance fault rather than a forgery: producing such a signature takes the private key, so a third party holding a valid signature cannot turn it into one of these.
- chore(p256): drop two declarations nothing defines #292
- fix(pss): refuse an encoding with a bit set outside emBits #293
2.1.6
The license: field now says what the tree holds – BSD-3-Clause AND MIT AND ISC – and license-files: lists all five texts. Nothing is required
of a user that was not required before; the field was simply incomplete.
- Carry the MIT notice for the parts that follow fusion, and say what the tree holds #267
- fix: two preconditions the Haskell layer did not enforce #288
- fix(x86): stop casting a packed block to __m128i * #289
- fix(c): say that the digest pointers are never null #290
- fix(pbkdf2): refuse a digest larger than its block at compile time #291
2.1.5
2.1.3 and 2.1.4 cannot be built with GCC 14 or newer. This release is that fix.
- Watch for a primitive fallen off its fast path #277
- The performance tables for 2.1.4 #278
- The x86-64 table, on the machine the README names #279
- perf(armv8): GHASH against a twisted H, a quarter faster #281
- ct: run the constant-time harness on AArch64, and put its AES to it #283
- Fix crypton_sha1_x86_do_chunk signature #284
- ci: build the C with a compiler stricter than this matrix has #285
2.1.4
2.1.3 could not be built from Hackage in the default configuration, and is deprecated there. This release is that fix.
- Add p256 header files to cabal extra-source-files #271
- Build what is published, not only what is checked out #272
- SHA-256 on AArch64 is 5.4x slower in 2.1.3 than in 2.1.2 #274
- The target attribute spelling gcc before 13 understands #276
2.1.3
- fix(aead): reject missing and oversized authentication tags #233
- fix(chacha): remove redundant Word8 import #234
- test(number): cover the two modulus sizes the assembly runs at #235
- perf(rsa): swap the buffers instead of copying them back #236
- perf(rsa): scan the exponentiation’s table four limbs at a time #237
- fix(gcm): write the field doubling from its definition #238
- doc(gcm): carry the MIT notice for the parts that follow fusion #239
- perf(ed25519): the base point multiplication through s2n-bignum #240
- perf(gcm): AES-GCM through the 512-bit VAES and VPCLMULQDQ #241
- doc: the README said AVX-512 was not used, and it is #242
- perf(ecdsa): P-256 verification multiplies both scalars at once #243
- perf(rsa): four limbs and two carry chains on AArch64 #244
- perf(rsa): write out the ragged end of the AArch64 row #245
- perf(rsa): build R^2 by squaring, not by doubling #246
- perf(rsa): stop clearing the scratch a Montgomery multiply writes over #247
- doc(gcm): write down what the AArch64 GHASH is short of #248
- security(aes): refuse a nonce of no bytes in Crypto.Cipher.AES.GCM #250
- ci: build and test the C the other architectures use #251
- perf(p256): five teeth to a comb block, over the signed representation #252
- security(cipher): stop truncating message lengths on the way to the C #253
- fix(c): two left shifts the standard leaves undefined #254
- ci: run the C under the sanitizers #255
- fix(c): read words out of a block rather than pointing at it #256
- fix(internal): drop an import nothing uses any more #257
- fix(c): decide the dispatch table once, not on every key #258
- Fix the three cabal flag settings that were broken #259
- Run the C that only 32-bit architectures get, and fix what that found #260
- Let the last addition of each scalar multiplication be a complete one #261
- Ask whether the secrets decide anything #262
- Ask a big-endian machine the same questions #263
- Ask what the secrets leave behind #264
- Stop taking eighteen runner slots to test three things #265
- Make the scrubs ones the compiler cannot drop, and finish round ten #266
- Feed the parsers bytes nobody chose #268
2.1.2
- perf(p256): 255 squarings for the field inversion, not 287 #223
- perf(p256): ECDH through s2n-bignum, 2.7x #224
- perf(ecc): P-384 and P-521 through s2n-bignum, 7x and 9x #225
- perf(p256): ECDSA signing 2.4x and verification 2.2x #226
- perf(rsa): the Montgomery multiplication through s2n-bignum on x86-64 #227
- perf(ecdsa): invert modulo the order in division steps, not an exponentiation #228
- perf(x25519): X25519 through s2n-bignum, and a table for key generation #229
- perf(gcm): AES-GCM through VAES and VPCLMULQDQ #230
- perf(gcm): compile the wide loop once per key length #231
2.1.1
- feat(ecdsa): RFC 6979 deterministic nonces for Crypto.PubKey.ECDSA #219
- feat(gcm): a decrypt that hands back the tag instead of comparing it #220
- feat(chachapoly): ChaCha20-Poly1305 a message at a time #221
- docs(rsa): say in the haddock what the optional blinder covers #222
2.1.0
- fix(cpu): stop reading Intel’s SDBG bit as AMD’s XOP #204
- fix(bench): build the benchmark against the checked ChaCha20-Poly1305 key #205
- ci: key the cache on the package version #206
- ci: build the benchmarks #207
- perf(gcm): a fused AES-GCM for x86-64 #208
- perf(gcm): a fused AES-GCM for AArch64 #209
- perf(gcm): build the counter in vector registers #210
- perf(gcm): a spare lane for E(K,Y0), and a cheaper short block #211
- perf(gcm): unroll the tail pass, and take its blocks from registers #212
- perf(gcm): read a short block where it lies #213
- perf(gcm): the length block and the counter, in registers #214
- perf(gcm): let the one-call interface specialise #215
- perf(gcm): decryption takes the fused path too #216
- perf(gcm): GHASH takes the ciphertext from the output buffer #217
- perf(p256): a signed five-bit window for the variable-point multiply #218
2.0.1
- feat(hash): Skein with the digest size as a type parameter #197
- fix(chachapoly1305): take a checked key, so that initializing cannot fail #198
- feat(aes): Crypto.Cipher.AES.GCM, for many short messages under one key #199
- build: say which platforms the fallback AES sources are for #200
- feat(aes): encryptWithMask, for the QUIC header protection mask #201
- fix(cpu): stop reading Intel’s SDBG bit as AMD’s XOP #203
2.0.0
Breaking changes. Input that used to be accepted is now refused: a value
at or above an RSA or Rabin modulus, a signature of the wrong length or out of
range, a digest too short for HOTP’s dynamic truncation, a non-canonical
Ed25519 signature, a PKCS#7 block size outside 1..255, and block cipher input
that is not a whole number of blocks. A refused KDF, Argon2 or bcrypt
parameter is reported as a CryptoError rather than raised as an ErrorCall,
and CryptoError_ParameterInvalid is appended to CryptoError;
tryGetShared is added beside getShared. No exported function changed its
signature.
Deprecated. The eighteen curves over a binary field in
Crypto.ECC.Simple.Types. They are obsolete, they are the curves whose
cofactor is not 1, and they will go in a later major version. Prefer a prime
curve, or X25519.
- Add GHC 9.14 to CI #74
- fix(ed25519): reject non-canonical signatures #81
- fix(hkdf): enforce RFC 5869 output limit #82
- fix(p256): accept valid edge-case points #83
- fix(ecc): accept zero-x P-256 shared secrets #84
- fix(otp): require a digest long enough for dynamic truncation #85
- fix(pkcs15): reject malformed PKCS#1 v1.5 signatures #86
- fix(ecdh): validate the peer point before the exchange #87
- fix(dsa): do not crash on non-invertible values #88
- fix(dh): validate the peer public number #89
- fix(argon2): report invalid options as CryptoFailed #90
- fix(rsa): drop the early exits from PKCS#1 v1.5 and OAEP unpadding #91
- fix(otp): compare TOTP candidates without an early exit #92
- feat(dh): add getShared’ reporting rejections as CryptoFailable #93
- feat(aead): add aeadSimpleDecrypt’ taking the tag length #94
- test: move the suite to hspec, with hspec-discover #95
- docs(bcrypt): say that only the first 72 bytes of a password count #96
- feat(elgamal): fix and expose Crypto.PubKey.ElGamal #97
- fix(padding): reject a PKCS7 block size outside 1..255 #98
- build(bench): move the benchmarks from gauge to tasty-bench #99
- feat(aes): use the ARMv8 cryptographic extensions on AArch64 #100
- ci: stop throwing the cache away, and keep the build products in it #101
- feat(aes): use PMULL for GHASH on AArch64 #102
- ci: cut the macOS queueing and supersede stale branch runs #103
- feat(sha256): use the ARMv8 SHA-2 instructions on AArch64 #104
- perf(gcm): fold four GHASH blocks into one reduction #105
- ci: build and test on aarch64 Linux #106
- fix(cabal): build the AES-NI paths on Windows too #107
- perf(aes): specialise by key size and interleave eight blocks on AArch64 #108
- perf(gcm): drive GCM from AArch64 rather than the generic loop #109
- feat(sha512): use the ARMv8.2 SHA-512 instructions on AArch64 #110
- perf(chacha): do four blocks at a time with NEON on AArch64 #111
- perf(chacha): do four blocks at a time with SSE2 on x86-64 #112
- perf(chacha): take eight blocks with AVX2 where the machine has it #113
- perf(gcm): give x86 its own decryption loop, and eight blocks either way #114
- fix(padding): bound PKCS7 padding by the block, and check ZERO’s size #115
- ecc: say which curves branch on a secret scalar, and work in Jacobian coordinates #116
- perf(poly1305): take four blocks at a time with AVX2 on x86-64 #117
- perf(xts): drive XTS eight blocks at a time, and dispatch its decryption #118
- Report refused KDF parameters as CryptoError, and fix a PBKDF2 SIGBUS #119
- Search the HOTP resynchronization window without early exits #120
- Refuse an RSA representative that is not below the modulus #121
- Give AFIS one answer for a parameter it cannot use #122
- Say what ElGamal’s signWith requires of k #123
- Draw Miller-Rabin witnesses per number, not once per process #124
- Refuse Rabin values that are not below the modulus, and keep the padding that was signed #125
- Decode Rabin’s OAEP without early exits #126
- Make CMAC linear, and chain it through CBC #127
- Put DES in C #128
- Make the generic block cipher modes linear, and bulk where the blocks allow #129
- Walk Twofish’s blocks once, and carry them in words #130
- Put Camellia in C #131
- Route P-256 through the C implementation it already had #132
- Fold instead of dividing in the generic curve arithmetic #133
- Reduce the binary field by folding, and work a byte and a nibble at a time #134
- Stop running a Fermat test Miller-Rabin subsumes #135
- Make expSafe hide the exponent again #136
- Square, and multiply, faster in expSafe #137
- Invert the signing nonce without a side channel #138
- Keep the P-256 signature out of Integer arithmetic #139
- Add at every bit in the prime-curve multiplication, which laziness was skipping #140
- Multiply points in C on curves over a prime field #141
- A ladder for the curves over a binary field #142
- Work RSA’s qinv out without the extended Euclidean algorithm #143
- Keep the RSA blinding factor out of the extended algorithm #144
- Unroll the inner loop at four and two as well #145
- Keep a table for each curve’s base point #146
- Start R squared at the top of the modulus, and why folding did not pay #147
- Do the binary field arithmetic in C #148
- Use the x86 carry-less multiply where the processor has it #149
- Close the two testing gaps: one multiplication for both APIs, one place for each buffer’s size #150
- Ask aarch64 for its carry-less multiply as well #151
- Work the RSA private exponent out without the extended algorithm #152
- Fewer Miller-Rabin rounds for a candidate nobody chose #153
- Blowfish, and the key setup bcrypt wraps it in, in C #154
- perf(sha256): use the Intel SHA extensions on x86-64 #155
- perf(aes): AES-192 through the processor’s AES instructions #156
- perf(aes): build the AArch64 key schedule with AESE, not the S-box table #157
- test(aes): run the XTS vectors, and OCB and CCM at 192 and 256 bits #158
- perf(ocb): drive OCB through the ECB paths a group at a time #159
- perf(gcm): take the GHASH of the group before, alongside this group’s rounds #160
- perf(sha): compute the message schedule in vector registers on x86 #161
- perf(chacha): combine as the keystream comes out of the registers #162
- perf(poly1305): shorten the carry chain and stop spilling the loop #163
- docs(sidechannel): say what the prime-field modules keep from the clock #164
- perf(sha1): use the Intel SHA extensions on x86-64 #165
- refactor(aes): drop the keystream generator nobody can call #166
- build: compile the C at -O3 #167
- perf(modes): stop the generic cipher modes allocating per byte #168
- perf(poly1305): four blocks at a time with NEON #169
- perf(sha1): use the ARMv8 SHA-1 instructions #170
- perf(sha3): use the ARMv8.2 SHA-3 instructions #171
- perf(gcm): the CRYPTOGAMS stitched AES-GCM on x86-64 #172
- perf(chacha): the CRYPTOGAMS ChaCha20 on AArch64 #173
- perf(poly1305): the CRYPTOGAMS Poly1305 on AArch64 #174
- perf(sha256): the CRYPTOGAMS SHA-256 on AArch64 #175
- perf(poly1305): the CRYPTOGAMS Poly1305 on x86-64 too #176
- perf(chacha): the CRYPTOGAMS ChaCha20 on x86-64 too #177
- perf(sha2): the CRYPTOGAMS SHA-256 and SHA-512 on x86-64 #178
- perf(sha1): hand the SHA-1 block loop a run of blocks, not one at a time #179
- perf(xts): double the tweak in the integer registers #180
- perf(sha3): take the CRYPTOGAMS Keccak for AArch64 #181
- perf(sha1): take the CRYPTOGAMS SHA-1 for AArch64 #182
- docs: put the performance tables in the README #183
- perf(sha3): take the CRYPTOGAMS Keccak for x86-64 as well #184
- docs: rebuild the performance tables #185
- perf(ecc): stop sharing the doublings in the double multiplication #186
- perf(number): count bytes from the bit count, not from base 256 #187
- perf(p256): inline the field arithmetic on AArch64 #188
- fix(api): name the reporting variants try…, not with an apostrophe #189
- fix(ecc): require a public point to be in the prime-order subgroup #190
- fix(pubkey): stop printing private keys, and add Crypto.Debug #191
- fix(poly1305): take a checked key, so that initializing cannot fail #192
- fix(bcrypt): refuse a cost bcrypt does not have rather than substituting one #194
- chore: build without a warning #195
- docs: build the documentation without a warning #196
1.1.5
- fix(aead): reject undersized tags #80
- fix(aes): refuse a zero-length AES-GCM IV #79
- fix(p256): prevent crashes when validating valid points #78
- feat(asn1): add SHA-3 HashAlgorithmASN1 instances for PKCS#1 v1.5 #77
- OCB3 conformance #76
1.1.4
- Generic instance for RSA PublicKey and PrivateKey
1.1.3
- Ensure that
pointAddinPubKey.ECC.P256treats the point at infinity as the additive identity. #73
1.1.2
- Preparing
ramv0.22. - Generalizing RSA encrypt/decrypt to manipulate ScrubbedBytes directly.
1.1.1
- On iOS, ScrubbedBytes based hashing is used for seedNew. On other plateforms, entropy is used directly as used to be. #71
1.1.0
- Removing “basement” and “memory”. #67
1.0.7
- Stop depending on basement, use upstream dependencies instead
- Stop transitively depending on basement by depending on ram.
1.0.6
- Fix test failures on less common 64-bit arches. #65
1.0.5
- Setter/Getter for ChaCha counter. #63
- Add simple interface to generate full blocks #60
- Avoid
ghc-primdependency. #61
1.0.4
- Ed448.sign: avoid extra re-derive of public key. #48
1.0.3
- Make sign of Ed25519/Ed448 safer. The public key parameter is ignored and its public key is generated from the secret key parameter to prevent Double Public Key Signing Function Oracle Attack. #47
1.0.2
- Deterministic Nonce Generation for ECDSA #46
- ECDSA Signature Normalization. #45
- Add Full Test Suite from RFC 6979. #44
- ECDSA with Public Key Recovery. #43
- Providing necessary features for HPKE. #42
1.0.1
1.0.0
- Versions follow the standard version policy.
- Removing pthread stuff. #32
0.34
- Hashing getRandomBytes before using as Seed for ChaChaDRG #24
- Add support for XChaCha and XChaChaPoly1305 #18
- Strict byteArray of IV c #16
0.33
- Add “crypton_” prefix to the final C symbols. #9
0.32
0.31
- Crypton is forked from cryptonite with the original authors permission.
- Ignoring exceptons from hClose to read the next entropy #1
- Enabling the support_pclmuldq flag by default.
0.30
- Fix some C symbol blake2b prefix to be cryptonite_ prefix (fix mixing with other C library)
- add hmac-lazy
- Fix compilation with GHC 9.2
- Drop support for GHC8.0, GHC8.2, GHC8.4, GHC8.6
0.29
- advance compilation with gmp breakage due to change upstream
- Add native EdDSA support
0.28
- Add hash constant time capability
- Prevent possible overflow during hashing by hashing in 4GB chunks
0.27
- Optimise AES GCM and CCM
- Optimise P256R1 implementation
- Various AES-NI building improvements
- Add better ECDSA support
- Add XSalsa derive
- Implement square roots for ECC binary curve
- Various tests and benchmarks
0.26
- Add Rabin cryptosystem (and variants)
- Add bcrypt_pbkdf key derivation function
- Optimize Blowfish implementation
- Add KMAC (Keccak Message Authentication Code)
- Add ECDSA sign/verify digest APIs
- Hash algorithms with runtime output length
- Update blake2 to latest upstream version
- RSA-PSS with arbitrary key size
- SHAKE with output length not divisible by 8
- Add Read and Data instances for Digest type
- Improve P256 scalar primitives
- Fix hash truncation bug in DSA
- Fix cost parsing for bcrypt
- Fix ECC failures on arm64
- Correction to PKCS#1 v1.5 padding
- Use powModSecInteger when available
- Drop GHC 7.8 and GHC 7.10 support, refer to pkg-guidelines
- Optimise GCM mode
- Add little endian serialization of integer
0.25
- Improve digest binary conversion efficiency
- AES CCM support
- Add MonadFailure instance for CryptoFailable
- Various misc improvements on documentation
- Edwards25519 lowlevel arithmetic support
- P256 add point negation
- Improvement in ECC (benchmark, better normalization)
- Blake2 improvements to context size
- Use gauge instead of criterion
- Use haskell-ci for CI scripts
- Improve Digest memory representation to be 2 less Ints and one less boxing
moving from
UArraytoBlock
0.24
- Ed25519: generateSecret & Documentation updates
- Repair tutorial
- RSA: Allow signing digest directly
- IV add: fix overflow behavior
- P256: validate point when decoding
- Compilation fix with deepseq disabled
- Improve Curve448 and use decaf for Ed448
- Compilation flag blake2 sse merged in sse support
- Process unaligned data better in hashes and AES, on architecture needing alignment
- Drop support for ghc 7.6
- Add ability to create random generator Seed from binary data and loosen constraint on ChaChaDRG seed from ByteArray to ByteArrayAccess.
- Add 3 associated types with the HashAlgorithm class, to get access to the constant for BlockSize, DigestSize and ContextSize at the type level. the related function that this replaced will be deprecated in later release, and eventually removed.
API CHANGES:
- Improve ECDH safety to return failure for bad inputs (e.g. public point in small order subgroup).
To go back to previous behavior you can replace
ecdhbyecdhRaw. It’s recommended to useecdhand handle the error appropriately. - Users defining their own HashAlgorithm needs to define the HashBlockSize, HashDigest, HashInternalContextSize associated types
0.23
- Digest memory usage improvement by using unpinned memory
- Fix generateBetween to generate within the right bounds
- Add pure Twofish implementation
- Fix memory allocation in P256 when using a temp point
- Consolidate hash benchmark code
- Add Nat-length Blake2 support (GHC > 8.0)
- Update tutorial
0.22
- Add Argon2 (Password Hashing Competition winner) hash function
- Update blake2 to latest upstream version
- Add extra blake2 hashing size
- Add faster PBKDF2 functions for SHA1/SHA256/SHA512
- Add SHAKE128 and SHAKE256
- Cleanup prime generation, and add tests
- Add Time-based One Time Password (TOTP) and HMAC-based One Time Password (HOTP)
- Rename Ed448 module name to Curve448, old module name still valid for now
0.21
- Drop automated tests with GHC 7.0, GHC 7.4, GHC 7.6. support dropped, but probably still working.
- Improve non-aligned support in C sources, ChaCha and SHA3 now probably work on arch without support for unaligned access. not complete or tested.
- Add another ECC framework that is more flexible, allowing different implementations to work instead of the existing Pure haskell NIST implementation.
- Add ECIES basic primitives
- Add XSalsa20 stream cipher
- Process partial buffer correctly with Poly1305
0.20
- Fixed hash truncation used in ECDSA signature & verification (Olivier Chéron)
- Fix ECDH when scalar and coordinate bit sizes differ (Olivier Chéron)
- Speed up ECDSA verification using Shamir’s trick (Olivier Chéron)
- Fix rdrand on windows
0.19
- Add tutorial (Yann Esposito)
- Derive Show instance for better interaction with Show pretty printer (Eric Mertens)
0.18
- Re-used standard rdrand instructions instead of bytedump of rdrand instruction
- Improvement to F2m, including lots of tests (Andrew Lelechenko)
- Add error check on salt length in bcrypt
0.17
- Add Miyaguchi-Preneel construction (Kei Hibino)
- Fix buffer length in scrypt (Luke Taylor)
- build fixes for i686 and arm related to rdrand
0.16
-
Fix basepoint for Ed448
-
Enable 64-bit Curve25519 implementation
0.15
- Fix serialization of DH and ECDH
0.14
- Reduce size of SHA3 context instead of allocating all-size fit memory. save up to 72 bytes of memory per context for SHA3-512.
- Add a Seed capability to the main DRG, to be able to debug/reproduce randomized program where you would want to disable the randomness.
- Add support for Cipher-based Message Authentication Code (CMAC) (Kei Hibino)
- CHANGE Change the
SharedKeyforCrypto.PubKey.DHandCrypto.PubKey.ECC.DH, from an Integer newtype to a ScrubbedBytes newtype. Prevent mistake where the bytes representation is generated without the right padding (when needed). - CHANGE Keep The field size in bits, in the
ParamsinCrypto.PubKey.DH, moving from 2 elements to 3 elements in the structure.
0.13
- SECURITY Fix buffer overflow issue in SHA384, copying 16 extra bytes from the SHA512 context to the destination memory pointer leading to memory corruption, segfault. (Mikael Bung)
0.12
- Fix compilation issue with Ed448 on 32 bits machine.
0.11
- Truncate hashing correctly for DSA
- Add support for HKDF (RFC 5869)
- Add support for Ed448
- Extends support for Blake2s to 224 bits version.
- Compilation workaround for old distribution (RHEL 4.1)
- Compilation fix for AIX
- Compilation fix with AESNI and ghci compiling C source in a weird order.
- Fix example compilation, typo, and warning
0.10
- Add reference implementation of blake2 for non-SSE2 platform
- Add support_blake2_sse flag
0.9
- Quiet down unused module imports
- Move Curve25519 over to Crypto.Error instead of using Either String.
- Add documentation for ChaChaPoly1305
- Add missing documentation for various modules
- Add a way to create Poly1305 Auth tag.
- Added support for the BLAKE2 family of hash algorithms
- Fix endianness of incrementNonce function for ChaChaPoly1305
0.8
- Add support for ChaChaPoly1305 Nonce Increment (John Galt)
- Move repository to the haskell-crypto organisation
0.7
- Add PKCS5 / PKCS7 padding and unpadding methods
- Fix ChaChaPoly1305 Decryption
- Add support for BCrypt (Luke Taylor)
0.6
- Add ChaChaPoly1305 AE cipher
- Add instructions in README for building on old OSX
- Fix blocking /dev/random Andrey Sverdlichenko
0.5
- Fix all strays exports to all be under the cryptonite prefix.
0.4
- Add a System DRG that represent a referentially transparent of evaluated bytes while using lazy evaluation for future entropy values.
0.3
- Allow drgNew to run in any MonadRandom, providing cascading initialization
- Remove Crypto.PubKey.HashDescr in favor of just having the algorithm specified in PKCS15 RSA function.
- Fix documentation in cipher sub section (Luke Taylor)
- Cleanup AES dead functions (Luke Taylor)
- Fix Show instance of Digest to display without quotes similar to cryptohash
- Use scrubbed bytes instead of bytes for P256 scalar
0.2
- Fix P256 compilation and exactness, + add tests
- Add a raw memory number serialization capability (i2osp, os2ip)
- Improve tests for number serialization
- Improve tests for ECC arithmetics
- Add Ord instance for Digest (Nicolas Di Prima)
- Fix entropy compilation on windows 64 bits.
0.1
- Initial release