mirror of
https://github.com/status-im/c-kzg-4844.git
synced 2025-02-19 21:38:06 +00:00
Statically allocate hash_output
This commit is contained in:
parent
ad31161515
commit
73d5d2fb0b
@ -1112,8 +1112,7 @@ static C_KZG_RET compute_challenges(BLSFieldElement *out, BLSFieldElement r_powe
|
|||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
bytes_from_g1(&bytes[np + i * 48], &comms[i]);
|
bytes_from_g1(&bytes[np + i * 48], &comms[i]);
|
||||||
|
|
||||||
uint8_t* hash_output = calloc(32, sizeof(uint8_t));
|
uint8_t hash_output[32] = {0};
|
||||||
if (hash_output == NULL) { free(bytes); return C_KZG_MALLOC; }
|
|
||||||
hash(hash_output, bytes, nb);
|
hash(hash_output, bytes, nb);
|
||||||
memcpy(bytes, hash_output, 32);
|
memcpy(bytes, hash_output, 32);
|
||||||
bytes[32] = 0x0;
|
bytes[32] = 0x0;
|
||||||
@ -1128,7 +1127,6 @@ static C_KZG_RET compute_challenges(BLSFieldElement *out, BLSFieldElement r_powe
|
|||||||
hash(hash_output, bytes, 33);
|
hash(hash_output, bytes, 33);
|
||||||
bytes_to_bls_field(out, hash_output);
|
bytes_to_bls_field(out, hash_output);
|
||||||
|
|
||||||
free(hash_output);
|
|
||||||
free(bytes);
|
free(bytes);
|
||||||
return C_KZG_OK;
|
return C_KZG_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user