| 180 | } |
| 181 | |
| 182 | bool check_signed_hash(const struct sha256_double *hash, |
| 183 | const secp256k1_ecdsa_signature *signature, |
| 184 | const struct pubkey *key) |
| 185 | { |
| 186 | int ret; |
| 187 | |
| 188 | /* BOLT #2: |
| 189 | * |
| 190 | * - if `signature` is incorrect OR non-compliant with |
| 191 | * LOW-S-standard rule |
| 192 | */ |
| 193 | /* From the secp256k1_ecdsa_verify documentation: "To avoid |
| 194 | * accepting malleable signatures, only ECDSA signatures in |
| 195 | * lower-S form are accepted." */ |
| 196 | ret = secp256k1_ecdsa_verify(secp256k1_ctx, |
| 197 | signature, |
| 198 | hash->sha.u.u8, &key->pubkey); |
| 199 | return ret == 1; |
| 200 | } |
| 201 | |
| 202 | bool check_tx_sig(const struct bitcoin_tx *tx, size_t input_num, |
| 203 | const u8 *redeemscript, |
no outgoing calls
no test coverage detected