-
Notifications
You must be signed in to change notification settings - Fork 85
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 sodium constant type (size_t instead of ulong_long) #113
Conversation
…etting sodium constants to size_t
|
For me it looks like ulong_long is used where something can come from a external source and size_t is used when it happens on the local machine. |
@jedisct1 I don't get it. The libsodium source says size_t in this case. See https://github.com/jedisct1/libsodium/blob/master/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c#L8. Why does rbnacl have to use ulong_long here? |
@paddor I haven't had time to investigate this in-depth but it would seem this change doesn't actually honor the libsodium type signatures and changing it to This seems like something that needs to be handled with care. |
All constants in NaCl and libsodium are of type size_t @tarcieri
|
@tarcieri Thanks for the answer. Your concerns make sense, of course. I just logged the usage of the method #sodium_constant to see for what constants it's used. I ended up with this list:
I just |
fix sodium constant type (size_t instead of ulong_long)
@tarcieri No problem, and thanks! |
It seems like libsodium exposes all constants as
size_t
(I checked at least the filessrc/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c
andsrc/libsodium/crypto_generichash/blake2/generichash_blake2_api.c
of libsodium). So this FFI declaration seems wrong and is probably the reason for issue #112.I haven't actually tested this. @patte Could you test this on your Raspberry Pi?
@tarcieri Does this sound plausible? I don't know a lot about C.