Remove support for HAVE_INT8 and HAVE_INT16

This commit is contained in:
Manuel Pégourié-Gonnard 2015-04-09 17:00:17 +02:00
parent b31424c86a
commit 7b53889f05
7 changed files with 36 additions and 138 deletions

View file

@ -9,6 +9,8 @@ Features
to override the whole module.
API Changes
* Configuration options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 have
been removed (compiler is required to support 32-bit operations).
* Configuration option POLARSSL_HAVE_IPV6 was removed (always enabled).
* All public identifiers moved to the mbedtls_* or MBEDTLS_* namespace.
* ecdsa_write_signature() gained an addtional md_alg argument and

View file

@ -38,13 +38,6 @@
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
#if (_MSC_VER <= 1200)
typedef signed short int16_t;
typedef unsigned short uint16_t;
#else
typedef INT16 int16_t;
typedef UINT16 uint16_t;
#endif
typedef INT32 int32_t;
typedef INT64 int64_t;
typedef UINT32 uint32_t;
@ -118,59 +111,44 @@ typedef UINT64 uint64_t;
#define MBEDTLS_MPI_RW_BUFFER_SIZE ( ((MBEDTLS_MPI_MAX_BITS_SCALE100 + MBEDTLS_LN_2_DIV_LN_10_SCALE100 - 1) / MBEDTLS_LN_2_DIV_LN_10_SCALE100) + 10 + 6 )
/*
* Define the base integer type, architecture-wise
* Define the base integer type, architecture-wise.
*
* 32-bit integers can be forced on 64-bit arches (eg. for testing purposes)
* by defining MBEDTLS_HAVE_INT32 and undefining MBEDTLS_HAVE_ASM
*/
#if defined(MBEDTLS_HAVE_INT8)
typedef signed char mbedtls_mpi_sint;
typedef unsigned char mbedtls_mpi_uint;
typedef uint16_t mbedtls_t_udbl;
#define MBEDTLS_HAVE_UDBL
#if ( ! defined(MBEDTLS_HAVE_INT32) && \
defined(_MSC_VER) && defined(_M_AMD64) )
#define MBEDTLS_HAVE_INT64
typedef int64_t mbedtls_mpi_sint;
typedef uint64_t mbedtls_mpi_uint;
#else
#if defined(MBEDTLS_HAVE_INT16)
typedef int16_t mbedtls_mpi_sint;
typedef uint16_t mbedtls_mpi_uint;
typedef uint32_t mbedtls_t_udbl;
#define MBEDTLS_HAVE_UDBL
#else
/*
* 32-bit integers can be forced on 64-bit arches (eg. for testing purposes)
* by defining MBEDTLS_HAVE_INT32 and undefining MBEDTLS_HAVE_ASM
*/
#if ( ! defined(MBEDTLS_HAVE_INT32) && \
defined(_MSC_VER) && defined(_M_AMD64) )
#define MBEDTLS_HAVE_INT64
typedef int64_t mbedtls_mpi_sint;
typedef uint64_t mbedtls_mpi_uint;
#if ( ! defined(MBEDTLS_HAVE_INT32) && \
defined(__GNUC__) && ( \
defined(__amd64__) || defined(__x86_64__) || \
defined(__ppc64__) || defined(__powerpc64__) || \
defined(__ia64__) || defined(__alpha__) || \
(defined(__sparc__) && defined(__arch64__)) || \
defined(__s390x__) || defined(__mips64) ) )
#define MBEDTLS_HAVE_INT64
typedef int64_t mbedtls_mpi_sint;
typedef uint64_t mbedtls_mpi_uint;
typedef unsigned int mbedtls_t_udbl __attribute__((mode(TI)));
#define MBEDTLS_HAVE_UDBL
#else
#if ( ! defined(MBEDTLS_HAVE_INT32) && \
defined(__GNUC__) && ( \
defined(__amd64__) || defined(__x86_64__) || \
defined(__ppc64__) || defined(__powerpc64__) || \
defined(__ia64__) || defined(__alpha__) || \
(defined(__sparc__) && defined(__arch64__)) || \
defined(__s390x__) || defined(__mips64) ) )
#define MBEDTLS_HAVE_INT64
typedef int64_t mbedtls_mpi_sint;
typedef uint64_t mbedtls_mpi_uint;
typedef unsigned int mbedtls_t_udbl __attribute__((mode(TI)));
#define MBEDTLS_HAVE_INT32
typedef int32_t mbedtls_mpi_sint;
typedef uint32_t mbedtls_mpi_uint;
#if ( defined(_MSC_VER) && defined(_M_IX86) )
typedef uint64_t mbedtls_t_udbl;
#define MBEDTLS_HAVE_UDBL
#else
#define MBEDTLS_HAVE_INT32
typedef int32_t mbedtls_mpi_sint;
typedef uint32_t mbedtls_mpi_uint;
#if ( defined(_MSC_VER) && defined(_M_IX86) )
typedef uint64_t mbedtls_t_udbl;
#else
#if defined( MBEDTLS_HAVE_LONGLONG )
typedef unsigned long long mbedtls_t_udbl;
#define MBEDTLS_HAVE_UDBL
#else
#if defined( MBEDTLS_HAVE_LONGLONG )
typedef unsigned long long mbedtls_t_udbl;
#define MBEDTLS_HAVE_UDBL
#endif
#endif
#endif /* !MBEDTLS_HAVE_INT32 && __GNUC__ && 64-bit platform */
#endif /* !MBEDTLS_HAVE_INT32 && _MSC_VER && _M_AMD64 */
#endif /* MBEDTLS_HAVE_INT16 */
#endif /* MBEDTLS_HAVE_INT8 */
#endif
#endif /* !MBEDTLS_HAVE_INT32 && __GNUC__ && 64-bit platform */
#endif /* !MBEDTLS_HAVE_INT32 && _MSC_VER && _M_AMD64 */
#ifdef __cplusplus
extern "C" {

View file

@ -240,12 +240,6 @@
#if defined MBEDTLS_HAVE_ASM
#define POLARSSL_HAVE_ASM MBEDTLS_HAVE_ASM
#endif
#if defined MBEDTLS_HAVE_INT16
#define POLARSSL_HAVE_INT16 MBEDTLS_HAVE_INT16
#endif
#if defined MBEDTLS_HAVE_INT8
#define POLARSSL_HAVE_INT8 MBEDTLS_HAVE_INT8
#endif
#if defined MBEDTLS_HAVE_LONGLONG
#define POLARSSL_HAVE_LONGLONG MBEDTLS_HAVE_LONGLONG
#endif

View file

@ -39,24 +39,6 @@
* \{
*/
/**
* \def MBEDTLS_HAVE_INT8
*
* The system uses 8-bit wide native integers.
*
* Uncomment if native integers are 8-bit wide.
*/
//#define MBEDTLS_HAVE_INT8
/**
* \def MBEDTLS_HAVE_INT16
*
* The system uses 16-bit wide native integers.
*
* Uncomment if native integers are 16-bit wide.
*/
//#define MBEDTLS_HAVE_INT16
/**
* \def MBEDTLS_HAVE_LONGLONG
*

View file

@ -44,34 +44,7 @@
* Conversion macros for embedded constants:
* build lists of mbedtls_mpi_uint's from lists of unsigned char's grouped by 8, 4 or 2
*/
#if defined(MBEDTLS_HAVE_INT8)
#define BYTES_TO_T_UINT_8( a, b, c, d, e, f, g, h ) \
a, b, c, d, e, f, g, h
#define BYTES_TO_T_UINT_4( a, b, c, d ) \
a, b, c, d
#define BYTES_TO_T_UINT_2( a, b ) \
a, b
#elif defined(MBEDTLS_HAVE_INT16)
#define BYTES_TO_T_UINT_2( a, b ) \
( (mbedtls_mpi_uint) a << 0 ) | \
( (mbedtls_mpi_uint) b << 8 )
#define BYTES_TO_T_UINT_4( a, b, c, d ) \
BYTES_TO_T_UINT_2( a, b ), \
BYTES_TO_T_UINT_2( c, d )
#define BYTES_TO_T_UINT_8( a, b, c, d, e, f, g, h ) \
BYTES_TO_T_UINT_2( a, b ), \
BYTES_TO_T_UINT_2( c, d ), \
BYTES_TO_T_UINT_2( e, f ), \
BYTES_TO_T_UINT_2( g, h )
#elif defined(MBEDTLS_HAVE_INT32)
#if defined(MBEDTLS_HAVE_INT32)
#define BYTES_TO_T_UINT_4( a, b, c, d ) \
( (mbedtls_mpi_uint) a << 0 ) | \
@ -907,26 +880,7 @@ cleanup:
*/
#define LOAD32 cur = A( i );
#if defined(MBEDTLS_HAVE_INT8) /* 8 bit */
#define MAX32 N->n / 4
#define A( j ) (uint32_t)( N->p[4*j+0] ) | \
( N->p[4*j+1] << 8 ) | \
( N->p[4*j+2] << 16 ) | \
( N->p[4*j+3] << 24 )
#define STORE32 N->p[4*i+0] = (mbedtls_mpi_uint)( cur ); \
N->p[4*i+1] = (mbedtls_mpi_uint)( cur >> 8 ); \
N->p[4*i+2] = (mbedtls_mpi_uint)( cur >> 16 ); \
N->p[4*i+3] = (mbedtls_mpi_uint)( cur >> 24 );
#elif defined(MBEDTLS_HAVE_INT16) /* 16 bit */
#define MAX32 N->n / 2
#define A( j ) (uint32_t)( N->p[2*j] ) | ( N->p[2*j+1] << 16 )
#define STORE32 N->p[2*i+0] = (mbedtls_mpi_uint)( cur ); \
N->p[2*i+1] = (mbedtls_mpi_uint)( cur >> 16 );
#elif defined(MBEDTLS_HAVE_INT32) /* 32 bit */
#if defined(MBEDTLS_HAVE_INT32) /* 32 bit */
#define MAX32 N->n
#define A( j ) N->p[j]
@ -1155,11 +1109,7 @@ cleanup:
#define P521_WIDTH ( 521 / 8 / sizeof( mbedtls_mpi_uint ) + 1 )
/* Bits to keep in the most significant mbedtls_mpi_uint */
#if defined(MBEDTLS_HAVE_INT8)
#define P521_MASK 0x01
#else
#define P521_MASK 0x01FF
#endif
/*
* Fast quasi-reduction modulo p521 (FIPS 186-3 D.2.5)

View file

@ -39,12 +39,6 @@
static const char *features[] = {
#if defined(MBEDTLS_VERSION_FEATURES)
#if defined(MBEDTLS_HAVE_INT8)
"MBEDTLS_HAVE_INT8",
#endif /* MBEDTLS_HAVE_INT8 */
#if defined(MBEDTLS_HAVE_INT16)
"MBEDTLS_HAVE_INT16",
#endif /* MBEDTLS_HAVE_INT16 */
#if defined(MBEDTLS_HAVE_LONGLONG)
"MBEDTLS_HAVE_LONGLONG",
#endif /* MBEDTLS_HAVE_LONGLONG */

View file

@ -19,8 +19,6 @@ EOU
# respective tests were adapted
my @excluded = qw(
MBEDTLS_DEPRECATED_REMOVED
MBEDTLS_HAVE_INT8
MBEDTLS_HAVE_INT16
MBEDTLS_HAVE_SSE2
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
MBEDTLS_ECP_DP_M221_ENABLED