|
Embedded SDK
Embedded SDK
|
Transaction Check: risk report from a security provider, displayed during the review. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "os_types.h"#include "buffer.h"#include "lcx_ecdsa.h"#include "lcx_sha3.h"#include "nbgl_use_case.h"#include "tlv_use_case_transaction_check.h"

Go to the source code of this file.
Classes | |
| struct | tx_check_context_t |
Macros | |
| #define | TRANSACTION_CHECK_MAX_PAYLOAD_SIZE |
Enumerations | |
| enum | tx_check_setting_t { TX_CHECK_SETTING_OPT_IN , TX_CHECK_SETTING_ENABLE } |
| enum | tx_check_status_t { TX_CHECK_SUCCESS , TX_CHECK_PENDING , TX_CHECK_DISABLED , TX_CHECK_NOT_ALLOWED , TX_CHECK_INVALID_SIGNATURE , TX_CHECK_INVALID_DESCRIPTOR } |
Functions | |
| bolos_err_t | tx_check_handle_apdu (const uint8_t *buffer, size_t buffer_len, uint8_t p1, uint8_t p2, uint8_t *buffer_out, size_t *buffer_out_length) |
| Handle the SDK default APDU (CLA 0xB0, INS DEFAULT_APDU_INS_TRANSACTION_CHECK). | |
| tx_check_status_t | tx_check_provide_descriptor (const buffer_t *payload) |
| Parse, verify and store a Transaction Check descriptor. | |
| tx_check_status_t | tx_check_opt_in (bool response_expected) |
| Display the opt-in screen if the user has not seen it yet. | |
| uint16_t | tx_check_status_to_sw (tx_check_status_t status) |
| Standard status word of a Transaction Check status. | |
| void | tx_check_apply_report (nbgl_warning_t *warning, const tx_check_context_t *ctx) |
| Bind the stored report to the operation being signed and fill the review warning. | |
| void | tx_check_clear (void) |
| Erase the stored report. | |
Transaction Check: risk report from a security provider, displayed during the review.
The descriptor is received either through the SDK default APDU (CLA 0xB0) or through an app-specific APDU calling tx_check_provide_descriptor() and tx_check_opt_in(). The coin app binds the report to the transaction being signed with tx_check_apply_report().
Definition in file transaction_check.h.
| #define TRANSACTION_CHECK_MAX_PAYLOAD_SIZE |
Largest descriptor, every tag at its max size. Each TLV is tag + length + value; tags from 0x80 are DER-encoded on 2 bytes, lengths on 1 byte.
Definition at line 77 of file transaction_check.h.
| enum tx_check_setting_t |
| Enumerator | |
|---|---|
| TX_CHECK_SETTING_OPT_IN | The user has seen the opt-in screen. |
| TX_CHECK_SETTING_ENABLE | Transaction Check is enabled. |
Definition at line 42 of file transaction_check.h.
| enum tx_check_status_t |
Result of a descriptor or opt-in request, mapped to status words by tx_check_status_to_sw().
Definition at line 48 of file transaction_check.h.
| void tx_check_apply_report | ( | nbgl_warning_t * | warning, |
| const tx_check_context_t * | ctx ) |
Bind the stored report to the operation being signed and fill the review warning.
Clears the W3C warnings and the report fields of warning, then, when Transaction Check is enabled, sets W3C_ISSUE_WARN when no report matches the operation, otherwise the W3C warning of the report risk level. When the report or ctx holds a domain hash, both must hold the same one.
| [in,out] | warning | Review warning, other bits are kept |
| [in] | ctx | Operation being signed |
| [in,out] | warning | Review warning |
| [in] | ctx | Operation being signed |
Definition at line 239 of file transaction_check.c.
| void tx_check_clear | ( | void | ) |
Erase the stored report.
Definition at line 156 of file transaction_check.c.
| bolos_err_t tx_check_handle_apdu | ( | const uint8_t * | buffer, |
| size_t | buffer_len, | ||
| uint8_t | p1, | ||
| uint8_t | p2, | ||
| uint8_t * | buffer_out, | ||
| size_t * | buffer_out_length ) |
Handle the SDK default APDU (CLA 0xB0, INS DEFAULT_APDU_INS_TRANSACTION_CHECK).
P1 0x00: descriptor, chunked as described in apdu_chunks.h. P1 0x01: opt-in request; replies with 1 byte (enable state), after the user choice when the opt-in screen is displayed.
| [in] | buffer | APDU data |
| [in] | buffer_len | APDU data length |
| [in] | p1 | APDU P1 |
| [in] | p2 | APDU P2 |
| [out] | buffer_out | Response data |
| [in,out] | buffer_out_length | Response capacity in, response length out |
Handle the SDK default APDU (CLA 0xB0, INS DEFAULT_APDU_INS_TRANSACTION_CHECK).
| [in] | buffer | APDU data |
| [in] | buffer_len | APDU data length |
| [in] | p1 | APDU P1 |
| [in] | p2 | APDU P2 |
| [out] | buffer_out | Response data |
| [in,out] | buffer_out_length | Response capacity in, response length out |
Definition at line 315 of file transaction_check.c.
| tx_check_status_t tx_check_opt_in | ( | bool | response_expected | ) |
Display the opt-in screen if the user has not seen it yet.
Used for an opt-in request received on an app APDU (response_expected set) or from the settings. No APDU reply is sent by the SDK: on TX_CHECK_SUCCESS the app replies at once, on TX_CHECK_PENDING it replies from handle_tx_check_opt_in_response().
| [in] | response_expected | Whether an APDU reply is pending |
Display the opt-in screen if the user has not seen it yet.
| [in] | response_expected | Whether an APDU reply is pending |
Definition at line 162 of file transaction_check_ui.c.
| tx_check_status_t tx_check_provide_descriptor | ( | const buffer_t * | payload | ) |
Parse, verify and store a Transaction Check descriptor.
The descriptor replaces the stored report, unless that report is bound to the review in progress (between tx_check_apply_report() and tx_check_clear()). Refused during a swap.
| [in] | payload | Complete TLV descriptor |
Parse, verify and store a Transaction Check descriptor.
| [in] | payload | Complete TLV descriptor |
Definition at line 167 of file transaction_check.c.
| uint16_t tx_check_status_to_sw | ( | tx_check_status_t | status | ) |
Standard status word of a Transaction Check status.
| [in] | status | Status returned by tx_check_provide_descriptor() or tx_check_opt_in() |
Definition at line 283 of file transaction_check.c.