Run astyle on C files

This commit is contained in:
Justin Traglia 2023-01-05 17:31:40 -06:00
parent 13f2a79345
commit c6f2c1b745
2 changed files with 382 additions and 345 deletions

View File

@ -290,26 +290,52 @@ out:
static const g1_t g1_identity = {{0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}}; static const g1_t g1_identity = {{0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}};
/** The G1 generator */ /** The G1 generator */
static const g1_t g1_generator = {{0x5cb38790fd530c16L, 0x7817fc679976fff5L, 0x154f95c7143ba1c1L, 0xf0ae6acdf3d0e747L, static const g1_t g1_generator = {{
0xedce6ecc21dbf440L, 0x120177419e0bfb75L}, 0x5cb38790fd530c16L, 0x7817fc679976fff5L, 0x154f95c7143ba1c1L, 0xf0ae6acdf3d0e747L,
{0xbaac93d50ce72271L, 0x8c22631a7918fd8eL, 0xdd595f13570725ceL, 0x51ac582950405194L, 0xedce6ecc21dbf440L, 0x120177419e0bfb75L
0x0e1c8c3fad0059c0L, 0x0bbc3efc5008a26aL}, },
{0x760900000002fffdL, 0xebf4000bc40c0002L, 0x5f48985753c758baL, 0x77ce585370525745L, {
0x5c071a97a256ec6dL, 0x15f65ec3fa80e493L}}; 0xbaac93d50ce72271L, 0x8c22631a7918fd8eL, 0xdd595f13570725ceL, 0x51ac582950405194L,
0x0e1c8c3fad0059c0L, 0x0bbc3efc5008a26aL
},
{
0x760900000002fffdL, 0xebf4000bc40c0002L, 0x5f48985753c758baL, 0x77ce585370525745L,
0x5c071a97a256ec6dL, 0x15f65ec3fa80e493L
}
};
/** The G2 generator */ /** The G2 generator */
static const g2_t g2_generator = {{{{0xf5f28fa202940a10L, 0xb3f5fb2687b4961aL, 0xa1a893b53e2ae580L, 0x9894999d1a3caee9L, static const g2_t g2_generator = {{{{
0x6f67b7631863366bL, 0x058191924350bcd7L}, 0xf5f28fa202940a10L, 0xb3f5fb2687b4961aL, 0xa1a893b53e2ae580L, 0x9894999d1a3caee9L,
{0xa5a9c0759e23f606L, 0xaaa0c59dbccd60c3L, 0x3bb17e18e2867806L, 0x1b1ab6cc8541b367L, 0x6f67b7631863366bL, 0x058191924350bcd7L
0xc2b6ed0ef2158547L, 0x11922a097360edf3L}}}, },
{{{0x4c730af860494c4aL, 0x597cfa1f5e369c5aL, 0xe7e6856caa0a635aL, 0xbbefb5e96e0d495fL, {
0x07d3a975f0ef25a2L, 0x0083fd8e7e80dae5L}, 0xa5a9c0759e23f606L, 0xaaa0c59dbccd60c3L, 0x3bb17e18e2867806L, 0x1b1ab6cc8541b367L,
{0xadc0fc92df64b05dL, 0x18aa270a2b1461dcL, 0x86adac6a3be4eba0L, 0x79495c4ec93da33aL, 0xc2b6ed0ef2158547L, 0x11922a097360edf3L
0xe7175850a43ccaedL, 0x0b2bc2a163de1bf2L}}}, }
{{{0x760900000002fffdL, 0xebf4000bc40c0002L, 0x5f48985753c758baL, 0x77ce585370525745L, }
0x5c071a97a256ec6dL, 0x15f65ec3fa80e493L}, },
{0x0000000000000000L, 0x0000000000000000L, 0x0000000000000000L, 0x0000000000000000L, { { {
0x0000000000000000L, 0x0000000000000000L}}}}; 0x4c730af860494c4aL, 0x597cfa1f5e369c5aL, 0xe7e6856caa0a635aL, 0xbbefb5e96e0d495fL,
0x07d3a975f0ef25a2L, 0x0083fd8e7e80dae5L
},
{
0xadc0fc92df64b05dL, 0x18aa270a2b1461dcL, 0x86adac6a3be4eba0L, 0x79495c4ec93da33aL,
0xe7175850a43ccaedL, 0x0b2bc2a163de1bf2L
}
}
},
{ { {
0x760900000002fffdL, 0xebf4000bc40c0002L, 0x5f48985753c758baL, 0x77ce585370525745L,
0x5c071a97a256ec6dL, 0x15f65ec3fa80e493L
},
{
0x0000000000000000L, 0x0000000000000000L, 0x0000000000000000L, 0x0000000000000000L,
0x0000000000000000L, 0x0000000000000000L
}
}
}
};
/** /**
@ -457,7 +483,8 @@ static const uint64_t scale2_root_of_unity[][4] = {
{0xd7b688830a4f2089L, 0x6558e9e3f6ac7b41L, 0x99e276b571905a7dL, 0x52dd465e2f094256L}, {0xd7b688830a4f2089L, 0x6558e9e3f6ac7b41L, 0x99e276b571905a7dL, 0x52dd465e2f094256L},
{0x474650359d8e211bL, 0x84d37b826214abc6L, 0x8da40c1ef2bb4598L, 0x0c83ea7744bf1beeL}, {0x474650359d8e211bL, 0x84d37b826214abc6L, 0x8da40c1ef2bb4598L, 0x0c83ea7744bf1beeL},
{0x694341f608c9dd56L, 0xed3a181fabb30adcL, 0x1339a815da8b398fL, 0x2c6d4e4511657e1eL}, {0x694341f608c9dd56L, 0xed3a181fabb30adcL, 0x1339a815da8b398fL, 0x2c6d4e4511657e1eL},
{0x63e7cb4906ffc93fL, 0xf070bb00e28a193dL, 0xad1715b02e5713b5L, 0x4b5371495990693fL}}; {0x63e7cb4906ffc93fL, 0xf070bb00e28a193dL, 0xad1715b02e5713b5L, 0x4b5371495990693fL}
};
/** /**
@ -933,9 +960,16 @@ static C_KZG_RET g1_lincomb(g1_t *out, const g1_t *p, const fr_t *coeffs, const
void *scratch = malloc(blst_p1s_mult_pippenger_scratch_sizeof(len)); void *scratch = malloc(blst_p1s_mult_pippenger_scratch_sizeof(len));
if (scratch == NULL) return C_KZG_MALLOC; if (scratch == NULL) return C_KZG_MALLOC;
blst_p1_affine *p_affine = malloc(len * sizeof(blst_p1_affine)); blst_p1_affine *p_affine = malloc(len * sizeof(blst_p1_affine));
if (p_affine == NULL) { free(scratch); return C_KZG_MALLOC; } if (p_affine == NULL) {
free(scratch);
return C_KZG_MALLOC;
}
blst_scalar *scalars = malloc(len * sizeof(blst_scalar)); blst_scalar *scalars = malloc(len * sizeof(blst_scalar));
if (scalars == NULL) { free(scratch); free(p_affine); return C_KZG_MALLOC; } if (scalars == NULL) {
free(scratch);
free(p_affine);
return C_KZG_MALLOC;
}
// Transform the points to affine representation // Transform the points to affine representation
const blst_p1 *p_arg[2] = {p, NULL}; const blst_p1 *p_arg[2] = {p, NULL};
@ -1014,8 +1048,10 @@ C_KZG_RET verify_kzg_proof(bool *out,
const KZGSettings *s) { const KZGSettings *s) {
BLSFieldElement frz, fry; BLSFieldElement frz, fry;
C_KZG_RET ret; C_KZG_RET ret;
ret = bytes_to_bls_field(&frz, z); if (ret != C_KZG_OK) return ret; ret = bytes_to_bls_field(&frz, z);
ret = bytes_to_bls_field(&fry, y); if (ret != C_KZG_OK) return ret; if (ret != C_KZG_OK) return ret;
ret = bytes_to_bls_field(&fry, y);
if (ret != C_KZG_OK) return ret;
return verify_kzg_proof_impl(out, commitment, &frz, &fry, kzg_proof, s); return verify_kzg_proof_impl(out, commitment, &frz, &fry, kzg_proof, s);
} }
@ -1162,7 +1198,8 @@ static void bytes_of_uint64(uint8_t out[8], uint64_t n) {
static C_KZG_RET compute_challenges(BLSFieldElement *out, BLSFieldElement r_powers[], static C_KZG_RET compute_challenges(BLSFieldElement *out, BLSFieldElement r_powers[],
const Polynomial polys[], const KZGCommitment comms[], uint64_t n) { const Polynomial polys[], const KZGCommitment comms[], uint64_t n) {
size_t i; uint64_t j; size_t i;
uint64_t j;
const size_t ni = 32; // len(FIAT_SHAMIR_PROTOCOL_DOMAIN) + 8 + 8 const size_t ni = 32; // len(FIAT_SHAMIR_PROTOCOL_DOMAIN) + 8 + 8
const size_t np = ni + n * BYTES_PER_BLOB; const size_t np = ni + n * BYTES_PER_BLOB;
const size_t nb = np + n * 48; const size_t nb = np + n * 48;