280 Commits

Author SHA1 Message Date
Jesper Louis Andersen
220ac6640a Fixup edoc compilation 2020-02-10 14:24:05 +01:00
Jesper Louis Andersen
218a6db09c More documentation. 2020-02-10 14:23:28 +01:00
Jesper Louis Andersen
2045ca8e09 Slightly better wording in documentation 2020-02-10 14:21:11 +01:00
Jesper Louis Andersen
8c13fc682e v1.0.0 2020-02-08 11:39:51 +01:00
Jesper Louis Andersen
24859776e4 Ready publishing of 1.0.0 2020-02-08 11:39:43 +01:00
Jesper Louis Andersen
1f7d553f75 Delete this sentence. It serves no purpose. 2020-02-06 16:18:25 +01:00
Jesper Louis Andersen
8e628a61fc Clean todo list 2020-02-06 16:06:21 +01:00
Jesper Louis Andersen
a3f112607c Document the notion of finalization 2020-02-06 16:06:02 +01:00
Jesper Louis Andersen
96b883ceba generichash finalization
Make sure we finalize properly in
generichash and check the alive
state of objects. If they are not
alive, return the general finalized
error.
2020-02-06 16:04:23 +01:00
Jesper Louis Andersen
d013a04a58 Manage the changelog. 2020-02-06 13:59:31 +01:00
Jesper Louis Andersen
fd87b9da39 Fix a bug in sign_init/0
The code path was wrong in a lot
of cases in sign_init/0 so even if it
succeeded it would return a failure.

Fixed by cleaning up the code.
2020-02-06 13:57:49 +01:00
Jesper Louis Andersen
cceef4530a Streamline naming
More changes before 1.0 with a
more direct naming scheme.
2020-02-06 13:57:07 +01:00
Jesper Louis Andersen
014d50cf47 Implement EQC for generic hashing, fix bug.
Turns out the interval we had in the
file were inverted and I was wrong
in an earlier commit. However, EQC
dutifully found the mistake, and it
is now corrected.
2020-02-06 12:18:47 +01:00
Jesper Louis Andersen
f580f6525b Streamline _open style calls
Those now return {ok, Msg} or
{error, term()} so you are kind of
forced to match on them. This is
likely to help with correctnes.
2020-02-06 11:48:57 +01:00
Jesper Louis Andersen
7999d08e9d Streamlining of secret and _verify
The secret key API is now streamlined.

Also, all verify-type functions are
now returning boolean() values.
This makes the API consistent.
2020-02-06 11:12:32 +01:00
Jesper Louis Andersen
1cb2c3a2a2 Extend pwhashing with limits
In the EQC tests, we generate limits at random and verify things work.
2020-02-05 13:41:19 +01:00
Jesper Louis Andersen
dea9ce62ed Rename constant to be in line with libsodium 2020-02-05 13:34:27 +01:00
Jesper Louis Andersen
41045fed85 Partially stream kx
Also while here, implement some EQC tests for it.
2020-02-05 13:16:35 +01:00
Jesper Louis Andersen
5d245797d2 Parallelize the ext tests 2020-02-05 13:15:54 +01:00
Jesper Louis Andersen
c26aeee413 Use an exit condition 2020-02-05 12:10:02 +01:00
Jesper Louis Andersen
78621356ec Split extension functions away 2020-02-05 12:08:28 +01:00
Jesper Louis Andersen
d06fff489d QuickCheck for randombytes
There are some new randombytes
functions. Implement these as EQC
properties.
2020-02-05 11:16:56 +01:00
Jesper Louis Andersen
c7720e6ab8 Streamline the AEAD API 2020-02-05 10:56:18 +01:00
Jesper Louis Andersen
b637ba307b Streamline generichash and pwhash 2020-02-04 17:50:56 +01:00
Jesper Louis Andersen
59b94439d1 Decide on an even better API 2020-02-04 14:00:02 +01:00
Jesper Louis Andersen
aa2c69529a Streamlines generichashThe multi-part hash API is nowreflecting the same crypto modulefunctions in style. This is easierto use for people, I believe. 2020-02-04 13:00:16 +01:00
Jesper Louis Andersen
71832cce4c Streamline sealed boxes 2020-02-04 12:44:47 +01:00
Jesper Louis Andersen
c791f602e9 Streamline returns in the public key API 2020-02-04 12:38:02 +01:00
Jesper Louis Andersen
2041cec2e8 Update the eqc suite.
Parameter order in
chacha20poly1305_ietf changed.

Fix this in the EQC tests.

While here, also do the Nonce
changes.
2020-02-03 14:58:52 +01:00
Jesper Louis Andersen
8ed8663dfe Correct ietf_decrypt
EQC Found a bug where parameters
where incorrectly passed. The CT
test suite passed, but randomized
tests found an error.
2020-02-03 14:57:42 +01:00
Jesper Louis Andersen
fc943a19c7 Go through the secret API as well 2020-01-24 22:17:24 +01:00
Jesper Louis Andersen
2b8b6224d8 Plug some memory leaks in the public API.
The problem is, like the other recent
patches, about properly releasing
binaries we have allocated but not
given to the VM for it to use.
2020-01-24 22:14:23 +01:00
Jesper Louis Andersen
4939f7bb23 Protect the signature ctx with a mutex
This is the same game as with the
generichash construction. We want
to protect it with a mutex so
different processes can safely do
work on the same resource.

While here, also move the _update
function onto the dirty scheduler.
It is by far the most expensive
operation, and why it wasn't there
in the first place is odd. This should
unblock the scheduler on long
sign-checks. It also move the
possible mutex block onto the
dirty scheduler thread, away from
the core schedulers, improving
latency in the system as a result.
2020-01-24 15:18:04 +01:00
Jesper Louis Andersen
7d8fdf69c0 Protect generichash by a mutex
While sodium is thread-safe, our
resources are not. Furthermore,
we might have an update call going
when someone decides to call
finalize and so on. It is not clever
to do so, but on the other hand
I want to protect against this.

While here, mark the mutexed
calls as dirty CPU. This avoids them
blocking the main scheduler and
only messes with the background
dirty threads, which is somewhat
more safe.

The consequence is that order
access to the resource is now
serialized. I don't think you should
do it, but it is now possible.
2020-01-24 14:48:21 +01:00
Jesper Louis Andersen
e4b35a7035 Flesh out changelog some more
This is a sort-of TODO list at the top of the list, but we use it to keep
track of what we need to do.
2020-01-22 22:23:23 +01:00
Jesper Louis Andersen
49a437347e Improve release naming
Make it obvious you are releasing both tx and rx.
2020-01-22 22:22:53 +01:00
Jesper Louis Andersen
018bf0f6fc Plug a large set of memory leaks in signing
If you fail, there are cases where binaries are not properly released.
This patch fixes them all in signing.
2020-01-22 22:22:29 +01:00
Jesper Louis Andersen
e67619a403 Update the naming scheme of AEAD xchacha20...
Since this AEAD construction variant is an IETF variant, reflect
this in the names of the functions.

This streamlines the API with the libsodium API.
2020-01-22 19:41:58 +01:00
Jesper Louis Andersen
7f857115bb Add aead IETF constructions
Since the chacha20poly1305 constructions were the IETF variants,
we renamed those so they follow the official library better. While
here, we also fixed the argument order of the files.
2020-01-21 14:16:24 +01:00
Jesper Louis Andersen
bdb4719f6d Fix AEAD parameter order / naming.
The order of parameters were in the wrong order. Make them equal
to the official order of libsodium.

While here, rename NONCEBYTES to NPUBBYTES so it reflects the
underlying names as well.
2020-01-21 13:57:39 +01:00
Jesper Louis Andersen
ab40d5bbf8 Rename fixups 2020-01-21 13:56:17 +01:00
Jesper Louis Andersen
92b91bd806 Rename "nacl_error_tuple" -> "enacl_error_tuple"
The new name is consistent where the old name was not.
2020-01-21 13:40:35 +01:00
Jesper Louis Andersen
fec24995d1 Clean up aead construction, plug mem-leak 2020-01-21 13:39:08 +01:00
Jesper Louis Andersen
899fbeefd3 Plug memory leaks in kx_ functions
If we, for some reason, fail to the error-path, then binaries allocated
are not being released properly back to the erlang runtime. Fix this
in the usual fashion by using a stack of undo-operations, and thread
them via goto.
2020-01-21 13:01:48 +01:00
Jesper Louis Andersen
d850b16d1b Fix multi-part signatures
Remove the signstate wrapper as it is not needed anyore.
2020-01-20 15:52:38 +01:00
Jesper Louis Andersen
a5e66ff204 Reap a #define 2020-01-20 15:38:42 +01:00
Jesper Louis Andersen
bf6fb6cf7b Split the remaining operations 2020-01-20 15:31:44 +01:00
Jesper Louis Andersen
fe478ea253 Header file fixupUse <erl_nif.h> since it is a system header.Also rearrange headers to be consistent. 2020-01-20 14:57:42 +01:00
Jesper Louis Andersen
460c5bddfd Rudimentary test of pwhash 2020-01-20 14:45:52 +01:00
Jesper Louis Andersen
d3c033c4e6 Split off password hashing 2020-01-20 14:38:20 +01:00