mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Introduce helper macro for presence of stream ciphersuites
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
@ -130,6 +130,15 @@
|
|||||||
* counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256).
|
* counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_SSL3) || \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1_1) || \
|
||||||
|
defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
|
#define MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER)
|
||||||
|
|
||||||
/* This macro determines whether CBC is supported. */
|
/* This macro determines whether CBC is supported. */
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_CBC) && \
|
#if defined(MBEDTLS_CIPHER_MODE_CBC) && \
|
||||||
( defined(MBEDTLS_AES_C) || \
|
( defined(MBEDTLS_AES_C) || \
|
||||||
@ -139,6 +148,12 @@
|
|||||||
#define MBEDTLS_SSL_SOME_SUITES_USE_CBC
|
#define MBEDTLS_SSL_SOME_SUITES_USE_CBC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* This macro determines whether a ciphersuite using a
|
||||||
|
* stream cipher can be used. */
|
||||||
|
#if defined(MBEDTLS_CIPHER_NULL_CIPHER)
|
||||||
|
#define MBEDTLS_SSL_SOME_SUITES_USE_STREAM
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This macro determines whether the CBC construct used in TLS 1.0-1.2 is supported. */
|
/* This macro determines whether the CBC construct used in TLS 1.0-1.2 is supported. */
|
||||||
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_CBC) && \
|
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_CBC) && \
|
||||||
( defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
( defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||||
@ -147,11 +162,13 @@
|
|||||||
#define MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC
|
#define MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_NULL_CIPHER) || \
|
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_STREAM) ||
|
||||||
defined(MBEDTLS_SSL_SOME_SUITES_USE_CBC)
|
defined(MBEDTLS_SSL_SOME_SUITES_USE_CBC)
|
||||||
#define MBEDTLS_SSL_SOME_SUITES_USE_MAC
|
#define MBEDTLS_SSL_SOME_SUITES_USE_MAC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_MAC)
|
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_MAC)
|
||||||
/* Ciphersuites using HMAC */
|
/* Ciphersuites using HMAC */
|
||||||
#if defined(MBEDTLS_SHA512_C)
|
#if defined(MBEDTLS_SHA512_C)
|
||||||
|
@ -683,7 +683,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
|||||||
/*
|
/*
|
||||||
* Encrypt
|
* Encrypt
|
||||||
*/
|
*/
|
||||||
#if defined(MBEDTLS_CIPHER_NULL_CIPHER)
|
#if defined(MBEDTLS_SSL_SOME_MODES_USE_STREAM)
|
||||||
if( mode == MBEDTLS_MODE_STREAM )
|
if( mode == MBEDTLS_MODE_STREAM )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
@ -708,7 +708,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* MBEDTLS_CIPHER_NULL_CIPHER */
|
#endif /* MBEDTLS_SSL_SOME_MODES_USE_STREAM */
|
||||||
|
|
||||||
#if defined(MBEDTLS_GCM_C) || \
|
#if defined(MBEDTLS_GCM_C) || \
|
||||||
defined(MBEDTLS_CCM_C) || \
|
defined(MBEDTLS_CCM_C) || \
|
||||||
@ -1245,7 +1245,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
|||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_NULL_CIPHER)
|
#if defined(MBEDTLS_SSL_SOME_MODES_USE_STREAM)
|
||||||
if( mode == MBEDTLS_MODE_STREAM )
|
if( mode == MBEDTLS_MODE_STREAM )
|
||||||
{
|
{
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
@ -1266,7 +1266,7 @@ int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* MBEDTLS_CIPHER_NULL_CIPHER */
|
#endif /* MBEDTLS_SSL_SOME_MODES_USE_STREAM */
|
||||||
#if defined(MBEDTLS_GCM_C) || \
|
#if defined(MBEDTLS_GCM_C) || \
|
||||||
defined(MBEDTLS_CCM_C) || \
|
defined(MBEDTLS_CCM_C) || \
|
||||||
defined(MBEDTLS_CHACHAPOLY_C)
|
defined(MBEDTLS_CHACHAPOLY_C)
|
||||||
|
Reference in New Issue
Block a user