-
Notifications
You must be signed in to change notification settings - Fork 1
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
+-x into 2x #6
+-x into 2x #6
Conversation
BigNumber::from_slice(x.to_be_bytes().as_bytes()) | ||
// double the range to account for +- | ||
let m = BigNumber::from(2) * &security.q; | ||
BigNumber::from_rng(&m, rng) |
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.
Openssl (and maybe some other) backends of unknown_order ignore provided source of randomness. I just can imagine someone choosing openssl backend and, as a result, getting unintuitive errors and unexpected behavior.
Can we detect somehow which backend is chosen and produce compiler_error!
(if it's possible to detect on compile-time) or panic!
(if we can determine backend only in runtime)?
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.
I think it's easier to forbid openssl as a feature, since a backend is explicitly selected with this crate. I'll disable it in the next commit
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.
Done
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.
You can do that, but one can bypass that by setting pailler-zk.deafult-features = false
, and turning openssl feature on directly on unknown-order
. If we can't check which backend is used, we should at least add a note, that this backend is not supported
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.
We don't have any root-level docs or readme where we could mention that, I'm fine if you open an issue to remember mention it in the docs in the future
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.
Ok, makes sense. Let's make this and the discussion below into a separate documentation MR
I see you added a lot of docs. Is it a right time to add |
Otherwise the performance is cripplingly bad
Found another case of non-determinism that slipped me by, and fixed it. Should be completely ready now |
Oh god, and now CI fails with that exact test, what happened |
I'm not sure what happened there with CI. I debugged it locally, and the proofs are computed deterministically |
I recommend you to use rand_dev in tests rather than |
=)) Good crate though, will use it The problem with determinism here is that it's easy to accidentally use functions from unknown_order that use OsRng implicitly. |
Should we then add a script that |
So still unresolved things in this PR
If you don't want to resolve any of them within this PR, please just open an issue so we could keep track of them. |
I think all those 4 changes are out of scope of this MR at least, yes. Let me make the issues for them |
Great, thanks! |
In the initial implementation I forgot that the notation for
y <- +-a
means thaty <- [0; 2a]
. This patch changes the generation functions to account for thatWhile making this change, I also refactored tests and added a new category of tests: check that the probablity to reject a correct proof is similar to the one in paper. This helps to show that the change above didn't break security (at least completely)