Skip to content

Commit 4c63668

Browse files
ColtonWilleydouzzer
authored andcommitted
Small changes per review comments
1 parent 3fc3a84 commit 4c63668

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/x509_str.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static int X509StoreAddCa(WOLFSSL_X509_STORE* store,
4343
WOLFSSL_X509* x509, int type);
4444
#endif
4545

46+
/* Based on OpenSSL default max depth */
4647
#ifndef WOLFSSL_X509_STORE_DEFAULT_MAX_DEPTH
4748
#define WOLFSSL_X509_STORE_DEFAULT_MAX_DEPTH 100
4849
#endif
@@ -264,9 +265,9 @@ static int X509StoreVerifyCert(WOLFSSL_X509_STORE_CTX* ctx)
264265
if (ret != WC_NO_ERR_TRACE(ASN_BEFORE_DATE_E) &&
265266
ret != WC_NO_ERR_TRACE(ASN_AFTER_DATE_E)) {
266267
/* wolfSSL_CertManagerVerifyBuffer only returns ASN_AFTER_DATE_E or
267-
ASN_BEFORE_DATE_E if there are no additional errors found in the
268-
cert. Therefore, check if the cert is expired or not yet valid
269-
in order to return the correct expected error. */
268+
* ASN_BEFORE_DATE_E if there are no additional errors found in the
269+
* cert. Therefore, check if the cert is expired or not yet valid
270+
* in order to return the correct expected error. */
270271
byte *afterDate = ctx->current_cert->notAfter.data;
271272
byte *beforeDate = ctx->current_cert->notBefore.data;
272273

@@ -333,7 +334,7 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
333334
ret = wolfSSL_sk_X509_push(certs,
334335
wolfSSL_sk_X509_value(ctx->ctxIntermediates, i));
335336
if (ret <= 0) {
336-
return WOLFSSL_FAILURE;
337+
goto exit;
337338
}
338339

339340
numInterAdd++;

tests/api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60424,6 +60424,8 @@ static int test_X509_STORE_untrusted(void)
6042460424
/* Root CA in untrusted chain is OK */
6042560425
ExpectIntEQ(test_X509_STORE_untrusted_certs(untrusted3, 1, 0, 1),
6042660426
TEST_SUCCESS);
60427+
ExpectIntEQ(test_X509_STORE_untrusted_certs(untrusted3, 1, 0, 0),
60428+
TEST_SUCCESS);
6042760429
/* Succeeds because path to loaded CA is available. */
6042860430
ExpectIntEQ(test_X509_STORE_untrusted_certs(untrusted4, 1, 0, 1),
6042960431
TEST_SUCCESS);

wolfssl/ssl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3324,7 +3324,8 @@ enum {
33243324

33253325
WOLFSSL_USER_CA = 1, /* user added as trusted */
33263326
WOLFSSL_CHAIN_CA = 2, /* added to cache from trusted chain */
3327-
WOLFSSL_INTER_CA = 3 /* Intermediate CA */
3327+
WOLFSSL_INTER_CA = 3 /* Intermediate CA, only for use by
3328+
* X509_STORE */
33283329
};
33293330

33303331
WOLFSSL_ABI WOLFSSL_API WC_RNG* wolfSSL_GetRNG(WOLFSSL* ssl);

0 commit comments

Comments
 (0)