-
Notifications
You must be signed in to change notification settings - Fork 803
Various fixes for ECDSA key operations with ePass 2003 token #2845
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
Conversation
|
rebased to avoid conflicts. pinging also @xaqfan as he contributed some code to the ePass2003 driver recently and he could proide some insights into the proposed changes. |
|
let me take a look, thanks |
The code paths for the ECDSA signatures provide SHA1 and SHA256 padding. Any other padding should return an error as unsopported operation, but given that the variable r was reused for some temporary calculation it returned positive value, which was handled by the calling code as a success. Moreover, the calling code in use_key() function skipped the key operation with this return value causing returning the uninitialized memory to the calling process.
|
Dropped the commit ab533d0 removing the raw ECDSA mechanism as this is something I do not completely understand and just announce additional mechanism that works only with specific input sizes (SHA1 and SHA256). The others stayed and should land before the 0.24.0 as they cause memory issues. |
By setting The driver sets By dropping the SC_ALGORITHM_ECDSA_RAW, upper layers in OpenSC will not do other hashes. The card appears to only accept length 0x14 or 0x20 requiring strange code. |
|
My old epass2003 without this mods shows: I would expect with this it mod it would only show: The "hw" is misleading because the driver is doing the hash. |
|
@Jakuje can you please test this patch? This should allow ECDSA to be used with SHA384 and SHA512. If we supplement epass2003_decipher() with the function of padding zeros before the shorter input, ECDSA with SHA224 will also work. I have only tested it in the simulator https://github.com/popovec/epass2003_sim/, as my epass2003 does not know anything about EC encryption. |
|
I have prepared a patch that fixes all ECDSA-SHA* and RAW EDCSA mechanisms. It also removes the incorrectly flagged "hw" attribute. Please try to check if it works on a real token, I only have a simulation. |
|
Does anyone have a epass2003 with EC that could test this PR? My epass2003 is from Gooze in 2011 and does not support EC. |
|
As far as I know, @Jakuje has the possibility to test it. The simulator test is available here: The error that is there comes from the diff of the reference and the new json file. |
|
Sorry, I will be able to test this manually only during last week of October. The most I can help with now is just to merge your changes and see what they will do in the gitlab CI, where I have the epass2003 plugged in. I do not have direct access to that machine now. |
|
I'll leave it up to you, I won't generate a PR from it yet, as I would hate to disrupt the current state of epass2003, which seems to work well at least for ECDSA-SHA1 and ECDSA-SHA256. However, it would be good if 0.24 final already contained functional code for ECDSA and ECDSA-SHA384 and ECDSA-SHA512. |
While setting up a token for automated CI, I noticed couple of failures that I am trying to fix here.
@FeitianSmartcardReader please, have a look. If the ePass should support also other digest operations with ECDSA, please point us to some documentation.
Checklist