Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/dox_comments/header_files-ja/cryptocb.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

TPMベースの暗号コールバックの例については、wolfTPM src/tpm2_wrap.cのwolfTPM2_CryptoDevCb関数を参照してください。

WOLFSSL_ASYNC_CRYPTとWOLF_CRYPTO_CB_ASYNC_POLLが定義されている場合、保留中の操作を完了させるために、wolfSSL_AsyncPollおよびwolfSSL_CTX_AsyncPollからWC_ALGO_TYPE_ASYNC_POLLでコールバックが呼び出されます。この呼び出しの間、イベントキューのロックは保持されています。ハンドラは、同じWOLFSSL_CTXに対してポーリングやTLS操作を行ってはならず、同じWOLF_EVENT_QUEUEを他のいかなる方法でも使用してはなりません。デッドロックが発生します。

\return CRYPTOCB_UNAVAILABLE ソフトウェア暗号の使用にフォールバックする場合
\return 0 成功時
\return 負の値 失敗時
Expand Down
7 changes: 7 additions & 0 deletions doc/dox_comments/header_files/cryptocb.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
devIds the handler already registered stay registered and are the
caller's to clean up.

With WOLFSSL_ASYNC_CRYPT and WOLF_CRYPTO_CB_ASYNC_POLL defined, the
callback is invoked with WC_ALGO_TYPE_ASYNC_POLL from
wolfSSL_AsyncPoll and wolfSSL_CTX_AsyncPoll to complete a pending
operation. The event queue lock is held for this call. The handler
must not poll or run TLS operations on the same WOLFSSL_CTX, or use
the same WOLF_EVENT_QUEUE in any other way: that deadlocks.

\return CRYPTOCB_UNAVAILABLE to fallback to using software crypto
\return 0 for success
\return ALREADY_E if devId is already registered. A devId must be
Expand Down
6 changes: 6 additions & 0 deletions doc/dox_comments/header_files/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ int wc_strncasecmp(const char *s1, const char *s2, size_t n);
\ingroup Threading
\brief Creates a new thread.

On Zephyr the thread object and its stack are allocated with the
global heap hint wolfsslThreadHeapHint and freed with it in
wolfSSL_JoinThread. Set the hint before the first call to
wolfSSL_NewThread. It must not be changed once it has been used for
an allocation: memory would be freed to the wrong heap.

\return 0 on success
\return negative on error

Expand Down
7 changes: 1 addition & 6 deletions wolfcrypt/src/wc_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -6160,14 +6160,9 @@ char* wolfSSL_strnstr(const char* s1, const char* s2, size_t n)
if (cond == NULL)
return BAD_FUNC_ARG;

if (wc_UnLockMutex(&cond->mutex) != 0)
return BAD_MUTEX_E;

/* Never blocks, so signal with the mutex held. */
dispatch_semaphore_signal(cond->cond);

if (wc_LockMutex(&cond->mutex) != 0)
return BAD_MUTEX_E;

return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion wolfssl/wolfcrypt/cryptocb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,8 @@ WOLFSSL_API void wc_CryptoCb_SetDeviceFindCb(CryptoDevCallbackFind cb);
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WOLF_CRYPTO_CB_ASYNC_POLL)
/* Poll completion for bulk cipher ops: on WC_PENDING_E the callback saves
* the output pointers; wolfSSL_AsyncPoll() re-enters it with
* WC_ALGO_TYPE_ASYNC_POLL to finish the job and fill the buffer. */
* WC_ALGO_TYPE_ASYNC_POLL to finish the job and fill the buffer. The event
* queue lock is held for that call, so the callback must not use the queue. */
WOLFSSL_LOCAL int wc_CryptoCb_Poll(int devId);
#endif

Expand Down
2 changes: 2 additions & 0 deletions wolfssl/wolfcrypt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,8 @@ WOLFSSL_API word32 CheckRunTimeSettings(void);
k_thread_stack_t* threadStack;
} THREAD_TYPE;
#define WOLFSSL_THREAD
/* Heap hint for thread allocations. Set it before the first
* wolfSSL_NewThread call and do not change it afterwards. */
extern void* wolfsslThreadHeapHint;
/* Native Zephyr condition variable (k_condvar) built on a k_mutex; no
* POSIX pthread layer required. Only reached when !SINGLE_THREADED, so
Expand Down
Loading