From 52d5dfc7d3ad907226436b49a6d2b8236375dc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 12 Mar 2026 21:34:09 -0400 Subject: [PATCH] Remove redundant BLAKE3_KEY_LEN32 it's the same number as BLAKE3_OUT_LEN32 Acked-by: Pierre-Eric Pelloux-Prayer Acked-by: Alyssa Rosenzweig Part-of: --- src/util/mesa-sha1.c | 8 ++++---- src/util/mesa-sha1.h | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/util/mesa-sha1.c b/src/util/mesa-sha1.c index a152585332b..1a2599afca7 100644 --- a/src/util/mesa-sha1.c +++ b/src/util/mesa-sha1.c @@ -57,7 +57,7 @@ _mesa_sha1_hex_to_sha1(unsigned char *buf, const char *hex) static void sha1_to_uint32(const uint8_t sha1[BLAKE3_KEY_LEN], - uint32_t out[BLAKE3_KEY_LEN32]) + uint32_t out[BLAKE3_OUT_LEN32]) { memset(out, 0, BLAKE3_KEY_LEN); @@ -71,16 +71,16 @@ _mesa_sha1_print(FILE *f, const uint8_t sha1[BLAKE3_KEY_LEN]) uint32_t u32[BLAKE3_KEY_LEN]; sha1_to_uint32(sha1, u32); - for (unsigned i = 0; i < BLAKE3_KEY_LEN32; i++) { + for (unsigned i = 0; i < BLAKE3_OUT_LEN32; i++) { fprintf(f, i ? ", 0x%08" PRIx32 : "0x%08" PRIx32, u32[i]); } } bool _mesa_printed_sha1_equal(const uint8_t sha1[BLAKE3_KEY_LEN], - const uint32_t printed_sha1[BLAKE3_KEY_LEN32]) + const uint32_t printed_sha1[BLAKE3_OUT_LEN32]) { - uint32_t u32[BLAKE3_KEY_LEN32]; + uint32_t u32[BLAKE3_OUT_LEN32]; sha1_to_uint32(sha1, u32); return memcmp(u32, printed_sha1, sizeof(u32)) == 0; diff --git a/src/util/mesa-sha1.h b/src/util/mesa-sha1.h index 91e042d99c4..41d7066cc81 100644 --- a/src/util/mesa-sha1.h +++ b/src/util/mesa-sha1.h @@ -32,8 +32,6 @@ extern "C" { #endif -#define BLAKE3_KEY_LEN32 (BLAKE3_KEY_LEN / 4) - void _mesa_sha1_format(char *buf, const unsigned char *sha1); @@ -48,7 +46,7 @@ _mesa_sha1_print(FILE *f, const uint8_t sha1[BLAKE3_KEY_LEN]); bool _mesa_printed_sha1_equal(const uint8_t sha1[BLAKE3_KEY_LEN], - const uint32_t printed_sha1[BLAKE3_KEY_LEN32]); + const uint32_t printed_sha1[BLAKE3_OUT_LEN32]); #ifdef __cplusplus } /* extern C */