| 45 | } |
| 46 | |
| 47 | static bool test_sign(const u5 *u5bytes, |
| 48 | const u8 *hrpu8, |
| 49 | secp256k1_ecdsa_recoverable_signature *rsig, |
| 50 | void *unused UNUSED) |
| 51 | { |
| 52 | struct hash_u5 hu5; |
| 53 | char *hrp; |
| 54 | struct sha256 sha; |
| 55 | struct privkey privkey; |
| 56 | |
| 57 | memset(&privkey, 'a', sizeof(privkey)); |
| 58 | |
| 59 | hrp = tal_dup_arr(NULL, char, (char *)hrpu8, tal_count(hrpu8), 1); |
| 60 | hrp[tal_count(hrpu8)] = '\0'; |
| 61 | |
| 62 | hash_u5_init(&hu5, hrp); |
| 63 | hash_u5(&hu5, u5bytes, tal_count(u5bytes)); |
| 64 | hash_u5_done(&hu5, &sha); |
| 65 | tal_free(hrp); |
| 66 | |
| 67 | if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, rsig, |
| 68 | (const u8 *)&sha, |
| 69 | privkey.secret.data, |
| 70 | NULL, NULL)) |
| 71 | abort(); |
| 72 | |
| 73 | return true; |
| 74 | } |
| 75 | |
| 76 | // We use a custom mutator to produce an input corpus that consists entirely of |
| 77 | // correctly encoded bech32 strings. This enables us to efficiently fuzz the |
nothing calls this directly
no test coverage detected