modules: Port bitcoin-core/secp256k1#1579 to zkp-specific code
This commit is contained in:
1 parent
913be29ea2
commit
e3bddfa750
13 files changed
+34
-12
No files matched your search
@@ -153,6 +153,7 @@ static size_t secp256k1_surjectionproof_csprng_next(secp256k1_surjectionproof_cs
|
||||
secp256k1_sha256_initialize(&sha);
|
||||
secp256k1_sha256_write(&sha, csprng->state, 32);
|
||||
secp256k1_sha256_finalize(&sha, csprng->state);
|
||||
secp256k1_sha256_clear(&sha);
|
||||
csprng->state_i = 0;
|
||||
}
|
||||
val = csprng->state[csprng->state_i];
|
||||
|
||||
@@ -32,6 +32,7 @@ SECP256K1_INLINE static void secp256k1_surjection_genmessage(unsigned char *msg3
|
||||
memcpy(&pk_ser[1], &ephemeral_output_tag->data[0], 32);
|
||||
secp256k1_sha256_write(&sha256_en, pk_ser, pk_len);
|
||||
secp256k1_sha256_finalize(&sha256_en, msg32);
|
||||
secp256k1_sha256_clear(&sha256_en);
|
||||
}
|
||||
|
||||
SECP256K1_INLINE static int secp256k1_surjection_genrand(secp256k1_scalar *s, size_t ns, const secp256k1_scalar *blinding_key) {
|
||||
@@ -51,13 +52,14 @@ SECP256K1_INLINE static int secp256k1_surjection_genrand(secp256k1_scalar *s, si
|
||||
secp256k1_sha256_initialize(&sha256_en);
|
||||
secp256k1_sha256_write(&sha256_en, sec_input, 36);
|
||||
secp256k1_sha256_finalize(&sha256_en, sec_input);
|
||||
secp256k1_sha256_clear(&sha256_en);
|
||||
secp256k1_scalar_set_b32(&s[i], sec_input, &overflow);
|
||||
if (overflow == 1) {
|
||||
memset(sec_input, 0, 32);
|
||||
secp256k1_memclear(sec_input, 32);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
memset(sec_input, 0, 32);
|
||||
secp256k1_memclear(sec_input, 32);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user