Skip to content

Commit 98d418b

Browse files
Removed const-qualifier on pointers arguments in function
1 parent 69a9427 commit 98d418b

9 files changed

Lines changed: 32 additions & 32 deletions

File tree

src_features/signMessageEIP712/encode_field.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef enum { MSB, LSB } e_padding_type;
1313
* @param[in] pval value used for padding
1414
* @return encoded field value
1515
*/
16-
static void *field_encode(const uint8_t *const value,
16+
static void *field_encode(const uint8_t *value,
1717
uint8_t length,
1818
e_padding_type ptype,
1919
uint8_t pval) {
@@ -53,7 +53,7 @@ static void *field_encode(const uint8_t *const value,
5353
* @param[in] length its byte-length
5454
* @return the encoded value
5555
*/
56-
void *encode_uint(const uint8_t *const value, uint8_t length) {
56+
void *encode_uint(const uint8_t *value, uint8_t length) {
5757
// no length check here since it will be checked by field_encode
5858
return field_encode(value, length, MSB, 0x00);
5959
}
@@ -66,7 +66,7 @@ void *encode_uint(const uint8_t *const value, uint8_t length) {
6666
* @param[in] typesize the type size in bytes
6767
* @return the encoded value
6868
*/
69-
void *encode_int(const uint8_t *const value, uint8_t length, uint8_t typesize) {
69+
void *encode_int(const uint8_t *value, uint8_t length, uint8_t typesize) {
7070
uint8_t padding_value;
7171

7272
if (length < 1) {
@@ -91,7 +91,7 @@ void *encode_int(const uint8_t *const value, uint8_t length, uint8_t typesize) {
9191
* @param[in] length its byte-length
9292
* @return the encoded value
9393
*/
94-
void *encode_bytes(const uint8_t *const value, uint8_t length) {
94+
void *encode_bytes(const uint8_t *value, uint8_t length) {
9595
// no length check here since it will be checked by field_encode
9696
return field_encode(value, length, LSB, 0x00);
9797
}
@@ -103,7 +103,7 @@ void *encode_bytes(const uint8_t *const value, uint8_t length) {
103103
* @param[in] length its byte-length
104104
* @return the encoded value
105105
*/
106-
void *encode_boolean(const bool *const value, uint8_t length) {
106+
void *encode_boolean(const bool *value, uint8_t length) {
107107
if (length != 1) // sanity check
108108
{
109109
apdu_response_code = APDU_RESPONSE_INVALID_DATA;
@@ -119,7 +119,7 @@ void *encode_boolean(const bool *const value, uint8_t length) {
119119
* @param[in] length its byte-length
120120
* @return the encoded value
121121
*/
122-
void *encode_address(const uint8_t *const value, uint8_t length) {
122+
void *encode_address(const uint8_t *value, uint8_t length) {
123123
if (length != ADDRESS_LENGTH) // sanity check
124124
{
125125
apdu_response_code = APDU_RESPONSE_INVALID_DATA;

src_features/signMessageEIP712/encode_field.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#define EIP_712_ENCODED_FIELD_LENGTH 32
77

8-
void *encode_uint(const uint8_t *const value, uint8_t length);
9-
void *encode_int(const uint8_t *const value, uint8_t length, uint8_t typesize);
10-
void *encode_boolean(const bool *const value, uint8_t length);
11-
void *encode_address(const uint8_t *const value, uint8_t length);
12-
void *encode_bytes(const uint8_t *const value, uint8_t length);
8+
void *encode_uint(const uint8_t *value, uint8_t length);
9+
void *encode_int(const uint8_t *value, uint8_t length, uint8_t typesize);
10+
void *encode_boolean(const bool *value, uint8_t length);
11+
void *encode_address(const uint8_t *value, uint8_t length);
12+
void *encode_bytes(const uint8_t *value, uint8_t length);

src_features/signMessageEIP712/field_hash.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static const uint8_t *field_hash_prepare(const s_struct_712_field *field_ptr,
7777
* @return pointer to the encoded value
7878
*/
7979
static const uint8_t *field_hash_finalize_static(const s_struct_712_field *field_ptr,
80-
const uint8_t *const data,
80+
const uint8_t *data,
8181
uint8_t data_length) {
8282
uint8_t *value = NULL;
8383

@@ -167,7 +167,7 @@ static void field_hash_feed_parent(e_type field_type, const uint8_t *hash) {
167167
* @return whether an error occurred or not
168168
*/
169169
static bool field_hash_domain_special_fields(const s_struct_712_field *field_ptr,
170-
const uint8_t *const data,
170+
const uint8_t *data,
171171
uint8_t data_length) {
172172
const char *key;
173173
const char *ethermint_vc = "cosmos";
@@ -215,7 +215,7 @@ static bool field_hash_domain_special_fields(const s_struct_712_field *field_ptr
215215
* @return whether an error occurred or not
216216
*/
217217
static bool field_hash_finalize(const s_struct_712_field *field_ptr,
218-
const uint8_t *const data,
218+
const uint8_t *data,
219219
uint8_t data_length) {
220220
const uint8_t *value = NULL;
221221

src_features/signMessageEIP712/path.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static const void *get_nth_field(uint8_t *fields_count_ptr, uint8_t n) {
7979
* @param[out] the number of fields in the depth of the returned field
8080
* @return the field which the path points to
8181
*/
82-
static inline const void *get_field(uint8_t *const fields_count) {
82+
static inline const void *get_field(uint8_t *fields_count) {
8383
return get_nth_field(fields_count, path_struct->depth_count);
8484
}
8585

@@ -187,7 +187,7 @@ static bool finalize_hash_depth(uint8_t *hash) {
187187
*
188188
* @param[in] hash pointer to given hash
189189
*/
190-
static bool feed_last_hash_depth(const uint8_t *const hash) {
190+
static bool feed_last_hash_depth(const uint8_t *hash) {
191191
const cx_sha3_t *hash_ctx;
192192

193193
hash_ctx = get_last_hash_ctx();
@@ -386,7 +386,7 @@ static bool path_update(bool skip_if_array, bool stop_at_array, bool do_typehash
386386
* @param[in] name_length the root struct name length
387387
* @return boolean indicating if it was successful or not
388388
*/
389-
bool path_set_root(const char *const struct_name, uint8_t name_length) {
389+
bool path_set_root(const char *struct_name, uint8_t name_length) {
390390
uint8_t hash[KECCAK256_HASH_BYTESIZE];
391391

392392
if (path_struct == NULL) {

src_features/signMessageEIP712/path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct {
2424
e_root_type root_type;
2525
} s_path;
2626

27-
bool path_set_root(const char *const struct_name, uint8_t length);
27+
bool path_set_root(const char *struct_name, uint8_t length);
2828
const void *path_get_field(void);
2929
bool path_advance(bool do_typehash);
3030
bool path_init(void);

src_features/signMessageEIP712/type_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static bool compare_struct_deps(const s_struct_dep *a, const s_struct_dep *b) {
147147
* @param[out] hash_buf buffer containing the resulting type_hash
148148
* @return whether the type_hash was successful or not
149149
*/
150-
bool type_hash(const char *const struct_name, const uint8_t struct_name_length, uint8_t *hash_buf) {
150+
bool type_hash(const char *struct_name, const uint8_t struct_name_length, uint8_t *hash_buf) {
151151
const void *struct_ptr;
152152
s_struct_dep *deps;
153153
cx_err_t error = CX_INTERNAL_ERROR;

src_features/signMessageEIP712/type_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#include <stdint.h>
44
#include <stdbool.h>
55

6-
bool type_hash(const char *const struct_name, const uint8_t struct_name_length, uint8_t *hash_buf);
6+
bool type_hash(const char *struct_name, const uint8_t struct_name_length, uint8_t *hash_buf);

src_features/signMessageEIP712/typed_data.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const s_struct_712 *get_structn(const char *name, uint8_t length) {
7878
* @param[in] name name
7979
* @return whether it was successful
8080
*/
81-
bool set_struct_name(uint8_t length, const uint8_t *const name) {
81+
bool set_struct_name(uint8_t length, const uint8_t *name) {
8282
s_struct_712 *new_struct;
8383

8484
if (name == NULL) {
@@ -112,7 +112,7 @@ bool set_struct_name(uint8_t length, const uint8_t *const name) {
112112
* @return whether it was successful or not
113113
*/
114114
static bool set_struct_field_typedesc(s_struct_712_field *field,
115-
const uint8_t *const data,
115+
const uint8_t *data,
116116
uint8_t *data_idx,
117117
uint8_t length) {
118118
uint8_t typedesc;
@@ -138,7 +138,7 @@ static bool set_struct_field_typedesc(s_struct_712_field *field,
138138
* @return whether it was successful
139139
*/
140140
static bool set_struct_field_custom_typename(s_struct_712_field *field,
141-
const uint8_t *const data,
141+
const uint8_t *data,
142142
uint8_t *data_idx,
143143
uint8_t length) {
144144
uint8_t typename_len;
@@ -176,7 +176,7 @@ static bool set_struct_field_custom_typename(s_struct_712_field *field,
176176
* @return whether it was successful
177177
*/
178178
static bool set_struct_field_array(s_struct_712_field *field,
179-
const uint8_t *const data,
179+
const uint8_t *data,
180180
uint8_t *data_idx,
181181
uint8_t length) {
182182
if ((*data_idx + sizeof(field->array_level_count)) > length) // check buffer bound
@@ -225,7 +225,7 @@ static bool set_struct_field_array(s_struct_712_field *field,
225225
* @return whether it was successful
226226
*/
227227
static bool set_struct_field_typesize(s_struct_712_field *field,
228-
const uint8_t *const data,
228+
const uint8_t *data,
229229
uint8_t *data_idx,
230230
uint8_t length) {
231231
// copy TypeSize
@@ -246,7 +246,7 @@ static bool set_struct_field_typesize(s_struct_712_field *field,
246246
* @return whether it was successful
247247
*/
248248
static bool set_struct_field_keyname(s_struct_712_field *field,
249-
const uint8_t *const data,
249+
const uint8_t *data,
250250
uint8_t *data_idx,
251251
uint8_t length) {
252252
uint8_t keyname_len;
@@ -283,7 +283,7 @@ static bool set_struct_field_keyname(s_struct_712_field *field,
283283
* @param[in] data the field data
284284
* @return whether it was successful
285285
*/
286-
bool set_struct_field(uint8_t length, const uint8_t *const data) {
286+
bool set_struct_field(uint8_t length, const uint8_t *data) {
287287
uint8_t data_idx = 0;
288288

289289
if ((data == NULL) || (length == 0)) {

src_features/signMessageEIP712/typed_data.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ typedef struct struct_712 {
5757
s_struct_712_field *fields;
5858
} s_struct_712;
5959

60-
const void *get_array_in_mem(const void *ptr, uint8_t *const array_size);
61-
const char *get_string_in_mem(const uint8_t *ptr, uint8_t *const string_length);
60+
const void *get_array_in_mem(const void *ptr, uint8_t *array_size);
61+
const char *get_string_in_mem(const uint8_t *ptr, uint8_t *string_length);
6262
const char *get_struct_field_custom_typename(const s_struct_712_field *field_ptr);
6363
const char *get_struct_field_typename(const s_struct_712_field *ptr);
64-
e_array_type struct_field_array_depth(const uint8_t *ptr, uint8_t *const array_size);
64+
e_array_type struct_field_array_depth(const uint8_t *ptr, uint8_t *array_size);
6565
const s_struct_712 *get_struct_list(void);
6666
const s_struct_712 *get_structn(const char *name_ptr, uint8_t name_length);
67-
bool set_struct_name(uint8_t length, const uint8_t *const name);
68-
bool set_struct_field(uint8_t length, const uint8_t *const data);
67+
bool set_struct_name(uint8_t length, const uint8_t *name);
68+
bool set_struct_field(uint8_t length, const uint8_t *data);
6969
bool typed_data_init(void);
7070
void typed_data_deinit(void);

0 commit comments

Comments
 (0)