From 425bf499185d78aa8fcad6a30b8771e7865d449d Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 18 Nov 2020 10:41:13 +0900 Subject: build: Use modern Autoconf check for type. * configure.ac (byte, ushort, us6, u32, u64): Use AC_CHECK_TYPES. * cipher/poly1305.c: Use HAVE_TYPE_U64. * src/hmac256.c: HAVE_TYPE_U32. * src/types.h: Use HAVE_TYPE_BYTE, HAVE_TYPE_USHORT, HAVE_TYPE_U16, HAVE_TYPE_U32, and HAVE_TYPE_U64. Signed-off-by: NIIBE Yutaka --- cipher/poly1305.c | 2 +- configure.ac | 5 +---- src/hmac256.c | 8 ++++---- src/types.h | 26 +++++++++++++------------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/cipher/poly1305.c b/cipher/poly1305.c index 69805085..adcb6792 100644 --- a/cipher/poly1305.c +++ b/cipher/poly1305.c @@ -37,7 +37,7 @@ static const char *selftest (void); #undef USE_MPI_64BIT #undef USE_MPI_32BIT -#if BYTES_PER_MPI_LIMB == 8 && defined(HAVE_U64_TYPEDEF) +#if BYTES_PER_MPI_LIMB == 8 && defined(HAVE_TYPE_U64) # define USE_MPI_64BIT 1 #elif BYTES_PER_MPI_LIMB == 4 # define USE_MPI_32BIT 1 diff --git a/configure.ac b/configure.ac index 96a18d19..de60856d 100644 --- a/configure.ac +++ b/configure.ac @@ -839,10 +839,7 @@ AC_TYPE_SIGNAL AC_DECL_SYS_SIGLIST AC_TYPE_PID_T -GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF) -GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF) -GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF) -GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF) +AC_CHECK_TYPES([byte, ushort, u16, u32, u64]) gl_TYPE_SOCKLEN_T case "${host}" in diff --git a/src/hmac256.c b/src/hmac256.c index 2d66079c..78dcf8af 100644 --- a/src/hmac256.c +++ b/src/hmac256.c @@ -35,7 +35,7 @@ WORDS_BIGENDIAN Defined to 1 on big endian systems. inline If defined, it should yield the keyword used to inline a function. - HAVE_U32_TYPEDEF Defined if the u32 type is available. + HAVE_TYPE_U32 Defined if the u32 type is available. SIZEOF_UNSIGNED_INT Defined to the size in bytes of an unsigned int. SIZEOF_UNSIGNED_LONG Defined to the size in bytes of an unsigned long. @@ -47,7 +47,7 @@ #ifdef STANDALONE #include -#define HAVE_U32_TYPEDEF 1 +#define HAVE_TYPE_U32 1 typedef uint32_t u32; #define VERSION "standalone" /* For GCC, we can detect endianness. If not GCC, please define manually. */ @@ -78,7 +78,7 @@ typedef uint32_t u32; -#ifndef HAVE_U32_TYPEDEF +#ifndef HAVE_TYPE_U32 # undef u32 /* Undef a possible macro with that name. */ # if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int u32; @@ -87,7 +87,7 @@ typedef uint32_t u32; # else # error no typedef for u32 # endif -# define HAVE_U32_TYPEDEF +# define HAVE_TYPE_U32 #endif diff --git a/src/types.h b/src/types.h index 39393be1..abcba2b9 100644 --- a/src/types.h +++ b/src/types.h @@ -54,23 +54,23 @@ -#ifndef HAVE_BYTE_TYPEDEF +#ifndef HAVE_TYPE_BYTE # undef byte /* In case there is a macro with that name. */ # if !(defined(_WIN32) && defined(cbNDRContext)) /* Windows typedefs byte in the rpc headers. Avoid warning about double definition. */ typedef unsigned char byte; # endif -# define HAVE_BYTE_TYPEDEF +# define HAVE_TYPE_BYTE #endif -#ifndef HAVE_USHORT_TYPEDEF +#ifndef HAVE_TYPE_USHORT # undef ushort /* In case there is a macro with that name. */ typedef unsigned short ushort; -# define HAVE_USHORT_TYPEDEF +# define HAVE_TYPE_USHORT #endif -#ifndef HAVE_U16_TYPEDEF +#ifndef HAVE_TYPE_U16 # undef u16 /* In case there is a macro with that name. */ # if SIZEOF_UNSIGNED_INT == 2 typedef unsigned int u16; @@ -79,10 +79,10 @@ # else # error no typedef for u16 # endif -# define HAVE_U16_TYPEDEF +# define HAVE_TYPE_U16 #endif -#ifndef HAVE_U32_TYPEDEF +#ifndef HAVE_TYPE_U32 # undef u32 /* In case there is a macro with that name. */ # if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int u32; @@ -91,7 +91,7 @@ # else # error no typedef for u32 # endif -# define HAVE_U32_TYPEDEF +# define HAVE_TYPE_U32 #endif /* @@ -99,24 +99,24 @@ * the dummy code in cipher/md.c is not available. Examples are * Solaris and IRIX. */ -#ifndef HAVE_U64_TYPEDEF +#ifndef HAVE_TYPE_U64 # undef u64 /* In case there is a macro with that name. */ # if SIZEOF_UNSIGNED_INT == 8 typedef unsigned int u64; # define U64_C(c) (c ## U) -# define HAVE_U64_TYPEDEF +# define HAVE_TYPE_U64 # elif SIZEOF_UNSIGNED_LONG == 8 typedef unsigned long u64; # define U64_C(c) (c ## UL) -# define HAVE_U64_TYPEDEF +# define HAVE_TYPE_U64 # elif SIZEOF_UNSIGNED_LONG_LONG == 8 typedef unsigned long long u64; # define U64_C(c) (c ## ULL) -# define HAVE_U64_TYPEDEF +# define HAVE_TYPE_U64 # elif SIZEOF_UINT64_T == 8 typedef uint64_t u64; # define U64_C(c) (UINT64_C(c)) -# define HAVE_U64_TYPEDEF +# define HAVE_TYPE_U64 # else # error No way to declare a 64 bit integer type # endif -- cgit v1.2.1