Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpftool: Allow bpftool to build with openssl < 3

ERR_get_error_all()[1] is a openssl v3 API, so to make code
compatible with openssl v1 utilize ERR_get_err_line_data
instead. Since openssl is already a build requirement for
the kernel (minimum requirement openssl 1.0.0), this will
allow bpftool to compile where opensslv3 is not available.
Signing-related BPF selftests pass with openssl v1.

[1] https://docs.openssl.org/3.4/man3/ERR_get_error/

Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/r/20251120084754.640405-2-alan.maguire@oracle.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Alan Maguire and committed by
Alexei Starovoitov
90ae54b4 acf87264

+6
+6
tools/bpf/bpftool/sign.c
··· 28 28 29 29 #define OPEN_SSL_ERR_BUF_LEN 256 30 30 31 + /* Use deprecated in 3.0 ERR_get_error_line_data for openssl < 3 */ 32 + #if !defined(OPENSSL_VERSION_MAJOR) || (OPENSSL_VERSION_MAJOR < 3) 33 + #define ERR_get_error_all(file, line, func, data, flags) \ 34 + ERR_get_error_line_data(file, line, data, flags) 35 + #endif 36 + 31 37 static void display_openssl_errors(int l) 32 38 { 33 39 char buf[OPEN_SSL_ERR_BUF_LEN];