-
Notifications
You must be signed in to change notification settings - Fork 54
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
crypt: provide non-cgo implementation of "crypt()" to be more cross-build friendly #1114
Conversation
8299f82
to
6b24f2f
Compare
Food for thought: what if we used openssl everywhere? I suppose that less cgo is generally better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but unit tests in GH actions need openssl now.
Also a note about communicating external dependencies, which might be a topic for a follow-up PR.
This commit add a trivial openssl based fallback version of crypt() that works when the library is build without cgo (e.g. when doing a cross build).
6b24f2f
to
d627f30
Compare
Rebased due to image build cache layout change (#1130) |
Now that we support building images without cgo also test it.
d627f30
to
6b31cff
Compare
Alternatively we could just switch to the pure go implementation in https://github.com/nanitor/pwhash - I have no strong opinions either way (I looked at the go implementation briefly and it looks fine and uses the official test vectors). I can do this as e.g. a followup. |
I actually have a quite strong opinion here: The more crypto we can offload to already existing implementation in operating systems, the better. I don't want our team to maintain needless crypto (and yes, since we are vendoring all the code, we are technically speaking maintaining it). Also, openssl and libxcrypt are widely used and recognized libraries. I'm happy to use Go libraries for a almost everything, the Go ecosystem is wonderful. Just not crypto please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The last commit has a typo in the commit message "kttp" vs. "http", but I can live with it 😅
koji requires the khttp kerberos module which requires cgo so when build without cgo kerberos uploads are currently not supported.
6b31cff
to
501d0f3
Compare
Nice catch! Indeed, the problematic import is Sadly will need a re-view :) |
This commit changes the build to not build with CGO. There is really no need to build with CGO, we only need it for the `crypt()` version in the images library. However since with the merge of osbuild/images#1114 that is no longer an issue.
This commit changes the build to not build with CGO. There is really no need to build with CGO, we only need it for the `crypt()` version in the images library. However since with the merge of osbuild/images#1114 that is no longer an issue.
This PR tweaks the images library to work without "cgo" so that we can cross build. Thanks to @supakeen for raising this!
With the PR we can now do:
in the image-builder-cli source tree.