Merge f_arithmetic.c into f_generic.c
authorMatt Caswell <matt@openssl.org>
Tue, 5 Dec 2017 16:59:42 +0000 (16:59 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 20 Feb 2018 12:59:30 +0000 (12:59 +0000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5105)

crypto/ec/build.info
crypto/ec/curve448/f_arithmetic.c [deleted file]
crypto/ec/curve448/f_generic.c

index 15d6ccc58c5bede59e6c74f101cc80f281fa2dec..b6549a1673e50cc30903673251fdced2a8ea76ab 100644 (file)
@@ -6,9 +6,8 @@ SOURCE[../../libcrypto]=\
         ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c \
         ecp_oct.c ec2_oct.c ec_oct.c ec_kmeth.c ecdh_ossl.c ecdh_kdf.c \
         ecdsa_ossl.c ecdsa_sign.c ecdsa_vrf.c curve25519.c ecx_meth.c \
-        curve448/arch_32/f_impl.c curve448/f_arithmetic.c curve448/f_generic.c \
-        curve448/scalar.c curve448/curve448_tables.c curve448/eddsa.c \
-        curve448/curve448.c \
+        curve448/arch_32/f_impl.c curve448/f_generic.c curve448/scalar.c \
+        curve448/curve448_tables.c curve448/eddsa.c curve448/curve448.c \
         {- $target{ec_asm_src} -}
 
 GENERATE[ecp_nistz256-x86.s]=asm/ecp_nistz256-x86.pl \
@@ -33,7 +32,6 @@ BEGINRAW[Makefile]
 ENDRAW[Makefile]
 
 INCLUDE[curve448/arch_32/f_impl.o]=curve448/arch_32 curve448
-INCLUDE[curve448/f_arithmetic.o]=curve448/arch_32 curve448
 INCLUDE[curve448/f_generic.o]=curve448/arch_32 curve448
 INCLUDE[curve448/scalar.o]=curve448/arch_32 curve448
 INCLUDE[curve448/curve448_tables.o]=curve448/arch_32 curve448
diff --git a/crypto/ec/curve448/f_arithmetic.c b/crypto/ec/curve448/f_arithmetic.c
deleted file mode 100644 (file)
index e8c5738..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
- * Copyright 2014 Cryptography Research, Inc.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- *
- * Originally written by Mike Hamburg
- */
-
-#include "field.h"
-
-mask_t gf_isr(gf a, const gf x)
-{
-    gf L0, L1, L2;
-    gf_sqr(L1, x);
-    gf_mul(L2, x, L1);
-    gf_sqr(L1, L2);
-    gf_mul(L2, x, L1);
-    gf_sqrn(L1, L2, 3);
-    gf_mul(L0, L2, L1);
-    gf_sqrn(L1, L0, 3);
-    gf_mul(L0, L2, L1);
-    gf_sqrn(L2, L0, 9);
-    gf_mul(L1, L0, L2);
-    gf_sqr(L0, L1);
-    gf_mul(L2, x, L0);
-    gf_sqrn(L0, L2, 18);
-    gf_mul(L2, L1, L0);
-    gf_sqrn(L0, L2, 37);
-    gf_mul(L1, L2, L0);
-    gf_sqrn(L0, L1, 37);
-    gf_mul(L1, L2, L0);
-    gf_sqrn(L0, L1, 111);
-    gf_mul(L2, L1, L0);
-    gf_sqr(L0, L2);
-    gf_mul(L1, x, L0);
-    gf_sqrn(L0, L1, 223);
-    gf_mul(L1, L2, L0);
-    gf_sqr(L2, L1);
-    gf_mul(L0, L2, x);
-    gf_copy(a, L1);
-    return gf_eq(L0, ONE);
-}
index 097ee6d4b0629ac9e5dc644fea2a61c0c6db53a2..6a3442231e5da3b1d6bf1253d58a339e4ff89b44 100644 (file)
@@ -165,3 +165,36 @@ mask_t gf_eq(const gf a, const gf b)
 
     return word_is_zero(ret);
 }
+
+mask_t gf_isr(gf a, const gf x)
+{
+    gf L0, L1, L2;
+    gf_sqr(L1, x);
+    gf_mul(L2, x, L1);
+    gf_sqr(L1, L2);
+    gf_mul(L2, x, L1);
+    gf_sqrn(L1, L2, 3);
+    gf_mul(L0, L2, L1);
+    gf_sqrn(L1, L0, 3);
+    gf_mul(L0, L2, L1);
+    gf_sqrn(L2, L0, 9);
+    gf_mul(L1, L0, L2);
+    gf_sqr(L0, L1);
+    gf_mul(L2, x, L0);
+    gf_sqrn(L0, L2, 18);
+    gf_mul(L2, L1, L0);
+    gf_sqrn(L0, L2, 37);
+    gf_mul(L1, L2, L0);
+    gf_sqrn(L0, L1, 37);
+    gf_mul(L1, L2, L0);
+    gf_sqrn(L0, L1, 111);
+    gf_mul(L2, L1, L0);
+    gf_sqr(L0, L2);
+    gf_mul(L1, x, L0);
+    gf_sqrn(L0, L1, 223);
+    gf_mul(L1, L2, L0);
+    gf_sqr(L2, L1);
+    gf_mul(L0, L2, x);
+    gf_copy(a, L1);
+    return gf_eq(L0, ONE);
+}