Commit Graph

996 Commits

Author SHA1 Message Date
Lars Petersen
ff8a1c524d Extend the internal interface of the Blowfish module.
In preparation of an implementation of the bcrypt_pbkdf (a
variant of PBKDF2 used by OpenSSH) algorithm,
certain low-level operations of the Blowfish algorithm need to
be generalized and exposed.

The Blowfish.Primitive module has already been extended to
account for the requirements imposed by the BCrypt algorithm,
but the salt length was limited to 16 bytes and the BCrypt
specific key schedule setup has been hard-coded into the Blowfish
module.

This commit makes a clear distintion between the expandKey and
expandKeyWithSalt operation. Both take arbitrary sized salts
and keys now. The specialized operation for 16 byte salts as used
by BCrypt has been preserved and is selected automatically.
Also, the BCrypt specific parts have been move to the BCrypt
module with regard to separation of concern.

A benchmark for generating BCrypt hashes with cost 10 shows a
performance improvement from 158 to 141ms on average (Intel i5-6500)
after this refactoring.
Further experiments suggest that the specialized expandKeyWithSalt128
does not have any advantage over the generalized version
and might be removed in favour of less branches and exceptional
behaviour.
2018-05-08 22:08:20 +02:00
Olivier Chéron
4622e5fc8e Fix ECC failures on arm64
Resolves #234.
2018-05-01 08:23:08 +02:00
Olivier Chéron
74463d1bf1 Merge pull request #235 from ocheron/powModSecInteger
Enable powModSecInteger again
2018-05-01 07:47:47 +02:00
Olivier Chéron
d0ac50c1af Additional QA clean-up 2018-04-29 10:43:55 +02:00
Olivier Chéron
b3a1506d82 Remove conditionals related to SHAKE and Blake2
Not needed anymore now that GHC > 8.0.
2018-04-28 08:09:25 +02:00
Olivier Chéron
1fa6c35c35 Update tested-with 2018-04-28 08:08:43 +02:00
Olivier Chéron
9d961e92e9 Comment about not having Show instance for HMAC
Closes #232.
2018-04-22 19:44:29 +02:00
Olivier Chéron
a2a2372412 Use newer GHC and lts for CI 2018-04-22 19:44:29 +02:00
Olivier Chéron
15f63fd849 Enable powModSecInteger with integer-gmp >= 1.0.2.0 2018-04-20 20:40:53 +02:00
Luke Taylor
d27d464627 Fix cost parsing for bcrypt
The tens value was wrong for values of 20+, as reported in #230.
It should be 10*costTens not 10^costTens. This wasn't detected because
the values are the same when costTens is 1, and using high cost values
is rare with bcrypt because of the performance hit.

Also added a simple hash and validate test since the KAT tests only do
validation. This doesn't cover this bug since the cost value is too
high to include in the test. It allows similar issues to be tested
locally though.
2018-04-17 13:51:04 +01:00
Chris Martin
d2da00445d fix spelling of "exponent" 2018-04-05 21:44:40 -04:00
Vincent Hanquez
8b508302eb
Merge pull request #223 from haskell-crypto/dropold
Drop GHC 7.8 and GHC 7.10 support, refer to pkg-guidelines
2018-03-26 10:19:00 +01:00
Vincent Hanquez
dfd8ff7e8d
Merge pull request #219 from ocheron/digest-read-basement
Add Read instance for Digest type
2018-03-12 08:41:38 +00:00
Vincent Hanquez
467ed66c16 Drop GHC 7.8 and GHC 7.10 support, refer to pkg-guidelines 2018-03-12 08:35:49 +00:00
Olivier Chéron
3e5be5fdf3 Add Read instance for Digest type 2018-02-11 09:15:05 +01:00
Vincent Hanquez
ec8366bbd2
release 0.25 2018-02-06 15:35:32 +00:00
Vincent Hanquez
41d610fb18
Merge pull request #217 from haskell-crypto/hash-use-block
Hash: use Block instead of UArray to reduce memory usage
2018-02-05 14:34:04 +00:00
Vincent Hanquez
e8350e03bd add proper dependency for tests 2018-02-05 12:26:25 +00:00
Vincent Hanquez
b4add57955 Hash: use Block instead of UArray to reduce memory usage 2018-02-04 23:06:02 +00:00
Vincent Hanquez
2d87929a4e
Merge pull request #215 from haskell-crypto/haskell-ci
Bring CI to 2018
2018-02-04 23:05:09 +00:00
Vincent Hanquez
8b95917572 fix some more reference to criterion 2018-02-04 22:18:07 +00:00
Vincent Hanquez
6c84a1605d
Merge pull request #216 from haskell-crypto/aesccm-rebase
AES CCM mode
2018-02-04 21:38:16 +00:00
Vincent Hanquez
d291f9f5bb move to gauge 2018-02-04 21:33:36 +00:00
Vincent Hanquez
fb800bd2b6 fix for 7.10 2018-02-04 21:28:48 +00:00
Vincent Hanquez
5400fdf5ae use haskell-ci 2018-02-04 14:43:40 +00:00
Olivier Chéron
07be32728e Avoid warning with tasty-quickcheck-0.9.2 2018-02-04 15:27:45 +01:00
Olivier Chéron
1490f080a5 Use aligned block128 functions
Applies similar changes to what was done in #175.
2018-02-04 14:36:03 +01:00
Olivier Chéron
325c87febf Use pattern matching 2018-02-04 14:35:43 +01:00
Olivier Chéron
4926cbb143 Improve types and indentation, fix typo 2018-02-03 19:05:20 +01:00
Baojun Wang
1e57f41e1d check AESCCM IV length in ccmInit instead of aeadInit 2018-02-03 09:34:57 +01:00
Baojun Wang
f6d9fb0cf1 aeadInit (ccm) returns CryptoError_IvSizeInvalid when iv size is wrong 2018-02-03 09:34:57 +01:00
Baojun Wang
d5f8348a4b use nonce_len for memcpy 2018-02-03 09:34:57 +01:00
Baojun Wang
ccc7c3e7a6 kill unused imports 2018-02-03 09:34:57 +01:00
Baojun Wang
6fef094e90 Add KATCCM test file 2018-02-03 09:34:57 +01:00
Baojun Wang
e01ef4386e Add AESCCM test vectors for testing 2018-02-03 09:34:57 +01:00
Baojun Wang
035693240d fix wrong condition check in cryptonite_aes_ccm_aad 2018-02-03 09:34:57 +01:00
Baojun Wang
fefe5d75e3 flavor condition checks instead of asserts 2018-02-03 09:34:57 +01:00
Baojun Wang
48770bf79f fix aes ccm decryption cbcmac mis-match 2018-02-03 09:34:57 +01:00
Baojun Wang
1e04890d73 Add ccm decrypt 2018-02-03 09:34:57 +01:00
Baojun Wang
55bf620365 add aes ccm support 2018-02-03 09:31:36 +01:00
Vincent Hanquez
28f604f7bd
Merge pull request #210 from avieth/avieth/bs_copy
More efficient digestFromByteString
2018-01-09 22:18:54 +00:00
Alexander Vieth
6dca020660 improve digestFromByteString efficiency 2018-01-09 17:10:12 -05:00
Vincent Hanquez
c02c43bfc7
Merge pull request #205 from osa1/close_dev_handle
withDev: Close the FD on exception
2017-12-17 18:15:31 +00:00
Vincent Hanquez
6346b8289c
Merge pull request #202 from ocheron/ed25519-arith-negate
Ed25519 arithmetic primitives
2017-12-17 18:12:50 +00:00
Vincent Hanquez
82c22d50c7
Merge pull request #206 from haskell-crypto/replace-foundation-by-basement
remove dependency on foundation and moving to basement
2017-12-17 18:12:41 +00:00
Olivier Chéron
3217038a1a Add pointMulByCofactor and pointHasPrimeOrder 2017-12-17 11:56:33 +01:00
Olivier Chéron
9cd77ed3e2 Test points with a torsion component 2017-12-17 09:46:42 +01:00
Olivier Chéron
251f164f47 Apply bugfix to Edwards25519.pointsMulVarTime 2017-12-17 09:46:42 +01:00
Olivier Chéron
b962952c30 Add introduction and warnings about possible pitfalls 2017-12-17 09:46:42 +01:00
Olivier Chéron
0820cd5c38 Simpler Edwards25519.scalarGenerate 2017-12-16 11:33:38 +01:00