Short circuit batch verification if n==1 (#234)

This commit is contained in:
George Kadianakis 2023-03-23 14:50:36 +02:00 committed by GitHub
parent 861371629e
commit 015e043475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1493,6 +1493,13 @@ C_KZG_RET verify_blob_kzg_proof_batch(
return C_KZG_OK;
}
/* For a single blob, just do a regular single verification */
if (n == 1) {
return verify_blob_kzg_proof(
ok, &blobs[0], &commitments_bytes[0], &proofs_bytes[0], s
);
}
/* We will need a bunch of arrays to store our objects... */
ret = new_g1_array(&commitments_g1, n);
if (ret != C_KZG_OK) goto out;