Skip to content

Commit 25db90a

Browse files
authored
Merge pull request wolfSSL#9741 from kareem-wolfssl/variousFixes
Various fixes
2 parents 8e6ebdb + a429eb7 commit 25db90a

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

doc/dox_comments/header_files/memory.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ int wolfSSL_is_static_memory(WOLFSSL* ssl, WOLFSSL_MEM_CONN_STATS* mem_stats);
376376
buffers to themselves for their lifetime.
377377
WOLFMEM_TRACK_STATS - each SSL keeps track of memory stats while running
378378
379-
\return none This function does not return a value.
379+
\return Returns 0 on success.
380+
\return Returns a non-zero integer on failure.
380381
381382
\param pHint WOLFSSL_HEAP_HINT structure to use
382383
\param buf memory to use for all operations.
@@ -396,7 +397,7 @@ int wolfSSL_is_static_memory(WOLFSSL* ssl, WOLFSSL_MEM_CONN_STATS* mem_stats);
396397
// load in memory for use
397398
398399
ret = wc_LoadStaticMemory(&hint, memory, memorySz, flag, 0);
399-
if (ret != SSL_SUCCESS) {
400+
if (ret) {
400401
// handle error case
401402
}
402403
...
@@ -419,7 +420,8 @@ int wc_LoadStaticMemory(WOLFSSL_HEAP_HINT** pHint, unsigned char* buf,
419420
into functions. This extended version allows for custom bucket sizes and distributions
420421
instead of using the default predefined sizes.
421422
422-
\return none This function does not return a value.
423+
\return Returns 0 on success.
424+
\return Returns a non-zero integer on failure.
423425
424426
\param pHint WOLFSSL_HEAP_HINT handle to initialize
425427
\param listSz number of entries in the size and distribution lists
@@ -447,7 +449,7 @@ int wc_LoadStaticMemory(WOLFSSL_HEAP_HINT** pHint, unsigned char* buf,
447449
448450
ret = wc_LoadStaticMemory_ex(&hint, listSz, sizeList, distList,
449451
memory, memorySz, flag, 0);
450-
if (ret != SSL_SUCCESS) {
452+
if (ret) {
451453
// handle error case
452454
}
453455
...

src/tls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9894,7 +9894,7 @@ static int TLSX_KeyShareEntry_Parse(const WOLFSSL* ssl, const byte* input,
98949894
ato16(&input[offset], &keLen);
98959895
offset += OPAQUE16_LEN;
98969896
if (keLen == 0)
9897-
return INVALID_PARAMETER;
9897+
return BUFFER_ERROR;
98989898
if (keLen > length - offset)
98999899
return BUFFER_ERROR;
99009900

src/tls13.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5497,8 +5497,8 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
54975497
suite[1] = ssl->options.cipherSuite;
54985498
if (!FindSuiteSSL(ssl, suite)) {
54995499
WOLFSSL_MSG("Cipher suite not supported on client");
5500-
WOLFSSL_ERROR_VERBOSE(MATCH_SUITE_ERROR);
5501-
return MATCH_SUITE_ERROR;
5500+
WOLFSSL_ERROR_VERBOSE(INVALID_PARAMETER);
5501+
return INVALID_PARAMETER;
55025502
}
55035503

55045504
#if defined(HAVE_ECH)

wolfcrypt/src/ecc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13214,7 +13214,7 @@ int ecc_mul2add(ecc_point* A, mp_int* kA,
1321413214
err = add_entry(idx1, A);
1321513215
}
1321613216
}
13217-
if (err == MP_OKAY && idx1 != -1) {
13217+
if (err == MP_OKAY && idx1 != -1 && fp_cache[idx1].lru_count < (INT_MAX-1)) {
1321813218
/* increment LRU */
1321913219
++(fp_cache[idx1].lru_count);
1322013220
}
@@ -13231,7 +13231,7 @@ int ecc_mul2add(ecc_point* A, mp_int* kA,
1323113231
}
1323213232
}
1323313233

13234-
if (err == MP_OKAY && idx2 != -1) {
13234+
if (err == MP_OKAY && idx2 != -1 && fp_cache[idx2].lru_count < (INT_MAX-1)) {
1323513235
/* increment LRU */
1323613236
++(fp_cache[idx2].lru_count);
1323713237
}
@@ -13368,7 +13368,7 @@ int wc_ecc_mulmod_ex(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
1336813368
if (idx >= 0)
1336913369
err = add_entry(idx, G);
1337013370
}
13371-
if (err == MP_OKAY && idx >= 0) {
13371+
if (err == MP_OKAY && idx >= 0 && fp_cache[idx].lru_count < (INT_MAX-1)) {
1337213372
/* increment LRU */
1337313373
++(fp_cache[idx].lru_count);
1337413374
}
@@ -13539,7 +13539,7 @@ int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
1353913539
if (idx >= 0)
1354013540
err = add_entry(idx, G);
1354113541
}
13542-
if (err == MP_OKAY && idx >= 0) {
13542+
if (err == MP_OKAY && idx >= 0 && fp_cache[idx].lru_count < (INT_MAX-1)) {
1354313543
/* increment LRU */
1354413544
++(fp_cache[idx].lru_count);
1354513545
}

wolfssl/wolfcrypt/asn.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,8 @@ typedef enum MimeStatus
22262226
#define GetShortInt wc_GetShortInt
22272227
#define SetShortInt wc_SetShortInt
22282228
#define GetLength wc_GetLength
2229+
#define SetLength wc_SetLength
2230+
#define SetSequence wc_SetSequence
22292231
#define GetASNInt wc_GetASNInt
22302232
#define GetASNTag wc_GetASNTag
22312233
#define SetAlgoID wc_SetAlgoID
@@ -2485,11 +2487,11 @@ WOLFSSL_LOCAL word32 SetASNImplicit(byte tag,byte number, word32 len,
24852487
WOLFSSL_LOCAL word32 SetASNExplicit(byte number, word32 len, byte* output);
24862488
WOLFSSL_LOCAL word32 SetASNSet(word32 len, byte* output);
24872489

2488-
WOLFSSL_LOCAL word32 SetLength(word32 length, byte* output);
2490+
WOLFSSL_ASN_API word32 SetLength(word32 length, byte* output);
24892491
WOLFSSL_LOCAL word32 SetLengthEx(word32 length, byte* output, byte isIndef);
24902492
WOLFSSL_LOCAL word32 SetHeader(byte tag, word32 len, byte* output,
24912493
byte isIndef);
2492-
WOLFSSL_LOCAL word32 SetSequence(word32 len, byte* output);
2494+
WOLFSSL_ASN_API word32 SetSequence(word32 len, byte* output);
24932495
WOLFSSL_LOCAL word32 SetSequenceEx(word32 len, byte* output, byte isIndef);
24942496
WOLFSSL_LOCAL word32 SetIndefEnd(byte* output);
24952497
WOLFSSL_LOCAL word32 SetOctetString(word32 len, byte* output);

0 commit comments

Comments
 (0)