From 019064e663f88b5b14b2864b89f783fb7059e094 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 21 Apr 2013 10:14:38 -0700 Subject: [PATCH] Use HAVE_TI_MODE for the macro and HAVE_TI_MODE_V for the substitution --- configure.ac | 16 ++++++++++------ .../sodium/crypto_scalarmult_curve25519.h.in | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 77d16c8c..7c366080 100644 --- a/configure.ac +++ b/configure.ac @@ -159,21 +159,25 @@ AC_C_BIGENDIAN( ) AC_MSG_CHECKING(for 128-bit arithmetic) -have_ti_mode=no +HAVE_TI_MODE_V=0 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include ]], [[ +#ifndef __GNUC__ +# error mode(TI) is a gcc extension +#endif +#if defined(__arm__) || defined(__ARMEL__) +# error clang doesn't properly compile smult_curve25519_donna_c64.c on arm +#endif typedef unsigned uint128_t __attribute__((mode(TI))); uint128_t x; (void) x; -return sizeof(x) / CHAR_BIT != 16U ]])], [AC_MSG_RESULT(yes) AC_DEFINE([HAVE_TI_MODE], [1], [gcc TI mode is available]) - have_ti_mode=yes], + HAVE_TI_MODE_V=1], [AC_MSG_RESULT(no)]) -AM_CONDITIONAL([HAVE_TI_MODE], [test x$have_ti_mode = xyes]) -AC_SUBST([HAVE_TI_MODE]) +AM_CONDITIONAL([HAVE_TI_MODE], [test $HAVE_TI_MODE_V = 1]) +AC_SUBST(HAVE_TI_MODE_V) dnl Checks for functions and headers diff --git a/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in b/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in index 4cfa74bd..37db17f6 100644 --- a/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in +++ b/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h.in @@ -1,7 +1,7 @@ #ifndef crypto_scalarmult_curve25519_H #define crypto_scalarmult_curve25519_H -#if @HAVE_TI_MODE@-1 == 0 +#if @HAVE_TI_MODE_V@-1 == 0 # define SODIUM_HAVE_TI_MODE #endif @@ -12,7 +12,7 @@ extern "C" { #endif -#ifndef SODIUM_HAVE_TI_MODE +#ifdef SODIUM_HAVE_TI_MODE extern int crypto_scalarmult_curve25519_donna_c64(unsigned char *,const unsigned char *,const unsigned char *); extern int crypto_scalarmult_curve25519_donna_c64_base(unsigned char *,const unsigned char *);