Commit Graph

103 Commits

Author SHA1 Message Date
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
Sam Protas
04b4c945c0 Add import to fix backwards compatibility 2017-04-10 00:57:49 -04:00
Sam Protas
762d818ec0 Twofish 192 and 256 bit key support 2017-04-10 00:33:54 -04:00
Sam Protas
b658c8a99b Cleanup and performance 2017-04-04 19:29:40 -04:00
Sam Protas
b1a9c7c047 Performance improvements 2017-04-02 19:36:58 -04:00
Sam Protas
7eedbaa112 Initial implementaiton with passing tests 2017-04-02 18:34:10 -04:00
Tim McIver
f5efdee75b Add key length validation to several AES Ciphers. 2016-12-06 22:06:57 -05:00
Brandon Hamilton
548cbb6f79 Implement the XSalsa20 stream cipher 2016-10-09 15:25:31 +02: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
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
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
Vincent Hanquez
7bd3a8f892 [ChaChaPoly1305] Document everything 2015-11-04 15:17:32 +00:00
John Galt
55c6988a6e Added support for incrementing Nonces 2015-10-05 14:08:08 -04:00
Joachim Breitner
507a8f8cea Use mkLE, not LE
to make sure the conversion to little endian is actually happening. This
fixes a test failure in ChaChaPoly1305. Fixes #31.
2015-08-27 14:52:37 +02:00
Vincent Hanquez
ea8cb2d45a [blowfish] remove unnecessary list of word32 for the schedule
Just use the binary's array directly
2015-08-27 10:57:28 +01:00
Luke Taylor
2566e46185 Implement the eksBlowfish function
This modifies the standard blowfish key schedule function to accept an
optional salt and cost as used in bcrypt and modifies the algorithm
accordingly to implement the "expensive" version.

The standard blowfish version is just the same but with a salt value of
zero and a single call to the expandKey function. See the original
bcrypt paper for more details.
2015-08-26 10:33:35 +01:00
Luke Taylor
08ebde2f09 Modify creation of Blowfish key schedule
Changes to create it from an array of Word32, instead of using
mutableArray32FromAddrBE, which seems to reverse the words.
2015-08-26 10:33:35 +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
ce849fb0d2 [ChaChaPoly1305] add implementation and simple KAT test 2015-07-19 17:53:56 +01:00
Vincent Hanquez
ce043f49a1 [AES] fix wrongly indented comment 2015-07-19 17:51:00 +01:00
Luke Taylor
875b80107c Remove unused AES primitives functions and exports
The code for initializing different AEAD modes is now encapsulated in
the BlockCipher type and the individual mode encryption and decryption
functions have been replaced by generalized versions, so are no longer
used.
2015-06-09 11:45:39 +02: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
be75de64e1 [aes] fast track length == 0 with ECB encryption/decryption 2015-06-02 14:22:26 +01:00
Vincent Hanquez
8eaaa06e1e add optional support for deepseq 2015-05-22 18:35:46 +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
ff736b47ca [cipher] use mconcat that force input to be the same as output 2015-05-21 11:06:41 +01:00
Vincent Hanquez
92343f856a add comments and description 2015-05-20 06:07:31 +01:00
Vincent Hanquez
987f9e7bb6 [internal] update to latest memory, and remove builtin support as memory is now available 2015-05-18 18:33:14 +01:00
Vincent Hanquez
26ec954a48 [Cipher] fix salsa and chacha related to chunking 2015-05-12 14:36:50 +01:00
Vincent Hanquez
eaad39a1af remove need for bytearray to marshall Word8s into a Word64 2015-05-11 10:04:56 +01:00
Vincent Hanquez
9ae9e38ce2 move to memory stuff 2015-05-09 14:23:32 +01:00
Vincent Hanquez
e89031c6d6 make AuthTag be a Bytes instead of ByteString 2015-05-06 11:39:07 +01:00
Vincent Hanquez
6ba517e945 [DES] remove DES.Serialization module 2015-05-06 07:52:49 +01:00
Vincent Hanquez
f09bbf55e3 [Chacha/Salsa] cleanup nonce handling and use bufXor 2015-05-03 14:58:59 +01:00
Vincent Hanquez
b4d1a278b3 [QA] remove unnecessary module, and allow on more module to use CPP 2015-05-03 08:43:32 +01:00
Vincent Hanquez
771007ad93 [cipher] Get rid of bytestring in Stream class. 2015-05-02 14:49:49 +01:00
Vincent Hanquez
b497737ef1 [Salsa] use more ByteArray operations instead of bytestring. 2015-04-30 06:07:25 +01:00
Vincent Hanquez
4e12aceee9 remove extra bytestring. 2015-04-24 17:22:25 +01:00
Vincent Hanquez
9dd17fc0c4 use byte array in more places 2015-04-24 17:22:13 +01:00
Vincent Hanquez
ec4e0c4ed9 remove all the byteArray prefix from byteArray function.
instead expect module import to be qualified for functions.
2015-04-24 06:54:33 +01:00
Vincent Hanquez
26006dfe25 [cleanup] remove useless import now that bytearray is exporting necessary bits 2015-04-22 06:25:01 +01:00
Vincent Hanquez
61ee498643 remove further deprecated modules and such 2015-04-20 10:56:39 +01:00
Vincent Hanquez
b487aef898 cleanup module imports 2015-04-20 07:36:51 +01:00
Vincent Hanquez
f86b493e32 remove warnings 2015-04-20 06:02:12 +01:00
Vincent Hanquez
b28b25abe7 [AES] add gcm / ocb support to base AES type 2015-04-18 07:58:52 +01:00
Vincent Hanquez
0e9d52de95 [Cipher] remove the need for bytestring in Block 2015-04-18 06:58:57 +01:00