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