|
370 | 370 | defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_CERT_GEN)) || \ |
371 | 371 | defined(WOLFSSL_TEST_STATIC_BUILD) || defined(WOLFSSL_DTLS) || \ |
372 | 372 | defined(HAVE_ECH) || defined(HAVE_EX_DATA) || !defined(NO_SESSION_CACHE) \ |
373 | | - || !defined(WOLFSSL_NO_TLS12) |
| 373 | + || !defined(WOLFSSL_NO_TLS12) || defined(WOLFSSL_TLS13) |
374 | 374 | /* for testing SSL_get_peer_cert_chain, or SESSION_TICKET_HINT_DEFAULT, |
375 | 375 | * for setting authKeyIdSrc in WOLFSSL_X509, or testing DTLS sequence |
376 | 376 | * number tracking */ |
@@ -44849,20 +44849,14 @@ static int test_wolfSSL_cert_cb_dyn_ciphers_certCB(WOLFSSL* ssl, void* arg) |
44849 | 44849 | hashSigAlgoSz == 0) |
44850 | 44850 | return 0; |
44851 | 44851 |
|
44852 | | - if (wolfSSL_GetVersion(ssl) != TLSv1_3_MINOR) { |
44853 | | - for (idx = 0; idx < suiteSz; idx += 2) { |
44854 | | - const char* cipherName = wolfSSL_get_cipher_name_from_suite( |
44855 | | - suites[idx], suites[idx+1]); |
44856 | | - if (cipherName == NULL) |
44857 | | - return 0; |
44858 | | - /* TLS 1.3 suites tell us nothing about the sigalg */ |
44859 | | - if (XSTRSTR(cipherName, "TLS13-") != NULL) |
44860 | | - continue; |
44861 | | - if (XSTRSTR(cipherName, "-RSA-") != NULL) |
44862 | | - haveRSA = 1; |
44863 | | - if (XSTRSTR(cipherName, "-ECDSA-") != NULL) |
44864 | | - haveECC = 1; |
44865 | | - } |
| 44852 | + for (idx = 0; idx < suiteSz; idx += 2) { |
| 44853 | + WOLFSSL_CIPHERSUITE_INFO info = |
| 44854 | + wolfSSL_get_ciphersuite_info(suites[idx], suites[idx+1]); |
| 44855 | + |
| 44856 | + if (info.rsaAuth) |
| 44857 | + haveRSA = 1; |
| 44858 | + else if (info.eccAuth) |
| 44859 | + haveECC = 1; |
44866 | 44860 | } |
44867 | 44861 |
|
44868 | 44862 | if (hashSigAlgoSz > 0) { |
@@ -44998,6 +44992,96 @@ static int test_wolfSSL_cert_cb_dyn_ciphers(void) |
44998 | 44992 | return EXPECT_RESULT(); |
44999 | 44993 | } |
45000 | 44994 |
|
| 44995 | +static int test_wolfSSL_ciphersuite_auth(void) |
| 44996 | +{ |
| 44997 | + EXPECT_DECLS; |
| 44998 | +#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EXTRA) |
| 44999 | + WOLFSSL_CIPHERSUITE_INFO info; |
| 45000 | + |
| 45001 | + (void)info; |
| 45002 | + |
| 45003 | +#ifndef WOLFSSL_NO_TLS12 |
| 45004 | +#ifdef HAVE_CHACHA |
| 45005 | + info = wolfSSL_get_ciphersuite_info(CHACHA_BYTE, |
| 45006 | + TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256); |
| 45007 | + ExpectIntEQ(info.rsaAuth, 1); |
| 45008 | + ExpectIntEQ(info.eccAuth, 0); |
| 45009 | + ExpectIntEQ(info.eccStatic, 0); |
| 45010 | + ExpectIntEQ(info.psk, 0); |
| 45011 | + |
| 45012 | + info = wolfSSL_get_ciphersuite_info(CHACHA_BYTE, |
| 45013 | + TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256); |
| 45014 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45015 | + ExpectIntEQ(info.eccAuth, 1); |
| 45016 | + ExpectIntEQ(info.eccStatic, 0); |
| 45017 | + ExpectIntEQ(info.psk, 0); |
| 45018 | + |
| 45019 | + info = wolfSSL_get_ciphersuite_info(CHACHA_BYTE, |
| 45020 | + TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256); |
| 45021 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45022 | + ExpectIntEQ(info.eccAuth, 0); |
| 45023 | + ExpectIntEQ(info.eccStatic, 0); |
| 45024 | + ExpectIntEQ(info.psk, 1); |
| 45025 | +#endif |
| 45026 | +#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448) |
| 45027 | +#ifndef NO_RSA |
| 45028 | + info = wolfSSL_get_ciphersuite_info(ECC_BYTE, |
| 45029 | + TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA); |
| 45030 | + ExpectIntEQ(info.rsaAuth, 1); |
| 45031 | + ExpectIntEQ(info.eccAuth, 0); |
| 45032 | + ExpectIntEQ(info.eccStatic, 0); |
| 45033 | + ExpectIntEQ(info.psk, 0); |
| 45034 | + |
| 45035 | + info = wolfSSL_get_ciphersuite_info(ECC_BYTE, |
| 45036 | + TLS_ECDH_RSA_WITH_AES_128_CBC_SHA); |
| 45037 | + ExpectIntEQ(info.rsaAuth, 1); |
| 45038 | + ExpectIntEQ(info.eccAuth, 0); |
| 45039 | + ExpectIntEQ(info.eccStatic, 1); |
| 45040 | + ExpectIntEQ(info.psk, 0); |
| 45041 | + |
| 45042 | + info = wolfSSL_get_ciphersuite_info(ECC_BYTE, |
| 45043 | + TLS_ECDH_RSA_WITH_AES_256_CBC_SHA); |
| 45044 | + ExpectIntEQ(info.rsaAuth, 1); |
| 45045 | + ExpectIntEQ(info.eccAuth, 0); |
| 45046 | + ExpectIntEQ(info.eccStatic, 1); |
| 45047 | + ExpectIntEQ(info.psk, 0); |
| 45048 | +#endif |
| 45049 | + info = wolfSSL_get_ciphersuite_info(ECC_BYTE, |
| 45050 | + TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA); |
| 45051 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45052 | + ExpectIntEQ(info.eccAuth, 1); |
| 45053 | + ExpectIntEQ(info.eccStatic, 0); |
| 45054 | + ExpectIntEQ(info.psk, 0); |
| 45055 | + |
| 45056 | + info = wolfSSL_get_ciphersuite_info(ECC_BYTE, |
| 45057 | + TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA); |
| 45058 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45059 | + ExpectIntEQ(info.eccAuth, 1); |
| 45060 | + ExpectIntEQ(info.eccStatic, 1); |
| 45061 | + ExpectIntEQ(info.psk, 0); |
| 45062 | + |
| 45063 | + info = wolfSSL_get_ciphersuite_info(ECDHE_PSK_BYTE, |
| 45064 | + TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256); |
| 45065 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45066 | + ExpectIntEQ(info.eccAuth, 0); |
| 45067 | + ExpectIntEQ(info.eccStatic, 0); |
| 45068 | + ExpectIntEQ(info.psk, 1); |
| 45069 | +#endif |
| 45070 | +#endif |
| 45071 | + |
| 45072 | +#ifdef WOLFSSL_TLS13 |
| 45073 | + info = wolfSSL_get_ciphersuite_info(TLS13_BYTE, |
| 45074 | + TLS_AES_128_GCM_SHA256); |
| 45075 | + ExpectIntEQ(info.rsaAuth, 0); |
| 45076 | + ExpectIntEQ(info.eccAuth, 0); |
| 45077 | + ExpectIntEQ(info.eccStatic, 0); |
| 45078 | + ExpectIntEQ(info.psk, 0); |
| 45079 | +#endif |
| 45080 | + |
| 45081 | +#endif |
| 45082 | + return EXPECT_RESULT(); |
| 45083 | +} |
| 45084 | + |
45001 | 45085 | static int test_wolfSSL_SESSION(void) |
45002 | 45086 | { |
45003 | 45087 | EXPECT_DECLS; |
@@ -69183,6 +69267,7 @@ TEST_CASE testCases[] = { |
69183 | 69267 | #endif |
69184 | 69268 | TEST_DECL(test_wolfSSL_cert_cb), |
69185 | 69269 | TEST_DECL(test_wolfSSL_cert_cb_dyn_ciphers), |
| 69270 | + TEST_DECL(test_wolfSSL_ciphersuite_auth), |
69186 | 69271 | /* Can't memory test as tcp_connect aborts. */ |
69187 | 69272 | TEST_DECL(test_wolfSSL_SESSION), |
69188 | 69273 | TEST_DECL(test_wolfSSL_SESSION_expire_downgrade), |
|
0 commit comments