提交 378fe6fb 编写于 作者: K Kamil Konieczny 提交者: Herbert Xu

crypto: n2 - 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: NKamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 9190b6fd
...@@ -359,6 +359,16 @@ static int n2_hash_async_finup(struct ahash_request *req) ...@@ -359,6 +359,16 @@ static int n2_hash_async_finup(struct ahash_request *req)
return crypto_ahash_finup(&rctx->fallback_req); return crypto_ahash_finup(&rctx->fallback_req);
} }
static int n2_hash_async_noimport(struct ahash_request *req, const void *in)
{
return -ENOSYS;
}
static int n2_hash_async_noexport(struct ahash_request *req, void *out)
{
return -ENOSYS;
}
static int n2_hash_cra_init(struct crypto_tfm *tfm) static int n2_hash_cra_init(struct crypto_tfm *tfm)
{ {
const char *fallback_driver_name = crypto_tfm_alg_name(tfm); const char *fallback_driver_name = crypto_tfm_alg_name(tfm);
...@@ -1467,6 +1477,8 @@ static int __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl) ...@@ -1467,6 +1477,8 @@ static int __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl)
ahash->final = n2_hash_async_final; ahash->final = n2_hash_async_final;
ahash->finup = n2_hash_async_finup; ahash->finup = n2_hash_async_finup;
ahash->digest = n2_hash_async_digest; ahash->digest = n2_hash_async_digest;
ahash->export = n2_hash_async_noexport;
ahash->import = n2_hash_async_noimport;
halg = &ahash->halg; halg = &ahash->halg;
halg->digestsize = tmpl->digest_size; halg->digestsize = tmpl->digest_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册