Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/modules/recovery/main_impl.h
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | if (!overflow && !secp256k1_scalar_is_zero(&sec)) { | ||||
unsigned int count = 0; | unsigned int count = 0; | ||||
secp256k1_scalar_set_b32(&msg, msg32, NULL); | secp256k1_scalar_set_b32(&msg, msg32, NULL); | ||||
while (1) { | while (1) { | ||||
ret = noncefp(nonce32, msg32, seckey, secp256k1_ecdsa_recoverable_algo16, (void*)noncedata, count); | ret = noncefp(nonce32, msg32, seckey, secp256k1_ecdsa_recoverable_algo16, (void*)noncedata, count); | ||||
if (!ret) { | if (!ret) { | ||||
break; | break; | ||||
} | } | ||||
secp256k1_scalar_set_b32(&non, nonce32, &overflow); | secp256k1_scalar_set_b32(&non, nonce32, &overflow); | ||||
if (!secp256k1_scalar_is_zero(&non) && !overflow) { | if (!overflow && !secp256k1_scalar_is_zero(&non)) { | ||||
if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, &recid)) { | if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, &recid)) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
count++; | count++; | ||||
} | } | ||||
memset(nonce32, 0, 32); | memset(nonce32, 0, 32); | ||||
secp256k1_scalar_clear(&msg); | secp256k1_scalar_clear(&msg); | ||||
Show All 35 Lines |