Skip to content

Commit

Permalink
Merge pull request #689 from LedgerHQ/misc/apa/unlink_eip712_nbgl_imp…
Browse files Browse the repository at this point in the history
…lementations

Unlink NBGL implementations of EIP-712 v0 and full
  • Loading branch information
apaillier-ledger authored Dec 5, 2024
2 parents dbcc279 + db8b202 commit a85de1e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src_nbgl/ui_message_signing.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
#include "ui_nbgl.h"
#include "ui_logic.h"
#include "common_712.h"

void ui_typed_message_review_choice(bool confirm) {
static void ui_typed_message_review_choice_common(bool confirm,
unsigned int (*approve_func)(),
unsigned int (*reject_func)()) {
if (confirm) {
ui_712_approve();
approve_func();
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_SIGNED, ui_idle);
} else {
ui_712_reject();
reject_func();
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_REJECTED, ui_idle);
}
}

void ui_typed_message_review_choice_v0(bool confirm) {
ui_typed_message_review_choice_common(confirm, ui_712_approve_cb, ui_712_reject_cb);
}

#ifdef HAVE_EIP712_FULL_SUPPORT
void ui_typed_message_review_choice(bool confirm) {
ui_typed_message_review_choice_common(confirm, ui_712_approve, ui_712_reject);
}
#endif
3 changes: 3 additions & 0 deletions src_nbgl/ui_message_signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#define TEXT_SIGN_EIP712 SIGN(TEXT_TYPED_MESSAGE)
#define TEXT_BLIND_SIGN_EIP712 BLIND_SIGN(TEXT_TYPED_MESSAGE)

void ui_typed_message_review_choice_v0(bool confirm);
#ifdef HAVE_EIP712_FULL_SUPPORT
void ui_typed_message_review_choice(bool confirm);
#endif

#endif // UI_MESSAGE_SIGNING_H_
2 changes: 1 addition & 1 deletion src_nbgl/ui_sign_712_v0.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ void ui_sign_712_v0(void) {
NULL,
TEXT_BLIND_SIGN_EIP712,
NULL,
ui_typed_message_review_choice);
ui_typed_message_review_choice_v0);
}

0 comments on commit a85de1e

Please sign in to comment.