|
57 | 57 | #include <wolfssl/ssl.h> |
58 | 58 | #include <wolfssl/wolfio.h> |
59 | 59 | #include <wolfssl/wolfcrypt/error-crypt.h> |
| 60 | +#ifdef WOLF_CRYPTO_CB |
| 61 | +#include <wolfssl/wolfcrypt/cryptocb.h> |
| 62 | +#endif |
60 | 63 | #include <wolfssl/certs_test.h> |
61 | 64 | #include "examples/async/async_tls.h" |
62 | 65 |
|
@@ -191,6 +194,9 @@ int server_async_test(int argc, char** argv) |
191 | 194 | int wouldblock_count = 0; |
192 | 195 | int pending_count = 0; |
193 | 196 | #endif |
| 197 | +#ifdef WOLF_CRYPTO_CB |
| 198 | + AsyncTlsCryptoCbCtx cryptoCbCtx; |
| 199 | +#endif |
194 | 200 | #ifdef WOLFSSL_STATIC_MEMORY |
195 | 201 | static byte memory[300000]; |
196 | 202 | static byte memoryIO[34500]; |
@@ -284,6 +290,13 @@ int server_async_test(int argc, char** argv) |
284 | 290 | goto exit; |
285 | 291 | } |
286 | 292 | #endif |
| 293 | +#ifdef WOLF_CRYPTO_CB |
| 294 | + XMEMSET(&cryptoCbCtx, 0, sizeof(cryptoCbCtx)); |
| 295 | + if (wc_CryptoCb_RegisterDevice(devId, AsyncTlsCryptoCb, &cryptoCbCtx) != 0) { |
| 296 | + fprintf(stderr, "ERROR: wc_CryptoCb_RegisterDevice failed\n"); |
| 297 | + goto exit; |
| 298 | + } |
| 299 | +#endif |
287 | 300 |
|
288 | 301 | /* Create and initialize WOLFSSL_CTX */ |
289 | 302 | #ifdef WOLFSSL_STATIC_MEMORY |
@@ -613,6 +626,9 @@ int server_async_test(int argc, char** argv) |
613 | 626 | } |
614 | 627 | if (ctx) |
615 | 628 | wolfSSL_CTX_free(ctx); |
| 629 | +#ifdef WOLF_CRYPTO_CB |
| 630 | + wc_CryptoCb_UnRegisterDevice(devId); |
| 631 | +#endif |
616 | 632 | #ifdef WOLFSSL_ASYNC_CRYPT |
617 | 633 | if (devId != INVALID_DEVID) { |
618 | 634 | wolfAsync_DevClose(&devId); |
|
0 commit comments