Skip to content

Commit 97e34ac

Browse files
committed
Updates to the async README. Added change log.
1 parent 975a30a commit 97e34ac

1 file changed

Lines changed: 163 additions & 72 deletions

File tree

README-async.md

Lines changed: 163 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# wolfSSL / wolfCrypt Asynchronous Support
22

3-
This respository contains the async.c and async.h files required for using Asynchronous Cryptography with the wolfSSL library.
3+
This repository contains the async.c and async.h files required for using Asynchronous Cryptography with the wolfSSL library.
44

55
* The async.c file goes into `./wolfcrypt/src/`.
66
* The async.h file goes into `./wolfssl/wolfcrypt/`.
@@ -11,13 +11,22 @@ This feature is enabled using:
1111
The async crypt simulator is enabled by default if the hardware does not support async crypto or it can be manually enabled using `#define WOLFSSL_ASYNC_CRYPT_TEST`.
1212

1313
## Design
14-
Each crypto alorithm has its own `WC_ASYNC_DEV` structure, which contains a `WOLF_EVENT`, local crypto context and local hardware context.
14+
15+
Each crypto algorithm has its own `WC_ASYNC_DEV` structure, which contains a `WOLF_EVENT`, local crypto context and local hardware context.
1516

1617
For SSL/TLS the `WOLF_EVENT` context is the `WOLFSSL*` and the type is `WOLF_EVENT_TYPE_ASYNC_WOLFSSL`. For wolfCrypt operations the `WOLF_EVENT` context is the `WC_ASYNC_DEV*` and the type is `WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT`.
1718

1819
A generic event system has been created using a `WOLF_EVENT` structure when `HAVE_WOLF_EVENT` is defined. The event structure resides in the `WC_ASYNC_DEV`.
1920

20-
The asyncronous crypto system is modeled after epoll. The implementation uses `wolfSSL_AsyncPoll` or `wolfSSL_CTX_AsyncPoll` to check if any async operations are complete.
21+
The asynchronous crypto system is modeled after epoll. The implementation uses `wolfSSL_AsyncPoll` or `wolfSSL_CTX_AsyncPoll` to check if any async operations are complete.
22+
23+
24+
## Hardware
25+
26+
Supported hardware:
27+
28+
* Intel QuickAssist with QAT 1.6 or QAT 1.7 driver. See README.md in `wolfcrypt/src/port/intel/README.md`.
29+
* Cavium Nitrox III and V. See README.md in `wolfcrypt/src/port/cavium/README.md`.
2130

2231
## API's
2332

@@ -46,7 +55,7 @@ Open the async device and returns an `int` device id for it.
4655
```
4756
int wolfAsync_DevOpenThread(int *devId, void* threadId);
4857
```
49-
Opens the async device for a specific thread. A crypto instance is assigned and thread assinity set.
58+
Opens the async device for a specific thread. A crypto instance is assigned and thread affinity set.
5059

5160
### ```wolfAsync_DevClose```
5261
```
@@ -143,8 +152,9 @@ void wolfAsync_HardwareStop(void);
143152

144153
Stops hardware if internal `--start_count == 0`.
145154

146-
# Examples
147-
## TLS Server Example
155+
## Examples
156+
157+
### TLS Server Example
148158

149159
```
150160
#ifdef WOLFSSL_ASYNC_CRYPT
@@ -177,7 +187,7 @@ Stops hardware if internal `--start_count == 0`.
177187
#endif
178188
```
179189

180-
## wolfCrypt Example
190+
### wolfCrypt RSA Example
181191

182192
```
183193
#ifdef WOLFSSL_ASYNC_CRYPT
@@ -211,39 +221,26 @@ Stops hardware if internal `--start_count == 0`.
211221
#endif
212222
```
213223

214-
## Benchmarks
224+
## Build Options
215225

216-
```
217-
./configure --enable-certgen --enable-certext --enable-keygen --enable-certreq --enable-ecc --enable-supportedcurves --enable-asynccrypt --enable-aesgcm --enable-intelasm --enable-aesni --enable-des3 --enable-sha224 --enable-opensslextra --enable-psk --with-intelqa=../QAT1.6 C_EXTRA_FLAGS="-DWC_ASYNC_THRESH_NONE"
218-
make
219-
sudo ./wolfcrypt/benchmark/benchmark
226+
1. Async mult-threading can be disabled by defining `WC_NO_ASYNC_THREADING`.
227+
2. Software benchmarks can be disabled by defining `NO_SW_BENCH`.
228+
3. The `WC_ASYNC_THRESH_NONE` define can be used to disable the cipher thresholds, which are tunable values to determine at what size hardware should be used vs. software.
229+
4. Use `WOLFSSL_DEBUG_MEMORY` and `WOLFSSL_TRACK_MEMORY` to help debug memory issues. QAT also supports `WOLFSSL_DEBUG_MEMORY_PRINT`.
220230

221-
IntelQA: Instances 6
222-
wolfCrypt Benchmark (min 1.0 sec each)
223-
CPUs: 8
224-
225-
```
226-
227-
# Build Options
228-
229-
1. `WC_NO_ASYNC_THREADING`: Disables async mult-threading.
230-
2. `WC_ASYNC_THREAD_BIND`: Enables binding of thread to crypto hardware instance.
231-
2. `WC_ASYNC_THRESH_NONE` Disables the cipher thresholds, which are tunable values to determine at what size hardware should be used vs. software.
232-
3. `NO_SW_BENCH`: Disables sofware benchmarks so only hardware results are returned.
233-
4. Use `WOLFSSL_DEBUG_MEMORY` and `WOLFSSL_TRACK_MEMORY` to help debug memory issues.
234231

232+
## References
235233

236-
# References
237-
238-
## TLS Client/Server Async Example
234+
### TLS Client/Server Async Example
239235

240236
We have a full TLS client/server async examples here:
241237

242238
* [https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/server-tls-epoll-perf.c](https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/server-tls-epoll-perf.c)
243239

244240
* [https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/client-tls-perf.c](https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/client-tls-perf.c)
245241

246-
### Usage
242+
#### Usage
243+
247244
```
248245
git clone git@github.com:wolfSSL/wolfssl-examples.git
249246
cd wolfssl-examples
@@ -269,46 +266,140 @@ wolfSSL Client Benchmark 16384 bytes
269266
Write : 74.535 ms ( 20.963 MBps)
270267
```
271268

272-
# Installation
273-
274-
If using wolfAsyncCrypt repo directly some useful commands to setup links to wolfssl in relative directory:
275-
276-
## Async Files
277-
```
278-
rm wolfcrypt/src/async.c
279-
ln -s ../../../wolfAsyncCrypt/wolfcrypt/src/async.c ./wolfcrypt/src/async.c
280-
rm wolfssl/wolfcrypt/async.h
281-
ln -s ../../../wolfAsyncCrypt/wolfssl/wolfcrypt/async.h ./wolfssl/wolfcrypt/async.h
282-
```
283-
284-
## Intel QuickAssist Port Files
285-
```
286-
rm wolfcrypt/src/port/intel/quickassist.c
287-
ln -s ../../../../../wolfAsyncCrypt/wolfcrypt/src/port/intel/quickassist.c ./wolfcrypt/src/port/intel/quickassist.c
288-
rm wolfcrypt/src/port/intel/quickassist_mem.c
289-
ln -s ../../../../../wolfAsyncCrypt/wolfcrypt/src/port/intel/quickassist_mem.c ./wolfcrypt/src/port/intel/quickassist_mem.c
290-
291-
mkdir wolfssl/wolfcrypt/port/intel
292-
rm wolfssl/wolfcrypt/port/intel/quickassist.h
293-
ln -s ../../../../../wolfAsyncCrypt/wolfssl/wolfcrypt/port/intel/quickassist.h ./wolfssl/wolfcrypt/port/intel/quickassist.h
294-
rm wolfssl/wolfcrypt/port/intel/quickassist_mem.h
295-
ln -s ../../../../../wolfAsyncCrypt/wolfssl/wolfcrypt/port/intel/quickassist_mem.h ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
296-
297-
rm wolfcrypt/src/port/intel/README.md
298-
ln -s ../../../../../wolfAsyncCrypt/wolfcrypt/src/port/intel/README.md ./wolfcrypt/src/port/intel/README.md
299-
```
300-
301-
## Cavium Nitrox Port Files
302-
```
303-
rm wolfcrypt/src/port/cavium/cavium_nitrox.c
304-
ln -s ../../../../../wolfAsyncCrypt/wolfcrypt/src/port/cavium/cavium_nitrox.c ./wolfcrypt/src/port/cavium/cavium_nitrox.c
305-
306-
mkdir wolfssl/wolfcrypt/port/cavium
307-
rm ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
308-
ln -s ../../../../../wolfAsyncCrypt/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
309-
310-
rm wolfcrypt/src/port/cavium/README.md
311-
ln -s ../../../../../wolfAsyncCrypt/wolfcrypt/src/port/cavium/README.md ./wolfcrypt/src/port/cavium/README.md
312-
```
313-
314-
Then a wolfssl `make dist` will include actual files.
269+
## Change Log
270+
271+
### wolfSSL Async Release v3.15.7 (12/27/2018)
272+
273+
* Fixes for various analysis warnings (https://github.com/wolfSSL/wolfssl/pull/2003).
274+
* Added QAT v1.7 driver support.
275+
* Added QAT SHA-3 support.
276+
* Added QAT RSA Key Generation support.
277+
* Added support for new usdm memory driver.
278+
* Added support for detecting QAT version and features.
279+
* Added `QAT_ENABLE_RNG` option to disable QAT TRNG/DRBG.
280+
* Added alternate hashing method to cache all updates (avoids using partial updates).
281+
282+
### wolfSSL Async Release v3.15.5 (11/09/2018)
283+
284+
* Fixes for various analysis warnings (https://github.com/wolfSSL/wolfssl/pull/1918).
285+
* Fix for QAT possible double free case where `ctx->symCtx` is not trapped.
286+
* Improved QAT debug messages when using `QAT_DEBUG`.
287+
* Fix for QAT RNG to allow zero length. This resolves PSS case where `wc_RNG_GenerateBlock` is called for saltLen == 0.
288+
289+
290+
### wolfSSL Async Release v3.15.3 (06/20/2018)
291+
292+
* Fixes for fsantize tests with Cavium Nitrox V.
293+
* Removed typedef for `CspHandle`, since its already defined.
294+
* Fixes for a couple of fsanitize warnings.
295+
* Fix for possible leak with large request to `IntelQaDrbg`.
296+
297+
### wolfSSL Async Release v3.14.4 (04/13/2018)
298+
299+
* Added Nitrox V ECC.
300+
* Added Nitrox V SHA-224 and SHA-3
301+
* Added Nitrox V AES GCM
302+
* Added Nitrox III SHA2 384/512 support for HMAC.
303+
* Added error code handling for signature check failure.
304+
* Added error translate for `ERR_PKCS_DECRYPT_INCORRECT`
305+
* Added useful `WOLFSSL_NITROX_DEBUG` and show count for pending checks.
306+
* Cleanup of Nitrox symmetric processing to use single while loops.
307+
* Cleanup to only include some headers in cavium_nitrox.c port.
308+
* Fixes for building against Nitrox III and V SDK.
309+
* Updates to README.md with required CFLAGS/LDFLAGS when building without ./configure.
310+
* Fix for Intel QuickAssist HMAC to use software for unsupported hash algorithms.
311+
312+
313+
### wolfSSL Async Release v3.12.2 (10/22/2017)
314+
315+
* Fix for HMAC QAT when block size aligned. The QAT HMAC final without any buffers will fail incorrectly (bug in QAT 1.6).
316+
* Nitrox fix for rename of `ContextType` to `context_type_t`. Updates to Nitrox README.md.
317+
* Workaround for `USE_QAE_THREAD_LS` issue with realloc from a different thread.
318+
* Fix for hashing to allow zero length. This resolves issue with new empty hash tests.
319+
* Fix bug with blocking async where operation was being free'd before completion. Set freeFunc prior to performing operation and check ret code in poll.
320+
* Fix leak with cipher symmetric context close.
321+
* Fix QAT_DEBUG partialState offset.
322+
* Fixes for symmetric context caching.
323+
* Refactored async event initialization so its done prior to making possible async calls.
324+
* Fix to resolve issue with QAT callbacks and multi-threading.
325+
* The cleanup is now handled in polling function and the event is only marked done from the polling thread that matches the originating thread.
326+
* Fix possible mem leak with multiple threads `g_qatEcdhY` and `g_qatEcdhCofactor1`.
327+
* Fix the block polling to use `ret` instead of `status`.
328+
* Change order of `IntelQaDevClear` and setting `event->ret`.
329+
* Fixes to better handle threading with async.
330+
* Refactor of async event state.
331+
* Refactor to initialize event prior to operation (in case it finishes before adding to queue).
332+
* Fixes issues with AES GCM decrypt that can corrupt up to authTag bytes at end of output buffer provided.
333+
* Optimize the Hmac struct to replace keyRaw with ipad.
334+
* Enhancement to allow re-use of the symmetric context for ciphers.
335+
* Fixes for QuickAssist (QAT) multi-threading. Fix to not set return code until after callback cleanup.
336+
* Disable thread binding to specific CPU by default (enabled now with `WC_ASYNC_THREAD_BIND`).
337+
* Added optional define `QAT_USE_POLLING_CHECK ` to have only one thread polling at a time (not required and doesn't improve performance).
338+
* Reduced default QAT_MAX_PENDING for benchmark to 15 (120/num_threads).
339+
* Fix for IntelQaDrbg to handle buffer over 0xFFFF in length.
340+
* Added working DRBG and TRNG implementations for QAT.
341+
* Fix to set callback status after ret and output have been set. Cleanup of the symmetric context.
342+
* Updates to support refactored dynamic types.
343+
* Fix for QAT symmetric to allow NULL authTag.
344+
* Fix GCC 7 build warning with braces.
345+
* Cleanup formatting.
346+
347+
### wolfSSL Async Release v3.11.0 (05/05/2017)
348+
349+
* Fixes for Cavium Nitrox III/V.
350+
- Fix with possible crash when using a request Id that is already complete, due to partial submissions not marking event done.
351+
- Improvements to max buffer lengths.
352+
- Fixes to handle various return code patterns with CNN55XX-SDK.
353+
- All Nitrox V tests and benchmarks pass. Bench: RSA 2048-bit public 336,674 ops/sec and private (CRT) 66,524 ops/sec.
354+
355+
* Intel QuickAssist support and various async fixes/improvements:
356+
- Added support for Intel QuickAssist v1.6 driver with QuickAssist 8950 hardware
357+
- Added QAE memory option to use static memory list instead of dynamic list using `USE_QAE_STATIC_MEM`.
358+
- Added tracking of deallocs and made the values signed long.
359+
- Improved code for wolf header check and expanded to 16-byte alignment for performance improvement with TLS.
360+
- Added ability to override limit dev access parameters and all configurable QAT fields.
361+
- Added async simulator tests for DH, DES3 CBC and AES CBC/GCM.
362+
- Rename AsyncCryptDev to WC_ASYNC_DEV.
363+
- Refactor to move WOLF_EVENT into WC_ASYNC_DEV.
364+
- Refactor the async struct/enum names to use WC_ naming.
365+
- Refactor of the async event->context to use WOLF_EVENT_TYPE_ASYNC_WOLFSSL or WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT to indicate the type of context pointer.
366+
- Added flag to WOLF_EVENT which is used to determine if the async complete should call into operation again or goto next `WC_ASYNC_FLAG_CALL_AGAIN`.
367+
- Cleanup of the "wolfAsync_DevCtxInit" calls to make sure asyncDev is always cleared if invalid device id is used.
368+
- Eliminated WOLFSSL_ASYNC_CRYPT_STATE.
369+
- Removed async event type WOLF_EVENT_TYPE_ASYNC_ANY.
370+
- Enable the random extra delay option by default for simulator as it helps catch bugs.
371+
- Cleanup for async free to also check marker.
372+
- Refactor of the async wait and handle to reduce duplicate code.
373+
- Added async simulator test for RSA make key.
374+
- Added WC_ASYNC_THRESH_NONE to allow bypass of threshold for testing
375+
- Added static numbers for the async sim test types, for easier debugging of the “testDev->type” value.
376+
- Populate heap hint into asyncDev struct.
377+
- Enhancement to cache the asyncDev to improve poll performance.
378+
- Added async threading helpers and new wolfAsync_DevOpenThread.
379+
- Added WC_NO_ASYNC_THREADING to prevent async threading.
380+
- Added new API “wc_AsyncGetNumberOfCpus” for getting number of CPU’s.
381+
- Added new “wc_AsyncThreadYield” API.
382+
- Added WOLF_ASYNC_MAX_THREADS.
383+
- Added new API for wolfAsync_DevCopy.
384+
- Fix to make sure an async init failure sets the deviceId to INVALID_DEVID.
385+
- Fix for building with async threading support on Mac.
386+
- Fix for using simulator so it supports multiple threads.
387+
388+
* Moved Intel QuickAssist and Cavium Nitrox III/V code into async repo.
389+
* Added new WC_ASYNC_NO_* options to allow disabling of individual async algorithms.
390+
- New defines are: WC_ASYNC_NO_CRYPT, WC_ASYNC_NO_PKI and WC_ASYNC_NO_HASH.
391+
- Additionally each algorithm has a WC_ASYNC_NO_[ALGO] define.
392+
393+
394+
### wolfSSL Async Release v3.9.8 (07/25/2016)
395+
396+
* Asynchronous wolfCrypt and Cavium Nitrox V support.
397+
398+
### wolfSSL Async Release v3.9.0 (03/04/2016)
399+
400+
* Initial version with async simulator and README.md.
401+
402+
403+
## Support
404+
405+
For questions email wolfSSL support at support@wolfssl.com

0 commit comments

Comments
 (0)