From 88396d7d12765ae6b7982c57d804c09f92d18e1c Mon Sep 17 00:00:00 2001 From: night1rider Date: Mon, 6 Apr 2026 11:12:37 -0600 Subject: [PATCH] Fix -Wcast-qual errors in _Label functions by making _common helpers accept const void* data parameter. --- wolfcrypt/src/aes.c | 6 +++--- wolfcrypt/src/cmac.c | 6 +++--- wolfcrypt/src/rsa.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index e8fc2603b9..a8c3035ff5 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -13567,7 +13567,7 @@ int wc_AesCcmEncrypt_ex(Aes* aes, byte* out, const byte* in, word32 sz, #endif static Aes* _AesNew_common(void* heap, int devId, int *result_code, - int aesInitType, void* aesInitData, + int aesInitType, const void* aesInitData, int aesInitDataLen) { int ret; @@ -13579,7 +13579,7 @@ static Aes* _AesNew_common(void* heap, int devId, int *result_code, switch (aesInitType) { #ifdef WOLF_PRIVATE_KEY_ID case AES_NEW_INIT_ID: - ret = wc_AesInit_Id(aes, (unsigned char*)aesInitData, + ret = wc_AesInit_Id(aes, (unsigned char*)(uintptr_t)aesInitData, aesInitDataLen, heap, devId); break; case AES_NEW_INIT_LABEL: @@ -13625,7 +13625,7 @@ Aes* wc_AesNew_Label(const char* label, void* heap, int devId, int *result_code) { return _AesNew_common(heap, devId, result_code, - AES_NEW_INIT_LABEL, (void*)label, 0); + AES_NEW_INIT_LABEL, label, 0); } #endif /* WOLF_PRIVATE_KEY_ID */ diff --git a/wolfcrypt/src/cmac.c b/wolfcrypt/src/cmac.c index 9559141310..7af409c993 100644 --- a/wolfcrypt/src/cmac.c +++ b/wolfcrypt/src/cmac.c @@ -106,7 +106,7 @@ void ShiftAndXorRb(byte* out, byte* in) static int _InitCmac_common(Cmac* cmac, const byte* key, word32 keySz, int type, void* unused, void* heap, int devId, - int aesInitType, void* aesInitData, + int aesInitType, const void* aesInitData, int aesInitDataLen) { int ret = 0; @@ -178,7 +178,7 @@ static int _InitCmac_common(Cmac* cmac, const byte* key, word32 keySz, switch (aesInitType) { #ifdef WOLF_PRIVATE_KEY_ID case CMAC_AES_INIT_ID: - ret = wc_AesInit_Id(&cmac->aes, (unsigned char*)aesInitData, + ret = wc_AesInit_Id(&cmac->aes, (unsigned char*)(uintptr_t)aesInitData, aesInitDataLen, heap, devId); break; case CMAC_AES_INIT_LABEL: @@ -271,7 +271,7 @@ int wc_InitCmac_Label(Cmac* cmac, const byte* key, word32 keySz, void* heap, int devId) { return _InitCmac_common(cmac, key, keySz, type, unused, heap, devId, - CMAC_AES_INIT_LABEL, (void*)label, 0); + CMAC_AES_INIT_LABEL, label, 0); } #endif /* WOLF_PRIVATE_KEY_ID */ diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 00c3006661..0a3d9201e0 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -192,7 +192,7 @@ static void wc_RsaCleanup(RsaKey* key) #endif static RsaKey* _NewRsaKey_common(void* heap, int devId, int *result_code, - int rsaInitType, void* rsaInitData, + int rsaInitType, const void* rsaInitData, int rsaInitDataLen) { int ret; @@ -204,7 +204,7 @@ static RsaKey* _NewRsaKey_common(void* heap, int devId, int *result_code, switch (rsaInitType) { #ifdef WOLF_PRIVATE_KEY_ID case RSA_NEW_INIT_ID: - ret = wc_InitRsaKey_Id(key, (unsigned char*)rsaInitData, + ret = wc_InitRsaKey_Id(key, (unsigned char*)(uintptr_t)rsaInitData, rsaInitDataLen, heap, devId); break; case RSA_NEW_INIT_LABEL: @@ -250,7 +250,7 @@ RsaKey* wc_NewRsaKey_Label(const char* label, void* heap, int devId, int *result_code) { return _NewRsaKey_common(heap, devId, result_code, - RSA_NEW_INIT_LABEL, (void*)label, 0); + RSA_NEW_INIT_LABEL, label, 0); } #endif /* WOLF_PRIVATE_KEY_ID */