Lines Matching +full:no +full:- +full:enum

4  * SPDX-License-Identifier: Apache-2.0
27 enum ncl_status (*init_context)(void *ctx);
29 enum ncl_status (*finalize_context)(void *ctx);
31 enum ncl_status (*init)(void *ctx);
33 * Prepare the context buffer for a SHA calculation - by loading the
34 * initial SHA-256/384/512 parameters.
36 enum ncl_status (*start)(void *ctx, enum ncl_sha_type type);
41 * in data buffer should no longer effect the SHA calculation.
43 enum ncl_status (*update)(void *ctx, const uint8_t *data, uint32_t Len);
45 enum ncl_status (*finish)(void *ctx, uint8_t *hashDigest);
47 enum ncl_status (*calc)(void *ctx, enum ncl_sha_type type, const uint8_t *data,
50 enum ncl_status (*power)(void *ctx, uint8_t enable);
51 /* Reset the SHA hardware and terminate any in-progress operations. */
52 enum ncl_status (*reset)(void *ctx);
64 enum hash_algo algo;
81 return -1; in npcx_get_unused_session_index()
85 enum ncl_status ret; in npcx_sha_compute()
86 struct npcx_sha_session *npcx_session = ctx->drv_sessn_state; in npcx_sha_compute()
87 struct npcx_sha_context *npcx_ctx = &npcx_session->npcx_sha_ctx; in npcx_sha_compute()
88 enum ncl_sha_type sha_type; in npcx_sha_compute()
90 switch (npcx_session->algo) { in npcx_sha_compute()
101 LOG_ERR("Unexpected algo: %d", npcx_session->algo); in npcx_sha_compute()
102 return -EINVAL; in npcx_sha_compute()
105 if (!ctx->started) { in npcx_sha_compute()
106 ret = NPCX_NCL_SHA->start(npcx_ctx->handle, sha_type); in npcx_sha_compute()
109 return -EINVAL; in npcx_sha_compute()
111 ctx->started = true; in npcx_sha_compute()
114 if (pkt->in_len != 0) { in npcx_sha_compute()
115 ret = NPCX_NCL_SHA->update(npcx_ctx->handle, pkt->in_buf, pkt->in_len); in npcx_sha_compute()
118 ctx->started = false; in npcx_sha_compute()
119 return -EINVAL; in npcx_sha_compute()
124 ctx->started = false; in npcx_sha_compute()
125 ret = NPCX_NCL_SHA->finish(npcx_ctx->handle, pkt->out_buf); in npcx_sha_compute()
128 return -EINVAL; in npcx_sha_compute()
136 enum hash_algo algo) in npcx_hash_session_setup()
141 if (ctx->flags & ~(NPCX_HASH_CAPS_SUPPORT)) { in npcx_hash_session_setup()
143 return -EINVAL; in npcx_hash_session_setup()
149 return -EINVAL; in npcx_hash_session_setup()
154 LOG_ERR("No free session for now"); in npcx_hash_session_setup()
155 return -ENOSPC; in npcx_hash_session_setup()
160 ctx->drv_sessn_state = &npcx_sessions[ctx_idx]; in npcx_hash_session_setup()
161 ctx->started = false; in npcx_hash_session_setup()
162 ctx->hash_hndlr = npcx_sha_compute; in npcx_hash_session_setup()
165 NPCX_NCL_SHA->init_context(npcx_ctx->handle); in npcx_hash_session_setup()
166 NPCX_NCL_SHA->power(npcx_ctx->handle, 1); in npcx_hash_session_setup()
167 NPCX_NCL_SHA->init(npcx_ctx->handle); in npcx_hash_session_setup()
168 NPCX_NCL_SHA->reset(npcx_ctx->handle); in npcx_hash_session_setup()
175 struct npcx_sha_session *npcx_session = ctx->drv_sessn_state; in npcx_hash_session_free()
176 struct npcx_sha_context *npcx_ctx = &npcx_session->npcx_sha_ctx; in npcx_hash_session_free()
178 NPCX_NCL_SHA->reset(npcx_ctx->handle); in npcx_hash_session_free()
179 NPCX_NCL_SHA->power(npcx_ctx->handle, 0); in npcx_hash_session_free()
180 NPCX_NCL_SHA->finalize_context(npcx_ctx->handle); in npcx_hash_session_free()
181 npcx_session->in_use = false; in npcx_hash_session_free()
195 handle_size_required = NPCX_NCL_SHA->get_context_size(); in npcx_hash_init()
197 LOG_ERR("Pre-alloc buf size doesn't match required buf size (%d)", in npcx_hash_init()
199 return -ENOSR; in npcx_hash_init()
214 "only one 'nuvoton,npcx-sha' compatible node can be supported");