smimesign icon indicating copy to clipboard operation
smimesign copied to clipboard

Fix certstore windows cmsg type error when building using go v1.18

Open ElMostafaIdrassi opened this issue 2 years ago • 3 comments

When trying to use certstore in a project that makes use of go v1.18+, the following error occurs :

github.com\github\[email protected]\certstore\certstore_windows.go:640:29: cannot convert cmsg (variable of type *_Ctype_char) to type _Ctype_HANDLE

From this golang issue, it appears that go 1.18 has added some safety checks which reject unsafe conversions, resulting in such errors.

A simple fix is to cast the cms variable into an unsafe.Pointer before casting it to a C.HLOCAL. This change was tested on Windows by building smimesign locally and running the test suite.

Closes #107

Signed-off-by: El Mostafa IDRASSI [email protected]

ElMostafaIdrassi avatar Jul 07 '22 17:07 ElMostafaIdrassi

Thanks for this PR!

It looks fairly straightforward — we'll have to verify and debug this a bit, but looks like an appropriate fix.

lgarron avatar Jul 21 '22 19:07 lgarron

Thanks for this PR!

It looks fairly straightforward — we'll have to verify and debug this a bit, but looks like an appropriate fix.

This pull requests also fixes an issue we have, that our signed commits cannot be verified with git verify-commit <commitid>. A misleading error message is shown: failed to verify signature: x509: certificate signed by unknown authority

Is there are a roadmap or release date when a new release with this fix will be available?

pc-ahrens avatar Sep 05 '22 06:09 pc-ahrens

I can confirm this is an issue on go version go1.20.8 linux/amd64

naggie avatar Nov 17 '23 16:11 naggie