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

ECDSA-SHA1: Apply SHA1 to input data before PSO compute signature. #2187

Closed
wants to merge 1 commit into from

Conversation

popovec
Copy link
Member

@popovec popovec commented Dec 17, 2020

CKM_ECDSA and CKM_ECDSA_SHA1 cannot be registered in the same way.
We need to use sc_pkcs11_register_sign_and_hash_mechanism ()
for CKM_ECDSA_SHA1.

This fix also enables more ECDSA-SHAxxx mechanisms in framework-pkcs15.c

Tested: MyEID 4.0.1 (secp256r1 with SHA1, SHA224, SHA256, SHA384, SHA512)

CI tests (Travis + OsEID) for ECDSA-SHAxxx mechanisms are also enabled.
Fixes #2181

Checklist
  • PKCS#11 module is tested

CKM_ECDSA and CKM_ECDSA_SHA1 cannot be registered in the same way.
We need to use sc_pkcs11_register_sign_and_hash_mechanism ()
for CKM_ECDSA_SHA1.

This fix  also enables more ECDSA-SHAxxx mechanisms in framework-pkcs15.c

Tested: MyEID 4.0.1 (secp256r1 with SHA1, SHA224, SHA256, SHA384, SHA512)

CI tests (Travis + OsEID) for ECDSA-SHAxxx mechanisms are also enabled.
Copy link
Member

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

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

Looks good. Tested with patch from #2181 and the EC with SHA1 works with my Yubikey as well as with NIST Test PIV card 5.

@popovec
Copy link
Member Author

popovec commented Dec 20, 2020

This fix interferes with the functions of the epass2003 driver. Please do not merge until a better solution is found - discusion in #2181.

dengert added a commit to dengert/OpenSC that referenced this pull request Dec 21, 2020
This PR is based on discussion with @popovec in
OpenSC#2181
and OpenSC#2187
which was cherry-picked as 5e53008

This has been tested with PIV, MyEID and Smartcard-HSM.
with ECDSA keys.

The main fixes include :
 - Setting "flags" in card drivers
 - added code to sc_pkcs15-compute-signature for handle ECDSA with hashes
 - code in framework-pkcs15.c

Signatures made by pkcs11-tool -sigm verify with openssl
but pkcs11-tool --verify  does not work with ECDSA but does with RSA
I suspect it has to do with:
and some  then creating the wrong PKCS11 mechanisms

It should work with the epass2003 which does hashes in the driver.
@frankmorgner
Copy link
Member

@popovec can we merge this along with #2190 or is there still an other problem?

@popovec
Copy link
Member Author

popovec commented Jan 22, 2021

@popovec can we merge this along with #2190 or is there still an other problem?

#2190 is fine for me, #2190 already contain this PR (as commit 5e53008).

Thanks.

frankmorgner pushed a commit that referenced this pull request Jan 24, 2021
This PR is based on discussion with @popovec in
#2181
and #2187
which was cherry-picked as 5e53008

This has been tested with PIV, MyEID and Smartcard-HSM.
with ECDSA keys.

The main fixes include :
 - Setting "flags" in card drivers
 - added code to sc_pkcs15-compute-signature for handle ECDSA with hashes
 - code in framework-pkcs15.c

Signatures made by pkcs11-tool -sigm verify with openssl
but pkcs11-tool --verify  does not work with ECDSA but does with RSA
I suspect it has to do with:
and some  then creating the wrong PKCS11 mechanisms

It should work with the epass2003 which does hashes in the driver.
@frankmorgner
Copy link
Member

thanks for the feedback! closed with #2190

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.

ECDSA-SHA1 - unable to sign file/wrong signature
3 participants