[Backport v4.4-branch] net: Fix generation of IPv6 IID and TCP ISN secret keys - #116533
Open
github-actions[bot] wants to merge 3 commits into
Open
[Backport v4.4-branch] net: Fix generation of IPv6 IID and TCP ISN secret keys#116533github-actions[bot] wants to merge 3 commits into
github-actions[bot] wants to merge 3 commits into
Conversation
The secret key used to derive RFC 7217 stable and RFC 8981 temporary interface identifiers is a long-lived protocol secret, so generate it with sys_csrand_get() instead of the non-cryptographic sys_rand_get(). Fail the IID generation if no cryptographic randomness is available rather than silently deriving addresses from a predictable key. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> (cherry picked from commit 2533158)
Callers of net_ipv6_addr_generate_iid() only logged a warning and carried on, so a failed generation left the configured SLAAC address as :: or, in the ipip case, as uninitialized stack memory. Skip the address configuration entirely when the IID cannot be generated. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> (cherry picked from commit f8b05ed)
An ignored sys_csrand_get() failure left the RFC 6528 secret key zeroed for the rest of the boot, making the ISN computable from the four-tuple alone. Generate the key from a single guarded helper that only latches on success, and fall back to sys_rand32_get() when no cryptographic randomness is available, as already happens when CONFIG_NET_TCP_ISN_RFC6528 is disabled. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> (cherry picked from commit 700888e)
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.
Backport 700888e~3..700888e from #115807.
Original PR description:
with
sys_csrand_get()instead ofsys_rand_get(), and fail IID generationrather than deriving addresses from a predictable key.
net_ipv6_addr_generate_iid()callers thatonly warned on failure and went on to install
::or uninitialized stack memory.the key zeroed on failure, and generate it once from a single guarded helper
instead of two independent flags sharing one key.
Fixes: #116527