diff --git a/app/Makefile.version b/app/Makefile.version index 0b62e91a..d796c687 100644 --- a/app/Makefile.version +++ b/app/Makefile.version @@ -3,4 +3,4 @@ APPVERSION_M=0 # This is the `spec_version` field of `Runtime` APPVERSION_N=0 # This is the patch version of this release -APPVERSION_P=10 +APPVERSION_P=11 diff --git a/app/src/crypto.c b/app/src/crypto.c index 8fb9c05d..94979a82 100644 --- a/app/src/crypto.c +++ b/app/src/crypto.c @@ -197,13 +197,24 @@ zxerr_t crypto_hashSigSection(const signature_section_t *signature_section, cons cx_sha256_update(&sha256, (uint8_t*) &signature_section->signerDiscriminant, 1); switch (signature_section->signerDiscriminant) { - case PubKeys: + case PubKeys: { cx_sha256_update(&sha256, (uint8_t*) &signature_section->pubKeysLen, 4); - if (signature_section->pubKeysLen > 0) { - cx_sha256_update(&sha256, signature_section->pubKeys.ptr, PK_LEN_25519_PLUS_TAG * signature_section->pubKeysLen); + uint32_t pos = 0; + for (uint32_t i = 0; i < signature_section->pubKeysLen; i++) { + uint8_t tag = signature_section->pubKeys.ptr[pos++]; + if (tag != key_ed25519 && tag != key_secp256k1) { + return zxerr_unknown; + } + // Skip the public key's type tag + const uint8_t pubKeySize = tag == key_ed25519 ? PK_LEN_25519 : COMPRESSED_SECP256K1_PK_LEN; + // Skip the signature proper + pos += pubKeySize; + } + if(pos > 0) { + cx_sha256_update(&sha256, signature_section->pubKeys.ptr, pos); } break; - + } case Address: cx_sha256_update(&sha256, signature_section->address.ptr, signature_section->address.len); break; @@ -213,8 +224,21 @@ zxerr_t crypto_hashSigSection(const signature_section_t *signature_section, cons } cx_sha256_update(&sha256, (const uint8_t*) &signature_section->signaturesLen, 4); - if(signature_section->signaturesLen > 0) { - cx_sha256_update(&sha256, signature_section->indexedSignatures.ptr, signature_section->indexedSignatures.len); + uint32_t pos = 0; + for (uint32_t i = 0; i < signature_section->signaturesLen; i++) { + // Skip the signature's 1 byte index + pos++; + uint8_t tag = signature_section->indexedSignatures.ptr[pos++]; + if (tag != key_ed25519 && tag != key_secp256k1) { + return zxerr_unknown; + } + // Skip the signature's type tag + const uint8_t signatureSize = tag == key_ed25519 ? ED25519_SIGNATURE_SIZE : SIG_SECP256K1_LEN; + // Skip the signature proper + pos += signatureSize; + } + if(pos > 0) { + cx_sha256_update(&sha256, signature_section->indexedSignatures.ptr, pos); } cx_sha256_final(&sha256, output); return zxerr_ok; diff --git a/app/src/parser_impl_txn.c b/app/src/parser_impl_txn.c index a154ffc3..b70d4230 100644 --- a/app/src/parser_impl_txn.c +++ b/app/src/parser_impl_txn.c @@ -978,7 +978,7 @@ static parser_error_t readSignatureSection(parser_context_t *ctx, signature_sect CHECK_ERROR(readBytes(ctx, &signature->indexedSignatures.ptr, signature->indexedSignatures.len)) for (uint32_t i = 0; i < signature->signaturesLen; i++) { - // Skip the signatures 1 byte index + // Skip the signature's 1 byte index ctx->offset ++; signature->indexedSignatures.len ++; // Read the signature's tag diff --git a/deps/ledger-secure-sdk b/deps/ledger-secure-sdk index e050ce5a..80309475 160000 --- a/deps/ledger-secure-sdk +++ b/deps/ledger-secure-sdk @@ -1 +1 @@ -Subproject commit e050ce5af3e9ac490fce6c9aebc95ee2d20aceb1 +Subproject commit 803094754f77f23c556b065317bceda3b6d2c002 diff --git a/deps/ledger-zxlib b/deps/ledger-zxlib index 52dfdeae..7f80d18a 160000 --- a/deps/ledger-zxlib +++ b/deps/ledger-zxlib @@ -1 +1 @@ -Subproject commit 52dfdeae81bb0b50cf3332f4690ed5c978f15f27 +Subproject commit 7f80d18afcf509f5028d226e36bc206624601229 diff --git a/js/package.json b/js/package.json index ed6d1dd7..67a6773f 100644 --- a/js/package.json +++ b/js/package.json @@ -32,12 +32,12 @@ "url": "https://github.com/zondax/ledger-namada/issues" }, "dependencies": { - "@ledgerhq/hw-transport": "^6.29.0" + "@ledgerhq/hw-transport": "^6.30.0" }, "devDependencies": { "@types/ledgerhq__hw-transport": "^4.21.8", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", + "@typescript-eslint/eslint-plugin": "^6.13.1", + "@typescript-eslint/parser": "^6.13.1", "bip32": "^4.0.0", "bip39": "^3.1.0", "core-js": "^3.33.3", diff --git a/tests_zemu/package.json b/tests_zemu/package.json index f7308d5c..fe851026 100644 --- a/tests_zemu/package.json +++ b/tests_zemu/package.json @@ -24,10 +24,10 @@ "devDependencies": { "@types/jest": "^29.5.6", "@types/ledgerhq__hw-transport": "^4.21.6", - "@typescript-eslint/eslint-plugin": "^6.9.0", - "@typescript-eslint/parser": "^6.9.0", + "@typescript-eslint/eslint-plugin": "^6.13.1", + "@typescript-eslint/parser": "^6.13.1", "blakejs": "^1.1.1", - "crypto-js": "4.1.1", + "crypto-js": "4.2.0", "ed25519-supercop": "^2.0.1", "eslint": "^8.52.0", "eslint-config-prettier": "^9.0.0", diff --git a/tests_zemu/snapshots/s-mainmenu/00004.png b/tests_zemu/snapshots/s-mainmenu/00004.png index 7d959858..743f8dd4 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00004.png and b/tests_zemu/snapshots/s-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/s-mainmenu/00010.png b/tests_zemu/snapshots/s-mainmenu/00010.png index 7d959858..743f8dd4 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00010.png and b/tests_zemu/snapshots/s-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00004.png b/tests_zemu/snapshots/sp-mainmenu/00004.png index 94575c43..83c56bd0 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00004.png and b/tests_zemu/snapshots/sp-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00010.png b/tests_zemu/snapshots/sp-mainmenu/00010.png index 94575c43..83c56bd0 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00010.png and b/tests_zemu/snapshots/sp-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00001.png b/tests_zemu/snapshots/st-mainmenu/00001.png index ca420465..92f14394 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00001.png and b/tests_zemu/snapshots/st-mainmenu/00001.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00004.png b/tests_zemu/snapshots/x-mainmenu/00004.png index 94575c43..83c56bd0 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00004.png and b/tests_zemu/snapshots/x-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00010.png b/tests_zemu/snapshots/x-mainmenu/00010.png index 94575c43..83c56bd0 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00010.png and b/tests_zemu/snapshots/x-mainmenu/00010.png differ