summaryrefslogtreecommitdiff
path: root/networking/tls_aes.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-11-23 17:21:38 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-23 17:48:07 +0100
commit83e5c627e1b2c7f34d694696d0c3d5a3ce25dc59 (patch)
tree3bdffe7c29ee5213ba4278da9b0ee116c2806d78 /networking/tls_aes.c
parent03ad7ae08189ed88dd7e0fcb6c6001fbf3b12efb (diff)
downloadbusybox-w32-83e5c627e1b2c7f34d694696d0c3d5a3ce25dc59.tar.gz
busybox-w32-83e5c627e1b2c7f34d694696d0c3d5a3ce25dc59.tar.bz2
busybox-w32-83e5c627e1b2c7f34d694696d0c3d5a3ce25dc59.zip
tls: add support for TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher
function old new delta xwrite_encrypted 209 605 +396 GHASH - 395 +395 aes_encrypt_1 - 382 +382 GMULT - 192 +192 tls_xread_record 489 659 +170 aes_encrypt_one_block - 65 +65 aesgcm_setkey - 58 +58 FlattenSzInBits - 52 +52 tls_handshake 1890 1941 +51 xwrite_and_update_handshake_hash 46 81 +35 xorbuf - 24 +24 aes_setkey - 16 +16 psRsaEncryptPub 413 421 +8 stty_main 1221 1227 +6 ssl_client_main 138 143 +5 next_token 841 845 +4 spawn_ssl_client 218 219 +1 volume_id_probe_hfs_hfsplus 564 563 -1 read_package_field 232 230 -2 i2cdetect_main 674 672 -2 fail_hunk 139 136 -3 parse_expr 891 883 -8 curve25519 802 793 -9 aes_cbc_decrypt 971 958 -13 xwrite_handshake_record 43 - -43 aes_cbc_encrypt 644 172 -472 ------------------------------------------------------------------------------ (add/remove: 9/1 grow/shrink: 9/8 up/down: 1860/-553) Total: 1307 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tls_aes.c')
-rw-r--r--networking/tls_aes.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/networking/tls_aes.c b/networking/tls_aes.c
index c137442e9..4d2b68975 100644
--- a/networking/tls_aes.c
+++ b/networking/tls_aes.c
@@ -340,8 +340,12 @@ static void aes_encrypt_1(unsigned astate[16], unsigned rounds, const uint32_t *
340 AddRoundKey(astate, RoundKey); 340 AddRoundKey(astate, RoundKey);
341} 341}
342 342
343#if 0 // UNUSED 343void FAST_FUNC aes_setkey(struct tls_aes *aes, const void *key, unsigned key_len)
344static void aes_encrypt_one_block(unsigned rounds, const uint32_t *RoundKey, const void *data, void *dst) 344{
345 aes->rounds = KeyExpansion(aes->key, key, key_len);
346}
347
348void FAST_FUNC aes_encrypt_one_block(struct tls_aes *aes, const void *data, void *dst)
345{ 349{
346 unsigned astate[16]; 350 unsigned astate[16];
347 unsigned i; 351 unsigned i;
@@ -351,13 +355,12 @@ static void aes_encrypt_one_block(unsigned rounds, const uint32_t *RoundKey, con
351 355
352 for (i = 0; i < 16; i++) 356 for (i = 0; i < 16; i++)
353 astate[i] = pt[i]; 357 astate[i] = pt[i];
354 aes_encrypt_1(astate, rounds, RoundKey); 358 aes_encrypt_1(astate, aes->rounds, aes->key);
355 for (i = 0; i < 16; i++) 359 for (i = 0; i < 16; i++)
356 ct[i] = astate[i]; 360 ct[i] = astate[i];
357} 361}
358#endif
359 362
360void aes_cbc_encrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst) 363void FAST_FUNC aes_cbc_encrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst)
361{ 364{
362 uint32_t RoundKey[60]; 365 uint32_t RoundKey[60];
363 uint8_t iv2[16]; 366 uint8_t iv2[16];
@@ -420,7 +423,7 @@ static void aes_decrypt_one_block(unsigned rounds, const uint32_t *RoundKey, con
420} 423}
421#endif 424#endif
422 425
423void aes_cbc_decrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst) 426void FAST_FUNC aes_cbc_decrypt(const void *key, int klen, void *iv, const void *data, size_t len, void *dst)
424{ 427{
425 uint32_t RoundKey[60]; 428 uint32_t RoundKey[60];
426 uint8_t iv2[16]; 429 uint8_t iv2[16];