From c3d179f06ea22b7218e0d9ee25531adfa8893bf8 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Thu, 21 Jul 2022 11:43:55 +0200 Subject: [PATCH] libpv: Fix condition in pv_BIO_reset() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pv_BIO_reset() wrongfully handled the BIO_reset() rc for non-file-backed BIOs. This is currently not an issue as the only non-file BIO used cannot fail at BIO_reset() Fixes: 3ab06d77fb1b ("pvattest: Create, perform, and verify attestation measurements") Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner --- libpv/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpv/crypto.c b/libpv/crypto.c index 207795d3..3cac9d23 100644 --- a/libpv/crypto.c +++ b/libpv/crypto.c @@ -41,7 +41,7 @@ int pv_BIO_reset(BIO *b) { int rc = BIO_reset(b); - if (rc != 1 && (BIO_method_type(b) == BIO_TYPE_FILE && rc != 0)) + if (rc != 1 && !(BIO_method_type(b) == BIO_TYPE_FILE && rc == 0)) return -1; return 1; }