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>
This commit is contained in:
Denys Vlasenko
2017-01-19 15:51:00 +01:00
parent 1bfc4b85a7
commit 6b1b004845
10 changed files with 122 additions and 69 deletions

View File

@@ -8,12 +8,12 @@
/* The code below is taken from parts of
* matrixssl-3-7-2b-open/crypto/pubkey/pkcs.c
* matrixssl-3-7-2b-open/crypto/pubkey/rsa.c
* and (so far) almost not modified. Changes are flagged with ///bbox
* and (so far) almost not modified. Changes are flagged with //bbox
*/
#define pkcs1Pad(in, inlen, out, outlen, cryptType, userPtr) \
pkcs1Pad(in, inlen, out, outlen, cryptType)
static ///bbox
static //bbox
int32 pkcs1Pad(unsigned char *in, uint32 inlen, unsigned char *out,
uint32 outlen, int32 cryptType, void *userPtr)
{
@@ -57,8 +57,8 @@ int32 pkcs1Pad(unsigned char *in, uint32 inlen, unsigned char *out,
}
#define psRsaCrypt(pool, in, inlen, out, outlen, key, type, data) \
psRsaCrypt(pool, in, inlen, out, outlen, key, type)
static ///bbox
psRsaCrypt( in, inlen, out, outlen, key, type)
static //bbox
int32 psRsaCrypt(psPool_t *pool, const unsigned char *in, uint32 inlen,
unsigned char *out, uint32 *outlen, psRsaKey_t *key, int32 type,
void *data)
@@ -67,10 +67,11 @@ int32 psRsaCrypt(psPool_t *pool, const unsigned char *in, uint32 inlen,
int32 res;
uint32 x;
if (in == NULL || out == NULL || outlen == NULL || key == NULL) {
psTraceCrypto("NULL parameter error in psRsaCrypt\n");
return PS_ARG_FAIL;
}
//bbox
// if (in == NULL || out == NULL || outlen == NULL || key == NULL) {
// psTraceCrypto("NULL parameter error in psRsaCrypt\n");
// return PS_ARG_FAIL;
// }
tmp.dp = tmpa.dp = tmpb.dp = NULL;
@@ -187,7 +188,8 @@ int32 psRsaEncryptPub(psPool_t *pool, psRsaKey_t *key,
size = key->size;
if (outlen < size) {
psTraceCrypto("Error on bad outlen parameter to psRsaEncryptPub: outlen:%d < size:%d", outlen, size);
//bbox psTraceCrypto("Error on bad outlen parameter to psRsaEncryptPub\n");
bb_error_msg_and_die("RSA crypt outlen:%d < size:%d", outlen, size);
return PS_ARG_FAIL;
}