Skip to content

Fix SAKKE OOB write and correctness gap in sakke_hash_to_range#10442

Open
JeremiahM37 wants to merge 4 commits into
wolfSSL:masterfrom
JeremiahM37:zd21783
Open

Fix SAKKE OOB write and correctness gap in sakke_hash_to_range#10442
JeremiahM37 wants to merge 4 commits into
wolfSSL:masterfrom
JeremiahM37:zd21783

Conversation

@JeremiahM37
Copy link
Copy Markdown
Contributor

Description

  • sakke_xor_in_v heap buffer overflow when ssvSz > hashSz and (ssvSz % hashSz) != 0.
  • sakke_xor_in_v correctness gap — output for some (ssvSz, hashSz) combinations does not match RFC 6508 §5.1.
  • wc_MakeSakkeEncapsulatedSSV / wc_DeriveSakkeSSV did not validate ssvSz.

Fixes Audit 7 of zd21783

Testing

  • Added sakke_xor_in_v_oob_test and sakke_mask_correctness_test in tests/unit.c.
  • wolfcrypt/test/testwolfcrypt SAKKE KAT still passes.

@JeremiahM37 JeremiahM37 self-assigned this May 8, 2026
@JeremiahM37 JeremiahM37 marked this pull request as ready for review May 8, 2026 22:27
@JeremiahM37 JeremiahM37 force-pushed the zd21783 branch 2 times, most recently from 5388da1 to 1b22c51 Compare May 8, 2026 23:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

MemBrowse Memory Report

No memory changes detected for:

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #10442

Scan targets checked: wolfcrypt-bugs, wolfcrypt-src

No new issues found in the changed files. ✅

@JeremiahM37 JeremiahM37 force-pushed the zd21783 branch 3 times, most recently from 7f24da5 to d75fdcb Compare May 12, 2026 17:15
Comment thread wolfcrypt/src/sakke.c Outdated
if (i == hashSz) {
i = 0;
}
off = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need for 'off' here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread wolfcrypt/src/sakke.c Outdated
i = 0;
}
off = 0;
len = hashSz - skip;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to assign to 'len' here - just put this into the xorbuf call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

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.

4 participants