-
Notifications
You must be signed in to change notification settings - Fork 47
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
RSA key comparison: exit early after MODULUS / PUBLIC_EXPONENT are compared - no round-trip to HSM #346
Conversation
00e2f75
to
23cd1f1
Compare
It is probably better to just add a check for the modulus early on for CKK_RSA just where we check the public exponent, and then we can immediately return w/o even calling cmp_public_keys. Alternatively, move the check for CKA_PUBLIC_EXPONENT into cmp_public_key_values(), and the initial check for CKK_RSA would simply call cmp_public_key_values() unconditionally (with a comment that Private RSA key always include the public attributes. And again just return later on. |
23cd1f1
to
1dd0d4e
Compare
Ok - colocated both checks (MODULUS/PUBLIC_EXPONENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a couple of style issues, then once CI is happy (ignore MacOS+softhsm if it fails, it if flaky) I'll merge.
1dd0d4e
to
40fdca8
Compare
Done - please check |
Addresses latchset#345. Signed-off-by: S-P Chan <[email protected]>
40fdca8
to
0ade270
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Addresses #345.
RSA keys:
the match operator was falling-through to the generic comparator (look for associated objects) instead of exiting early after EXPONENT/MODULUS were verifiedRSA keys should never need to use find_associated_obj: the private key has enough attributes to do a logical comparison with the public key.
This is the same behaviour as OpenSC/libp11