Skip to content

Commit c13afd6

Browse files
Merge pull request #29 from dgarske/rel_prep
wolfSSL Async v4.2.0 release prep
2 parents ba7cd58 + 0efba4c commit c13afd6

File tree

5 files changed

+57
-22
lines changed

5 files changed

+57
-22
lines changed

README-async.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ wolfSSL Client Benchmark 16384 bytes
268268

269269
## Change Log
270270

271+
### wolfSSL Async Release v4.2.0 (10/22/2019)
272+
* Fix for QuickAssist DH Agree issue with leading zero bytes.
273+
* Fix for QuickAssist AES CBC issue with previous IV on back-to-back operations.
274+
* Updates to QuickAssist README.md for latest QAT v1.7 driver.
275+
* Instructions for Octeon III (CN7300) use.
276+
271277
### wolfSSL Async Release v4.0.0 (03/25/2019)
272278

273279
* Fix for building with QuickAssist v1.7 driver (4.4.0-00023) (was missing usdm_drv during configure with check).

wolfcrypt/src/port/cavium/cavium_nitrox.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -793,15 +793,15 @@ static int NitroxAesDecrypt(Aes* aes, int aes_algo,
793793
int NitroxAesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 length)
794794
{
795795
return NitroxAesEncrypt(aes, AES_CBC,
796-
(byte*)aes->asyncKey, (byte*)aes->asyncIv,
796+
(byte*)aes->devKey, (byte*)aes->reg,
797797
out, in, length, 0, NULL, NULL);
798798
}
799799

800800
#ifdef HAVE_AES_DECRYPT
801801
int NitroxAesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 length)
802802
{
803803
return NitroxAesDecrypt(aes, AES_CBC,
804-
(byte*)aes->asyncKey, (byte*)aes->asyncIv,
804+
(byte*)aes->devKey, (byte*)aes->reg,
805805
out, in, length, 0, NULL, NULL);
806806
}
807807
#endif /* HAVE_AES_DECRYPT */
@@ -930,13 +930,13 @@ int NitroxDes3CbcEncrypt(Des3* des3, byte* out, const byte* in, word32 length)
930930
cav_ret = CspEncrypt3Des(des3->asyncDev.nitrox.devId, blockMode,
931931
DMA_DIRECT_DIRECT, CAVIUM_SSL_GRP, CAVIUM_DPORT,
932932
des3->asyncDev.nitrox.contextHandle, FROM_DPTR, FROM_CTX, DES3_CBC,
933-
(byte*)des3->key_raw, (byte*)des3->iv_raw, (word16)slen, (byte*)in + offset,
933+
(byte*)des3->devKey, (byte*)des3->reg, (word16)slen, (byte*)in + offset,
934934
out + offset, &des3->asyncDev.nitrox.reqId);
935935
#else
936936
cav_ret = CspEncrypt3Des(blockMode,
937937
des3->asyncDev.nitrox.contextHandle, CAVIUM_NO_UPDATE, (word16)slen,
938-
(byte*)in + offset, out + offset, (byte*)des3->iv_raw,
939-
(byte*)des3->key_raw, &des3->asyncDev.nitrox.reqId,
938+
(byte*)in + offset, out + offset, (byte*)des3->reg,
939+
(byte*)des3->devKey, &des3->asyncDev.nitrox.reqId,
940940
des3->asyncDev.nitrox.devId);
941941
#endif
942942
ret = NitroxTranslateResponseCode(cav_ret);
@@ -978,13 +978,13 @@ int NitroxDes3CbcDecrypt(Des3* des3, byte* out, const byte* in, word32 length)
978978
cav_ret = CspDecrypt3Des(des3->asyncDev.nitrox.devId, blockMode,
979979
DMA_DIRECT_DIRECT, CAVIUM_SSL_GRP, CAVIUM_DPORT,
980980
des3->asyncDev.nitrox.contextHandle, FROM_DPTR, FROM_CTX, DES3_CBC,
981-
(byte*)des3->key_raw, (byte*)des3->iv_raw, (word16)slen, (byte*)in + offset,
981+
(byte*)des3->devKey, (byte*)des3->reg, (word16)slen, (byte*)in + offset,
982982
out + offset, &des3->asyncDev.nitrox.reqId);
983983
#else
984984
cav_ret = CspDecrypt3Des(blockMode,
985985
des3->asyncDev.nitrox.contextHandle, CAVIUM_NO_UPDATE, (word16)slen,
986-
(byte*)in + offset, out + offset, (byte*)des3->iv_raw,
987-
(byte*)des3->key_raw, &des3->asyncDev.nitrox.reqId,
986+
(byte*)in + offset, out + offset, (byte*)des3->reg,
987+
(byte*)des3->devKey, &des3->asyncDev.nitrox.reqId,
988988
des3->asyncDev.nitrox.devId);
989989
#endif
990990
ret = NitroxTranslateResponseCode(cav_ret);

wolfcrypt/src/port/intel/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ Note: If you have the older driver installed you may need to remove it or unload
2626

2727
Prerequisites:
2828
`sudo apt-get install libudev-dev`
29+
OR
30+
`sudo yum install systemd-devel`
2931

3032

3133
```
32-
curl -o qat1.7.l.4.6.0-00025.tar.gz https://01.org/sites/default/files/downloads/qat1.7.l.4.6.0-00025.tar.gz
34+
curl -o qat1.7.l.4.7.0-00006.tar.gz https://01.org/sites/default/files/downloads/qat1.7.l.4.7.0-00006.tar.gz
3335
mkdir QAT1.7
34-
mv qat1.7.l.4.5.0-00034.tar.gz QAT1.7
36+
mv qat1.7.l.4.7.0-00006.tar.gz QAT1.7
3537
cd QAT1.7
36-
tar -xvzf qat1.7.l.4.6.0-00025.tar.gz
38+
tar -xvzf qat1.7.l.4.7.0-00006.tar.gz
3739
./configure
3840
make
3941
sudo make install

wolfcrypt/src/port/intel/quickassist.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,17 @@ static void IntelQaSymCipherCallback(void *pCallbackTag, CpaStatus status,
21802180
XMEMCPY(dev->qat.out, pDstBuffer->pBuffers->pData, outLen);
21812181
}
21822182

2183+
/* capture IV for next call */
2184+
if (dev->qat.op.cipher.iv && dev->qat.op.cipher.ivSz > 0) {
2185+
word32 ivSz = dev->qat.op.cipher.ivSz;
2186+
if (ivSz > outLen)
2187+
ivSz = outLen;
2188+
/* copy last block */
2189+
XMEMCPY(dev->qat.op.cipher.iv,
2190+
&pDstBuffer->pBuffers->pData[outLen - ivSz],
2191+
ivSz);
2192+
}
2193+
21832194
#ifndef NO_AES
21842195
/* return authTag */
21852196
if (dev->qat.op.cipher.authTag && dev->qat.op.cipher.authTagSz > 0) {
@@ -2207,7 +2218,7 @@ static void IntelQaSymCipherCallback(void *pCallbackTag, CpaStatus status,
22072218
}
22082219

22092220
static int IntelQaSymCipher(WC_ASYNC_DEV* dev, byte* out, const byte* in,
2210-
word32 inOutSz, const byte* key, word32 keySz, const byte* iv, word32 ivSz,
2221+
word32 inOutSz, const byte* key, word32 keySz, byte* iv, word32 ivSz,
22112222
CpaCySymOp symOperation, CpaCySymCipherAlgorithm cipherAlgorithm,
22122223
CpaCySymCipherDirection cipherDirection,
22132224

@@ -2352,6 +2363,20 @@ static int IntelQaSymCipher(WC_ASYNC_DEV* dev, byte* out, const byte* in,
23522363
/* store info needed for output */
23532364
dev->qat.out = out;
23542365
dev->qat.outLen = inOutSz;
2366+
/* optional return of next IV */
2367+
if (cipherAlgorithm != CPA_CY_SYM_CIPHER_AES_GCM && iv) {
2368+
if (ivSz > inOutSz)
2369+
ivSz = inOutSz;
2370+
if (cipherDirection == CPA_CY_SYM_CIPHER_DIRECTION_ENCRYPT) {
2371+
/* capture this on the callback */
2372+
dev->qat.op.cipher.iv = iv;
2373+
dev->qat.op.cipher.ivSz = ivSz;
2374+
}
2375+
else {
2376+
/* capture last block of input as next IV */
2377+
XMEMCPY(iv, &in[inOutSz - ivSz], ivSz);
2378+
}
2379+
}
23552380
if (cipherDirection == CPA_CY_SYM_CIPHER_DIRECTION_ENCRYPT) {
23562381
dev->qat.op.cipher.authTag = authTag;
23572382
dev->qat.op.cipher.authTagSz = authTagSz;
@@ -2394,7 +2419,7 @@ static int IntelQaSymCipher(WC_ASYNC_DEV* dev, byte* out, const byte* in,
23942419
int IntelQaSymAesCbcEncrypt(WC_ASYNC_DEV* dev,
23952420
byte* out, const byte* in, word32 sz,
23962421
const byte* key, word32 keySz,
2397-
const byte* iv, word32 ivSz)
2422+
byte* iv, word32 ivSz)
23982423
{
23992424
return IntelQaSymCipher(dev, out, in, sz,
24002425
key, keySz, iv, ivSz,
@@ -2407,7 +2432,7 @@ int IntelQaSymAesCbcEncrypt(WC_ASYNC_DEV* dev,
24072432
int IntelQaSymAesCbcDecrypt(WC_ASYNC_DEV* dev,
24082433
byte* out, const byte* in, word32 sz,
24092434
const byte* key, word32 keySz,
2410-
const byte* iv, word32 ivSz)
2435+
byte* iv, word32 ivSz)
24112436
{
24122437
return IntelQaSymCipher(dev, out, in, sz,
24132438
key, keySz, iv, ivSz,
@@ -2428,7 +2453,7 @@ int IntelQaSymAesGcmEncrypt(WC_ASYNC_DEV* dev,
24282453
const byte* authIn, word32 authInSz)
24292454
{
24302455
return IntelQaSymCipher(dev, out, in, sz,
2431-
key, keySz, iv, ivSz,
2456+
key, keySz, (byte*)iv, ivSz,
24322457
CPA_CY_SYM_OP_ALGORITHM_CHAINING, CPA_CY_SYM_CIPHER_AES_GCM,
24332458
CPA_CY_SYM_CIPHER_DIRECTION_ENCRYPT,
24342459
CPA_CY_SYM_HASH_AES_GCM, authTag, authTagSz, authIn, authInSz);
@@ -2442,7 +2467,7 @@ int IntelQaSymAesGcmDecrypt(WC_ASYNC_DEV* dev,
24422467
const byte* authIn, word32 authInSz)
24432468
{
24442469
return IntelQaSymCipher(dev, out, in, sz,
2445-
key, keySz, iv, ivSz,
2470+
key, keySz, (byte*)iv, ivSz,
24462471
CPA_CY_SYM_OP_ALGORITHM_CHAINING, CPA_CY_SYM_CIPHER_AES_GCM,
24472472
CPA_CY_SYM_CIPHER_DIRECTION_DECRYPT,
24482473
CPA_CY_SYM_HASH_AES_GCM, (byte*)authTag, authTagSz, authIn, authInSz);
@@ -2454,7 +2479,7 @@ int IntelQaSymAesGcmDecrypt(WC_ASYNC_DEV* dev,
24542479
int IntelQaSymDes3CbcEncrypt(WC_ASYNC_DEV* dev,
24552480
byte* out, const byte* in, word32 sz,
24562481
const byte* key, word32 keySz,
2457-
const byte* iv, word32 ivSz)
2482+
byte* iv, word32 ivSz)
24582483
{
24592484
return IntelQaSymCipher(dev, out, in, sz,
24602485
key, keySz, iv, ivSz,
@@ -2466,7 +2491,7 @@ int IntelQaSymDes3CbcEncrypt(WC_ASYNC_DEV* dev,
24662491
int IntelQaSymDes3CbcDecrypt(WC_ASYNC_DEV* dev,
24672492
byte* out, const byte* in, word32 sz,
24682493
const byte* key, word32 keySz,
2469-
const byte* iv, word32 ivSz)
2494+
byte* iv, word32 ivSz)
24702495
{
24712496
return IntelQaSymCipher(dev, out, in, sz,
24722497
key, keySz, iv, ivSz,

wolfssl/wolfcrypt/port/intel/quickassist.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ typedef struct IntelQaDev {
226226
CpaFlatBuffer flatBuffer;
227227
byte* authTag;
228228
word32 authTagSz;
229+
byte* iv;
230+
word32 ivSz;
229231
} cipher;
230232
#endif
231233
#if defined(QAT_ENABLE_PKI) && defined(HAVE_ECC)
@@ -345,12 +347,12 @@ WOLFSSL_LOCAL int IntelQaGetCyInstanceCount(void);
345347
WOLFSSL_LOCAL int IntelQaSymAesCbcEncrypt(struct WC_ASYNC_DEV* dev,
346348
byte* out, const byte* in, word32 sz,
347349
const byte* key, word32 keySz,
348-
const byte* iv, word32 ivSz);
350+
byte* iv, word32 ivSz);
349351
#ifdef HAVE_AES_DECRYPT
350352
WOLFSSL_LOCAL int IntelQaSymAesCbcDecrypt(struct WC_ASYNC_DEV* dev,
351353
byte* out, const byte* in, word32 sz,
352354
const byte* key, word32 keySz,
353-
const byte* iv, word32 ivSz);
355+
byte* iv, word32 ivSz);
354356
#endif /* HAVE_AES_DECRYPT */
355357
#endif /* HAVE_AES_CBC */
356358

@@ -376,11 +378,11 @@ WOLFSSL_LOCAL int IntelQaGetCyInstanceCount(void);
376378
WOLFSSL_LOCAL int IntelQaSymDes3CbcEncrypt(struct WC_ASYNC_DEV* dev,
377379
byte* out, const byte* in, word32 sz,
378380
const byte* key, word32 keySz,
379-
const byte* iv, word32 ivSz);
381+
byte* iv, word32 ivSz);
380382
WOLFSSL_LOCAL int IntelQaSymDes3CbcDecrypt(struct WC_ASYNC_DEV* dev,
381383
byte* out, const byte* in, word32 sz,
382384
const byte* key, word32 keySz,
383-
const byte* iv, word32 ivSz);
385+
byte* iv, word32 ivSz);
384386
#endif /*! NO_DES3 */
385387

386388
#ifdef WOLFSSL_SHA512

0 commit comments

Comments
 (0)