Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch libtommath-no-stdint.h Excluding Merge-Ins
This is equivalent to a diff from 354511454d to 122f576e90
|
2023-09-13
| ||
| 12:35 | Fix [a1f11d96b8]: VC6 compilation error of core-8-6-branch: error C2065: 'int16_t' : undeclared iden... check-in: 16bd24dc0d user: jan.nijtmans tags: core-8-6-branch | |
| 12:31 | Don't use int16_t, pre-C99 Closed-Leaf check-in: 122f576e90 user: jan.nijtmans tags: libtommath-no-stdint.h | |
|
2023-09-04
| ||
| 20:18 | Merge libtommath check-in: 51fa501391 user: jan.nijtmans tags: libtommath-no-stdint.h | |
| 20:14 | libtommath -> version 1.2.1 Closed-Leaf check-in: 354511454d user: jan.nijtmans tags: libtommath | |
|
2019-11-22
| ||
| 12:38 | Take over recent commmits on the support/1.x branch check-in: 37af21de0b user: jan.nijtmans tags: libtommath | |
Changes to libtommath/bn_deprecated.c.
| ︙ | |||
215 216 217 218 219 220 221 | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - + - + |
#ifdef BN_MP_N_ROOT_EX_C
mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
{
(void)fast;
if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
return MP_VAL;
}
|
| ︙ |
Changes to libtommath/bn_mp_expt_u32.c.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + | #include "tommath_private.h" #ifdef BN_MP_EXPT_U32_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* calculate c = a**b using a square-multiply algorithm */ |
| ︙ |
Changes to libtommath/bn_mp_log_u32.c.
| ︙ | |||
66 67 68 69 70 71 72 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - + - + |
return ret;
}
/* TODO: output could be "int" because the output of mp_radix_size is int, too,
as is the output of mp_bitcount.
With the same problem: max size is INT_MAX * MP_DIGIT not INT_MAX only!
*/
|
| ︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + - + |
/* A small shortcut for bases that are powers of two. */
if ((base & (base - 1u)) == 0u) {
int y, bit_count;
for (y=0; (y < 7) && ((base & 1u) == 0u); y++) {
base >>= 1;
}
bit_count = mp_count_bits(a) - 1;
|
| ︙ | |||
142 143 144 145 146 147 148 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | - + |
}
}
mp_set(&bi_base, base);
while ((high - low) > 1u) {
mid = (high + low) >> 1;
|
| ︙ |
Changes to libtommath/bn_mp_radix_smap.c.
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - + | #include "tommath_private.h" #ifdef BN_MP_RADIX_SMAP_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* chars used in radix conversions */ const char *const mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; |
| ︙ |
Changes to libtommath/bn_mp_root_u32.c.
| ︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | * Result found such that (c)**b <= a and (c+1)**b > a * * This algorithm uses Newton's approximation * x[i+1] = x[i] - f(x[i])/f'(x[i]) * which will find the root in log(N) time where * each step involves a fair bit. */ |
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + |
ilog2 = mp_count_bits(a);
/*
If "b" is larger than INT_MAX it is also larger than
log_2(n) because the bit-length of the "n" is measured
with an int and hence the root is always < 2 (two).
*/
|
| ︙ |
Changes to libtommath/tommath.h.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + - + + | /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #ifndef BN_H_ #define BN_H_ #ifndef MP_NO_STDINT |
| ︙ | |||
26 27 28 29 30 31 32 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + |
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */
|
| ︙ | |||
62 63 64 65 66 67 68 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - - + + - - + + - + - - + + | * A "mp_word" must be able to hold 2*MP_DIGIT_BIT + 1 bits * * At the very least a mp_digit must be able to hold 7 bits * [any size beyond that is ok provided it doesn't overflow the data type] */ #ifdef MP_8BIT |
| ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | + | void mp_zero(mp_int *a); /* get and set doubles */ double mp_get_double(const mp_int *a) MP_WUR; mp_err mp_set_double(mp_int *a, double b) MP_WUR; /* get integer, set integer and init with integer (int32_t) */ #ifndef MP_NO_STDINT int32_t mp_get_i32(const mp_int *a) MP_WUR; void mp_set_i32(mp_int *a, int32_t b); mp_err mp_init_i32(mp_int *a, int32_t b) MP_WUR; /* get integer, set integer and init with integer, behaves like two complement for negative numbers (uint32_t) */ #define mp_get_u32(a) ((uint32_t)mp_get_i32(a)) void mp_set_u32(mp_int *a, uint32_t b); |
| ︙ | |||
329 330 331 332 333 334 335 336 337 338 339 340 341 342 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | + | #define mp_get_u64(a) ((uint64_t)mp_get_i64(a)) void mp_set_u64(mp_int *a, uint64_t b); mp_err mp_init_u64(mp_int *a, uint64_t b) MP_WUR; /* get magnitude */ uint32_t mp_get_mag_u32(const mp_int *a) MP_WUR; uint64_t mp_get_mag_u64(const mp_int *a) MP_WUR; #endif unsigned long mp_get_mag_ul(const mp_int *a) MP_WUR; unsigned long long mp_get_mag_ull(const mp_int *a) MP_WUR; /* get integer, set integer (long) */ long mp_get_l(const mp_int *a) MP_WUR; void mp_set_l(mp_int *a, long b); mp_err mp_init_l(mp_int *a, long b) MP_WUR; |
| ︙ | |||
559 560 561 562 563 564 565 | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - + | /* c = [a, b] or (a*b)/(a, b) */ mp_err mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* finds one of the b'th root of a, such that |c|**b <= |a| * * returns error if a < 0 and b is even */ |
| ︙ | |||
722 723 724 725 726 727 728 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | - + - + |
*
*/
MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags,
private_mp_prime_callback cb, void *dat) MP_WUR;
mp_err mp_prime_rand(mp_int *a, int t, int size, int flags) MP_WUR;
/* Integer logarithm to integer base */
|
| ︙ |
Changes to libtommath/tommath_private.h.
| ︙ | |||
208 209 210 211 212 213 214 215 216 217 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | + + - + | MP_PRIVATE mp_err s_mp_rand_platform(void *p, size_t n) MP_WUR; MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat); MP_PRIVATE void s_mp_reverse(unsigned char *s, size_t len); MP_PRIVATE mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result); /* TODO: jenkins prng is not thread safe as of now */ MP_PRIVATE mp_err s_mp_rand_jenkins(void *p, size_t n) MP_WUR; #ifndef MP_NO_STDINT MP_PRIVATE void s_mp_rand_jenkins_init(uint64_t seed); #endif extern MP_PRIVATE const char *const mp_s_rmap; |
| ︙ | |||
238 239 240 241 242 243 244 | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | - + |
MP_DEPRECATED(s_mp_karatsuba_sqr) mp_err mp_karatsuba_sqr(const mp_int *a, mp_int *b);
MP_DEPRECATED(s_mp_toom_mul) mp_err mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
MP_DEPRECATED(s_mp_toom_sqr) mp_err mp_toom_sqr(const mp_int *a, mp_int *b);
MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
#define MP_GET_ENDIANNESS(x) \
do{\
|
| ︙ |