From 34344f7b1df7ae16d05e2c54d0d3b987b690c30f Mon Sep 17 00:00:00 2001 From: qmuntal Date: Fri, 13 Dec 2024 16:43:14 +0100 Subject: [PATCH] fix FIPS mode --- rsa.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsa.go b/rsa.go index a027ced..36e719a 100644 --- a/rsa.go +++ b/rsa.go @@ -50,9 +50,12 @@ func SupportsSignatureRSAPKCS1v15(ch crypto.Hash) (supported bool) { } defer C.go_openssl_EVP_PKEY_CTX_free(ctx) + msg := make([]byte, 1) + var outLen C.size_t return C.go_openssl_EVP_PKEY_sign_init(ctx) == 1 && C.go_openssl_EVP_PKEY_CTX_ctrl(ctx, -1, -1, C.GO_EVP_PKEY_CTRL_MD, 0, unsafe.Pointer(md)) == 1 && - setRSAPAdding(ctx, C.GO_RSA_PKCS1_PADDING) == nil + setRSAPAdding(ctx, C.GO_RSA_PKCS1_PADDING) == nil && + C.go_openssl_EVP_PKEY_sign(ctx, nil, &outLen, base(msg), C.size_t(len(msg))) == 1 } func GenerateKeyRSA(bits int) (N, E, D, P, Q, Dp, Dq, Qinv BigInt, err error) {