diff --git a/bin/transpiler/src/main.cpp b/bin/transpiler/src/main.cpp index fd40c75a..846358ce 100644 --- a/bin/transpiler/src/main.cpp +++ b/bin/transpiler/src/main.cpp @@ -496,7 +496,7 @@ int curve_dependent_main( std::cout << "Generating proof..." << std::endl; using ProofType = nil::crypto3::zk::snark::placeholder_proof; ProofType proof = nil::crypto3::zk::snark::placeholder_prover::process( - public_preprocessed_data, private_preprocessed_data, table_description, constraint_system, assignment_table, + public_preprocessed_data, private_preprocessed_data, table_description, constraint_system, lpc_scheme); std::cout << "Proof generated" << std::endl; diff --git a/examples/cpp/bls12_381_signature_verification.cpp b/examples/cpp/bls12_381_signature_verification.cpp index 133ae69f..56c98a6e 100644 --- a/examples/cpp/bls12_381_signature_verification.cpp +++ b/examples/cpp/bls12_381_signature_verification.cpp @@ -1,29 +1,13 @@ #include #include -#include +#include using namespace nil::crypto3; [[circuit]] bool verify_signature( typename algebra::fields::bls12_base_field<381>::value_type hashed_msg, typename algebra::curves::bls12<381>::template g2_type<>::value_type pubkey, - typename algebra::curves::bls12<381>::template g1_type<>::value_type sig) { - - typename algebra::curves::bls12<381>::template g1_type<>::value_type msg_point = __builtin_assigner_hash_to_curve(hashed_msg); - - // __builtin_assigner_exit_check(__builtin_assigner_is_in_g1_check(sig)); - // __builtin_assigner_exit_check(__builtin_assigner_is_in_g2_check(pubkey)); - - typename algebra::curves::bls12<381>::template g2_type<>::value_type g2_group_generator = algebra::curves::bls12<381>::template g2_type<>::one(); - - typename algebra::curves::bls12<381>::gt_type::value_type pairing1 = algebra::pair>(sig, g2_group_generator); - typename algebra::curves::bls12<381>::gt_type::value_type pairing2 = algebra::pair>(msg_point, pubkey); - - bool are_equal = 0; - for (std::size_t i = 0; i < 12; i++) { - are_equal = are_equal && (pairing1[i] == pairing2[i]); - } - // __builtin_assigner_exit_check(are_equal); - - return are_equal; + typename algebra::curves::bls12<381>::template g1_type<>::value_type sig +) { + return pubkey::detail::bls_basic_functions::verify(hashed_msg, pubkey, sig); } \ No newline at end of file diff --git a/examples/cpp/bls12_381_signature_verification_aggregated.cpp b/examples/cpp/bls12_381_signature_verification_aggregated.cpp index 31cf885f..4135fa44 100644 --- a/examples/cpp/bls12_381_signature_verification_aggregated.cpp +++ b/examples/cpp/bls12_381_signature_verification_aggregated.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include using namespace nil::crypto3; @@ -13,32 +13,5 @@ constexpr const std::size_t validators_amount = 5; typename algebra::curves::bls12<381>::template g1_type<>::value_type aggregated_signature ) { - // __builtin_assigner_exit_check(__builtin_assigner_is_in_g1_check(aggregated_signature)); - - - typename algebra::curves::bls12<381>::template g2_type<>::value_type g2_group_generator = algebra::curves::bls12<381>::template g2_type<>::one(); - typename algebra::curves::bls12<381>::gt_type::value_type pairing1 = - algebra::pair>(aggregated_signature, g2_group_generator); - - typename algebra::curves::bls12<381>::template g1_type<>::value_type msg_point = __builtin_assigner_hash_to_curve(hashed_msg); - - // __builtin_assigner_exit_check(__builtin_assigner_is_in_g2_check(pubkeys[0])); - typename algebra::curves::bls12<381>::gt_type::value_type pairing2 = - algebra::pair>(msg_point, pubkeys[0]); - - typename algebra::curves::bls12<381>::gt_type::value_type current_pairing; - - for (std::size_t i = 1; i < validators_amount; i++) { - // __builtin_assigner_exit_check(__builtin_assigner_is_in_g2_check(pubkeys[i])); - current_pairing = algebra::pair>(msg_point, pubkeys[i]); - pairing2 = __builtin_assigner_gt_multiplication(pairing2, current_pairing); - } - - bool are_equal = 0; - for (std::size_t i = 0; i < 12; i++) { - are_equal = are_equal && (pairing1[i] == pairing2[i]); - } - // __builtin_assigner_exit_check(are_equal); - - return are_equal; + return nil::crypto3::pubkey::detail::bls_basic_functions::aggregate_verify(hashed_msg, pubkeys, aggregated_signature); } diff --git a/libs/crypto3 b/libs/crypto3 index 81e0c05c..932140da 160000 --- a/libs/crypto3 +++ b/libs/crypto3 @@ -1 +1 @@ -Subproject commit 81e0c05c4a36592b135f448b15a65f58e8fe8fed +Subproject commit 932140da6efa9da1d02ede7219ca9b96e1fdda95