Skip to content

dh/csidh: harden key imports - #689

Merged
bwesterb merged 1 commit into
mainfrom
bas/zk32
Jul 31, 2026
Merged

dh/csidh: harden key imports#689
bwesterb merged 1 commit into
mainfrom
bas/zk32

Conversation

@bwesterb

@bwesterb bwesterb commented Jul 31, 2026

Copy link
Copy Markdown
Member

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread dh/csidh/csidh.go

func (c *PrivateKey) Import(key []byte) bool {
if len(key) < len(c.e) {
if len(key) != len(c.e) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟨 Private key import accepts out-of-range exponents

PrivateKey.Import now enforces the exact byte length but still copies the raw bytes into the exponent array without validating that each 4-bit exponent lies in the documented range [-5, 5] (dh/csidh/csidh.go:199-207, exponents documented at dh/csidh/csidh.go:38-40). A caller importing attacker-supplied or corrupted key material can therefore obtain a private key whose exponents (up to -8..7 after sign extension) are outside the cSIDH/512 parameter set, producing group-action results that are not valid cSIDH secrets while Import still reports success.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@bwesterb
bwesterb merged commit cc3976a into main Jul 31, 2026
14 checks passed
@bwesterb
bwesterb deleted the bas/zk32 branch July 31, 2026 20:55
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