ecdsa_adaptor: Simplify code
This commit is contained in:
@@ -26,26 +26,23 @@ static const unsigned char dleq_algo[] = {'D','L','E','Q'};
|
|||||||
|
|
||||||
static void secp256k1_dleq_hash_point(secp256k1_sha256 *sha, secp256k1_ge *p) {
|
static void secp256k1_dleq_hash_point(secp256k1_sha256 *sha, secp256k1_ge *p) {
|
||||||
unsigned char buf[33];
|
unsigned char buf[33];
|
||||||
size_t size = 33;
|
|
||||||
|
|
||||||
secp256k1_eckey_pubkey_serialize33(p, buf);
|
secp256k1_eckey_pubkey_serialize33(p, buf);
|
||||||
|
secp256k1_sha256_write(sha, buf, 33);
|
||||||
secp256k1_sha256_write(sha, buf, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int secp256k1_dleq_nonce(secp256k1_scalar *k, const unsigned char *sk32, const unsigned char *gen2_33, const unsigned char *p1_33, const unsigned char *p2_33, secp256k1_nonce_function_hardened_ecdsa_adaptor noncefp, void *ndata) {
|
static int secp256k1_dleq_nonce(secp256k1_scalar *k, const unsigned char *sk32, const unsigned char *gen2_33, const unsigned char *p1_33, const unsigned char *p2_33, secp256k1_nonce_function_hardened_ecdsa_adaptor noncefp, void *ndata) {
|
||||||
secp256k1_sha256 sha;
|
secp256k1_sha256 sha;
|
||||||
unsigned char buf[32];
|
unsigned char buf[32];
|
||||||
unsigned char nonce[32];
|
unsigned char nonce[32];
|
||||||
size_t size = 33;
|
|
||||||
|
|
||||||
if (noncefp == NULL) {
|
if (noncefp == NULL) {
|
||||||
noncefp = secp256k1_nonce_function_ecdsa_adaptor;
|
noncefp = secp256k1_nonce_function_ecdsa_adaptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
secp256k1_sha256_initialize(&sha);
|
secp256k1_sha256_initialize(&sha);
|
||||||
secp256k1_sha256_write(&sha, p1_33, size);
|
secp256k1_sha256_write(&sha, p1_33, 33);
|
||||||
secp256k1_sha256_write(&sha, p2_33, size);
|
secp256k1_sha256_write(&sha, p2_33, 33);
|
||||||
secp256k1_sha256_finalize(&sha, buf);
|
secp256k1_sha256_finalize(&sha, buf);
|
||||||
secp256k1_sha256_clear(&sha);
|
secp256k1_sha256_clear(&sha);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user