diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-24 21:26:20 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-24 21:26:20 +0100 |
commit | d2923b3d239d55565427533d3a9702cf1d27eb92 (patch) | |
tree | 3c2e778fc1312349a03ab207db6b2076036638b9 | |
parent | 03569bc50f0d731aa3af94ab600adc59eaac3162 (diff) | |
download | busybox-w32-d2923b3d239d55565427533d3a9702cf1d27eb92.tar.gz busybox-w32-d2923b3d239d55565427533d3a9702cf1d27eb92.tar.bz2 busybox-w32-d2923b3d239d55565427533d3a9702cf1d27eb92.zip |
tls: fix is.gd again, fix AES-CBC using decrypt key instead of encrypt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/tls.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/networking/tls.c b/networking/tls.c index b774340ae..f337bc0c9 100644 --- a/networking/tls.c +++ b/networking/tls.c | |||
@@ -58,11 +58,13 @@ | |||
58 | // Works with "wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.5.tar.xz" | 58 | // Works with "wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.5.tar.xz" |
59 | #define CIPHER_ID2 TLS_RSA_WITH_AES_128_CBC_SHA | 59 | #define CIPHER_ID2 TLS_RSA_WITH_AES_128_CBC_SHA |
60 | 60 | ||
61 | // bug #11456: host is.gd accepts only ECDHE-ECDSA-foo (the simplest which works: ECDHE-ECDSA-AES128-SHA 0xC009) | 61 | // bug #11456: |
62 | #define CIPHER_ID3 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA | ||
63 | |||
64 | // ftp.openbsd.org only supports ECDHE-RSA-AESnnn-GCM-SHAnnn or ECDHE-RSA-CHACHA20-POLY1305 | 62 | // ftp.openbsd.org only supports ECDHE-RSA-AESnnn-GCM-SHAnnn or ECDHE-RSA-CHACHA20-POLY1305 |
65 | #define CIPHER_ID4 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 | 63 | #define CIPHER_ID3 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 |
64 | // host is.gd accepts only ECDHE-ECDSA-foo (the simplest which works: ECDHE-ECDSA-AES128-SHA 0xC009), | ||
65 | // and immediately throws alert 40 "handshake failure" in response to our hello record | ||
66 | // if ECDHE-ECDSA-AES-CBC-SHA is *before* ECDHE-RSA-AES-GCM cipher in the list! Server bug? | ||
67 | #define CIPHER_ID4 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA | ||
66 | 68 | ||
67 | #define NUM_CIPHERS 4 | 69 | #define NUM_CIPHERS 4 |
68 | 70 | ||
@@ -785,7 +787,7 @@ static void xwrite_encrypted_and_hmac_signed(tls_state_t *tls, unsigned size, un | |||
785 | 787 | ||
786 | /* Encrypt content+MAC+padding in place */ | 788 | /* Encrypt content+MAC+padding in place */ |
787 | aes_cbc_encrypt( | 789 | aes_cbc_encrypt( |
788 | &tls->aes_decrypt, /* selects 128/256 */ | 790 | &tls->aes_encrypt, /* selects 128/256 */ |
789 | buf - AES_BLOCK_SIZE, /* IV */ | 791 | buf - AES_BLOCK_SIZE, /* IV */ |
790 | buf, size, /* plaintext */ | 792 | buf, size, /* plaintext */ |
791 | buf /* ciphertext */ | 793 | buf /* ciphertext */ |