1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-28 19:02:34 +00:00

Groestl hash: fix -Wshadow warnings

This commit is contained in:
Yura Pakhuchiy 2018-04-05 03:13:16 +07:00 committed by Pavol Rusnak
parent 9e08e8ce63
commit f15605bd45
2 changed files with 14 additions and 12 deletions

View File

@ -11,6 +11,7 @@ CFLAGS += $(OPTFLAGS) \
-Wredundant-decls \ -Wredundant-decls \
-Wstrict-prototypes \ -Wstrict-prototypes \
-Wundef \ -Wundef \
-Wshadow \
-Wpointer-arith \ -Wpointer-arith \
-Wformat \ -Wformat \
-Wreturn-type \ -Wreturn-type \
@ -20,6 +21,7 @@ CFLAGS += $(OPTFLAGS) \
-Winit-self \ -Winit-self \
-Wuninitialized \ -Wuninitialized \
-Wformat-security \ -Wformat-security \
-Werror
CFLAGS += -I. CFLAGS += -I.
CFLAGS += -DUSE_ETHEREUM=1 CFLAGS += -DUSE_ETHEREUM=1

View File

@ -917,24 +917,24 @@ static const sph_u32 T3dn[] = {
#define COMPRESS_BIG do { \ #define COMPRESS_BIG do { \
sph_u32 g[32], m[32]; \ sph_u32 g[32], m[32]; \
size_t u; \ size_t uu; \
for (u = 0; u < 32; u ++) { \ for (uu = 0; uu < 32; uu ++) { \
m[u] = dec32e_aligned(buf + (u << 2)); \ m[uu] = dec32e_aligned(buf + (uu << 2)); \
g[u] = m[u] ^ H[u]; \ g[uu] = m[uu] ^ H[uu]; \
} \ } \
PERM_BIG_P(g); \ PERM_BIG_P(g); \
PERM_BIG_Q(m); \ PERM_BIG_Q(m); \
for (u = 0; u < 32; u ++) \ for (uu = 0; uu < 32; uu ++) \
H[u] ^= g[u] ^ m[u]; \ H[uu] ^= g[uu] ^ m[uu]; \
} while (0) } while (0)
#define FINAL_BIG do { \ #define FINAL_BIG do { \
sph_u32 x[32]; \ sph_u32 x[32]; \
size_t u; \ size_t uu; \
memcpy(x, H, sizeof x); \ memcpy(x, H, sizeof x); \
PERM_BIG_P(x); \ PERM_BIG_P(x); \
for (u = 0; u < 32; u ++) \ for (uu = 0; uu < 32; uu ++) \
H[u] ^= x[u]; \ H[uu] ^= x[uu]; \
} while (0) } while (0)
@ -993,7 +993,7 @@ groestl_big_close(sph_groestl_big_context *sc,
unsigned ub, unsigned n, void *dst, size_t out_len) unsigned ub, unsigned n, void *dst, size_t out_len)
{ {
unsigned char pad[136]; unsigned char pad[136];
size_t ptr, pad_len, u; size_t ptr, pad_len, u2;
sph_u64 count; sph_u64 count;
unsigned z; unsigned z;
DECL_STATE_BIG DECL_STATE_BIG
@ -1013,8 +1013,8 @@ groestl_big_close(sph_groestl_big_context *sc,
groestl_big_core(sc, pad, pad_len); groestl_big_core(sc, pad, pad_len);
READ_STATE_BIG(sc); READ_STATE_BIG(sc);
FINAL_BIG; FINAL_BIG;
for (u = 0; u < 16; u ++) for (u2 = 0; u2 < 16; u2 ++)
enc32e(pad + (u << 2), H[u + 16]); enc32e(pad + (u2 << 2), H[u2 + 16]);
memcpy(dst, pad + 64 - out_len, out_len); memcpy(dst, pad + 64 - out_len, out_len);
groestl_big_init(sc, (unsigned)out_len << 3); groestl_big_init(sc, (unsigned)out_len << 3);
} }