Skip to content

Commit d6b2648

Browse files
Moved the 7702 struct version check to the verify struct function
1 parent 6fa9e4a commit d6b2648

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src_features/signAuthorizationEIP7702/auth_7702.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ static bool handle_version(const s_tlv_data *data, s_auth_7702_ctx *context) {
2727
return false;
2828
}
2929
context->mask_parsed |= SET_BIT(BIT_VERSION);
30-
return (data->value[0] == STRUCT_VERSION);
30+
context->version = data->value[0];
31+
return true;
3132
}
3233

3334
static bool handle_delegate_addr(const s_tlv_data *data, s_auth_7702_ctx *context) {
@@ -89,8 +90,8 @@ bool handle_auth_7702_struct(const s_tlv_data *data, s_auth_7702_ctx *context) {
8990
return ret;
9091
}
9192

92-
bool verify_auth_7702_struct(s_auth_7702_ctx *context) {
93-
return ((context->mask_parsed & MASK_ALL) == MASK_ALL);
93+
bool verify_auth_7702_struct(const s_auth_7702_ctx *context) {
94+
return ((context->mask_parsed & MASK_ALL) == MASK_ALL) && (context->version == STRUCT_VERSION);
9495
}
9596

9697
#endif // HAVE_EIP7702

src_features/signAuthorizationEIP7702/auth_7702.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ typedef struct {
1212

1313
typedef struct {
1414
s_auth_7702 auth_7702;
15+
uint8_t version;
1516
uint8_t mask_parsed;
1617
} s_auth_7702_ctx;
1718

1819
bool handle_auth_7702_struct(const s_tlv_data *data, s_auth_7702_ctx *context);
19-
bool verify_auth_7702_struct(s_auth_7702_ctx *context);
20+
bool verify_auth_7702_struct(const s_auth_7702_ctx *context);

0 commit comments

Comments
 (0)