@@ -1084,6 +1084,21 @@ static int do_dual_alg_tls13_connection(byte *caCert, word32 caCertSz,
10841084 return EXPECT_RESULT();
10851085}
10861086
1087+ static int extCount = 0;
1088+ static int myUnknownExtCallback(const word16* oid, word32 oidSz, int crit,
1089+ const unsigned char* der, word32 derSz)
1090+ {
1091+ (void) oid;
1092+ (void) oidSz;
1093+ (void) crit;
1094+ (void) der;
1095+ (void) derSz;
1096+ extCount ++;
1097+ /* Accept all extensions. This is only a test. Normally we would be much more
1098+ * careful about critical extensions. */
1099+ return 1;
1100+ }
1101+
10871102static int test_dual_alg_support(void)
10881103{
10891104 EXPECT_DECLS;
@@ -1099,6 +1114,7 @@ static int test_dual_alg_support(void)
10991114 int rootSz = 0;
11001115 byte *server = NULL;
11011116 int serverSz = 0;
1117+ WOLFSSL_CERT_MANAGER* cm = NULL;
11021118
11031119 ExpectIntEQ(load_file(keyFile, &serverKey, &serverKeySz), 0);
11041120
@@ -1130,6 +1146,20 @@ static int test_dual_alg_support(void)
11301146 ExpectIntEQ(do_dual_alg_tls13_connection(root, rootSz,
11311147 server, serverSz, serverKey, (word32)serverKeySz, 1),
11321148 TEST_SUCCESS);
1149+
1150+ /* Lets see if CertManager can find the new extensions */
1151+ extCount = 0;
1152+ ExpectNotNull(cm = wolfSSL_CertManagerNew());
1153+ wolfSSL_CertManagerSetUnknownExtCallback(cm, myUnknownExtCallback);
1154+ ExpectIntEQ(wolfSSL_CertManagerLoadCABuffer(cm, root, rootSz,
1155+ SSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
1156+ ExpectIntEQ(wolfSSL_CertManagerVerifyBuffer(cm, server, serverSz,
1157+ SSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
1158+ /* There is only 1 unknown exension (1.2.3.4.5). The other ones are known
1159+ * because they are for the dual alg extensions. */
1160+ ExpectIntEQ(extCount, 1);
1161+ wolfSSL_CertManagerFree(cm);
1162+
11331163 XFREE(root, NULL, DYNAMIC_TYPE_TMP_BUFFER);
11341164 XFREE(server, NULL, DYNAMIC_TYPE_TMP_BUFFER);
11351165
0 commit comments