|
| 1 | +--- |
| 2 | +name: Test kryoptic FIPS module |
| 3 | + |
| 4 | +on: [push, pull_request, workflow_dispatch] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Test kryoptic FIPS module |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + container: quay.io/fedora/fedora:latest |
| 11 | + steps: |
| 12 | + ################# |
| 13 | + ### DNF cache ### |
| 14 | + ################# |
| 15 | + - name: Get Date for DNF cache entry |
| 16 | + id: get-date |
| 17 | + run: | |
| 18 | + echo "date=$(/bin/date -u "+%Y%V")" >> $GITHUB_OUTPUT |
| 19 | + shell: bash |
| 20 | + |
| 21 | + - name: Restore DNF cache |
| 22 | + uses: actions/cache/restore@v4 |
| 23 | + id: cache-dnf |
| 24 | + with: |
| 25 | + path: "/var/cache/libdnf5" |
| 26 | + key: fedora-dnf-${{ steps.get-date.outputs.date }} |
| 27 | + |
| 28 | + - name: Install Dependencies |
| 29 | + run: | |
| 30 | + dnf -y install git cargo clang-devel openssl-devel sqlite-devel \ |
| 31 | + 'perl(FindBin)' 'perl(lib)' 'perl(File::Compare)' \ |
| 32 | + 'perl(File::Copy)' 'perl(bigint)' 'perl(Time::HiRes)' \ |
| 33 | + 'perl(IPC::Cmd)' 'perl(Pod::Html)' 'perl(Digest::SHA)' \ |
| 34 | + 'perl(Module::Load::Conditional)' 'perl(File::Temp)' \ |
| 35 | + 'perl(Test::Harness)' 'perl(Test::More)' 'perl(Math::BigInt)' \ |
| 36 | + 'perl(Time::Piece)' zlib-devel sed sqlite-devel |
| 37 | +
|
| 38 | + - name: DNF cache |
| 39 | + if: ${{ steps.cache-dnf.outputs.cache-hit != 'true' }} |
| 40 | + uses: actions/cache/save@v4 |
| 41 | + with: |
| 42 | + path: "/var/cache/libdnf5" |
| 43 | + key: fedora-dnf-${{ steps.get-date.outputs.date }} |
| 44 | + |
| 45 | + ##################### |
| 46 | + ### OpenSSL build ### |
| 47 | + ##################### |
| 48 | + - name: Setup OpenSSL 3.5 |
| 49 | + id: ossl-setup |
| 50 | + run: | |
| 51 | + OPENSSL_BRANCH="openssl-3.5" |
| 52 | +
|
| 53 | + cd .. |
| 54 | + git clone https://github.com/openssl/openssl.git \ |
| 55 | + --single-branch --branch $OPENSSL_BRANCH openssl |
| 56 | + cd openssl |
| 57 | + echo "KRYOPTIC_OPENSSL_SOURCES=$PWD" >> "$GITHUB_ENV" |
| 58 | + echo "cacheid=${{ runner.os }}-ossl-$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
| 59 | +
|
| 60 | + - name: Restore OpenSSL build if cached |
| 61 | + uses: actions/cache/restore@v4 |
| 62 | + id: cache |
| 63 | + with: |
| 64 | + path: ${{ env.KRYOPTIC_OPENSSL_SOURCES }} |
| 65 | + key: ${{ steps.ossl-setup.outputs.cacheid }} |
| 66 | + |
| 67 | + - name: Build OpenSSL |
| 68 | + if: ${{ steps.cache.outputs.cache-hit != 'true' }} |
| 69 | + run: | |
| 70 | + pushd ${{ env.KRYOPTIC_OPENSSL_SOURCES }} |
| 71 | + ./Configure |
| 72 | + make |
| 73 | +
|
| 74 | + - name: Cache OpenSSL 3.5 build |
| 75 | + if: ${{ steps.cache.outputs.cache-hit != 'true' }} |
| 76 | + uses: actions/cache/save@v4 |
| 77 | + with: |
| 78 | + path: ${{ env.KRYOPTIC_OPENSSL_SOURCES }} |
| 79 | + key: ${{ steps.ossl-setup.outputs.cacheid }} |
| 80 | + |
| 81 | + ###################### |
| 82 | + ### kryoptic build ### |
| 83 | + ###################### |
| 84 | + - name: Setup kryoptic |
| 85 | + run: | |
| 86 | + KRYOPTIC_REVISION="v1.3.1" |
| 87 | +
|
| 88 | + cd .. |
| 89 | + git clone https://github.com/latchset/kryoptic.git \ |
| 90 | + --depth 1 --single-branch --revision $KRYOPTIC_REVISION kryoptic |
| 91 | +
|
| 92 | + - name: Generate lock file |
| 93 | + run: | |
| 94 | + cd ../kryoptic && |
| 95 | + cargo generate-lockfile |
| 96 | +
|
| 97 | + - name: Cache Rust dependencies |
| 98 | + uses: actions/cache@v4 |
| 99 | + with: |
| 100 | + path: | |
| 101 | + ~/.cargo/bin/ |
| 102 | + ~/.cargo/registry/index/ |
| 103 | + ~/.cargo/registry/cache/ |
| 104 | + ~/.cargo/git/db/ |
| 105 | + ../kryoptic/target/ |
| 106 | + key: fedora-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 107 | + |
| 108 | + - name: Build kryoptic |
| 109 | + run: | |
| 110 | + FEATURES="fips,pqc,dummy-integrity" |
| 111 | + OPTS="--no-default-features" |
| 112 | +
|
| 113 | + cd ../kryoptic && |
| 114 | + cargo build -vv $OPTS --features "$FEATURES" |
| 115 | +
|
| 116 | + - uses: actions/upload-artifact@v4 |
| 117 | + if: failure() |
| 118 | + with: |
| 119 | + name: Build logs OpenSSL version 3.5 |
| 120 | + path: | |
| 121 | + target/debug/build/*/output |
| 122 | +
|
| 123 | + - name: Checkout rust-cryptoki |
| 124 | + uses: actions/checkout@v4 |
| 125 | + |
| 126 | + ################# |
| 127 | + ### the tests ### |
| 128 | + ################# |
| 129 | + - name: Run test script |
| 130 | + env: |
| 131 | + KRYOPTIC_CONF: /tmp/kryoptic.sql |
| 132 | + TEST_PKCS11_MODULE: /__w/rust-cryptoki/kryoptic/target/debug/libkryoptic_pkcs11.so |
| 133 | + OUT_DIR: /__w/rust-cryptoki/kryoptic/target/debug/deps/ |
| 134 | + run: | |
| 135 | + RUST_BACKTRACE=1 cargo build --all-features && |
| 136 | + RUST_BACKTRACE=1 cargo test |
| 137 | +
|
0 commit comments