Avoid exposing blst scalar

This commit is contained in:
Ramana Kumar 2022-10-01 12:42:44 +01:00
parent 9897fb2fa9
commit 8f6bc22b2f
No known key found for this signature in database
GPG Key ID: ED471C788B900433
3 changed files with 7 additions and 7 deletions

View File

@ -70,7 +70,6 @@
}
#endif
%array_class(scalar_t, scalars)
%array_class(uint8_t, bytes)
%array_class(BLSFieldElement, BLSFieldElements)
%pointer_class(PolynomialEvalForm, PolynomialEvalFormPtr)

View File

@ -753,7 +753,7 @@ static bool pairings_verify(const g1_t *a1, const g2_t *a2, const g1_t *b1, cons
}
void Bytes48_from_G1(uint8_t out[48], const g1_t *in) {
void bytes_from_G1(uint8_t out[48], const g1_t *in) {
blst_p1_compress(out, in);
}
@ -824,8 +824,10 @@ void compute_powers(fr_t out[], const fr_t *x, uint64_t n) {
while (++i < n) fr_mul(&out[i], &out[i-1], x);
}
void bytes_to_bls_field(BLSFieldElement *out, const scalar_t *bytes) {
blst_fr_from_scalar(out, bytes);
void bytes_to_bls_field(BLSFieldElement *out, const uint8_t bytes[32]) {
blst_scalar tmp;
blst_scalar_from_lendian(&tmp, bytes);
blst_fr_from_scalar(out, &tmp);
}
/**

View File

@ -32,7 +32,6 @@
typedef blst_p1 g1_t; /**< Internal G1 group element type */
typedef blst_p2 g2_t; /**< Internal G2 group element type */
typedef blst_fr fr_t; /**< Internal Fr field element type */
typedef blst_scalar scalar_t; /**< Internal scalar type */
typedef g1_t KZGCommitment;
typedef g1_t KZGProof;
@ -41,7 +40,7 @@ typedef fr_t BLSFieldElement;
/**
* KZGCommitment and KZGProof can be recovered as 48 bytes
*/
void Bytes48_from_G1(uint8_t out[48], const g1_t*);
void bytes_from_G1(uint8_t out[48], const g1_t*);
/**
* BLSFieldElements are communicated directly to/from clients,
@ -105,7 +104,7 @@ C_KZG_RET load_trusted_setup(KZGSettings *out, FILE *in);
void free_trusted_setup(KZGSettings *s);
void bytes_to_bls_field(BLSFieldElement *out, const scalar_t *bytes);
void bytes_to_bls_field(BLSFieldElement *out, const uint8_t bytes[32]);
void vector_lincomb(BLSFieldElement out[], const BLSFieldElement *vectors, const BLSFieldElement *scalars, uint64_t num_vectors, uint64_t vector_len);