From b1f4c5f3b07387ed57a5794570969c55a3cd34ea Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Thu, 21 Mar 2019 10:56:40 +0100 Subject: crypto: Restore 'error' as result of failed aead decryption --- lib/crypto/doc/src/crypto.xml | 3 ++- lib/crypto/src/crypto.erl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') 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 @@ Key = key() | des3_key() PlainText = iodata() AAD = IVec = CipherText = CipherTag = binary() - Error = run_time_error() + Error = BadTag | run_time_error() + BadTag = error

Decrypt CipherText according to Type 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). -- cgit v1.2.3