From 9109b63aaae8ac4dd0185fa66d4b1c1cc8ad25f6 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sat, 21 Sep 2019 08:34:48 +0800 Subject: [PATCH] Avoid confusion of the return value of aead_cipher_decrypt() --- src/aead.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/aead.c b/src/aead.c index 4a49d77c..1c68bb58 100644 --- a/src/aead.c +++ b/src/aead.c @@ -245,6 +245,12 @@ aead_cipher_decrypt(cipher_ctx_t *cipher_ctx, return CRYPTO_ERROR; } + // The success return value ln libsodium and mbedTLS are both 0 + if (err != 0) + // Although we never return any library specific value in the caller, + // here we still set the error code to CRYPTO_ERROR to avoid confusion. + err = CRYPTO_ERROR; + return err; }