Commit Graph

608 Commits

Author SHA1 Message Date
John Galt
7d83ff16f8 rdrand-related code and build flag changes
Combined commits between 0.15 and 0.19:

- Decoupled -DARCH_X86_64 and support_rdrand
- add an untested workaround for i686 machine
- limit to i686 and x86_64
- add possible workaround for fPIC building
- re-use standard instruction
2016-08-22 13:34:38 +02:00
John Galt
ab3ca7b5df [Ed448] Fixed incorrect base point 2016-08-22 13:05:44 +02:00
Vincent Hanquez
5eb71a90ec bump version to 0.15 2016-04-09 17:16:08 +01:00
Vincent Hanquez
0c3f68929b Fix serialization of ECDH and DH 2016-04-09 17:13:51 +01:00
Vincent Hanquez
e76d43470d bump version to 0.14 2016-04-09 14:46:14 +01:00
Vincent Hanquez
fd24980530 [ECC] add Bounded instance to CurveName 2016-04-09 13:46:06 +01:00
Vincent Hanquez
605e5cf6a6 Merge branch 'master' of https://github.com/haskell-crypto/cryptonite 2016-04-09 13:45:18 +01:00
Vincent Hanquez
0fa83e32d8 [ECDH][DH] change SharedKey representation to be the usual bytes-like representation
Prevent mistake when the serialization is not done properly, for example missing
the padding when necessary.
2016-04-09 13:45:05 +01:00
Vincent Hanquez
e29c8a6fe5 [DH] Keep The field size in bits, in Params 2016-04-09 13:41:40 +01:00
Vincent Hanquez
a73c1b9171 [CMAC] drop the accessor in favor of just using the ByteArrayAccess constraint 2016-04-09 10:31:13 +01:00
Vincent Hanquez
6164968912 update CHANGELOG 2016-04-09 08:46:30 +01:00
Vincent Hanquez
2b0f0dab9c Merge branch 'master' of https://github.com/haskell-crypto/cryptonite 2016-04-09 08:43:07 +01:00
Vincent Hanquez
81d3e31e0b Merge pull request #75 from khibino/cmac
Adding CMAC support
2016-04-09 08:42:40 +01:00
Vincent Hanquez
d7e26e34ee [random] add a seed capability with export/import from integer.
It decomposes the drgNew call that was gathering entropy then
initializing a ChaChaDRG, into 2 new calls seedNew and drgNewSeed.

drgNew remains unchanged.

The integer importing capability, should be used when wanting to bring
reproducibility to a debugging problem or for testing, otherwise it's
probably a bad idea to use.
2016-04-09 08:33:37 +01:00
Kei Hibino
327d75c2d4 Add comments about irreducible binary polynomial. 2016-04-06 11:59:26 +09:00
Kei Hibino
4442744b1d Add the smart constructor of CMAC type. 2016-04-06 09:41:50 +09:00
Kei Hibino
b704f2c02a Add test-suite of CMAC. 2016-04-01 19:26:16 +09:00
Kei Hibino
ca0c3830eb Add implementation of CMAC. 2016-04-01 19:25:04 +09:00
Vincent Hanquez
149bfa6010 [HKDF] document a bit better extractSkip 2016-03-29 07:17:24 +01:00
Vincent Hanquez
93fad940e4 Improve context memory usage of Keccak and SHA3
saves up to 72 bytes per context for SHA3-512
2016-03-26 10:29:33 +00:00
Vincent Hanquez
f362d50d46 [bcrypt] make the haddock comment reflect what happens to the cost value.
also fix a tpyo
2016-02-25 07:48:30 +00:00
Vincent Hanquez
e5748d5edf correct the description of support_rdrand 2016-02-25 07:45:15 +00:00
Vincent Hanquez
cd6d46170f bump version to 0.13 2016-02-21 09:28:41 +00:00
Vincent Hanquez
b91c5889fa add to CHANGELOG 2016-02-21 09:28:28 +00:00
Mikael Bung
0ca7afcb87 [SECURITY] Fix a buffer overflow in SHA384
Caused by a difference in the size of the digest
byte array allocated on Haskell side and the
amount of bytes copied to it on the C side.

In cbits/cryptonite_sha512.c:cryptonite_sha384_finalize
SHA384_DIGEST_SIZE bytes is copied into the out buffer.
SHA384_DIGEST_SIZE is #defined as 64 in cbits/cryptonite_sha512.h
while the buffer given will have size 48, as defined in
Crypto/Hash/SHA384.hs.

Defining SHA384_DIGEST_SIZE as 48 fixes the issue.
2016-02-21 09:23:36 +00:00
Vincent Hanquez
23a6ad1b35 bump version to 0.12 2016-02-20 06:21:15 +00:00
Vincent Hanquez
cb1aa842dc update CHANGELOG 2016-02-20 06:21:07 +00:00
Vincent Hanquez
ec130aeca0 x448: set WBITS to 32 bits on 32 bits architectures 2016-02-17 07:05:25 +00:00
Vincent Hanquez
6d6a0cbabd bump version to 0.11 2016-02-12 09:46:47 +00:00
Vincent Hanquez
7a7f3a8c81 release update CHANGELOG 2016-02-12 09:46:31 +00:00
Vincent Hanquez
b07a856127 Merge pull request #62 from clinty/dsa-truncate
Do DSS truncation on verify
2016-02-11 08:04:32 +00:00
Vincent Hanquez
e4989deb4f Merge pull request #66 from haskell-crypto/ed448
Added Ed448-Goldilocks support
2016-02-11 08:02:12 +00:00
Vincent Hanquez
c82785473d Workaround bug with old distributions c99 issue
When in c99 mode (which is needed for some of our newer additions),
old distributions has an glibc inlining bug which triggers lots of
duplicated symbols.

Add a cabal flag to revert the inliner to c89 mode.

Fixes #64
2016-02-10 12:05:42 +00:00
John Galt
a04b56d2a3 Added Ed448-Goldilocks support 2016-02-09 01:22:55 -07:00
Vincent Hanquez
b7d12b957b Add support for AIX in bitfn. 2016-02-07 09:44:45 +00:00
Vincent Hanquez
d80a499582 removed bounded names for useless parameter 2016-02-04 07:28:42 +00:00
Vincent Hanquez
4858574955 remove sysrand so that the linker doesn't complain of an empty symbol file on osx 2016-02-04 07:28:22 +00:00
Vincent Hanquez
0849f6d77d comment the WIP sysrand_init 2016-01-16 11:35:25 +00:00
Vincent Hanquez
4fff75d949 update .travis 2016-01-14 19:17:43 +00:00
Clint Adams
4c6b774a3d Do DSS truncation on verify
RFC 4880 and FIPS 186-4 require that DSA signatures truncate the
hash to the size of q.  This changes Crypto.PubKey.DSA.verify
to do so in all cases.
2016-01-10 17:05:37 -05:00
Vincent Hanquez
50631d3150 Add support for blake2s(p) 224 bits 2016-01-09 10:09:35 +00:00
Vincent Hanquez
08edce4ec7 C-Sources are not kept in the order they are defined. fix #58
Cabal links to all C-sources defined unconditionally, then conditionally
append blocks that defined C-Sources; This lead to bug when the order of
.c files are important, like for cabal repl.

Workaround this bug, by defining everything aes related in the
conditional part.
2016-01-05 22:56:29 +00:00
Vincent Hanquez
99049cc66e Merge pull request #53 from kinoru/master
[ChaChaPoly1305] fix type error of example code
2016-01-05 17:49:58 +00:00
Vincent Hanquez
43890b1175 Add support for HKDF (RFC 5869) 2015-12-28 14:32:07 +00:00
Vincent Hanquez
c2d791f2ec bump version to 0.10 2015-12-24 20:38:52 +00:00
Vincent Hanquez
4875406fe5 update CHANGELOG 2015-12-24 20:38:38 +00:00
Vincent Hanquez
823940f2d8 Force blake2 sse support on x86_64 (all having SSE2) 2015-12-24 20:38:17 +00:00
Vincent Hanquez
e4a856d28b Merge pull request #56 from haskell-crypto/blake2-fix
[blake2] Added reference implementation
2015-12-24 20:34:50 +00:00
John Galt
26976b1583 [blake2] Added reference implementation
This commit allows the user to select either the portable reference
implementation or the optimized (SSE) implementation.
2015-12-16 07:49:30 -06:00
kinoru
5a2809a0f8 [ChaChaPoly1305] fix type error of example code
The example code had a type mismatch.

    Couldn't match expected type ‘State’
                with actual type ‘CryptoFailable State’
    In the second argument of ‘appendAAD’, namely ‘st1’
    In the second argument of ‘($)’, namely ‘appendAAD hdr st1’

This is due to the following part:

    let st1 = ChaChaPoly1305.initialize key nonce
        st2 = ChaChaPoly1305.finalizeAAD $ ChaChaPoly1305.appendAAD hdr st1

`initialize` returns `CryptoFailable State`, not `State`.

This commit fixes the type mismatch, changes the return type of the
example function to `CryptoFailable ByteString`, and makes the code
to be immediately copy-and-paste-able.
2015-12-03 18:05:04 +00:00