[PATCH v7 1/5] crypto: aspeed: Add HACE hash driver
Dhananjay Phadke
dphadke at linux.microsoft.com
Wed Jul 13 17:24:45 AEST 2022
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
More information about the Linux-aspeed
mailing list