Commit Graph

870 Commits

Author SHA1 Message Date
James Clarke
2b43be4d84 Fix many cases of unaligned accesses 2017-06-25 18:10:55 +01:00
Olivier Chéron
bc72179d89 Merge pull request #174 from vorlonofportland/master
Actually process unaligned data through trampoline buffer
2017-06-24 09:07:21 +02:00
Steve Langasek
7f0f5bd3fa Actually process unaligned data through trampoline buffer
Follow-on to commit ba10930, which implemented a trampoline buffer but then
used the unaligned input character array instead.  This commit /actually/
fixes #108, having been tested on an affected architecture :)
2017-06-23 21:46:43 -07:00
Olivier Chéron
c80df7ffc3 Merge pull request #173 from remove-blake2-sse-flag 2017-06-22 21:26:48 +02:00
Olivier Chéron
bf0a476187 Update decaf to upstream commit 'b29565f'
Fix assertion on x448(0)
2017-06-19 21:15:03 +02:00
John Galt
1cb7bdfc5f Remove support_blake2_sse flag in favor of support_sse 2017-06-19 08:57:26 -04:00
Vincent Hanquez
1bcfa2e087 Merge pull request #167 from ocheron/eddsa-minimal
Improve Curve448 and add Ed448
2017-06-19 13:49:07 +01:00
Vincent Hanquez
8c39200e00 Merge pull request #172 from trofi/master
fix build failure with -f-support_deepseq disabled
2017-06-19 13:28:26 +01:00
Sergei Trofimovich
d911a34258 fix build failure with -f-support_deepseq disabled
How to reproduce:

```
$ cabal configure -f-support_deepseq
Resolving dependencies...
Configuring cryptonite-0.23...

$ cabal build
Building cryptonite-0.23...
Preprocessing library cryptonite-0.23...
[114 of 120] Compiling Crypto.PubKey.RSA.Types ( Crypto/PubKey/RSA/Types.hs, dist/build/Crypto/PubKey/RSA/Types

Crypto/PubKey/RSA/Types.hs:48:30: error:
    • No instance for (NFData Integer) arising from a use of ‘rnf’
    • In the first argument of ‘seq’, namely ‘rnf n’
      In the expression: rnf n `seq` rnf e `seq` sz `seq` ()
      In an equation for ‘rnf’:
          rnf (PublicKey sz n e) = rnf n `seq` rnf e `seq` sz `seq` ()
```

The fix is to inctoruce 'NFData Integer' instance to `Crypto/Internal/DeepSeq`.

Closes: https://github.com/haskell-crypto/cryptonite/issues/171
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-06-19 10:37:23 +01:00
Vincent Hanquez
588c61406e Merge pull request #168 from ocheron/decode-p256
Validate P256 point when decoding
2017-06-18 07:43:52 +01:00
Olivier Chéron
b0d207c77b Test point encoding/decoding with Crypto.ECC 2017-06-10 14:33:37 +02:00
Olivier Chéron
e71d9b135c Derive Show,Data,Typeable when defining curve singletons 2017-06-10 14:26:59 +02:00
Olivier Chéron
5c2988716e Validate P256 point when decoding
Fixes #165.
2017-06-10 14:26:59 +02:00
Olivier Chéron
a879845434 Add note about the optional all-zero test
This is actually a lie: the condition is tested in both curve
implementations but not returned by the Haskell API.  Will be a reminder to
add this in the future.  A function 'allocRetAndFreeze' could be useful.
2017-06-04 19:25:19 +02:00
Olivier Chéron
8d51bce071 Reorder C sources based on symbol dependencies
GHCi dynamic loader processes modules in order and expects to resolve
symbols at each intermediate step.
2017-06-04 19:25:19 +02:00
Olivier Chéron
8ecde60853 Compilation warnings on Windows 2017-06-04 19:25:19 +02:00
Olivier Chéron
8be9856402 Compilation warnings on OpenBSD
Replaces unnecessary aligned(32) with aligned(16) instead.
2017-06-04 19:25:19 +02:00
Olivier Chéron
75e3bd555e Add Show instances for EdDSA secret keys
Other algorithms define Show instances for their secrets.
Here ScrubbedBytes will obfuscate the content anyway.

Will be useful for X509.PrivKey, which requires a Show instance.
2017-06-04 19:25:19 +02:00
Olivier Chéron
3c89f0d0b7 Simplify decaf build with Cabal
Keeping only one finite field, header 'f_field.h' can be included
from Cabal standard 'include-dirs'.
2017-06-04 19:25:19 +02:00
Olivier Chéron
961dd63eaf Remove decaf code related to SHAKE
Use cryptonite code instead.
2017-06-04 19:25:19 +02:00
Olivier Chéron
4392ef57b8 More EdDSA vectors from RFC 8032 2017-06-04 19:25:19 +02:00
Olivier Chéron
6805ddd4f7 Add support for Ed448
This replaces the Diffie-Hellman API that was previously exported.
2017-06-04 19:25:19 +02:00
Olivier Chéron
6fb412e2af Use decaf_x448_derive_public_key 2017-06-04 19:25:19 +02:00
Olivier Chéron
6b4621b14f Remove previous X448 implementation
This ensures it is not necessary anymore.
2017-06-04 19:25:19 +02:00
Olivier Chéron
23b359d842 Switch Haskell APIs to decaf implementation
Module 'Curve448' now use decaf.
2017-06-04 19:25:19 +02:00
Olivier Chéron
efcae3ac11 Added generation tools
This generates all decaf files from the original repo.
2017-06-04 19:25:19 +02:00
Olivier Chéron
b3d9156846 Added code from decaf library
In sync with upstream commit '0a6e968'.
2017-06-04 19:25:19 +02:00
Olivier Chéron
7472caf838 Test Curve25519.toPublic 2017-06-02 19:37:25 +02:00
Olivier Chéron
ac7eaac523 Simplify Ed25519.generateSecretKey 2017-06-02 19:37:25 +02:00
Olivier Chéron
51b36f77b8 Test for Ed25519 signature verification 2017-06-02 19:37:25 +02:00
Olivier Chéron
b3b2e86b53 Merge pull request #164 from ocheron/iv-arith
Fix ivAdd overflow behaviour
2017-06-01 21:04:55 +02:00
Olivier Chéron
edd5d94bd4 Make ivAdd more constant-time
All IV bytes are processed even if accumulator is zero.
2017-05-31 23:31:29 +02:00
Olivier Chéron
07592ab237 Fix ivAdd overflow behaviour 2017-05-26 09:59:54 +02:00
Olivier Chéron
8fb59dfc19 Test IV arithmetic
With emphasis on ivAdd overflow behaviour.
2017-05-26 09:59:54 +02:00
Olivier Chéron
c6caba88ed Merge pull request #159 from wangbj/patch-1
Allow sign/verify digest directly
2017-05-26 09:52:53 +02:00
Baojun Wang
a8902fe119 remove redundant condition test on `hashLen /= B.length mHash` 2017-05-18 21:00:14 -07:00
Olivier Chéron
a32489ce32 Merge pull request #162 from 3noch/patch-1
Fix docs for Argon variants
2017-05-18 20:40:34 +02:00
Elliot Cameron
8971458e06 Fix docs for Argon variants 2017-05-17 17:11:00 -04:00
Baojun Wang
4270f00277 Use `Digest hash` to represent message digest 2017-05-16 10:54:31 -07:00
Baojun Wang
f9a0bc3c53 Allow sign/verify digest directly
currently sign/verify works on message directly, it would be nice if PSS could sign/verify digest directly. This is useful for:

  1) for some signing server it only has a digest (without message)
  2) message could be very large, for cases when client need request a singing server to sign, it may make more sense for the client to compute digest, then ask server to (PSS) sign the digest
  3) openSSL pkeyutl (PSS) sign operation signs with digest only, not the message, it would be nice to work with openSSL more easily 

*openSSL command line:
```shell
openssl pkeyutl -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:-1  -pkeyopt digest:sha256 -sign -inkey "pri.key" -in hmac.bin > sig.bin
openssl pkeyutl -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:-1  -pkeyopt digest:sha256 -verify -inkey "pri.key" -in hmac.bin -sigfile sig.bin
```
2017-05-15 19:42:19 -07:00
Olivier Chéron
554f0fc701 Restore Haddock comment in tutorial module
Need to use ordinary comments instead of nested comments
because LANGUAGE pragmas were removed otherwise.

Also adds a table of contents.  We may have other examples
in the future.
2017-05-05 07:21:52 +02:00
Vincent Hanquez
8a9bd75dc7 Merge pull request #157 from ixmatus/parnell/adding-ed25519-seckey-generator
ed25519: Adding generateSecretKey and a unit test
2017-05-03 04:32:48 +01:00
Parnell Springmeyer
94d67ad86d
ed25519: Adding generateSecretKey and a unit test 2017-05-02 16:18:26 -05:00
Vincent Hanquez
f26c02278f bump version to 0.23 2017-04-25 17:21:14 +01:00
Vincent Hanquez
274c422be2 update CHANGELOG 2017-04-25 17:19:31 +01:00
Vincent Hanquez
737959dc76 Merge pull request #156 from haskell-crypto/hash-update
Hash update
2017-04-25 17:15:44 +01:00
Vincent Hanquez
468d8fe582 require memory at least 0.14.5 2017-04-25 16:06:49 +01:00
Vincent Hanquez
67dd8ed7fc [Hash] change Digest to use a foundation UArray that have configurable pinnable memory setting 2017-04-25 14:23:13 +01:00
Vincent Hanquez
a9fd1f079d [Hash] update part of Crypto.Hash.IO to ScopeTypeVariable 2017-04-25 14:22:20 +01:00
Vincent Hanquez
53bd6c13b7 Add missing extension 2017-04-25 14:21:53 +01:00