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.
This commit is contained in:
Jesper Louis Andersen
2020-01-22 19:41:58 +01:00
parent 7f857115bb
commit e67619a403
6 changed files with 136 additions and 99 deletions
+4 -4
View File
@@ -91,15 +91,15 @@ generichash_chunked(State, Msg, N) ->
generichash_chunked(State2, Msg, N-1).
aead_xchacha20poly1305(_Config) ->
NonceLen = enacl:aead_xchacha20poly1305_NONCEBYTES(),
KLen = enacl:aead_xchacha20poly1305_KEYBYTES(),
NonceLen = enacl:aead_xchacha20poly1305_ietf_NPUBBYTES(),
KLen = enacl:aead_xchacha20poly1305_ietf_KEYBYTES(),
Key = binary:copy(<<"K">>, KLen),
Msg = <<"test">>,
AD = <<1,2,3,4,5,6>>,
Nonce = binary:copy(<<"N">>, NonceLen),
CipherText = enacl:aead_xchacha20poly1305_encrypt(Key, Nonce, AD, Msg),
Msg = enacl:aead_xchacha20poly1305_decrypt(Key, Nonce, AD, CipherText),
CipherText = enacl:aead_xchacha20poly1305_ietf_encrypt(Msg, AD, Nonce, Key),
Msg = enacl:aead_xchacha20poly1305_ietf_decrypt(CipherText, AD, Nonce, Key),
ok.
aead_chacha20poly1305_ietf(_Config) ->