Skip to content

Commit d6f8c0c

Browse files
Merge pull request #22 from dgarske/more_testing
Additional CI tests
2 parents 5795bd3 + 411c5a6 commit d6f8c0c

File tree

20 files changed

+180
-78
lines changed

20 files changed

+180
-78
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: wolfPKCS11 Build Workflow
2+
3+
on:
4+
5+
workflow_call:
6+
inputs:
7+
config:
8+
required: false
9+
type: string
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
#pull wolfPKCS11
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
#setup wolfssl
23+
- uses: actions/checkout@v3
24+
with:
25+
repository: wolfssl/wolfssl
26+
path: wolfssl
27+
- name: wolfssl autogen
28+
working-directory: ./wolfssl
29+
run: ./autogen.sh
30+
- name: wolfssl configure
31+
working-directory: ./wolfssl
32+
run: |
33+
./configure --enable-cryptonly --enable-aescfb --enable-rsapss --enable-keygen --enable-pwdbased --enable-scrypt \
34+
C_EXTRA_FLAGS="-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT"
35+
- name: wolfssl make install
36+
working-directory: ./wolfssl
37+
run: make
38+
- name: wolfssl make install
39+
working-directory: ./wolfssl
40+
run: |
41+
sudo make install
42+
sudo ldconfig
43+
44+
#setup wolfPKCS11
45+
- name: wolfpkcs11 autogen
46+
run: ./autogen.sh
47+
- name: wolfpkcs11 configure
48+
run: ./configure ${{inputs.config}}
49+
- name: wolfpkcs11 make
50+
run: make
51+
- name: wolfpkcs11 make check
52+
run: make check
53+
- name: wolfpkcs11 make install
54+
run: sudo make install
55+
- name: wolfpkcs11 make dist
56+
run: make dist
57+
58+
# capture logs on failure
59+
- name: Upload failure logs
60+
if: failure() || cancelled()
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: wolfpkcs11-test-logs
64+
path: |
65+
test-suite.log
66+
retention-days: 5

.github/workflows/unit-test.yml

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,67 @@ on:
77
branches: [ '*' ]
88

99
jobs:
10-
build:
1110

12-
runs-on: ubuntu-latest
11+
defaults_all:
12+
uses: ./.github/workflows/build-workflow.yml
1313

14-
steps:
15-
#pull wolfPKCS11
16-
- uses: actions/checkout@v3
14+
no_rsa:
15+
uses: ./.github/workflows/build-workflow.yml
16+
with:
17+
config: --disable-rsa
18+
no_rsaoaep:
19+
uses: ./.github/workflows/build-workflow.yml
20+
with:
21+
config: --disable-rsaoaep
22+
no_rsapss:
23+
uses: ./.github/workflows/build-workflow.yml
24+
with:
25+
config: --disable-rsapss
26+
no_ecc:
27+
uses: ./.github/workflows/build-workflow.yml
28+
with:
29+
config: --disable-ecc
30+
no_dh:
31+
uses: ./.github/workflows/build-workflow.yml
32+
with:
33+
config: --disable-dh
34+
no_keygen:
35+
uses: ./.github/workflows/build-workflow.yml
36+
with:
37+
config: --disable-keygen
38+
no_keystore:
39+
uses: ./.github/workflows/build-workflow.yml
40+
with:
41+
config: CFLAGS="-DWOLFPKCS11_NO_STORE"
42+
no_aesgcm:
43+
uses: ./.github/workflows/build-workflow.yml
44+
with:
45+
config: --disable-aesgcm
46+
no_sha512:
47+
uses: ./.github/workflows/build-workflow.yml
48+
with:
49+
config: --disable-sha512
50+
no_sha384:
51+
uses: ./.github/workflows/build-workflow.yml
52+
with:
53+
config: --disable-sha384
54+
no_sha224:
55+
uses: ./.github/workflows/build-workflow.yml
56+
with:
57+
config: --disable-sha224
58+
no_sha1:
59+
uses: ./.github/workflows/build-workflow.yml
60+
with:
61+
config: --disable-sha1
62+
no_md5:
63+
uses: ./.github/workflows/build-workflow.yml
64+
with:
65+
config: --disable-md5
66+
no_hmac:
67+
uses: ./.github/workflows/build-workflow.yml
68+
with:
69+
config: --disable-hmac
1770

18-
#setup wolfssl
19-
- uses: actions/checkout@v3
20-
with:
21-
repository: wolfssl/wolfssl
22-
path: wolfssl
23-
- name: wolfssl autogen
24-
working-directory: ./wolfssl
25-
run: ./autogen.sh
26-
- name: wolfssl configure
27-
working-directory: ./wolfssl
28-
run: |
29-
./configure --enable-wolftpm --enable-rsapss --enable-keygen --enable-pwdbased --enable-scrypt \
30-
C_EXTRA_FLAGS="-DWOLFSSL_PUBLIC_MP -DWC_RSA_DIRECT"
31-
- name: wolfssl make install
32-
working-directory: ./wolfssl
33-
run: make
34-
- name: wolfssl make install
35-
working-directory: ./wolfssl
36-
run: |
37-
sudo make install
38-
sudo ldconfig
39-
40-
#setup wolfPKCS11
41-
- name: wolfpkcs11 autogen
42-
run: ./autogen.sh
43-
- name: wolfpkcs11 configure
44-
run: ./configure
45-
- name: wolfpkcs11 make
46-
run: make
47-
- name: wolfpkcs11 make check
48-
run: make check
49-
- name: wolfpkcs11 make install
50-
run: sudo make install
51-
- name: wolfpkcs11 make dist
52-
run: make dist
53-
54-
# capture logs on failure
55-
- name: Upload failure logs
56-
if: failure()
57-
uses: actions/upload-artifact@v3
58-
with:
59-
name: wolfpkcs11-test-logs
60-
path: |
61-
test-suite.log
62-
retention-days: 5
71+
#TODO: --disable-aes Enable AES (default: enabled)
72+
#TODO: --disable-aescbc Enable AES-CBC (default: enabled)
73+
#TODO: --disable-sha256 Enable SHA-256 (default: enabled)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PKCS#11 library that implements cryptographic algorithms using wolfSSL.
99

1010
Build wolfSSL:
1111

12-
```
12+
```sh
1313
git clone https://github.com/wolfSSL/wolfssl.git
1414
cd wolfssl
1515
./autogen.sh
@@ -24,7 +24,7 @@ autogen.sh requires: automake and libtool: `sudo apt-get install automake libtoo
2424

2525
Build wolfPKCS11:
2626

27-
```
27+
```sh
2828
git clone https://github.com/wolfSSL/wolfPKCS11.git
2929
cd wolfPKCS11
3030
./autogen.sh

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# configure.ac
22
#
3-
# Copyright (C) 2018 wolfSSL Inc.
3+
# Copyright (C) 2023 wolfSSL Inc.
44
# All right reserved.
55
#
66
# This file is part of wolfPKCS11.
77
#
8-
AC_COPYRIGHT([Copyright (C) 2014-2018 wolfSSL Inc.])
8+
AC_COPYRIGHT([Copyright (C) 2014-2023 wolfSSL Inc.])
99
AC_PREREQ([2.63])
1010
AC_INIT([wolfpkcs11],[1.1.0],[https://github.com/wolfssl/wolfpkcs11/issues],[wolfpkcs11],[http://www.wolfssl.com])
1111
AC_CONFIG_AUX_DIR([build-aux])
@@ -367,7 +367,7 @@ rm -f $OPTION_FILE
367367
echo "/* wolfpkcs11 options.h" > $OPTION_FILE
368368
echo " * generated from configure options" >> $OPTION_FILE
369369
echo " *" >> $OPTION_FILE
370-
echo " * Copyright (C) 2006-2021 wolfSSL Inc." >> $OPTION_FILE
370+
echo " * Copyright (C) 2006-2023 wolfSSL Inc." >> $OPTION_FILE
371371
echo " *" >> $OPTION_FILE
372372
echo " * * This file is part of wolfPKCS11." >> $OPTION_FILE
373373
echo " *" >> $OPTION_FILE
@@ -479,7 +479,7 @@ echo " * AES: $ENABLED_AES"
479479
echo " * AES-CBC: $ENABLED_AESCBC"
480480
echo " * AES-GCM: $ENABLED_AESGCM"
481481
echo " * MD5: $ENABLED_MD5"
482-
echo " * SHA: $ENABLED_SHA"
482+
echo " * SHA: $ENABLED_SHA1"
483483
echo " * SHA-224: $ENABLED_SHA224"
484484
echo " * SHA-256: $ENABLED_SHA256"
485485
echo " * SHA-384: $ENABLED_SHA384"

src/crypto.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* crypto.c
22
*
3-
* Copyright (C) 2006-2022 wolfSSL Inc.
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
44
*
55
* This file is part of wolfPKCS11.
66
*
@@ -488,6 +488,7 @@ static CK_RV AddObject(WP11_Session* session, WP11_Object* object,
488488
return CKR_OK;
489489
}
490490

491+
#ifndef NO_RSA
491492
/**
492493
* Create an RSA private key object in the session or on the token associated with the session.
493494
*
@@ -606,6 +607,7 @@ static CK_RV AddRSAPrivateKeyObject(WP11_Session* session,
606607

607608
return rv;
608609
}
610+
#endif
609611

610612
/**
611613
* Create an object in the session or on the token associated with the session.
@@ -3853,7 +3855,7 @@ CK_RV C_WrapKey(CK_SESSION_HANDLE hSession,
38533855
return rv;
38543856

38553857
switch (keyType) {
3856-
3858+
#if !defined(NO_RSA) && !defined(WOLFPKCS11_NO_STORE)
38573859
case CKK_RSA:
38583860
ret = WP11_Rsa_SerializeKeyPTPKC8(key, NULL, &serialSize);
38593861
if (ret != 0)
@@ -3868,17 +3870,17 @@ CK_RV C_WrapKey(CK_SESSION_HANDLE hSession,
38683870
rv = CKR_FUNCTION_FAILED;
38693871
goto err_out;
38703872
}
3871-
38723873
break;
3874+
#endif
38733875
default:
38743876
rv = CKR_KEY_NOT_WRAPPABLE;
38753877
goto err_out;
38763878
}
38773879

38783880
switch (pMechanism->mechanism) {
3881+
#ifndef NO_AES
38793882
/* These unwrap mechanisms can be supported with high level C_Encrypt */
38803883
case CKM_AES_CBC_PAD:
3881-
38823884
if (wrapkeyType != CKK_AES) {
38833885
rv = CKR_WRAPPING_KEY_TYPE_INCONSISTENT;
38843886
goto err_out;
@@ -3893,10 +3895,12 @@ CK_RV C_WrapKey(CK_SESSION_HANDLE hSession,
38933895
goto err_out;
38943896

38953897
break;
3898+
#endif
38963899
default:
38973900
rv = CKR_MECHANISM_INVALID;
38983901
break;
38993902
}
3903+
(void)pWrappedKey;
39003904

39013905
err_out:
39023906

@@ -4024,11 +4028,12 @@ CK_RV C_UnwrapKey(CK_SESSION_HANDLE hSession,
40244028
}
40254029

40264030
switch (keyType) {
4031+
#ifndef NO_RSA
40274032
case CKK_RSA:
4028-
40294033
rv = AddRSAPrivateKeyObject(session, pTemplate, ulAttributeCount,
40304034
workBuffer, ulUnwrappedLen, phKey);
40314035
break;
4036+
#endif
40324037
default:
40334038
rv = CKR_KEY_NOT_WRAPPABLE;
40344039
goto err_out;

src/internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* internal.c
22
*
3-
* Copyright (C) 2006-2022 wolfSSL Inc.
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
44
*
55
* This file is part of wolfPKCS11.
66
*

src/slot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* slot.c
22
*
3-
* Copyright (C) 2006-2022 wolfSSL Inc.
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
44
*
55
* This file is part of wolfPKCS11.
66
*

src/wolfpkcs11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* wolfpkcs11.c
22
*
3-
* Copyright (C) 2006-2022 wolfSSL Inc.
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
44
*
55
* This file is part of wolfPKCS11.
66
*

tests/pkcs11mtt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* pkcs11mtt.c - unit tests
22
*
3-
* Copyright (C) 2006-2022 wolfSSL Inc.
3+
* Copyright (C) 2006-2023 wolfSSL Inc.
44
*
55
* This file is part of wolfPKCS11.
66
*

0 commit comments

Comments
 (0)