Commit Graph

360 Commits

Author SHA1 Message Date
Luke Taylor
de17b66e31 Fix buffer length in scrypt
The temporary XY buffer passed to the scrypt_smix C function should be
256r+64 bytes in length, but the Haskell code was only allocating 256r
bytes, causing the additional 64 to be written past the end of the
buffer.

See #91.
2016-06-13 21:08:06 +01:00
Vincent Hanquez
dc8bb8934c Merge pull request #77 from khibino/mp
Adding miyaguchi-preneel hash construction
2016-06-13 05:57:44 +01:00
Kei Hibino
7989dc71b0 fix unpad of zero-padding and add tests. 2016-06-08 22:57:35 +09:00
Kei Hibino
ec7e73401f apply zero-padding to miyaguchi-preneel. 2016-06-08 22:26:14 +09:00
Kei Hibino
c2285db4e3 add zero padding and its test. 2016-06-08 22:23:41 +09:00
Kei Hibino
87867b49bc rename definitions which compute miyaguchi-preneel hash. 2016-06-08 01:13:23 +09:00
Kei Hibino
f9c1aa713f drop cipherInit'. 2016-06-02 17:05:17 +09:00
Denis Redozubov
512605d513 fix documentation typo 2016-05-05 19:51:22 +03:00
John Galt
e2b0e9ee6b [Ed448] Fixed incorrect base point 2016-04-18 13:25:11 -07:00
Kei Hibino
fce698b821 [MP] Drop data constructor access. 2016-04-12 14:53:16 +09:00
Kei Hibino
0f241e31db [MP] drop the accessor in favor of just using the ByteArrayAccess constraint 2016-04-12 11:00:01 +09:00
Vincent Hanquez
0c3f68929b Fix serialization of ECDH and DH 2016-04-09 17:13:51 +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
2b0f0dab9c Merge branch 'master' of https://github.com/haskell-crypto/cryptonite 2016-04-09 08:43:07 +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
5d96c804ae Add infered cipher version. 2016-04-08 16:43:55 +09:00
Kei Hibino
3af88f3145 Add smart constructor of MiyaguchiPreneel hash type. 2016-04-08 16:11:17 +09:00
Kei Hibino
285d9fb433 Specify each chunk type. 2016-04-07 14:43:44 +09: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
5e4b126fc5 Add implementation of MiyaguchiPreneel. 2016-04-03 05:51:07 +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
b07a856127 Merge pull request #62 from clinty/dsa-truncate
Do DSS truncation on verify
2016-02-11 08:04:32 +00:00
John Galt
a04b56d2a3 Added Ed448-Goldilocks support 2016-02-09 01:22:55 -07:00
Vincent Hanquez
d80a499582 removed bounded names for useless parameter 2016-02-04 07:28:42 +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
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
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
Maciej Pietrzak
6020bde0e2 Add support_blake2 flag. 2015-11-30 22:17:21 +01:00
Vincent Hanquez
812b5d1aed [blake2] uncapitalize the modules and types as it's not abbreviation. 2015-11-19 14:24:54 +00:00
Vincent Hanquez
fae5f084cf [Blake2] define the algorithm as a multiple algorithm so that the output digest size is explicit in the digest types. 2015-11-19 12:10:14 +00:00
Vincent Hanquez
69f9d225eb [hash] trim hash algorithm with multiple output size.
The output size is now passed by parameter to the finalize function
instead of being stored in the context. that simplify quite a
bit the passing of this parameter
2015-11-19 11:52:21 +00:00
Vincent Hanquez
ad285be68c [Hash] tweak internal C API to have the hashlen 2015-11-19 11:37:38 +00:00
Vincent Hanquez
2785a50228 Merge pull request #42 from Rufflewind/master
Document the arguments for DH.generateParams
2015-11-18 21:51:53 +00:00
Vincent Hanquez
6ae67d5c91 Merge pull request #46 from centromere/nonce-fix
Fix endianness of incrementNonce function for ChaChaPoly1305
2015-11-18 16:52:27 +00:00
Vincent Hanquez
093f1af8e4 Merge pull request #41 from kinoru/master
Fix typo: Kekkak -> Keccak
2015-11-18 15:38:19 +00:00
John Galt
53270f1ef6 Removed unused language extension 2015-11-16 13:13:18 -05:00
John Galt
320186cdd1 Fix endianness of incrementNonce function for ChaChaPoly1305 2015-11-16 12:59:01 -05:00
John Galt
880dfae098 Added BLAKE2 support 2015-11-12 12:33:20 -05:00
Vincent Hanquez
da2f445690 [Poly1305] fix size of Authentication tag creation from Bytestring 2015-11-06 22:00:49 +00:00