Commit Graph

87 Commits

Author SHA1 Message Date
ECrownofFire 07bcd87294 Add choice of ops and mem limits to pwhash 2018-10-27 23:23:16 -04:00
ECrownofFire d779071285 Add choice of ops and mem limits to pwhash_str
It natively checks atoms, which is kinda messy, but it avoids having to
export the libsodium pwhash constants, which is nice.
2018-10-27 23:22:55 -04:00
Jesper Louis Andersen f650c72b02 version bump 2018-05-21 17:52:25 +02:00
Jesper Louis Andersen bb4014286f version bump 2018-05-21 17:38:39 +02:00
Jesper Louis Andersen edd95498d1 Fix pwhash_str* functions.
The API for pwhash_str returns a cstring in the output buffer. These
are null terminated. However, we return the full buffer as a binary
back to Erlang. This means that we have a buffer with 0'es in the end.

The tests take this buffer and passes it back in as is. Hence all the
tests pass. However, it is conceivable that if we write said buffer to
disk somewhere, we are not going to write those 0's out.

When we then load the ASCII-armored Argon2 string into memory again,
it is not 0-terminated as a cstring should be, and this produces
errors all over the place.

The fix is twofold:

* Return the full buffer to Erlang, but use binary:split/2 to create a
  subbinary with the relevant part.
* Add a 0 in the end of ASCII Argon2 string before passing it to
  libsodium

Since we are looking at pwhashing, and Argon2, we expect the
computational problem to be memory bound. Thus, spending a bit more
work in memory is not going to have any considerable impact on the
speed of this system.
2018-05-21 15:21:09 +02:00
Jesper Louis Andersen e77aca8ecb Improve the description 2018-05-21 13:51:32 +02:00
Jesper Louis Andersen d737552b2a Hello 0.17.0 2018-05-21 13:46:17 +02:00
Jesper Louis Andersen 3b9bc848e9 Move functions around. Mark untested functionality.
A lot of people who pushed functions they missed have not pushed any
kind of test cases for them. To make sure we have test coverage, I've
marked the functions we have under test and the functions we are still
missing tests for.
2018-05-21 12:27:24 +02:00
Jesper Louis Andersen 8b8ceff4ef Fix rebar3 edoc compilation 2018-05-20 20:25:33 +02:00
Jesper Louis Andersen fb7de2cbb4 Merge pull request #21 from aeternity/add_aead_chacha20poly1305
Add AEAD chacha20poly1305
2018-05-20 19:38:14 +02:00
Hans Svensson 2f50ba6289 Also expose crypto_curve25519_scalarmult_base 2018-03-05 15:33:17 +01:00
Hans Svensson 9dfbe8cc90 Expose AEAD ChaCha20 Poly1305 functionality
Note: We expose the modern IETF version but still name it plain
aead_chacha20poly1305.
2018-03-05 09:52:39 +01:00
daveed-al 97ad7a5452 pwhash_str doc update 2018-01-31 18:25:13 +08:00
Jesper Louis Andersen c8403ab198 Merge pull request #19 from technion/indents
Fix mixed tabs and spaces. Fixes #12.
2018-01-02 17:07:00 +01:00
Technion 9d2f90a5c5 Fix mixed tabs and spaces. Fixes #12. 2017-12-31 05:02:18 +00:00
Technion c6de481b2e Changed -spec on generichash/2 and generichash/3.
Fixes #17.
2017-12-31 02:40:22 +00:00
Venkatakumar Srinivasan ba640b0659 Added generic hash NIF 2017-08-11 13:32:04 -05:00
Venkatakumar Srinivasan 36eedc6751 Pulled in latest version of enacl. Added nif's for password hashing functions 2017-08-11 13:32:04 -05:00
Venkatakumar Srinivasan 43cae7c7ea Implemented nif for crypto_pwhash() 2017-08-11 13:32:04 -05:00
Jesper Louis Andersen 61be95caad Bump version to 0.16.0 2017-03-25 23:25:25 +01:00
Jesper Louis Andersen fffe07e965 Reindent everything.
Indentation follows the standard emacs mode for Erlang code.
2017-03-19 19:28:39 +01:00
Alexander Malaev 2da2ba138f Add kx_* functions from libsodium 1.0.12 2017-03-19 18:24:06 +03:00
Doug Huff 3f4b50dbe1 Squash some dialyzer warnings for constants. 2015-10-29 20:35:44 +00:00
Doug Huff 9849e7310a Add unsafe_memzero/1 2015-10-28 21:54:08 +00:00
Doug Huff 4d5524db61 Add chacha stream function access. 2015-10-28 21:53:42 +00:00
Doug Huff ca005d32f9 Add access to siphash-2-4 (no dirty scheduler necessary). 2015-10-28 21:52:25 +00:00
Jesper Louis Andersen 01526484f2 Update the README file with version 0.15.0 2015-08-29 22:17:13 +02:00
Jesper Louis Andersen b1c3e69fb5 Change randombytes/1 so it always executes on a DS
Investigation shows erratic behaviour of the CSPRNG. It may block at times
because it needs to go to the kernel and obtain more random information in
the system. Once this happens, you are blocked for quite a long time, but
we don't generally know when this happens. So just execute these directly
on the dirty scheduler.
2015-08-29 22:09:51 +02:00
Jesper Louis Andersen 2cad66ac2a Handle the ED25519 to Curve25519 conversion routines.
Make sure these either execute on the Dirty Scheduler or execute with bumping
reductions.
2015-08-29 22:08:34 +02:00
Jesper Louis Andersen 2e5163a934 Clean up things which are not needed anymore. 2015-08-29 21:50:16 +02:00
Jesper Louis Andersen a59e983d9e Fix large detached signature verification. 2015-08-29 21:34:08 +02:00
Jesper Louis Andersen 1562eed9a3 Use DS-variants whenever it doesn't make sense.
Some operations are simply too expensive. Always run these on the dirty
scheduler.
2015-08-29 21:33:22 +02:00
Jesper Louis Andersen 66cf275152 Introduce a scalarmult variant which is safe from arguments swaps. 2015-08-29 21:32:48 +02:00
Jesper Louis Andersen 6bfa191f6b Do not create a new set of 0-bytes all the time.
Rather than creating a set of <<0,…,0>> every time and then throwing it away,
we now reuse a constant. They are small enough they are still small-binaries, but a
process can keep them around and use them whenever it needs to go to the
low-level area.
2015-08-29 20:54:37 +02:00
Jesper Louis Andersen 310bb3cc77 Remove the mention of the timing module.
We have a better way to handle this. So we are going to handle it in a better way, by
simply making the direct solution: Fix the crap by using DTrace.
2015-08-29 20:53:43 +02:00
Jesper Louis Andersen a135bce9d3 Simplify the code base, first round:
* Introduce enacl:verify/0 to verify the integrity of the library.
* Always run keypair functions on the dirty schedulers.
* Do not call NIFs when creating zerobytes. Avoid constructing new binary data, but reuse a constant.
* The box/box_open and box_seal/box_seal_open API is so expensive to call there is little overhead in
  running it on the DS always.
2015-08-23 21:44:28 +02:00
Jesper Louis Andersen 9830068304 Cook 0.14.0. 2015-08-14 22:11:45 +02:00
Jesper Louis Andersen f444d1e4ac Fix box_seal/2 and box_seal_open/3.
* Call the functions `box_seal` and `box_seal_open` to match the libsodium names in module `enacl`.
* Fix a bug in the C NIF: We should fail if the input is `<` SEALBYTES but not on `<=` SEALBYTES. The latter made it impossible to encode empty messages.
* Add variants which run directly on the interpreter scheduler for small messages.

Also:

* Provide full EQC functions for the testing purposes. This generated around 13000 random test cases in a 5 minute run, all passing.# Please enter the commit message for your changes. Lines starting
2015-08-14 22:03:33 +02:00
Jesper Louis Andersen 92109eb354 Improve and verify sign_*_detached functions.
Provide non-dirty-scheduler variants for small strings, accurately bump
reductions for these strings.

While here, provide EQC test cases for the two functions.
2015-08-12 23:11:41 +02:00
Amir Ghassemi Nasr 233c924b70 correct enacl:seal_box_open return value 2015-08-09 17:24:12 +04:30
Amir Ghassemi Nasr 64c03a1425 added bindings for crypto_box_seal_open\' functions 2015-08-07 00:24:50 +04:30
Parnell Springmeyer 35515e465a Improvements re: suggestions from @jlouis. 2015-07-26 13:49:15 -05:00
Joel Stanley 7e7ac67fb3 Add bindings to the libsodium DSA operations 'crypto_sign_detached' and 'crypto_sign_verify_detached' 2015-07-26 08:00:48 -05:00
Jesper Louis Andersen 89e28feab8 Bump version to 0.13.0. 2015-05-11 18:25:31 +02:00
Alexander Færøy de0ce86473 Add Ed 25519 Utility API. 2015-04-02 18:43:58 +02:00
Alexander Færøy d34e3bfef1 Remove dot after @end. 2015-04-02 18:15:48 +02:00
Jesper Louis Andersen 2979503a7f Fix the missing priv directory. 2015-03-11 13:41:53 +01:00
Jesper Louis Andersen 7ba5f9888f v0.12.0 - Add new Curve25519 extensions to the API
* Introduce Curve25519 handling.
* Update and bump README.md
* Add contributor file
2015-02-22 15:05:40 +01:00
Alexander Færøy e408278d50 Move the high-level API to enacl_ext 2015-02-22 14:29:44 +01:00
Alexander Færøy ef36bb85c1 Add curve25519_public_key/1. 2015-02-21 23:08:07 +01:00