ec/curve448: portability fixups.
[openssl.git] / crypto / ec / curve448 / curve448utils.h
index 91fea6abf5fa9fb4a3ab70569c51bdfc665cc34a..9bf837993c94bf900ccd5a7e68553d761927fe76 100644 (file)
  * Originally written by Mike Hamburg
  */
 
-#ifndef __C448_COMMON_H__
-# define __C448_COMMON_H__ 1
+#ifndef HEADER_CURVE448UTILS_H
+# define HEADER_CURVE448UTILS_H
 
 # include <openssl/e_os2.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*
  * Internal word types. Somewhat tricky.  This could be decided separately per
  * platform.  However, the structs do need to be all the same size and
@@ -27,8 +23,8 @@ extern "C" {
  * with arch_arm32.
  */
 # ifndef C448_WORD_BITS
-#  if (defined(__ILP64__) || defined(__amd64__) || defined(__x86_64__) \
-      || (((__UINT_FAST32_MAX__)>>30)>>30))
+#  if (defined(__SIZEOF_INT128__) && (__SIZEOF_INT128__ == 16)) \
+      && !defined(__sparc__)
 #   define C448_WORD_BITS 64      /* The number of bits in a word */
 #  else
 #   define C448_WORD_BITS 32      /* The number of bits in a word */
@@ -62,10 +58,10 @@ typedef int64_t c448_dsword_t;
 # endif
 
 /* C448_TRUE = -1 so that C448_TRUE & x = x */
-static const c448_bool_t C448_TRUE = 0 - (c448_bool_t)1;
+# define C448_TRUE      (0 - (c448_bool_t)1)
 
 /* C448_FALSE = 0 so that C448_FALSE & x = 0 */
-static const c448_bool_t C448_FALSE = 0;
+# define C448_FALSE     0
 
 /* Another boolean type used to indicate success or failure. */
 typedef enum {
@@ -79,8 +75,4 @@ static ossl_inline c448_error_t c448_succeed_if(c448_bool_t x)
     return (c448_error_t) x;
 }
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 #endif                          /* __C448_COMMON_H__ */