-
Notifications
You must be signed in to change notification settings - Fork 100
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
Request use of SHA256 hash from OpenSSL #31
Comments
I have no clue on what an ameth is or where to register it. |
Notes from #15: @AndreasFuchsSIT I'll let you ensure you have an ameth which implements ASN1_PKEY_CTRL_DEFAULT_MD_NID, reporting something like SHA1 or SHA256 as mandatory. Arguably if you do that, it should be considered a bug in existing versions of OpenSSL that they then ask you to perform any other kind of signature. And in fact, that bug is fixed in my trees at [...] This is fixed in OpenSSL master now that openssl/openssl#7408 is merged. This bug is all yours now :) |
@dwmw2 Sorry, but OpenSSL is just beyond my comprehension... So, at https://github.com/tpm2-software/tpm2-tss-engine/blob/master/src/tpm2-tss-engine-ecc.c#L328 Just wanted to confirm before running the wrong direction... |
I confess I don't really know. What you suggest looks reasonable. |
https://mta.openssl.org/pipermail/openssl-users/2018-November/009334.html pointed out that digest values are merely truncated if the curve uses fewer bits. Implement this alongside the ameth ctrl for maximum compatibility. |
The truncation seems to be working, although shouldn't it be using EC_GROUP_order_bits() instead of hard-coding it for just a couple of curves? That's what I've submitted to the other engine, in https://groups.io/g/openssl-tpm2-engine/topic/patch_truncate_hashes_for/32999767 I suggested that OpenSSL should perhaps do the truncation for itself: openssl/openssl#9680 Note that if OpenSSL does that, then our trick of making up a hash type for the TPM to ignore based on the digest size is going to start failing. Perhaps we should just always say SHA256 regardless of the hash being used? Why does the TPM care anyway? |
The problem is within the TPM spec. The max size for input buffers on the TPM command is restricted by the maximum hash size of TPM supported hash algorithms. Kind of weird, but whatever. Would you mind sending a PR to here as well so it's not GPL tainted ? Thanks ! |
How does #139 look? |
LGTM. |
Split out from #15
The text was updated successfully, but these errors were encountered: