libsodium-go
libsodium-go copied to clipboard
Fix pointer to AEAD context
The crypto_aead functions with precomputation take a pointer to a
crypto_aead_aes256gcm_state object as argument, not a char array.
The compiler is changed to clang because the code with the correct pointer does not compile with GCC, see golang/go#7270.
Does it compile on Windows too?
I don't see why not, but I don't have any way to verify.
Hmm, ok.
Me neither, the batch file needs updating before I can accept this PR. Maybe it's a small change.
I have changed the batch file as well.
Is there any news on this? It doesn't compile on macos with apple-clang 9.0 either, this patch fixes it
It's weird that it breaks GCC, crypto_aead_aes256gcm_state is just a C typedef. This PR fixed clang but broke GCC.
Do you think there is a way to make both happy?
That structure must be stored at a 16 bytes aligned location.
The same thing applies to crypto_onetimeauth_poly1305_state.
@theodelrieu GCC has an open issue for this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81001
This seems to explain how to deal with alignment constraints: http://www.tapirgames.com/blog/golang-memory-alignment
@jedisct1 I will look into alignment constraints for this (and for #31), thanks!
Thank you to everyone that's helping with this issue.
I have updated #31 and created #32 for the alignment issue.
Does this work for CLANG and GCC now then?
@redragonx no, that is not possible until this GCC bug is solved.