Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
13 changes: 0 additions & 13 deletions .github/scripts/cargo_deny.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/scripts/loop.sh

This file was deleted.

34 changes: 0 additions & 34 deletions .github/scripts/test_utimaco.sh

This file was deleted.

18 changes: 18 additions & 0 deletions check_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

# Install cargo deny if not already installed
# cargo install --version 0.18.2 cargo-deny --locked

find . -name "Cargo.toml" -not -path "./Cargo.toml" -exec dirname {} \; | while read -r dir; do
echo "Running cargo build in $dir"
pushd "$dir"
cargo build
cargo test -- --nocapture
cargo clippy --all-targets -- -D warnings
cargo deny check advisories
popd
done

cargo hack build --all --feature-powerset
6 changes: 6 additions & 0 deletions find_empty_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -ex

# Find all regular files that are empty (size 0)
find . -not -path "./*.cargo_check/**" -not -path "./**target/**" -not -path "./*env/lib/*" -not -path "./*node_modules/**" -not -path "./.git/**" -type f -empty -print
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#!/bin/bash
set -ex

if [ "$1" = "Cosmian/kms" || "$1" = "Cosmian/cli"]; then
export OPENSSL_DIR=/usr/local/openssl
fi

env

if [ -z "$OPENSSL_DIR" ]; then
echo "Error: OPENSSL_DIR is not set."
exit 1
fi

if [ -z "$OS_NAME" ]; then
if [[ -z "$OS_NAME" || "$OS_NAME" == "ui" ]]; then
OS_NAME=ubuntu_22_04
else
OS_NAME=${OS_NAME#fips_}
Expand All @@ -37,5 +33,5 @@ mv "${OPENSSL_VERSION}.tar.gz" "${OPENSSL_DIR}"
echo -n Extracting compressed archive...
cd "${OPENSSL_DIR}"
tar -xf "$OPENSSL_VERSION.tar.gz"
find .
chmod u+x lib*/ossl-modules/*
rm "$OPENSSL_VERSION.tar.gz"
Binary file added hsm-proteccio.tar.gz
Binary file not shown.
Binary file added hsm-utimaco-simulator.tar.xz
Binary file not shown.
15 changes: 15 additions & 0 deletions prepare_proteccio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -ex

wget -q https://package.cosmian.com/ci/hsm-proteccio.tar.gz
tar -xzf hsm-proteccio.tar.gz
rm hsm-proteccio.tar.gz

mkdir -p /etc/proteccio/
sudo cp proteccio/etc/proteccio/* /etc/proteccio/
sudo cp proteccio/lib/* /lib/
sudo cp proteccio/usr/local/bin/* /usr/local/bin/

rm -rf proteccio

/usr/local/bin/nethsmstatus
37 changes: 37 additions & 0 deletions prepare_utimaco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -ex

# Fallback to wget if nix is not available (CI environments)
wget -q https://package.cosmian.com/ci/hsm-utimaco-simulator.tar.xz

killall -9 bl_sim5 || true
echo -n Extracting compressed archive...
tar -xf hsm-utimaco-simulator.tar.xz
rm hsm-utimaco-simulator.tar.xz
./hsm-simulator/sim5_linux/bin/bl_sim5 -h -o -d ./hsm-simulator/sim5_linux/devices &

sleep 5

# Place PKCS#11 library and config in a user-writable, persistent location
UTIMACO_ETC="$PWD/.utimaco"
mkdir -p "$UTIMACO_ETC"
cp ./hsm-simulator/libcs_pkcs11_R3.so "$UTIMACO_ETC/libcs_pkcs11_R3.so"
export UTIMACO_PKCS11_LIB="$UTIMACO_ETC/libcs_pkcs11_R3.so"
cp ./hsm-simulator/cs_pkcs11_R3.cfg "$UTIMACO_ETC/"
chmod 644 "$UTIMACO_ETC/cs_pkcs11_R3.cfg"
printf "[Global]\nLogpath = /tmp\nLogging = 3\n[CryptoServer]\nDevice = 3001@localhost\n" >"$UTIMACO_ETC/cs_pkcs11_R3.cfg"
export CS_PKCS11_R3_CFG="$UTIMACO_ETC/cs_pkcs11_R3.cfg"

cd ./hsm-simulator/Administration
# set the SO PIN to 11223344
./p11tool2 Slot=0 login=ADMIN,./key/ADMIN_SIM.key InitToken=11223344
# Change the SO PIN to 12345678
./p11tool2 Slot=0 LoginSO=11223344 SetPin=11223344,12345678
# Set the User PIN to 11223344
./p11tool2 Slot=0 LoginSO=12345678 InitPin=11223344
# Change the User PIN to 12345678
./p11tool2 Slot=0 LoginUser=11223344 SetPin=11223344,12345678
./p11tool2 Slot=0 GetSlotInfo
cd ../..

rm -rf hsm-simulator