Skip to content

Commit

Permalink
Merge pull request #28 from tropicsquare/develop
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
pavelpolach321 authored Feb 4, 2025
2 parents c2db08b + a4f730c commit e9ba707
Show file tree
Hide file tree
Showing 50 changed files with 3,051 additions and 468 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/build_docs.yml

This file was deleted.

35 changes: 18 additions & 17 deletions .github/workflows/build_docs_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build docs and release (master)
name: Build docs and release to GitHub Pages from master
on:
push:
branches:
Expand Down Expand Up @@ -27,21 +27,22 @@ jobs:
BUILD_DOCS=ON
USE_TREZOR_CRYPTO=ON
- name: Archive HTML docs
uses: thedoctor0/[email protected]
- name: Upload built html as artifact
id: html_artifact
uses: actions/upload-pages-artifact@v3
with:
type: 'zip'
filename: 'libtropic-html-docs.zip'
directory: 'build/docs/doxygen/html/'
path: build/docs/doxygen/html

- name: Upload HTML docs release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: 'build/docs/doxygen/html/libtropic-html-docs.zip'
makeLatest: true
name: 'HTML Documentation'
prerelease: false
replacesArtifacts: true
tag: 'latest'
deploy:
environment:
name: github-pages
url: ${{ steps.html_artifact.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Deploy to GitHub Pages
id: pages_deployment
uses: actions/deploy-pages@v4
61 changes: 0 additions & 61 deletions .github/workflows/integration_tests.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
static_analysis:
if: ${{ false }} # disable for now

runs-on: ubuntu-22.04

steps:
Expand All @@ -32,8 +34,8 @@ jobs:
uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
config: ./codechecker_config.json
build-command: ./codechecker_build.sh
config: ./scripts/codechecker/codechecker_config.json
build-command: ./scripts/codechecker/codechecker_build.sh

- name: Upload results artifacts
uses: actions/upload-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
- name: Checkout Repository
uses: actions/[email protected]

- name: Set Ceedling config path
run: echo "CEEDLING_MAIN_PROJECT_FILE=scripts/ceedling.yml" >>$GITHUB_ENV

- name: Run Ceedling Unit Tests
uses: pavelpolach321/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ run_ceedling_tests:
script:
- source setup_env
- rm -rf build/
- ceedling gcov:all utils:gcov
- CEEDLING_MAIN_PROJECT_FILE=scripts/ceedling.yml ceedling gcov:all utils:gcov

coverage: '/^TOTAL.*\s+(\d+\%)$/'

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "stm32_example/drivers/STM32CubeF4"]
path = stm32_example/drivers/STM32CubeF4
url = https://github.com/STMicroelectronics/STM32CubeF4
[submodule "tests/platforms/libtropic-stm32"]
path = tests/platforms/libtropic-stm32
url = https://github.com/tropicsquare/libtropic-stm32
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ECC_SLOT1-32 numbering chabged to ECC_SLOT_0-31
- lt_handshake() function renamed to lt_session_start()
- TROPIC01 hw wallet example updated - compiles for 32 and 64 bit system
- Unit tests organization was updated
- Included lt_l2_api_structs.h and lt_l3_api_structs.h are automatically generated
- SH0 pairing keypair now reflects first batch of TROPIC01 devices
- Changed logging format in examples.

### Added

- L3 commands: MCounter (init, update and get), MAC-and-destroy,
- L2 commands: Resend, Sleep and Log req
- libtropic API: lt_update_mode()
- Example folder and test folder is reworked
- option LT_ADD_EXAMPLES controls if example's folder code is a part of compilation

### Fixed

Expand Down
63 changes: 51 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ option(LT_CRYPTO_MBEDTLS "Use mbedtls as a cryptography provider" OFF)
option(BUILD_DOCS "Build documentation" OFF)
option(EXPERIMENTAL_SPI_UART "Experimental feature for spi slave to serial hw convertor" OFF)
option(EXPERIMENTAL_SPI_RASPBERRYPI "Experimental feature for spi slave on rpi 4" OFF)

option(LT_ADD_EXAMPLES "Compile example code as part of libtropic library" OFF)
option(LT_ENABLE_FW_UPDATE "Enable firmware update functions and compile firmware update in a form of byte array" OFF)
###########################################################################
# #
# Building documentation #
Expand All @@ -35,7 +36,12 @@ endif()

###########################################################################
# #
# Collect files #
# Collect files: #
# #
# SDK_SRCS: source files #
# SDK_INCS: header files #
# SDK_DIRS_PRIV: private directories #
# SDK_DIRS_PUB: public directories #
# #
###########################################################################

Expand All @@ -45,6 +51,7 @@ project(libtropic_SDK
HOMEPAGE_URL "www.tropicsquare.com"
LANGUAGES C)

# Collect source files which are always compiled
set(SDK_SRCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/src/libtropic.c
${CMAKE_CURRENT_SOURCE_DIR}/src/lt_crc16.c
Expand All @@ -56,7 +63,12 @@ set(SDK_SRCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/src/lt_hkdf.c
${CMAKE_CURRENT_SOURCE_DIR}/src/lt_random.c
)

set(SDK_SRCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_aesgcm.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_ed25519.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_x25519.c
)
set(SDK_INCS ${SDK_INCS}
${CMAKE_CURRENT_SOURCE_DIR}/include/libtropic_common.h
${CMAKE_CURRENT_SOURCE_DIR}/include/libtropic.h
Expand All @@ -70,18 +82,45 @@ set(SDK_INCS ${SDK_INCS}
${CMAKE_CURRENT_SOURCE_DIR}/src/lt_hkdf.h
${CMAKE_CURRENT_SOURCE_DIR}/src/lt_random.h
)

set(SDK_SRCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_aesgcm.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_ed25519.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_sha256.c
${CMAKE_CURRENT_SOURCE_DIR}/hal/crypto/trezor_crypto/lt_crypto_trezor_x25519.c
set(SDK_DIRS_PRIV ${SDK_DIRS_PRIV}
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
set(SDK_DIRS_PUB ${SDK_DIRS_PUB}
${CMAKE_CURRENT_SOURCE_DIR}/include
)


# Collect files to be compiled when "examples" are enabled
if(LT_ADD_EXAMPLES)
set(SDK_SRCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/examples/lt_ex_hello_world.c
${CMAKE_CURRENT_SOURCE_DIR}/examples/lt_ex_hw_wallet.c
${CMAKE_CURRENT_SOURCE_DIR}/examples/lt_ex_test_reversible.c
${CMAKE_CURRENT_SOURCE_DIR}/examples/lt_ex_test_ireversible.c
${CMAKE_CURRENT_SOURCE_DIR}/examples/keys.c
)
set(SDK_DIRS_PUB ${SDK_DIRS_PUB}
${CMAKE_CURRENT_SOURCE_DIR}/examples/
)
endif()


# Collect files to be compiled when "fw update" is enabled
if(LT_ENABLE_FW_UPDATE)
set(SDK_INCS ${SDK_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/TROPIC01_fw_update_files/boot_v1.0.1/fw_CPU_0_1_2.h
${CMAKE_CURRENT_SOURCE_DIR}/examples/lt_ex_fw_update.c
)
set(SDK_DIRS_PUB ${SDK_DIRS_PUB}
${CMAKE_CURRENT_SOURCE_DIR}/TROPIC01_fw_update_files/boot_v1.0.1/
)
endif()


add_library(tropic ${SDK_SRCS} ${SDK_INCS})

target_include_directories(tropic PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_include_directories(tropic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_include_directories(tropic PRIVATE ${SDK_DIRS_PRIV})
target_include_directories(tropic PUBLIC ${SDK_DIRS_PUB})

target_compile_definitions(tropic PRIVATE "$<$<CONFIG:DEBUG>:LIBT_DEBUG>")

Expand All @@ -103,7 +142,7 @@ endif()

if(USE_TREZOR_CRYPTO)
add_subdirectory(vendor/trezor_crypto/ "trezor_crypto")
target_compile_definitions(trezor_crypto PRIVATE AES_VAR)
target_compile_definitions(trezor_crypto PRIVATE AES_VAR USE_INSECURE_PRNG)
target_link_libraries(tropic PRIVATE trezor_crypto)
target_compile_definitions(tropic PRIVATE USE_TREZOR_CRYPTO)
endif()
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For more info about TROPIC01 check datasheet and API pdf.
* `examples/` A few examples how libtropic might be used
* `hal/` Support code for various platforms - transport layer, delay function and RNG
* `include/` Public API header files
* `scripts/` Build and config scripts
* `src/` Library's source files
* `tests/` Unit tests and integration tests
* `vendor/` Third party libraries and tools
Expand Down
7 changes: 7 additions & 0 deletions TROPIC01_fw_update_files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### TROPIC01 firmware update files

TODO explain here the purpose of this folder

```
./convert.py boot_v1.0.1/fw_v0.1.2_signed.bin > boot_v1.0.1/fw_CPU_0_1_2.
```
Loading

0 comments on commit e9ba707

Please sign in to comment.