MCPcopy Create free account
hub / github.com/ElementsProject/lightning / sign_hash

Function sign_hash

bitcoin/signature.c:97–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95bool dev_no_signature_grind = false;
96
97void sign_hash(const struct privkey *privkey,
98 const struct sha256_double *h,
99 secp256k1_ecdsa_signature *s)
100{
101 bool ok;
102 unsigned char extra_entropy[32] = {0};
103
104 /* Grind for low R */
105 do {
106 ok = secp256k1_ecdsa_sign(secp256k1_ctx,
107 s,
108 h->sha.u.u8,
109 privkey->secret.data, NULL,
110 dev_no_signature_grind ? NULL
111 : extra_entropy);
112 ((u32 *)extra_entropy)[0]++;
113 if (dev_no_signature_grind)
114 break;
115 } while (!sig_has_low_r(s));
116
117 assert(ok);
118}
119
120void bitcoin_tx_hash_for_sig(const struct bitcoin_tx *tx, unsigned int in,
121 const u8 *script,

Callers 9

sign_tx_inputFunction · 0.85
mainFunction · 0.85
test_sync_readFunction · 0.85
print_updateFunction · 0.85
print_nannounceFunction · 0.85
mainFunction · 0.85

Calls 1

sig_has_low_rFunction · 0.85

Tested by 2

mainFunction · 0.68
test_sync_readFunction · 0.68