Skip to content

Teach sshkey_check_sigtype about OQS hybrid framing - #204

Merged
andrewyounkers merged 2 commits into
open-quantum-safe:OQS-v10from
mkhellat:fix/hybrid-sigtype-check-201
Nov 15, 2026
Merged

andrewyounkers merged 2 commits into
open-quantum-safe:OQS-v10from
mkhellat:fix/hybrid-sigtype-check-201

Conversation

@mkhellat

@mkhellat mkhellat commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

Fixes #201.

Logic

sshkey_check_sigtype assumes a classic SSH signature: leading string(algorithm). OQS classical+PQ hybrids instead encode:

string(classical_sig) || string(pq_sig)

each component itself a typed SSH signature. The outer blob therefore has no hybrid algorithm name, so the check always failed. During the 8.4/10.x uplift this was papered over by skipping the check for hybrids in identity_sign (OQS-TODO).

Is the validation meaningful for hybrids? Yes for the callers that use it (PKCS#11 / agent):

  • RSA hybrids must embed rsa-sha2-256 (not ssh-rsa/SHA1) in the classical half — same concern as plain RSA tokens.
  • ECDSA hybrids label the classical half with the hybrid algorithm name via sshkey_ssh_name_plain.

Changing the wire format to put the hybrid name on the outside would break existing OQS-OpenSSH interop, so this extends the parser instead.

Change

  • Add sshkey_check_oqs_hybrid_sigtype: parse both components; require classical type matches expected (rsa-sha2-* or hybrid name); require PQ half is a well-formed typed signature.
  • Route hybrid requested_alg through that path in sshkey_check_sigtype.
  • Drop the hybrid bypass / OQS-TODO in identity_sign (agent path in authfd.c benefits automatically).

Test plan

@mkhellat
mkhellat force-pushed the fix/hybrid-sigtype-check-201 branch from f3da26c to 351bdc5 Compare October 30, 2026 05:43
@mkhellat
mkhellat marked this pull request as draft October 31, 2026 04:51
@mkhellat

Copy link
Copy Markdown
Author

Converting this PR to draft for now.

CI is red across ubuntu + the full VM matrix with a failure pattern that also appears on #204 (which does not touch the KEX path), so this looks like a shared CI / floating liboqs main environment issue rather than something to hammer with more pushes against the upstream runners.

I will reproduce and troubleshoot on my fork (and locally) first, then follow up here with findings and/or a separate CI/liboqs fix as appropriate before asking for review again.

mkhellat added a commit to mkhellat/openssh that referenced this pull request Oct 31, 2026
workflow_dispatch-only job to reproduce CI Checks against a chosen
liboqs ref without opening or updating upstream PRs. Used to bisect
rekey failures seen on draft PRs open-quantum-safe#203/open-quantum-safe#204.

Signed-off-by: Mohammadreza Khellat <mkhellat@beavernets.com>
Co-authored-by: Mohammad Masoumi <225140472+mhmd-masoumi@users.noreply.github.com>
Co-authored-by: Cursor Auto <cursoragent@cursor.com>
mkhellat added a commit to mkhellat/openssh that referenced this pull request Oct 31, 2026
workflow_dispatch-only job to reproduce CI Checks against a chosen
liboqs ref without opening or updating upstream PRs. Used to bisect
rekey failures seen on draft PRs open-quantum-safe#203/open-quantum-safe#204.

Signed-off-by: Mohammadreza Khellat <mkhellat@gmail.com>
Co-authored-by: Mohammad Masoumi <225140472+mhmd-masoumi@users.noreply.github.com>
Co-authored-by: Cursor Auto <cursoragent@cursor.com>
@mkhellat

Copy link
Copy Markdown
Author

Update on the red Ubuntu / VM CI: fork-only rekey-only trisect against
liboqs shows this is shared env, not this PR — tip fails at
classic-mceliece-* after liboqs #2640 default-off; pre-#2640 passes.
Tracked in #205. Keeping this draft until that lands.

@mkhellat
mkhellat force-pushed the fix/hybrid-sigtype-check-201 branch from 351bdc5 to 5e2dde9 Compare November 8, 2026 05:53
@mkhellat

mkhellat commented Nov 8, 2026

Copy link
Copy Markdown
Author

Undrafting after #206 merged.

Same hold as #203: draft while CI was dominated by the McEliece / liboqs default-off failure (#205). Rebased onto current OQS-v10 (post-#206); Checks + VM matrix are green on this head.

@mkhellat
mkhellat marked this pull request as ready for review November 8, 2026 06:46
Comment thread sshkey.c
&classic_type)) != 0)
goto out;
/* Require the PQ half to also be a well-formed typed SSH signature. */
if ((r = sshkey_get_sigtype(pq_sig, pq_len, &pq_type)) != 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It looks like the PQ type is parsed into pq_type but its value isn’t used after this call. In your opinion, would it make sense not to introduce it here and pass NULL to sshkey_get_sigtype(), or validate pq_type against the expected PQ type?

mkhellat and others added 2 commits November 14, 2026 11:43
Hybrid signatures are string(classical) || string(pq), each component a
normal typed SSH signature. The outer blob has no leading hybrid
algorithm name, so the classic get_sigtype path always failed and
identity_sign skipped the PKCS#11 post-sign check for hybrids.

Validation is meaningful: RSA hybrids must embed rsa-sha2-* (not
ssh-rsa/SHA1) in the classical half; ECDSA hybrids label that half with
the hybrid algorithm name. Parse both components and check the classical
type accordingly; also require the PQ half to be a well-formed typed
signature. Re-enable the check in identity_sign (covers agent path too).

Fixes open-quantum-safe#201

Signed-off-by: Mohammadreza Khellat <mkhellat@gmail.com>
Signed-off-by: Mohammadreza Khellat <mkhellat@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mkhellat
mkhellat force-pushed the fix/hybrid-sigtype-check-201 branch from 4019f02 to bf7ef35 Compare November 14, 2026 08:14
@mkhellat

Copy link
Copy Markdown
Author

@andrewyounkers Thank you for the approval — much appreciated.

From our side this is ready to merge. Rebased onto current OQS-v10 (post-#203) so the branch is no longer behind tip; CI is re-running on that head.

@mkhellat

Copy link
Copy Markdown
Author

Follow-up: dragonflybsd-6.4.2 is red again on this head with the same pre-build runner fault as post-#203 on OQS-v10 (sudo: libcrypto.so.17 not found). Noted on #203; looking unrelated to this PR’s diff. Watching the rest of the matrix.

@mkhellat

Copy link
Copy Markdown
Author

dragonflybsd-6.4.2 red on this head is the tip-wide Avalon openssl 3.5
libcrypto SONAME break (#208), not this PR's diff. Fix in #209.

@andrewyounkers
andrewyounkers merged commit 5d42e44 into open-quantum-safe:OQS-v10 Nov 15, 2026
14 of 16 checks passed
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.

Hybrid signatures bypass sshkey_check_sigtype post-sign validation

2 participants