public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: mxs-dcp: Add empty hash export and import
       [not found] <CGME20180116161641eucas1p1f776ccf0d08da2d3b670e5b2ad550ea6@eucas1p1.samsung.com>
@ 2018-01-16 16:16 ` Kamil Konieczny
  2018-01-16 16:56   ` Marek Vasut
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kamil Konieczny @ 2018-01-16 16:16 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Marek Vasut, David S. Miller, Bartlomiej Zolnierkiewicz,
	linux-crypto, linux-kernel

Crypto framework will require async hash export/import, so add empty
functions to prevent OOPS.

Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
---
 drivers/crypto/mxs-dcp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index 764be3e6933c..a10c418d4e5c 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -759,6 +759,16 @@ static int dcp_sha_digest(struct ahash_request *req)
 	return dcp_sha_finup(req);
 }
 
+static int dcp_sha_noimport(struct ahash_request *req, const void *in)
+{
+	return -ENOSYS;
+}
+
+static int dcp_sha_noexport(struct ahash_request *req, void *out)
+{
+	return -ENOSYS;
+}
+
 static int dcp_sha_cra_init(struct crypto_tfm *tfm)
 {
 	crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
@@ -829,6 +839,8 @@ static struct ahash_alg dcp_sha1_alg = {
 	.final	= dcp_sha_final,
 	.finup	= dcp_sha_finup,
 	.digest	= dcp_sha_digest,
+	.import = dcp_sha_noimport,
+	.export = dcp_sha_noexport,
 	.halg	= {
 		.digestsize	= SHA1_DIGEST_SIZE,
 		.base		= {
@@ -853,6 +865,8 @@ static struct ahash_alg dcp_sha256_alg = {
 	.final	= dcp_sha_final,
 	.finup	= dcp_sha_finup,
 	.digest	= dcp_sha_digest,
+	.import = dcp_sha_noimport,
+	.export = dcp_sha_noexport,
 	.halg	= {
 		.digestsize	= SHA256_DIGEST_SIZE,
 		.base		= {
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: mxs-dcp: Add empty hash export and import
  2018-01-16 16:16 ` [PATCH] crypto: mxs-dcp: Add empty hash export and import Kamil Konieczny
@ 2018-01-16 16:56   ` Marek Vasut
  2018-01-16 17:33     ` Kamil Konieczny
  2018-01-16 17:28   ` Fabio Estevam
  2018-01-18 17:53   ` Kamil Konieczny
  2 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2018-01-16 16:56 UTC (permalink / raw)
  To: Kamil Konieczny, Herbert Xu
  Cc: David S. Miller, Bartlomiej Zolnierkiewicz, linux-crypto,
	linux-kernel

On 01/16/2018 05:16 PM, Kamil Konieczny wrote:
> Crypto framework will require async hash export/import, so add empty
> functions to prevent OOPS.

Shouldn't this be handled on the subsystem level with some

if (foo->bar)
 foo->bar();

instead?

> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
> ---
>  drivers/crypto/mxs-dcp.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
> index 764be3e6933c..a10c418d4e5c 100644
> --- a/drivers/crypto/mxs-dcp.c
> +++ b/drivers/crypto/mxs-dcp.c
> @@ -759,6 +759,16 @@ static int dcp_sha_digest(struct ahash_request *req)
>  	return dcp_sha_finup(req);
>  }
>  
> +static int dcp_sha_noimport(struct ahash_request *req, const void *in)
> +{
> +	return -ENOSYS;
> +}
> +
> +static int dcp_sha_noexport(struct ahash_request *req, void *out)
> +{
> +	return -ENOSYS;
> +}
> +
>  static int dcp_sha_cra_init(struct crypto_tfm *tfm)
>  {
>  	crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
> @@ -829,6 +839,8 @@ static struct ahash_alg dcp_sha1_alg = {
>  	.final	= dcp_sha_final,
>  	.finup	= dcp_sha_finup,
>  	.digest	= dcp_sha_digest,
> +	.import = dcp_sha_noimport,
> +	.export = dcp_sha_noexport,
>  	.halg	= {
>  		.digestsize	= SHA1_DIGEST_SIZE,
>  		.base		= {
> @@ -853,6 +865,8 @@ static struct ahash_alg dcp_sha256_alg = {
>  	.final	= dcp_sha_final,
>  	.finup	= dcp_sha_finup,
>  	.digest	= dcp_sha_digest,
> +	.import = dcp_sha_noimport,
> +	.export = dcp_sha_noexport,
>  	.halg	= {
>  		.digestsize	= SHA256_DIGEST_SIZE,
>  		.base		= {
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: mxs-dcp: Add empty hash export and import
  2018-01-16 16:16 ` [PATCH] crypto: mxs-dcp: Add empty hash export and import Kamil Konieczny
  2018-01-16 16:56   ` Marek Vasut
@ 2018-01-16 17:28   ` Fabio Estevam
  2018-01-16 18:28     ` Kamil Konieczny
  2018-01-18 17:53   ` Kamil Konieczny
  2 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2018-01-16 17:28 UTC (permalink / raw)
  To: Kamil Konieczny
  Cc: Herbert Xu, Marek Vasut, David S. Miller,
	Bartlomiej Zolnierkiewicz, linux-crypto, linux-kernel

Hi Kamil,

On Tue, Jan 16, 2018 at 2:16 PM, Kamil Konieczny
<k.konieczny@partner.samsung.com> wrote:
> Crypto framework will require async hash export/import, so add empty
> functions to prevent OOPS.

Which Oops exactly are you getting?

Just booted 4.14.13 and the mxs-dcp driver does not even probe successfully:

[    2.455404] mxs-dcp 80028000.dcp: Failed to register sha1 hash!
[    2.464042] mxs-dcp: probe of 80028000.dcp failed with error -22

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: mxs-dcp: Add empty hash export and import
  2018-01-16 16:56   ` Marek Vasut
@ 2018-01-16 17:33     ` Kamil Konieczny
  0 siblings, 0 replies; 6+ messages in thread
From: Kamil Konieczny @ 2018-01-16 17:33 UTC (permalink / raw)
  To: Marek Vasut, Herbert Xu
  Cc: David S. Miller, Bartlomiej Zolnierkiewicz, linux-crypto,
	linux-kernel



On 16.01.2018 17:56, Marek Vasut wrote:
> On 01/16/2018 05:16 PM, Kamil Konieczny wrote:
>> Crypto framework will require async hash export/import, so add empty
>> functions to prevent OOPS.
> 
> Shouldn't this be handled on the subsystem level with some
> 
> if (foo->bar)
>  foo->bar();
> 
> instead?

I am sorry, I should write more elaborate description for patch.

It is handled by subsystem. Most drivers have them, and testmgr is testing for 
export/import and drivers without them fail internal crypto tests,
so I prepared patch which removed these two wrappers from crypto framework.

In summary: export/import are now required, so crypto framework can work properly.

-- 
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: mxs-dcp: Add empty hash export and import
  2018-01-16 17:28   ` Fabio Estevam
@ 2018-01-16 18:28     ` Kamil Konieczny
  0 siblings, 0 replies; 6+ messages in thread
From: Kamil Konieczny @ 2018-01-16 18:28 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Herbert Xu, Marek Vasut, David S. Miller,
	Bartlomiej Zolnierkiewicz, linux-crypto, linux-kernel



On 16.01.2018 18:28, Fabio Estevam wrote:
> Hi Kamil,
> 
> On Tue, Jan 16, 2018 at 2:16 PM, Kamil Konieczny
> <k.konieczny@partner.samsung.com> wrote:
>> Crypto framework will require async hash export/import, so add empty
>> functions to prevent OOPS.
> 
> Which Oops exactly are you getting?

None now, it is for preparation for patch removing export/import wrappers.

> 
> Just booted 4.14.13 and the mxs-dcp driver does not even probe successfully:
> 
> [    2.455404] mxs-dcp 80028000.dcp: Failed to register sha1 hash!
> [    2.464042] mxs-dcp: probe of 80028000.dcp failed with error -22
> 

With this option turned on in config:

crypto: Disable run-time self tests 

driver should load. Can you verify ?

Btw, there is no maintainer for this file.

-- 
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: mxs-dcp: Add empty hash export and import
  2018-01-16 16:16 ` [PATCH] crypto: mxs-dcp: Add empty hash export and import Kamil Konieczny
  2018-01-16 16:56   ` Marek Vasut
  2018-01-16 17:28   ` Fabio Estevam
@ 2018-01-18 17:53   ` Kamil Konieczny
  2 siblings, 0 replies; 6+ messages in thread
From: Kamil Konieczny @ 2018-01-18 17:53 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Marek Vasut, David S. Miller, Bartlomiej Zolnierkiewicz,
	linux-crypto, linux-kernel

Please drop this as I will resend it as part of patchset.

On 16.01.2018 17:16, Kamil Konieczny wrote:
> Crypto framework will require async hash export/import, so add empty
> functions to prevent OOPS.
> 
> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
> ---
>  drivers/crypto/mxs-dcp.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
> index 764be3e6933c..a10c418d4e5c 100644
> --- a/drivers/crypto/mxs-dcp.c
> +++ b/drivers/crypto/mxs-dcp.c
> @@ -759,6 +759,16 @@ static int dcp_sha_digest(struct ahash_request *req)
>  	return dcp_sha_finup(req);
>  }
>  
> +static int dcp_sha_noimport(struct ahash_request *req, const void *in)
> +{
> +	return -ENOSYS;
> +}
> +
> +static int dcp_sha_noexport(struct ahash_request *req, void *out)
> +{
> +	return -ENOSYS;
> +}
> +
>  static int dcp_sha_cra_init(struct crypto_tfm *tfm)
>  {
>  	crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
> @@ -829,6 +839,8 @@ static struct ahash_alg dcp_sha1_alg = {
>  	.final	= dcp_sha_final,
>  	.finup	= dcp_sha_finup,
>  	.digest	= dcp_sha_digest,
> +	.import = dcp_sha_noimport,
> +	.export = dcp_sha_noexport,
>  	.halg	= {
>  		.digestsize	= SHA1_DIGEST_SIZE,
>  		.base		= {
> @@ -853,6 +865,8 @@ static struct ahash_alg dcp_sha256_alg = {
>  	.final	= dcp_sha_final,
>  	.finup	= dcp_sha_finup,
>  	.digest	= dcp_sha_digest,
> +	.import = dcp_sha_noimport,
> +	.export = dcp_sha_noexport,
>  	.halg	= {
>  		.digestsize	= SHA256_DIGEST_SIZE,
>  		.base		= {
> 

-- 
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-18 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180116161641eucas1p1f776ccf0d08da2d3b670e5b2ad550ea6@eucas1p1.samsung.com>
2018-01-16 16:16 ` [PATCH] crypto: mxs-dcp: Add empty hash export and import Kamil Konieczny
2018-01-16 16:56   ` Marek Vasut
2018-01-16 17:33     ` Kamil Konieczny
2018-01-16 17:28   ` Fabio Estevam
2018-01-16 18:28     ` Kamil Konieczny
2018-01-18 17:53   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox