Skip to content
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

BLS extensions #274

Merged
merged 5 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ lazy_static = "=1.4.0"
num-bigint = "=0.4.3"
num-traits = "=0.2.15"
num-integer = "=0.1.45"
bls12_381 = "=0.8.0"
sha2 = "=0.10.6"
# the experimental feature enables hashing to curves
bls12_381 = { version = "=0.8.0", features = ["experimental"] }
# the newer sha2 crate doesn't implement the digest traits required by HKDF
group = "=0.13.0"
sha2 = "=0.9.9"
openssl = { version = "=0.10.52", features = ["vendored"], optional = true }

[dev-dependencies]
Expand Down
18 changes: 17 additions & 1 deletion fuzz/fuzz_targets/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
use libfuzzer_sys::fuzz_target;

use clvmr::allocator::{Allocator, NodePtr};
use clvmr::bls_ops::{
op_bls_g1_multiply, op_bls_g1_negate, op_bls_g1_subtract, op_bls_g2_add, op_bls_g2_multiply,
op_bls_g2_negate, op_bls_g2_subtract, op_bls_map_to_g1, op_bls_map_to_g2,
op_bls_pairing_identity, op_bls_verify,
};
use clvmr::core_ops::{op_cons, op_eq, op_first, op_if, op_listp, op_raise, op_rest};
use clvmr::cost::Cost;
use clvmr::more_ops::{
Expand All @@ -14,7 +19,7 @@ use clvmr::serde::node_from_bytes;

type Opf = fn(&mut Allocator, NodePtr, Cost) -> Response;

const FUNS: [Opf; 30] = [
const FUNS: [Opf; 41] = [
op_if as Opf,
op_cons as Opf,
op_first as Opf,
Expand Down Expand Up @@ -46,6 +51,17 @@ const FUNS: [Opf; 30] = [
op_all as Opf,
// the BLS extension
op_coinid as Opf,
op_bls_g1_subtract as Opf,
op_bls_g1_multiply as Opf,
op_bls_g1_negate as Opf,
op_bls_g2_add as Opf,
op_bls_g2_subtract as Opf,
op_bls_g2_multiply as Opf,
op_bls_g2_negate as Opf,
op_bls_map_to_g1 as Opf,
op_bls_map_to_g2 as Opf,
op_bls_pairing_identity as Opf,
op_bls_verify as Opf,
];

fuzz_target!(|data: &[u8]| {
Expand Down
208 changes: 208 additions & 0 deletions op-tests/test-bls-ops.txt

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions op-tests/test-blspy-g1.txt

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions op-tests/test-blspy-g2.txt

Large diffs are not rendered by default.

212 changes: 212 additions & 0 deletions op-tests/test-blspy-hash.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions op-tests/test-blspy-pairing.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions op-tests/test-blspy-verify.txt

Large diffs are not rendered by default.

Loading