@@ -39717,6 +39717,7 @@ static int test_wolfSSL_X509_NAME_ENTRY(void)
3971739717
3971839718 ExpectNotNull(subject = X509_NAME_oneline(nm, 0, 0));
3971939719 ExpectNotNull(XSTRSTR(subject, "favouriteDrink=tequila"));
39720+ ExpectNotNull(XSTRSTR(subject, "contentType=Server"));
3972039721 #ifdef DEBUG_WOLFSSL
3972139722 if (subject != NULL) {
3972239723 fprintf(stderr, "\n\t%s\n", subject);
@@ -57149,7 +57150,8 @@ static int test_ECDH_compute_key(void)
5714957150#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) && \
5715057151 defined(WOLFSSL_CERT_GEN) && defined(WOLFSSL_CERT_REQ) && \
5715157152 !defined(NO_ASN_TIME)
57152- static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey)
57153+ static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey,
57154+ int expectedDerSz)
5715357155{
5715457156 EXPECT_DECLS;
5715557157 X509* x509 = NULL;
@@ -57158,6 +57160,7 @@ static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey)
5715857160 time_t epoch_off = 0;
5715957161 ASN1_INTEGER* asn1_serial_number;
5716057162 long not_before, not_after;
57163+ int derSz;
5716157164
5716257165 ExpectNotNull(x509 = X509_new());
5716357166
@@ -57175,6 +57178,8 @@ static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey)
5717557178
5717657179 ExpectIntNE(X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_UTF8,
5717757180 (unsigned char*)"www.wolfssl.com", -1, -1, 0), 0);
57181+ ExpectIntNE(X509_NAME_add_entry_by_NID(name, NID_pkcs9_contentType,
57182+ MBSTRING_UTF8,(unsigned char*)"Server", -1, -1, 0), 0);
5717857183
5717957184 ExpectIntNE(X509_set_subject_name(x509, name), 0);
5718057185 ExpectIntNE(X509_set_issuer_name(x509, name), 0);
@@ -57188,6 +57193,9 @@ static int test_openssl_make_self_signed_certificate(EVP_PKEY* pkey)
5718857193
5718957194 ExpectIntNE(X509_sign(x509, pkey, EVP_sha256()), 0);
5719057195
57196+ ExpectNotNull(wolfSSL_X509_get_der(x509, &derSz));
57197+ ExpectIntGE(derSz, expectedDerSz);
57198+
5719157199 BN_free(serial_number);
5719257200 X509_NAME_free(name);
5719357201 X509_free(x509);
@@ -57205,6 +57213,7 @@ static int test_openssl_generate_key_and_cert(void)
5720557213 EC_KEY* ec_key = NULL;
5720657214#endif
5720757215#if !defined(NO_RSA)
57216+ int expectedDerSz;
5720857217 int key_length = 2048;
5720957218 BIGNUM* exponent = NULL;
5721057219 RSA* rsa = NULL;
@@ -57243,11 +57252,13 @@ static int test_openssl_generate_key_and_cert(void)
5724357252
5724457253 #if !defined(NO_CERTS) && defined(WOLFSSL_CERT_GEN) && \
5724557254 defined(WOLFSSL_CERT_REQ) && !defined(NO_ASN_TIME)
57246- ExpectIntEQ(test_openssl_make_self_signed_certificate(pkey),
57247- TEST_SUCCESS);
57255+ expectedDerSz = 743;
57256+ ExpectIntEQ(test_openssl_make_self_signed_certificate(pkey,
57257+ expectedDerSz), TEST_SUCCESS);
5724857258 #endif
5724957259 }
5725057260
57261+ (void)expectedDerSz;
5725157262 EVP_PKEY_free(pkey);
5725257263 pkey = NULL;
5725357264 BN_free(exponent);
@@ -57269,7 +57280,9 @@ static int test_openssl_generate_key_and_cert(void)
5726957280
5727057281#if !defined(NO_CERTS) && defined(WOLFSSL_CERT_GEN) && \
5727157282 defined(WOLFSSL_CERT_REQ) && !defined(NO_ASN_TIME)
57272- ExpectIntEQ(test_openssl_make_self_signed_certificate(pkey), TEST_SUCCESS);
57283+ expectedDerSz = 345;
57284+ ExpectIntEQ(test_openssl_make_self_signed_certificate(pkey, expectedDerSz),
57285+ TEST_SUCCESS);
5727357286#endif
5727457287
5727557288 EVP_PKEY_free(pkey);
0 commit comments