Use HAVE_TI_MODE for the macro and HAVE_TI_MODE_V for the substitution
This commit is contained in:
parent
08e08c966b
commit
019064e663
16
configure.ac
16
configure.ac
@ -159,21 +159,25 @@ AC_C_BIGENDIAN(
|
|||||||
)
|
)
|
||||||
|
|
||||||
AC_MSG_CHECKING(for 128-bit arithmetic)
|
AC_MSG_CHECKING(for 128-bit arithmetic)
|
||||||
have_ti_mode=no
|
HAVE_TI_MODE_V=0
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <limits.h>
|
|
||||||
]], [[
|
]], [[
|
||||||
|
#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)));
|
typedef unsigned uint128_t __attribute__((mode(TI)));
|
||||||
uint128_t x;
|
uint128_t x;
|
||||||
(void) x;
|
(void) x;
|
||||||
return sizeof(x) / CHAR_BIT != 16U
|
|
||||||
]])],
|
]])],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([HAVE_TI_MODE], [1], [gcc TI mode is available])
|
AC_DEFINE([HAVE_TI_MODE], [1], [gcc TI mode is available])
|
||||||
have_ti_mode=yes],
|
HAVE_TI_MODE_V=1],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
AM_CONDITIONAL([HAVE_TI_MODE], [test x$have_ti_mode = xyes])
|
AM_CONDITIONAL([HAVE_TI_MODE], [test $HAVE_TI_MODE_V = 1])
|
||||||
AC_SUBST([HAVE_TI_MODE])
|
AC_SUBST(HAVE_TI_MODE_V)
|
||||||
|
|
||||||
dnl Checks for functions and headers
|
dnl Checks for functions and headers
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef crypto_scalarmult_curve25519_H
|
#ifndef crypto_scalarmult_curve25519_H
|
||||||
#define 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
|
# define SODIUM_HAVE_TI_MODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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(unsigned char *,const unsigned char *,const unsigned char *);
|
||||||
extern int crypto_scalarmult_curve25519_donna_c64_base(unsigned char *,const unsigned char *);
|
extern int crypto_scalarmult_curve25519_donna_c64_base(unsigned char *,const unsigned char *);
|
||||||
|
Loading…
Reference in New Issue
Block a user