diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-19 15:51:00 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-19 15:51:00 +0100 |
commit | 6b1b004845ebec194c4d4868d3deb57f22711b19 (patch) | |
tree | 291b2cf65b5537a184369eabec0089420ed63930 /networking/tls_pstm.c | |
parent | 1bfc4b85a7915210936edc62ecf0d01a17751222 (diff) | |
download | busybox-w32-6b1b004845ebec194c4d4868d3deb57f22711b19.tar.gz busybox-w32-6b1b004845ebec194c4d4868d3deb57f22711b19.tar.bz2 busybox-w32-6b1b004845ebec194c4d4868d3deb57f22711b19.zip |
tls: commented out psPool_t use
function old new delta
psAesEncrypt 159 162 +3
der_binary_to_pstm 42 40 -2
xwrite_and_hash 437 434 -3
xread_tls_block 446 443 -3
pstm_div_2d 449 444 -5
psAesDecrypt 179 174 -5
pstm_init_size 52 45 -7
pstm_init 46 39 -7
pstm_to_unsigned_bin 165 157 -8
tls_main 1265 1256 -9
pstm_mulmod 132 123 -9
pstm_mod 125 116 -9
pstm_init_copy 93 84 -9
psAesInitKey 840 825 -15
send_client_key_exchange 362 342 -20
psAesInit 103 80 -23
psRsaEncryptPub 429 403 -26
psAesDecryptBlock 1211 1184 -27
psAesEncryptBlock 1223 1193 -30
pstm_exptmod 1582 1524 -58
pstm_div 1557 1472 -85
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/20 up/down: 3/-360) Total: -357 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tls_pstm.c')
-rw-r--r-- | networking/tls_pstm.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/networking/tls_pstm.c b/networking/tls_pstm.c index f802baa15..acd800307 100644 --- a/networking/tls_pstm.c +++ b/networking/tls_pstm.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include "tls.h" | 6 | #include "tls.h" |
7 | 7 | ||
8 | /* The file is taken almost verbatim from matrixssl-3-7-2b-open/crypto/math/. | 8 | /* The file is taken almost verbatim from matrixssl-3-7-2b-open/crypto/math/. |
9 | * Changes are flagged with ///bbox | 9 | * Changes are flagged with //bbox |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /** | 12 | /** |
@@ -43,7 +43,7 @@ | |||
43 | */ | 43 | */ |
44 | /******************************************************************************/ | 44 | /******************************************************************************/ |
45 | 45 | ||
46 | ///bbox | 46 | //bbox |
47 | //#include "../cryptoApi.h" | 47 | //#include "../cryptoApi.h" |
48 | #ifndef DISABLE_PSTM | 48 | #ifndef DISABLE_PSTM |
49 | 49 | ||
@@ -55,21 +55,21 @@ static int32 pstm_mul_2d(pstm_int *a, int16 b, pstm_int *c); | |||
55 | */ | 55 | */ |
56 | int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) | 56 | int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) |
57 | { | 57 | { |
58 | ///bbox | 58 | //bbox |
59 | // uint16 x; | 59 | // uint16 x; |
60 | 60 | ||
61 | /* | 61 | /* |
62 | alloc mem | 62 | alloc mem |
63 | */ | 63 | */ |
64 | a->dp = xzalloc(sizeof (pstm_digit) * size);///bbox | 64 | a->dp = xzalloc(sizeof (pstm_digit) * size);//bbox |
65 | a->pool = pool; | 65 | //bbox a->pool = pool; |
66 | a->used = 0; | 66 | a->used = 0; |
67 | a->alloc = (int16)size; | 67 | a->alloc = (int16)size; |
68 | a->sign = PSTM_ZPOS; | 68 | a->sign = PSTM_ZPOS; |
69 | /* | 69 | /* |
70 | zero the digits | 70 | zero the digits |
71 | */ | 71 | */ |
72 | ///bbox | 72 | //bbox |
73 | // for (x = 0; x < size; x++) { | 73 | // for (x = 0; x < size; x++) { |
74 | // a->dp[x] = 0; | 74 | // a->dp[x] = 0; |
75 | // } | 75 | // } |
@@ -82,16 +82,16 @@ int32 pstm_init_size(psPool_t *pool, pstm_int * a, uint32 size) | |||
82 | */ | 82 | */ |
83 | int32 pstm_init(psPool_t *pool, pstm_int * a) | 83 | int32 pstm_init(psPool_t *pool, pstm_int * a) |
84 | { | 84 | { |
85 | ///bbox | 85 | //bbox |
86 | // int32 i; | 86 | // int32 i; |
87 | /* | 87 | /* |
88 | allocate memory required and clear it | 88 | allocate memory required and clear it |
89 | */ | 89 | */ |
90 | a->dp = xzalloc(sizeof (pstm_digit) * PSTM_DEFAULT_INIT);///bbox | 90 | a->dp = xzalloc(sizeof (pstm_digit) * PSTM_DEFAULT_INIT);//bbox |
91 | /* | 91 | /* |
92 | set the digits to zero | 92 | set the digits to zero |
93 | */ | 93 | */ |
94 | ///bbox | 94 | //bbox |
95 | // for (i = 0; i < PSTM_DEFAULT_INIT; i++) { | 95 | // for (i = 0; i < PSTM_DEFAULT_INIT; i++) { |
96 | // a->dp[i] = 0; | 96 | // a->dp[i] = 0; |
97 | // } | 97 | // } |
@@ -99,7 +99,7 @@ int32 pstm_init(psPool_t *pool, pstm_int * a) | |||
99 | set the used to zero, allocated digits to the default precision and sign | 99 | set the used to zero, allocated digits to the default precision and sign |
100 | to positive | 100 | to positive |
101 | */ | 101 | */ |
102 | a->pool = pool; | 102 | //bbox a->pool = pool; |
103 | a->used = 0; | 103 | a->used = 0; |
104 | a->alloc = PSTM_DEFAULT_INIT; | 104 | a->alloc = PSTM_DEFAULT_INIT; |
105 | a->sign = PSTM_ZPOS; | 105 | a->sign = PSTM_ZPOS; |
@@ -126,7 +126,7 @@ int32 pstm_grow(pstm_int * a, int16 size) | |||
126 | We store the return in a temporary variable in case the operation | 126 | We store the return in a temporary variable in case the operation |
127 | failed we don't want to overwrite the dp member of a. | 127 | failed we don't want to overwrite the dp member of a. |
128 | */ | 128 | */ |
129 | tmp = xrealloc(a->dp, sizeof (pstm_digit) * size);///bbox | 129 | tmp = xrealloc(a->dp, sizeof (pstm_digit) * size);//bbox |
130 | /* | 130 | /* |
131 | reallocation succeeded so set a->dp | 131 | reallocation succeeded so set a->dp |
132 | */ | 132 | */ |
@@ -1622,7 +1622,7 @@ int32 pstm_exptmod(psPool_t *pool, pstm_int *G, pstm_int *X, pstm_int *P, | |||
1622 | Pre-allocated digit. Used for mul, sqr, AND reduce | 1622 | Pre-allocated digit. Used for mul, sqr, AND reduce |
1623 | */ | 1623 | */ |
1624 | paDlen = ((M[1].used + 3) * 2) * sizeof(pstm_digit); | 1624 | paDlen = ((M[1].used + 3) * 2) * sizeof(pstm_digit); |
1625 | paD = xzalloc(paDlen);///bbox | 1625 | paD = xzalloc(paDlen);//bbox |
1626 | /* | 1626 | /* |
1627 | compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times | 1627 | compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times |
1628 | */ | 1628 | */ |
@@ -1941,6 +1941,9 @@ int32 pstm_cmp_d(pstm_int *a, pstm_digit b) | |||
1941 | in cases where dQ > dP. The values must be switched and a new qP must be | 1941 | in cases where dQ > dP. The values must be switched and a new qP must be |
1942 | calculated using this function | 1942 | calculated using this function |
1943 | */ | 1943 | */ |
1944 | //bbox: pool unused | ||
1945 | #define pstm_invmod_slow(pool, a, b, c) \ | ||
1946 | pstm_invmod_slow( a, b, c) | ||
1944 | static int32 pstm_invmod_slow(psPool_t *pool, pstm_int * a, pstm_int * b, | 1947 | static int32 pstm_invmod_slow(psPool_t *pool, pstm_int * a, pstm_int * b, |
1945 | pstm_int * c) | 1948 | pstm_int * c) |
1946 | { | 1949 | { |