From afba7d6ba8907f765110d4aedc8e40806df898f5 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Fri, 17 May 2024 18:07:04 +0200 Subject: [PATCH] [example] use `sysrand` to fill secureRandomBytes array --- examples-c/ethereum_bls_signatures.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples-c/ethereum_bls_signatures.c b/examples-c/ethereum_bls_signatures.c index c50f46d3..c55800ad 100644 --- a/examples-c/ethereum_bls_signatures.c +++ b/examples-c/ethereum_bls_signatures.c @@ -64,7 +64,14 @@ int main(){ { message, 32 } }; const ctt_eth_bls_signature sigs[3] = { sig, sig, sig }; - byte srb[32] = {0}; // just a bunch of zeros as random "secure" bytes. + + // Use constantine's `sysrand` to fill the secure random bytes + byte srb[32]; + if(!ctt_csprng_sysrand(srb, 32)){ + printf("Failed to fill `srb` using `sysrand`\n"); + exit(1); + } + bls_status = ctt_eth_bls_batch_verify(pkeys, messages, sigs, 3, srb); if (bls_status != cttEthBls_Success) { printf("Batch verification failure: status %d - %s\n", bls_status, ctt_eth_bls_status_to_string(bls_status));