MBEDTLS_NO_INT64_DIVISION -> MBEDTLS_NO_UDBL_DIVISION

Changed the option to disable the use of 64-bit division, to an option
to disable the use of double-width division, whether that's 64 or 128-bit.
This commit is contained in:
Gilles Peskine 2017-06-08 15:19:20 +02:00 committed by Simon Butcher
parent d7fce008c5
commit b1a977f5a7
3 changed files with 39 additions and 0 deletions

View File

@ -16,6 +16,13 @@ API Changes
qualifier from the functions mbedtls_aes_decrypt, mbedtls_aes_encrypt, qualifier from the functions mbedtls_aes_decrypt, mbedtls_aes_encrypt,
mbedtls_ssl_ciphersuite_uses_ec and mbedtls_ssl_ciphersuite_uses_psk. mbedtls_ssl_ciphersuite_uses_ec and mbedtls_ssl_ciphersuite_uses_psk.
Changes
* Added config.h option MBEDTLS_NO_UDBL_DIVISION, to prevent the use of
64-bit division.
* Added config.h option MBEDTLS_TYPE_UDBL to allow configuring the
double-width integer type used in the bignum module when the compiler is
unknown.
Bugfix Bugfix
* Add a check if iv_len is zero, and return an error if it is zero. reported * Add a check if iv_len is zero, and return an error if it is zero. reported
by roberto. #716 by roberto. #716

View File

@ -55,6 +55,31 @@
*/ */
#define MBEDTLS_HAVE_ASM #define MBEDTLS_HAVE_ASM
/**
* \def MBEDTLS_NO_UDBL_DIVISION
*
* The platform lacks support for double-width integer division (64-bit
* division on a 32-bit platform, 128-bit division on a 64-bit platform).
*
* Used in:
* include/mbedtls/bignum.h
* library/bignum.c
*
* The bignum code uses double-width division to speed up some operations.
* Double-width division is often implemented in software that needs to
* be linked with the program. The presence of a double-width integer
* type is usually detected automatically through preprocessor macros,
* but the automatic detection cannot know whether the code needs to
* and can be linked with an implementation of division for that type.
* By default division is assumed to be usable if the type is present.
* Uncomment this option to prevent the use of double-width division.
*
* Note that division for the native integer type is always required.
* Furthermore, a 64-bit type is always required even on a 32-bit
* platform, but it need not support multiplication or division.
*/
//#define MBEDTLS_NO_UDBL_DIVISION
/** /**
* \def MBEDTLS_HAVE_SSE2 * \def MBEDTLS_HAVE_SSE2
* *

View File

@ -468,6 +468,13 @@ scripts/config.pl unset MBEDTLS_MEMORY_BACKTRACE # execinfo.h
scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C # calls exit
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib
msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
cleanup
scripts/config.pl set MBEDTLS_NO_UDBL_DIVISION
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' make lib
echo "Checking that software 64-bit division is not required"
! grep __aeabi_uldiv library/*.o
msg "build: ARM Compiler 5, make" msg "build: ARM Compiler 5, make"
cleanup cleanup
cp "$CONFIG_H" "$CONFIG_BAK" cp "$CONFIG_H" "$CONFIG_BAK"