-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Gnu Privacy Tools
 
 iF4EABEIAAYFAlxPWNkACgkQrwyxdiHtrXIg2AD+IIAkFz4ZThepyYmLJYZ71ecN
 f6XLJp4rRqHlgigxjm0BAIaRNSt2vuk2xaa9DASR/fmoIZ/TXxTr5F5UMuOBIhjk
 =ByKS
 -----END PGP SIGNATURE-----

Merge tag 'v1.1.0' into develop

v1.1.0
This commit is contained in:
Steffen Jaeckel 2019-01-28 20:33:16 +01:00
commit 6d54b80456
10 changed files with 42 additions and 15 deletions

View File

@ -71,7 +71,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
} }
#ifdef MP_8BIT #ifdef MP_8BIT
/* The search in the loop above was exhaustive in this case */ /* The search in the loop above was exhaustive in this case */
if (a->used == 1 && PRIME_SIZE >= 31) { if ((a->used == 1) && (PRIME_SIZE >= 31)) {
return MP_OKAY; return MP_OKAY;
} }
#endif #endif
@ -126,7 +126,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
*/ */
#if defined (MP_8BIT) || defined (LTM_USE_FROBENIUS_TEST) #if defined (MP_8BIT) || defined (LTM_USE_FROBENIUS_TEST)
err = mp_prime_frobenius_underwood(a, &res); err = mp_prime_frobenius_underwood(a, &res);
if (err != MP_OKAY && err != MP_ITER) { if ((err != MP_OKAY) && (err != MP_ITER)) {
goto LBL_B; goto LBL_B;
} }
if (res == MP_NO) { if (res == MP_NO) {
@ -296,7 +296,7 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
* One 8-bit digit is too small, so concatenate two if the size of * One 8-bit digit is too small, so concatenate two if the size of
* unsigned int allows for it. * unsigned int allows for it.
*/ */
if ((sizeof(unsigned int) * CHAR_BIT)/2 >= (sizeof(mp_digit) * CHAR_BIT)) { if (((sizeof(unsigned int) * CHAR_BIT)/2) >= (sizeof(mp_digit) * CHAR_BIT)) {
if ((err = mp_rand(&b, 1)) != MP_OKAY) { if ((err = mp_rand(&b, 1)) != MP_OKAY) {
goto LBL_B; goto LBL_B;
} }
@ -305,10 +305,9 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
fips_rand &= mask; fips_rand &= mask;
} }
#endif #endif
if (fips_rand > ((unsigned int) INT_MAX - DIGIT_BIT)) { if (fips_rand > (unsigned int)(INT_MAX - DIGIT_BIT)) {
len = INT_MAX / DIGIT_BIT; len = INT_MAX / DIGIT_BIT;
} } else {
else {
len = (((int)fips_rand + DIGIT_BIT) / DIGIT_BIT); len = (((int)fips_rand + DIGIT_BIT) / DIGIT_BIT);
} }
/* Unlikely. */ /* Unlikely. */

View File

@ -1,3 +1,25 @@
Jan 28th, 2019
v1.1.0
-- Christoph Zurnieden contributed FIPS 186.4 compliant
prime-checking (PR #113), several other fixes and a load of documentation
-- Daniel Mendler provided two's-complement functions (PR #124)
and mp_{set,get}_double() (PR #123)
-- Francois Perrad took care of linting the sources, provided all fixes and
a astylerc to auto-format the sources.
-- A bunch of patches by Kevin B Kenny have been back-ported from TCL
-- Jan Nijtmans provided the patches to `const`ify all API
function arguments (also from TCL)
-- mp_rand() has now several native random provider implementations
and doesn't rely on `rand()` anymore
-- Karel Miko provided fixes when building for MS Windows
and re-worked the makefile generating process
-- The entire environment and build logic has been extended and improved
regarding auto-detection of platforms, libtool and a lot more
-- Prevent some potential BOF cases
-- Improved/fixed mp_lshd() and mp_invmod()
-- A load more bugs were fixed by various contributors
Aug 29th, 2017 Aug 29th, 2017
v1.0.1 v1.0.1
-- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy() -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy()

View File

@ -741,7 +741,8 @@ int main(void)
} }
/* Check regarding problem #143 */ /* Check regarding problem #143 */
#ifndef MP_8BIT #ifndef MP_8BIT
mp_read_radix(&a, "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF", mp_read_radix(&a,
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF",
16); 16);
err = mp_prime_strong_lucas_selfridge(&a, &cnt); err = mp_prime_strong_lucas_selfridge(&a, &cnt);
/* small problem */ /* small problem */

1
dep.pl
View File

@ -21,6 +21,7 @@ print {$class} << 'EOS';
* *
* SPDX-License-Identifier: Unlicense * SPDX-License-Identifier: Unlicense
*/ */
#if !(defined(LTM1) && defined(LTM2) && defined(LTM3)) #if !(defined(LTM1) && defined(LTM2) && defined(LTM3))
#if defined(LTM2) #if defined(LTM2)
# define LTM3 # define LTM3

View File

@ -49,7 +49,7 @@
\begin{document} \begin{document}
\frontmatter \frontmatter
\pagestyle{empty} \pagestyle{empty}
\title{LibTomMath User Manual \\ v1.0.1} \title{LibTomMath User Manual \\ v1.1.0}
\author{LibTom Projects \\ www.libtom.net} \author{LibTom Projects \\ www.libtom.net}
\maketitle \maketitle
This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been

View File

@ -141,6 +141,8 @@ zipup: clean astyle new_file manual poster docs
$(MAKE) -C libtommath-$(VERSION)/ pre_gen $(MAKE) -C libtommath-$(VERSION)/ pre_gen
tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION) zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
cp doc/bn.pdf bn-$(VERSION).pdf
cp doc/tommath.pdf tommath-$(VERSION).pdf
rm -rf libtommath-$(VERSION) rm -rf libtommath-$(VERSION)
gpg -b -a ltm-$(VERSION).tar.xz gpg -b -a ltm-$(VERSION).tar.xz
gpg -b -a ltm-$(VERSION).zip gpg -b -a ltm-$(VERSION).zip

View File

@ -83,6 +83,7 @@ test_standalone: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME) $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME)
.PHONY: mtest
mtest: mtest:
cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest

View File

@ -21,7 +21,7 @@ RANLIB = ranlib
CFLAGS = -O2 CFLAGS = -O2
LDFLAGS = LDFLAGS =
VERSION = 1.0.1 VERSION = 1.1.0
#Compilation flags #Compilation flags
LTM_CFLAGS = -I. $(CFLAGS) LTM_CFLAGS = -I. $(CFLAGS)

View File

@ -3,9 +3,9 @@
# #
#version of library #version of library
VERSION=1.0.1 VERSION=1.1.0
VERSION_PC=1.0.1 VERSION_PC=1.1.0
VERSION_SO=1:1 VERSION_SO=2:0:1
PLATFORM := $(shell uname | sed -e 's/_.*//') PLATFORM := $(shell uname | sed -e 's/_.*//')

View File

@ -283,9 +283,10 @@ int mp_rand(mp_int *a, int digits);
int mp_rand_digit(mp_digit *r); int mp_rand_digit(mp_digit *r);
#ifdef MP_PRNG_ENABLE_LTM_RNG #ifdef MP_PRNG_ENABLE_LTM_RNG
/* as last resort we will fall back to libtomcrypt's rng_get_bytes() /* A last resort to provide random data on systems without any of the other
* in case you don't use libtomcrypt or use it w/o rng_get_bytes() * implemented ways to gather entropy.
* you have to implement it somewhere else, as it's required */ * It is compatible with `rng_get_bytes()` from libtomcrypt so you could
* provide that one and then set `ltm_rng = rng_get_bytes;` */
extern unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void)); extern unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
extern void (*ltm_rng_callback)(void); extern void (*ltm_rng_callback)(void);
#endif #endif