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

Function sign_hash

bitcoin/signature.c:104–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 8

handle_cannouncement_sigFunction · 0.85
sign_tx_inputFunction · 0.85
mainFunction · 0.85
print_updateFunction · 0.85
print_nannounceFunction · 0.85
mainFunction · 0.85

Calls 1

sig_has_low_rFunction · 0.85

Tested by 1

mainFunction · 0.68