diff options
author | Hans Nilsson <[email protected]> | 2019-03-21 10:56:40 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2019-03-22 10:23:57 +0100 |
commit | b1f4c5f3b07387ed57a5794570969c55a3cd34ea (patch) | |
tree | 560c617b8b741183268e305a0c8e72d281d34fdc | |
parent | 03f94058c410162091ce9168609908abd2caaba3 (diff) | |
download | otp-b1f4c5f3b07387ed57a5794570969c55a3cd34ea.tar.gz otp-b1f4c5f3b07387ed57a5794570969c55a3cd34ea.tar.bz2 otp-b1f4c5f3b07387ed57a5794570969c55a3cd34ea.zip |
crypto: Restore 'error' as result of failed aead decryption
-rw-r--r-- | lib/crypto/doc/src/crypto.xml | 3 | ||||
-rw-r--r-- | lib/crypto/src/crypto.erl | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index ee95cc3074..2c5f1b846f 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -667,7 +667,8 @@ <v>Key = <seealso marker="#type-key">key()</seealso> | <seealso marker="#type-des3_key">des3_key()</seealso></v> <v>PlainText = iodata()</v> <v>AAD = IVec = CipherText = CipherTag = binary()</v> - <v>Error = <seealso marker="#type-run_time_error">run_time_error()</seealso></v> + <v>Error = BadTag | <seealso marker="#type-run_time_error">run_time_error()</seealso></v> + <v>BadTag = error</v> </type> <desc> <p>Decrypt <c>CipherText</c> according to <c>Type</c> block cipher. diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index ade4c17089..a5e60fbe75 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -651,7 +651,7 @@ block_encrypt(Type, Key, PlainText) -> binary() | run_time_error(); (Type::aead_cipher(), Key::iodata(), Ivec::binary(), {AAD::binary(), Data::iodata(), Tag::binary()}) -> - binary() | run_time_error() . + binary() | error | run_time_error() . block_decrypt(Type, Key, Ivec, Data) -> do_block_decrypt(alias(Type), Key, Ivec, Data). |