| 77 | } |
| 78 | |
| 79 | static bool sign_b11(const u5 *u5bytes, |
| 80 | const u8 *hrpu8, |
| 81 | secp256k1_ecdsa_recoverable_signature *rsig, |
| 82 | struct privkey *privkey) |
| 83 | { |
| 84 | struct hash_u5 hu5; |
| 85 | char *hrp; |
| 86 | struct sha256 sha; |
| 87 | |
| 88 | hrp = tal_dup_arr(NULL, char, (char *)hrpu8, tal_count(hrpu8), 1); |
| 89 | hrp[tal_count(hrpu8)] = '\0'; |
| 90 | |
| 91 | hash_u5_init(&hu5, hrp); |
| 92 | hash_u5(&hu5, u5bytes, tal_count(u5bytes)); |
| 93 | hash_u5_done(&hu5, &sha); |
| 94 | tal_free(hrp); |
| 95 | |
| 96 | if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, rsig, |
| 97 | (const u8 *)&sha, |
| 98 | privkey->secret.data, |
| 99 | NULL, NULL)) |
| 100 | abort(); |
| 101 | |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | static void encode(const tal_t *ctx, |
| 106 | struct privkey *privkey, |
nothing calls this directly
no test coverage detected