From 696ddc9b71963d59bd136f26d39e82107e9834a0 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 20 Dec 2017 09:08:01 -0800 Subject: [PATCH] Added `wolfSSL_CTX_SetDevId` and `wolfSSL_SetDevId` to allow setting `devId`. Use #define macro to map the original async `wolfSSL_CTX_UseAsync` and `wolfSSL_UseAsync` API's to the new ones. --- src/ssl.c | 12 +++--------- wolfssl/ssl.h | 6 ++++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index a19257bc4..a959b154f 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1771,10 +1771,9 @@ int wolfSSL_mcast_read(WOLFSSL* ssl, word16* id, void* data, int sz) #endif /* WOLFSSL_MULTICAST */ -#ifdef WOLFSSL_ASYNC_CRYPT -/* let's use async hardware, WOLFSSL_SUCCESS on ok */ -int wolfSSL_UseAsync(WOLFSSL* ssl, int devId) +/* helpers to set the device id, WOLFSSL_SUCCESS on ok */ +int wolfSSL_SetDevId(WOLFSSL* ssl, int devId) { if (ssl == NULL) return BAD_FUNC_ARG; @@ -1783,10 +1782,7 @@ int wolfSSL_UseAsync(WOLFSSL* ssl, int devId) return WOLFSSL_SUCCESS; } - - -/* let's use async hardware, WOLFSSL_SUCCESS on ok */ -int wolfSSL_CTX_UseAsync(WOLFSSL_CTX* ctx, int devId) +int wolfSSL_CTX_SetDevId(WOLFSSL_CTX* ctx, int devId) { if (ctx == NULL) return BAD_FUNC_ARG; @@ -1796,8 +1792,6 @@ int wolfSSL_CTX_UseAsync(WOLFSSL_CTX* ctx, int devId) return WOLFSSL_SUCCESS; } -#endif /* WOLFSSL_ASYNC_CRYPT */ - /* helpers to get device id and heap */ int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl) { diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 7aa6eaf10..b5ed5b811 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -1880,8 +1880,10 @@ WOLFSSL_API int wolfSSL_CTX_UseClientSuites(WOLFSSL_CTX* ctx); WOLFSSL_API int wolfSSL_UseClientSuites(WOLFSSL* ssl); /* async additions */ -WOLFSSL_API int wolfSSL_UseAsync(WOLFSSL*, int devId); -WOLFSSL_API int wolfSSL_CTX_UseAsync(WOLFSSL_CTX*, int devId); +#define wolfSSL_UseAsync wolfSSL_SetDevId +#define wolfSSL_CTX_UseAsync wolfSSL_CTX_SetDevId +WOLFSSL_API int wolfSSL_SetDevId(WOLFSSL*, int devId); +WOLFSSL_API int wolfSSL_CTX_SetDevId(WOLFSSL_CTX*, int devId); /* helpers to get device id and heap */ WOLFSSL_API int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl);