aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-10-01 14:27:10 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-10-01 14:27:10 +0200
commit1f5a44d20c7963a347165a033aea6da3bbfa9d2c (patch)
tree9c6e17f65feb63f2df7e4985057d06b8cc4e4b00
parent7714518f1a97b6facd58a877afaafa130149192d (diff)
downloadbusybox-w32-1f5a44d20c7963a347165a033aea6da3bbfa9d2c.tar.gz
busybox-w32-1f5a44d20c7963a347165a033aea6da3bbfa9d2c.tar.bz2
busybox-w32-1f5a44d20c7963a347165a033aea6da3bbfa9d2c.zip
tls: add scaffolding to selectively disable ciphers. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls.c106
1 files changed, 51 insertions, 55 deletions
diff --git a/networking/tls.c b/networking/tls.c
index 5566d7911..d0b976c33 100644
--- a/networking/tls.c
+++ b/networking/tls.c
@@ -22,47 +22,23 @@
22 22
23#include "tls.h" 23#include "tls.h"
24 24
25// Usually enabled. You can disable some of them to force only
26// specific ciphers to be advertized to server.
27// (this would not exclude code to handle disabled ciphers, no code size win)
28#define ALLOW_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 1
29#define ALLOW_ECDHE_RSA_WITH_AES_128_CBC_SHA256 1
30#define ALLOW_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 1
31#define ALLOW_ECDHE_RSA_WITH_AES_128_GCM_SHA256 1
32#define ALLOW_RSA_WITH_AES_128_CBC_SHA256 1
33#define ALLOW_RSA_WITH_AES_256_CBC_SHA256 1
34#define ALLOW_RSA_WITH_AES_128_GCM_SHA256 1
35#define ALLOW_CURVE_P256 1
36#define ALLOW_CURVE_X25519 1
37
38// For testing (does everything except encrypting).
25// works against "openssl s_server -cipher NULL" 39// works against "openssl s_server -cipher NULL"
26// and against wolfssl-3.9.10-stable/examples/server/server.c: 40// and against wolfssl-3.9.10-stable/examples/server/server.c:
27#define ALLOW_RSA_NULL_SHA256 0 // for testing (does everything except encrypting) 41#define ALLOW_RSA_NULL_SHA256 0
28
29//Tested against kernel.org:
30//#define CIPHER_ID TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA // ok, recvs SERVER_KEY_EXCHANGE *** matrixssl uses this on my box
31//#define CIPHER_ID TLS_RSA_WITH_AES_256_CBC_SHA256 // ok, no SERVER_KEY_EXCHANGE
32//#define CIPHER_ID TLS_DH_anon_WITH_AES_256_CBC_SHA // SSL_ALERT_HANDSHAKE_FAILURE
33//^^^^^^^^^^^^^^^^^^^^^^^ (tested b/c this one doesn't req server certs... no luck, server refuses it)
34//#define CIPHER_ID TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 // SSL_ALERT_HANDSHAKE_FAILURE
35//#define CIPHER_ID TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 // SSL_ALERT_HANDSHAKE_FAILURE
36//#define CIPHER_ID TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 // ok, recvs SERVER_KEY_EXCHANGE
37//#define CIPHER_ID TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
38//#define CIPHER_ID TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
39//#define CIPHER_ID TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 // SSL_ALERT_HANDSHAKE_FAILURE
40//#define CIPHER_ID TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
41//#define CIPHER_ID TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 // SSL_ALERT_HANDSHAKE_FAILURE
42//#define CIPHER_ID TLS_RSA_WITH_AES_256_GCM_SHA384 // ok, no SERVER_KEY_EXCHANGE
43//#define CIPHER_ID TLS_RSA_WITH_AES_128_GCM_SHA256 // ok, no SERVER_KEY_EXCHANGE
44
45// works against wolfssl-3.9.10-stable/examples/server/server.c
46// works for kernel.org
47// does not work for cdn.kernel.org (e.g. downloading an actual tarball, not a web page)
48// getting alert 40 "handshake failure" at once
49// with GNU Wget 1.18, they agree on TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xC02F) cipher
50// fail: openssl s_client -connect cdn.kernel.org:443 -debug -tls1_2 -cipher AES256-SHA256
51// fail: openssl s_client -connect cdn.kernel.org:443 -debug -tls1_2 -cipher AES256-GCM-SHA384
52// fail: openssl s_client -connect cdn.kernel.org:443 -debug -tls1_2 -cipher AES128-SHA256
53// ok: openssl s_client -connect cdn.kernel.org:443 -debug -tls1_2 -cipher AES128-GCM-SHA256
54// ok: openssl s_client -connect cdn.kernel.org:443 -debug -tls1_2 -cipher AES128-SHA
55// (TLS_RSA_WITH_AES_128_CBC_SHA - in TLS 1.2 it's mandated to be always supported)
56//#define CIPHER_ID1 TLS_RSA_WITH_AES_256_CBC_SHA256 //0x003D
57// Works with "wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.5.tar.xz"
58//#define CIPHER_ID2 TLS_RSA_WITH_AES_128_CBC_SHA //0x002F
59
60// bug #11456:
61// ftp.openbsd.org only supports ECDHE-RSA-AESnnn-GCM-SHAnnn or ECDHE-RSA-CHACHA20-POLY1305
62//#define CIPHER_ID3 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 //0xC02F
63// host is.gd accepts only ECDHE-ECDSA-foo (the simplest which works: ECDHE-ECDSA-AES128-SHA 0xC009)
64//#define CIPHER_ID4 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA //0xC009
65
66 42
67#define TLS_DEBUG 0 43#define TLS_DEBUG 0
68#define TLS_DEBUG_HASH 0 44#define TLS_DEBUG_HASH 0
@@ -1488,9 +1464,20 @@ static ALWAYS_INLINE void fill_handshake_record_hdr(void *buf, unsigned type, un
1488 1464
1489static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni) 1465static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1490{ 1466{
1491#define NUM_CIPHERS (7 + 6 * ENABLE_FEATURE_TLS_SHA1 + ALLOW_RSA_NULL_SHA256) 1467#define NUM_CIPHERS (0 \
1468 + 4 * ENABLE_FEATURE_TLS_SHA1 \
1469 + ALLOW_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 \
1470 + ALLOW_ECDHE_RSA_WITH_AES_128_CBC_SHA256 \
1471 + ALLOW_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 \
1472 + ALLOW_ECDHE_RSA_WITH_AES_128_GCM_SHA256 \
1473 + 2 * ENABLE_FEATURE_TLS_SHA1 \
1474 + ALLOW_RSA_WITH_AES_128_CBC_SHA256 \
1475 + ALLOW_RSA_WITH_AES_256_CBC_SHA256 \
1476 + ALLOW_RSA_WITH_AES_128_GCM_SHA256 \
1477 + ALLOW_RSA_NULL_SHA256 \
1478 )
1492 static const uint8_t ciphers[] = { 1479 static const uint8_t ciphers[] = {
1493 0x00,2 + NUM_CIPHERS*2, //len16_be 1480 0x00,2 * (1 + NUM_CIPHERS), //len16_be
1494 0x00,0xFF, //not a cipher - TLS_EMPTY_RENEGOTIATION_INFO_SCSV 1481 0x00,0xFF, //not a cipher - TLS_EMPTY_RENEGOTIATION_INFO_SCSV
1495 /* ^^^^^^ RFC 5746 Renegotiation Indication Extension - some servers will refuse to work with us otherwise */ 1482 /* ^^^^^^ RFC 5746 Renegotiation Indication Extension - some servers will refuse to work with us otherwise */
1496#if ENABLE_FEATURE_TLS_SHA1 1483#if ENABLE_FEATURE_TLS_SHA1
@@ -1501,14 +1488,22 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1501 // 0xC0,0x18, // TLS_ECDH_anon_WITH_AES_128_CBC_SHA 1488 // 0xC0,0x18, // TLS_ECDH_anon_WITH_AES_128_CBC_SHA
1502 // 0xC0,0x19, // TLS_ECDH_anon_WITH_AES_256_CBC_SHA 1489 // 0xC0,0x19, // TLS_ECDH_anon_WITH_AES_256_CBC_SHA
1503#endif 1490#endif
1491#if ALLOW_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
1504 0xC0,0x23, // 5 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - ok: wget https://is.gd/ 1492 0xC0,0x23, // 5 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - ok: wget https://is.gd/
1493#endif
1505 // 0xC0,0x24, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet 1494 // 0xC0,0x24, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet
1495#if ALLOW_ECDHE_RSA_WITH_AES_128_CBC_SHA256
1506 0xC0,0x27, // 6 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA256 1496 0xC0,0x27, // 6 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA256
1497#endif
1507 // 0xC0,0x28, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet 1498 // 0xC0,0x28, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet
1499#if ALLOW_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
1508 0xC0,0x2B, // 7 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - ok: wget https://is.gd/ 1500 0xC0,0x2B, // 7 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - ok: wget https://is.gd/
1501#endif
1509 // 0xC0,0x2C, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - wget https://is.gd/: "TLS error from peer (alert code 20): bad MAC" 1502 // 0xC0,0x2C, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - wget https://is.gd/: "TLS error from peer (alert code 20): bad MAC"
1510//TODO: GCM_SHA384 ciphers can be supported, only need sha384-based PRF? 1503//TODO: GCM_SHA384 ciphers can be supported, only need sha384-based PRF?
1504#if ALLOW_ECDHE_RSA_WITH_AES_128_GCM_SHA256
1511 0xC0,0x2F, // 8 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-GCM-SHA256 1505 0xC0,0x2F, // 8 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-GCM-SHA256
1506#endif
1512 // 0xC0,0x30, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher ECDHE-RSA-AES256-GCM-SHA384: "decryption failed or bad record mac" 1507 // 0xC0,0x30, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher ECDHE-RSA-AES256-GCM-SHA384: "decryption failed or bad record mac"
1513 //possibly these too: 1508 //possibly these too:
1514#if ENABLE_FEATURE_TLS_SHA1 1509#if ENABLE_FEATURE_TLS_SHA1
@@ -1521,9 +1516,15 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1521 0x00,0x2F, // 9 TLS_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher AES128-SHA 1516 0x00,0x2F, // 9 TLS_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher AES128-SHA
1522 0x00,0x35, //10 TLS_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher AES256-SHA 1517 0x00,0x35, //10 TLS_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher AES256-SHA
1523#endif 1518#endif
1519#if ALLOW_RSA_WITH_AES_128_CBC_SHA256
1524 0x00,0x3C, //11 TLS_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher AES128-SHA256 1520 0x00,0x3C, //11 TLS_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher AES128-SHA256
1521#endif
1522#if ALLOW_RSA_WITH_AES_256_CBC_SHA256
1525 0x00,0x3D, //12 TLS_RSA_WITH_AES_256_CBC_SHA256 - ok: openssl s_server ... -cipher AES256-SHA256 1523 0x00,0x3D, //12 TLS_RSA_WITH_AES_256_CBC_SHA256 - ok: openssl s_server ... -cipher AES256-SHA256
1524#endif
1525#if ALLOW_RSA_WITH_AES_128_GCM_SHA256
1526 0x00,0x9C, //13 TLS_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher AES128-GCM-SHA256 1526 0x00,0x9C, //13 TLS_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher AES128-GCM-SHA256
1527#endif
1527 // 0x00,0x9D, // TLS_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher AES256-GCM-SHA384: "decryption failed or bad record mac" 1528 // 0x00,0x9D, // TLS_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher AES256-GCM-SHA384: "decryption failed or bad record mac"
1528#if ALLOW_RSA_NULL_SHA256 1529#if ALLOW_RSA_NULL_SHA256
1529 0x00,0x3B, // TLS_RSA_WITH_NULL_SHA256 1530 0x00,0x3B, // TLS_RSA_WITH_NULL_SHA256
@@ -1532,12 +1533,16 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1532 }; 1533 };
1533 static const uint8_t supported_groups[] = { 1534 static const uint8_t supported_groups[] = {
1534 0x00,0x0a, //extension_type: "supported_groups" 1535 0x00,0x0a, //extension_type: "supported_groups"
1535 0x00,0x06, //ext len 1536 0x00,2 * (1 + ALLOW_CURVE_P256 + ALLOW_CURVE_X25519), //ext len
1536 0x00,0x04, //list len 1537 0x00,2 * (0 + ALLOW_CURVE_P256 + ALLOW_CURVE_X25519), //list len
1537 0x00,0x17, //curve_secp256r1 (aka P256) 1538#if ALLOW_CURVE_P256
1539 0x00,0x17, //curve_secp256r1 (aka P256, aka prime256v1)
1540#endif
1538 //0x00,0x18, //curve_secp384r1 1541 //0x00,0x18, //curve_secp384r1
1539 //0x00,0x19, //curve_secp521r1 1542 //0x00,0x19, //curve_secp521r1
1543#if ALLOW_CURVE_X25519
1540 0x00,0x1d, //curve_x25519 (RFC 7748) 1544 0x00,0x1d, //curve_x25519 (RFC 7748)
1545#endif
1541 //0x00,0x1e, //curve_x448 (RFC 7748) 1546 //0x00,0x1e, //curve_x448 (RFC 7748)
1542 }; 1547 };
1543 //static const uint8_t signature_algorithms[] = { 1548 //static const uint8_t signature_algorithms[] = {
@@ -1555,7 +1560,7 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1555 uint8_t session_id_len; 1560 uint8_t session_id_len;
1556 /* uint8_t session_id[]; */ 1561 /* uint8_t session_id[]; */
1557 uint8_t cipherid_len16_hi, cipherid_len16_lo; 1562 uint8_t cipherid_len16_hi, cipherid_len16_lo;
1558 uint8_t cipherid[2 + NUM_CIPHERS*2]; /* actually variable */ 1563 uint8_t cipherid[2 * (1 + NUM_CIPHERS)]; /* actually variable */
1559 uint8_t comprtypes_len; 1564 uint8_t comprtypes_len;
1560 uint8_t comprtypes[1]; /* actually variable */ 1565 uint8_t comprtypes[1]; /* actually variable */
1561 /* Extensions (SNI shown): 1566 /* Extensions (SNI shown):
@@ -1603,7 +1608,7 @@ static void send_client_hello_and_alloc_hsd(tls_state_t *tls, const char *sni)
1603 memset(record->rand32, 0x11, sizeof(record->rand32)); 1608 memset(record->rand32, 0x11, sizeof(record->rand32));
1604 /* record->session_id_len = 0; - already is */ 1609 /* record->session_id_len = 0; - already is */
1605 1610
1606 BUILD_BUG_ON(sizeof(ciphers) != 2 + 2 + NUM_CIPHERS*2 + 2); 1611 BUILD_BUG_ON(sizeof(ciphers) != 2 * (1 + 1 + NUM_CIPHERS + 1));
1607 memcpy(&record->cipherid_len16_hi, ciphers, sizeof(ciphers)); 1612 memcpy(&record->cipherid_len16_hi, ciphers, sizeof(ciphers));
1608 1613
1609 ptr = (void*)(record + 1); 1614 ptr = (void*)(record + 1);
@@ -1700,42 +1705,33 @@ static void get_server_hello(tls_state_t *tls)
1700 1705
1701 /* Set up encryption params based on selected cipher */ 1706 /* Set up encryption params based on selected cipher */
1702#if 0 1707#if 0
1703#if ENABLE_FEATURE_TLS_SHA1
1704 0xC0,0x09, // 1 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA - ok: wget https://is.gd/ 1708 0xC0,0x09, // 1 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA - ok: wget https://is.gd/
1705 0xC0,0x0A, // 2 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA - ok: wget https://is.gd/ 1709 0xC0,0x0A, // 2 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA - ok: wget https://is.gd/
1706 0xC0,0x13, // 3 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA 1710 0xC0,0x13, // 3 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA
1707 0xC0,0x14, // 4 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher ECDHE-RSA-AES256-SHA (might fail with older openssl) 1711 0xC0,0x14, // 4 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher ECDHE-RSA-AES256-SHA (might fail with older openssl)
1708 // 0xC0,0x18, // TLS_ECDH_anon_WITH_AES_128_CBC_SHA 1712 // 0xC0,0x18, // TLS_ECDH_anon_WITH_AES_128_CBC_SHA
1709 // 0xC0,0x19, // TLS_ECDH_anon_WITH_AES_256_CBC_SHA 1713 // 0xC0,0x19, // TLS_ECDH_anon_WITH_AES_256_CBC_SHA
1710#endif
1711 0xC0,0x23, // 5 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - ok: wget https://is.gd/ 1714 0xC0,0x23, // 5 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - ok: wget https://is.gd/
1712 // 0xC0,0x24, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet 1715 // 0xC0,0x24, // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet
1713 0xC0,0x27, // 6 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA256 1716 0xC0,0x27, // 6 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-SHA256
1714 // 0xC0,0x28, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet 1717 // 0xC0,0x28, // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet
1715 0xC0,0x2B, // 7 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - ok: wget https://is.gd/ 1718 0xC0,0x2B, // 7 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - ok: wget https://is.gd/
1716 // 0xC0,0x2C, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - wget https://is.gd/: "TLS error from peer (alert code 20): bad MAC" 1719 // 0xC0,0x2C, // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - wget https://is.gd/: "TLS error from peer (alert code 20): bad MAC"
1717//TODO: GCM_SHA384 ciphers can be supported, only need sha384-based PRF?
1718 0xC0,0x2F, // 8 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-GCM-SHA256 1720 0xC0,0x2F, // 8 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher ECDHE-RSA-AES128-GCM-SHA256
1719 // 0xC0,0x30, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher ECDHE-RSA-AES256-GCM-SHA384: "decryption failed or bad record mac" 1721 // 0xC0,0x30, // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher ECDHE-RSA-AES256-GCM-SHA384: "decryption failed or bad record mac"
1720 //possibly these too: 1722 //possibly these too:
1721#if ENABLE_FEATURE_TLS_SHA1
1722 // 0xC0,0x35, // TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 1723 // 0xC0,0x35, // TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
1723 // 0xC0,0x36, // TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 1724 // 0xC0,0x36, // TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
1724#endif
1725 // 0xC0,0x37, // TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 1725 // 0xC0,0x37, // TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
1726 // 0xC0,0x38, // TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet 1726 // 0xC0,0x38, // TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 - can't do SHA384 yet
1727#if ENABLE_FEATURE_TLS_SHA1
1728 0x00,0x2F, // 9 TLS_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher AES128-SHA 1727 0x00,0x2F, // 9 TLS_RSA_WITH_AES_128_CBC_SHA - ok: openssl s_server ... -cipher AES128-SHA
1729 0x00,0x35, //10 TLS_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher AES256-SHA 1728 0x00,0x35, //10 TLS_RSA_WITH_AES_256_CBC_SHA - ok: openssl s_server ... -cipher AES256-SHA
1730#endif
1731 0x00,0x3C, //11 TLS_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher AES128-SHA256 1729 0x00,0x3C, //11 TLS_RSA_WITH_AES_128_CBC_SHA256 - ok: openssl s_server ... -cipher AES128-SHA256
1732 0x00,0x3D, //12 TLS_RSA_WITH_AES_256_CBC_SHA256 - ok: openssl s_server ... -cipher AES256-SHA256 1730 0x00,0x3D, //12 TLS_RSA_WITH_AES_256_CBC_SHA256 - ok: openssl s_server ... -cipher AES256-SHA256
1733 0x00,0x9C, //13 TLS_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher AES128-GCM-SHA256 1731 0x00,0x9C, //13 TLS_RSA_WITH_AES_128_GCM_SHA256 - ok: openssl s_server ... -cipher AES128-GCM-SHA256
1734 // 0x00,0x9D, // TLS_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher AES256-GCM-SHA384: "decryption failed or bad record mac" 1732 // 0x00,0x9D, // TLS_RSA_WITH_AES_256_GCM_SHA384 - openssl s_server ... -cipher AES256-GCM-SHA384: "decryption failed or bad record mac"
1735#if ALLOW_RSA_NULL_SHA256
1736 0x00,0x3B, // TLS_RSA_WITH_NULL_SHA256 1733 0x00,0x3B, // TLS_RSA_WITH_NULL_SHA256
1737#endif 1734#endif
1738#endif
1739 cipherid1 = cipherid[1]; 1735 cipherid1 = cipherid[1];
1740 tls->cipher_id = 0x100 * cipherid[0] + cipherid1; 1736 tls->cipher_id = 0x100 * cipherid[0] + cipherid1;
1741 tls->key_size = AES256_KEYSIZE; 1737 tls->key_size = AES256_KEYSIZE;