You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
5
5
* The async.c file goes into `./wolfcrypt/src/`.
6
6
* The async.h file goes into `./wolfssl/wolfcrypt/`.
@@ -11,13 +11,22 @@ This feature is enabled using:
11
11
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`.
12
12
13
13
## 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.
15
16
16
17
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`.
17
18
18
19
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`.
19
20
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`.
21
30
22
31
## API's
23
32
@@ -46,7 +55,7 @@ Open the async device and returns an `int` device id for it.
46
55
```
47
56
int wolfAsync_DevOpenThread(int *devId, void* threadId);
48
57
```
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.
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`.
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