aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2018-09-19 11:32:41 +0200
committerHans Nilsson <[email protected]>2018-09-19 11:32:41 +0200
commit71be11e97d7b5e07b3f00c7a19f132c7113ba682 (patch)
treeaad9e7056aae8027a40c8b855cb76440d0cadd67 /lib/crypto/src
parentc6c86e7a8594de25268bdd455a2dce8e8b4f6a51 (diff)
parentfd038c43ee378854f6f216faaa92a48ec65e8ad7 (diff)
downloadotp-71be11e97d7b5e07b3f00c7a19f132c7113ba682.tar.gz
otp-71be11e97d7b5e07b3f00c7a19f132c7113ba682.tar.bz2
otp-71be11e97d7b5e07b3f00c7a19f132c7113ba682.zip
Merge branch 'maint'
* maint: crypto: Re-work the 'Description' section crypto: Add warnings in RefMan and User's Guide for experimental RSA opts
Diffstat (limited to 'lib/crypto/src')
-rw-r--r--lib/crypto/src/crypto.erl19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 68c0bcef5e..3d86ceb14d 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -529,9 +529,8 @@ block_encrypt(Type, Key, Ivec, {AAD, PlainText}) when Type =:= aes_gcm;
block_encrypt(Type, Key, Ivec, {AAD, PlainText, TagLength}) when Type =:= aes_gcm;
Type =:= aes_ccm ->
aead_encrypt(Type, Key, Ivec, AAD, PlainText, TagLength);
-block_encrypt(chacha20_poly1305=Type, Key, Ivec, {AAD, PlainText}) ->
- aead_encrypt(Type, Key, Ivec, AAD, PlainText, 16).
-
+block_encrypt(chacha20_poly1305, Key, Ivec, {AAD, PlainText}) ->
+ chacha20_poly1305_encrypt(Key, Ivec, AAD, PlainText).
-spec block_decrypt(Type::block_cipher_with_iv(), Key::key()|des3_key(), Ivec::binary(), Data::iodata()) -> binary();
(Type::aead_cipher(), Key::iodata(), Ivec::binary(),
@@ -561,9 +560,11 @@ block_decrypt(des3_cfb, Key0, Ivec, Data) ->
block_decrypt(aes_ige256, Key, Ivec, Data) ->
notsup_to_error(aes_ige_crypt_nif(Key, Ivec, Data, false));
block_decrypt(Type, Key, Ivec, {AAD, Data, Tag}) when Type =:= aes_gcm;
- Type =:= aes_ccm;
- Type =:= chacha20_poly1305 ->
- aead_decrypt(Type, Key, Ivec, AAD, Data, Tag).
+ Type =:= aes_ccm ->
+ aead_decrypt(Type, Key, Ivec, AAD, Data, Tag);
+block_decrypt(chacha20_poly1305, Key, Ivec, {AAD, Data, Tag}) ->
+ chacha20_poly1305_decrypt(Key, Ivec, AAD, Data, Tag).
+
-spec block_encrypt(Type::block_cipher_without_iv(), Key::key(), PlainText::iodata()) -> binary().
@@ -1743,6 +1744,12 @@ aead_encrypt(_Type, _Key, _Ivec, _AAD, _In, _TagLength) -> ?nif_stub.
aead_decrypt(_Type, _Key, _Ivec, _AAD, _In, _Tag) -> ?nif_stub.
%%
+%% Chacha20/Ppoly1305
+%%
+chacha20_poly1305_encrypt(_Key, _Ivec, _AAD, _In) -> ?nif_stub.
+chacha20_poly1305_decrypt(_Key, _Ivec, _AAD, _In, _Tag) -> ?nif_stub.
+
+%%
%% AES - with 256 bit key in infinite garble extension mode (IGE)
%%