From: Leo Yan <leo.yan@arm.com>
To: Quentin Monnet <qmo@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Leo Yan <leo.yan@arm.com>
Subject: [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0
Date: Fri, 5 Dec 2025 14:55:06 +0000 [thread overview]
Message-ID: <20251205145506.1270248-1-leo.yan@arm.com> (raw)
ERR_get_error_all() exists only in OpenSSL 3.0 and later. Older versions
lack this API, causing build failure:
sign.c: In function 'display_openssl_errors':
sign.c:40:21: warning: implicit declaration of function 'ERR_get_error_all'; did you mean 'ERR_get_error_line'? [-Wimplicit-function-declaration]
40 | while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
| ^~~~~~~~~~~~~~~~~
| ERR_get_error_line
LINK /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/sign.o: in function `display_openssl_errors.constprop.0':
sign.c:(.text+0x59): undefined reference to `ERR_get_error_all'
collect2: error: ld returned 1 exit status
Use the deprecated ERR_get_error_line_data() for OpenSSL < 3.0, and keep
using ERR_get_error_all() when available.
Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/bpf/bpftool/sign.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/bpf/bpftool/sign.c b/tools/bpf/bpftool/sign.c
index b34f74d210e9..c98edd6d1dde 100644
--- a/tools/bpf/bpftool/sign.c
+++ b/tools/bpf/bpftool/sign.c
@@ -37,7 +37,11 @@ static void display_openssl_errors(int l)
int flags;
int line;
+#if OPENSSL_VERSION_MAJOR >= 3
while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
+#else
+ while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
+#endif
ERR_error_string_n(e, buf, sizeof(buf));
if (data && (flags & ERR_TXT_STRING)) {
p_err("OpenSSL %s: %s:%d: %s", buf, file, line, data);
--
2.34.1
next reply other threads:[~2025-12-05 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 14:55 Leo Yan [this message]
2025-12-05 15:06 ` Quentin Monnet
2025-12-05 15:32 ` Leo Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251205145506.1270248-1-leo.yan@arm.com \
--to=leo.yan@arm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®