Lines Matching +full:op +full:- +full:mode
4 * SPDX-License-Identifier: Apache-2.0
54 * by the op function returning, or it is conveyed by an async notification
73 enum cipher_algo algo, enum cipher_mode mode,
79 /* Register async crypto op completion callback with the driver */
88 /* Register async hash op completion callback with the driver */
95 * have four cipher mode specific (CTR, CCM, CBC ...) calls to perform the
116 api = (struct crypto_driver_api *) dev->api; in crypto_query_hwcaps()
118 tmp = api->query_hw_caps(dev); in crypto_query_hwcaps()
127 "Driver should support at least one op-type: sync/async"); in crypto_query_hwcaps()
147 * mode which may remain constant for all operations in the session. The state
157 * @param mode The cipher mode to be used in this session. e.g CBC, CTR
165 enum cipher_mode mode, in cipher_begin_session() argument
171 api = (struct crypto_driver_api *) dev->api; in cipher_begin_session()
172 ctx->device = dev; in cipher_begin_session()
173 ctx->ops.cipher_mode = mode; in cipher_begin_session()
175 flags = (ctx->flags & (CAP_OPAQUE_KEY_HNDL | CAP_RAW_KEY)); in cipher_begin_session()
180 flags = (ctx->flags & (CAP_INPLACE_OPS | CAP_SEPARATE_IO_BUFS)); in cipher_begin_session()
185 flags = (ctx->flags & (CAP_SYNC_OPS | CAP_ASYNC_OPS)); in cipher_begin_session()
190 return api->cipher_begin_session(dev, ctx, algo, mode, optype); in cipher_begin_session()
209 api = (struct crypto_driver_api *) dev->api; in cipher_free_session()
211 return api->cipher_free_session(dev, ctx); in cipher_free_session()
215 * @brief Registers an async crypto op completion callback with the driver
217 * The application can register an async crypto op completion callback handler
225 * @return 0 on success, -ENOTSUP if the driver does not support async op,
233 api = (struct crypto_driver_api *) dev->api; in cipher_callback_set()
235 if (api->cipher_async_callback_set) { in cipher_callback_set()
236 return api->cipher_async_callback_set(dev, cb); in cipher_callback_set()
239 return -ENOTSUP; in cipher_callback_set()
244 * @brief Perform single-block crypto operation (ECB cipher mode). This
247 * @param ctx Pointer to the crypto context of this op.
255 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_ECB, "ECB mode " in cipher_block_op()
256 "session invoking a different mode handler"); in cipher_block_op()
258 pkt->ctx = ctx; in cipher_block_op()
259 return ctx->ops.block_crypt_hndlr(ctx, pkt); in cipher_block_op()
265 * @param ctx Pointer to the crypto context of this op.
276 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CBC, "CBC mode " in cipher_cbc_op()
277 "session invoking a different mode handler"); in cipher_cbc_op()
279 pkt->ctx = ctx; in cipher_cbc_op()
280 return ctx->ops.cbc_crypt_hndlr(ctx, pkt, iv); in cipher_cbc_op()
284 * @brief Perform Counter (CTR) mode crypto operation.
286 * @param ctx Pointer to the crypto context of this op.
290 * Consequently ivlen = keylen - ctrlen. 'ctrlen' is
294 * (within a session context) for security. The non-IV
303 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CTR, "CTR mode " in cipher_ctr_op()
304 "session invoking a different mode handler"); in cipher_ctr_op()
306 pkt->ctx = ctx; in cipher_ctr_op()
307 return ctx->ops.ctr_crypt_hndlr(ctx, pkt, iv); in cipher_ctr_op()
311 * @brief Perform Counter with CBC-MAC (CCM) mode crypto operation
313 * @param ctx Pointer to the crypto context of this op.
325 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_CCM, "CCM mode " in cipher_ccm_op()
326 "session invoking a different mode handler"); in cipher_ccm_op()
328 pkt->pkt->ctx = ctx; in cipher_ccm_op()
329 return ctx->ops.ccm_crypt_hndlr(ctx, pkt, nonce); in cipher_ccm_op()
333 * @brief Perform Galois/Counter Mode (GCM) crypto operation
335 * @param ctx Pointer to the crypto context of this op.
347 __ASSERT(ctx->ops.cipher_mode == CRYPTO_CIPHER_MODE_GCM, "GCM mode " in cipher_gcm_op()
348 "session invoking a different mode handler"); in cipher_gcm_op()
350 pkt->pkt->ctx = ctx; in cipher_gcm_op()
351 return ctx->ops.gcm_crypt_hndlr(ctx, pkt, nonce); in cipher_gcm_op()
391 api = (struct crypto_driver_api *) dev->api; in hash_begin_session()
392 ctx->device = dev; in hash_begin_session()
394 flags = (ctx->flags & (CAP_INPLACE_OPS | CAP_SEPARATE_IO_BUFS)); in hash_begin_session()
399 flags = (ctx->flags & (CAP_SYNC_OPS | CAP_ASYNC_OPS)); in hash_begin_session()
405 return api->hash_begin_session(dev, ctx, algo); in hash_begin_session()
424 api = (struct crypto_driver_api *) dev->api; in hash_free_session()
426 return api->hash_free_session(dev, ctx); in hash_free_session()
440 * @return 0 on success, -ENOTSUP if the driver does not support async op,
448 api = (struct crypto_driver_api *) dev->api; in hash_callback_set()
450 if (api->hash_async_callback_set) { in hash_callback_set()
451 return api->hash_async_callback_set(dev, cb); in hash_callback_set()
454 return -ENOTSUP; in hash_callback_set()
461 * @param ctx Pointer to the hash context of this op.
468 pkt->ctx = ctx; in hash_compute()
470 return ctx->hash_hndlr(ctx, pkt, true); in hash_compute()
480 * @param ctx Pointer to the hash context of this op.
487 pkt->ctx = ctx; in hash_update()
489 return ctx->hash_hndlr(ctx, pkt, false); in hash_update()