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
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
183
+
if (ret < 0) break;
184
+
}
166
185
}
167
-
wolfSSL_CTX_UseAsync(ctx, devId);
168
-
#endif /* WOLFSSL_ASYNC_CRYPT */
169
-
170
-
err = 0;
171
-
do {
172
-
#ifdef WOLFSSL_ASYNC_CRYPT
173
-
if (err == WC_PENDING_E) {
174
-
ret = wolfSSL_AsyncPoll(ssl);
175
-
if (ret < 0) { break; } else if (ret == 0) { continue; }
176
-
}
177
-
#endif
178
-
179
-
ret = wolfSSL_accept(ssl);
180
-
if (ret != SSL_SUCCESS) {
181
-
err = wolfSSL_get_error(ssl, 0);
182
-
}
183
-
} while (ret != SSL_SUCCESS && err == WC_PENDING_E);
186
+
} while (err == WC_PENDING_E);
187
+
if (ret != WOLFSSL_SUCCESS) {
188
+
err_sys("SSL_connect failed");
189
+
}
184
190
185
-
#ifdef WOLFSSL_ASYNC_CRYPT
186
-
wolfAsync_DevClose(&devId);
187
-
#endif
191
+
wolfAsync_DevClose(&devId);
188
192
```
189
193
190
194
### wolfCrypt RSA Example
191
195
192
-
```
193
-
#ifdef WOLFSSL_ASYNC_CRYPT
194
-
static int devId = INVALID_DEVID;
195
-
196
-
ret = wolfAsync_DevOpen(&devId);
197
-
if (ret != 0) {
198
-
err_sys("Async device open failed");
199
-
}
200
-
#endif /* WOLFSSL_ASYNC_CRYPT */
196
+
```c
197
+
static int devId = INVALID_DEVID;
198
+
RsaKey key;
201
199
202
-
RsaKey key;
203
-
ret = wc_InitRsaKey_ex(&key, HEAP_HINT, devId);
200
+
ret = wolfAsync_DevOpen(&devId);
201
+
if (ret != 0)
202
+
err_sys("Async device open failed");
204
203
205
-
ret = wc_RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
206
-
207
-
do {
208
-
#if defined(WOLFSSL_ASYNC_CRYPT)
204
+
wc_InitRsaKey_ex(&key, HEAP_HINT, devId);
205
+
if (ret == 0) {
206
+
ret = wc_RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
207
+
do {
209
208
ret = wc_AsyncWait(ret, &key.asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
210
-
#endif
211
-
if (ret >= 0) {
209
+
if (ret >= 0)
212
210
ret = wc_RsaPublicEncrypt(in, inLen, out, outSz, &key, &rng);
213
-
}
214
211
} while (ret == WC_PENDING_E);
215
-
if (ret < 0) {
216
-
err_sys("RsaPublicEncrypt operation failed");
217
-
}
212
+
wc_FreeRsaKey(&key);
213
+
}
218
214
219
-
#ifdef WOLFSSL_ASYNC_CRYPT
220
-
wolfAsync_DevClose(&devId);
221
-
#endif
215
+
wolfAsync_DevClose(&devId);
222
216
```
223
217
224
218
## Build Options
225
219
226
-
1. Async mult-threading can be disabled by defining `WC_NO_ASYNC_THREADING`.
220
+
1. Async multi-threading can be disabled by defining `WC_NO_ASYNC_THREADING`. This only disables internal async threading functions. You are free to use other threading APIs or paradigms in your application.
227
221
2. Software benchmarks can be disabled by defining `NO_SW_BENCH`.
228
222
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
223
4. Use `WOLFSSL_DEBUG_MEMORY` and `WOLFSSL_TRACK_MEMORY` to help debug memory issues. QAT also supports `WOLFSSL_DEBUG_MEMORY_PRINT`.
@@ -239,31 +233,53 @@ We have a full TLS client/server async examples here:
@@ -38,14 +77,14 @@ c. In `include/linux/sysdep.h:46` rename `__BYTED_ORDER` to `__BYTE_ORDER`.
38
77
39
78
2. If the CNN55XX driver is not extracted on the Linux box it can cause issues with the symbolic links in the microcode folder. Fix was to resolve the symbolic links in `./microcode`.
40
79
41
-
```
80
+
```sh
42
81
NITROX Model: 0x1200 [ CNN55XX PASS 1.0 ]
43
82
Invalid microcode
44
83
ucode_dload: failed to initialize
45
84
```
46
85
47
86
Resolve Links:
48
-
```
87
+
```sh
49
88
cd microcode
50
89
rm main_asym.out
51
90
ln -s ./build/main_ae.out ./main_asym.out
@@ -58,7 +97,7 @@ ls -s ./build/main_ssl.out ./main_ssl.out
@@ -82,7 +121,7 @@ Include the libnitrox static library:
82
121
`LDFLAGS+= ../CNN55XX-SDK/lib/libnitrox.a`
83
122
84
123
85
-
### Issues
124
+
### wolfSSL Build Issues
86
125
87
126
a. If building with debug `-g` and using an older binutils LD version 2.23 or less you may see a linker crash. Example of error: `BFD (GNU Binutils) 2.23.2 internal error, aborting at merge.c line 873 in _bfd_merged_section_offset`. Resolution is to use this in the CFLAGS `-g -fno-merge-debug-strings -fdebug-types-section`.
0 commit comments