]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
nettle: fail OAEP decryption on unknown hash
authorAlexander Sosedkin <asosedkin@redhat.com>
Fri, 20 Sep 2024 14:04:44 +0000 (16:04 +0200)
committerAlexander Sosedkin <asosedkin@redhat.com>
Fri, 20 Sep 2024 14:05:20 +0000 (16:05 +0200)
_rsa_oaep_decrypt() "returns 1 on success; 0 otherwise",
but here we've returned non-zero on using an unsupported hash.
This confused the error reporting into thinking gnutls_privkey_decrypt_data()
has succeeded, while it hasn't.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
lib/nettle/pk.c

index 7cf067a8fcdd0b1e27147ba0b36fb4760b713c70..cccad6f7d41708a24823a14aba25d53c9b0ed308 100644 (file)
@@ -1035,7 +1035,7 @@ static inline int _rsa_oaep_decrypt(gnutls_digest_algorithm_t dig,
                break;
        default:
                gnutls_assert();
-               return GNUTLS_E_UNKNOWN_ALGORITHM;
+               return 0;
        }
 
        return decrypt_func(pub, key, rnd_ctx, rnd_func, label_length, label,