diff options
author | Denys Vlasenko | 2017-01-19 15:51:00 +0100 |
---|---|---|
committer | Denys Vlasenko | 2017-01-19 15:51:00 +0100 |
commit | 6b1b004845ebec194c4d4868d3deb57f22711b19 (patch) | |
tree | 291b2cf65b5537a184369eabec0089420ed63930 /networking/tls_aes.c | |
parent | 1bfc4b85a7915210936edc62ecf0d01a17751222 (diff) | |
download | busybox-6b1b004845ebec194c4d4868d3deb57f22711b19.zip busybox-6b1b004845ebec194c4d4868d3deb57f22711b19.tar.gz |
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_aes.c')
-rw-r--r-- | networking/tls_aes.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/networking/tls_aes.c b/networking/tls_aes.c index 661bd82..6c3c393 100644 --- a/networking/tls_aes.c +++ b/networking/tls_aes.c @@ -6,7 +6,7 @@ #include "tls.h" /* The file is taken almost verbatim from matrixssl-3-7-2b-open/crypto/symmetric/. - * Changes are flagged with ///bbox + * Changes are flagged with //bbox */ /** @@ -43,7 +43,7 @@ */ /******************************************************************************/ -///vda +//bbox //#include "../cryptoApi.h" #ifdef USE_AES @@ -1084,10 +1084,11 @@ int32 psAesInit(psCipherContext_t *ctx, unsigned char *IV, { int32 x, err; - if (IV == NULL || key == NULL || ctx == NULL) { - psTraceCrypto("psAesInit arg fail\n"); - return PS_ARG_FAIL; - } +//bbox +// if (IV == NULL || key == NULL || ctx == NULL) { +// psTraceCrypto("psAesInit arg fail\n"); +// return PS_ARG_FAIL; +// } memset(ctx, 0x0, sizeof(psCipherContext_t)); /* setup cipher @@ -1112,10 +1113,13 @@ int32 psAesEncrypt(psCipherContext_t *ctx, unsigned char *pt, uint32 i; unsigned char tmp[MAXBLOCKSIZE]; - if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) { - psTraceCrypto("Bad parameters to psAesEncrypt\n"); - return PS_ARG_FAIL; - } +//bbox +// if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) { +// psTraceCrypto("Bad parameters to psAesEncrypt\n"); +// return PS_ARG_FAIL; +// } + if ((len & 0x7) != 0) + bb_error_msg_and_die("AES len:%d", len); /* is blocklen valid? @@ -1159,10 +1163,13 @@ int32 psAesDecrypt(psCipherContext_t *ctx, unsigned char *ct, uint32 i; unsigned char tmp[MAXBLOCKSIZE], tmp2[MAXBLOCKSIZE]; - if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) { - psTraceCrypto("Bad parameters to psAesDecrypt\n"); - return PS_ARG_FAIL; - } +//bbox +// if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) { +// psTraceCrypto("Bad parameters to psAesDecrypt\n"); +// return PS_ARG_FAIL; +// } + if ((len & 0x7) != 0) + bb_error_msg_and_die("AES len:%d", len); /* is blocklen valid? @@ -1221,14 +1228,15 @@ int32 psAesInitKey(const unsigned char *key, uint32 keylen, psAesKey_t *skey) int32 i, j; uint32 temp, *rk, *rrk; - if (key == NULL || skey == NULL) { - psTraceCrypto("Bad args to psAesInitKey\n"); - return PS_ARG_FAIL; - } +//bbox +// if (key == NULL || skey == NULL) { +// psTraceCrypto("Bad args to psAesInitKey\n"); +// return PS_ARG_FAIL; +// } if (keylen != 16 && keylen != 24 && keylen != 32) { psTraceCrypto("Invalid AES key length\n"); - ///bbox return CRYPT_INVALID_KEYSIZE; + //bbox return CRYPT_INVALID_KEYSIZE; //unreachable anyway return PS_ARG_FAIL; } @@ -1398,9 +1406,10 @@ void psAesEncryptBlock(const unsigned char *pt, unsigned char *ct, uint32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; int32 Nr, r; - if (pt == NULL || ct == NULL || skey == NULL) { - return; - } +//bbox +// if (pt == NULL || ct == NULL || skey == NULL) { +// return; +// } Nr = skey->Nr; rk = skey->eK; @@ -1562,9 +1571,10 @@ void psAesDecryptBlock(const unsigned char *ct, unsigned char *pt, uint32 s0, s1, s2, s3, t0, t1, t2, t3, *rk; int32 Nr, r; - if (pt == NULL || ct == NULL || skey == NULL) { - return; - } +//bbox +// if (pt == NULL || ct == NULL || skey == NULL) { +// return; +// } Nr = skey->Nr; rk = skey->dK; |