ec: Rename reference p521 field operations and use them via macros
authorMartin Schwenke <martin@meltin.net>
Wed, 12 May 2021 01:47:55 +0000 (11:47 +1000)
committerPauli <pauli@openssl.org>
Sat, 29 May 2021 06:07:15 +0000 (16:07 +1000)
This will allow clean addition of assembly versions of these operations.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15401)

crypto/ec/ecp_nistp521.c

index c449b93a0aaf8cdb7d2e76a9c060e56a1b96d7d5..e507c1e55cb49187fe38ec86a6d7d9f71a7af140 100644 (file)
@@ -401,7 +401,7 @@ static void felem_diff128(largefelem out, const largefelem in)
  * On exit:
  *   out[i] < 17 * max(in[i]) * max(in[i])
  */
-static void felem_square(largefelem out, const felem in)
+static void felem_square_ref(largefelem out, const felem in)
 {
     felem inx2, inx4;
     felem_scalar(inx2, in, 2);
@@ -485,7 +485,7 @@ static void felem_square(largefelem out, const felem in)
  * On exit:
  *   out[i] < 17 * max(in1[i]) * max(in2[i])
  */
-static void felem_mul(largefelem out, const felem in1, const felem in2)
+static void felem_mul_ref(largefelem out, const felem in1, const felem in2)
 {
     felem in2x2;
     felem_scalar(in2x2, in2, 2);
@@ -675,6 +675,9 @@ static void felem_reduce(felem out, const largefelem in)
      */
 }
 
+#define felem_square felem_square_ref
+#define felem_mul felem_mul_ref
+
 static void felem_square_reduce(felem out, const felem in)
 {
     largefelem tmp;