Commit Graph

153 Commits

Author SHA1 Message Date
Olivier Chéron
72c3fa0f6a Update decaf to upstream commit '807a7e6'
* Don't use vector arithmetic in generic arch_32

* fix comments add/subtract
2017-09-17 11:45:26 +02:00
James Clarke
2b43be4d84 Fix many cases of unaligned accesses 2017-06-25 18:10:55 +01: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
bf0a476187 Update decaf to upstream commit 'b29565f'
Fix assertion on x448(0)
2017-06-19 21:15:03 +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
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
6b4621b14f Remove previous X448 implementation
This ensures it is not necessary anymore.
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
Vincent Hanquez
75e98e9699 Merge pull request #138 from haskell-crypto/blake2-update
Blake2 & Argon2
2017-02-24 15:31:38 +00:00
Vincent Hanquez
253bf0cb8b Argon2: add working hash function
* Cleanup argon c files:
  * Remove encoded format and base64 encoder
  * Remove verification code
  * Remove all variants based simple caller
* Add basic hashing function
* Add a simple KAT test
* Define more things at the haskell level
2017-02-24 13:37:40 +00:00
cielavenir
ad40f40818 Merged Keccak code into SHA3 2017-02-24 21:04:46 +09:00
Vincent Hanquez
a5b6fdc36e add Argon2 C sources 2017-02-20 11:46:17 +00:00
Vincent Hanquez
b4db1dab33 remove executable attribute on sha3.[ch] 2017-02-20 11:34:48 +00:00
Vincent Hanquez
956904e3c2 hide X448 base point export 2017-02-20 11:27:19 +00:00
Vincent Hanquez
139b204c6b add latest version of blake2 and reference to it 2017-02-20 07:32:50 +00:00
Vincent Hanquez
2932df9e24 Merge branch 'master' of https://github.com/haskell-crypto/cryptonite 2017-02-20 07:06:14 +00:00
Vincent Hanquez
bcada64bf5 fix compilation on openbsd and introduce more alignment compat fucntions 2017-02-20 07:05:44 +00:00
Vincent Hanquez
7286cb832a Add better constants for trampoline buffer 2017-02-14 23:01:18 +00:00
Olivier Chéron
d8ed5ce9f1 Add SHAKE128 and SHAKE256 as HashAlgorithm instances
Generalizes SHA-3 code for SHAKE support and uses GHC type-level literals
to keep the output length variable.
2017-02-14 23:01:18 +00:00
Nicolas DI PRIMA
002f300021 add fastpbkdf2 with sha512 2017-02-11 14:08:27 +00:00
Nicolas DI PRIMA
4189aa9389 Port Fast PBKDF2 for sha1 and sha256 2017-02-11 14:08:23 +00:00
Vincent Hanquez
ba10930add process unaligned data through a trampoline buffer when architecture needs it
should fix #108
2016-12-09 15:04:02 +00:00
Vincent Hanquez
12a26c14c4 add basic support for unaligned key/iv in chacha. barely tested 2016-12-09 15:02:51 +00:00
Vincent Hanquez
12e5eca4ea add basic framework to tests and query for alignments 2016-12-09 15:01:58 +00:00
Dom Crossley
a251c9ff15 Update the index into a partial Poly1305 buffer instead of overwriting 2016-12-07 09:33:55 +00:00
Brandon Hamilton
bfaf1d324d Correct XSalsa20 initialization when using 8/12 rounds 2016-10-09 22:26:37 +02:00
Brandon Hamilton
548cbb6f79 Implement the XSalsa20 stream cipher 2016-10-09 15:25:31 +02:00
Vincent Hanquez
8e0d34ff4d [random] re-use standard instruction 2016-07-11 06:59:12 +01:00
Vincent Hanquez
8c19352e48 [rdrand] add possible workaround for fPIC building 2016-06-14 07:24:08 +01:00
Vincent Hanquez
f5a811e755 [rdrand] add an untested workaround for i686 machine 2016-06-03 07:12:38 +01:00
John Galt
aa7269c6dc [Curve25519] Enabled 64-bit implementation 2016-04-20 11:23:51 -07: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
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
ec130aeca0 x448: set WBITS to 32 bits on 32 bits architectures 2016-02-17 07:05:25 +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
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
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
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
093f1af8e4 Merge pull request #41 from kinoru/master
Fix typo: Kekkak -> Keccak
2015-11-18 15:38:19 +00:00
John Galt
4df1ead592 Removed unnecessary code 2015-11-13 15:56:25 -05:00
John Galt
64d7dca79a Prevented internal blake2 functions from being exported 2015-11-13 15:49:13 -05:00
John Galt
880dfae098 Added BLAKE2 support 2015-11-12 12:33:20 -05:00
kinoru
558c21491e Fix typo: Kekkak -> Keccak
The SHA-3 winning algorithm's name is Keccak (pronounced "catch-ack"),
not Kekkak.

- <http://keccak.noekeon.org/>
- <http://www.nist.gov/itl/csd/sha-100212.cfm>
- <https://en.wikipedia.org/wiki/SHA-3>
2015-10-27 14:56:42 +00:00
Edmund Grimley Evans
4beda3a49d Avoid endianess problems in integerify()
This fixes a build failure in KDF/Scrypt. Fixes #30.
2015-08-27 14:52:03 +02:00
Vincent Hanquez
69d8dd1a08 [tidy-exports] properly prefix aesni stuff 2015-06-21 15:16:05 +01:00
Vincent Hanquez
e6d3518c2e [tidy-exports] properly prefix gf_mul(x) 2015-06-21 15:11:02 +01:00
Vincent Hanquez
03074526d6 [tidy-exports] properly prefix initialize_hw with cryptonite_aesni_ 2015-06-21 15:06:27 +01:00
Vincent Hanquez
5812bce10f [tidy-exports] mark gmtab as static 2015-06-21 15:05:46 +01:00
Vincent Hanquez
b859083d19 [ed25519] add missing 32 bits files 2015-06-19 11:14:06 +01:00
Vincent Hanquez
6cf72ac2de [random] add missing header 2015-06-01 14:02:47 +01:00
Vincent Hanquez
f37618d00f [random] add sysrand base. WIP 2015-06-01 13:37:32 +01:00
Vincent Hanquez
b9e6bff690 fix a bug in serialization 2015-05-30 10:37:24 +01:00
Vincent Hanquez
78fa0c3650 [P256] implement missing function, and remove un-implementable one.
remove temporary removal, and properly fixes #1
2015-05-29 15:47:25 +01:00
Vincent Hanquez
1dacb7fa94 [Salsa] opaquify the state just like for hash functions
add more tests
2015-05-22 14:04:54 +01:00
Vincent Hanquez
9a69c61e84 [ChaCha] opaquify the state to be handled directly in the C level just like the hash function
increase the number of tests
2015-05-22 14:04:27 +01:00
Vincent Hanquez
81e335cfff [HASH] re-enable SHA512t 2015-05-06 07:53:51 +01:00
Vincent Hanquez
df3c3523a4 [P256] add a point_add function 2015-05-04 06:56:27 +01:00
Vincent Hanquez
98463b6dad [P256] export SECP constants using the cryptonite_ prefix 2015-05-03 19:49:42 +01:00
Vincent Hanquez
e1e449d121 add google's mincrypt p256 2015-04-22 07:07:04 +01:00
Vincent Hanquez
d595c01c09 [Ed25519] typo in C file 2015-04-19 09:21:19 +01:00
Vincent Hanquez
5c851e3d01 [ED25519] add ed25519-donna C files 2015-04-18 21:38:04 +01:00
Vincent Hanquez
488bc980aa [hash] mark update function buffer as const 2015-04-18 12:20:38 +01:00
Vincent Hanquez
c9a28daf0c [RDRAND] use better C type for casting to prevent a warmless warning 2015-04-11 15:12:51 +01:00
Vincent Hanquez
e302eb51ba [AES] add prefix cryptonite_aes_ prefix everwhere 2015-04-11 15:08:44 +01:00
Vincent Hanquez
e74448aeb4 cryptonitize AES, and add foreign function interfaces to it (not exported). 2015-04-05 10:44:23 +01:00
Vincent Hanquez
087a2f118a fix usage of cryptonite_chacha_init 2015-03-29 07:43:31 +01:00
Vincent Hanquez
06832d678d add random generation through chacha 2015-03-28 15:33:03 +00:00
Vincent Hanquez
ec26f9a25b add initial support for curve25519 2015-01-27 06:20:19 +00:00
Vincent Hanquez
6ba2a6b6b6 support proper SHA3 2015-01-18 16:09:07 -08:00
Vincent Hanquez
c291952018 fix symbol 2015-01-18 16:08:53 -08:00
Vincent Hanquez
1d706a3ef1 rename file 2015-01-15 04:58:35 -08:00
Vincent Hanquez
6195bd40af merge cipher-aes C files in cryptonite 2015-01-15 04:58:25 -08:00
Vincent Hanquez
1f9d7af56f add a working implementation of scrypt. 2014-08-23 16:36:29 +01:00
Vincent Hanquez
903ff726a2 add kekkak 2014-08-14 13:47:41 +02:00
Vincent Hanquez
2e5e428bb1 correct CPP header for salsa 2014-08-01 04:45:14 -07:00
Vincent Hanquez
4fcb859cc3 make the comment more precise. 2014-08-01 04:44:52 -07:00
Vincent Hanquez
474734ecba add a salsa_core_xor export for scrypt. 2014-08-01 04:44:35 -07:00
Vincent Hanquez
63cd646817 add array_xor32 to copy+xor an array of 32 bits values. 2014-08-01 04:43:18 -07:00
Vincent Hanquez
f2bfecfa3e add RC4 2014-07-21 10:58:42 +01:00
Vincent Hanquez
7185a5b871 unexpand QR macro in salsa 2014-07-19 20:30:23 +01:00
Vincent Hanquez
f328269199 mark salsa load32 as static inline 2014-07-19 18:00:54 +01:00
Vincent Hanquez
5097e18d30 Merge branch 'entropy'
Conflicts:
	cryptonite.cabal
2014-07-19 15:07:59 +01:00
Vincent Hanquez
8562223d57 fix some harmless warnings with LLVM with signed vs unsigned buffer types. 2014-07-18 15:32:55 +01:00
Vincent Hanquez
4e955ad505 merge entropy from crypto-random 2014-07-09 08:12:34 +01:00
Vincent Hanquez
09feb59f62 merge cryptohash 2014-07-07 14:55:55 +01:00
Vincent Hanquez
ec1a44881d fix empty loop in poly1305 for final case 2014-07-07 08:10:37 +01:00
Vincent Hanquez
336093c53b Merge branch 'salsa'
Conflicts:
	README.md
	cryptonite.cabal
	tests/Tests.hs
2014-07-07 08:10:31 +01:00
Vincent Hanquez
d6af6ff023 Merge remote-tracking branch 'origin/poly1305' 2014-07-07 08:05:54 +01:00
Vincent Hanquez
16eb6fa387 Add Salsa20 cipher. most is copied from the ChaCha implementation 2014-07-07 08:04:57 +01:00
Vincent Hanquez
937d52c1a6 fix generate dst offset. not used anyway for now 2014-07-07 08:03:54 +01:00
Vincent Hanquez
bb3d38215f fix sign-ess warning with string constants 2014-07-07 06:42:29 +01:00
Vincent Hanquez
be7ffaac80 add chunking tests and fix a buf with partial buffer 2014-07-07 04:59:47 +01:00
Vincent Hanquez
c4c0802f80 Add working implementation of poly1305 with 1 test vector. 2014-07-06 15:44:54 +01:00