Skip to content

[dnssec] Make JavaSecDigestCalculator thread-safe - #157

Merged
Flowdalic merged 1 commit into
MiniDNS:masterfrom
Flowdalic:dnssec-thread-safe-digest-calculator
Oct 18, 2026
Merged

Flowdalic merged 1 commit into
MiniDNS:masterfrom
Flowdalic:dnssec-thread-safe-digest-calculator

Conversation

@Flowdalic

Copy link
Copy Markdown
Collaborator

JavaSecDigestCalculator used a single MessageDigest instance, which is not thread-safe. Since the calculators are shared via AlgorithmMap.INSTANCE, concurrent DNSSEC validations, e.g. resolving multiple names in parallel, raced on it. This produced wrong digests, often the digest of the empty input, or even exceptions thrown from within the MessageDigest implementation. As a result, DS digest comparisons of valid DNSKEYs failed intermittently with DigestComparisonFailedException, and NSEC3 owner name hashes could be wrong.

Synchronize the access to the MessageDigest instance.

Related to #132.

JavaSecDigestCalculator used a single MessageDigest instance, which is
not thread-safe. Since the calculators are shared via
AlgorithmMap.INSTANCE, concurrent DNSSEC validations, e.g. resolving
multiple names in parallel, raced on it. This produced wrong digests,
often the digest of the empty input, or even exceptions thrown from
within the MessageDigest implementation. As a result, DS digest
comparisons of valid DNSKEYs failed intermittently with
DigestComparisonFailedException, and NSEC3 owner name hashes could be
wrong.

Synchronize the access to the MessageDigest instance.

Related to MiniDNS#132.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39124665706

Coverage remained the same at 60.968%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4775
Covered Lines: 3075
Line Coverage: 64.4%
Relevant Branches: 1794
Covered Branches: 930
Branch Coverage: 51.84%
Branches in Coverage %: Yes
Coverage Strength: 2.89 hits per line

💛 - Coveralls

@Flowdalic
Flowdalic merged commit 9423a4c into MiniDNS:master Oct 18, 2026
3 checks passed
@Flowdalic
Flowdalic deleted the dnssec-thread-safe-digest-calculator branch October 18, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants