-
Notifications
You must be signed in to change notification settings - Fork 714
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
[WIP][Build] Libsodium upgrade & sanity checks #2358
base: master
Are you sure you want to change the base?
[WIP][Build] Libsodium upgrade & sanity checks #2358
Conversation
09e0059
to
3c7e965
Compare
3c7e965
to
0b49eda
Compare
826245e
to
6aeb599
Compare
Gitian looking good
|
So, i've spent the past couple days diving into this. I didn't like the idea of relying solely on a runtime assertion to determine if a linked 3rd party library dependency was compatible or not... Ended up adding an additional patch to the 1.0.17 source tarball that sets a fixed This, of course, lead to issues with the PPA nightly builds. PPA builds don't allow network access during build-time, so they cannot use the The branch i've been working on is https://github.com/Fuzzbawls/PIVX/tree/pr-2358, which was rebased on master to resolve the minor conflicts currently present here. Still todo:
Note: While all this makes the runtime assertion rather redundant, I have left it in place so as to not revert anything in the branch. |
here again finally, so much stuff happening.. |
6aeb599
to
6ca1355
Compare
Updated + removed libsodium from the recently added native macOS-10.15 job. Let's see if GA likes it now. |
Not adding test vectors for non-canonical pubkeys, as that would require grinding to find a private key corresponding to one of the 19 pubkeys that can be non-canonical. Adapted for PIVX unit test framework.
Abort at node startup if it is running a non-patched version of the libsodium library. libsodium <= 1.0.15 accepts valid signatures for a non-zero pubkey with small order; this is currently part of our consensus rules. libsodium >= 1.0.16 rejects all pubkeys with small order.
…hat. Adaptation coming from zcash@2902ac7ce8e754d09a5137cba82d8af10c172977
Plus connected to GA.
…ency, to avoid updating config scripts over the network.
This allows us to do some compile time checking to see if we are using a compatible version
Otherwise it is already supplied by the previous depends stage
GA builds that intend to use syslibs instead of depends (CMake and no_depends jobs) end up installing libsodium syslib, so remove that prior to installing our patched version. This also moves the installation of the patched version of sodium to the environment setup stage.
We require the use of libsodium <= 1.0.15, or a patched version of 1.0.17, which is supplied by depends or the `install_sodium.sh` shell script. This change will look at the libsodium version header's `SODIUM_LIBRARY_VERSION_MAJOR` and `SODIUM_LIBRARY_VERSION_MINOR` values to determine if it is a valid version. For reference, Sodium 1.0.15 used `10` and `0`, respectively. Earlier versions used a different major value, and later versions used a different minor value, so this combination of values is unique to v1.0.15 (and our patched version of v1.0.17)
fbe871a
to
80e8493
Compare
Moved to v6.0 milestone. |
Conclusion of a time consuming gitian investigation..
Focused on the following points:
Upgrading the current libsodium version that has been marked as deprecated by the maintainers.
Adding sanity checks and unit test coverage for newer libsodium versions which are breaking the network consensus rules for the Ed25519 pubkey and signature validation.
libsodium <= 1.0.15 accepts valid signatures for a non-zero pubkey with small order; this is currently part of our consensus rules.
libsodium >= 1.0.16 rejects all pubkeys with small order.
Investigation coming from zcash#4359, adapted to our sources as we cannot run libsodium 1.0.18 for glibc compatibility issues.
This dangerous situation at the moment does not affect the released binaries as gitian/depends build is hardcoded to use libsodium 1.0.15 but can happen during local builds. For example, in macOS, brew by default installs the latest supported libsodium library, which at the time being is 1.0.18, and without the pubkey and signature validation patches, it breaks our consensus rules (same occurs in xenial with the
libsodium-dev
package).Plus, added another good to have init sanity check for libsodium that verifies that signatures are canonical (s < L)
(coming from zcash#2902ac7c)
TO DO:
Create script to build and patch libsodium 1.0.17. So the library can easily be built and linked locally fixing GA issues.
Document this properly inside each of the build_**.md files.