Lines Matching defs:algo
129 static inline u32 ocs_hcu_num_chains(enum ocs_hcu_algo algo)
131 switch (algo) {
144 static inline u32 ocs_hcu_digest_size(enum ocs_hcu_algo algo)
146 switch (algo) {
232 * @algo: The algorithm being used.
245 enum ocs_hcu_algo algo)
247 const int n = ocs_hcu_num_chains(algo);
282 * @algo: The algorithm being used.
288 enum ocs_hcu_algo algo)
290 const int n = ocs_hcu_num_chains(algo);
308 enum ocs_hcu_algo algo, u8 *dgst, size_t dgst_len)
317 /* Length of the output buffer must match the algo digest size. */
318 if (dgst_len != ocs_hcu_digest_size(algo))
336 * @algo: The algorithm to be used by the HCU device.
341 static int ocs_hcu_hw_cfg(struct ocs_hcu_dev *hcu_dev, enum ocs_hcu_algo algo,
347 if (algo != OCS_HCU_ALGO_SHA256 && algo != OCS_HCU_ALGO_SHA224 &&
348 algo != OCS_HCU_ALGO_SHA384 && algo != OCS_HCU_ALGO_SHA512 &&
349 algo != OCS_HCU_ALGO_SM3)
361 cfg |= algo << HCU_MODE_ALGO_SHIFT;
582 * @algo: The hashing algorithm to use.
586 int ocs_hcu_hash_init(struct ocs_hcu_hash_ctx *ctx, enum ocs_hcu_algo algo)
591 ctx->algo = algo;
617 rc = ocs_hcu_hw_cfg(hcu_dev, ctx->algo, false);
623 ocs_hcu_set_intermediate_data(hcu_dev, &ctx->idata, ctx->algo);
631 return ocs_hcu_get_intermediate_data(hcu_dev, &ctx->idata, ctx->algo);
655 rc = ocs_hcu_hw_cfg(hcu_dev, ctx->algo, false);
661 ocs_hcu_set_intermediate_data(hcu_dev, &ctx->idata, ctx->algo);
669 return ocs_hcu_get_digest(hcu_dev, ctx->algo, dgst, dgst_len);
691 rc = ocs_hcu_hw_cfg(hcu_dev, ctx->algo, false);
697 ocs_hcu_set_intermediate_data(hcu_dev, &ctx->idata, ctx->algo);
712 return ocs_hcu_get_digest(hcu_dev, ctx->algo, dgst, dgst_len);
718 * @algo: The hash algorithm to use.
726 int ocs_hcu_digest(struct ocs_hcu_dev *hcu_dev, enum ocs_hcu_algo algo,
735 rc = ocs_hcu_hw_cfg(hcu_dev, algo, false);
762 return ocs_hcu_get_digest(hcu_dev, algo, dgst, dgst_len);
768 * @algo: The hash algorithm to use with HMAC.
777 int ocs_hcu_hmac(struct ocs_hcu_dev *hcu_dev, enum ocs_hcu_algo algo,
789 rc = ocs_hcu_hw_cfg(hcu_dev, algo, true);
805 return ocs_hcu_get_digest(hcu_dev, algo, dgst, dgst_len);