| 95 | bool dev_no_signature_grind = false; |
| 96 | |
| 97 | void 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 | |
| 120 | void bitcoin_tx_hash_for_sig(const struct bitcoin_tx *tx, unsigned int in, |
| 121 | const u8 *script, |