Joachim Breitner
6c35dd7e11
Import stddef in tommath.h
...
At least here (compiling for WebAssembly
(`wasm32-unknown-unknown-wasm`), I need this, otherwise `size_t` is not
available.
2019-07-17 15:39:57 +02:00
nijtmans
0db64fc83c
Rename bn_get_magxx -> bn_get_mag_uxx. Documentation updated too
2019-07-03 14:45:14 +02:00
nijtmans
fde8524945
@minad 's suggestions
2019-07-03 12:49:19 +02:00
nijtmans
db4afb3d5e
Provide explicit symbols for bn_xxx_l and bn_xxx_ll functions.
2019-07-03 12:49:19 +02:00
nijtmans
a911999db9
Better interoperability between MSVC and mingw-w64, 3
2019-06-06 10:30:00 +02:00
nijtmans
ab309de02f
Fix MSVC warning: bn_mp_rand.c(9): warning C4028: formal parameter 1 different from declaration
2019-06-05 14:50:12 +02:00
H.Merijn Brand - Tux
f5b6cd079e
Fix building on HP-UX 11.11 / PA-RISC
...
$ perl -v
This is perl 5, version 28, subversion 2 (v5.28.2) built for PA-RISC2.0-thread-multi-LP64
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for CryptX
Writing MYMETA.yml and MYMETA.json
$ make
:
:
gcc64 -Iltm -Iltc/headers -DLTC_SOURCE -DLTC_NO_TEST -DLTC_NO_PROTOTYPES -DLTM_DESC -D_POSIX_C_SOURCE=199506L -D_REENTRANT -mpa-risc-2-0 -fPIC -D_HPUX_SOURCE -fwrapv -fno-strict-aliasing -pipe -I/usr/local/pa20_64/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -fPIC -g -O -DARGTYPE=4 -c ltc/math/ltm_desc.c -o ltc/math/ltm_desc.o
In file included from ltc/math/ltm_desc.c:15:0:
ltm/tommath.h:74:1: error: unable to emulate 'TI'
make[1]: *** [ltc/math/ltm_desc.o] Error 1
make[1]: Leaving directory `/data/cpan-build/CryptX-0.063-0/src'
make: *** [src/liballinone.a] Error 2
$ gcc64 --version
gcc64 (GCC) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ perl -V:cppsymbols
cppsymbols='_FILE_OFFSET_BITS=64 _HPUX_SOURCE=1 _LARGEFILE_SOURCE=1 _LFS64_LARGEFILE=1 _LFS_LARGEFILE=1 _LP64=1 _PA_RISC2_0=1 _POSIX_C_SOURCE=199506L _PROTOTYPES= _REENTRANT=1 _XOPEN_SOURCE_EXTENDED=1 _XPG4= _XPG4_EXTENDED= __BYTE_ORDER__=4321 __ELF__=1 __GNUC_MINOR__=6 __GNUC__=4 __LP64__=1 __PIC__=2 __STDC_EXT__=1 __STDC__=1 __hp9000s700=1 __hp9000s700__=1 __hp9000s800=1 __hp9000s800__=1 __hppa=1 __hppa__=1 __hpux=1 __hpux__=1 __pic__=2 __unix=1 __unix__=1';
2019-06-05 09:40:33 +02:00
Steffen Jaeckel
0ebc4f9268
fix MP_DEPRECATED for non-gcc, -clang or -msvc
2019-06-05 09:40:10 +02:00
Francois Perrad
25ff85d2bf
move cast inside macro
2019-05-29 08:16:46 +02:00
Daniel Mendler
c7314fa400
deprecate mp_n_root_ex and mp_expt_d_ex
...
These functions were introduced to give some timing guarantees.
However the guarantees are too weak to be useful.
The functions seem to be unused essentially by downstream users.
2019-05-27 15:59:40 +02:00
Daniel Mendler
4b475aca03
fixes for msvc
2019-05-26 11:47:26 +02:00
Daniel Mendler
bcec605af5
deprecate mp_prime_is_divisible and ltm_prime_tab
...
* it is an implementation detail used for prime testing
* there is upcoming work by @czurnieden regarding a generalised prime sieve
* furthermore remove jacobi test (replaced by kronecker)
2019-05-24 12:30:55 +02:00
Daniel Mendler
c7a7bd47af
MP_PREC is an internal macro, it should be defined in tommath_private.h
2019-05-24 12:26:50 +02:00
Daniel Mendler
b0938d70f3
remove obsolete comment
2019-05-24 11:57:47 +02:00
Daniel Mendler
9f607dd5eb
disallow defining MP_DIGIT_BIT, only allow MP_8/16/31/32/64BIT
2019-05-24 11:57:47 +02:00
Daniel Mendler
0a9f5e9bc1
use u32 i64 suffix
2019-05-24 10:21:54 +02:00
Daniel Mendler
d7e1cb4a09
another proposal: use _ul and _l for the long macros
2019-05-24 00:15:57 +02:00
Daniel Mendler
b58c996686
use int32 and uint32 instead of sint and uint
2019-05-24 00:15:57 +02:00
Daniel Mendler
d795985497
improve comment in tommath.h, extend .gitignore
2019-05-24 00:15:57 +02:00
Daniel Mendler
3289c9590b
introduce various mp_set_sint/mp_set_uint functions with precise types
2019-05-24 00:15:57 +02:00
Daniel Mendler
1af0de1f91
deprecate mp_tc_(and|or|xor) in favor of mp_(and|or|xor)
...
* same behavior for positive numbers
* generalisation for negative numbers, treating them as two complement
* improve algorithm, iterate once over the digits, manually perform two complement
* simplify mp_add_d, mp_sub_d
* functions are safe in case of a==c or b==c
* renamed mp_tc_div_2d to mp_signed_rsh (signed right shift)
2019-05-21 18:28:11 +02:00
Daniel Mendler
0dfa9da5a6
make tommath_class.h and tommath_superclass.h private
...
These headers are used for configuration during build time.
Therefore they shouldn't be exposed as part of the public API.
2019-05-21 18:01:17 +02:00
Daniel Mendler
0b840b78a3
make mp_word private
...
mp_word is an internal type and it is problematic if it is exposed
in the public api. See for example #216 - MSVC does not support 128 bit
mp_words. But it is perfectly ok to use those internally in the library,
as long as the library is compiled with GCC.
2019-05-21 15:34:04 +02:00
Daniel Mendler
a8239c2465
deprecate mp_get_bit
...
The return type of mp_get_bit was imprecise (either mp_err or mp_bool),
therefore this function is deprecated in favor of s_mp_get_bit for now.
If we need s_mp_get_bit to be public, we should add it under a different
name. However since mp_set_bit is not available, I don't think there any
downstream users (ab)using mp_int as bitsets.
2019-05-18 10:03:47 +02:00
Daniel Mendler
56e7a40123
deprecate mp_jacobi
2019-05-18 10:03:46 +02:00
Daniel Mendler
89bac3a7a0
deprecate MP_RANGE
2019-05-13 19:15:14 +02:00
Daniel Mendler
4534056c28
use enums mp_err, mp_ord, mp_bool, mp_sign
...
* MP_USE_ENUMS enables enums
* Wc++-compat catches some implicit conversions if MP_USE_ENUMS is defined
* 100% backwards compatible API/ABI if MP_USE_ENUMS is not defined
2019-05-13 19:15:14 +02:00
Francois Perrad
38116079e4
literal suffix
2019-05-13 17:53:10 +02:00
Francois Perrad
2d508723aa
const parameter
2019-05-13 17:53:00 +02:00
Daniel Mendler
7365442ace
No grow necessary in mp_set_int* functions
...
* mp_set_int* always return MP_OKAY
* remove return checks for mp_set_int*
* introduce MP_MIN_PREC
2019-05-12 13:04:45 +02:00
Daniel Mendler
adf9605d6c
add warn_unused_result, found one missing check!
2019-05-11 19:26:58 +02:00
Francois Perrad
cc703a849b
add missing parameter name in prototype
2019-05-11 16:57:04 +02:00
Daniel Mendler
0669e92e78
deprecate mp_prime_random_ex in favor of mp_prime_rand
...
We can use the internal mp_rand generator now, since it generates
numbers which are safe for crypto purposes.
2019-05-11 00:48:48 +02:00
Daniel Mendler
e05215a894
deprecate old macros, deprecate mp_rand_digit
2019-05-09 15:05:47 +02:00
Daniel Mendler
9ddf1e5838
support custom random data source via mp_rand_source
...
* deprecate MP_PRNG_ENABLE_LTM_RNG
* custom mp_rand_source is used always if set, which should be more aligned with user expectations
* use custom source in tune.c
* don't call random number generator once per digit, which is slow
2019-05-08 11:21:10 +02:00
Daniel Mendler
290c28c10e
deprecate PRIME_SIZE in favor of MP_PRIME_SIZE
2019-05-07 09:49:26 +02:00
Daniel Mendler
44d03a6f8b
deprecate LTM_PRIME_* macros in favor of MP_PRIME_*
2019-05-07 09:45:38 +02:00
Daniel Mendler
e2ee39b536
deprecate ltm_prime_callback
2019-05-07 09:36:24 +02:00
Daniel Mendler
80f5fac53b
rename LTM_NO_FILE to MP_NO_FILE
2019-05-07 09:33:56 +02:00
Daniel Mendler
0337d48b67
add MP_NULL_TERMINATED
2019-05-07 09:33:46 +02:00
Daniel Mendler
250751be46
tommath.h: do not expose stdlib.h
2019-05-07 09:32:59 +02:00
Daniel Mendler
818d8fb7f5
Rework handling of tunable cutoffs
...
* In the default settings, a cutoff X can be modified at runtime
by adjusting the corresponding X_CUTOFF variable.
* Tunability of the library can be disabled at compile time
by defining the MP_FIXED_CUTOFFS macro.
* There is an additional file tommath_cutoffs.h, which defines
the default cutoffs. These can be adjusted manually or by the
autotuner.
2019-05-04 13:08:37 +02:00
Daniel Mendler
90eccd5768
prefix private macros by PRIVATE_
2019-04-25 15:36:35 +02:00
Daniel Mendler
632601f405
MP_WARRAY is an internal macro
2019-04-25 13:39:50 +02:00
Daniel Mendler
e45f75fddb
deprecate DIGIT_BIT, use MP_DIGIT_BIT
2019-04-25 13:39:50 +02:00
Daniel Mendler
a8c76138f9
deprecate macros in tommath.h
...
* move MP_DEPRECATED to tommath.h since we need it later
* add MP_DEPRECATED_PRAGMA
2019-04-25 13:39:50 +02:00
Daniel Mendler
87292ed10a
move mp_balance_mul to tommath_private.h
2019-04-12 14:55:09 +02:00
czurnieden
35311aea49
added function mp_ilogb
2019-04-09 21:59:59 +02:00
czurnieden
27ca25cb82
added multiplcation balancing for the Toom-Cook algorithms
2019-04-07 22:15:09 +02:00
Daniel Mendler
ff56140462
shorter headers
2019-04-07 17:26:31 +02:00