diff --git a/.github/workflows/codeql_checks.yml b/.github/workflows/codeql_checks.yml index 8b535779..1c89d507 100644 --- a/.github/workflows/codeql_checks.yml +++ b/.github/workflows/codeql_checks.yml @@ -15,32 +15,6 @@ on: jobs: analyse: - name: Analyse - strategy: - matrix: - sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"] - #'cpp' covers C and C++ - language: [ 'cpp' ] - runs-on: ubuntu-latest - container: - image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest - - steps: - - name: Clone - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: security-and-quality - - # CodeQL will create the database during the compilation - - name: Build - run: | - make BOLOS_SDK=${{ matrix.sdk }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + name: Call Ledger CodeQL analysis + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_codeql_checks.yml@v1 + secrets: inherit diff --git a/.github/workflows/documentation_generation.yml b/.github/workflows/documentation_generation.yml index 7334769f..d99f72cf 100644 --- a/.github/workflows/documentation_generation.yml +++ b/.github/workflows/documentation_generation.yml @@ -18,14 +18,14 @@ jobs: steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: HTML documentation run: doxygen .doxygen/Doxyfile - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: documentation path: doc/html diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml index c427ca55..f9edea1e 100644 --- a/.github/workflows/js_tests.yml +++ b/.github/workflows/js_tests.yml @@ -13,9 +13,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js 16 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 16 - run: cd js && yarn install && yarn build && yarn test diff --git a/.github/workflows/misspellings_checks.yml b/.github/workflows/misspellings_checks.yml index 6612d6fd..d0cf6e6a 100644 --- a/.github/workflows/misspellings_checks.yml +++ b/.github/workflows/misspellings_checks.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check misspellings uses: codespell-project/actions-codespell@v2 diff --git a/.github/workflows/python_client_checks.yml b/.github/workflows/python_client_checks.yml index ce58b3cb..152bee11 100644 --- a/.github/workflows/python_client_checks.yml +++ b/.github/workflows/python_client_checks.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Installing PIP dependencies run: | pip install pylint @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Installing PIP dependencies run: | pip install mypy diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 3a63ea07..8c484b50 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check directory run: | @@ -31,7 +31,7 @@ jobs: - name: Clone SDK if: ${{ env.DIR_OK == 'true' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ledgerHQ/ledger-secure-sdk path: sdk @@ -53,7 +53,7 @@ jobs: lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \ genhtml coverage.info -o coverage - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ env.DIR_OK == 'true' }} with: name: code-coverage @@ -61,7 +61,7 @@ jobs: - name: Upload to codecov.io if: ${{ env.DIR_OK == 'true' }} - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./unit-tests/coverage.info diff --git a/Makefile b/Makefile index f6ff0d10..3fd717fc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ include $(BOLOS_SDK)/Makefile.defines APPNAME = "Flow" APPVERSION_M=0 -APPVERSION_N=15 +APPVERSION_N=16 APPVERSION_P=0 APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" @@ -49,6 +49,7 @@ ICON_NANOX = icons/nanox_icon.gif ICON_NANOSP = icons/nanox_icon.gif ICON_STAX = icons/stax_icon.gif ICON_FLEX = icons/flex_icon.png +ICON_APEX_P = icons/apex_p_icon.png # Application allowed derivation curves. # Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1 @@ -105,15 +106,12 @@ ENABLE_BLUETOOTH = 1 ######################################## # These advanced settings allow to disable some feature that are by # default enabled in the SDK `Makefile.standard_app`. -DISABLE_STANDARD_APP_FILES = 1 +# DISABLE_STANDARD_APP_FILES = 1 #DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1 # To allow custom size declaration #DISABLE_STANDARD_APP_DEFINES = 1 # Will set all the following disablers #DISABLE_STANDARD_SNPRINTF = 1 #DISABLE_STANDARD_USB = 1 #DISABLE_STANDARD_WEBUSB = 1 -ifeq ($(TARGET_NAME),TARGET_NANOS) -DISABLE_STANDARD_BAGL_UX_FLOW = 1 -endif ######################################## # Main app configuration # @@ -122,10 +120,6 @@ endif DEFINES += HAVE_BOLOS_APP_STACK_CANARY DEFINES += LEDGER_SPECIFIC -ifeq ($(TARGET_NAME),TARGET_NANOS) -APP_STACK_MIN_SIZE:=2480 -endif - ######################################## # Unit tests and misc # ######################################## diff --git a/glyphs/icon_apex_p_48.png b/glyphs/icon_apex_p_48.png new file mode 100644 index 00000000..b2378b21 Binary files /dev/null and b/glyphs/icon_apex_p_48.png differ diff --git a/icons/apex_p_icon.png b/icons/apex_p_icon.png new file mode 100644 index 00000000..6ee29509 Binary files /dev/null and b/icons/apex_p_icon.png differ diff --git a/ledger_app.toml b/ledger_app.toml index d29d3583..df09cecb 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,7 +1,7 @@ [app] build_directory = "./" sdk = "C" -devices = ["nanos+", "nanox", "stax", "flex"] +devices = ["nanos+", "nanox", "stax", "flex", "apex_p"] [tests] unit_directory = "./unit-tests/" diff --git a/src/addr.c b/src/addr.c index 13054977..25c3000c 100644 --- a/src/addr.c +++ b/src/addr.c @@ -71,17 +71,12 @@ zxerr_t addr_getItem_internal(int8_t *displayIdx, pageString(outVal, outValLen, "account data.", pageIdx, pageCount); return zxerr_ok; case SHOW_ADDRESS_EMPTY_SLOT: -#if defined(TARGET_NANOS) - snprintf(outKey, outKeyLen, "Account data"); - pageString(outVal, outValLen, "not saved on the device.", pageIdx, pageCount); -#else snprintf(outKey, outKeyLen, "Address:"); pageString(outVal, outValLen, "Account data not saved on the device.", pageIdx, pageCount); -#endif return zxerr_ok; case SHOW_ADDRESS_HDPATHS_NOT_EQUAL: snprintf(outKey, outKeyLen, "Address:"); @@ -107,24 +102,12 @@ zxerr_t addr_getItem_internal(int8_t *displayIdx, } SCREEN(show_address_yes) { -#if defined(TARGET_NANOS) - snprintf(outKey, outKeyLen, "Verify if this"); - snprintf(outVal, outValLen, " public key was added to"); -#else snprintf(outKey, outKeyLen, "Warning:"); snprintf(outVal, outValLen, "Verify if this public key was added to"); -#endif return zxerr_ok; } SCREEN(show_address_yes) { -#if defined(TARGET_NANOS) - array_to_hexstr(outKey, - outKeyLen, - address_to_display.data, - sizeof(address_to_display.data)); - snprintf(outVal, outValLen, " using any Flow blockch. explorer."); -#else char buffer[2 * sizeof(address_to_display.data) + 1]; array_to_hexstr(buffer, sizeof(buffer), @@ -132,7 +115,6 @@ zxerr_t addr_getItem_internal(int8_t *displayIdx, sizeof(address_to_display.data)); snprintf(outVal, outValLen, "%s using any Flow blockchain explorer.", buffer); snprintf(outKey, outKeyLen, ""); -#endif return zxerr_ok; } diff --git a/src/common/main.c b/src/common/main.c index 3e408e7f..767734fa 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -31,6 +31,7 @@ __attribute__((section(".boot"))) int main(void) { app_main(); } CATCH_OTHER(e) { + UNUSED(e); } FINALLY { } diff --git a/src/common/tx.c b/src/common/tx.c index 086cf6a2..20fcb32b 100644 --- a/src/common/tx.c +++ b/src/common/tx.c @@ -22,13 +22,8 @@ #include "zxmacros.h" #include "app_mode.h" -#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX) #define RAM_BUFFER_SIZE 8192 #define FLASH_BUFFER_SIZE 16384 -#elif defined(TARGET_NANOS) -#define RAM_BUFFER_SIZE 0 -#define FLASH_BUFFER_SIZE 8192 -#endif // Ram uint8_t ram_buffer[RAM_BUFFER_SIZE]; @@ -39,7 +34,7 @@ typedef struct { } storage_t; #if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || \ - defined(TARGET_STAX) || defined(TARGET_FLEX) + defined(TARGET_STAX) || defined(TARGET_FLEX) || defined(TARGET_APEX_P) storage_t NV_CONST N_appdata_impl __attribute__((aligned(64))); #define N_appdata (*(NV_VOLATILE storage_t *) PIC(&N_appdata_impl)) #endif diff --git a/src/crypto.c b/src/crypto.c index a3399162..2d4d8fd8 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -22,7 +22,7 @@ #include "zxerror.h" #if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || \ - defined(TARGET_STAX) || defined(TARGET_FLEX) + defined(TARGET_STAX) || defined(TARGET_FLEX) || defined(TARGET_APEX_P) #include "lib_standard_app/crypto_helpers.h" #include "cx.h" diff --git a/src/crypto.h b/src/crypto.h index 7b9692d4..287c52b6 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -31,7 +31,7 @@ typedef enum { HASH_UNKNOWN, HASH_SHA2_256, HASH_SHA3_256 } digest_type_e; typedef enum { CURVE_UNKNOWN, CURVE_SECP256K1, CURVE_SECP256R1 } curve_e; #if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || \ - defined(TARGET_STAX) || defined(TARGET_FLEX) + defined(TARGET_STAX) || defined(TARGET_FLEX) || defined(TARGET_APEX_P) #else #define CX_SHA256_SIZE 32 #define CX_SHA3_256_SIZE 32 diff --git a/src/json/json_parser.h b/src/json/json_parser.h index dbdfbeff..d8b9b4a0 100644 --- a/src/json/json_parser.h +++ b/src/json/json_parser.h @@ -29,12 +29,6 @@ extern "C" { /// Max number of accepted tokens in the JSON input #define MAX_NUMBER_OF_TOKENS 256 -// we must limit the number -#if defined(TARGET_NANOS) -#undef MAX_NUMBER_OF_TOKENS -#define MAX_NUMBER_OF_TOKENS 128 -#endif - #define ROOT_TOKEN_INDEX 0 //---------------------------------------------