-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
changed crypto/olm to use goolm (no cgo needed anymore) #106
Conversation
This package does not need to be compiled with cgo anymore. I wrote a pure go implementation of libolm and changed crypto/olm to use this new implementation.
Looks interesting, I've wanted to build that myself for a while but never got around to it. Definitely can't make it the default right away though, that's a very sensitive part of the code |
Instead of completly replacing the libolm integration, the goolm integration can now be used with the build tag 'goolm'. Libolm is thus still the default olm implementation.
I agree that this change should still be tested and is truly a sensitive part. I've changed the code to again include your libolm implementation and moved the goolm part into seperate files with the build tag 'goolm'. Maybe a short message could be added to the README if this PR is to be merged. Something like: Usage without CGO (experimental)Instead of depending on libolm with CGO, an alternative pure go implementation of olm can be used by specifying the build tag Should I add this? |
any news on getting this merged? |
i've been trying this with a bot i've been building and it seems to work fine btw thanks for implementing it! |
Pulled the PR and test with
A current state of the merge is at https://github.com/meschbach/mautrix-go . Assuming this does not happen on Could this be related to |
The error is now fixed. There was a missing initialization of the initial ratchet on an inbound megolm session in goolm.
I fixed this too and merged the current master as well. |
Thank you for making those changes! 🥇 Tested with a derivative of the code in |
@DerLukas15 do you mind if I just copy goolm into mautrix-go? Circular dependencies in go.mod aren't nice even though they technically work, and there's a bunch of code quality stuff that needs improving. |
Please go ahead with the integration. |
Merged the base implementation plus a bunch of tweaks (fixing typos, underscores in JSON field names, switching to base64.RawStdEncoding instead of implementing it manually, reverting unnecessary changes to error names, dropping usage of github.com/pkg/errors in favor of the stdlib errors package). I think the remaining things are:
|
I'd give those remaining tasks a try if you don't mind. Another thing which I noticed now: |
Hmm yeah, that could make sense. It'd probably be cleaner even if it didn't reduce the amount of code. Someone might want to use vodozemac too (I don't because rust<->go interop is not nice, but having interfaces to make it possible to implement would be good) |
Hello.
I was in need for a matrix client written in go. I saw your package and wanted to use it, but I didn't want any c bindings (usage of cgo). To fix this issue I created goolm which is a pure go implementation of libolm. I took some inspiration from your crypto/olm package and included it in goolm so that the integration in your package was easier.
Goolm uses the same pickle algorithm as libolm. So this change should work with existing sessions which were pickled with libolm. However, I've not checked that. Most of the tests included in libolm have been directly ported to goolm.
I've been running my client with your package and goolm for some time now and it works fine so far. So now I want to contribute something back to you.
If you prefer to use libolm, I could also change the PR to use goolm only with a build tag (e.g. goolm) and keep libolm as the default.Please let me know what you think.