Commit Graph

1103 Commits

Author SHA1 Message Date
Olivier Chéron
f2fa7836cb Merge pull request #290 from ocheron/gcm-wrapping
Fix counter wrapping in AES GCM
2019-08-25 08:51:03 +02:00
Olivier Chéron
fc07a8b931 Fix counter wrapping in AES GCM
The generic and AESNI implementations used different conventions
regarding counter wrapping in GCM.  The generic code was based on
function block128_inc_be, for which the counter is a 128-bit value.
Whereas the AESNI code used intrinsic function _mm_add_epi64, and
therefore wrapping at 2^64.

In NIST.SP.800-38d the GCM specification mandates to use incrementing
function inc32, wrapping after 2^32 blocks.  This commit changes both
generic and AESNI implementations to align to the specification and
adds a test vector specially crafted to start encryption with IV block
0xfffffffffffffffffffffffffffffffe.
2019-08-20 10:34:40 +02:00
Olivier Chéron
0d32f9b833 Remove unused variables 2019-08-12 21:11:01 +02:00
Olivier Chéron
7e6aeaa8da Add Crypto.System.CPU to QA 2019-08-12 21:10:47 +02:00
Olivier Chéron
00221a494c Ignore stack.yaml.lock 2019-07-28 08:46:18 +02:00
Olivier Chéron
a0ad444ec1 Merge pull request #288 from 3for/P256-bench
bench for P256.pointAdd and P256.pointMul
2019-07-28 08:42:21 +02:00
Olivier Chéron
3e4ce8d2ed Merge pull request #287 from tom-audm/master
Fix typo ("strive" -> "strives")
2019-07-28 08:38:28 +02:00
root
a64a058153 warning remove and benchF2m okay 2019-07-23 11:14:09 +08:00
root
d3a60abf28 warning remove 2019-07-23 10:57:33 +08:00
root
7ca1f2e4d6 bench for P256.pointAdd and P256.pointMul 2019-07-15 10:47:58 +08:00
tom-audm
71184beb15 Fix typo ("strive" -> "strives") 2019-07-11 16:36:27 -04:00
Olivier Chéron
cdd0821eee Merge pull request #281 from ocheron/cpu-options
Add module Crypto.System.CPU
2019-06-23 09:05:13 +02:00
Olivier Chéron
53a1bf7ebf Report info about runtime environment in the test suite 2019-06-15 09:28:02 +02:00
Olivier Chéron
91c87deae1 Add Crypto.System.CPU 2019-06-15 09:28:02 +02:00
Olivier Chéron
f121d1b8d1 Merge pull request #280 from ocheron/gcm-small-table
More optimizations for AES GCM and CCM
2019-06-15 09:27:48 +02:00
Olivier Chéron
2cf3b75636 AES CCM: use AESNI in CBC-MAC computation when possible 2019-06-06 06:48:22 +02:00
Olivier Chéron
4df2a95276 AES GCM: use Shoup's method with 4-bit table 2019-06-06 06:48:16 +02:00
Olivier Chéron
5b39ae3e48 Add missing void and const 2019-05-26 11:50:07 +02:00
Olivier Chéron
c8a4e48e0c Remove unused variables 2019-05-26 11:50:07 +02:00
Vincent Hanquez
7596e2959d release 0.26 2019-05-21 08:49:16 +01:00
Vincent Hanquez
60ddb49298
Merge pull request #277 from ocheron/little-endian
Little-endian integer serialization
2019-05-19 21:56:41 +01:00
Vincent Hanquez
982ded8ad5
Merge pull request #278 from ocheron/gcm-pclmul
Faster AES GCM with PCLMULQDQ
2019-05-19 21:53:57 +01:00
Olivier Chéron
d25e44ea61 Add GHASH implementation with PCLMULQDQ 2019-05-19 11:18:40 +02:00
Olivier Chéron
cddbc2cef9 Remove unopt_gf_mul 2019-05-19 11:16:34 +02:00
Olivier Chéron
76ba39fc95 Add benchmark with AES GCM and CCM 2019-05-19 11:16:34 +02:00
Olivier Chéron
5b4845dd0e Use GHC 8.6.5 for CI and bump versions 2019-05-16 06:55:01 +02:00
Olivier Chéron
af98a837d1 Add missing INLINABLE pragma 2019-05-16 06:33:35 +02:00
Olivier Chéron
7ecb259aae Fix LE.i2osp 0
Little-endian bytes are stored at the beginning of the buffer.
2019-05-16 06:33:35 +02:00
Olivier Chéron
6893eae70a Make os2ip loop argument strict 2019-05-16 06:33:35 +02:00
Olivier Chéron
393aeac8cd Test LE serialization 2019-05-16 06:33:35 +02:00
Olivier Chéron
6e1b6fdb90 Little-endian integer serialization 2019-05-16 06:33:35 +02:00
Olivier Chéron
3161630390 Update CHANGELOG 2019-05-08 10:22:30 +02:00
Olivier Chéron
158d8dfd0c Remove unnecessary imports 2019-05-08 10:22:30 +02:00
Olivier Chéron
687765cacd Merge pull request #276 from ocheron/kmac
Keccak Message Authentication Code (KMAC)
2019-05-08 10:06:25 +02:00
Olivier Chéron
ae107a9285 Merge last cshakeUpdate with cshakeFinalize 2019-05-01 07:03:45 +02:00
Olivier Chéron
8b235612be Merge cshakeInit with first cshakeUpdate 2019-04-28 09:14:25 +02:00
Olivier Chéron
14093ac298 Optimize KMAC allocations
Adds a minimalist Builder type to merge intermediate allocations into
a single ByteArray.  Key is now copied to a ScrubbedBytes only.
2019-04-28 09:14:25 +02:00
Olivier Chéron
1551436111 Add KMAC 2019-04-28 09:14:25 +02:00
Olivier Chéron
c9f8dac6b0 Merge pull request #274 from ocheron/p256-add-sub
Improve P256.scalarAdd and P256.scalarSub
2019-04-28 09:12:47 +02:00
Olivier Chéron
7e5dbeb146 Use vector/vectorOf from QuickCheck and simplify 2019-03-26 06:25:45 +01:00
Olivier Chéron
6f67cefa3d Remove code duplication 2019-03-26 06:24:00 +01:00
Olivier Chéron
15f117d9c3 Remove tests add-n-1 and sub-n-1
Operation with value close to the curve order is now tested in other
tests.  This tests substraction with 0 instead.
2019-03-25 06:47:21 +01:00
Olivier Chéron
399fc891da Test P256 primitives will full scalar range 2019-03-24 08:31:58 +01:00
Olivier Chéron
47123ed97a Better P256 scalar primitives
Allows scalars in full range [ 0 .. 2^256-1 ].  Modular reduction is
added a few more operations with conditional selection.
2019-03-24 08:31:45 +01:00
Olivier Chéron
e3edc100c3 Remove unnecessary import 2019-03-24 07:59:57 +01:00
Olivier Chéron
3253501166 Time-constant P256.scalarAdd and P256.scalarSub 2019-03-21 07:04:01 +01:00
Olivier Chéron
f4be05eb2e Merge pull request #240 from lpeterse/bcrypt_pbkdf
Add bcrypt_pbkdf key derivation function
2019-03-17 19:02:27 +01:00
Lars Petersen
2a26202a32 Add implementation of bcrypt_pbkdf 2019-03-14 21:30:29 +01:00
Olivier Chéron
0ce2e5f325 Remove -fno-warn-unused-imports
Changing the build so that we don't diverge again after cleanup done
in #267.
2019-03-09 09:08:53 +01:00
Olivier Chéron
d67a21f95f Remove unnecessary imports and calls 2019-03-09 09:08:53 +01:00