aboutsummaryrefslogtreecommitdiff
path: root/p256_ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'p256_ec.c')
-rw-r--r--p256_ec.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/p256_ec.c b/p256_ec.c
index 72e80e6..4dc02d4 100644
--- a/p256_ec.c
+++ b/p256_ec.c
@@ -791,7 +791,6 @@ static char felem_is_zero_vartime(const felem in) {
memcmp(tmp, k2P, sizeof(tmp)) == 0;
}
-
/* Group operations:
*
* Elements of the elliptic curve group are represented in Jacobian
@@ -1236,6 +1235,22 @@ void p256_base_point_mul(const p256_int* n, p256_int* out_x, p256_int* out_y) {
}
}
+/* p256_point_mul sets {out_x,out_y} = n*{in_x,in_y}, where n is <
+ * the order of the group. */
+void p256_point_mul(const p256_int* n, const p256_int* in_x,
+ const p256_int* in_y, p256_int* out_x, p256_int* out_y) {
+ felem x, y, z, px, py;
+
+ to_montgomery(px, in_x);
+ to_montgomery(py, in_y);
+
+ scalar_mult(x, y, z, px, py, n);
+
+ point_to_affine(px, py, x, y, z);
+ from_montgomery(out_x, px);
+ from_montgomery(out_y, py);
+}
+
/* p256_points_mul_vartime sets {out_x,out_y} = n1*G + n2*{in_x,in_y}, where
* n1 and n2 are < the order of the group.
*