Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory: fix types in wc_LoadStaticMemory_ex() #8117

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions wolfcrypt/src/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ static int wc_partition_static_memory(byte* buffer, word32 sz, int flag,
}

static int wc_init_memory_heap(WOLFSSL_HEAP* heap, unsigned int listSz,
const unsigned int* sizeList, const unsigned int* distList)
const word32 *sizeList, const word32 *distList)
{
unsigned int i;

Expand All @@ -695,8 +695,8 @@ static int wc_init_memory_heap(WOLFSSL_HEAP* heap, unsigned int listSz,
}

int wc_LoadStaticMemory_ex(WOLFSSL_HEAP_HINT** pHint,
unsigned int listSz, const unsigned int* sizeList,
const unsigned int* distList, unsigned char* buf,
unsigned int listSz, const word32 *sizeList,
const word32 *distList, unsigned char *buf,
unsigned int sz, int flag, int maxSz)
{
WOLFSSL_HEAP* heap = NULL;
Expand Down Expand Up @@ -773,13 +773,8 @@ int wc_LoadStaticMemory_ex(WOLFSSL_HEAP_HINT** pHint,
int wc_LoadStaticMemory(WOLFSSL_HEAP_HINT** pHint,
unsigned char* buf, unsigned int sz, int flag, int maxSz)
{
#ifdef WOLFSSL_LEAN_STATIC_PSK
word16 sizeList[WOLFMEM_DEF_BUCKETS] = { WOLFMEM_BUCKETS };
byte distList[WOLFMEM_DEF_BUCKETS] = { WOLFMEM_DIST };
#else
word32 sizeList[WOLFMEM_DEF_BUCKETS] = { WOLFMEM_BUCKETS };
word32 distList[WOLFMEM_DEF_BUCKETS] = { WOLFMEM_DIST };
#endif
int ret = 0;

WOLFSSL_ENTER("wc_LoadStaticMemory");
Expand Down Expand Up @@ -817,7 +812,7 @@ int wolfSSL_MemoryPaddingSz(void)
/* Used to calculate memory size for optimum use with buckets.
returns the suggested size rounded down to the nearest bucket. */
int wolfSSL_StaticBufferSz_ex(unsigned int listSz,
const unsigned int *sizeList, const unsigned int *distList,
const word32 *sizeList, const word32 *distList,
byte* buffer, word32 sz, int flag)
{
word32 ava = sz;
Expand Down
10 changes: 5 additions & 5 deletions wolfssl/wolfcrypt/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
#endif

#ifdef WOLFSSL_STATIC_MEMORY_LEAN
word16 sizeList[WOLFMEM_MAX_BUCKETS];/* memory sizes in ava list */
byte distList[WOLFMEM_MAX_BUCKETS];/* general distribution */
word32 sizeList[WOLFMEM_MAX_BUCKETS];/* memory sizes in ava list */
word32 distList[WOLFMEM_MAX_BUCKETS];/* general distribution */
#else
word32 maxHa; /* max concurrent handshakes */
word32 curHa;
Expand Down Expand Up @@ -258,8 +258,8 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
WOLFSSL_API void* wolfSSL_SetGlobalHeapHint(void* heap);
WOLFSSL_API void* wolfSSL_GetGlobalHeapHint(void);
WOLFSSL_API int wc_LoadStaticMemory_ex(WOLFSSL_HEAP_HINT** pHint,
unsigned int listSz, const unsigned int *sizeList,
const unsigned int *distList, unsigned char* buf, unsigned int sz,
unsigned int listSz, const word32 *sizeList,
const word32 *distList, unsigned char* buf, unsigned int sz,
int flag, int max);
#ifdef WOLFSSL_STATIC_MEMORY_DEBUG_CALLBACK
#define WOLFSSL_DEBUG_MEMORY_ALLOC 0
Expand All @@ -281,7 +281,7 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb* mf,
WOLFSSL_LOCAL int FreeFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io);

WOLFSSL_API int wolfSSL_StaticBufferSz_ex(unsigned int listSz,
const unsigned int *sizeList, const unsigned int *distList,
const word32 *sizeList, const word32 *distList,
byte* buffer, word32 sz, int flag);
WOLFSSL_API int wolfSSL_StaticBufferSz(byte* buffer, word32 sz, int flag);
WOLFSSL_API int wolfSSL_MemoryPaddingSz(void);
Expand Down
Loading