Fix deprecated warnings
This commit is contained in:
@@ -52,6 +52,7 @@ static const uint8_t *field_hash_prepare(const void *const field_ptr,
|
||||
const uint8_t *data,
|
||||
uint8_t *data_length) {
|
||||
e_type field_type;
|
||||
cx_err_t error = CX_INTERNAL_ERROR;
|
||||
|
||||
field_type = struct_field_type(field_ptr);
|
||||
fh->remaining_size = __builtin_bswap16(*(uint16_t *) &data[0]); // network byte order
|
||||
@@ -59,10 +60,12 @@ static const uint8_t *field_hash_prepare(const void *const field_ptr,
|
||||
*data_length -= sizeof(uint16_t);
|
||||
fh->state = FHS_WAITING_FOR_MORE;
|
||||
if (IS_DYN(field_type)) {
|
||||
cx_keccak_init(&global_sha3, 256); // init hash
|
||||
CX_CHECK(cx_keccak_init_no_throw(&global_sha3, 256));
|
||||
ui_712_new_field(field_ptr, data, *data_length);
|
||||
}
|
||||
return data;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,14 +123,22 @@ static const uint8_t *field_hash_finalize_static(const void *const field_ptr,
|
||||
*/
|
||||
static uint8_t *field_hash_finalize_dynamic(void) {
|
||||
uint8_t *value;
|
||||
cx_err_t error = CX_INTERNAL_ERROR;
|
||||
|
||||
if ((value = mem_alloc(KECCAK256_HASH_BYTESIZE)) == NULL) {
|
||||
apdu_response_code = APDU_RESPONSE_INSUFFICIENT_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
// copy hash into memory
|
||||
cx_hash((cx_hash_t *) &global_sha3, CX_LAST, NULL, 0, value, KECCAK256_HASH_BYTESIZE);
|
||||
CX_CHECK(cx_hash_no_throw((cx_hash_t *) &global_sha3,
|
||||
CX_LAST,
|
||||
NULL,
|
||||
0,
|
||||
value,
|
||||
KECCAK256_HASH_BYTESIZE));
|
||||
return value;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user