1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-21 14:00:51 +03:00

crypto: add LIBSSH2_NO_AES_CBC option

Also rename internal `LIBSSH2_AES` to `LIBSSH2_AES_CBC`.

Follow-up to 857e431648

Closes #990
This commit is contained in:
Viktor Szakats
2023-04-20 13:55:30 +00:00
parent 2d7be5f5d8
commit 5e56002055
7 changed files with 16 additions and 11 deletions

View File

@@ -195,7 +195,7 @@ static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes256_ctr = {
}; };
#endif #endif
#if LIBSSH2_AES #if LIBSSH2_AES_CBC
static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes128_cbc = { static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_aes128_cbc = {
"aes128-cbc", "aes128-cbc",
"DEK-Info: AES-128-CBC", "DEK-Info: AES-128-CBC",
@@ -249,7 +249,7 @@ static const LIBSSH2_CRYPT_METHOD
&crypt_dtor, &crypt_dtor,
_libssh2_cipher_aes256 _libssh2_cipher_aes256
}; };
#endif /* LIBSSH2_AES */ #endif /* LIBSSH2_AES_CBC */
#if LIBSSH2_BLOWFISH #if LIBSSH2_BLOWFISH
static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_blowfish_cbc = { static const LIBSSH2_CRYPT_METHOD libssh2_crypt_method_blowfish_cbc = {
@@ -359,13 +359,13 @@ static const LIBSSH2_CRYPT_METHOD *_libssh2_crypt_methods[] = {
&libssh2_crypt_method_aes256_ctr, &libssh2_crypt_method_aes256_ctr,
&libssh2_crypt_method_aes192_ctr, &libssh2_crypt_method_aes192_ctr,
&libssh2_crypt_method_aes128_ctr, &libssh2_crypt_method_aes128_ctr,
#endif /* LIBSSH2_AES */ #endif /* LIBSSH2_AES_CTR */
#if LIBSSH2_AES #if LIBSSH2_AES_CBC
&libssh2_crypt_method_aes256_cbc, &libssh2_crypt_method_aes256_cbc,
&libssh2_crypt_method_rijndael_cbc_lysator_liu_se, /* == aes256-cbc */ &libssh2_crypt_method_rijndael_cbc_lysator_liu_se, /* == aes256-cbc */
&libssh2_crypt_method_aes192_cbc, &libssh2_crypt_method_aes192_cbc,
&libssh2_crypt_method_aes128_cbc, &libssh2_crypt_method_aes128_cbc,
#endif /* LIBSSH2_AES */ #endif /* LIBSSH2_AES_CBC */
#if LIBSSH2_BLOWFISH #if LIBSSH2_BLOWFISH
&libssh2_crypt_method_blowfish_cbc, &libssh2_crypt_method_blowfish_cbc,
#endif /* LIBSSH2_BLOWFISH */ #endif /* LIBSSH2_BLOWFISH */

View File

@@ -87,6 +87,11 @@
#define LIBSSH2_AES_CTR 0 #define LIBSSH2_AES_CTR 0
#endif #endif
#ifdef LIBSSH2_NO_AES_CBC
#undef LIBSSH2_AES_CBC
#define LIBSSH2_AES_CBC 0
#endif
#ifdef LIBSSH2_NO_BLOWFISH #ifdef LIBSSH2_NO_BLOWFISH
#undef LIBSSH2_BLOWFISH #undef LIBSSH2_BLOWFISH
#define LIBSSH2_BLOWFISH 0 #define LIBSSH2_BLOWFISH 0

View File

@@ -49,7 +49,7 @@
#define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA256 1
#define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_HMAC_SHA512 1
#define LIBSSH2_AES 1 #define LIBSSH2_AES_CBC 1
#define LIBSSH2_AES_CTR 1 #define LIBSSH2_AES_CTR 1
#define LIBSSH2_AES_GCM 0 #define LIBSSH2_AES_GCM 0
#define LIBSSH2_BLOWFISH 1 #define LIBSSH2_BLOWFISH 1

View File

@@ -65,7 +65,7 @@
#define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA256 1
#define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_HMAC_SHA512 1
#define LIBSSH2_AES 1 #define LIBSSH2_AES_CBC 1
#define LIBSSH2_AES_CTR 1 #define LIBSSH2_AES_CTR 1
#define LIBSSH2_AES_GCM 0 #define LIBSSH2_AES_GCM 0
#ifdef MBEDTLS_CIPHER_BLOWFISH_CBC #ifdef MBEDTLS_CIPHER_BLOWFISH_CBC

View File

@@ -153,10 +153,10 @@
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)) || \ #if (OPENSSL_VERSION_NUMBER >= 0x00907000L && !defined(OPENSSL_NO_AES)) || \
(defined(LIBSSH2_WOLFSSL) && defined(WOLFSSL_AES_COUNTER)) (defined(LIBSSH2_WOLFSSL) && defined(WOLFSSL_AES_COUNTER))
# define LIBSSH2_AES_CTR 1 # define LIBSSH2_AES_CTR 1
# define LIBSSH2_AES 1 # define LIBSSH2_AES_CBC 1
#else #else
# define LIBSSH2_AES_CTR 0 # define LIBSSH2_AES_CTR 0
# define LIBSSH2_AES 0 # define LIBSSH2_AES_CBC 0
#endif #endif
#if (OPENSSL_VERSION_NUMBER >= 0x01010100fL && !defined(OPENSSL_NO_AES)) #if (OPENSSL_VERSION_NUMBER >= 0x01010100fL && !defined(OPENSSL_NO_AES))

View File

@@ -169,7 +169,7 @@
#define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA256 1
#define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_HMAC_SHA512 1
#define LIBSSH2_AES 1 #define LIBSSH2_AES_CBC 1
#define LIBSSH2_AES_CTR 1 #define LIBSSH2_AES_CTR 1
#define LIBSSH2_AES_GCM 0 #define LIBSSH2_AES_GCM 0
#define LIBSSH2_BLOWFISH 0 #define LIBSSH2_BLOWFISH 0

View File

@@ -57,7 +57,7 @@
#define LIBSSH2_HMAC_SHA256 1 #define LIBSSH2_HMAC_SHA256 1
#define LIBSSH2_HMAC_SHA512 1 #define LIBSSH2_HMAC_SHA512 1
#define LIBSSH2_AES 1 #define LIBSSH2_AES_CBC 1
#define LIBSSH2_AES_CTR 1 #define LIBSSH2_AES_CTR 1
#define LIBSSH2_AES_GCM 0 #define LIBSSH2_AES_GCM 0
#define LIBSSH2_BLOWFISH 0 #define LIBSSH2_BLOWFISH 0