Skip to content

Commit 87ce965

Browse files
ColtonWilleydouzzer
authored andcommitted
Changes for various failing build configs
1 parent 1afbf55 commit 87ce965

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

src/ssl_certman.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ int wolfSSL_CertManagerUnloadCAs(WOLFSSL_CERT_MANAGER* cm)
455455
return ret;
456456
}
457457

458-
static int wolfSSL_CertManagerUnloadIntermediateCertsEx(WOLFSSL_CERT_MANAGER* cm,
459-
byte type)
458+
static int wolfSSL_CertManagerUnloadIntermediateCertsEx(
459+
WOLFSSL_CERT_MANAGER* cm, byte type)
460460
{
461461
int ret = WOLFSSL_SUCCESS;
462462

@@ -483,14 +483,16 @@ static int wolfSSL_CertManagerUnloadIntermediateCertsEx(WOLFSSL_CERT_MANAGER* cm
483483
}
484484

485485
#if defined(OPENSSL_EXTRA)
486-
static int wolfSSL_CertManagerUnloadTempIntermediateCerts(WOLFSSL_CERT_MANAGER* cm)
486+
static int wolfSSL_CertManagerUnloadTempIntermediateCerts(
487+
WOLFSSL_CERT_MANAGER* cm)
487488
{
488489
WOLFSSL_ENTER("wolfSSL_CertManagerUnloadTempIntermediateCerts");
489490
return wolfSSL_CertManagerUnloadIntermediateCertsEx(cm, WOLFSSL_INTER_CA);
490491
}
491492
#endif
492493

493-
int wolfSSL_CertManagerUnloadIntermediateCerts(WOLFSSL_CERT_MANAGER* cm)
494+
int wolfSSL_CertManagerUnloadIntermediateCerts(
495+
WOLFSSL_CERT_MANAGER* cm)
494496
{
495497
WOLFSSL_ENTER("wolfSSL_CertManagerUnloadIntermediateCerts");
496498
return wolfSSL_CertManagerUnloadIntermediateCertsEx(cm, WOLFSSL_CHAIN_CA);

src/x509.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7597,7 +7597,7 @@ int wolfSSL_X509_LOOKUP_load_file(WOLFSSL_X509_LOOKUP* lookup,
75977597
else if (wc_PemGetHeaderFooter(CERT_TYPE, &header, &footer) == 0 &&
75987598
XSTRNSTR((char*)curr, header, (unsigned int)sz) != NULL) {
75997599
ret = X509StoreLoadCertBuffer(lookup->store, curr,
7600-
(word32)sz, WOLFSSL_FILETYPE_PEM);
7600+
(word32)sz, WOLFSSL_FILETYPE_PEM);
76017601
if (ret != WOLFSSL_SUCCESS)
76027602
goto end;
76037603
curr = (byte*)XSTRNSTR((char*)curr, footer, (unsigned int)sz);
@@ -14205,8 +14205,9 @@ int wolfSSL_X509_NAME_digest(const WOLFSSL_X509_NAME *name,
1420514205

1420614206
#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
1420714207
defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL)
14208-
#if defined(OPENSSL_EXTRA) && (defined(SESSION_CERTS) || \
14209-
defined(WOLFSSL_SIGNER_DER_CERT))
14208+
#if defined(OPENSSL_EXTRA) && \
14209+
((defined(SESSION_CERTS) && !defined(WOLFSSL_QT)) || \
14210+
defined(WOLFSSL_SIGNER_DER_CERT))
1421014211

1421114212
/**
1421214213
* Find the issuing cert of the input cert. On a self-signed cert this

src/x509_str.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ static void SetupStoreCtxError(WOLFSSL_X509_STORE_CTX* ctx, int ret)
247247
static int X509StoreVerifyCert(WOLFSSL_X509_STORE_CTX* ctx)
248248
{
249249
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
250+
WOLFSSL_ENTER("X509StoreVerifyCert");
250251

251252
if (ctx->current_cert != NULL && ctx->current_cert->derCert != NULL) {
252253
ret = wolfSSL_CertManagerVerifyBuffer(ctx->store->cm,
@@ -874,7 +875,7 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_STORE_get1_certs(
874875
int wolfSSL_X509_STORE_CTX_get1_issuer(WOLFSSL_X509 **issuer,
875876
WOLFSSL_X509_STORE_CTX *ctx, WOLFSSL_X509 *x)
876877
{
877-
int ret = WOLFSSL_FAILURE;
878+
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
878879
WOLFSSL_ENTER("wolfSSL_X509_STORE_CTX_get1_issuer");
879880

880881
if (issuer == NULL || ctx == NULL || x == NULL)
@@ -960,6 +961,7 @@ WOLFSSL_X509_STORE* wolfSSL_X509_STORE_new(void)
960961
if ((store->cm = wolfSSL_CertManagerNew()) == NULL)
961962
goto err_exit;
962963

964+
#ifdef OPENSSL_EXTRA
963965
if ((store->certs = wolfSSL_sk_X509_new_null()) == NULL)
964966
goto err_exit;
965967

@@ -970,6 +972,7 @@ WOLFSSL_X509_STORE* wolfSSL_X509_STORE_new(void)
970972
if ((store->trusted = wolfSSL_sk_X509_new_null()) == NULL)
971973
goto err_exit;
972974
#endif
975+
#endif
973976

974977
#ifdef HAVE_CRL
975978
store->crl = store->cm->crl;
@@ -1057,6 +1060,7 @@ void wolfSSL_X509_STORE_free(WOLFSSL_X509_STORE* store)
10571060
wolfSSL_CertManagerFree(store->cm);
10581061
store->cm = NULL;
10591062
}
1063+
#if defined(OPENSSL_EXTRA)
10601064
if (store->certs != NULL) {
10611065
wolfSSL_sk_X509_free(store->certs);
10621066
store->certs = NULL;
@@ -1071,6 +1075,7 @@ void wolfSSL_X509_STORE_free(WOLFSSL_X509_STORE* store)
10711075
store->trusted = NULL;
10721076
}
10731077
#endif
1078+
#endif
10741079
#ifdef OPENSSL_ALL
10751080
if (store->objs != NULL) {
10761081
X509StoreFreeObjList(store, store->objs);
@@ -1270,14 +1275,24 @@ int wolfSSL_X509_STORE_add_cert(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509)
12701275
#if !defined(WOLFSSL_SIGNER_DER_CERT)
12711276
if (result == WOLFSSL_SUCCESS && store->trusted != NULL) {
12721277
result = wolfSSL_sk_X509_push(store->trusted, x509);
1273-
result = (result > 0) ? WOLFSSL_SUCCESS : WOLFSSL_FATAL_ERROR;
1278+
if (result > 0) {
1279+
result = WOLFSSL_SUCCESS;
1280+
}
1281+
else {
1282+
result = WOLFSSL_FATAL_ERROR;
1283+
}
12741284
}
12751285
#endif
12761286
}
12771287
else {
12781288
if (store->certs != NULL) {
12791289
result = wolfSSL_sk_X509_push(store->certs, x509);
1280-
result = (result > 0) ? WOLFSSL_SUCCESS : WOLFSSL_FATAL_ERROR;
1290+
if (result > 0) {
1291+
result = WOLFSSL_SUCCESS;
1292+
}
1293+
else {
1294+
result = WOLFSSL_FATAL_ERROR;
1295+
}
12811296
}
12821297
else {
12831298
/* If store->certs is NULL, this is an X509_STORE managed by an
@@ -1327,7 +1342,7 @@ int wolfSSL_X509_STORE_set_default_paths(WOLFSSL_X509_STORE* store)
13271342
int X509StoreLoadCertBuffer(WOLFSSL_X509_STORE *str,
13281343
byte *buf, word32 bufLen, int type)
13291344
{
1330-
int ret = WOLFSSL_FAILURE;
1345+
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
13311346
WOLFSSL_X509 *x509 = NULL;
13321347

13331348
if (str == NULL || buf == NULL) {
@@ -1654,6 +1669,10 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
16541669
{
16551670
WOLFSSL_STACK* ret = NULL;
16561671
WOLFSSL_STACK* cert_stack = NULL;
1672+
#if ((defined(WOLFSSL_SIGNER_DER_CERT) && !defined(NO_FILESYSTEM)) || \
1673+
(defined(HAVE_CRL)))
1674+
WOLFSSL_X509_OBJECT* obj = NULL;
1675+
#endif
16571676
#if defined(WOLFSSL_SIGNER_DER_CERT) && !defined(NO_FILESYSTEM)
16581677
WOLFSSL_X509* x509 = NULL;
16591678
int i = 0;
@@ -1698,7 +1717,7 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
16981717
* simplify cleanup logic handling cert merging above */
16991718
for (i = 0; i < wolfSSL_sk_X509_num(cert_stack); i++) {
17001719
x509 = wolfSSL_sk_value(cert_stack, i);
1701-
WOLFSSL_X509_OBJECT* obj = wolfSSL_X509_OBJECT_new();
1720+
obj = wolfSSL_X509_OBJECT_new();
17021721
if (obj == NULL) {
17031722
WOLFSSL_MSG("wolfSSL_X509_OBJECT_new error");
17041723
goto err_cleanup;
@@ -1720,7 +1739,7 @@ WOLF_STACK_OF(WOLFSSL_X509_OBJECT)* wolfSSL_X509_STORE_get0_objects(
17201739

17211740
#ifdef HAVE_CRL
17221741
if (store->cm->crl != NULL) {
1723-
WOLFSSL_X509_OBJECT* obj = wolfSSL_X509_OBJECT_new();
1742+
obj = wolfSSL_X509_OBJECT_new();
17241743
if (obj == NULL) {
17251744
WOLFSSL_MSG("wolfSSL_X509_OBJECT_new error");
17261745
goto err_cleanup;

0 commit comments

Comments
 (0)