Improved modular exponentiation (automatic window optimisation if there is enough...
[BearSSL] / src / ec / ecdsa_i31_vrfy_raw.c
index 54dcfc2..259477f 100644 (file)
@@ -47,6 +47,13 @@ br_ecdsa_i31_vrfy_raw(const br_ec_impl *impl,
        size_t nlen, rlen, ulen;
        uint32_t n0i, res;
 
+       /*
+        * If the curve is not supported, then report an error.
+        */
+       if (((impl->supported_curves >> pk->curve) & 1) == 0) {
+               return 0;
+       }
+
        /*
         * Get the curve parameters (generator and order).
         */
@@ -137,7 +144,7 @@ br_ecdsa_i31_vrfy_raw(const br_ec_impl *impl,
         */
        ulen = cd->generator_len;
        memcpy(eU, pk->q, ulen);
-       res = impl->muladd(eU, cd->generator, ulen,
+       res = impl->muladd(eU, NULL, ulen,
                tx, nlen, ty, nlen, cd->curve);
 
        /*