Commit Graph

1126 Commits

Author SHA1 Message Date
Olivier Chéron
b9a8a6b83d ECDSA with digest 2019-11-11 17:46:16 +01:00
Olivier Chéron
15327ecd4f ECDSA with a type class 2019-11-11 17:46:16 +01:00
Olivier Chéron
8f75165f8b Time-constant P256 scalar inversion 2019-11-11 17:46:16 +01:00
Olivier Chéron
977e75f478 Add P256 functions to implement ECDSA 2019-11-11 17:46:16 +01:00
Olivier Chéron
19b7ab375a Time-constant modular inverse 2019-11-11 17:46:16 +01:00
Olivier Chéron
ce35a1e07d Merge pull request #299 from ocheron/ecc-scalar-ext
Extended ECC type class
2019-11-11 17:45:18 +01:00
Olivier Chéron
6f2a59e470 Apply hlint suggestions 2019-10-05 08:34:12 +02:00
Olivier Chéron
db8d47a76c ECC arithmetic in prime-order subgroup
A type-class extension packs together additional functions related to
a chosen basepoint as well as scalar serialization and arithmetic
modulo the subgroup order.
2019-10-05 08:34:12 +02:00
Olivier Chéron
bdf1a7a133 Require point equality in EllipticCurveArith
This is an incompatible API change but is very useful to test
properties and algorithms derived from the primitives.  An ECC
instance sufficiently advanced to have math primitives should
implement equality too.
2019-10-05 08:34:12 +02:00
Olivier Chéron
e0b201b5e7 Test P256.pointMul 2019-10-05 08:34:12 +02:00
Olivier Chéron
2e92639679 Add P256.scalarMul 2019-10-05 08:34:12 +02:00
Olivier Chéron
68c93ccbb1 Add GHC 8.8.1 to CI and bump versions 2019-10-05 08:23:45 +02:00
Olivier Chéron
e8b8a199e8 Merge pull request #293 from ocheron/xsalsa-derive
Add XSalsa.derive
2019-09-14 08:53:43 +02:00
Olivier Chéron
2433893730 Test XSalsa.derive
Adds a test case taken from NaCl paper, but without the parts related
to Curve25519 and Poly1305 because we want to test only XSalsa here.
2019-09-14 08:35:43 +02:00
Olivier Chéron
096e2ec0bd Add XSalsa.derive and example
This function adds one more HSalsa key derivation to an XSalsa context
that has previously been initialized.  It allows multi-level cascades
like the 2-level done by NaCl crypto_box.
2019-09-09 19:32:24 +02:00
Olivier Chéron
65643a3bea Merge pull request #292 from ocheron/aes-gcm-siv
AES-GCM-SIV
2019-09-08 09:49:35 +02:00
Olivier Chéron
3ae08ed509 Add API to generate a random nonce
This AEAD scheme is compatible with choosing the nonce randomly.
2019-08-25 16:38:08 +02:00
Olivier Chéron
29f0fd1b7a Test AES-GCM-SIV
Includes the test vectors from RFC 8452 and QuickCheck properties with
encryption-decryption round trip.
2019-08-25 16:38:03 +02:00
Olivier Chéron
73719cbe88 Add AES-GCM-SIV to AEAD benchmarks 2019-08-25 16:38:03 +02:00
Olivier Chéron
908f979d44 Add AES-GCM-SIV 2019-08-25 16:38:01 +02:00
Olivier Chéron
0075b57f90 Add internal AES CTR variant with 32-bit counter
This variant of CTR mode is used by AES-GCM-SIV.  The counter is in
little-endian format and uses the first four bytes of the IV only.
2019-08-25 08:55:49 +02:00
Olivier Chéron
262252a5c4 Merge pull request #291 from ocheron/p256-point-add
Faster P256.pointAdd
2019-08-25 08:51:58 +02:00
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
4ca77b8cf5 Faster P256.pointAdd
Convert to projective coordinates without expansive calls to function
'scalar_mult'.
2019-08-21 09:32:53 +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