@@ -3162,75 +3162,6 @@ int test_tls13_warning_alert_is_fatal(void)
31623162 return EXPECT_RESULT ();
31633163}
31643164
3165- /* Test that an unknown extension in a TLS 1.3 server-to-client message is
3166- * rejected with unsupported_extension (RFC 8446 4.2). The client MUST abort
3167- * the handshake when it receives an extension it did not advertise.
3168- */
3169- int test_tls13_unknown_ext_rejected (void )
3170- {
3171- EXPECT_DECLS ;
3172- #if defined(WOLFSSL_TLS13 ) && defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES ) && \
3173- !defined(NO_WOLFSSL_CLIENT ) && defined(WOLFSSL_AES_128 ) && \
3174- defined(HAVE_AESGCM ) && !defined(NO_SHA256 ) && \
3175- !defined(WOLFSSL_TLS13_MIDDLEBOX_COMPAT )
3176- WOLFSSL_CTX * ctx_c = NULL ;
3177- WOLFSSL * ssl_c = NULL ;
3178- struct test_memio_ctx test_ctx ;
3179- /* HelloRetryRequest carrying TLS_AES_128_GCM_SHA256, supported_versions
3180- * (TLS 1.3), and an extra unknown extension type 0xFABC.
3181- *
3182- * The base HRR (from test_tls13_same_ch) extended with 4 bytes:
3183- * extensions length: 6 -> 10 (0x00,0x0a)
3184- * handshake body length: 46 -> 50 (0x00,0x00,0x32)
3185- * record body length: 50 -> 54 (0x00,0x36)
3186- * appended: 0xfa,0xbc,0x00,0x00 (unknown type, zero-length value)
3187- */
3188- static const unsigned char hrr_unknown_ext [] = {
3189- /* TLS record header: handshake, TLS 1.2 compat, len=54 */
3190- 0x16 , 0x03 , 0x03 , 0x00 , 0x36 ,
3191- /* Handshake header: ServerHello, len=50 */
3192- 0x02 , 0x00 , 0x00 , 0x32 ,
3193- /* legacy_version: TLS 1.2 */
3194- 0x03 , 0x03 ,
3195- /* HelloRetryRequest magic random */
3196- 0xcf , 0x21 , 0xad , 0x74 , 0xe5 , 0x9a , 0x61 , 0x11 ,
3197- 0xbe , 0x1d , 0x8c , 0x02 , 0x1e , 0x65 , 0xb8 , 0x91 ,
3198- 0xc2 , 0xa2 , 0x11 , 0x16 , 0x7a , 0xbb , 0x8c , 0x5e ,
3199- 0x07 , 0x9e , 0x09 , 0xe2 , 0xc8 , 0xa8 , 0x33 , 0x9c ,
3200- /* session ID length: 0 */
3201- 0x00 ,
3202- /* cipher suite: TLS_AES_128_GCM_SHA256 */
3203- 0x13 , 0x01 ,
3204- /* compression: null */
3205- 0x00 ,
3206- /* extensions length: 10 */
3207- 0x00 , 0x0a ,
3208- /* supported_versions: TLS 1.3 (0x0304) */
3209- 0x00 , 0x2b , 0x00 , 0x02 , 0x03 , 0x04 ,
3210- /* unknown extension type 0xFABC, zero-length value */
3211- 0xfa , 0xbc , 0x00 , 0x00
3212- };
3213-
3214- XMEMSET (& test_ctx , 0 , sizeof (test_ctx ));
3215- ExpectIntEQ (test_memio_setup (& test_ctx , & ctx_c , NULL , & ssl_c , NULL ,
3216- wolfTLSv1_3_client_method , NULL ), 0 );
3217-
3218- /* Inject the crafted HRR before the client starts the handshake.
3219- * wolfSSL_connect will send the ClientHello and then read this message. */
3220- ExpectIntEQ (test_memio_inject_message (& test_ctx , 1 ,
3221- (const char * )hrr_unknown_ext , sizeof (hrr_unknown_ext )), 0 );
3222-
3223- /* RFC 8446 4.2: the client MUST abort with unsupported_extension. */
3224- ExpectIntEQ (wolfSSL_connect (ssl_c ), -1 );
3225- ExpectIntEQ (wolfSSL_get_error (ssl_c , -1 ),
3226- WC_NO_ERR_TRACE (UNSUPPORTED_EXTENSION ));
3227-
3228- wolfSSL_free (ssl_c );
3229- wolfSSL_CTX_free (ctx_c );
3230- #endif
3231- return EXPECT_RESULT ();
3232- }
3233-
32343165/* Test that wolfSSL_set1_sigalgs_list() is honored in TLS 1.3
32353166 */
32363167int test_tls13_cert_req_sigalgs (void )
0 commit comments