Bugfix: swap arguments to noncefp
This commit is contained in:
parent
c98df263ed
commit
f79aa88373
|
@ -105,7 +105,7 @@ int secp256k1_ecdsa_sign_recoverable(const secp256k1_context* ctx, secp256k1_ecd
|
||||||
secp256k1_scalar_set_b32(&msg, msg32, NULL);
|
secp256k1_scalar_set_b32(&msg, msg32, NULL);
|
||||||
while (1) {
|
while (1) {
|
||||||
unsigned char nonce32[32];
|
unsigned char nonce32[32];
|
||||||
ret = noncefp(nonce32, seckey, msg32, NULL, (void*)noncedata, count);
|
ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ void test_ecdsa_recovery_end_to_end(void) {
|
||||||
/* Serialize/parse compact and verify/recover. */
|
/* Serialize/parse compact and verify/recover. */
|
||||||
extra[0] = 0;
|
extra[0] = 0;
|
||||||
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[0], message, privkey, NULL, NULL) == 1);
|
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[0], message, privkey, NULL, NULL) == 1);
|
||||||
|
CHECK(secp256k1_ecdsa_sign(ctx, &signature[0], message, privkey, NULL, NULL) == 1);
|
||||||
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[4], message, privkey, NULL, NULL) == 1);
|
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[4], message, privkey, NULL, NULL) == 1);
|
||||||
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[1], message, privkey, NULL, extra) == 1);
|
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[1], message, privkey, NULL, extra) == 1);
|
||||||
extra[31] = 1;
|
extra[31] = 1;
|
||||||
|
@ -43,6 +44,7 @@ void test_ecdsa_recovery_end_to_end(void) {
|
||||||
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[3], message, privkey, NULL, extra) == 1);
|
CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[3], message, privkey, NULL, extra) == 1);
|
||||||
CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1);
|
CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1);
|
||||||
CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1);
|
CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1);
|
||||||
|
CHECK(memcmp(&signature[4], &signature[0], 64) == 0);
|
||||||
CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1);
|
CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1);
|
||||||
memset(&rsignature[4], 0, sizeof(rsignature[4]));
|
memset(&rsignature[4], 0, sizeof(rsignature[4]));
|
||||||
CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1);
|
CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1);
|
||||||
|
|
Loading…
Reference in New Issue