Messages in this thread | | | Date | Wed, 13 Jul 2022 00:24:45 -0700 | Subject | Re: [PATCH v7 1/5] crypto: aspeed: Add HACE hash driver | From | Dhananjay Phadke <> |
| |
On 7/12/2022 10:32 PM, Dhananjay Phadke wrote: >> +static void aspeed_ahash_iV(struct aspeed_sham_reqctx *rctx) >> +{ >> + if (rctx->flags & SHA_FLAGS_SHA1) >> + memcpy(rctx->digest, sha1_iv, 32); >> + else if (rctx->flags & SHA_FLAGS_SHA224) >> + memcpy(rctx->digest, sha224_iv, 32); >> + else if (rctx->flags & SHA_FLAGS_SHA256) >> + memcpy(rctx->digest, sha256_iv, 32); >> + else if (rctx->flags & SHA_FLAGS_SHA384) >> + memcpy(rctx->digest, sha384_iv, 64); >> + else if (rctx->flags & SHA_FLAGS_SHA512) >> + memcpy(rctx->digest, sha512_iv, 64); >> + else if (rctx->flags & SHA_FLAGS_SHA512_224) >> + memcpy(rctx->digest, sha512_224_iv, 64); >> + else if (rctx->flags & SHA_FLAGS_SHA512_256) >> + memcpy(rctx->digest, sha512_256_iv, 64); >> +} > > Can use the "digsize" from reqctx to memcpy() instead lots of if..else > conditionals for every request?
Sorry, meant pre-initialized ivsize not digsize, which could be in alg wrapper structure (aspeed_hace_alg).
Thanks, Dhananjay
| |