Skip to content

Commit 0a69f14

Browse files
Merge pull request #10015 from gabor-mezei-arm/9682_remove_RSA_key_exchange
Remove the RSA-decryption key exchange
2 parents 4515d10 + 2c7f388 commit 0a69f14

26 files changed

+77
-825
lines changed
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removals
2+
* Remove support for the RSA key exchange in TLS 1.2.

docs/architecture/tls13-support.md

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ Support description
116116
| | |
117117
| MBEDTLS_KEY_EXCHANGE_PSK_ENABLED | n/a (2) |
118118
| MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED | n/a |
119-
| MBEDTLS_KEY_EXCHANGE_RSA_ENABLED | n/a |
120119
| MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED | n/a |
121120
| MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED | n/a |
122121
| MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED | n/a |

framework

include/mbedtls/check_config.h

+1-8
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@
8787
#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
8888
#endif
8989

90-
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \
91-
( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
92-
!defined(MBEDTLS_PKCS1_V15) )
93-
#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
94-
#endif
95-
9690
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
9791
( !defined(PSA_WANT_ALG_JPAKE) || \
9892
!defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \
@@ -155,8 +149,7 @@
155149
#endif
156150

157151
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
158-
!(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
159-
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
152+
!(defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
160153
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
161154
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
162155
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \

include/mbedtls/config_adjust_ssl.h

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#undef MBEDTLS_SSL_ENCRYPT_THEN_MAC
6262
#undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET
6363
#undef MBEDTLS_SSL_RENEGOTIATION
64-
#undef MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
6564
#undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
6665
#undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
6766
#undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED

include/mbedtls/mbedtls_config.h

-25
Original file line numberDiff line numberDiff line change
@@ -360,31 +360,6 @@
360360
*/
361361
#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
362362

363-
/**
364-
* \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
365-
*
366-
* Enable the RSA-only based ciphersuite modes in SSL / TLS.
367-
*
368-
* Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
369-
* MBEDTLS_X509_CRT_PARSE_C
370-
*
371-
* This enables the following ciphersuites (if other requisites are
372-
* enabled as well):
373-
* MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
374-
* MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
375-
* MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
376-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
377-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
378-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
379-
* MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
380-
* MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
381-
* MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
382-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
383-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
384-
* MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
385-
*/
386-
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
387-
388363
/**
389364
* \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
390365
*

include/mbedtls/ssl.h

+2-80
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,6 @@
650650
/* Dummy type used only for its size */
651651
union mbedtls_ssl_premaster_secret {
652652
unsigned char dummy; /* Make the union non-empty even with SSL disabled */
653-
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
654-
unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
655-
#endif
656653
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
657654
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
658655
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
@@ -1002,80 +999,14 @@ typedef int mbedtls_ssl_async_sign_t(mbedtls_ssl_context *ssl,
1002999
mbedtls_md_type_t md_alg,
10031000
const unsigned char *hash,
10041001
size_t hash_len);
1005-
1006-
/**
1007-
* \brief Callback type: start external decryption operation.
1008-
*
1009-
* This callback is called during an SSL handshake to start
1010-
* an RSA decryption operation using an
1011-
* external processor. The parameter \p cert contains
1012-
* the public key; it is up to the callback function to
1013-
* determine how to access the associated private key.
1014-
*
1015-
* This function typically sends or enqueues a request, and
1016-
* does not wait for the operation to complete. This allows
1017-
* the handshake step to be non-blocking.
1018-
*
1019-
* The parameters \p ssl and \p cert are guaranteed to remain
1020-
* valid throughout the handshake. On the other hand, this
1021-
* function must save the contents of \p input if the value
1022-
* is needed for later processing, because the \p input buffer
1023-
* is no longer valid after this function returns.
1024-
*
1025-
* This function may call mbedtls_ssl_set_async_operation_data()
1026-
* to store an operation context for later retrieval
1027-
* by the resume or cancel callback.
1028-
*
1029-
* \warning RSA decryption as used in TLS is subject to a potential
1030-
* timing side channel attack first discovered by Bleichenbacher
1031-
* in 1998. This attack can be remotely exploitable
1032-
* in practice. To avoid this attack, you must ensure that
1033-
* if the callback performs an RSA decryption, the time it
1034-
* takes to execute and return the result does not depend
1035-
* on whether the RSA decryption succeeded or reported
1036-
* invalid padding.
1037-
*
1038-
* \param ssl The SSL connection instance. It should not be
1039-
* modified other than via
1040-
* mbedtls_ssl_set_async_operation_data().
1041-
* \param cert Certificate containing the public key.
1042-
* In simple cases, this is one of the pointers passed to
1043-
* mbedtls_ssl_conf_own_cert() when configuring the SSL
1044-
* connection. However, if other callbacks are used, this
1045-
* property may not hold. For example, if an SNI callback
1046-
* is registered with mbedtls_ssl_conf_sni(), then
1047-
* this callback determines what certificate is used.
1048-
* \param input Buffer containing the input ciphertext. This buffer
1049-
* is no longer valid when the function returns.
1050-
* \param input_len Size of the \p input buffer in bytes.
1051-
*
1052-
* \return 0 if the operation was started successfully and the SSL
1053-
* stack should call the resume callback immediately.
1054-
* \return #MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS if the operation
1055-
* was started successfully and the SSL stack should return
1056-
* immediately without calling the resume callback yet.
1057-
* \return #MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH if the external
1058-
* processor does not support this key. The SSL stack will
1059-
* use the private key object instead.
1060-
* \return Any other error indicates a fatal failure and is
1061-
* propagated up the call chain. The callback should
1062-
* use \c MBEDTLS_ERR_PK_xxx error codes, and <b>must not</b>
1063-
* use \c MBEDTLS_ERR_SSL_xxx error codes except as
1064-
* directed in the documentation of this callback.
1065-
*/
1066-
typedef int mbedtls_ssl_async_decrypt_t(mbedtls_ssl_context *ssl,
1067-
mbedtls_x509_crt *cert,
1068-
const unsigned char *input,
1069-
size_t input_len);
10701002
#endif /* MBEDTLS_X509_CRT_PARSE_C */
10711003

10721004
/**
10731005
* \brief Callback type: resume external operation.
10741006
*
10751007
* This callback is called during an SSL handshake to resume
10761008
* an external operation started by the
1077-
* ::mbedtls_ssl_async_sign_t or
1078-
* ::mbedtls_ssl_async_decrypt_t callback.
1009+
* ::mbedtls_ssl_async_sign_t callback.
10791010
*
10801011
* This function typically checks the status of a pending
10811012
* request or causes the request queue to make progress, and
@@ -1541,7 +1472,6 @@ struct mbedtls_ssl_config {
15411472
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
15421473
#if defined(MBEDTLS_X509_CRT_PARSE_C)
15431474
mbedtls_ssl_async_sign_t *MBEDTLS_PRIVATE(f_async_sign_start); /*!< start asynchronous signature operation */
1544-
mbedtls_ssl_async_decrypt_t *MBEDTLS_PRIVATE(f_async_decrypt_start); /*!< start asynchronous decryption operation */
15451475
#endif /* MBEDTLS_X509_CRT_PARSE_C */
15461476
mbedtls_ssl_async_resume_t *MBEDTLS_PRIVATE(f_async_resume); /*!< resume asynchronous operation */
15471477
mbedtls_ssl_async_cancel_t *MBEDTLS_PRIVATE(f_async_cancel); /*!< cancel asynchronous operation */
@@ -2857,17 +2787,10 @@ static inline uintptr_t mbedtls_ssl_get_user_data_n(
28572787
* external processor does not support any signature
28582788
* operation; in this case the private key object
28592789
* associated with the certificate will be used.
2860-
* \param f_async_decrypt Callback to start a decryption operation. See
2861-
* the description of ::mbedtls_ssl_async_decrypt_t
2862-
* for more information. This may be \c NULL if the
2863-
* external processor does not support any decryption
2864-
* operation; in this case the private key object
2865-
* associated with the certificate will be used.
28662790
* \param f_async_resume Callback to resume an asynchronous operation. See
28672791
* the description of ::mbedtls_ssl_async_resume_t
28682792
* for more information. This may not be \c NULL unless
2869-
* \p f_async_sign and \p f_async_decrypt are both
2870-
* \c NULL.
2793+
* \p f_async_sign is \c NULL.
28712794
* \param f_async_cancel Callback to cancel an asynchronous operation. See
28722795
* the description of ::mbedtls_ssl_async_cancel_t
28732796
* for more information. This may be \c NULL if
@@ -2879,7 +2802,6 @@ static inline uintptr_t mbedtls_ssl_get_user_data_n(
28792802
*/
28802803
void mbedtls_ssl_conf_async_private_cb(mbedtls_ssl_config *conf,
28812804
mbedtls_ssl_async_sign_t *f_async_sign,
2882-
mbedtls_ssl_async_decrypt_t *f_async_decrypt,
28832805
mbedtls_ssl_async_resume_t *f_async_resume,
28842806
mbedtls_ssl_async_cancel_t *f_async_cancel,
28852807
void *config_data);

include/mbedtls/ssl_ciphersuites.h

+2-36
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,11 @@ extern "C" {
2424
/*
2525
* Supported ciphersuites (Official IANA names)
2626
*/
27-
#define MBEDTLS_TLS_RSA_WITH_NULL_MD5 0x01 /**< Weak! */
28-
#define MBEDTLS_TLS_RSA_WITH_NULL_SHA 0x02 /**< Weak! */
29-
3027
#define MBEDTLS_TLS_PSK_WITH_NULL_SHA 0x2C /**< Weak! */
31-
#define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA 0x2F
32-
33-
#define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA 0x35
34-
35-
#define MBEDTLS_TLS_RSA_WITH_NULL_SHA256 0x3B /**< Weak! */
36-
#define MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C /**< TLS 1.2 */
37-
#define MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D /**< TLS 1.2 */
38-
39-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41
40-
41-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84
4228

4329
#define MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA 0x8C
4430
#define MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA 0x8D
4531

46-
#define MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C /**< TLS 1.2 */
47-
#define MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D /**< TLS 1.2 */
48-
4932
#define MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 0xA8 /**< TLS 1.2 */
5033
#define MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 0xA9 /**< TLS 1.2 */
5134

@@ -54,10 +37,6 @@ extern "C" {
5437
#define MBEDTLS_TLS_PSK_WITH_NULL_SHA256 0xB0 /**< Weak! */
5538
#define MBEDTLS_TLS_PSK_WITH_NULL_SHA384 0xB1 /**< Weak! */
5639

57-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA /**< TLS 1.2 */
58-
59-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0 /**< TLS 1.2 */
60-
6140
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001 /**< Weak! */
6241
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004
6342
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005
@@ -100,8 +79,6 @@ extern "C" {
10079
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A
10180
#define MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B
10281

103-
#define MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 0xC03C /**< TLS 1.2 */
104-
#define MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 0xC03D /**< TLS 1.2 */
10582
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC048 /**< TLS 1.2 */
10683
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC049 /**< TLS 1.2 */
10784
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC04A /**< TLS 1.2 */
@@ -110,8 +87,6 @@ extern "C" {
11087
#define MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC04D /**< TLS 1.2 */
11188
#define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 0xC04E /**< TLS 1.2 */
11289
#define MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 0xC04F /**< TLS 1.2 */
113-
#define MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 0xC050 /**< TLS 1.2 */
114-
#define MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 0xC051 /**< TLS 1.2 */
11590
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05C /**< TLS 1.2 */
11691
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05D /**< TLS 1.2 */
11792
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05E /**< TLS 1.2 */
@@ -136,8 +111,6 @@ extern "C" {
136111
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078
137112
#define MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079
138113

139-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A /**< TLS 1.2 */
140-
#define MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B /**< TLS 1.2 */
141114
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC086 /**< TLS 1.2 */
142115
#define MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC087 /**< TLS 1.2 */
143116
#define MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC088 /**< TLS 1.2 */
@@ -155,10 +128,6 @@ extern "C" {
155128
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A
156129
#define MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B
157130

158-
#define MBEDTLS_TLS_RSA_WITH_AES_128_CCM 0xC09C /**< TLS 1.2 */
159-
#define MBEDTLS_TLS_RSA_WITH_AES_256_CCM 0xC09D /**< TLS 1.2 */
160-
#define MBEDTLS_TLS_RSA_WITH_AES_128_CCM_8 0xC0A0 /**< TLS 1.2 */
161-
#define MBEDTLS_TLS_RSA_WITH_AES_256_CCM_8 0xC0A1 /**< TLS 1.2 */
162131
#define MBEDTLS_TLS_PSK_WITH_AES_128_CCM 0xC0A4 /**< TLS 1.2 */
163132
#define MBEDTLS_TLS_PSK_WITH_AES_256_CCM 0xC0A5 /**< TLS 1.2 */
164133
#define MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8 0xC0A8 /**< TLS 1.2 */
@@ -190,7 +159,6 @@ extern "C" {
190159
*/
191160
typedef enum {
192161
MBEDTLS_KEY_EXCHANGE_NONE = 0,
193-
MBEDTLS_KEY_EXCHANGE_RSA,
194162
MBEDTLS_KEY_EXCHANGE_ECDHE_RSA,
195163
MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA,
196164
MBEDTLS_KEY_EXCHANGE_PSK,
@@ -201,8 +169,7 @@ typedef enum {
201169
} mbedtls_key_exchange_type_t;
202170

203171
/* Key exchanges using a certificate */
204-
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
205-
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
172+
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
206173
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
207174
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
208175
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
@@ -260,8 +227,7 @@ typedef enum {
260227
#endif
261228

262229
/* Key exchanges that don't involve ephemeral keys */
263-
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
264-
defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
230+
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
265231
defined(MBEDTLS_KEY_EXCHANGE_SOME_ECDH_ENABLED)
266232
#define MBEDTLS_KEY_EXCHANGE_SOME_NON_PFS_ENABLED
267233
#endif

0 commit comments

Comments
 (0)