mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[PR #2416] [MERGED] Use u32 internally when randomizing case of labels #3025
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#3025
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/2416
Author: @divergentdave
Created: 9/3/2024
Status: ✅ Merged
Merged: 9/3/2024
Merged by: @djc
Base:
main← Head:david/case-randomization-u32📝 Commits (1)
e7d8aedUse u32 internally when randomizing case of labels📊 Changes
1 file changed (+5 additions, -5 deletions)
View changed files
📝
crates/proto/src/rr/domain/name.rs(+5 -5)📄 Description
This is a follow-up to #2403 that changes how the case of labels is randomized. The temporary variable holding to-be-used random bits is changed from an
i16to anu32, and the update part of the loop is changed to match.I changed from 16 to 32 bits because the
randcrate's RNGs primarily deal in eitheru32s oru64s. The implementation ofDistribution<u16> for Standardjust callsrng.next_u32()and truncates, so this change will cut RNG calls in half for longer names.I changed from a signed integer to an unsigned integer, and deleted the associated comment, because I could not reproduce this issue. My best guess is that there was an off-by-one issue in an earlier version of the code. Plus, I'd rather that the shift operation use zero extension, rather than sign extension, because our tests can catch a character that's never randomized, but they can't currently catch correlation between the case of two characters, which is just as bad for entropy.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.