[PATCH bpf-next v2] bpf: Remove inclusions of crypto/sha1.h

Eric Biggers posted 1 patch 3 weeks, 2 days ago
There is a newer version of this series
include/linux/filter.h | 1 -
kernel/bpf/core.c      | 1 -
2 files changed, 2 deletions(-)
[PATCH bpf-next v2] bpf: Remove inclusions of crypto/sha1.h
Posted by Eric Biggers 3 weeks, 2 days ago
Since commit 603b44162325 ("bpf: Update the bpf_prog_calc_tag to use
SHA256") made BPF program tags use SHA-256 instead of SHA-1, the header
<crypto/sha1.h> no longer needs to be included.  Remove the relevant
inclusions so that they no longer unnecessarily come up in searches for
which kernel code is still using the obsolete SHA-1 algorithm.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---

v2: also update include/linux/filter.h

 include/linux/filter.h | 1 -
 kernel/bpf/core.c      | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index 44d7ae95ddbcc..e40d4071a3455 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -19,11 +19,10 @@
 #include <linux/set_memory.h>
 #include <linux/kallsyms.h>
 #include <linux/if_vlan.h>
 #include <linux/vmalloc.h>
 #include <linux/sockptr.h>
-#include <crypto/sha1.h>
 #include <linux/u64_stats_sync.h>
 
 #include <net/sch_generic.h>
 
 #include <asm/byteorder.h>
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 3ece2da55625c..f11ab6f354e2e 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -16,11 +16,10 @@
  * Andi Kleen - Fix a few bad bugs and races.
  * Kris Katterjohn - Added many additional checks in bpf_check_classic()
  */
 
 #include <uapi/linux/btf.h>
-#include <crypto/sha1.h>
 #include <linux/filter.h>
 #include <linux/skbuff.h>
 #include <linux/vmalloc.h>
 #include <linux/prandom.h>
 #include <linux/bpf.h>

base-commit: 1c9982b4961334c1edb0745a04cabd34bc2de675
-- 
2.53.0
[syzbot ci] Re: bpf: Remove inclusions of crypto/sha1.h
Posted by syzbot ci 3 weeks, 1 day ago
syzbot ci has tested the following series

[v2] bpf: Remove inclusions of crypto/sha1.h
https://lore.kernel.org/all/20260314210810.67348-1-ebiggers@kernel.org
* [PATCH bpf-next v2] bpf: Remove inclusions of crypto/sha1.h

and found the following issue:
kernel build error

Full report is available here:
https://ci.syzbot.org/series/38f41420-5e88-492b-9239-7c260178aa25

***

kernel build error

tree:      torvalds
URL:       https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
base:      1c9982b4961334c1edb0745a04cabd34bc2de675
arch:      amd64
compiler:  Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config:    https://ci.syzbot.org/builds/b5327796-0a46-46fc-a192-f0dbd20d9047/config

net/ipv6/addrconf.c:3341:25: error: variable has incomplete type 'struct sha1_ctx'
net/ipv6/addrconf.c:3344:13: error: use of undeclared identifier 'SHA1_BLOCK_SIZE'
net/ipv6/addrconf.c:3369:2: error: call to undeclared function 'sha1_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
net/ipv6/addrconf.c:3378:2: error: call to undeclared function 'sha1_update'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

***

If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
  Tested-by: syzbot@syzkaller.appspotmail.com

---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
Re: [syzbot ci] Re: bpf: Remove inclusions of crypto/sha1.h
Posted by Eric Biggers 3 weeks, 1 day ago
On Sun, Mar 15, 2026 at 04:56:14AM -0700, syzbot ci wrote:
> net/ipv6/addrconf.c:3341:25: error: variable has incomplete type 'struct sha1_ctx'
> net/ipv6/addrconf.c:3344:13: error: use of undeclared identifier 'SHA1_BLOCK_SIZE'
> net/ipv6/addrconf.c:3369:2: error: call to undeclared function 'sha1_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> net/ipv6/addrconf.c:3378:2: error: call to undeclared function 'sha1_update'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Thanks.  The BPF CI caught this first, and this was already fixed in v3.

- Eric