Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795054577; b=jJXhVIjUwaP1s3gF0/IjAJD8PcUmzb91jqdbUHSTvymY7YcT9jHE4R4x0OTJb1IydWa3 bSIrcrI3lDVQbbNLtnIy5rv+FbN/KiDyyO1RWZdGxJc7o5ICwVknuyCXgRPmhnHJedBrE kfN1FZ3fWU4aOYUqy3YSMvvEGKiDmw+48Sb+bZTP7dNY0vWSZsG+J2t7E3oJ5PWIc3JPg 5y2qxa2HAaW5C08BAzcua8CJ9n6LXEShKTPtHO7qNKKwoRyBhBDqgDngmfb7AduevakAl 1mgcqRa4DJ1KDXWvioVPAhvkCKppDI2Q5aVimGtLkCH893bH1XyofbyTYQZs3qKOfQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795054577; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=hzjHatXKPLYUBS7vkI/PI4E+pfzIUBANgxXagb/F3pY=; b=T2U2zg32+CGHFWQAmak6kxMGmXfX378DjKOxG5XlJ+OpRpLnmEEktD8L4tW+pFU8z/cg Om72znb0qXh69NQkB8gJxO6q2TCO/zg8zxI7atAbEoYROA36MGITSFhQTlxy8ldon+ak7 veaj6ukFNdKBsKEO6djBdhBOg5WofUSIkYP0fhc2UKrW1UVWSHio1Q4fnwBS/DCgL3ETZ KteMh+Zg4Zh/qdz0+L6/H7ENeG4ym4Af9tUVWEeCkreVLer0a/82tNnwIbu2w+4+KqYDy YvZLXPHxQvEBd4wpyYfM5T93FmaAnpvCO1HYob71+iimD5tiM1EI6EpePOJohztcmmQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mn3q6pwZ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1D98606A331; Thu, 19 Nov 2026 02:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mn3q6pwZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DF3E1F000C4; Thu, 19 Nov 2026 02:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795054577; bh=hzjHatXKPLYUBS7vkI/PI4E+pfzIUBANgxXagb/F3pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mn3q6pwZojjSpNfVZjiC2fRP5q+JhWFrAuW3ixwbmBGex+jTuKFUna9KbGYIchNia wDBbEVz6p2dWRMuWyZXcn84Zf0z9eJ/QTDd8Zu9+sIKWr0CbZrufg2qrrvKs2eChnw 7Jz155qcQtheTF2Ws5Q96oN6fjK7sIJ6PQfeGVjg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Stancek , Jarkko Sakkinen , R Nageswara Sastry , Neal Gompa , Huacai Chen , Luca Weiss Subject: [PATCH 5.15 1323/2214] sign-file,extract-cert: avoid using deprecated ERR_get_error_line() Date: Wed, 18 Nov 2026 15:49:59 +0100 Message-ID: <20261118150104.377788540@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Stancek commit 467d60eddf55588add232feda325da7215ddaf30 upstream. ERR_get_error_line() is deprecated since OpenSSL 3.0. Use ERR_peek_error_line() instead, and combine display_openssl_errors() and drain_openssl_errors() to a single function where parameter decides if it should consume errors silently. Signed-off-by: Jan Stancek Reviewed-by: Jarkko Sakkinen Tested-by: R Nageswara Sastry Reviewed-by: Neal Gompa Signed-off-by: Jarkko Sakkinen Signed-off-by: Huacai Chen Signed-off-by: Greg Kroah-Hartman Signed-off-by: Luca Weiss Signed-off-by: Greg Kroah-Hartman --- scripts/extract-cert.c | 4 ++-- scripts/sign-file.c | 6 +++--- scripts/ssl-common.h | 23 ++++++++--------------- 3 files changed, 13 insertions(+), 20 deletions(-) --- a/scripts/extract-cert.c +++ b/scripts/extract-cert.c @@ -96,11 +96,11 @@ int main(int argc, char **argv) parms.cert = NULL; ENGINE_load_builtin_engines(); - drain_openssl_errors(); + drain_openssl_errors(__LINE__, 1); e = ENGINE_by_id("pkcs11"); ERR(!e, "Load PKCS#11 ENGINE"); if (ENGINE_init(e)) - drain_openssl_errors(); + drain_openssl_errors(__LINE__, 1); else ERR(1, "ENGINE_init"); if (key_pass) --- a/scripts/sign-file.c +++ b/scripts/sign-file.c @@ -114,11 +114,11 @@ static EVP_PKEY *read_private_key(const ENGINE *e; ENGINE_load_builtin_engines(); - drain_openssl_errors(); + drain_openssl_errors(__LINE__, 1); e = ENGINE_by_id("pkcs11"); ERR(!e, "Load PKCS#11 ENGINE"); if (ENGINE_init(e)) - drain_openssl_errors(); + drain_openssl_errors(__LINE__, 1); else ERR(1, "ENGINE_init"); if (key_pass) @@ -273,7 +273,7 @@ int main(int argc, char **argv) /* Digest the module data. */ OpenSSL_add_all_digests(); - display_openssl_errors(__LINE__); + drain_openssl_errors(__LINE__, 0); digest_algo = EVP_get_digestbyname(hash_algo); ERR(!digest_algo, "EVP_get_digestbyname"); --- a/scripts/ssl-common.h +++ b/scripts/ssl-common.h @@ -3,7 +3,7 @@ * SSL helper functions shared by sign-file and extract-cert. */ -static void display_openssl_errors(int l) +static void drain_openssl_errors(int l, int silent) { const char *file; char buf[120]; @@ -11,28 +11,21 @@ static void display_openssl_errors(int l if (ERR_peek_error() == 0) return; - fprintf(stderr, "At main.c:%d:\n", l); + if (!silent) + fprintf(stderr, "At main.c:%d:\n", l); - while ((e = ERR_get_error_line(&file, &line))) { + while ((e = ERR_peek_error_line(&file, &line))) { ERR_error_string(e, buf); - fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line); + if (!silent) + fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line); + ERR_get_error(); } } -static void drain_openssl_errors(void) -{ - const char *file; - int line; - - if (ERR_peek_error() == 0) - return; - while (ERR_get_error_line(&file, &line)) {} -} - #define ERR(cond, fmt, ...) \ do { \ bool __cond = (cond); \ - display_openssl_errors(__LINE__); \ + drain_openssl_errors(__LINE__, 0); \ if (__cond) { \ errx(1, fmt, ## __VA_ARGS__); \ } \