Skip to content

Commit 85623cb

Browse files
committed
Move cmd line tests to separate yaml, add tags for testing in simple.yml
1 parent bd00908 commit 85623cb

4 files changed

Lines changed: 119 additions & 10 deletions

File tree

.github/workflows/cmdline.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Command Line 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+
cmdtest_test:
17+
name: Command line test
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
openssl_ref: [ 'master', 'openssl-3.5.0' ]
23+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
25+
debug: ['WOLFPROV_DEBUG=1', '']
26+
steps:
27+
- name: Checkout wolfProvider
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Checking wolfSSL/wolfProvider in cache
33+
# Debug builds are not currently supported by build-wolfprovider.yml
34+
# so those are manually built as a separate step.
35+
if: ${{ matrix.debug == '' }}
36+
uses: actions/cache@v4
37+
id: wolfprov-cache
38+
with:
39+
path: |
40+
wolfssl-install
41+
wolfprov-install
42+
openssl-install/lib64
43+
openssl-install/include
44+
openssl-install/bin
45+
46+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
47+
# Normally we would fail on cache miss, but we rebuild below
48+
# for the DEBUG build.
49+
fail-on-cache-miss: false
50+
51+
# If not yet built this version, build it now
52+
- name: Build wolfProvider
53+
# Only run the test for a cache miss. On hit, we've already run the test.
54+
if: steps.wolfprov-cache-restore.cache-hit != 'true'
55+
run: |
56+
${{ matrix.debug }} OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh
57+
58+
- name: Run tests
59+
run: |
60+
${{ matrix.force_fail }} ${{ matrix.debug }} ./scripts/cmd_test/do-cmd-tests.sh

.github/workflows/simple.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,19 @@ jobs:
2020
openssl_ref: ${{ matrix.openssl_ref }}
2121
strategy:
2222
matrix:
23-
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24-
openssl_ref: [ 'master', 'openssl-3.5.0' ]
23+
wolfssl_ref: [
24+
'master',
25+
'v5.8.2-stable',
26+
'v5.8.0-stable']
27+
# Test against the newest of each minor version
28+
openssl_ref: [
29+
'openssl-3.5.2',
30+
'openssl-3.4.2',
31+
'openssl-3.3.4',
32+
'openssl-3.2.5',
33+
'openssl-3.1.8',
34+
'openssl-3.0.17']
35+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
2536
debug: ['WOLFPROV_DEBUG=1', '']
2637

2738
simple_test:
@@ -31,9 +42,20 @@ jobs:
3142
timeout-minutes: 20
3243
strategy:
3344
matrix:
34-
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
35-
openssl_ref: [ 'master', 'openssl-3.5.0' ]
45+
wolfssl_ref: [
46+
'master',
47+
'v5.8.2-stable',
48+
'v5.8.0-stable']
49+
# Test against the newest of each minor version
50+
openssl_ref: [
51+
'openssl-3.5.2',
52+
'openssl-3.4.2',
53+
'openssl-3.3.4',
54+
'openssl-3.2.5',
55+
'openssl-3.1.8',
56+
'openssl-3.0.17']
3657
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
58+
debug: ['WOLFPROV_DEBUG=1', '']
3759
steps:
3860
- name: Checkout wolfProvider
3961
uses: actions/checkout@v4
@@ -55,16 +77,22 @@ jobs:
5577
openssl-install/bin
5678
5779
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
58-
fail-on-cache-miss: true
80+
# Normally we would fail on cache miss, but we rebuild below
81+
# for the DEBUG build.
82+
fail-on-cache-miss: false
5983

60-
- name: Build wolfProvider
61-
if: ${{ matrix.debug != '' }}
84+
- name: Build and test wolfProvider
85+
# Only run the test for a cache miss. On hit, we've already run the test.
86+
if: steps.wolfprov-cache-restore.cache-hit != 'true'
6287
run: |
6388
${{ matrix.debug }} \
6489
OPENSSL_TAG=${{ matrix.openssl_ref }} \
6590
WOLFSSL_TAG=${{ matrix.wolfssl_ref }} \
6691
./scripts/build-wolfprovider.sh
6792
68-
- name: Run simple tests
93+
- name: Print errors
94+
if: ${{ failure() }}
6995
run: |
70-
${{ matrix.force_fail }} ./scripts/cmd_test/do-cmd-tests.sh
96+
if [ -f test-suite.log ] ; then
97+
cat test-suite.log
98+
fi

test/test_hkdf.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,56 +109,76 @@ static int test_hkdf_double_set_salt(OSSL_LIB_CTX* libCtx, unsigned char *key,
109109

110110
ctx = EVP_PKEY_CTX_new_from_name(libCtx, "HKDF", NULL);
111111
if (ctx == NULL) {
112+
PRINT_MSG("Failed to create HKDF context");
112113
err = 1;
113114
}
114115
if (err == 0) {
115116
if (EVP_PKEY_derive_init(ctx) != 1) {
117+
PRINT_MSG("Failed to init HKDF derive");
116118
err = 1;
117119
}
118120
}
119121
if (err == 0) {
120122
if (EVP_PKEY_CTX_hkdf_mode(ctx, mode) != 1) {
123+
PRINT_MSG("Failed to set HKDF mode");
121124
err = 1;
122125
}
123126
}
124127
if (err == 0) {
125128
if (EVP_PKEY_CTX_set_hkdf_md(ctx, md) != 1) {
129+
PRINT_MSG("Failed to set HKDF md");
126130
err = 1;
127131
}
128132
}
129133
if (err == 0) {
130134
if (EVP_PKEY_CTX_set1_hkdf_key(ctx, inKey, sizeof(inKey)) != 1) {
135+
PRINT_MSG("Failed to set HKDF key");
131136
err = 1;
132137
}
133138
}
134139
if ((err == 0) && (mode != EVP_PKEY_HKDEF_MODE_EXPAND_ONLY)) {
140+
#if OPENSSL_VERSION_NUMBER >= 0x30100000L && \
141+
OPENSSL_VERSION_NUMBER != 0x30200050L && \
142+
OPENSSL_VERSION_NUMBER != 0x30300040L
135143
if (EVP_PKEY_CTX_set1_hkdf_salt(ctx, NULL, 0) != 1) {
144+
#else
145+
/* In 3.1.x, the following code was added to hkdf_common_set_ctx_params()
146+
* if (p->data_size != 0 && p->data != NULL) {
147+
* The above code is not present in 3.2.5 and 3.3.4. */
148+
if (EVP_PKEY_CTX_set1_hkdf_salt(ctx, NULL, 0) != 0) {
149+
#endif
150+
PRINT_MSG("Failed to set HKDF salt to NULL");
136151
err = 1;
137152
}
138153
}
139154
if ((err == 0) && (mode != EVP_PKEY_HKDEF_MODE_EXPAND_ONLY)) {
140155
if (EVP_PKEY_CTX_set1_hkdf_salt(ctx, salt, sizeof(salt)) != 1) {
156+
PRINT_MSG("Failed to set HKDF salt");
141157
err = 1;
142158
}
143159
}
144160
if ((err == 0) && (mode != EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY)) {
145161
if (EVP_PKEY_CTX_add1_hkdf_info(ctx, info, sizeof(info)) != 1) {
162+
PRINT_MSG("Failed to set HKDF info");
146163
err = 1;
147164
}
148165
}
149166
if (err == 0) {
150167
if (EVP_PKEY_derive(ctx, key, &len) != 1) {
168+
PRINT_MSG("Failed to derive HKDF key");
151169
err = 1;
152170
}
153171
}
154172

155173
if ((err == 0) && (mode != EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY)) {
156174
if (len != (size_t)keyLen) {
175+
PRINT_MSG("HKDF key length mismatch");
157176
err = 1;
158177
}
159178
}
160179
else {
161180
if (len != (size_t)EVP_MD_size(md)) {
181+
PRINT_MSG("HKDF key length mismatch for extract only");
162182
err = 1;
163183
}
164184
}
@@ -204,6 +224,7 @@ static int test_hkdf_md(const EVP_MD *md, int mode)
204224
memset(wKey, 0, sizeof(wKey));
205225

206226
if (err == 0) {
227+
PRINT_MSG("Calc with OpenSSL");
207228
err = test_hkdf_double_set_salt(osslLibCtx, oKey, sizeof(oKey), md, mode);
208229
if (err == 1) {
209230
PRINT_MSG("FAILED OpenSSL");

test/test_rsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ int test_rsa_fromdata(void* data)
11701170
static const int selections[] = {
11711171
EVP_PKEY_KEYPAIR,
11721172
EVP_PKEY_PUBLIC_KEY,
1173-
EVP_PKEY_PRIVATE_KEY,
1173+
EVP_PKEY_PRIVATE_KEY, /* added in 3.0.12 and 3.1.4 */
11741174
};
11751175

11761176
/* Parameter data fields */

0 commit comments

Comments
 (0)