-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from coti-io/master
Adding message data
- Loading branch information
Showing
37 changed files
with
1,019 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Coti Ledger Compilation & tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
nano_build: | ||
name: Build Coti Ledger application for NanoS, X and S+ | ||
strategy: | ||
matrix: | ||
include: | ||
- SDK: "$NANOS_SDK" | ||
SDK_VERSION: "$NANOS_SDK_VERSION" | ||
SDK_NAME: NANOS | ||
ARTIFACT: coti-ledger-app-nanoS | ||
- SDK: "$NANOX_SDK" | ||
SDK_VERSION: "$NANOX_SDK_VERSION" | ||
SDK_NAME: NANOX | ||
ARTIFACT: coti-ledger-app-nanoX | ||
- SDK: "$NANOSP_SDK" | ||
SDK_VERSION: "$NANOSP_SDK_VERSION" | ||
SDK_NAME: NANOS+ | ||
ARTIFACT: coti-ledger-app-nanoSP | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/coti-io/coti-ledger-app-builder:latest | ||
|
||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v2 | ||
- name: Build ${{ matrix.SDK_NAME }} app | ||
run: | | ||
cd app | ||
make BOLOS_SDK=${{ matrix.SDK }} | ||
- name: Generate app binary name | ||
id: generate-name | ||
run: echo "::set-output name=BINARY_NAME::${{ matrix.ARTIFACT }}-${{ matrix.SDK_VERSION }}" | ||
- name: Upload app binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.generate-name.outputs.BINARY_NAME }} | ||
path: app/bin | ||
|
||
job_scan_build: | ||
name: Clang Static Analyzer | ||
runs-on: ubuntu-latest | ||
|
||
container: | ||
image: ghcr.io/coti-io/coti-ledger-app-builder:latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build with Clang Static Analyzer | ||
run: | | ||
cd app | ||
make clean | ||
scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default | ||
- uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: scan-build | ||
path: scan-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Build the docker image and push it to GitHub Packages | ||
|
||
name: Coti Ledger App Builder Publisher | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
name: Build and push coti-ledger-app-builder image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
|
||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push coti-ledger-app-builder to GitHub Packages | ||
uses: docker/build-push-action@v1 | ||
with: | ||
dockerfile: Dockerfile | ||
repository: coti-io/coti-ledger-app-builder | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
tag_with_sha: true | ||
tags: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
.vscode | ||
.DS_Store | ||
cmake-build-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
project(coti-ledger-app) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
|
||
set(APP_DOMAIN ./app/src/) | ||
set(BOLOS_SDK_INCLUDE ../nanos-sdk/include ../nanos-sdk/lib_2uf/include ../nanos-sdk/lib_ux/include ../nanos-sdk/lib_u2f/include ../nanos-sdk/lib_cxng/include) | ||
|
||
include_directories(${APP_DOMAIN}) | ||
include_directories(${BOLOS_SDK_INCLUDE}) | ||
|
||
add_compile_definitions(OS_IO_SEPROXYHAL HAVE_BAGL HAVE_PRINTF HAVE_SPRINTF HAVE_UX_FLOW HAVE_USB_APDU HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=6 IO_HID_EP_LENGTH=64 HAVE_USB_APDU) | ||
add_compile_definitions(HAVE_ECC HAVE_SHA3 HAVE_U2F HAVE_IO_U2F HAVE_ECC_WEIERSTRASS HAVE_SECP256K1_CURVE HAVE_HASH HAVE_ECDSA U2F_PROXY_MAGIC=\"COTI\" USB_SEGMENT_SIZE=64 BLE_SEGMENT_SIZE=32) | ||
add_compile_definitions(HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL="" PRINTF=screen_printf IO_SEPROXYHAL_BUFFER_SIZE_B=300 APPVERSION) | ||
|
||
file(GLOB_RECURSE APP_SRC "./app/src/**") | ||
file(GLOB_RECURSE BOLOS_SDK_SRC "../nanos-sdk/**") | ||
add_executable(coti-ledger-app ${BOLOS_SDK_SRC} ${APP_SRC}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,82 @@ | ||
FROM python:3.8-slim | ||
FROM ubuntu:20.04 | ||
ENV LANG C.UTF-8 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG LLVM_VERSION=12 | ||
|
||
RUN apt-get update && apt-get upgrade -qy && \ | ||
apt-get install -qy \ | ||
clang \ | ||
gcc-multilib \ | ||
gcc-arm-none-eabi \ | ||
libc6-dev-armhf-cross \ | ||
cmake \ | ||
git \ | ||
libudev-dev \ | ||
libusb-1.0-0-dev \ | ||
python3-pip \ | ||
wget \ | ||
gettext-base && \ | ||
clang-$LLVM_VERSION \ | ||
clang-tools-$LLVM_VERSION \ | ||
clang-format-$LLVM_VERSION \ | ||
cmake \ | ||
curl \ | ||
doxygen \ | ||
git \ | ||
lcov \ | ||
libbsd-dev \ | ||
libcmocka0 \ | ||
libcmocka-dev \ | ||
lld-$LLVM_VERSION \ | ||
make \ | ||
protobuf-compiler \ | ||
python-is-python3 \ | ||
python3 \ | ||
python3-pip \ | ||
gettext-base && \ | ||
apt-get autoclean -y && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean | ||
|
||
# Create generic clang & lld symbolic links to their installed version | ||
RUN cd /usr/bin && \ | ||
find . -name "*-"$LLVM_VERSION | sed "s/^\(.*\)\(-"$LLVM_VERSION"\)$/ln -s \1\2 \1/" | sh | ||
|
||
# ARM Embedded Toolchain | ||
# Integrity is checked using the MD5 checksum provided by ARM at https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads | ||
RUN curl -sSfL -o arm-toolchain.tar.bz2 "https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2" && \ | ||
echo 2383e4eb4ea23f248d33adc70dc3227e arm-toolchain.tar.bz2 > /tmp/arm-toolchain.md5 && \ | ||
md5sum --check /tmp/arm-toolchain.md5 && rm /tmp/arm-toolchain.md5 && \ | ||
tar xf arm-toolchain.tar.bz2 -C /opt && \ | ||
rm arm-toolchain.tar.bz2 | ||
|
||
# Adding GCC to PATH and defining rustup/cargo home directories | ||
ENV PATH=/opt/gcc-arm-none-eabi-10.3-2021.10/bin:$PATH \ | ||
RUSTUP_HOME=/opt/rustup \ | ||
CARGO_HOME=/opt/.cargo | ||
|
||
# Install rustup to manage rust toolchains | ||
RUN curl https://sh.rustup.rs -sSf | \ | ||
sh -s -- --default-toolchain stable -y | ||
|
||
# Adding cargo binaries to PATH | ||
ENV PATH=${CARGO_HOME}/bin:${PATH} | ||
|
||
# Adding ARMV6M target to the default toolchain | ||
RUN rustup target add thumbv6m-none-eabi | ||
|
||
# Python packages commonly used by apps | ||
RUN pip3 install ledgerblue pytest | ||
|
||
# CMocka | ||
RUN \ | ||
echo f0ccd8242d55e2fd74b16ba518359151f6f8383ff8aef4976e48393f77bba8b6 cmocka-1.1.5.tar.xz >> SHA256SUMS && \ | ||
wget https://cmocka.org/files/1.1/cmocka-1.1.5.tar.xz && \ | ||
sha256sum --check SHA256SUMS && \ | ||
mkdir cmocka && \ | ||
tar xf cmocka-1.1.5.tar.xz && \ | ||
cd cmocka && \ | ||
cmake ../cmocka-1.1.5 -DBUILD_SHARED_LIBS=OFF -DWITH_EXAMPLES=OFF -DCMAKE_C_COMPILER=arm-none-eabi-gcc -DCMAKE_C_FLAGS="--specs=nosys.specs" -DWITH_STATIC_LIB=true -DCMAKE_INSTALL_PREFIX=/install && \ | ||
make install && \ | ||
cd .. && \ | ||
rm -rf cmoka/ cmocka-1.1.5/ cmocka-1.1.5.tar.xz SHA256SUMS | ||
# Latest Nano S SDK | ||
ENV NANOS_SDK=/opt/nanos-secure-sdk | ||
ENV NANOS_SDK_VERSION=2.1.0 | ||
RUN git clone --branch ${NANOS_SDK_VERSION} --depth 1 https://github.com/LedgerHQ/nanos-secure-sdk.git "${NANOS_SDK}" | ||
|
||
# Latest Nano X SDK | ||
ENV NANOX_SDK=/opt/nanox-secure-sdk | ||
ENV NANOX_SDK_VERSION=2.0.2-2 | ||
RUN git clone --branch ${NANOX_SDK_VERSION} --depth 1 https://github.com/LedgerHQ/nanox-secure-sdk.git "${NANOX_SDK}" | ||
|
||
# Nano S SDK | ||
RUN git clone --branch 2.0.0-1 https://github.com/LedgerHQ/nanos-secure-sdk.git sdk | ||
# Latest Nano S+ SDK | ||
ENV NANOSP_SDK=/opt/nanosplus-secure-sdk | ||
ENV NANOSP_SDK_VERSION=1.0.3 | ||
RUN git clone --branch ${NANOSP_SDK_VERSION} --depth 1 https://github.com/LedgerHQ/nanosplus-secure-sdk.git "${NANOSP_SDK}" | ||
|
||
ENV BOLOS_SDK=/sdk | ||
# Default SDK | ||
ENV BOLOS_SDK=${NANOS_SDK} | ||
|
||
WORKDIR /coti | ||
|
||
CMD ["/bin/bash"] | ||
CMD ["/usr/bin/env", "bash"] |
Oops, something went wrong.