Skip to content

Commit 1b907d0

Browse files
committed
WOLFSSL_DEBUG_TRACE_ERROR_CODES: restore several initializations, one because needed (in wolfSSL_UseSecureRenegotiation()), the rest in an abundance of caution, and rearrange wolfSSL_CryptHwMutexInit() and wolfSSL_CryptHwMutexUnLock() in a similar abundance of caution.
1 parent b3e8f0a commit 1b907d0

6 files changed

Lines changed: 13 additions & 15 deletions

File tree

src/internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12549,7 +12549,7 @@ int CheckForAltNames(DecodedCert* dCert, const char* domain, word32 domainLen,
1254912549
int CheckHostName(DecodedCert* dCert, const char *domainName, size_t domainNameLen)
1255012550
{
1255112551
int checkCN;
12552-
int ret;
12552+
int ret = WC_NO_ERR_TRACE(DOMAIN_NAME_MISMATCH);
1255312553

1255412554
if (CheckForAltNames(dCert, domainName, (word32)domainNameLen,
1255512555
&checkCN) != 1) {

src/ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3532,7 +3532,7 @@ int wolfSSL_ALPN_FreePeerProtocol(WOLFSSL* ssl, char **list)
35323532
/* user is forcing ability to use secure renegotiation, we discourage it */
35333533
int wolfSSL_UseSecureRenegotiation(WOLFSSL* ssl)
35343534
{
3535-
int ret;
3535+
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
35363536
#if defined(NO_TLS)
35373537
(void)ssl;
35383538
#else

src/tls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static int Hmac_HashFinalRaw(Hmac* hmac, unsigned char* hash)
883883
*/
884884
static int Hmac_OuterHash(Hmac* hmac, unsigned char* mac)
885885
{
886-
int ret;
886+
int ret = WC_NO_ERR_TRACE(BAD_FUNC_ARG);
887887
wc_HashAlg hash;
888888
enum wc_HashType hashType = (enum wc_HashType)hmac->macType;
889889
int digestSz = wc_HashGetDigestSize(hashType);
@@ -9745,7 +9745,7 @@ int TLSX_KeyShare_Choose(const WOLFSSL *ssl, TLSX* extensions,
97459745

97469746
if (extension && extension->resp == 1) {
97479747
/* Outside of the async case this path should not be taken. */
9748-
int ret;
9748+
int ret = WC_NO_ERR_TRACE(INCOMPLETE_DATA);
97499749
#ifdef WOLFSSL_ASYNC_CRYPT
97509750
/* in async case make sure key generation is finalized */
97519751
KeyShareEntry* serverKSE = (KeyShareEntry*)extension->data;

wolfcrypt/src/sakke.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static int sakke_load_base_point(SakkeKey* key)
327327
static int sakke_mulmod_base(SakkeKey* key, const mp_int* n, ecc_point* res,
328328
int map)
329329
{
330-
int err;
330+
int err = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
331331

332332
#ifdef WOLFSSL_SP_1024
333333
if ((key->ecc.idx != ECC_CUSTOM_IDX) &&
@@ -357,7 +357,7 @@ static int sakke_mulmod_base(SakkeKey* key, const mp_int* n, ecc_point* res,
357357
static int sakke_mulmod_base_add(SakkeKey* key, const mp_int* n,
358358
const ecc_point* a, ecc_point* res, int map)
359359
{
360-
int err;
360+
int err = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
361361

362362
#ifdef WOLFSSL_SP_1024
363363
if ((key->ecc.idx != ECC_CUSTOM_IDX) &&
@@ -448,7 +448,7 @@ static int sakke_mulmod_base_add(SakkeKey* key, const mp_int* n, ecc_point* a,
448448
static int sakke_mulmod_point(SakkeKey* key, const mp_int* n,
449449
const ecc_point* p, byte* table, ecc_point* res, int map)
450450
{
451-
int err;
451+
int err = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
452452

453453
#ifdef WOLFSSL_SP_1024
454454
if ((key->ecc.idx != ECC_CUSTOM_IDX) &&
@@ -1363,7 +1363,7 @@ int wc_GenerateSakkeRskTable(const SakkeKey* key, const ecc_point* rsk,
13631363
static int sakke_pairing(const SakkeKey* key, const ecc_point* p,
13641364
const ecc_point* q, mp_int* r, const byte* table, word32 len)
13651365
{
1366-
int err;
1366+
int err = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
13671367

13681368
#ifdef WOLFSSL_SP_1024
13691369
if ((key->ecc.idx != ECC_CUSTOM_IDX) &&
@@ -2539,7 +2539,7 @@ int wc_GetSakkeAuthSize(SakkeKey* key, word16* authSz)
25392539
static int sakke_modexp(const SakkeKey* key, const mp_int* b, mp_int* e,
25402540
mp_int* r)
25412541
{
2542-
int err;
2542+
int err = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
25432543

25442544
#ifdef WOLFSSL_SP_1024
25452545
if ((key->ecc.idx != ECC_CUSTOM_IDX) &&

wolfcrypt/src/wc_port.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,8 @@ int wolfSSL_CryptHwMutexInit(void)
13031303
}
13041304
int wolfSSL_CryptHwMutexLock(void)
13051305
{
1306-
int ret;
13071306
/* Make sure HW Mutex has been initialized */
1308-
ret = wolfSSL_CryptHwMutexInit();
1307+
int ret = wolfSSL_CryptHwMutexInit();
13091308
if (ret == 0) {
13101309
ret = wc_LockMutex(&wcCryptHwMutex);
13111310
}
@@ -1700,9 +1699,8 @@ int wolfSSL_CryptHwMutexUnLock(void)
17001699

17011700
int maxq_CryptHwMutexTryLock()
17021701
{
1703-
int ret;
17041702
/* Make sure HW Mutex has been initialized */
1705-
ret = wolfSSL_CryptHwMutexInit();
1703+
int ret = wolfSSL_CryptHwMutexInit();
17061704
if (ret == 0) {
17071705
ret = maxq_LockMutex(&wcCryptHwMutex, 1);
17081706
}

wolfcrypt/src/wc_xmss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static const wc_XmssString wc_xmss_alg[] = {
385385
static int wc_xmss_str_to_params(const char *s, word32* oid,
386386
const XmssParams** params)
387387
{
388-
int ret;
388+
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
389389
#if WOLFSSL_XMSS_MIN_HEIGHT <= 20
390390
unsigned int i;
391391

@@ -614,7 +614,7 @@ static const wc_XmssString wc_xmssmt_alg[] = {
614614
static int wc_xmssmt_str_to_params(const char *s, word32* oid,
615615
const XmssParams** params)
616616
{
617-
int ret;
617+
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
618618
#if WOLFSSL_XMSS_MAX_HEIGHT >= 20
619619
unsigned int i;
620620

0 commit comments

Comments
 (0)