Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for GitHub CI #76

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: SPDM-Utils-ci

on:
push:
pull_request:

jobs:
ci-check:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
components: rustfmt, clippy

- name: Install dependencies
run: |
sudo apt-get install -y cmake libclang-dev libpci-dev libssl-dev python3-dev gem; \
sudo gem install cbor-diag;

- name: Build libspdm
run: |
pushd third-party/libspdm; \
mkdir build; cd build; \
cmake \
-DARCH=x64 \
-DTOOLCHAIN=GCC \
-DTARGET=Debug \
-DCRYPTO=openssl \
-DENABLE_BINARY_BUILD=1 \
-DCOMPILED_LIBCRYPTO_PATH=/usr/lib/ \
-DCOMPILED_LIBSSL_PATH=/usr/lib/ \
-DDISABLE_TESTS=1 \
-DCMAKE_C_FLAGS="-DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0" \
.. ; \
make -j8; \
popd;

- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Build
uses: actions-rs/cargo@v1
with:
command: build

- name: Test
uses: actions-rs/cargo@v1
with:
command: test

# TODO: Fixup clippy failures and enable this
# - name: Clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy

- name: Format Tock Responder
run: pushd tock-responder && cargo fmt --all -- --check && popd

- name: Install ARM toolchain
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: latest

- name: Install elf2tab
run: cargo install elf2tab

- name: Build ARM embedded libspdm
run: |
pushd third-party/libspdm; \
mkdir -p build_no_std_arm; \
cd build_no_std_arm; \
cmake \
-DARCH=arm \
-DTOOLCHAIN=ARM_GNU_BARE_METAL \
-DTARGET=Release \
-DCRYPTO=mbedtls \
-DDISABLE_TESTS=1 \
-DMARCH=armv7e-m \
-DDISABLE_LTO=1 \
-DCMAKE_C_FLAGS=" \
-DLIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP=1 \
-DMBEDTLS_SKIP_TIME_CHECK \
-DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0 \
" \
.. ; \
make -j8; \
popd;

- name: Build Tock Responder for nRF52840
run: pushd tock-responder && make nrf52840_spdm_responder && popd

# Ubuntu uses riscv64-unknown-elf-gcc, which isn't supported by
# the libspdm CMake TOOLCHAIN
# - name: Install RISC-V toolchain
# run: |
# sudo apt-get install -y gcc-riscv64-unknown-elf

# - name: Build RISC-V embedded libspdm
# run: |
# pushd third-party/libspdm; \
# mkdir -p build_no_std_riscv; \
# cd build_no_std_riscv; \
# cmake \
# -DARCH=riscv32 \
# -DTOOLCHAIN=RISCV_NONE \
# -DTARGET=Release \
# -DCRYPTO=mbedtls \
# -DDISABLE_TESTS=1 \
# -DCMAKE_C_FLAGS=" \
# -DLIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP=1 \
# -DMBEDTLS_SKIP_TIME_CHECK \
# -DLIBSPDM_ENABLE_CAPABILITY_EVENT_CAP=0 \
# " \
# .. ; \
# make -j8; \
# popd;

# - name: Build Tock Responder for OpenTitan
# run: pushd tock-responder && make opentitan_spdm_responder && popd
4 changes: 2 additions & 2 deletions src/libspdm/spdm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2270,8 +2270,8 @@ pub unsafe extern "C" fn libspdm_encap_challenge_opaque_data(
/// ii. Requester must not request a CsrTrackingTag [1, 7], only 0
/// allowed.
///
/// If an spdm-utils responder and requester is used, this should not
/// be problematic.
/// If an spdm-utils responder and requester is used, this should not
/// be problematic.
///
/// Saves a certificate pointed to by `cert_chain` to device non-volatile memory
/// into the respective `slot_id`. Once saved, import the file and use it as
Expand Down
5 changes: 1 addition & 4 deletions tock-responder/src/mctp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,7 @@ unsafe extern "C" fn tock_receive_message(

let len = payload.len() + 1;
// The `MCTP_PAYLOAD_OFFSET-1`` is the SPDM MCTP Message type, lets retain this
recv_buf.copy_within(
MCTP_PAYLOAD_OFFSET - 1..(message_len - 1),
0,
);
recv_buf.copy_within(MCTP_PAYLOAD_OFFSET - 1..(message_len - 1), 0);

#[cfg(feature = "spdm_debug")]
{
Expand Down
Loading