Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC2A-1408: Remove duplicate apdu_parser #1

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ APPNAME = "Kaspa"
# Application version
APPVERSION_M = 1
APPVERSION_N = 0
APPVERSION_P = 0
APPVERSION_P = 1
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

ifeq ($(TARGET_NAME),TARGET_NANOS)
Expand Down
1 change: 1 addition & 0 deletions src/apdu/dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#pragma once

#include "../types.h"
#include "parser.h"

/**
* Parameter 2 for last APDU to receive.
Expand Down
46 changes: 0 additions & 46 deletions src/apdu/parser.c

This file was deleted.

45 changes: 0 additions & 45 deletions src/apdu/parser.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "io.h"
#include "sw.h"
#include "ui/menu.h"
#include "apdu/parser.h"
#include "parser.h"
#include "apdu/dispatcher.h"

global_ctx_t G_context;
Expand Down
12 changes: 0 additions & 12 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ typedef enum {
SIGN_MESSAGE = 0x07 /// sign a personal message with BIP32 path
} command_e;

/**
* Structure with fields of APDU command.
*/
typedef struct {
uint8_t cla; /// Instruction class
command_e ins; /// Instruction code
uint8_t p1; /// Instruction parameter 1
uint8_t p2; /// Instruction parameter 2
uint8_t lc; /// Length of command data
uint8_t *data; /// Command data
} command_t;

/**
* Enumeration with parsing state.
*/
Expand Down
Binary file modified tests/snapshots/nanos/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/test_app_mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_name_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def test_get_app_and_version(backend, backend_name):
app_name, version = unpack_get_app_and_version_response(response.data)

assert app_name == "Kaspa"
assert version == "1.0.0"
assert version == "1.0.1"
2 changes: 1 addition & 1 deletion tests/test_version_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Taken from the Makefile, to update every time the Makefile version is bumped
MAJOR = 1
MINOR = 0
PATCH = 0
PATCH = 1

# In this test we check the behavior of the device when asked to provide the app version
def test_version(backend):
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ add_library(sighash SHARED ../src/sighash.c)
add_library(personal_message SHARED ../src/personal_message.c)
add_library(write SHARED /opt/ledger-secure-sdk/lib_standard_app/write.c)
add_library(format_local SHARED ../src/common/format_local.c)
add_library(apdu_parser SHARED ../src/apdu/parser.c)
add_library(apdu_parser SHARED /opt/ledger-secure-sdk/lib_standard_app/parser.c)
add_library(transaction_deserialize ../src/transaction/deserialize.c)
add_library(transaction_serialize ../src/transaction/serialize.c)
add_library(transaction_utils ../src/transaction/utils.c)
Expand Down
7 changes: 4 additions & 3 deletions unit-tests/test_apdu_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cmocka.h>

#include "types.h"
#include "apdu/parser.h"
#include "parser.h"

static void test_apdu_parser(void **state) {
(void) state;
Expand All @@ -42,10 +42,11 @@ static void test_apdu_parser(void **state) {
command_t cmd;

memset(&cmd, 0, sizeof(cmd));
assert_false(apdu_parser(&cmd, apdu_bad_min_len, sizeof(apdu_bad_min_len)));
assert_true(apdu_parser(&cmd, apdu_bad_min_len, sizeof(apdu_bad_min_len)));
assert_int_equal(cmd.lc, 0);

memset(&cmd, 0, sizeof(cmd));
assert_false(apdu_parser(&cmd, apdu_bad_lc, sizeof(apdu_bad_min_len)));
assert_false(apdu_parser(&cmd, apdu_bad_lc, sizeof(apdu_bad_lc)));

memset(&cmd, 0, sizeof(cmd));
assert_true(apdu_parser(&cmd, apdu, sizeof(apdu)));
Expand Down
Loading