Use openssl.HashSignECDSA in fips-enabled Go 1.22#8
Use openssl.HashSignECDSA in fips-enabled Go 1.22#8nalind wants to merge 1 commit intocontainers:mainfrom
Conversation
Try to use openssl.HashSignECDSA instead of ecdsa.HashSign in Go 1.22 and later. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
|
In my testing, after and many others. (Removing the Building this package directly, without any users, (in module mode, or with GO111MODULE=off and packages placed into GOPATH) fails similarly. Am I missing a trick? (I tested this by installing the EL*
At least the version in Go 1.20 was creating ASN.1 (which was immediately decoded in |
|
I was checking this inside of a centos-stream-10-x86_64 mock chroot, so there could well be some mixing of a copies inside of $GOROOT and ./vendor that I wasn't noticing. |
|
Let me retry this tomorrow in a proper environment, so make sure it’s not me. |
|
I get similar errors from inside of a container based on quay.io/centos/centos:stream10-development. Perhaps I didn't understand the advice we were being given after all. |
|
Testing this:
That seems consistent with the idea that the But even then the tests fail for me, e.g. |
|
@derekparker could you help us with this, please? Previously, around containers/skopeo#2297 (comment), you pointed at But, also, contra the motivating (private) https://bugzilla.redhat.com/show_bug.cgi?id=1740920 , where calling Is there some other way to build/use the Thanks! |
Absolutely!
Sorry for the confusion there. I did not intent to imply that you should be importing that package yourself if you're already using the Go toolchain we provide. You're correct in that it is already provided by our toolchain internally.
I believe this to be a bug in the 1.22 toolchain we ship, where we do not provide these symbols exported publicly. We shipped them initially due to guidance from the crypto teams that hashing and signing should be done in a single-shot API due to FIPS limitations, however in more recent discussions that seems to be more of a "nice to have" feature to ensure that hashing and signing both happen via the certified crypto module.
Please do not revert to
Let me sync with the crypto team on this and see if we can remove the HashSign and HashVerify symbols going forward. If not, we will provide those symbols in our next release. |
|
golang-fips/go#57 has restored the original API, and builds with |
|
Agreed, closing. |
Try to use openssl.HashSignECDSA instead of ecdsa.HashSign in Go 1.22 and later. The main trick is the format of the generated signature being different, but
TestECSignVerify()uses the new function to generate signatures and the standard library's function to verify them, so I think it's right.