mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 19:53:46 +00:00
C++20 port 15/15: remove the stream ciphers (#3079)
* Remove the stream ciphers The unauthenticated stream ciphers (aes-*-cfb, aes-*-ctr, camellia-*-cfb, chacha20, chacha20-ietf, salsa20) are gone from every build, together with the SS_ENABLE_LEGACY option, the C++ stream codecs, their C test oracle and the stream-only tests and configurations. A configuration naming one of them, or RC4/table, now fails at startup with a message pointing to an AEAD method, and test_cli checks that. Shell completions list only the supported methods (and now include the 2022 ones), and the docs and the compatibility contract say the stream ciphers were removed. * Drop the Mbed TLS CFB requirement and stale stream-cipher examples CFB was only needed by the removed stream ciphers, so a system Mbed TLS built without it no longer fails to configure. The public header example now uses aes-256-gcm.
This commit is contained in:
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "base64.h"
|
||||
#include "crypto.h"
|
||||
#include "stream.h"
|
||||
#include "aead.h"
|
||||
#include "utils.h"
|
||||
#include "ppbloom.h"
|
||||
@@ -150,32 +149,6 @@ crypto_init(const char *password, const char *key, const char *method)
|
||||
#endif
|
||||
|
||||
if (method != NULL) {
|
||||
#if SS_ENABLE_LEGACY
|
||||
for (i = 0; i < STREAM_CIPHER_NUM; i++)
|
||||
if (strcmp(method, supported_stream_ciphers[i]) == 0) {
|
||||
m = i;
|
||||
break;
|
||||
}
|
||||
if (m != -1) {
|
||||
LOGI("Stream ciphers are insecure, therefore deprecated, and should be almost always avoided.");
|
||||
cipher_t *cipher = stream_init(password, key, method);
|
||||
if (cipher == NULL)
|
||||
return NULL;
|
||||
crypto_t *crypto = (crypto_t *)ss_malloc(sizeof(crypto_t));
|
||||
crypto_t tmp = {
|
||||
.cipher = cipher,
|
||||
.encrypt_all = &stream_encrypt_all,
|
||||
.decrypt_all = &stream_decrypt_all,
|
||||
.encrypt = &stream_encrypt,
|
||||
.decrypt = &stream_decrypt,
|
||||
.ctx_init = &stream_ctx_init,
|
||||
.ctx_release = &stream_ctx_release,
|
||||
};
|
||||
memcpy((void *)crypto, &tmp, sizeof(crypto_t)); /* const members: copy the bytes */
|
||||
return crypto;
|
||||
}
|
||||
|
||||
#endif
|
||||
for (i = 0; i < AEAD_CIPHER_NUM; i++)
|
||||
if (strcmp(method, supported_aead_ciphers[i]) == 0) {
|
||||
m = i;
|
||||
|
||||
Reference in New Issue
Block a user