82 {
83
96 int recid = 0;
97 int k, should_verify;
98 unsigned char msg32[32];
99
100 if (skip_section(&iter)) continue;
101
102 secp256k1_scalar_set_int(&s_s,
s);
103 secp256k1_scalar_set_int(&r_s,
r);
104 secp256k1_scalar_set_int(&msg_s, msg);
105 secp256k1_scalar_set_int(&sk_s, key);
106 secp256k1_scalar_get_b32(msg32, &msg_s);
107
108
109
110
111 should_verify = 0;
114 r_from_k(&check_x_s, group, k, NULL);
115 if (r_s == check_x_s) {
116 secp256k1_scalar_set_int(&s_times_k_s, k);
117 secp256k1_scalar_mul(&s_times_k_s, &s_times_k_s, &s_s);
118 secp256k1_scalar_mul(&msg_plus_r_times_sk_s, &r_s, &sk_s);
119 secp256k1_scalar_add(&msg_plus_r_times_sk_s, &msg_plus_r_times_sk_s, &msg_s);
120 should_verify |= secp256k1_scalar_eq(&s_times_k_s, &msg_plus_r_times_sk_s);
121 }
122 }
123
124 should_verify &= !secp256k1_scalar_is_high(&s_s);
125
126
127
128
129
130
131
132 secp256k1_ecdsa_recoverable_signature_save(&rsig, &r_s, &s_s, recid);
134 memcpy(&nonconst_ge, &group[sk_s],
sizeof(nonconst_ge));
135 secp256k1_pubkey_save(&pk, &nonconst_ge);
136 CHECK(should_verify ==
138 }
139 }
140 }
141 }
142}
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(const secp256k1_context *ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msghash32, const secp256k1_pubkey *pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
memcpy((char *) pInfo->slotDescription, s, l)