Make verify_*() functions pessimistic by default (#184)
This commit is contained in:
parent
db2fa8dcdb
commit
02b7855eb7
|
@ -932,7 +932,7 @@ static C_KZG_RET verify_kzg_proof_impl(
|
|||
/**
|
||||
* Verify a KZG proof claiming that `p(z) == y`.
|
||||
*
|
||||
* @param[out] out `true` if the proof is valid, `false` if not
|
||||
* @param[out] ok `true` if the proof is valid, `false` if not
|
||||
* @param[in] commitment The KZG commitment corresponding to polynomial
|
||||
* p(x)
|
||||
* @param[in] z The evaluation point
|
||||
|
@ -942,7 +942,7 @@ static C_KZG_RET verify_kzg_proof_impl(
|
|||
* verification key (i.e. trusted setup)
|
||||
*/
|
||||
C_KZG_RET verify_kzg_proof(
|
||||
bool *out,
|
||||
bool *ok,
|
||||
const Bytes48 *commitment_bytes,
|
||||
const Bytes32 *z_bytes,
|
||||
const Bytes32 *y_bytes,
|
||||
|
@ -953,6 +953,8 @@ C_KZG_RET verify_kzg_proof(
|
|||
fr_t z_fr, y_fr;
|
||||
g1_t commitment_g1, proof_g1;
|
||||
|
||||
*ok = false;
|
||||
|
||||
ret = bytes_to_kzg_commitment(&commitment_g1, commitment_bytes);
|
||||
if (ret != C_KZG_OK) return ret;
|
||||
ret = bytes_to_bls_field(&z_fr, z_bytes);
|
||||
|
@ -963,7 +965,7 @@ C_KZG_RET verify_kzg_proof(
|
|||
if (ret != C_KZG_OK) return ret;
|
||||
|
||||
return verify_kzg_proof_impl(
|
||||
out, &commitment_g1, &z_fr, &y_fr, &proof_g1, s
|
||||
ok, &commitment_g1, &z_fr, &y_fr, &proof_g1, s
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1202,6 +1204,8 @@ C_KZG_RET verify_blob_kzg_proof(
|
|||
fr_t evaluation_challenge_fr, y_fr;
|
||||
g1_t commitment_g1, proof_g1;
|
||||
|
||||
*ok = false;
|
||||
|
||||
ret = bytes_to_kzg_commitment(&commitment_g1, commitment_bytes);
|
||||
if (ret != C_KZG_OK) return ret;
|
||||
|
||||
|
@ -1334,6 +1338,8 @@ static C_KZG_RET verify_kzg_proof_batch(
|
|||
|
||||
assert(n > 0);
|
||||
|
||||
*ok = false;
|
||||
|
||||
/* First let's allocate our arrays */
|
||||
ret = new_fr_array(&r_powers, n);
|
||||
if (ret != C_KZG_OK) goto out;
|
||||
|
|
Loading…
Reference in New Issue