Skip to content

Commit 1f92ef8

Browse files
committed
Fixes for scan-build warnings.
1 parent 62d123f commit 1f92ef8

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

wolfcrypt/src/port/intel/quickassist.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
#include <wolfcrypt/src/misc.c>
7171
#endif
7272

73+
#include <pthread.h>
74+
7375
/* Async enables (1=non-block, 0=block) */
7476
#ifndef QAT_RSA_ASYNC
7577
#define QAT_RSA_ASYNC 1
@@ -802,6 +804,7 @@ static int IntelQaPollBlockRet(WC_ASYNC_DEV* dev, int ret_wait)
802804

803805
do {
804806
ret = IntelQaPoll(dev);
807+
(void)ret; /* not used */
805808

806809
if (dev->qat.ret != ret_wait) {
807810
break;
@@ -1996,9 +1999,10 @@ static int IntelQaSymOpen(WC_ASYNC_DEV* dev, CpaCySymSessionSetupData* setup,
19961999
/* Determine size of session context to allocate - use max size */
19972000
status = cpaCySymSessionCtxGetSize(dev->qat.handle, setup, &sessionCtxSize);
19982001

1999-
if (ctx->symCtxSize > 0 && ctx->symCtxSize > sessionCtxSize) {
2000-
printf("Symmetric context size error! Buf %d, Exp %d\n",
2001-
ctx->symCtxSize, sessionCtxSize);
2002+
if (status != CPA_STATUS_SUCCESS || (ctx->symCtxSize > 0 &&
2003+
ctx->symCtxSize > sessionCtxSize)) {
2004+
printf("Symmetric context size error %d! Buf %d, Exp %d\n",
2005+
status, ctx->symCtxSize, sessionCtxSize);
20022006
return ASYNC_OP_E;
20032007
}
20042008

@@ -3797,14 +3801,11 @@ static void IntelQaEcdsaSignCallback(void *pCallbackTag,
37973801
ret = ECC_CURVE_OID_E;
37983802
}
37993803
else {
3800-
/* mark event result */
3801-
ret = 0; /* success */
3802-
}
3803-
3804-
/* populate result */
3805-
ret = IntelQaFlatBufferToBigInt(pR, dev->qat.op.ecc_sign.pR);
3806-
if (ret == 0) {
3807-
ret = IntelQaFlatBufferToBigInt(pS, dev->qat.op.ecc_sign.pS);
3804+
/* success - populate result */
3805+
ret = IntelQaFlatBufferToBigInt(pR, dev->qat.op.ecc_sign.pR);
3806+
if (ret == 0) {
3807+
ret = IntelQaFlatBufferToBigInt(pS, dev->qat.op.ecc_sign.pS);
3808+
}
38083809
}
38093810
}
38103811
(void)opData;

wolfcrypt/src/port/intel/quickassist_mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include <string.h>
3737

3838
/* use thread local for QAE variables (removing mutex requirement) */
39+
#include <pthread.h> /* for threadId tracking */
3940
#ifdef USE_QAE_THREAD_LS
40-
#include <pthread.h> /* for threadId tracking */
4141
#define QAE_THREAD_LS THREAD_LS_T
4242
#else
4343
#define QAE_THREAD_LS

0 commit comments

Comments
 (0)