Commit Graph

219 Commits

Author SHA1 Message Date
Olivier Chéron
9cd77ed3e2 Test points with a torsion component 2017-12-17 09:46:42 +01:00
Olivier Chéron
0820cd5c38 Simpler Edwards25519.scalarGenerate 2017-12-16 11:33:38 +01:00
Olivier Chéron
fbe1c213e2 Use throwCryptoError 2017-12-11 06:40:41 +01:00
Olivier Chéron
45723e3542 Rename to Edwards25519 2017-12-10 21:14:47 +01:00
Olivier Chéron
d472d9b74f Import Ed25519 unqualified 2017-12-10 21:13:09 +01:00
Olivier Chéron
8d7e0d236c Add P256.pointNegate 2017-11-20 19:28:17 +01:00
Olivier Chéron
e8f1bc08c8 Decrease iterations of ECC tests 2017-11-20 19:28:17 +01:00
Olivier Chéron
4f7d742461 Export and test ECC.pointNegate 2017-11-20 19:28:16 +01:00
Olivier Chéron
5778909761 Add Ed25519.pointsMulVarTime 2017-11-20 19:28:16 +01:00
Olivier Chéron
416fc649e1 Test Ed25519 arithmetic primitives 2017-11-20 19:28:16 +01:00
Olivier Chéron
bb2363eea7 Add CAST5 aka CAST-128
Haskell translation of RFC 2144.
2017-09-17 11:28:56 +02:00
Olivier Chéron
5c4458d626 Test ECC functions ecdh and ecdhRaw 2017-07-05 22:24:22 +02:00
Olivier Chéron
8e274f8e60 Validate output point when calling P256.pointFromBinary
Function unsafePointFromBinary is added when validation is not needed.
2017-07-05 22:24:22 +02: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
Olivier Chéron
b0d207c77b Test point encoding/decoding with Crypto.ECC 2017-06-10 14:33:37 +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
7472caf838 Test Curve25519.toPublic 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
8fb59dfc19 Test IV arithmetic
With emphasis on ivAdd overflow behaviour.
2017-05-26 09:59:54 +02:00
Parnell Springmeyer
94d67ad86d
ed25519: Adding generateSecretKey and a unit test 2017-05-02 16:18:26 -05:00
Vincent Hanquez
4f988181c7 Merge pull request #150 from SamProtas/twofish
Twofish
2017-04-12 07:47:19 +01:00
Sam Protas
762d818ec0 Twofish 192 and 256 bit key support 2017-04-10 00:33:54 -04:00
Sam Protas
7eedbaa112 Initial implementaiton with passing tests 2017-04-02 18:34:10 -04:00
Nicolas DI PRIMA
653e67d221 add tests for the new digest sizes 2017-03-13 00:25:04 +00:00
Olivier Chéron
f9b593520f Fixed test suite when base < 4.7
ExistentialQuantification is needed for HashAlg.
2017-02-26 16:27:55 +01: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
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
Vincent Hanquez
7378fe3f45 add some missing blake2 modes 2017-02-14 16:26:44 +00:00
Vincent Hanquez
e3ef0684f9 Merge pull request #132 from NicolasDP/master
Add Fast PBKDF2 for SHA1, SHA256 and SHA512
2017-02-14 09:43:21 +00:00
Nicolas DI PRIMA
4bd98c80e0 add tests for pbkdf2 sha512 for both haskell's and fast implementation 2017-02-11 14:08:28 +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
d2a8763918 Merge pull request #125 from colatkinson/fix_prime_size
Fix generated primes being too large
2017-02-09 07:48:16 +00:00
Vincent Hanquez
e76bbaa8a7 Merge pull request #63 from tekul/otp
[For Review] HOTP and TOTP implementation
2017-01-29 20:09:29 +00:00
Olivier Chéron
f832c328d0 Use new module name Crypto.PubKey.Curve448 2017-01-19 20:26:25 +01:00
Olivier Chéron
6d4a2bb707 Rename Ed448 to Curve448
This makes the API uniform for both D-H functions, avoids
confusion and leaves the name Ed448 available for EdDSA.
2017-01-19 20:26:25 +01:00
Colin Atkinson
a218b4ea3b Update tests for new generate(Safe)Prime
Update generatePrime test to test smaller bit sizes

Add test for generateSafePrime

Remove -fobject-code
2017-01-19 00:12:02 -05:00
Brandon Hamilton
548cbb6f79 Implement the XSalsa20 stream cipher 2016-10-09 15:25:31 +02:00
Olivier Chéron
5630efb5f9 Decreased QuickCheck iterations 2016-09-11 18:37:10 +02:00
Olivier Chéron
43233cb911 Double-scalar multiplication using Shamir's trick 2016-09-10 12:05:46 +02:00
Olivier Chéron
5d42d817ec Add new hash algorithms to ECDSA tests 2016-08-25 18:13:15 +02:00
Olivier Chéron
75d83d75e7 Prepare utility functions for more hash algorithms 2016-08-25 18:11:57 +02:00
Vincent Hanquez
18a9634bb7 Merge pull request #92 from Bodigrim/number-f2m
Arithmetic over F2m
2016-07-28 20:23:38 +01:00
Luke Taylor
fb66c35f46 Add a check for salt length in bcrypt function
Raises an error (as the original doc claimed) if the salt is not the
required length of 16 bytes.

validatePasswordEither doesn't require separate checking since the hash
length as a whole is checked, implicitly ensuring the salt is the right
length. Therefore it shouldn't be possible to trigger the error by
calling this function.

Fixes #93.
2016-07-27 17:45:33 +02:00
Bodigrim
e80eaa56f3 Tests for Crypto.Number.F2m 2016-07-24 10:58:50 +02: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
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
5e76b8af5f apply convertFromBase. 2016-06-08 01:05:08 +09:00
John Galt
e2b0e9ee6b [Ed448] Fixed incorrect base point 2016-04-18 13:25:11 -07:00
Vincent Hanquez
a73c1b9171 [CMAC] drop the accessor in favor of just using the ByteArrayAccess constraint 2016-04-09 10:31:13 +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
f99827c05d Drop unused imports. 2016-04-07 15:33:00 +09:00
Kei Hibino
4442744b1d Add the smart constructor of CMAC type. 2016-04-06 09:41:50 +09:00
Kei Hibino
a3255c7ab5 Add test suite of MiyaguchiPreneel. 2016-04-04 09:37:34 +09:00
Kei Hibino
b704f2c02a Add test-suite of CMAC. 2016-04-01 19:26:16 +09:00
John Galt
a04b56d2a3 Added Ed448-Goldilocks support 2016-02-09 01:22:55 -07:00
Luke Taylor
f2e5942246 Add totpVerify function
Also adds a ClockSkew type which limits the acceptable clock skew window
to a limited number of time steps.
2016-01-10 18:19:53 +00:00
Luke Taylor
5217b6dbfd Add TOTP KAT tests for SHA256 and SHA512 2016-01-04 19:37:03 +00:00
Luke Taylor
0be97fc5ca Add hash parameter to hotp function
While HOTP only mentions SHA1, TOTP allows the use of different hash
functions, which implicitly requires that the HOTP implementation support
them too.

This will also allow users to use HOTP with another hash if they so choose,
though it would not be compatible with most client applications, such as
Google authenticator.
2016-01-04 19:04:38 +00:00
Luke Taylor
47d202a90f Add TOTParams data type
Reduce the arguments to the totp function (most people will use defaults)
and allows validation of the time step value.

Added a top-level module overview.
2015-12-28 17:23:26 +00:00
Vincent Hanquez
43890b1175 Add support for HKDF (RFC 5869) 2015-12-28 14:32:07 +00:00
Luke Taylor
88a2cd80f6 Add TOTP function and KATs
Just uses SHA1 for now. HashAlgorithm is ignored.
2015-12-27 19:13:22 +00:00
Luke Taylor
48f0598cc7 Make OTP resynch values a tuple
This is clearer than having two separate arguments.
2015-12-27 18:43:00 +00:00
Luke Taylor
c5b3622562 Add an OTP resynchronize function
Allows server to reset its counter to the client's current value, given
a sequence of one or more OTP values.
2015-12-20 23:33:52 +00:00
Luke Taylor
476f7c10d5 One-time password (OTP) implementation
Initial commit

- Implementation of HOTP algorithm as defined in RFC 4226
- Tests using values from the spec
2015-12-20 23:04:14 +00: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
081a14326e [tests] remove duplicated symbol in BCrypt 2015-11-19 14:23:45 +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
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
320186cdd1 Fix endianness of incrementNonce function for ChaChaPoly1305 2015-11-16 12:59:01 -05:00
Vincent Hanquez
2191dddf5b [Curve25519] use the Crypto.Error api instead of an Either type for parsing types 2015-11-02 11:17:19 +00: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
John Galt
55c6988a6e Added support for incrementing Nonces 2015-10-05 14:08:08 -04:00
Vincent Hanquez
b00a1a2553 [tests] expands tabs, and remove redundant binding 2015-08-30 07:49:30 +01:00
Vincent Hanquez
5f72788041 [tests] fix last number test problem 2015-08-27 15:42:08 +01:00
Vincent Hanquez
3af592e997 [tests] make sure we don't use 0 for number parameters 2015-08-27 15:03:07 +01:00
Luke Taylor
a888501bb8 Add bcrypt tests
Mostly copied from openwall source, leaving out the unsupported 2x
tests and special bug-related tests for passwords containing 0xFF bytes.
2015-08-26 10:33:36 +01:00
Vincent Hanquez
cd8f70e062 [Padding] add PKCS5/PKCS7 padding/unpadding methods 2015-08-18 12:03:05 +01:00
Vincent Hanquez
8a0bacfc6d [Poly1305] make initialize explicitely failable 2015-07-29 09:49:49 +01:00
Vincent Hanquez
e064af5cba [chachapoly1305] properly handle the decryption, and change combine to encrypt. 2015-07-29 07:24:46 +01:00
Vincent Hanquez
169570c963 fix 0 case. 2015-07-29 07:13:04 +01:00
Vincent Hanquez
ce849fb0d2 [ChaChaPoly1305] add implementation and simple KAT test 2015-07-19 17:53:56 +01:00
Vincent Hanquez
58c6efe4c4 [tests] introduce a new checker for hunit based on the property checker 2015-07-19 17:53:07 +01:00
Vincent Hanquez
6e5ad0c640 [tests] reduce the size of the number generated as this basically block the test suite now 2015-07-19 17:52:35 +01:00
Luke Taylor
4e1437d4fd Minor haddock fixes
Fix some incorrect parameter descriptions and spelling/typos.
2015-06-07 13:26:26 +02:00
Vincent Hanquez
59bc2a9528 [tests] remove unnecessary binding in P256 2015-06-01 13:03:38 +01:00
Vincent Hanquez
6c8ab6b610 [tests] remove unnecessary modules 2015-06-01 13:03:29 +01:00
Vincent Hanquez
69723be05c [tests] add the reverse of the previous number kat test 2015-06-01 10:46:59 +01:00
Vincent Hanquez
360f4f51dc [tests] add some vectors for i2ospOf_ 2015-06-01 10:41:42 +01:00
Vincent Hanquez
f63a3c6025 [p256] fix all the bugs found by the now useful P256 test suite 2015-06-01 07:48:31 +01:00
Vincent Hanquez
2c112b8877 [tests] generate smaller number in one of the case 2015-06-01 07:47:40 +01:00
Vincent Hanquez
1d383a3d12 [ECC] add a simple property test for point addition 2015-06-01 05:59:08 +01:00
Vincent Hanquez
1634c6bbb5 [tests] add missing extension related to previous commit 2015-06-01 05:58:43 +01:00
Vincent Hanquez
df5ed2a4e9 [tests] add a more elaborate report testing for property checks 2015-06-01 05:58:32 +01:00
Vincent Hanquez
f79081670c [tests] add better range integer generation. by default the number generated are fairly small. 2015-06-01 05:58:15 +01:00