diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-03 21:53:29 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-03 21:53:29 +0200 |
| commit | 229d3c467d20bb776edbbb29517df84f09e1e46f (patch) | |
| tree | 59809f057cc9c018109a26cab3dae3fbc20986bd | |
| parent | 636c3b627cc964f65e5b38bb005d50f2841d6966 (diff) | |
| download | busybox-w32-229d3c467d20bb776edbbb29517df84f09e1e46f.tar.gz busybox-w32-229d3c467d20bb776edbbb29517df84f09e1e46f.tar.bz2 busybox-w32-229d3c467d20bb776edbbb29517df84f09e1e46f.zip | |
tls: avoid using int16 in pstm code
function old new delta
pstm_div 1472 1522 +50
psRsaEncryptPub 403 413 +10
pstm_2expt 91 96 +5
pstm_clear 68 72 +4
pstm_init 39 42 +3
pstm_unsigned_bin_size 36 37 +1
pstm_montgomery_reduce 398 399 +1
pstm_init_size 45 46 +1
pstm_zero 39 38 -1
pstm_set 35 34 -1
pstm_read_unsigned_bin 112 109 -3
pstm_mulmod 123 120 -3
pstm_mod 116 113 -3
pstm_cmp 57 54 -3
pstm_sub 107 102 -5
pstm_to_unsigned_bin 157 151 -6
pstm_clamp 63 57 -6
pstm_add 116 108 -8
pstm_grow 81 72 -9
pstm_count_bits 57 48 -9
pstm_init_copy 84 72 -12
pstm_cmp_mag 93 78 -15
pstm_sqr_comba 567 551 -16
pstm_montgomery_calc_normalization 158 140 -18
pstm_copy 115 92 -23
pstm_lshd 133 109 -24
pstm_mul_comba 525 500 -25
pstm_mul_d 251 224 -27
s_pstm_sub 256 228 -28
s_pstm_add 370 337 -33
pstm_div_2d 444 409 -35
pstm_mul_2 195 156 -39
pstm_rshd 154 104 -50
pstm_mul_2d 247 186 -61
pstm_exptmod 1524 1463 -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/27 up/down: 75/-524) Total: -449 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | networking/tls.c | 4 | ||||
| -rw-r--r-- | networking/tls_pstm.c | 76 | ||||
| -rw-r--r-- | networking/tls_pstm.h | 18 |
3 files changed, 49 insertions, 49 deletions
diff --git a/networking/tls.c b/networking/tls.c index bbf2b158f..590c04ad9 100644 --- a/networking/tls.c +++ b/networking/tls.c | |||
| @@ -475,7 +475,7 @@ static void prf_hmac_sha256(/*tls_state_t *tls,*/ | |||
| 475 | uint8_t a[TLS_MAX_MAC_SIZE]; | 475 | uint8_t a[TLS_MAX_MAC_SIZE]; |
| 476 | uint8_t *out_p = outbuf; | 476 | uint8_t *out_p = outbuf; |
| 477 | unsigned label_size = strlen(label); | 477 | unsigned label_size = strlen(label); |
| 478 | unsigned MAC_size = SHA256_OUTSIZE;///tls->MAC_size; | 478 | unsigned MAC_size = SHA256_OUTSIZE; |
| 479 | 479 | ||
| 480 | /* In P_hash() calculation, "seed" is "label + seed": */ | 480 | /* In P_hash() calculation, "seed" is "label + seed": */ |
| 481 | #define SEED label, label_size, seed, seed_size | 481 | #define SEED label, label_size, seed, seed_size |
| @@ -486,7 +486,7 @@ static void prf_hmac_sha256(/*tls_state_t *tls,*/ | |||
| 486 | hmac_sha256(/*tls,*/ a, SECRET, SEED, NULL); | 486 | hmac_sha256(/*tls,*/ a, SECRET, SEED, NULL); |
| 487 | //TODO: convert hmac to precomputed | 487 | //TODO: convert hmac to precomputed |
| 488 | 488 | ||
| 489 | for(;;) { | 489 | for (;;) { |
| 490 | /* HMAC_hash(secret, A(1) + seed) */ | 490 | /* HMAC_hash(secret, A(1) + seed) */ |
| 491 | if (outbuf_size <= MAC_size) { | 491 | if (outbuf_size <= MAC_size) { |
| 492 | /* Last, possibly incomplete, block */ | 492 | /* Last, possibly incomplete, block */ |
diff --git a/networking/tls_pstm.c b/networking/tls_pstm.c index c39a2182d..bd5bae0b7 100644 --- a/networking/tls_pstm.c +++ b/networking/tls_pstm.c | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | //#include "../cryptoApi.h" | 47 | //#include "../cryptoApi.h" |
| 48 | #ifndef DISABLE_PSTM | 48 | #ifndef DISABLE_PSTM |
| 49 | 49 | ||
| 50 | static int32 pstm_mul_2d(pstm_int *a, int16 b, pstm_int *c); | 50 | static int32 pstm_mul_2d(pstm_int *a, int b, pstm_int *c); //bbox: was int16 b |
| 51 | 51 | ||
| 52 | /******************************************************************************/ | 52 | /******************************************************************************/ |
| 53 | /* | 53 | /* |
| @@ -64,7 +64,7 @@ int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) | |||
| 64 | a->dp = xzalloc(sizeof (pstm_digit) * size);//bbox | 64 | a->dp = xzalloc(sizeof (pstm_digit) * size);//bbox |
| 65 | //bbox a->pool = pool; | 65 | //bbox a->pool = pool; |
| 66 | a->used = 0; | 66 | a->used = 0; |
| 67 | a->alloc = (int16)size; | 67 | a->alloc = size; |
| 68 | a->sign = PSTM_ZPOS; | 68 | a->sign = PSTM_ZPOS; |
| 69 | /* | 69 | /* |
| 70 | zero the digits | 70 | zero the digits |
| @@ -111,9 +111,9 @@ int32 pstm_init(psPool_t *pool, pstm_int * a) | |||
| 111 | /* | 111 | /* |
| 112 | Grow as required | 112 | Grow as required |
| 113 | */ | 113 | */ |
| 114 | int32 pstm_grow(pstm_int * a, int16 size) | 114 | int32 pstm_grow(pstm_int * a, int size) |
| 115 | { | 115 | { |
| 116 | int16 i; | 116 | int i; //bbox: was int16 |
| 117 | pstm_digit *tmp; | 117 | pstm_digit *tmp; |
| 118 | 118 | ||
| 119 | /* | 119 | /* |
| @@ -298,7 +298,7 @@ void pstm_zero(pstm_int * a) | |||
| 298 | */ | 298 | */ |
| 299 | int32 pstm_cmp_mag(pstm_int * a, pstm_int * b) | 299 | int32 pstm_cmp_mag(pstm_int * a, pstm_int * b) |
| 300 | { | 300 | { |
| 301 | int16 n; | 301 | int n; //bbox: was int16 |
| 302 | pstm_digit *tmpa, *tmpb; | 302 | pstm_digit *tmpa, *tmpb; |
| 303 | 303 | ||
| 304 | /* | 304 | /* |
| @@ -406,7 +406,7 @@ int32 pstm_read_unsigned_bin(pstm_int *a, unsigned char *b, int32 c) | |||
| 406 | c -= excess; | 406 | c -= excess; |
| 407 | b += excess; | 407 | b += excess; |
| 408 | } | 408 | } |
| 409 | a->used = (int16)((c + sizeof(pstm_digit) - 1)/sizeof(pstm_digit)); | 409 | a->used = ((c + sizeof(pstm_digit) - 1)/sizeof(pstm_digit)); |
| 410 | if (a->alloc < a->used) { | 410 | if (a->alloc < a->used) { |
| 411 | if (pstm_grow(a, a->used) != PSTM_OKAY) { | 411 | if (pstm_grow(a, a->used) != PSTM_OKAY) { |
| 412 | return PSTM_MEM; | 412 | return PSTM_MEM; |
| @@ -460,9 +460,9 @@ int32 pstm_read_unsigned_bin(pstm_int *a, unsigned char *b, int32 c) | |||
| 460 | /******************************************************************************/ | 460 | /******************************************************************************/ |
| 461 | /* | 461 | /* |
| 462 | */ | 462 | */ |
| 463 | int16 pstm_count_bits (pstm_int * a) | 463 | int pstm_count_bits (pstm_int * a) |
| 464 | { | 464 | { |
| 465 | int16 r; | 465 | int r; //bbox: was int16 |
| 466 | pstm_digit q; | 466 | pstm_digit q; |
| 467 | 467 | ||
| 468 | if (a->used == 0) { | 468 | if (a->used == 0) { |
| @@ -500,9 +500,9 @@ void pstm_set(pstm_int *a, pstm_digit b) | |||
| 500 | /* | 500 | /* |
| 501 | Right shift | 501 | Right shift |
| 502 | */ | 502 | */ |
| 503 | void pstm_rshd(pstm_int *a, int16 x) | 503 | void pstm_rshd(pstm_int *a, int x) |
| 504 | { | 504 | { |
| 505 | int16 y; | 505 | int y; //bbox: was int16 |
| 506 | 506 | ||
| 507 | /* too many digits just zero and return */ | 507 | /* too many digits just zero and return */ |
| 508 | if (x >= a->used) { | 508 | if (x >= a->used) { |
| @@ -529,9 +529,9 @@ void pstm_rshd(pstm_int *a, int16 x) | |||
| 529 | /* | 529 | /* |
| 530 | Shift left a certain amount of digits. | 530 | Shift left a certain amount of digits. |
| 531 | */ | 531 | */ |
| 532 | int32 pstm_lshd(pstm_int * a, int16 b) | 532 | int32 pstm_lshd(pstm_int * a, int b) |
| 533 | { | 533 | { |
| 534 | int16 x; | 534 | int x; //bbox: was int16 |
| 535 | int32 res; | 535 | int32 res; |
| 536 | 536 | ||
| 537 | /* | 537 | /* |
| @@ -582,9 +582,9 @@ int32 pstm_lshd(pstm_int * a, int16 b) | |||
| 582 | /* | 582 | /* |
| 583 | computes a = 2**b | 583 | computes a = 2**b |
| 584 | */ | 584 | */ |
| 585 | int32 pstm_2expt(pstm_int *a, int16 b) | 585 | int32 pstm_2expt(pstm_int *a, int b) |
| 586 | { | 586 | { |
| 587 | int16 z; | 587 | int z; //bbox: was int16 |
| 588 | 588 | ||
| 589 | /* zero a as per default */ | 589 | /* zero a as per default */ |
| 590 | pstm_zero (a); | 590 | pstm_zero (a); |
| @@ -619,7 +619,7 @@ int32 pstm_2expt(pstm_int *a, int16 b) | |||
| 619 | int32 pstm_mul_2(pstm_int * a, pstm_int * b) | 619 | int32 pstm_mul_2(pstm_int * a, pstm_int * b) |
| 620 | { | 620 | { |
| 621 | int32 res; | 621 | int32 res; |
| 622 | int16 x, oldused; | 622 | int x, oldused; //bbox: was int16 |
| 623 | 623 | ||
| 624 | /* | 624 | /* |
| 625 | grow to accomodate result | 625 | grow to accomodate result |
| @@ -684,7 +684,7 @@ int32 pstm_mul_2(pstm_int * a, pstm_int * b) | |||
| 684 | */ | 684 | */ |
| 685 | int32 s_pstm_sub(pstm_int *a, pstm_int *b, pstm_int *c) | 685 | int32 s_pstm_sub(pstm_int *a, pstm_int *b, pstm_int *c) |
| 686 | { | 686 | { |
| 687 | int16 oldbused, oldused; | 687 | int oldbused, oldused; //bbox: was int16 |
| 688 | int32 x; | 688 | int32 x; |
| 689 | pstm_word t; | 689 | pstm_word t; |
| 690 | 690 | ||
| @@ -724,7 +724,7 @@ int32 s_pstm_sub(pstm_int *a, pstm_int *b, pstm_int *c) | |||
| 724 | */ | 724 | */ |
| 725 | static int32 s_pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) | 725 | static int32 s_pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) |
| 726 | { | 726 | { |
| 727 | int16 x, y, oldused; | 727 | int x, y, oldused; //bbox: was int16 |
| 728 | register pstm_word t, adp, bdp; | 728 | register pstm_word t, adp, bdp; |
| 729 | 729 | ||
| 730 | y = a->used; | 730 | y = a->used; |
| @@ -781,8 +781,8 @@ static int32 s_pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) | |||
| 781 | */ | 781 | */ |
| 782 | int32 pstm_sub(pstm_int *a, pstm_int *b, pstm_int *c) | 782 | int32 pstm_sub(pstm_int *a, pstm_int *b, pstm_int *c) |
| 783 | { | 783 | { |
| 784 | int32 res; | 784 | int32 res; |
| 785 | int16 sa, sb; | 785 | int sa, sb; //bbox: was int16 |
| 786 | 786 | ||
| 787 | sa = a->sign; | 787 | sa = a->sign; |
| 788 | sb = b->sign; | 788 | sb = b->sign; |
| @@ -881,7 +881,7 @@ int32 pstm_montgomery_setup(pstm_int *a, pstm_digit *rho) | |||
| 881 | int32 pstm_montgomery_calc_normalization(pstm_int *a, pstm_int *b) | 881 | int32 pstm_montgomery_calc_normalization(pstm_int *a, pstm_int *b) |
| 882 | { | 882 | { |
| 883 | int32 x; | 883 | int32 x; |
| 884 | int16 bits; | 884 | int bits; //bbox: was int16 |
| 885 | 885 | ||
| 886 | /* how many bits of last digit does b use */ | 886 | /* how many bits of last digit does b use */ |
| 887 | bits = pstm_count_bits (b) % DIGIT_BIT; | 887 | bits = pstm_count_bits (b) % DIGIT_BIT; |
| @@ -916,10 +916,10 @@ int32 pstm_montgomery_calc_normalization(pstm_int *a, pstm_int *b) | |||
| 916 | /* | 916 | /* |
| 917 | c = a * 2**d | 917 | c = a * 2**d |
| 918 | */ | 918 | */ |
| 919 | static int32 pstm_mul_2d(pstm_int *a, int16 b, pstm_int *c) | 919 | static int32 pstm_mul_2d(pstm_int *a, int b, pstm_int *c) |
| 920 | { | 920 | { |
| 921 | pstm_digit carry, carrytmp, shift; | 921 | pstm_digit carry, carrytmp, shift; |
| 922 | int16 x; | 922 | int x; //bbox: was int16 |
| 923 | 923 | ||
| 924 | /* copy it */ | 924 | /* copy it */ |
| 925 | if (pstm_copy(a, c) != PSTM_OKAY) { | 925 | if (pstm_copy(a, c) != PSTM_OKAY) { |
| @@ -961,9 +961,9 @@ static int32 pstm_mul_2d(pstm_int *a, int16 b, pstm_int *c) | |||
| 961 | /* | 961 | /* |
| 962 | c = a mod 2**d | 962 | c = a mod 2**d |
| 963 | */ | 963 | */ |
| 964 | static int32 pstm_mod_2d(pstm_int *a, int16 b, pstm_int *c) | 964 | static int32 pstm_mod_2d(pstm_int *a, int b, pstm_int *c) //bbox: was int16 b |
| 965 | { | 965 | { |
| 966 | int16 x; | 966 | int x; //bbox: was int16 |
| 967 | 967 | ||
| 968 | /* zero if count less than or equal to zero */ | 968 | /* zero if count less than or equal to zero */ |
| 969 | if (b <= 0) { | 969 | if (b <= 0) { |
| @@ -1001,7 +1001,7 @@ int32 pstm_mul_d(pstm_int *a, pstm_digit b, pstm_int *c) | |||
| 1001 | { | 1001 | { |
| 1002 | pstm_word w; | 1002 | pstm_word w; |
| 1003 | int32 res; | 1003 | int32 res; |
| 1004 | int16 x, oldused; | 1004 | int x, oldused; //bbox: was int16 |
| 1005 | 1005 | ||
| 1006 | if (c->alloc < a->used + 1) { | 1006 | if (c->alloc < a->used + 1) { |
| 1007 | if ((res = pstm_grow (c, a->used + 1)) != PSTM_OKAY) { | 1007 | if ((res = pstm_grow (c, a->used + 1)) != PSTM_OKAY) { |
| @@ -1032,12 +1032,12 @@ int32 pstm_mul_d(pstm_int *a, pstm_digit b, pstm_int *c) | |||
| 1032 | /* | 1032 | /* |
| 1033 | c = a / 2**b | 1033 | c = a / 2**b |
| 1034 | */ | 1034 | */ |
| 1035 | int32 pstm_div_2d(psPool_t *pool, pstm_int *a, int16 b, pstm_int *c, | 1035 | int32 pstm_div_2d(psPool_t *pool, pstm_int *a, int b, pstm_int *c, |
| 1036 | pstm_int *d) | 1036 | pstm_int *d) |
| 1037 | { | 1037 | { |
| 1038 | pstm_digit D, r, rr; | 1038 | pstm_digit D, r, rr; |
| 1039 | int32 res; | 1039 | int32 res; |
| 1040 | int16 x; | 1040 | int x; //bbox: was int16 |
| 1041 | pstm_int t; | 1041 | pstm_int t; |
| 1042 | 1042 | ||
| 1043 | /* if the shift count is <= 0 then we do no work */ | 1043 | /* if the shift count is <= 0 then we do no work */ |
| @@ -1120,7 +1120,7 @@ LBL_DONE: | |||
| 1120 | */ | 1120 | */ |
| 1121 | int32 pstm_div_2(pstm_int * a, pstm_int * b) | 1121 | int32 pstm_div_2(pstm_int * a, pstm_int * b) |
| 1122 | { | 1122 | { |
| 1123 | int16 x, oldused; | 1123 | int x, oldused; //bbox: was int16 |
| 1124 | 1124 | ||
| 1125 | if (b->alloc < a->used) { | 1125 | if (b->alloc < a->used) { |
| 1126 | if (pstm_grow(b, a->used) != PSTM_OKAY) { | 1126 | if (pstm_grow(b, a->used) != PSTM_OKAY) { |
| @@ -1166,9 +1166,9 @@ int32 pstm_div_2(pstm_int * a, pstm_int * b) | |||
| 1166 | /* | 1166 | /* |
| 1167 | Creates "a" then copies b into it | 1167 | Creates "a" then copies b into it |
| 1168 | */ | 1168 | */ |
| 1169 | int32 pstm_init_copy(psPool_t *pool, pstm_int * a, pstm_int * b, int16 toSqr) | 1169 | int32 pstm_init_copy(psPool_t *pool, pstm_int * a, pstm_int * b, int toSqr) |
| 1170 | { | 1170 | { |
| 1171 | int16 x; | 1171 | int x; //bbox: was int16 |
| 1172 | int32 res; | 1172 | int32 res; |
| 1173 | 1173 | ||
| 1174 | if (a == b) { | 1174 | if (a == b) { |
| @@ -1279,7 +1279,7 @@ int32 pstm_div(psPool_t *pool, pstm_int *a, pstm_int *b, pstm_int *c, | |||
| 1279 | { | 1279 | { |
| 1280 | pstm_int q, x, y, t1, t2; | 1280 | pstm_int q, x, y, t1, t2; |
| 1281 | int32 res; | 1281 | int32 res; |
| 1282 | int16 n, t, i, norm, neg; | 1282 | int n, t, i, norm, neg; //bbox: was int16 |
| 1283 | 1283 | ||
| 1284 | /* is divisor zero ? */ | 1284 | /* is divisor zero ? */ |
| 1285 | if (pstm_iszero (b) == 1) { | 1285 | if (pstm_iszero (b) == 1) { |
| @@ -1531,7 +1531,7 @@ int32 pstm_mulmod(psPool_t *pool, pstm_int *a, pstm_int *b, pstm_int *c, | |||
| 1531 | pstm_int *d) | 1531 | pstm_int *d) |
| 1532 | { | 1532 | { |
| 1533 | int32 res; | 1533 | int32 res; |
| 1534 | int16 size; | 1534 | int size; //bbox: was int16 |
| 1535 | pstm_int tmp; | 1535 | pstm_int tmp; |
| 1536 | 1536 | ||
| 1537 | /* | 1537 | /* |
| @@ -1567,7 +1567,7 @@ int32 pstm_exptmod(psPool_t *pool, pstm_int *G, pstm_int *X, pstm_int *P, | |||
| 1567 | pstm_digit buf, mp; | 1567 | pstm_digit buf, mp; |
| 1568 | pstm_digit *paD; | 1568 | pstm_digit *paD; |
| 1569 | int32 err, bitbuf; | 1569 | int32 err, bitbuf; |
| 1570 | int16 bitcpy, bitcnt, mode, digidx, x, y, winsize; | 1570 | int bitcpy, bitcnt, mode, digidx, x, y, winsize; //bbox: was int16 |
| 1571 | uint32 paDlen; | 1571 | uint32 paDlen; |
| 1572 | 1572 | ||
| 1573 | /* set window size from what user set as optimization */ | 1573 | /* set window size from what user set as optimization */ |
| @@ -1804,7 +1804,7 @@ LBL_RES:pstm_clear(&res); | |||
| 1804 | int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) | 1804 | int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) |
| 1805 | { | 1805 | { |
| 1806 | int32 res; | 1806 | int32 res; |
| 1807 | int16 sa, sb; | 1807 | int sa, sb; //bbox: was int16 |
| 1808 | 1808 | ||
| 1809 | /* get sign of both inputs */ | 1809 | /* get sign of both inputs */ |
| 1810 | sa = a->sign; | 1810 | sa = a->sign; |
| @@ -1817,7 +1817,7 @@ int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) | |||
| 1817 | if ((res = s_pstm_add (a, b, c)) != PSTM_OKAY) { | 1817 | if ((res = s_pstm_add (a, b, c)) != PSTM_OKAY) { |
| 1818 | return res; | 1818 | return res; |
| 1819 | } | 1819 | } |
| 1820 | } else { | 1820 | } else { |
| 1821 | /* | 1821 | /* |
| 1822 | one positive, the other negative | 1822 | one positive, the other negative |
| 1823 | subtract the one with the greater magnitude from the one of the lesser | 1823 | subtract the one with the greater magnitude from the one of the lesser |
| @@ -1842,7 +1842,7 @@ int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c) | |||
| 1842 | /* | 1842 | /* |
| 1843 | reverse an array, used for radix code | 1843 | reverse an array, used for radix code |
| 1844 | */ | 1844 | */ |
| 1845 | static void pstm_reverse (unsigned char *s, int16 len) | 1845 | static void pstm_reverse (unsigned char *s, int len) //bbox: was int16 len |
| 1846 | { | 1846 | { |
| 1847 | int32 ix, iy; | 1847 | int32 ix, iy; |
| 1848 | unsigned char t; | 1848 | unsigned char t; |
| @@ -1865,7 +1865,7 @@ static void pstm_reverse (unsigned char *s, int16 len) | |||
| 1865 | int32 pstm_to_unsigned_bin_nr(psPool_t *pool, pstm_int *a, unsigned char *b) | 1865 | int32 pstm_to_unsigned_bin_nr(psPool_t *pool, pstm_int *a, unsigned char *b) |
| 1866 | { | 1866 | { |
| 1867 | int32 res; | 1867 | int32 res; |
| 1868 | int16 x; | 1868 | int x; //bbox: was int16 |
| 1869 | pstm_int t = { 0 }; | 1869 | pstm_int t = { 0 }; |
| 1870 | 1870 | ||
| 1871 | if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY) { | 1871 | if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY) { |
| @@ -1890,7 +1890,7 @@ int32 pstm_to_unsigned_bin_nr(psPool_t *pool, pstm_int *a, unsigned char *b) | |||
| 1890 | int32 pstm_to_unsigned_bin(psPool_t *pool, pstm_int *a, unsigned char *b) | 1890 | int32 pstm_to_unsigned_bin(psPool_t *pool, pstm_int *a, unsigned char *b) |
| 1891 | { | 1891 | { |
| 1892 | int32 res; | 1892 | int32 res; |
| 1893 | int16 x; | 1893 | int x; //bbox: was int16 |
| 1894 | pstm_int t = { 0 }; | 1894 | pstm_int t = { 0 }; |
| 1895 | 1895 | ||
| 1896 | if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY) { | 1896 | if ((res = pstm_init_copy(pool, &t, a, 0)) != PSTM_OKAY) { |
diff --git a/networking/tls_pstm.h b/networking/tls_pstm.h index 3a0fd8ce6..df705adce 100644 --- a/networking/tls_pstm.h +++ b/networking/tls_pstm.h | |||
| @@ -122,7 +122,7 @@ | |||
| 122 | #define PSTM_MAX_SIZE 4096 | 122 | #define PSTM_MAX_SIZE 4096 |
| 123 | 123 | ||
| 124 | typedef struct { | 124 | typedef struct { |
| 125 | int16 used, alloc, sign; | 125 | int used, alloc, sign; //bbox: was int16 |
| 126 | pstm_digit *dp; | 126 | pstm_digit *dp; |
| 127 | //bbox psPool_t *pool; | 127 | //bbox psPool_t *pool; |
| 128 | } pstm_int; | 128 | } pstm_int; |
| @@ -154,9 +154,9 @@ extern int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size); | |||
| 154 | #define pstm_init_copy(pool, a, b, toSqr) \ | 154 | #define pstm_init_copy(pool, a, b, toSqr) \ |
| 155 | pstm_init_copy( a, b, toSqr) | 155 | pstm_init_copy( a, b, toSqr) |
| 156 | extern int32 pstm_init_copy(psPool_t *pool, pstm_int * a, pstm_int * b, | 156 | extern int32 pstm_init_copy(psPool_t *pool, pstm_int * a, pstm_int * b, |
| 157 | int16 toSqr); | 157 | int toSqr); //bbox: was int16 toSqr |
| 158 | 158 | ||
| 159 | extern int16 pstm_count_bits (pstm_int * a); | 159 | extern int pstm_count_bits (pstm_int * a); //bbox: was returning int16 |
| 160 | 160 | ||
| 161 | //bbox: pool unused | 161 | //bbox: pool unused |
| 162 | #define pstm_init_for_read_unsigned_bin(pool, a, len) \ | 162 | #define pstm_init_for_read_unsigned_bin(pool, a, len) \ |
| @@ -178,7 +178,7 @@ extern void pstm_clear_multi(pstm_int *mp0, pstm_int *mp1, pstm_int *mp2, | |||
| 178 | pstm_int *mp3, pstm_int *mp4, pstm_int *mp5, pstm_int *mp6, | 178 | pstm_int *mp3, pstm_int *mp4, pstm_int *mp5, pstm_int *mp6, |
| 179 | pstm_int *mp7); | 179 | pstm_int *mp7); |
| 180 | 180 | ||
| 181 | extern int32 pstm_grow(pstm_int * a, int16 size); | 181 | extern int32 pstm_grow(pstm_int * a, int size); //bbox: was int16 size |
| 182 | 182 | ||
| 183 | extern void pstm_clamp(pstm_int * a); | 183 | extern void pstm_clamp(pstm_int * a); |
| 184 | 184 | ||
| @@ -186,9 +186,9 @@ extern int32 pstm_cmp(pstm_int * a, pstm_int * b); | |||
| 186 | 186 | ||
| 187 | extern int32 pstm_cmp_mag(pstm_int * a, pstm_int * b); | 187 | extern int32 pstm_cmp_mag(pstm_int * a, pstm_int * b); |
| 188 | 188 | ||
| 189 | extern void pstm_rshd(pstm_int *a, int16 x); | 189 | extern void pstm_rshd(pstm_int *a, int x); //bbox: was int16 x |
| 190 | 190 | ||
| 191 | extern int32 pstm_lshd(pstm_int * a, int16 b); | 191 | extern int32 pstm_lshd(pstm_int * a, int b); //bbox: was int16 b |
| 192 | 192 | ||
| 193 | //bbox: pool unused | 193 | //bbox: pool unused |
| 194 | #define pstm_div(pool, a, b, c, d) \ | 194 | #define pstm_div(pool, a, b, c, d) \ |
| @@ -199,8 +199,8 @@ extern int32 pstm_div(psPool_t *pool, pstm_int *a, pstm_int *b, pstm_int *c, | |||
| 199 | //bbox: pool unused | 199 | //bbox: pool unused |
| 200 | #define pstm_div_2d(pool, a, b, c, d) \ | 200 | #define pstm_div_2d(pool, a, b, c, d) \ |
| 201 | pstm_div_2d( a, b, c, d) | 201 | pstm_div_2d( a, b, c, d) |
| 202 | extern int32 pstm_div_2d(psPool_t *pool, pstm_int *a, int16 b, pstm_int *c, | 202 | extern int32 pstm_div_2d(psPool_t *pool, pstm_int *a, int b, pstm_int *c, |
| 203 | pstm_int *d); | 203 | pstm_int *d); //bbox: was int16 b |
| 204 | 204 | ||
| 205 | extern int32 pstm_div_2(pstm_int * a, pstm_int * b); | 205 | extern int32 pstm_div_2(pstm_int * a, pstm_int * b); |
| 206 | 206 | ||
| @@ -232,7 +232,7 @@ extern int32 pstm_mulmod(psPool_t *pool, pstm_int *a, pstm_int *b, pstm_int *c, | |||
| 232 | extern int32 pstm_exptmod(psPool_t *pool, pstm_int *G, pstm_int *X, pstm_int *P, | 232 | extern int32 pstm_exptmod(psPool_t *pool, pstm_int *G, pstm_int *X, pstm_int *P, |
| 233 | pstm_int *Y); | 233 | pstm_int *Y); |
| 234 | 234 | ||
| 235 | extern int32 pstm_2expt(pstm_int *a, int16 b); | 235 | extern int32 pstm_2expt(pstm_int *a, int b); //bbox: was int16 b |
| 236 | 236 | ||
| 237 | extern int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c); | 237 | extern int32 pstm_add(pstm_int *a, pstm_int *b, pstm_int *c); |
| 238 | 238 | ||
