Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for EdDSA signatures + test coverage #497

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

Jakuje
Copy link
Contributor

@Jakuje Jakuje commented Jan 9, 2025

Description

There was a logic error in creating the eddsa signature params for pkcs11, that when OSSL_SIGNATURE_PARAM_INSTANCE OSSL_PARAM was not provided, the pkcs11 parameters were not created and Ed448 operations were failing.

For some reason, the pkcs11 parameters are required for the Ed448 even if no prehashing nor context is used.

Additionally, if only the context is provided by OpenSSL/caller, we also need to provide the correct parameters, which was not handled before.

Unfortunately, this is not the issue I was after during last days.

Checklist

  • Code modified for feature
  • Test suite updated with functionality tests

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Code conform to coding style that today cannot yet be enforced via the check style test
  • Commits have short titles and sensible commit messages
  • Coverity Scan has run if needed (code PR) and no new defects were found

@Jakuje Jakuje requested a review from simo5 January 9, 2025 18:07
Copy link
Member

@simo5 simo5 left a comment

Choose a reason for hiding this comment

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

I think the fix needs changes, but it is correct in abstract

tests/tsession.c Outdated Show resolved Hide resolved
src/signature.c Outdated Show resolved Hide resolved
The EdDSA supports only one-shot signatures so we need to get rid of the
Update + Final semantics in favor of the one-shot operation.

Signed-off-by: Jakub Jelen <[email protected]>
tests/setup.sh Outdated Show resolved Hide resolved
@Jakuje Jakuje force-pushed the eddsa-fixes branch 2 times, most recently from f7fbb4d to 9a8549e Compare January 13, 2025 17:41
When we import the EdDSA key from file, we always use the printable
string choice in the EC_PARAMS. But the key on token can use OID
in which case, we will not be able to match these two keys.

Previously, the fallback involved getting the EC_GROUP from the
EC_PARAMS, but this really works only with the ECDSA keys. On EdDSA
keys, we always fail as the EdDSA keys do not have any EC_GROUP defined
in OpenSSL and there is no conversion from the EC_PARAMS that contain
printable string so the matching needs to be done differently than with
the ECDSA keys.

Previously, this worked because the Ed25519 keys we used had always
representation with printable string so we were able to match the
EC_PARAM strings byte-by-byte.

Signed-off-by: Jakub Jelen <[email protected]>
@simo5 simo5 added the covscan Triggers Coverity Scanner label Jan 13, 2025
@github-actions github-actions bot removed the covscan Triggers Coverity Scanner label Jan 13, 2025
@simo5 simo5 added the covscan-ok Coverity scan passed label Jan 13, 2025
@simo5
Copy link
Member

simo5 commented Jan 13, 2025

Thanks for this fix!

@simo5 simo5 merged commit 9e5635b into latchset:main Jan 13, 2025
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
covscan-ok Coverity scan passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants