From 5912a425e27141c0d6e1a6bcff4c3dee9c2861e4 Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:14:54 +0100 Subject: [PATCH] Lint, and remove unused import --- src/common/merkle.c | 28 +++++++--------------------- src/crypto.c | 18 ++++-------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/src/common/merkle.c b/src/common/merkle.c index e952fe1e0..ea9d7d4e2 100644 --- a/src/common/merkle.c +++ b/src/common/merkle.c @@ -24,22 +24,16 @@ #include "merkle.h" -#include "cx_ram.h" #include "debug-helpers/debug.h" #include "ledger_assert.h" -void merkle_compute_element_hash(const uint8_t *in, size_t in_len, uint8_t out[static CX_SHA256_SIZE]) { +void merkle_compute_element_hash(const uint8_t *in, + size_t in_len, + uint8_t out[static CX_SHA256_SIZE]) { // H(0x00 | in) uint8_t data = 0x00; - cx_iovec_t iovec[2] = { - { - .iov_base = &data, .iov_len = 1 - }, - { - .iov_base = in, .iov_len = in_len - } - }; + cx_iovec_t iovec[2] = {{.iov_base = &data, .iov_len = 1}, {.iov_base = in, .iov_len = in_len}}; cx_sha256_hash_iovec(iovec, 2, out); } @@ -49,17 +43,9 @@ void merkle_combine_hashes(const uint8_t left[static CX_SHA256_SIZE], PRINT_STACK_POINTER(); uint8_t prefix = 0x01; - cx_iovec_t iovec[3] = { - { - .iov_base = &prefix, .iov_len = 1 - }, - { - .iov_base = left, .iov_len = CX_SHA256_SIZE - }, - { - .iov_base = right, .iov_len = CX_SHA256_SIZE - } - }; + cx_iovec_t iovec[3] = {{.iov_base = &prefix, .iov_len = 1}, + {.iov_base = left, .iov_len = CX_SHA256_SIZE}, + {.iov_base = right, .iov_len = CX_SHA256_SIZE}}; cx_sha256_hash_iovec(iovec, 3, out); } diff --git a/src/crypto.c b/src/crypto.c index 474eccb82..b5917b150 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -466,20 +466,10 @@ static void crypto_tr_tagged_hash(const uint8_t *tag, // First compute hashtag, reuse out buffer for that cx_sha256_hash(tag, tag_len, out); - cx_iovec_t iovec[4] = { - { - .iov_base = out, .iov_len = CX_SHA256_SIZE - }, - { - .iov_base = out, .iov_len = CX_SHA256_SIZE - }, - { - .iov_base = data, .iov_len = data_len - }, - { - .iov_base = data2, .iov_len = data2_len - } - }; + cx_iovec_t iovec[4] = {{.iov_base = out, .iov_len = CX_SHA256_SIZE}, + {.iov_base = out, .iov_len = CX_SHA256_SIZE}, + {.iov_base = data, .iov_len = data_len}, + {.iov_base = data2, .iov_len = data2_len}}; if (data2_len > 0) { cx_sha256_hash_iovec(iovec, 4, out); } else {