aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/curve448
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2017-12-05 16:59:42 +0000
committerMatt Caswell <matt@openssl.org>2018-02-20 12:59:30 +0000
commitb47758dbd06e960e5775db5de39b6e9b31c09097 (patch)
tree285418bb0714810405a2b7d36b430afe4e3e20c8 /crypto/ec/curve448
parentaeeef83cb536216a414287dee1f424265283da88 (diff)
downloadopenssl-b47758dbd06e960e5775db5de39b6e9b31c09097.tar.gz
Merge f_arithmetic.c into f_generic.c
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/5105)
Diffstat (limited to 'crypto/ec/curve448')
-rw-r--r--crypto/ec/curve448/f_arithmetic.c46
-rw-r--r--crypto/ec/curve448/f_generic.c33
2 files changed, 33 insertions, 46 deletions
diff --git a/crypto/ec/curve448/f_arithmetic.c b/crypto/ec/curve448/f_arithmetic.c
deleted file mode 100644
index e8c5738d07..0000000000
--- a/crypto/ec/curve448/f_arithmetic.c
+++ /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);
-}
diff --git a/crypto/ec/curve448/f_generic.c b/crypto/ec/curve448/f_generic.c
index 097ee6d4b0..6a3442231e 100644
--- a/crypto/ec/curve448/f_generic.c
+++ b/crypto/ec/curve448/f_generic.c
@@ -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);
+}