Add checks for sizes/alignment.

This commit is contained in:
Sean Bowe 2016-08-02 23:30:47 -06:00
parent dcb0d44b00
commit f18273d8df
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
1 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,20 @@ extern "C" void libsnarkwrap_init() {
libsnark::inhibit_profiling_counters = true;
assert(sodium_init() != -1);
curve_pp::init_public_params();
// Rust wrappers assume these sizes
assert(sizeof(curve_Fr) == 8 * (4));
assert(sizeof(curve_G1) == 8 * (4 * 3));
assert(sizeof(curve_G2) == 8 * (4 * 2 * 3));
assert(sizeof(curve_GT) == 8 * (4 * 6 * 2));
// Rust wrappers assume alignment.
// This will trip up enabling ate-pairing until
// the wrappers are changed.
assert(alignof(curve_Fr) == alignof(uint64_t));
assert(alignof(curve_G1) == alignof(uint64_t));
assert(alignof(curve_G2) == alignof(uint64_t));
assert(alignof(curve_GT) == alignof(uint64_t));
}
// Fr