Skip to content

Commit 88396d7

Browse files
committed
Fix -Wcast-qual errors in _Label functions by making _common helpers accept const void* data parameter.
1 parent 48e8442 commit 88396d7

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13567,7 +13567,7 @@ int wc_AesCcmEncrypt_ex(Aes* aes, byte* out, const byte* in, word32 sz,
1356713567
#endif
1356813568

1356913569
static Aes* _AesNew_common(void* heap, int devId, int *result_code,
13570-
int aesInitType, void* aesInitData,
13570+
int aesInitType, const void* aesInitData,
1357113571
int aesInitDataLen)
1357213572
{
1357313573
int ret;
@@ -13579,7 +13579,7 @@ static Aes* _AesNew_common(void* heap, int devId, int *result_code,
1357913579
switch (aesInitType) {
1358013580
#ifdef WOLF_PRIVATE_KEY_ID
1358113581
case AES_NEW_INIT_ID:
13582-
ret = wc_AesInit_Id(aes, (unsigned char*)aesInitData,
13582+
ret = wc_AesInit_Id(aes, (unsigned char*)(uintptr_t)aesInitData,
1358313583
aesInitDataLen, heap, devId);
1358413584
break;
1358513585
case AES_NEW_INIT_LABEL:
@@ -13625,7 +13625,7 @@ Aes* wc_AesNew_Label(const char* label, void* heap, int devId,
1362513625
int *result_code)
1362613626
{
1362713627
return _AesNew_common(heap, devId, result_code,
13628-
AES_NEW_INIT_LABEL, (void*)label, 0);
13628+
AES_NEW_INIT_LABEL, label, 0);
1362913629
}
1363013630
#endif /* WOLF_PRIVATE_KEY_ID */
1363113631

wolfcrypt/src/cmac.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void ShiftAndXorRb(byte* out, byte* in)
106106

107107
static int _InitCmac_common(Cmac* cmac, const byte* key, word32 keySz,
108108
int type, void* unused, void* heap, int devId,
109-
int aesInitType, void* aesInitData,
109+
int aesInitType, const void* aesInitData,
110110
int aesInitDataLen)
111111
{
112112
int ret = 0;
@@ -178,7 +178,7 @@ static int _InitCmac_common(Cmac* cmac, const byte* key, word32 keySz,
178178
switch (aesInitType) {
179179
#ifdef WOLF_PRIVATE_KEY_ID
180180
case CMAC_AES_INIT_ID:
181-
ret = wc_AesInit_Id(&cmac->aes, (unsigned char*)aesInitData,
181+
ret = wc_AesInit_Id(&cmac->aes, (unsigned char*)(uintptr_t)aesInitData,
182182
aesInitDataLen, heap, devId);
183183
break;
184184
case CMAC_AES_INIT_LABEL:
@@ -271,7 +271,7 @@ int wc_InitCmac_Label(Cmac* cmac, const byte* key, word32 keySz,
271271
void* heap, int devId)
272272
{
273273
return _InitCmac_common(cmac, key, keySz, type, unused, heap, devId,
274-
CMAC_AES_INIT_LABEL, (void*)label, 0);
274+
CMAC_AES_INIT_LABEL, label, 0);
275275
}
276276
#endif /* WOLF_PRIVATE_KEY_ID */
277277

wolfcrypt/src/rsa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void wc_RsaCleanup(RsaKey* key)
192192
#endif
193193

194194
static RsaKey* _NewRsaKey_common(void* heap, int devId, int *result_code,
195-
int rsaInitType, void* rsaInitData,
195+
int rsaInitType, const void* rsaInitData,
196196
int rsaInitDataLen)
197197
{
198198
int ret;
@@ -204,7 +204,7 @@ static RsaKey* _NewRsaKey_common(void* heap, int devId, int *result_code,
204204
switch (rsaInitType) {
205205
#ifdef WOLF_PRIVATE_KEY_ID
206206
case RSA_NEW_INIT_ID:
207-
ret = wc_InitRsaKey_Id(key, (unsigned char*)rsaInitData,
207+
ret = wc_InitRsaKey_Id(key, (unsigned char*)(uintptr_t)rsaInitData,
208208
rsaInitDataLen, heap, devId);
209209
break;
210210
case RSA_NEW_INIT_LABEL:
@@ -250,7 +250,7 @@ RsaKey* wc_NewRsaKey_Label(const char* label, void* heap, int devId,
250250
int *result_code)
251251
{
252252
return _NewRsaKey_common(heap, devId, result_code,
253-
RSA_NEW_INIT_LABEL, (void*)label, 0);
253+
RSA_NEW_INIT_LABEL, label, 0);
254254
}
255255
#endif /* WOLF_PRIVATE_KEY_ID */
256256

0 commit comments

Comments
 (0)