Skip to content

Commit ef66711

Browse files
committed
Address code comments, add new workflow for openvpn tests
1 parent ee96d10 commit ef66711

File tree

4 files changed

+131
-4
lines changed

4 files changed

+131
-4
lines changed

.github/workflows/openvpn.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: OpenVPN 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+
build_wolfprovider:
17+
name: Build wolfProvider
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
wolfssl_ref: [ 'master', 'v5.7.4-stable' ]
23+
steps:
24+
- name: Checkout wolfProvider
25+
uses: actions/checkout@v4
26+
27+
# Check if this version of wolfssl/wolfprovider has already been built,
28+
# mark to cache these items on post if we do end up building
29+
- name: Checking wolfSSL/wolfProvider in cache
30+
uses: actions/cache@v4
31+
id: wolfprov-cache
32+
with:
33+
path: |
34+
wolfssl-source
35+
wolfssl-install
36+
wolfprov-install
37+
provider.conf
38+
39+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
40+
lookup-only: true
41+
42+
# If wolfssl/wolfprovider have not yet been built, pull ossl from cache
43+
- name: Checking OpenSSL in cache
44+
if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true'
45+
uses: actions/cache@v4
46+
id: openssl-cache
47+
with:
48+
path: |
49+
openssl-source
50+
openssl-install
51+
52+
key: ossl-depends
53+
54+
# If not yet built this version, build it now
55+
- name: Build wolfProvider
56+
if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true'
57+
run: |
58+
WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh
59+
make check
60+
61+
- name: Print errors
62+
if: ${{ failure() }}
63+
run: |
64+
if [ -f test-suite.log ] ; then
65+
cat test-suite.log
66+
fi
67+
68+
test_openvpn:
69+
runs-on: ubuntu-22.04
70+
needs: build_wolfprovider
71+
# This should be a safe limit for the tests to run.
72+
timeout-minutes: 20
73+
strategy:
74+
matrix:
75+
openvpn_ref: [ 'master', 'release/2.6' ]
76+
wolfssl_ref: [ 'master', 'v5.7.4-stable' ]
77+
steps:
78+
- name: Retrieving OpenSSL from cache
79+
uses: actions/cache/restore@v4
80+
id: openssl-cache
81+
with:
82+
path: |
83+
openssl-source
84+
openssl-install
85+
86+
key: ossl-depends
87+
fail-on-cache-miss: true
88+
89+
- name: Retrieving wolfSSL/wolfProvider from cache
90+
uses: actions/cache/restore@v4
91+
id: wolfprov-cache
92+
with:
93+
path: |
94+
wolfssl-source
95+
wolfssl-install
96+
wolfprov-install
97+
provider.conf
98+
99+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
100+
fail-on-cache-miss: true
101+
102+
- name: Install test dependencies
103+
run: |
104+
sudo apt-get update
105+
sudo apt-get install liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev \
106+
linux-libc-dev man2html libcmocka-dev python3-docutils \
107+
libtool automake autoconf libnl-genl-3-dev libnl-genl-3-200
108+
109+
- name: Build and test OpenVPN
110+
uses: wolfSSL/actions-build-autotools-project@v1
111+
with:
112+
repository: OpenVPN/openvpn
113+
path: openvpn
114+
ref: ${{ matrix.openvpn_ref }}
115+
configure:
116+
check: false
117+
118+
- name: Test OpenVPN with wolfProvider
119+
working-directory: openvpn
120+
run: |
121+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
122+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
123+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
124+
make check

src/wp_dh_kmgmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ static int wp_dh_decode(wp_DhEncDecCtx* ctx, OSSL_CORE_BIO *cBio,
21192119
ok = 0;
21202120
}
21212121
if (ok && (ctx->format == WP_ENC_FORMAT_TYPE_SPECIFIC)) {
2122-
if (selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) {
2122+
if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
21232123
if (!wp_dh_decode_params(dh, data, len)) {
21242124
ok = 0;
21252125
decoded = 0;

src/wp_ecc_kmgmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@ static int wp_ecc_encode(wp_EccEncDecCtx* ctx, OSSL_CORE_BIO *cBio,
24702470
ok = 0;
24712471
}
24722472
}
2473-
else if(selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) {
2473+
else if (selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) {
24742474
if (!wp_ecc_encode_params_size(key, &derLen)) {
24752475
ok = 0;
24762476
}
@@ -2515,7 +2515,7 @@ static int wp_ecc_encode(wp_EccEncDecCtx* ctx, OSSL_CORE_BIO *cBio,
25152515
ok = 0;
25162516
}
25172517
}
2518-
else if(selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) {
2518+
else if (selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) {
25192519
pemType = DH_PARAM_TYPE;
25202520
if (!wp_ecc_encode_params(key, derData, &derLen)) {
25212521
ok = 0;

src/wp_file_store.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ static wp_FileCtx* wp_file_open(WOLFPROV_CTX* provCtx, const char* uri)
110110
int ok = 1;
111111

112112
if (OPENSSL_strncasecmp(uri, "file:", 5) == 0) {
113-
/* TODO: may need more uri processing for extended/windows cases */
114113
uri += 5;
114+
if (OPENSSL_strncasecmp(uri, "//", 2) == 0) {
115+
/* TODO: may need more uri processing for windows cases */
116+
uri += 2;
117+
}
115118
}
116119
ctx->uri = OPENSSL_strdup(uri);
117120
if (ctx->uri == NULL) {

0 commit comments

Comments
 (0)