|
| 1 | +name: hostap/wpa_supplicant Tests |
| 2 | + |
| 3 | +# START OF COMMON SECTION |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ 'master', 'main', 'release/**' ] |
| 7 | + pull_request: |
| 8 | + branches: [ '*' ] |
| 9 | + # allow manual runs of this workflow |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + run_type: |
| 13 | + description: 'Reason for manual run' |
| 14 | + required: false |
| 15 | + default: 'manual test' |
| 16 | + type: string |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: true |
| 21 | +# END OF COMMON SECTION |
| 22 | + |
| 23 | +jobs: |
| 24 | + build_wolfprovider: |
| 25 | + name: Build wolfProvider |
| 26 | + runs-on: ubuntu-22.04 |
| 27 | + timeout-minutes: 20 |
| 28 | + strategy: |
| 29 | + matrix: |
| 30 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 31 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 32 | + steps: |
| 33 | + - name: Checkout wolfProvider |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + # Check if this version of wolfssl/wolfprovider has already been built, |
| 37 | + # mark to cache these items on post if we do end up building |
| 38 | + - name: Checking wolfSSL/wolfProvider in cache |
| 39 | + uses: actions/cache@v4 |
| 40 | + id: wolfprov-cache |
| 41 | + with: |
| 42 | + path: | |
| 43 | + wolfssl-source |
| 44 | + wolfssl-install |
| 45 | + wolfprov-install |
| 46 | + provider.conf |
| 47 | +
|
| 48 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} |
| 49 | + lookup-only: true |
| 50 | + |
| 51 | + # If wolfssl/wolfprovider have not yet been built, pull ossl from cache |
| 52 | + - name: Checking OpenSSL in cache |
| 53 | + if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true' |
| 54 | + uses: actions/cache@v4 |
| 55 | + id: openssl-cache |
| 56 | + with: |
| 57 | + path: | |
| 58 | + openssl-source |
| 59 | + openssl-install |
| 60 | +
|
| 61 | + key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 62 | + lookup-only: true |
| 63 | + |
| 64 | + # If not yet built this version, build it now |
| 65 | + - name: Build wolfProvider |
| 66 | + if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true' |
| 67 | + run: | |
| 68 | + OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh |
| 69 | +
|
| 70 | + - name: Print errors |
| 71 | + if: ${{ failure() }} |
| 72 | + run: | |
| 73 | + if [ -f test-suite.log ] ; then |
| 74 | + cat test-suite.log |
| 75 | + fi |
| 76 | +
|
| 77 | + test_hostap: |
| 78 | + runs-on: ubuntu-22.04 |
| 79 | + needs: build_wolfprovider |
| 80 | + # This should be a safe limit for the tests to run. |
| 81 | + timeout-minutes: 20 |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 85 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 86 | + hostap_ref: [ 'hostap_2_11' ] |
| 87 | + force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ] |
| 88 | + steps: |
| 89 | + - name: Checkout wolfProvider |
| 90 | + uses: actions/checkout@v4 |
| 91 | + |
| 92 | + - name: Retrieving OpenSSL from cache |
| 93 | + uses: actions/cache/restore@v4 |
| 94 | + id: openssl-cache |
| 95 | + with: |
| 96 | + path: | |
| 97 | + openssl-source |
| 98 | + openssl-install |
| 99 | +
|
| 100 | + key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 101 | + fail-on-cache-miss: true |
| 102 | + |
| 103 | + - name: Retrieving wolfSSL/wolfProvider from cache |
| 104 | + uses: actions/cache/restore@v4 |
| 105 | + id: wolfprov-cache |
| 106 | + with: |
| 107 | + path: | |
| 108 | + wolfssl-source |
| 109 | + wolfssl-install |
| 110 | + wolfprov-install |
| 111 | + provider.conf |
| 112 | +
|
| 113 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }} |
| 114 | + fail-on-cache-miss: true |
| 115 | + |
| 116 | + - name: Checkout OSP |
| 117 | + uses: actions/checkout@v4 |
| 118 | + with: |
| 119 | + # TODO: change to main branch before merging, after osp patch is merged |
| 120 | + repository: padelsbach/osp |
| 121 | + path: osp |
| 122 | + fetch-depth: 0 |
| 123 | + ref: wp_hostap_patch |
| 124 | + |
| 125 | + - name: Checkout hostap/wpa_supplicant |
| 126 | + run: | |
| 127 | + git clone https://w1.fi/cgit/hostap |
| 128 | + cd $GITHUB_WORKSPACE/hostap |
| 129 | + git fetch --tags |
| 130 | + git checkout ${{ matrix.hostap_ref }} |
| 131 | +
|
| 132 | + - name: Checkout cryptography repository |
| 133 | + uses: actions/checkout@v4 |
| 134 | + with: |
| 135 | + repository: pyca/cryptography |
| 136 | + path: cryptography |
| 137 | + |
| 138 | + - name: Build and Test hostap/wpa_supplicant |
| 139 | + working-directory: hostap |
| 140 | + run: | |
| 141 | + export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64 |
| 142 | + export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf |
| 143 | + export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib |
| 144 | + export LDFLAGS="-L$GITHUB_WORKSPACE/.libs -L$GITHUB_WORKSPACE/wolfssl-install/lib -L$GITHUB_WORKSPACE/openssl-install/lib -L$GITHUB_WORKSPACE/hostap/src/cryptowpa" |
| 145 | + export LIBS_EXTRA="-lssl -lcrypto -lcryptowpa" |
| 146 | + export ${{ matrix.force_fail }} |
| 147 | +
|
| 148 | + # Apply patch for running the tests with wolfProvider |
| 149 | + cd $GITHUB_WORKSPACE/hostap |
| 150 | + git apply $GITHUB_WORKSPACE/osp/wolfProvider/hostap/hostap_2_11/hostap_2_11-wolfprov.patch |
| 151 | +
|
| 152 | + # Setup test vectors from cryptography repository |
| 153 | + mkdir -p $GITHUB_WORKSPACE/hostap/tests/CAVP |
| 154 | + cp $GITHUB_WORKSPACE/cryptography/vectors/cryptography_vectors/hashes/SHA1/SHA1*.rsp $GITHUB_WORKSPACE/hostap/tests/CAVP |
| 155 | + cp $GITHUB_WORKSPACE/cryptography/vectors/cryptography_vectors/hashes/SHA2/SHA2*.rsp $GITHUB_WORKSPACE/hostap/tests/CAVP |
| 156 | + cp $GITHUB_WORKSPACE/cryptography/vectors/cryptography_vectors/asymmetric/RSA/FIPS_186-2/SigVer*.rsp $GITHUB_WORKSPACE/hostap/tests/CAVP |
| 157 | +
|
| 158 | + # Run tests and capture output |
| 159 | + cd $GITHUB_WORKSPACE/hostap/src/cryptowpa |
| 160 | + make -j |
| 161 | + cd $GITHUB_WORKSPACE/hostap/tests |
| 162 | + make run-tests 2>&1 | tee hostap-test.log |
| 163 | + TEST_RESULT=$? |
| 164 | + echo "Test result: $TEST_RESULT" |
| 165 | + $GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} hostap |
0 commit comments