Skip to content

Commit 476dd06

Browse files
committed
Merge branch 'master' of github.com:ColtonWilley/wolfProvider into wp_rsa_x931
2 parents bedf0d1 + 40d48ad commit 476dd06

File tree

19 files changed

+930
-150
lines changed

19 files changed

+930
-150
lines changed

.github/workflows/curl.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Curl 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_curl:
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+
curl_ref: [ 'master', 'curl-8_4_0' ]
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 curl test dependencies
103+
run: |
104+
sudo apt-get update
105+
sudo apt-get install nghttp2 libpsl5 libpsl-dev python3-impacket
106+
107+
- name: Build curl
108+
uses: wolfSSL/actions-build-autotools-project@v1
109+
with:
110+
repository: curl/curl
111+
path: curl
112+
ref: ${{ matrix.curl_ref }}
113+
configure: --with-openssl=$GITHUB_WORKSPACE/openssl-install/
114+
check: false
115+
116+
- name: Test curl with wolfProvider
117+
working-directory: curl
118+
run: |
119+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
120+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
121+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
122+
make -j $(nproc) test-ci

.github/workflows/nginx.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Nginx 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_nginx:
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+
nginx_ref: [ 'master', 'release-1.27.4' ]
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 nginx dependencies
103+
run: |
104+
sudo cpan -iT Proc::Find Net::SSLeay IO::Socket::SSL
105+
106+
- name: Checkout nginx
107+
uses: actions/checkout@v4
108+
with:
109+
repository: nginx/nginx
110+
path: nginx
111+
ref: ${{ matrix.nginx_ref }}
112+
113+
- name: Build nginx
114+
working-directory: nginx
115+
run: |
116+
./auto/configure --with-http_ssl_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --with-mail --with-mail_ssl_module
117+
make -j
118+
119+
- name: Checkout nginx-tests
120+
uses: actions/checkout@v4
121+
with:
122+
repository: nginx/nginx-tests
123+
path: nginx-tests
124+
ref: master
125+
126+
- name: Run nginx-tests with wolfProvider
127+
working-directory: nginx-tests
128+
run: |
129+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
130+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
131+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
132+
TEST_NGINX_VERBOSE=y TEST_NGINX_CATLOG=y TEST_NGINX_BINARY=../nginx/objs/nginx prove -v .

IDE/XCODE/build-wolfssl-framework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SDK_OUTPUT_DIR=${OUTDIR}/xcframework
2929
CFLAGS_COMMON=""
3030
CPPFLAGS_COMMON=""
3131
# Base configure flags
32-
CONF_OPTS="--disable-shared --enable-static"
32+
CONF_OPTS="--disable-shared --enable-static --enable-armasm=no"
3333

3434
helpFunction()
3535
{

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sudo make install
7171
git clone https://github.com/wolfssl/wolfssl.git
7272
cd wolfssl
7373
./autogen.sh
74-
./configure --enable-opensslcoexist --enable-cmac --enable-keygen --enable-sha --enable-des3 --enable-aesctr --enable-aesccm --enable-x963kdf --enable-compkey CPPFLAGS="-DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT -DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP -DECC_MIN_KEY_SZ=192 -DHAVE_PUBLIC_FFDHE -DWOLFSSL_DH_EXTRA -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_PSS_SALT_LEN_DISCOVER -DRSA_MIN_SIZE=1024" --enable-certgen --enable-aeskeywrap --enable-enckeys --enable-base16
74+
./configure --enable-opensslcoexist --enable-cmac --enable-keygen --enable-sha --enable-des3 --enable-aesctr --enable-aesccm --enable-x963kdf --enable-compkey CPPFLAGS="-DHAVE_AES_ECB -DWOLFSSL_AES_DIRECT -DWC_RSA_NO_PADDING -DWOLFSSL_PUBLIC_MP -DHAVE_PUBLIC_FFDHE -DWOLFSSL_DH_EXTRA -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_PSS_SALT_LEN_DISCOVER -DRSA_MIN_SIZE=1024" --enable-certgen --enable-aeskeywrap --enable-enckeys --enable-base16 --with-eccminsz=192
7575
make
7676
sudo make install
7777
```
@@ -86,10 +86,14 @@ Add `--enable-pwdbased` to the configure command above if PKCS#12 is used in Ope
8686

8787
Add to CPPFLAGS `-DHAVE_FFDHE_6144 -DHAVE_FFDHE_8192 -DFP_MAX_BITS=16384` to enable predefined 6144-bit and 8192-bit DH parameters.
8888

89+
Add to `--enable-hmac-copy` if performing HMAC repeatedly with the same key to improve performance. (Available with wolfSSL 5.7.8+.)
90+
8991
Add `--enable-sp=yes,asm' '--enable-sp-math-all'` to use SP Integer maths. Replace `-DFP_MAX_BITS=16384` with -DSP_INT_BITS=8192` when used.
9092

9193
Remove `-DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_PSS_SALT_LEN_DISCOVER` and add `--enable-fips=v2` to the configure command above if building from a FIPS v2 bundle and not the git repository. Change `--enable-fips=v2` to `--enable-fips=ready` if using a FIPS Ready bundle.
9294

95+
If '--with-eccminsz=192' is not supported by wolfSSL, add '-DECC_MIN_KEY_SZ=192' to the CPPFLAGS.
96+
9397
### wolfProvider
9498

9599
```

include/wolfprovider/alg_funcs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ extern const OSSL_DISPATCH wp_dh_pki_decoder_functions[];
339339
extern const OSSL_DISPATCH wp_ecc_type_specific_decoder_functions[];
340340
extern const OSSL_DISPATCH wp_ecc_spki_decoder_functions[];
341341
extern const OSSL_DISPATCH wp_ecc_pki_decoder_functions[];
342+
extern const OSSL_DISPATCH wp_ecc_x9_62_decoder_functions[];
342343
extern const OSSL_DISPATCH wp_x25519_spki_decoder_functions[];
343344
extern const OSSL_DISPATCH wp_x25519_pki_decoder_functions[];
344345
extern const OSSL_DISPATCH wp_ed25519_spki_decoder_functions[];
@@ -378,6 +379,8 @@ extern const OSSL_DISPATCH wp_ecc_pki_der_encoder_functions[];
378379
extern const OSSL_DISPATCH wp_ecc_pki_pem_encoder_functions[];
379380
extern const OSSL_DISPATCH wp_ecc_epki_der_encoder_functions[];
380381
extern const OSSL_DISPATCH wp_ecc_epki_pem_encoder_functions[];
382+
extern const OSSL_DISPATCH wp_ecc_x9_62_der_encoder_functions[];
383+
extern const OSSL_DISPATCH wp_ecc_x9_62_pem_encoder_functions[];
381384
extern const OSSL_DISPATCH wp_x25519_spki_der_encoder_functions[];
382385
extern const OSSL_DISPATCH wp_x25519_spki_pem_encoder_functions[];
383386
extern const OSSL_DISPATCH wp_x25519_pki_der_encoder_functions[];

include/wolfprovider/internal.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
#define WP_ENC_FORMAT_EPKI 3
7575
/** Type-specific encoding format. */
7676
#define WP_ENC_FORMAT_TYPE_SPECIFIC 4
77+
/** X9_62 encoding format. */
78+
#define WP_ENC_FORMAT_X9_62 5
7779

7880
/* Data format. */
7981
/** DER - Binary encoding. */
@@ -94,6 +96,9 @@
9496
/** Default iterations for PKCS#12 PBKDF2. */
9597
#define WP_PKCS12_ITERATIONS_DEFAULT 2048
9698

99+
/** Maximum salt length for PKCS. */
100+
#define WP_MAX_SALT_SIZE 64
101+
97102

98103
/* These values are taken from ssl.h.
99104
* Can't include this header as it re-declares OpenSSL types.
@@ -175,6 +180,8 @@ int wp_encrypt_key(WOLFPROV_CTX* provCtx, const char* cipherName,
175180
OSSL_PASSPHRASE_CALLBACK *pwCb, void *pwCbArg, byte** cipherInfo);
176181

177182
int wp_read_der_bio(WOLFPROV_CTX* provCtx, OSSL_CORE_BIO *coreBio, unsigned char** data, word32* len);
183+
int wp_read_pem_bio(WOLFPROV_CTX *provctx, OSSL_CORE_BIO *coreBio,
184+
unsigned char** data, word32* len);
178185
BIO* wp_corebio_get_bio(WOLFPROV_CTX* provCtx, OSSL_CORE_BIO *coreBio);
179186

180187
byte wp_ct_byte_mask_eq(byte a, byte b);

include/wolfprovider/settings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
#endif
115115
#ifndef NO_RSA
116116
#define WP_HAVE_RSA
117+
#if defined(WC_RSA_PSS) && LIBWOLFSSL_VERSION_HEX >= 0x05005000
118+
#define WOLFSSL_RSA_PSS_ENCODING
119+
#endif
117120
#endif
118121

119122
#ifdef HAVE_ECC
@@ -155,6 +158,9 @@
155158
#ifdef HAVE_ED448
156159
#define WP_HAVE_ED448
157160
#endif
161+
#ifndef WP_NO_FORCE_FAIL
162+
#define WP_CHECK_FORCE_FAIL
163+
#endif
158164

159165
#endif /* WOLFPROV_SETTINGS_H */
160166

0 commit comments

Comments
 (0)