Skip to content
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
27 changes: 23 additions & 4 deletions wolfcrypt/src/port/cavium/cavium_nitrox.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,12 +815,22 @@ int NitroxAesGcmEncrypt(Aes* aes,
byte* authTag, word32 authTagSz,
const byte* authIn, word32 authInSz)
{
const byte* ivTmp = iv;
byte ivLcl[AES_BLOCK_SIZE];

(void)keySz;
(void)ivSz;
(void)authTagSz;
return NitroxAesEncrypt(aes, AES_GCM, key, iv, out, in, sz,

/* Nitrox HW requires IV buffer to be 16-bytes */
if (ivSz < AES_BLOCK_SIZE) {
ivTmp = ivLcl;
XMEMCPY(ivLcl, iv, ivSz);
}

return NitroxAesEncrypt(aes, AES_GCM, key, ivTmp, out, in, sz,
authInSz, authIn, authTag);
}

#ifdef HAVE_AES_DECRYPT
int NitroxAesGcmDecrypt(Aes* aes,
byte* out, const byte* in, word32 sz,
Expand All @@ -829,10 +839,19 @@ int NitroxAesGcmDecrypt(Aes* aes,
const byte* authTag, word32 authTagSz,
const byte* authIn, word32 authInSz)
{
const byte* ivTmp = iv;
byte ivLcl[AES_BLOCK_SIZE];

(void)keySz;
(void)ivSz;
(void)authTagSz;
return NitroxAesDecrypt(aes, AES_GCM, key, iv, out, in, sz,

/* Nitrox HW requires IV buffer to be 16-bytes */
if (ivSz < AES_BLOCK_SIZE) {
ivTmp = ivLcl;
XMEMCPY(ivLcl, iv, ivSz);
}

return NitroxAesDecrypt(aes, AES_GCM, key, ivTmp, out, in, sz,
authInSz, authIn, authTag);
}
#endif /* HAVE_AES_DECRYPT */
Expand Down
13 changes: 9 additions & 4 deletions wolfcrypt/src/port/intel/quickassist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3404,10 +3404,15 @@ int IntelQaDrbg(WC_ASYNC_DEV* dev, byte* rngBuf, word32 rngSz)
gen = 0xFFFF;

pOut->dataLenInBytes = gen;
pOut->pData = XREALLOC(&rngBuf[idx], gen, dev->heap,
DYNAMIC_TYPE_ASYNC_NUMA);
if (pOut->pData == NULL) {
ret = MEMORY_E; goto exit;
if (idx == 0 && pOut->pData == NULL) {
pOut->pData = XREALLOC(rngBuf, gen, dev->heap,
DYNAMIC_TYPE_ASYNC_NUMA);
if (pOut->pData == NULL) {
ret = MEMORY_E; goto exit;
}
}
else {
XMEMCPY(pOut->pData, &rngBuf[idx], gen);
}

opData->sessionHandle = dev->qat.op.drbg.handle;
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/intel/quickassist_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ static void* _qaeMemAlloc(size_t size, void* heap, int type
/* allocate type */
if (isNuma) {
/* Node is typically 0 */
ptr = qaeMemAllocNUMA(size + sizeof(qaeMemHeader), 0, alignment,
&page_offset);
ptr = qaeMemAllocNUMA((Cpa32U)(size + sizeof(qaeMemHeader)), 0,
alignment, &page_offset);
}
if (ptr == NULL) {
isNuma = 0;
Expand Down
1 change: 0 additions & 1 deletion wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#define AES_CBC 0x3
#define AES_GCM 0x7
#else
typedef int CspHandle;
typedef word64 CavReqId;
#define CAVIUM_DEV_ID 0
#define CAVIUM_BLOCKING BLOCKING
Expand Down