From 55aad157453bf15b7697a5d0b86cb7e0c54540db Mon Sep 17 00:00:00 2001 From: ftheirs Date: Tue, 12 Dec 2023 14:58:14 -0300 Subject: [PATCH] update Ledger CI --- .github/workflows/guidelines_enforcer.yml | 3 --- app/Makefile | 1 - app/src/common/tx.h | 1 + app/src/crypto.c | 14 +++++++------- app/src/crypto_test.c | 2 +- ledger_app.toml | 7 +++++++ 6 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 ledger_app.toml diff --git a/.github/workflows/guidelines_enforcer.yml b/.github/workflows/guidelines_enforcer.yml index b39250cb..fdaf9f27 100644 --- a/.github/workflows/guidelines_enforcer.yml +++ b/.github/workflows/guidelines_enforcer.yml @@ -21,6 +21,3 @@ jobs: guidelines_enforcer: name: Call Ledger guidelines_enforcer uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1 - with: - relative_app_directory: app - run_for_devices: '["nanos", "nanosp", "nanox"]' diff --git a/app/Makefile b/app/Makefile index 4753e1b6..fe073e2c 100755 --- a/app/Makefile +++ b/app/Makefile @@ -50,7 +50,6 @@ endif APP_LOAD_PARAMS = --curve secp256k1 $(COMMON_LOAD_PARAMS) --path $(APPPATH) -NANOS_STACK_SIZE := 1932 include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices $(info TARGET_NAME = [$(TARGET_NAME)]) diff --git a/app/src/common/tx.h b/app/src/common/tx.h index 803114e1..901e7448 100644 --- a/app/src/common/tx.h +++ b/app/src/common/tx.h @@ -17,6 +17,7 @@ #include "coin.h" #include "zxerror.h" +#include // transaction initializer for the buffer and transaction type. void tx_context_fil(); diff --git a/app/src/crypto.c b/app/src/crypto.c index 8e9839b1..32274c8d 100644 --- a/app/src/crypto.c +++ b/app/src/crypto.c @@ -45,11 +45,11 @@ static zxerr_t crypto_extractPublicKey(uint8_t *pubKey, uint16_t pubKeyLen, uint privateKeyData, chainCode, NULL, - 0)) + 0)); - CATCH_CXERROR(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &cx_privateKey)) - CATCH_CXERROR(cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1, NULL, 0, &cx_publicKey)) - CATCH_CXERROR(cx_ecfp_generate_pair_no_throw(CX_CURVE_256K1, &cx_publicKey, &cx_privateKey, 1)) + CATCH_CXERROR(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &cx_privateKey)); + CATCH_CXERROR(cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1, NULL, 0, &cx_publicKey)); + CATCH_CXERROR(cx_ecfp_generate_pair_no_throw(CX_CURVE_256K1, &cx_publicKey, &cx_privateKey, 1)); memcpy(pubKey, cx_publicKey.W, SECP256K1_PK_LEN); error = zxerr_ok; @@ -170,16 +170,16 @@ zxerr_t _sign(uint8_t *output, uint16_t outputLen, const uint8_t *message, uint1 privateKeyData, NULL, NULL, - 0)) + 0)); - CATCH_CXERROR(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &cx_privateKey)) + CATCH_CXERROR(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &cx_privateKey)); CATCH_CXERROR(cx_ecdsa_sign_no_throw(&cx_privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256, message, messageLen, signature->der_signature, - &signatureLength, &tmpInfo)) + &signatureLength, &tmpInfo)); const err_convert_e err_c = convertDERtoRSV(signature->der_signature, tmpInfo, signature->r, signature->s, &signature->v); if (err_c == no_error) { diff --git a/app/src/crypto_test.c b/app/src/crypto_test.c index 91fb528b..69f0fcf1 100644 --- a/app/src/crypto_test.c +++ b/app/src/crypto_test.c @@ -19,7 +19,7 @@ #include "crypto_helper.h" // Implementation from methods that are needed for cpp_test -#if !defined (TARGET_NANOS) && !defined(TARGET_NANOS2) && !defined(TARGET_NANOX) && !defined(TARGET_STAX) +#if !defined(LEDGER_SPECIFIC) #include "blake2.h" char *crypto_testPubKey; diff --git a/ledger_app.toml b/ledger_app.toml new file mode 100644 index 00000000..de2864f5 --- /dev/null +++ b/ledger_app.toml @@ -0,0 +1,7 @@ +[app] +build_directory = "./app/" +sdk = "C" +devices = ["nanos", "nanox", "nanos+"] + +[tests] +unit_directory = "./tests/"