Skip to content

Commit a4544ce

Browse files
committed
Updates to address review comments
1 parent af537a6 commit a4544ce

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

tests/api.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41520,11 +41520,11 @@ static int test_wolfSSL_X509_max_altnames(void)
4152041520
0xff, 0x9f, 0xea, 0x78, 0x6f, 0x11, 0x9d, 0xe6
4152141521
};
4152241522

41523-
X509* x509 = NULL;
41524-
int certSize = (int)sizeof(too_many_altnames_cert) / sizeof(unsigned char);
41523+
WOLFSSL_X509* x509 = NULL;
41524+
int certSize = (int)(sizeof(too_many_altnames_cert) / sizeof(unsigned char));
4152541525

4152641526
ExpectNull(x509 = wolfSSL_X509_load_certificate_buffer(
41527-
too_many_altnames_cert, certSize, SSL_FILETYPE_ASN1));
41527+
too_many_altnames_cert, certSize, WOLFSSL_FILETYPE_ASN1));
4152841528
#endif
4152941529
#endif
4153041530
return EXPECT_RESULT();
@@ -41534,15 +41534,19 @@ static int test_wolfSSL_X509_max_name_constraints(void)
4153441534
{
4153541535
EXPECT_DECLS;
4153641536
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
41537-
!defined(NO_WOLFSSL_CLIENT)
41537+
!(defined(NO_WOLFSSL_CLIENT) && defined(NO_WOLFSSL_SERVER))
4153841538

4153941539
/* Only test if max name constraints has not been modified */
4154041540
#if WOLFSSL_MAX_NAME_CONSTRAINTS == 128
4154141541
WOLFSSL_CTX* ctx = NULL;
4154241542
/* File contains a certificate with 130 name constraints */
4154341543
const char* malformed_ca_cert = "./certs/test/cert-too-many-name-constraints.pem";
41544-
41544+
41545+
#ifndef NO_WOLFSSL_SERVER
41546+
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
41547+
#else
4154541548
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()));
41549+
#endif
4154641550

4154741551
ExpectIntNE(wolfSSL_CTX_load_verify_locations_ex(ctx, malformed_ca_cert, NULL,
4154841552
WOLFSSL_LOAD_FLAG_NONE), WOLFSSL_SUCCESS);

wolfssl/wolfcrypt/asn.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,10 +780,16 @@ extern const WOLFSSL_ObjectInfo wolfssl_object_info[];
780780
#define WOLFSSL_TLS_FEATURE_SUM 92
781781
#endif
782782

783+
/* Maximum number of allowed subject alternative names in a certificate.
784+
* Any certificate containing more than this number of subject
785+
* alternative names will cause an error when attempting to parse. */
783786
#ifndef WOLFSSL_MAX_ALT_NAMES
784787
#define WOLFSSL_MAX_ALT_NAMES 128
785788
#endif
786789

790+
/* Maximum number of allowed name constraints in a certificate.
791+
* Any certificate containing more than this number of name constraints
792+
* will cause an error when attempting to parse. */
787793
#ifndef WOLFSSL_MAX_NAME_CONSTRAINTS
788794
#define WOLFSSL_MAX_NAME_CONSTRAINTS 128
789795
#endif

0 commit comments

Comments
 (0)