Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel committed Aug 29, 2024
1 parent a16c86b commit 6f082d8
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 127 deletions.
62 changes: 47 additions & 15 deletions icicle/include/icicle/api/babybear.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,37 @@ extern "C" void babybear_generate_scalars(babybear::scalar_t* scalars, int size)
extern "C" void babybear_scalar_convert_montgomery(
const babybear::scalar_t* input, uint64_t size, bool is_into, const VecOpsConfig& config, babybear::scalar_t* output);

extern "C" eIcicleError babybear_ntt_init_domain(
babybear::scalar_t* primitive_root, const NTTInitDomainConfig& config);
extern "C" eIcicleError babybear_ntt_init_domain(babybear::scalar_t* primitive_root, const NTTInitDomainConfig& config);

extern "C" eIcicleError babybear_ntt(
const babybear::scalar_t* input, int size, NTTDir dir, const NTTConfig<babybear::scalar_t>& config, babybear::scalar_t* output);
const babybear::scalar_t* input,
int size,
NTTDir dir,
const NTTConfig<babybear::scalar_t>& config,
babybear::scalar_t* output);

extern "C" eIcicleError babybear_ntt_release_domain();

extern "C" eIcicleError babybear_extension_vector_mul(
const babybear::extension_t* vec_a, const babybear::extension_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::extension_t* result);
const babybear::extension_t* vec_a,
const babybear::extension_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::extension_t* result);

extern "C" eIcicleError babybear_extension_vector_add(
const babybear::extension_t* vec_a, const babybear::extension_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::extension_t* result);
const babybear::extension_t* vec_a,
const babybear::extension_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::extension_t* result);

extern "C" eIcicleError babybear_extension_vector_sub(
const babybear::extension_t* vec_a, const babybear::extension_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::extension_t* result);
const babybear::extension_t* vec_a,
const babybear::extension_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::extension_t* result);

extern "C" eIcicleError babybear_extension_matrix_transpose(
const babybear::extension_t* input,
Expand All @@ -41,20 +56,35 @@ extern "C" eIcicleError babybear_extension_matrix_transpose(
extern "C" eIcicleError babybear_extension_bit_reverse(
const babybear::extension_t* input, uint64_t n, const VecOpsConfig& config, babybear::extension_t* output);


extern "C" void babybear_extension_generate_scalars(babybear::extension_t* scalars, int size);

extern "C" eIcicleError babybear_extension_scalar_convert_montgomery(
const babybear::extension_t* input, uint64_t size, bool is_into, const VecOpsConfig& config, babybear::extension_t* output);
extern "C" eIcicleError babybear_extension_scalar_convert_montgomery(
const babybear::extension_t* input,
uint64_t size,
bool is_into,
const VecOpsConfig& config,
babybear::extension_t* output);

extern "C" eIcicleError babybear_vector_mul(
const babybear::scalar_t* vec_a, const babybear::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::scalar_t* result);
const babybear::scalar_t* vec_a,
const babybear::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::scalar_t* result);

extern "C" eIcicleError babybear_vector_add(
const babybear::scalar_t* vec_a, const babybear::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::scalar_t* result);
const babybear::scalar_t* vec_a,
const babybear::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::scalar_t* result);

extern "C" eIcicleError babybear_vector_sub(
const babybear::scalar_t* vec_a, const babybear::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, babybear::scalar_t* result);
const babybear::scalar_t* vec_a,
const babybear::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
babybear::scalar_t* result);

extern "C" eIcicleError babybear_matrix_transpose(
const babybear::scalar_t* input,
Expand All @@ -66,7 +96,9 @@ extern "C" eIcicleError babybear_matrix_transpose(
extern "C" eIcicleError babybear_bit_reverse(
const babybear::scalar_t* input, uint64_t n, const VecOpsConfig& config, babybear::scalar_t* output);


extern "C" eIcicleError babybear_extension_ntt(
const babybear::extension_t* input, int size, NTTDir dir, const NTTConfig<babybear::scalar_t>& config, babybear::extension_t* output);

const babybear::extension_t* input,
int size,
NTTDir dir,
const NTTConfig<babybear::scalar_t>& config,
babybear::extension_t* output);
82 changes: 59 additions & 23 deletions icicle/include/icicle/api/bls12_377.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@
#include "icicle/vec_ops.h"

extern "C" eIcicleError bls12_377_precompute_msm_bases(
const bls12_377::affine_t* bases,
int nof_bases,
const MSMConfig& config,
bls12_377::affine_t* output_bases);
const bls12_377::affine_t* bases, int nof_bases, const MSMConfig& config, bls12_377::affine_t* output_bases);

extern "C" eIcicleError bls12_377_msm(
const bls12_377::scalar_t* scalars, const bls12_377::affine_t* points, int msm_size, const MSMConfig& config, bls12_377::projective_t* out);
const bls12_377::scalar_t* scalars,
const bls12_377::affine_t* points,
int msm_size,
const MSMConfig& config,
bls12_377::projective_t* out);

extern "C" eIcicleError bls12_377_g2_precompute_msm_bases(
const bls12_377::g2_affine_t* bases,
int nof_bases,
const MSMConfig& config,
bls12_377::g2_affine_t* output_bases);
const bls12_377::g2_affine_t* bases, int nof_bases, const MSMConfig& config, bls12_377::g2_affine_t* output_bases);

extern "C" eIcicleError bls12_377_g2_msm(
const bls12_377::scalar_t* scalars, const bls12_377::g2_affine_t* points, int msm_size, const MSMConfig& config, bls12_377::g2_projective_t* out);
const bls12_377::scalar_t* scalars,
const bls12_377::g2_affine_t* points,
int msm_size,
const MSMConfig& config,
bls12_377::g2_projective_t* out);

extern "C" bool bls12_377_eq(bls12_377::projective_t* point1, bls12_377::projective_t* point2);

Expand All @@ -40,7 +42,11 @@ extern "C" eIcicleError bls12_377_affine_convert_montgomery(
const bls12_377::affine_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_377::affine_t* output);

extern "C" eIcicleError bls12_377_projective_convert_montgomery(
const bls12_377::projective_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_377::projective_t* output);
const bls12_377::projective_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_377::projective_t* output);

extern "C" bool bls12_377_g2_eq(bls12_377::g2_projective_t* point1, bls12_377::g2_projective_t* point2);

Expand All @@ -51,35 +57,67 @@ extern "C" void bls12_377_g2_generate_projective_points(bls12_377::g2_projective
extern "C" void bls12_377_g2_generate_affine_points(bls12_377::g2_affine_t* points, int size);

extern "C" eIcicleError bls12_377_g2_affine_convert_montgomery(
const bls12_377::g2_affine_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_377::g2_affine_t* output);
const bls12_377::g2_affine_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_377::g2_affine_t* output);

extern "C" eIcicleError bls12_377_g2_projective_convert_montgomery(
const bls12_377::g2_projective_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_377::g2_projective_t* output);
const bls12_377::g2_projective_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_377::g2_projective_t* output);

extern "C" eIcicleError bls12_377_ecntt(
const bls12_377::projective_t* input, int size, NTTDir dir, const NTTConfig<bls12_377::scalar_t>& config, bls12_377::projective_t* output);
const bls12_377::projective_t* input,
int size,
NTTDir dir,
const NTTConfig<bls12_377::scalar_t>& config,
bls12_377::projective_t* output);

extern "C" void bls12_377_generate_scalars(bls12_377::scalar_t* scalars, int size);

extern "C" void bls12_377_scalar_convert_montgomery(
const bls12_377::scalar_t* input, uint64_t size, bool is_into, const VecOpsConfig& config, bls12_377::scalar_t* output);
const bls12_377::scalar_t* input,
uint64_t size,
bool is_into,
const VecOpsConfig& config,
bls12_377::scalar_t* output);

extern "C" eIcicleError bls12_377_ntt_init_domain(
bls12_377::scalar_t* primitive_root, const NTTInitDomainConfig& config);
extern "C" eIcicleError
bls12_377_ntt_init_domain(bls12_377::scalar_t* primitive_root, const NTTInitDomainConfig& config);

extern "C" eIcicleError bls12_377_ntt(
const bls12_377::scalar_t* input, int size, NTTDir dir, const NTTConfig<bls12_377::scalar_t>& config, bls12_377::scalar_t* output);
const bls12_377::scalar_t* input,
int size,
NTTDir dir,
const NTTConfig<bls12_377::scalar_t>& config,
bls12_377::scalar_t* output);

extern "C" eIcicleError bls12_377_ntt_release_domain();

extern "C" eIcicleError bls12_377_vector_mul(
const bls12_377::scalar_t* vec_a, const bls12_377::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_377::scalar_t* result);
const bls12_377::scalar_t* vec_a,
const bls12_377::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_377::scalar_t* result);

extern "C" eIcicleError bls12_377_vector_add(
const bls12_377::scalar_t* vec_a, const bls12_377::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_377::scalar_t* result);
const bls12_377::scalar_t* vec_a,
const bls12_377::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_377::scalar_t* result);

extern "C" eIcicleError bls12_377_vector_sub(
const bls12_377::scalar_t* vec_a, const bls12_377::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_377::scalar_t* result);
const bls12_377::scalar_t* vec_a,
const bls12_377::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_377::scalar_t* result);

extern "C" eIcicleError bls12_377_matrix_transpose(
const bls12_377::scalar_t* input,
Expand All @@ -90,5 +128,3 @@ extern "C" eIcicleError bls12_377_matrix_transpose(

extern "C" eIcicleError bls12_377_bit_reverse(
const bls12_377::scalar_t* input, uint64_t n, const VecOpsConfig& config, bls12_377::scalar_t* output);


82 changes: 59 additions & 23 deletions icicle/include/icicle/api/bls12_381.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@
#include "icicle/vec_ops.h"

extern "C" eIcicleError bls12_381_precompute_msm_bases(
const bls12_381::affine_t* bases,
int nof_bases,
const MSMConfig& config,
bls12_381::affine_t* output_bases);
const bls12_381::affine_t* bases, int nof_bases, const MSMConfig& config, bls12_381::affine_t* output_bases);

extern "C" eIcicleError bls12_381_msm(
const bls12_381::scalar_t* scalars, const bls12_381::affine_t* points, int msm_size, const MSMConfig& config, bls12_381::projective_t* out);
const bls12_381::scalar_t* scalars,
const bls12_381::affine_t* points,
int msm_size,
const MSMConfig& config,
bls12_381::projective_t* out);

extern "C" eIcicleError bls12_381_g2_precompute_msm_bases(
const bls12_381::g2_affine_t* bases,
int nof_bases,
const MSMConfig& config,
bls12_381::g2_affine_t* output_bases);
const bls12_381::g2_affine_t* bases, int nof_bases, const MSMConfig& config, bls12_381::g2_affine_t* output_bases);

extern "C" eIcicleError bls12_381_g2_msm(
const bls12_381::scalar_t* scalars, const bls12_381::g2_affine_t* points, int msm_size, const MSMConfig& config, bls12_381::g2_projective_t* out);
const bls12_381::scalar_t* scalars,
const bls12_381::g2_affine_t* points,
int msm_size,
const MSMConfig& config,
bls12_381::g2_projective_t* out);

extern "C" bool bls12_381_eq(bls12_381::projective_t* point1, bls12_381::projective_t* point2);

Expand All @@ -40,7 +42,11 @@ extern "C" eIcicleError bls12_381_affine_convert_montgomery(
const bls12_381::affine_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_381::affine_t* output);

extern "C" eIcicleError bls12_381_projective_convert_montgomery(
const bls12_381::projective_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_381::projective_t* output);
const bls12_381::projective_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_381::projective_t* output);

extern "C" bool bls12_381_g2_eq(bls12_381::g2_projective_t* point1, bls12_381::g2_projective_t* point2);

Expand All @@ -51,35 +57,67 @@ extern "C" void bls12_381_g2_generate_projective_points(bls12_381::g2_projective
extern "C" void bls12_381_g2_generate_affine_points(bls12_381::g2_affine_t* points, int size);

extern "C" eIcicleError bls12_381_g2_affine_convert_montgomery(
const bls12_381::g2_affine_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_381::g2_affine_t* output);
const bls12_381::g2_affine_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_381::g2_affine_t* output);

extern "C" eIcicleError bls12_381_g2_projective_convert_montgomery(
const bls12_381::g2_projective_t* input, size_t n, bool is_into, const VecOpsConfig& config, bls12_381::g2_projective_t* output);
const bls12_381::g2_projective_t* input,
size_t n,
bool is_into,
const VecOpsConfig& config,
bls12_381::g2_projective_t* output);

extern "C" eIcicleError bls12_381_ecntt(
const bls12_381::projective_t* input, int size, NTTDir dir, const NTTConfig<bls12_381::scalar_t>& config, bls12_381::projective_t* output);
const bls12_381::projective_t* input,
int size,
NTTDir dir,
const NTTConfig<bls12_381::scalar_t>& config,
bls12_381::projective_t* output);

extern "C" void bls12_381_generate_scalars(bls12_381::scalar_t* scalars, int size);

extern "C" void bls12_381_scalar_convert_montgomery(
const bls12_381::scalar_t* input, uint64_t size, bool is_into, const VecOpsConfig& config, bls12_381::scalar_t* output);
const bls12_381::scalar_t* input,
uint64_t size,
bool is_into,
const VecOpsConfig& config,
bls12_381::scalar_t* output);

extern "C" eIcicleError bls12_381_ntt_init_domain(
bls12_381::scalar_t* primitive_root, const NTTInitDomainConfig& config);
extern "C" eIcicleError
bls12_381_ntt_init_domain(bls12_381::scalar_t* primitive_root, const NTTInitDomainConfig& config);

extern "C" eIcicleError bls12_381_ntt(
const bls12_381::scalar_t* input, int size, NTTDir dir, const NTTConfig<bls12_381::scalar_t>& config, bls12_381::scalar_t* output);
const bls12_381::scalar_t* input,
int size,
NTTDir dir,
const NTTConfig<bls12_381::scalar_t>& config,
bls12_381::scalar_t* output);

extern "C" eIcicleError bls12_381_ntt_release_domain();

extern "C" eIcicleError bls12_381_vector_mul(
const bls12_381::scalar_t* vec_a, const bls12_381::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_381::scalar_t* result);
const bls12_381::scalar_t* vec_a,
const bls12_381::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_381::scalar_t* result);

extern "C" eIcicleError bls12_381_vector_add(
const bls12_381::scalar_t* vec_a, const bls12_381::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_381::scalar_t* result);
const bls12_381::scalar_t* vec_a,
const bls12_381::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_381::scalar_t* result);

extern "C" eIcicleError bls12_381_vector_sub(
const bls12_381::scalar_t* vec_a, const bls12_381::scalar_t* vec_b, uint64_t n, const VecOpsConfig& config, bls12_381::scalar_t* result);
const bls12_381::scalar_t* vec_a,
const bls12_381::scalar_t* vec_b,
uint64_t n,
const VecOpsConfig& config,
bls12_381::scalar_t* result);

extern "C" eIcicleError bls12_381_matrix_transpose(
const bls12_381::scalar_t* input,
Expand All @@ -90,5 +128,3 @@ extern "C" eIcicleError bls12_381_matrix_transpose(

extern "C" eIcicleError bls12_381_bit_reverse(
const bls12_381::scalar_t* input, uint64_t n, const VecOpsConfig& config, bls12_381::scalar_t* output);


Loading

0 comments on commit 6f082d8

Please sign in to comment.