Skip to content

Commit 1a1f6ab

Browse files
Merge pull request #71 from dgarske/release_v5.6.4
wolfSSL Async Release v5.6.4
2 parents a65d2a6 + 16d355d commit 1a1f6ab

File tree

3 files changed

+40
-58
lines changed

3 files changed

+40
-58
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ wolfSSL Server Benchmark 16384 bytes
286286

287287
## Change Log
288288

289+
### wolfSSL Async Release v5.6.4 (Oct 30, 2023)
290+
* Fixes for support async with crypto or pk callbacks.
291+
* Rename `WC_NOT_PENDING_E` -> `WC_NO_PENDING_E`
292+
289293
### wolfSSL Async Release v5.6.3 (June 16, 2023)
290294
* Includes all wolfSSL v5.6.3 fixes. See ChangeLog.md here: https://github.com/wolfSSL/wolfssl/blob/master/ChangeLog.md#wolfssl-release-563-jun-16-2023
291295
* Add sanity check of index devId before accessing array

wolfcrypt/src/port/intel/README.md

Lines changed: 30 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Intel QuickAssist Adapter Asynchronous Support
22

3-
The wolfSSL / wolfCrypt libraries support hardware crypto acceleration using the Intel QuickAssist adapter. This software has been tested using QAT 1.6 in user space on Cent OS (Kernel 3.10.0-327.22.2.el7.x86_64) on an Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz. Intel QuickAssist is DH895xCC (BDF=03:00.0, Stepping A0, device 0 is SKU2).
3+
The wolfSSL / wolfCrypt libraries support hardware crypto acceleration using the Intel QuickAssist adapter. This software has been tested using the Intel DH8970 and DH8950 QuickAssist adapters.
44

55
## Overview
66

@@ -13,33 +13,30 @@ The asynchronous crypto files are located at `wolfcrypt/src/async.c` and `wolfss
1313

1414
## Building
1515

16-
QuickAssist drivers can be downloaded from Intel here:
17-
https://01.org/intel-quick-assist-technology/downloads
16+
1. Download Driver: The latest driver for QAT can be found here: https://www.intel.com/content/www/us/en/download/19734
1817

19-
The latest driver for QAT can be found here:
20-
https://www.intel.com/content/www/us/en/download/19734
18+
2. Notes:
2119

22-
### QAT 1.7
23-
24-
The latest QAT 1.7 Linux release:
25-
https://downloadcenter.intel.com/download/30178
26-
27-
Note: If you have the older driver installed you may need to remove it or unload the module and reboot.
20+
* If you have the older driver installed you may need to remove it or unload the module and reboot.
21+
* If you are using the QAT hardware hashing, you may need to disable the params checking, which doesn't support a last partial with 0 length source input. Code runs and works, but parameter checking will fail.
22+
Use `./configure --disable-param-check && sudo make install`
23+
* If you want to use legacy algorithms like RSA 1024 bit then Use `./configure --enable-legacy-algorithms`
24+
* Recommend not using `make -j` due to synchronization issues on dependencies.
2825

29-
1. Setup `QAT1.7` and `wolfssl` next to each other in the same folder.
26+
3. Setup `QAT` and `wolfssl` next to each other in the same folder.
3027

31-
2. Build QAT 1.7
28+
4. Build QAT Driver
3229

33-
Prerequisites:
34-
`sudo apt-get install libudev-dev`
30+
Prerequisites Ubuntu:
31+
`sudo apt-get install libudev-dev pciutils-dev g++ pkg-config libssl-dev`
3532
OR
36-
`sudo yum install systemd-devel`
33+
Prerequisites CentOS:
34+
`sudo yum install pciutils libudev-devel kernel-devel-$(uname -r) gcc openssl-devel`
3735

3836
```sh
39-
mkdir QAT1.7
40-
cd QAT1.7
41-
curl -o QAT1.7.L.4.14.0-00031.tar.gz https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz
42-
tar -xvzf QAT1.7.L.4.14.0-00031.tar.gz
37+
mkdir QAT
38+
cd QAT
39+
tar -zxof QAT.L.4.23.0-00001.tar.gz
4340
./configure
4441
sudo make install
4542
...
@@ -56,44 +53,20 @@ $ lspci -d 8086: | grep QuickAssist
5653
86:00.0 Co-processor: Intel Corporation C62x Chipset QuickAssist Technology (rev 04)
5754
```
5855

59-
If you are using the QAT hardware hashing, you may need to disable the params checking, which doesn't support a last partial with 0 length source input. Code runs and works, but parameter checking will fail.
60-
Use `./configure --disable-param-check && sudo make install`
56+
5. Build wolfSSL:
57+
58+
```sh
59+
cd ../wolfssl
60+
./configure --with-intelqa=../QAT --enable-asynccrypt
61+
make
62+
```
6163

62-
3. Change owner permissions for build output directory:
63-
64-
`sudo chown [user]:[user] build`
65-
66-
To manually startup the services you can use:
67-
68-
```
69-
sudo modprobe usdm_drv
70-
sudo service qat_service start
71-
```
72-
73-
4. Build wolfSSL:
74-
75-
```
76-
cd ../wolfssl
77-
./configure --with-intelqa=../QAT1.7 --enable-asynccrypt
78-
make
79-
```
80-
81-
82-
### QAT 1.6
83-
84-
1. Setup `QAT1.6` and `wolfssl` next to each other in the same folder.
85-
2. Build the QAT 1.6:
86-
* Run the installer using `sudo ./installer.sh`
87-
* Choose option 3 to install.
88-
* After reboot you'll need to make sure and load the qaeMemDrv.ko module. `sudo insmod ./QAT1.6/build/qaeMemDrv.ko`
89-
3. Build wolfSSL:
90-
* `./configure --enable-asynccrypt --with-intelqa=../QAT1.6 && make`
9164

9265
## Usage
9366

9467
Running wolfCrypt test and benchmark must be done with `sudo` to allow hardware access. By default the QuickAssist code uses the "SSL" process name via `QAT_PROCESS_NAME` in quickassist.h to match up to the hardware configuration.
9568

96-
Note: `sudo make check` will fail since default QAT configuration doesn't allow multiple concurrent processes to use hardware. You can run each of the make check scripts individually with sudo. The hardware configuration can be customized by editing the `QAT1.6/build/dh895xcc_qa_dev0.conf` file to allow multiple processes.
69+
Note: `sudo make check` will fail since default QAT configuration doesn't allow multiple concurrent processes to use hardware. You can run each of the make check scripts individually with sudo. The hardware configuration can be customized by editing the `QAT/build/dh895xcc_qa_dev0.conf` file to allow multiple processes.
9770

9871
Here are some build options for tuning your use:
9972

@@ -113,18 +86,18 @@ The QuickAssist v1.6 driver uses its own memory management system in `quickassis
11386
1. `USE_QAE_STATIC_MEM`: Uses a global pool for the list of allocations. This improves performance, but consumes extra up front memory. The pre-allocation size can be tuned using `QAE_USER_MEM_MAX_COUNT`.
11487
2. `USE_QAE_THREAD_LS` : Uses thread-local-storage and removes the mutex. Can improve performance in multi-threaded environment, but does use extra memory.
11588

116-
For QuickAssist v1.7 the newer usdm memory driver is used directly.
89+
For QuickAssist v1.7 or later the newer usdm memory driver is used directly.
11790

11891
### Recommended wolfSSL Build Options
11992

12093
```sh
121-
$ ./configure --with-intelqa=../QAT1.7 --enable-asynccrypt \
94+
$ ./configure --with-intelqa=../QAT --enable-asynccrypt \
12295
--enable-aesni --enable-intelasm \
12396
--enable-sp --enable-sp-asm \
12497
CFLAGS="-DWC_ASYNC_NO_HASH"
12598
```
12699

127-
* `--with-intelqa=../QAT1.7`: Enables the Intel QuickAssist mode.
100+
* `--with-intelqa=../QAT`: Enables the Intel QuickAssist mode.
128101
* `--enable-asynccrypt`: Enables asynchronous cryptography mode.
129102
* `--enable-aesni`: Enables the Intel AES-NI assembly speedups.
130103
* `--enable-intelasm`: Enables the Intel ASM (AVX/AVX2) speedups.
@@ -149,7 +122,7 @@ Multiple concurrent threads will be started based on the number of CPU's availab
149122
Intel QuickAssist DH8950 on Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz:
150123
151124
Recommended wolfSSL build options when benchmarking.
152-
$ ./configure --enable-sp --enable-sp-asm --enable-aesni --enable-intelasm --enable-intelrand --enable-keygen --enable-sha3 --enable-asynccrypt --with-intelqa=../QAT1.7 CFLAGS="-DWC_ASYNC_THRESH_NONE -DQAT_MAX_PENDING=40 -DWC_ASYNC_BENCH_THREAD_COUNT=2"
125+
$ ./configure --enable-sp --enable-sp-asm --enable-aesni --enable-intelasm --enable-intelrand --enable-keygen --enable-sha3 --enable-asynccrypt --with-intelqa=../QAT CFLAGS="-DWC_ASYNC_THRESH_NONE -DQAT_MAX_PENDING=40 -DWC_ASYNC_BENCH_THREAD_COUNT=2"
153126
$ make
154127
155128
$ sudo ./wolfcrypt/benchmark/benchmark -rsa_sign -base10 -threads 2 -print
@@ -430,7 +403,7 @@ Enable asynccrypt alone to use async simulator.
430403
## Debugging
431404

432405
To enable debug messages:
433-
`./configure --enable-asynccrypt --with-intelqa=../QAT1.7 --enable-debug --disable-shared CFLAGS="-DQAT_DEBUG" && make`
406+
`./configure --enable-asynccrypt --with-intelqa=../QAT --enable-debug --disable-shared CFLAGS="-DQAT_DEBUG" && make`
434407

435408

436409
## Support

wolfcrypt/src/port/intel/quickassist.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4050,6 +4050,8 @@ static void IntelQaDhKeyGenFree(WC_ASYNC_DEV* dev)
40504050
CpaFlatBuffer* pOut = &dev->qat.op.dh_gen.pOut;
40514051

40524052
if (opData) {
4053+
IntelQaFreeFlatBuffer(&opData->privateValueX, dev->heap);
4054+
40534055
XMEMSET(opData, 0, sizeof(CpaCyDhPhase1KeyGenOpData));
40544056
}
40554057

@@ -4130,13 +4132,16 @@ int IntelQaDhKeyGen(WC_ASYNC_DEV* dev, WC_BIGINT* p, WC_BIGINT* g,
41304132
/* setup operation data */
41314133
ret = IntelQaBigIntToFlatBuffer(p, &opData->primeP);
41324134
ret += IntelQaBigIntToFlatBuffer(g, &opData->baseG);
4135+
/* transfer control of big int buffer to opData structure */
41334136
ret += IntelQaBigIntToFlatBuffer(x, &opData->privateValueX);
4137+
/* don't let caller free x, do it in IntelQaDhKeyGenFree */
4138+
x->buf = NULL;
4139+
x->len = 0;
41344140
if (ret != 0) {
41354141
ret = BAD_FUNC_ARG; goto exit;
41364142
}
41374143
pOut->dataLenInBytes = p->len;
41384144
pOut->pData = XREALLOC(pub, p->len, dev->heap, DYNAMIC_TYPE_ASYNC_NUMA);
4139-
41404145
if (pOut->pData == NULL) {
41414146
ret = MEMORY_E; goto exit;
41424147
}

0 commit comments

Comments
 (0)