Lines Matching +full:sync +full:- +full:mode
4 * SPDX-License-Identifier: Apache-2.0
71 enum cipher_algo algo, enum cipher_mode mode,
93 * have four cipher mode specific (CTR, CCM, CBC ...) calls to perform the
114 api = (struct crypto_driver_api *) dev->api; in crypto_query_hwcaps()
116 tmp = api->query_hw_caps(dev); in crypto_query_hwcaps()
125 "Driver should support at least one op-type: sync/async"); in crypto_query_hwcaps()
145 * mode which may remain constant for all operations in the session. The state
155 * @param mode The cipher mode to be used in this session. e.g CBC, CTR
163 enum cipher_mode mode, in cipher_begin_session() argument
169 api = (struct crypto_driver_api *) dev->api; in cipher_begin_session()
170 ctx->device = dev; in cipher_begin_session()
171 ctx->ops.cipher_mode = mode; in cipher_begin_session()
173 flags = (ctx->flags & (CAP_OPAQUE_KEY_HNDL | CAP_RAW_KEY)); in cipher_begin_session()
178 flags = (ctx->flags & (CAP_INPLACE_OPS | CAP_SEPARATE_IO_BUFS)); in cipher_begin_session()
183 flags = (ctx->flags & (CAP_SYNC_OPS | CAP_ASYNC_OPS)); in cipher_begin_session()
184 __ASSERT(flags != 0U, "sync/async type missing"); in cipher_begin_session()
186 "conflicting options for sync/async"); in cipher_begin_session()
188 return api->cipher_begin_session(dev, ctx, algo, mode, optype); in cipher_begin_session()
207 api = (struct crypto_driver_api *) dev->api; in cipher_free_session()
209 return api->cipher_free_session(dev, ctx); in cipher_free_session()
223 * @return 0 on success, -ENOTSUP if the driver does not support async op,
231 api = (struct crypto_driver_api *) dev->api; in cipher_callback_set()
233 if (api->cipher_async_callback_set) { in cipher_callback_set()
234 return api->cipher_async_callback_set(dev, cb); in cipher_callback_set()
237 return -ENOTSUP; in cipher_callback_set()
242 * @brief Perform single-block crypto operation (ECB cipher mode). This
253 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_ECB, "ECB mode " in cipher_block_op()
254 "session invoking a different mode handler"); in cipher_block_op()
256 pkt->ctx = ctx; in cipher_block_op()
257 return ctx->ops.block_crypt_hndlr(ctx, pkt); in cipher_block_op()
274 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CBC, "CBC mode " in cipher_cbc_op()
275 "session invoking a different mode handler"); in cipher_cbc_op()
277 pkt->ctx = ctx; in cipher_cbc_op()
278 return ctx->ops.cbc_crypt_hndlr(ctx, pkt, iv); in cipher_cbc_op()
282 * @brief Perform Counter (CTR) mode crypto operation.
288 * Consequently ivlen = keylen - ctrlen. 'ctrlen' is
292 * (within a session context) for security. The non-IV
301 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CTR, "CTR mode " in cipher_ctr_op()
302 "session invoking a different mode handler"); in cipher_ctr_op()
304 pkt->ctx = ctx; in cipher_ctr_op()
305 return ctx->ops.ctr_crypt_hndlr(ctx, pkt, iv); in cipher_ctr_op()
309 * @brief Perform Counter with CBC-MAC (CCM) mode crypto operation
323 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CCM, "CCM mode " in cipher_ccm_op()
324 "session invoking a different mode handler"); in cipher_ccm_op()
326 pkt->pkt->ctx = ctx; in cipher_ccm_op()
327 return ctx->ops.ccm_crypt_hndlr(ctx, pkt, nonce); in cipher_ccm_op()
331 * @brief Perform Galois/Counter Mode (GCM) crypto operation
345 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_GCM, "GCM mode " in cipher_gcm_op()
346 "session invoking a different mode handler"); in cipher_gcm_op()
348 pkt->pkt->ctx = ctx; in cipher_gcm_op()
349 return ctx->ops.gcm_crypt_hndlr(ctx, pkt, nonce); in cipher_gcm_op()
389 api = (struct crypto_driver_api *) dev->api; in hash_begin_session()
390 ctx->device = dev; in hash_begin_session()
392 flags = (ctx->flags & (CAP_INPLACE_OPS | CAP_SEPARATE_IO_BUFS)); in hash_begin_session()
397 flags = (ctx->flags & (CAP_SYNC_OPS | CAP_ASYNC_OPS)); in hash_begin_session()
398 __ASSERT(flags != 0U, "sync/async type missing"); in hash_begin_session()
400 "conflicting options for sync/async"); in hash_begin_session()
403 return api->hash_begin_session(dev, ctx, algo); in hash_begin_session()
422 api = (struct crypto_driver_api *) dev->api; in hash_free_session()
424 return api->hash_free_session(dev, ctx); in hash_free_session()
438 * @return 0 on success, -ENOTSUP if the driver does not support async op,
446 api = (struct crypto_driver_api *) dev->api; in hash_callback_set()
448 if (api->hash_async_callback_set) { in hash_callback_set()
449 return api->hash_async_callback_set(dev, cb); in hash_callback_set()
452 return -ENOTSUP; in hash_callback_set()
466 pkt->ctx = ctx; in hash_compute()
468 return ctx->hash_hndlr(ctx, pkt, true); in hash_compute()
485 pkt->ctx = ctx; in hash_update()
487 return ctx->hash_hndlr(ctx, pkt, false); in hash_update()