Skip to content

Commit 9190b6f

Browse files
Kamil Koniecznyherbertx
authored andcommitted
crypto: mxs-dcp - Add empty hash export and import
Crypto framework requires export/import in async hash. If driver do not implement them, wrapper functions in framework will be used, and it will cause error during ahash alg registration (unless one disables crypto internal tests). To make change in framework and expose this requirement, I will remove wrappers from crypto/ahash.c , but this can broke code which depends on them. Add empty hash export and import, with the same behaviour as in framework and expose this directly in driver. This can also prevent OOPS when config option in Cryptographic API 'Disable run-time self tests' will be enabled. Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent c927b08 commit 9190b6f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/crypto/mxs-dcp.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,16 @@ static int dcp_sha_digest(struct ahash_request *req)
759759
return dcp_sha_finup(req);
760760
}
761761

762+
static int dcp_sha_noimport(struct ahash_request *req, const void *in)
763+
{
764+
return -ENOSYS;
765+
}
766+
767+
static int dcp_sha_noexport(struct ahash_request *req, void *out)
768+
{
769+
return -ENOSYS;
770+
}
771+
762772
static int dcp_sha_cra_init(struct crypto_tfm *tfm)
763773
{
764774
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
@@ -829,6 +839,8 @@ static struct ahash_alg dcp_sha1_alg = {
829839
.final = dcp_sha_final,
830840
.finup = dcp_sha_finup,
831841
.digest = dcp_sha_digest,
842+
.import = dcp_sha_noimport,
843+
.export = dcp_sha_noexport,
832844
.halg = {
833845
.digestsize = SHA1_DIGEST_SIZE,
834846
.base = {
@@ -853,6 +865,8 @@ static struct ahash_alg dcp_sha256_alg = {
853865
.final = dcp_sha_final,
854866
.finup = dcp_sha_finup,
855867
.digest = dcp_sha_digest,
868+
.import = dcp_sha_noimport,
869+
.export = dcp_sha_noexport,
856870
.halg = {
857871
.digestsize = SHA256_DIGEST_SIZE,
858872
.base = {

0 commit comments

Comments
 (0)