From 8fec8e5056d3d0c206dd821ce7be4fb029f8cfd8 Mon Sep 17 00:00:00 2001 From: Taras Drozdovskyi Date: Mon, 19 Feb 2024 17:06:41 +0200 Subject: [PATCH] ci: Added linter workflow Signed-off-by: Taras Drozdovskyi --- .github/workflows/linter.yml | 25 +++++++++++++++++++++++++ README.md | 1 + apps/hello_world/ca/hello_world_ns.c | 2 +- docs/mtower_test_suite_description.md | 2 ++ tools/ecdsa_keygen.c | 6 +++--- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..9bb67a3d --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +name: cpp-linter + +on: [push, pull_request] + +jobs: + cpp-linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cpp-linter/cpp-linter-action@main + id: linter + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: '' + files-changed-only: false + ignore: crypto + + - name: Fail fast?! + if: steps.linter.outputs.checks-failed != 0 + run: | + echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}" + # for actual deployment + # run: exit 1 \ No newline at end of file diff --git a/README.md b/README.md index 3d0b4c1f..bd3ee4fd 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Build](https://github.com/samsung/mtower/workflows/Build/badge.svg)](https://github.com/samsung/mtower/actions?query=workflow%3ABuild) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6108/badge)](https://bestpractices.coreinfrastructure.org/projects/6108) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Samsung/mTower/badge)](https://api.securityscorecards.dev/projects/github.com/Samsung/mTower) +[![cpp-linter](https://github.com/cpp-linter/cpp-linter-action/actions/workflows/cpp-linter.yml/badge.svg)](https://github.com/cpp-linter/cpp-linter-action/actions/workflows/cpp-linter.yml) [![RepoSize](https://img.shields.io/github/repo-size/samsung/mtower.svg)](https://github.com/samsung/mtower) [![Release](https://img.shields.io/github/v/release/samsung/mtower.svg)](https://github.com/samsung/mtower/releases) [![LICENSE](https://img.shields.io/github/license/samsung/mtower.svg)](https://github.com/samsung/mtower/blob/master/LICENSE) diff --git a/apps/hello_world/ca/hello_world_ns.c b/apps/hello_world/ca/hello_world_ns.c index 8e2a0dce..7e1af7f5 100644 --- a/apps/hello_world/ca/hello_world_ns.c +++ b/apps/hello_world/ca/hello_world_ns.c @@ -29,7 +29,7 @@ #include #include -#include +#include "tee_client_api.h" /* To the the UUID (found the the TA's h-file(s)) */ #include diff --git a/docs/mtower_test_suite_description.md b/docs/mtower_test_suite_description.md index c774ccd4..57150b84 100644 --- a/docs/mtower_test_suite_description.md +++ b/docs/mtower_test_suite_description.md @@ -7,6 +7,8 @@ ## 1. Overview mTower GP API test suite demonstrates the valid execution of relevant GP TEE API function implementations. As many of the functions depend on each other for successful operation, it is not reasonable to create a separate test for every possible combination of invalid parameters for each function in API, so, while the tests demonstrate behavior of API functions under some error conditions, most of the tests are concerned with correct use of functions, where returned results signal successful execution. Also note that many of the functions in Trusted part of TEE do not have full-fledged error handling mechanisms, as these functions are considered critical - that is, they must succeed, because it is impossible for system to recover if these functions fail. In such functions, error condition typically results in calling TEE_Panic() function, which writes an error message into log and drops the system into infinite loop, essentially hanging it. +**When adding or changing functionality, it is highly advisable to add new tests as part of your contribution.** + ## 2. How to run Start out by following the "Get and build the solution" in the [build.md] file. > Warning: Need to download the toolchain (exec. `make toolchain`). diff --git a/tools/ecdsa_keygen.c b/tools/ecdsa_keygen.c index 96bc164e..2955fc60 100644 --- a/tools/ecdsa_keygen.c +++ b/tools/ecdsa_keygen.c @@ -75,11 +75,11 @@ typedef struct Message_Struct { /* Private Data. */ /* All static data definitions appear here. */ -uint32_t key[] = +const uint32_t key[] = { 0x78563412, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xefcdac00 }; -uint32_t iv[] = +const uint32_t iv[] = { 0x78563412, 0x00000000, 0x00000000, 0xefcdac00 }; /* Public Data. */ @@ -374,7 +374,7 @@ int main(int argc, char * argv[]) } fclose(fd); -exit: +// exit: BN_free(x); BN_free(y); EC_GROUP_free(ecgroup);