Skip to content

Commit 7c44f14

Browse files
committed
add apple test to github actions
1 parent d3b30f8 commit 7c44f14

4 files changed

Lines changed: 41 additions & 9 deletions

File tree

.github/workflows/macos-ancv.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: MacOS apple native cert validation tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
make_check:
17+
strategy:
18+
fail-fast: false
19+
runs-on: macos-latest
20+
# This should be a safe limit for the tests to run.
21+
timeout-minutes: 5
22+
steps:
23+
- name: Build and configure wolfSSL
24+
uses: wolfSSL/actions-build-autotools-project@v1
25+
with:
26+
configure: CFLAGS='-DWOLFSSL_APPLE_NATIVE_CERT_VALIDATION -DWOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION -DRSA_MIN_SIZE=2048 -DNO_WOLFSSL_CIPHER_SUITE_TEST'
27+

src/internal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42857,6 +42857,8 @@ static int DisplaySecTrustError(CFErrorRef error, SecTrustRef trust)
4285742857
return 0;
4285842858
}
4285942859

42860+
#if defined(WOLFSSL_APPLE_NATIVE_CERT_VALIDATION) && \
42861+
defined (WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION)
4286042862
static int MaxValidityPeriodErrorOnly(CFErrorRef error)
4286142863
{
4286242864
int multiple = 0;
@@ -42896,7 +42898,7 @@ static int MaxValidityPeriodErrorOnly(CFErrorRef error)
4289642898
}
4289742899
return multiple;
4289842900
}
42899-
42901+
#endif
4290042902
/*
4290142903
* Validates a chain of certificates using the Apple system trust APIs
4290242904
*
@@ -42999,7 +43001,7 @@ static int DoAppleNativeCertValidation(WOLFSSL* ssl,
4299943001
code);
4300043002
DisplaySecTrustError(error, trust);
4300143003

43002-
#if WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
43004+
#ifdef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
4300343005
/* TEST ONLY CODE:
4300443006
* wolfSSL API tests use a cert with a validity period that is too
4300543007
* long for the Apple system trust APIs

src/ssl_load.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#if defined(HAVE_SECURITY_SECTRUSTSETTINGS_H)
4747
#include <Security/SecTrustSettings.h>
4848
#endif /* HAVE_SECURITY_SECTRUSTSETTINGS_H */
49-
#if WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
49+
#ifdef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
5050
#include <CoreFoundation/CoreFoundation.h>
5151
#endif /* WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION */
5252
#endif /* __APPLE__ */

tests/api.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48373,6 +48373,7 @@ static int test_X509_LOOKUP_add_dir(void)
4837348373
!defined(WOLFSSL_NO_CLIENT_AUTH)) && !defined(NO_FILESYSTEM)
4837448374
#if !defined(NO_RSA) || defined(HAVE_ECC)
4837548375
/* Use the Cert Manager(CM) API to generate the error ASN_SIG_CONFIRM_E */
48376+
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
4837648377
static int verify_sig_cm(const char* ca, byte* cert_buf, size_t cert_sz,
4837748378
int type)
4837848379
{
@@ -48423,10 +48424,9 @@ static int verify_sig_cm(const char* ca, byte* cert_buf, size_t cert_sz,
4842348424

4842448425
return ret;
4842548426
}
48426-
#endif
48427+
4842748428

4842848429
#if !defined(NO_FILESYSTEM)
48429-
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
4843048430
static int test_RsaSigFailure_cm(void)
4843148431
{
4843248432
EXPECT_DECLS;
@@ -48501,7 +48501,8 @@ static int test_EccSigFailure_cm(void)
4850148501
#endif /* HAVE_ECC */
4850248502
return EXPECT_RESULT();
4850348503
}
48504-
#endif
48504+
#endif /* !NO_FILESYSTEM */
48505+
#endif /* !WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION*/
4850548506
#endif /* !NO_FILESYSTEM */
4850648507
#endif /* NO_CERTS */
4850748508

@@ -57928,6 +57929,7 @@ static int test_wolfSSL_dtls_stateless(void)
5792857929
* HAVE_IO_TESTS_DEPENDENCIES && !SINGLE_THREADED */
5792957930

5793057931
#ifdef HAVE_CERT_CHAIN_VALIDATION
57932+
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
5793157933
static int load_ca_into_cm(WOLFSSL_CERT_MANAGER* cm, char* certA)
5793257934
{
5793357935
int ret;
@@ -58106,7 +58108,6 @@ static int test_chainJ(WOLFSSL_CERT_MANAGER* cm)
5810658108
return ret;
5810758109
}
5810858110

58109-
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
5811058111
static int test_various_pathlen_chains(void)
5811158112
{
5811258113
EXPECT_DECLS;
@@ -66927,6 +66928,7 @@ static int test_get_signature_nid(void)
6692766928
return EXPECT_RESULT();
6692866929
}
6692966930

66931+
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
6693066932
#if !defined(NO_CERTS) && defined(HAVE_SSL_MEMIO_TESTS_DEPENDENCIES)
6693166933
static word32 test_tls_cert_store_unchanged_HashCaTable(Signer** caTable)
6693266934
{
@@ -67017,7 +67019,6 @@ static int test_tls_cert_store_unchanged_ssl_ready(WOLFSSL* ssl)
6701767019
}
6701867020
#endif
6701967021

67020-
#ifndef WOLFSSL_TEST_NATIVE_CERT_VALIDATION
6702167022
static int test_tls_cert_store_unchanged(void)
6702267023
{
6702367024
EXPECT_DECLS;
@@ -67074,7 +67075,7 @@ static int test_tls_cert_store_unchanged(void)
6707467075
#endif
6707567076
return EXPECT_RESULT();
6707667077
}
67077-
#endif
67078+
#endif /* !WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION */
6707867079

6707967080
static int test_wolfSSL_SendUserCanceled(void)
6708067081
{
@@ -68502,7 +68503,9 @@ TEST_CASE testCases[] = {
6850268503
TEST_DECL(test_write_dup),
6850368504
TEST_DECL(test_read_write_hs),
6850468505
TEST_DECL(test_get_signature_nid),
68506+
#ifndef WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION
6850568507
TEST_DECL(test_tls_cert_store_unchanged),
68508+
#endif
6850668509
TEST_DECL(test_wolfSSL_SendUserCanceled),
6850768510
TEST_DECL(test_wolfSSL_SSLDisableRead),
6850868511
TEST_DECL(test_wolfSSL_inject),

0 commit comments

Comments
 (0)