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.

This commit is contained in:
David Garske
2017-12-20 09:08:01 -08:00
parent c0f2a0c77b
commit 696ddc9b71
2 changed files with 7 additions and 11 deletions

View File

@ -1771,10 +1771,9 @@ int wolfSSL_mcast_read(WOLFSSL* ssl, word16* id, void* data, int sz)
#endif /* WOLFSSL_MULTICAST */ #endif /* WOLFSSL_MULTICAST */
#ifdef WOLFSSL_ASYNC_CRYPT
/* let's use async hardware, WOLFSSL_SUCCESS on ok */ /* helpers to set the device id, WOLFSSL_SUCCESS on ok */
int wolfSSL_UseAsync(WOLFSSL* ssl, int devId) int wolfSSL_SetDevId(WOLFSSL* ssl, int devId)
{ {
if (ssl == NULL) if (ssl == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
@ -1783,10 +1782,7 @@ int wolfSSL_UseAsync(WOLFSSL* ssl, int devId)
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }
int wolfSSL_CTX_SetDevId(WOLFSSL_CTX* ctx, int devId)
/* let's use async hardware, WOLFSSL_SUCCESS on ok */
int wolfSSL_CTX_UseAsync(WOLFSSL_CTX* ctx, int devId)
{ {
if (ctx == NULL) if (ctx == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
@ -1796,8 +1792,6 @@ int wolfSSL_CTX_UseAsync(WOLFSSL_CTX* ctx, int devId)
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }
#endif /* WOLFSSL_ASYNC_CRYPT */
/* helpers to get device id and heap */ /* helpers to get device id and heap */
int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl) int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{ {

View File

@ -1880,8 +1880,10 @@ WOLFSSL_API int wolfSSL_CTX_UseClientSuites(WOLFSSL_CTX* ctx);
WOLFSSL_API int wolfSSL_UseClientSuites(WOLFSSL* ssl); WOLFSSL_API int wolfSSL_UseClientSuites(WOLFSSL* ssl);
/* async additions */ /* async additions */
WOLFSSL_API int wolfSSL_UseAsync(WOLFSSL*, int devId); #define wolfSSL_UseAsync wolfSSL_SetDevId
WOLFSSL_API int wolfSSL_CTX_UseAsync(WOLFSSL_CTX*, int devId); #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 */ /* helpers to get device id and heap */
WOLFSSL_API int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl); WOLFSSL_API int wolfSSL_CTX_GetDevId(WOLFSSL_CTX* ctx, WOLFSSL* ssl);