]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/ec/curve448/curve448.c
Reorganize local header files
[thirdparty/openssl.git] / crypto / ec / curve448 / curve448.c
index 7c43a758f91f02afcb055c634444efda1c752379..e3dffd09c93fea8b8681c9d4d94dbc546bfb65d5 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright 2015-2016 Cryptography Research, Inc.
  *
- * Licensed under the OpenSSL license (the "License").  You may not use
+ * Licensed under the Apache License 2.0 (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
@@ -15,7 +15,7 @@
 
 #include "point_448.h"
 #include "ed448.h"
-#include "curve448_lcl.h"
+#include "curve448_local.h"
 
 #define COFACTOR 4
 
@@ -27,8 +27,8 @@
 static const curve448_scalar_t precomputed_scalarmul_adjustment = {
     {
         {
-            SC_LIMB(0xc873d6d54a7bb0cf), SC_LIMB(0xe933d8d723a70aad),
-            SC_LIMB(0xbb124b65129c96fd), SC_LIMB(0x00000008335dc163)
+            SC_LIMB(0xc873d6d54a7bb0cfULL), SC_LIMB(0xe933d8d723a70aadULL),
+            SC_LIMB(0xbb124b65129c96fdULL), SC_LIMB(0x00000008335dc163ULL)
         }
     }
 };
@@ -500,10 +500,10 @@ struct smvt_control {
     int power, addend;
 };
 
-#if defined(__GNUC__) || defined(__clang__)
-# define NUMTRAILINGZEROS      __builtin_ctz
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
+# define NUMTRAILINGZEROS       __builtin_ctz
 #else
-# define NUMTRAILINGZEROS      numtrailingzeros
+# define NUMTRAILINGZEROS       numtrailingzeros
 static uint32_t numtrailingzeros(uint32_t i)
 {
     uint32_t tmp;
@@ -579,7 +579,7 @@ static int recode_wnaf(struct smvt_control *control,
             assert(position >= 0);
             if (odd & (1 << (table_bits + 1)))
                 delta -= (1 << (table_bits + 1));
-            current -= delta << pos;
+            current -= delta * (1 << pos);
             control[position].power = pos + 16 * (w - 1);
             control[position].addend = delta;
             position--;