From 5142650622376a742080a208bb363d9af88c7497 Mon Sep 17 00:00:00 2001 From: rnburn Date: Fri, 18 Oct 2024 19:41:52 -0700 Subject: [PATCH] add serialization api --- cbindings/blitzar_api.h | 9 +++++++-- sxt/cbindings/backend/BUILD | 6 +++--- sxt/cbindings/backend/computational_backend.cc | 3 ++- sxt/cbindings/backend/computational_backend.h | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cbindings/blitzar_api.h b/cbindings/blitzar_api.h index 0e5546a5..e70c6cab 100644 --- a/cbindings/blitzar_api.h +++ b/cbindings/blitzar_api.h @@ -579,14 +579,19 @@ struct sxt_multiexp_handle* sxt_multiexp_handle_new(unsigned curve_id, const voi unsigned n); /** - * Use a serialized file to create a handle for computing multiexponentiations using a fixed + * Use a serialized file to create a handle for computing multiexponentiations using a fixed * sequence of generators. + * + * Reading the handle from a file can be significantly faster than calling + * sxt_multiexp_handle_new. */ struct sxt_multiexp_handle* sxt_multiexp_handle_new_from_file(unsigned curve_id, const char* filename); /** - * Write to file + * Write a multiexponentiation handle to file. + * + * Use this function in combination with sxt_multiexp_handle_new_from_file. */ void sxt_multiexp_handle_write_to_file(const struct sxt_multiexp_handle* handle, const char* filename); diff --git a/sxt/cbindings/backend/BUILD b/sxt/cbindings/backend/BUILD index efb28061..bf5e00f9 100644 --- a/sxt/cbindings/backend/BUILD +++ b/sxt/cbindings/backend/BUILD @@ -5,6 +5,9 @@ load( sxt_cc_component( name = "computational_backend", + impl_deps = [ + "//sxt/multiexp/pippenger2:in_memory_partition_table_accessor", + ], with_test = False, deps = [ ":computational_backend_utility", @@ -15,9 +18,6 @@ sxt_cc_component( "//sxt/multiexp/pippenger2:partition_table_accessor_base", "//sxt/ristretto/type:compressed_element", ], - impl_deps = [ - "//sxt/multiexp/pippenger2:in_memory_partition_table_accessor", - ], ) sxt_cc_component( diff --git a/sxt/cbindings/backend/computational_backend.cc b/sxt/cbindings/backend/computational_backend.cc index 9ab22c5b..6ba70260 100644 --- a/sxt/cbindings/backend/computational_backend.cc +++ b/sxt/cbindings/backend/computational_backend.cc @@ -15,8 +15,9 @@ * limitations under the License. */ -#include "sxt/cbindings/backend/computational_backend.h" #include "computational_backend.h" +#include "sxt/cbindings/backend/computational_backend.h" + #include "sxt/cbindings/base/curve_id_utility.h" #include "sxt/multiexp/pippenger2/in_memory_partition_table_accessor.h" diff --git a/sxt/cbindings/backend/computational_backend.h b/sxt/cbindings/backend/computational_backend.h index 2cf2a4bf..e91c342f 100644 --- a/sxt/cbindings/backend/computational_backend.h +++ b/sxt/cbindings/backend/computational_backend.h @@ -108,7 +108,6 @@ class computational_backend { make_partition_table_accessor(cbnb::curve_id_t curve_id, const void* generators, unsigned n) const noexcept = 0; - virtual void fixed_multiexponentiation(void* res, cbnb::curve_id_t curve_id, const mtxpp2::partition_table_accessor_base& accessor, unsigned element_num_bytes, unsigned num_outputs,