Skip to content

Reject small-order Ed25519 public keys in Validate - #36

Merged
Coralesoft merged 1 commit into
mainfrom
security/2026.5.2-small-order-validate
May 25, 2026
Merged

Reject small-order Ed25519 public keys in Validate#36
Coralesoft merged 1 commit into
mainfrom
security/2026.5.2-small-order-validate

Conversation

@Coralesoft

@Coralesoft Coralesoft commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This closes the remaining small-order public key part of upstream issue weidai11/cryptopp#1352.

ed25519PublicKey::Validate now rejects small-order Ed25519 public keys at validation level 2 and above. The existing canonical encoding check still runs at all validation levels, so level 0 behaviour is unchanged.

What changed

  • ed25519PublicKey::Validate now uses the existing HasSmallOrder helper at level 2 and above.
  • validat7.cpp adds coverage for the level boundary: identity accepted at level 0, identity rejected at level 2, fresh keypair accepted at level 2.
  • validat9.cpp now runs the non-canonical public-key test at level 1 so it stays scoped to canonicality.

This follows upstream commit weidai11/cryptopp@4775a166.

…#1352)

ed25519PublicKey::Validate checked public-key canonicality but did not reject small-order points. That left the identity-point case from #1352 accepted by Validate even though it is not a valid Ed25519 public key for strict validation.

Wire the existing HasSmallOrder helper into ed25519PublicKey::Validate at level >= 2. Canonical encoding checks still run at all validation levels; small-order rejection is part of the stricter validation path.

validat7.cpp covers the validation-level boundary: the identity key is accepted at level 0, rejected at level 2, and a fresh keypair remains accepted at level 2.

validat9.cpp keeps the non-canonical public-key test scoped to canonicality by running it at level 1. Its baseline pk_id and pk_pminus1 values are also small-order points, so level 2 would test two properties at once.
@Coralesoft
Coralesoft marked this pull request as ready for review May 25, 2026 10:10
@Coralesoft
Coralesoft merged commit 51c225e into main May 25, 2026
41 checks passed
@Coralesoft
Coralesoft deleted the security/2026.5.2-small-order-validate branch May 25, 2026 10:31
@Coralesoft Coralesoft mentioned this pull request May 26, 2026
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.

1 participant