Skip to content
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

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

Closed

Conversation

ElMostafaIdrassi
Copy link
Contributor

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]

@lgarron
Copy link
Contributor

lgarron commented Jul 21, 2022

Thanks for this PR!

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

@pc-ahrens
Copy link

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?

@naggie
Copy link

naggie commented Nov 17, 2023

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

leo-cydar added a commit to CydarLtd/smimesign that referenced this pull request Jan 12, 2024
This commit ports over two fixes that seemingly have lost all upstream traction:

1. Add support for RSA-PSS signature verification
2. Add an `unsafe.Pointer` cast to allow compilation on Go > 1.17

These code changes are both mostly ported, there is little "original" code.

https://github.com/github/certstore/pull/20/files#diff-e46a14c55fd3c2c2f7ade1a63b9f14f591829e183d307f7d2ee54cb7cc4c4073R395
github#114
@Alestrix Alestrix mentioned this pull request Sep 11, 2024
@vcsjones
Copy link
Member

Closing and re-opening to jog CI.

@vcsjones vcsjones closed this Sep 16, 2024
@vcsjones vcsjones reopened this Sep 16, 2024
@vcsjones vcsjones mentioned this pull request Sep 16, 2024
@vcsjones
Copy link
Member

This pull request was cherry-picked in pull request #149. Thank you for your contribution! I am going to close this pull request since your commits are now merged.

@vcsjones vcsjones closed this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

certstore: certstore_windows.go type error
6 participants