crypto: rename hmac_sha256() to rtw_hmac_sha256() to fix build on Linux 7.0 - #7
Open
s-b-repo wants to merge 1 commit into
Open
crypto: rename hmac_sha256() to rtw_hmac_sha256() to fix build on Linux 7.0#7s-b-repo wants to merge 1 commit into
s-b-repo wants to merge 1 commit into
Conversation
Linux 7.0 provides its own hmac_sha256() in <crypto/sha2.h>, added by the
lib/crypto SHA-256 HMAC series:
void hmac_sha256(const struct hmac_sha256_key *key, const void *data,
size_t data_len, u8 out[SHA256_DIGEST_SIZE]);
This collides with the driver's wpa_supplicant-derived function of the same
name, so core/crypto/sha256.{c,h} fail to compile:
core/crypto/sha256.h:16:5: error: conflicting types for 'hmac_sha256'
core/crypto/sha256.c:100:5: error: conflicting types for 'hmac_sha256'
The driver's hmac_sha256() has no callers anywhere in the tree - only
hmac_sha256_vector() is used, by core/crypto/sha256-prf.c - so the rename is
behaviour-neutral and needs no LINUX_VERSION_CODE guard.
Verified on 7.0.14-arch1-1 with gcc 16.1.1: dwa-x1850 HEAD fails with exit
status 2 and produces no module; with this change the build completes with
zero errors and 8852au.ko has vermagic 7.0.14-arch1-1.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xh5tbTQAWbek2feXD2uhaZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dwa-x1850HEAD does not build on Linux 7.0:Eric Biggers'
lib/cryptoSHA-256 series made HMAC a first-class part of theSHA-256 library, adding to
include/crypto/sha2.h:That collides with the driver's wpa_supplicant-derived function of the same name
and incompatible signature:
Both headers land in the same translation unit, so the declarations conflict.
Fix
Rename the driver's function to
rtw_hmac_sha256().grep -rnw hmac_sha256finds exactly three occurrences — a kernel-doc comment,the definition, and the declaration — and zero call sites. Only
hmac_sha256_vector()is actually used, bycore/crypto/sha256-prf.c. The renameis therefore behaviour-neutral, and because the symbol is driver-internal it needs
no
LINUX_VERSION_CODEguard — it is safe on every kernel version.Reproduction
Verification
Built on Arch Linux, kernel
7.0.14-arch1-1(x86_64), gcc16.1.1 20260625:dwa-x1850HEAD, unmodifieddwa-x1850HEAD + this commit8852au.kobuiltmodinfoon the resulting module reportsvermagic: 7.0.14-arch1-1 SMP preempt mod_unload.This also fixes the AUR
rtl8852au-dkms-gitpackage, which currently fails tobuild on Arch for the same reason.
Unrelated observation:
radio_idis not version-gatedNot part of this PR, just something I hit while bisecting. The kernel 6.17
radio_idfix already indwa-x1850is applied unconditionally:struct cfg80211_opsonly gained that parameter in 6.17, so as written the treeno longer builds on older kernels. If you want to keep those working, the three
sites (
cfg80211_rtw_set_wiphy_params,cfg80211_rtw_set_txpower,cfg80211_rtw_get_txpower) want:Happy to send that as a separate PR if it would be useful.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xh5tbTQAWbek2feXD2uhaZ