Skip to content
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/atecc608-sdk-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ATECC608 SDK test

on:
push:
branches: [main]
pull_request:
branches: ['**']
workflow_dispatch:

jobs:
sdk-test:
name: cryptoauthlib + OpenSSL cross-verification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3

- name: Build sdk-test image
uses: docker/build-push-action@v6
with:
context: ATECC608Sim
file: ATECC608Sim/Dockerfile.sdk-test
tags: atecc608-sdk-test:ci
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run sdk-test suite
run: docker run --rm atecc608-sdk-test:ci
26 changes: 26 additions & 0 deletions .github/workflows/atecc608-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ATECC608 test suite

on:
push:
branches: [main]
pull_request:
branches: ['**']
workflow_dispatch:

jobs:
cargo-test:
name: cargo test (unit + integration)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
workspaces: ATECC608Sim/atecc608-sim

- name: cargo test
run: |
cargo test --manifest-path ATECC608Sim/atecc608-sim/Cargo.toml \
-- --test-threads=1
30 changes: 30 additions & 0 deletions .github/workflows/atecc608-wolfcrypt-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ATECC608 wolfCrypt test

on:
push:
branches: [main]
pull_request:
branches: ['**']
workflow_dispatch:

jobs:
wolfcrypt-test:
name: wolfCrypt + cryptoauthlib integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3

- name: Build wolfcrypt-test image
uses: docker/build-push-action@v6
with:
context: ATECC608Sim
file: ATECC608Sim/Dockerfile.wolfcrypt
tags: atecc608-wolfcrypt-test:ci
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run wolfCrypt test suite
run: docker run --rm atecc608-wolfcrypt-test:ci
17 changes: 17 additions & 0 deletions ATECC608Sim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build artifacts
target/
atecc608-sim/target/

# Runtime state
atecc608_store.json

# Editor files
.idea/
.vscode/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db
9 changes: 9 additions & 0 deletions ATECC608Sim/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rust:1.85-bookworm

WORKDIR /app

COPY atecc608-sim/ /app/atecc608-sim/

RUN cd /app/atecc608-sim && cargo build 2>&1

CMD ["cargo", "test", "--manifest-path", "/app/atecc608-sim/Cargo.toml", "--", "--test-threads=1", "--nocapture"]
66 changes: 66 additions & 0 deletions ATECC608Sim/Dockerfile.sdk-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Stage 1: build the Rust simulator TCP server
FROM rust:1.85-bookworm AS sim-builder

WORKDIR /app
COPY atecc608-sim/ /app/atecc608-sim/
RUN cd /app/atecc608-sim && cargo build --release --bin tcp_server 2>&1

# =============================================================================
# Stage 2: build cryptoauthlib + test binary
# =============================================================================
FROM debian:bookworm

RUN apt-get update && apt-get install -y \
build-essential cmake git pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

COPY --from=sim-builder /app/atecc608-sim/target/release/tcp_server /app/atecc608-sim-server

# ---- Build cryptoauthlib ----
WORKDIR /app
# Pin to a recent known-working tag. v3.7.8 is the latest as of early 2026.
RUN git clone --branch v3.7.8 --depth 1 \
https://github.com/MicrochipTech/cryptoauthlib.git /app/cryptoauthlib

# We register our HAL at runtime by populating ATCAIfaceCfg.atcacustom, so
# cryptoauthlib just needs ATCA_HAL_CUSTOM=ON and the other HALs disabled
# (they pull in libraries we don't have in the container).
RUN mkdir -p /app/cryptoauthlib/build && cd /app/cryptoauthlib/build && \
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-fPIC" \
-DATCA_HAL_CUSTOM=ON \
-DATCA_HAL_I2C=OFF \
-DATCA_HAL_SPI=OFF \
-DATCA_HAL_KIT_UART=OFF \
-DATCA_HAL_KIT_HID=OFF \
-DATCA_HAL_KIT_BRIDGE=OFF \
-DATCA_BUILD_SHARED_LIBS=OFF \
-DATCA_OPENSSL=OFF \
-DATCA_ATECC608_SUPPORT=ON \
-DATCA_PRINTF=ON \
2>&1 && \
cmake --build . -j$(nproc) 2>&1 && \
cmake --install . 2>&1

# ---- Build test binary ----
COPY sdk-test/ /app/sdk-test/

# We link hal_tcp.c directly into the test binary (cryptoauthlib's CMake
# compiles a stubbed `hal_custom.c` into the archive but doesn't link
# user code, so we supply it here ourselves).
RUN gcc -o /app/test_atecc608 \
/app/sdk-test/test_atecc608.c \
/app/sdk-test/hal_tcp.c \
-I/app/sdk-test \
-I/usr/include/cryptoauthlib \
-I/app/cryptoauthlib/build/lib \
-L/usr/lib \
-lcryptoauth -lssl -lcrypto -lpthread \
2>&1

COPY sdk-test/run_test.sh /app/run_test.sh
RUN chmod +x /app/run_test.sh

CMD ["/app/run_test.sh"]
Loading
Loading