All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] crypto/ahash: Require export/import in ahash
       [not found] <CGME20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53@eucas1p1.samsung.com>
@ 2018-01-16 18:38 ` Kamil Konieczny
  2018-01-18 10:51   ` Kamil Konieczny
  0 siblings, 1 reply; 2+ messages in thread
From: Kamil Konieczny @ 2018-01-16 18:38 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, Bartlomiej Zolnierkiewicz, linux-crypto, linux-kernel

Export and import were optional in async hash. As most drivers were
rewritten, they become mandatory now, so correct init of ahash
transformation.

Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
---
This is resend of previous patch. As Bartlomiej Zolnierkiewicz pointed out,
there are still three crypto drivers that didn't have export/import implemented:

drivers/crypto/mxs-dcp.c
drivers/crypto/n2_core.c
drivers/crypto/ux500/hash/hash_core.c

I have no documentation for them, so I sended patches with the behaviour taken
from crypto framework, but maybe that hardware is capable of import/export,
so proper implementation is possible. Unfortunatly, there is no maintainer
for any of these files.

Please take this patch after these remainig drivers will be patched.

 crypto/ahash.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/crypto/ahash.c b/crypto/ahash.c
index 3a35d67de7d9..7a8906d5af53 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -434,16 +434,6 @@ static int ahash_def_finup(struct ahash_request *req)
 	return ahash_def_finup_finish1(req, err);
 }
 
-static int ahash_no_export(struct ahash_request *req, void *out)
-{
-	return -ENOSYS;
-}
-
-static int ahash_no_import(struct ahash_request *req, const void *in)
-{
-	return -ENOSYS;
-}
-
 static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 {
 	struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
@@ -451,8 +441,8 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 
 	hash->setkey = ahash_nosetkey;
 	hash->has_setkey = false;
-	hash->export = ahash_no_export;
-	hash->import = ahash_no_import;
+	hash->export = alg->export;
+	hash->import = alg->import;
 
 	if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
 		return crypto_init_shash_ops_async(tfm);
@@ -467,10 +457,6 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 		hash->setkey = alg->setkey;
 		hash->has_setkey = true;
 	}
-	if (alg->export)
-		hash->export = alg->export;
-	if (alg->import)
-		hash->import = alg->import;
 
 	return 0;
 }
-- 
2.15.0

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

* Re: [PATCH v2] crypto/ahash: Require export/import in ahash
  2018-01-16 18:38 ` [PATCH v2] crypto/ahash: Require export/import in ahash Kamil Konieczny
@ 2018-01-18 10:51   ` Kamil Konieczny
  0 siblings, 0 replies; 2+ messages in thread
From: Kamil Konieczny @ 2018-01-18 10:51 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, Bartlomiej Zolnierkiewicz, linux-crypto, linux-kernel

On 16.01.2018 19:38, Kamil Konieczny wrote:
> Export and import were optional in async hash. As most drivers were
> rewritten, they become mandatory now, so correct init of ahash
> transformation.
> 
> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>

Please drop this patch, as there is one more driver needed for convert,
namely bfin_crc.c

I will also prepare this as patch series, to be sure that this patch is last

> ---
> This is resend of previous patch. As Bartlomiej Zolnierkiewicz pointed out,
> there are still three crypto drivers that didn't have export/import implemented:
> 
> drivers/crypto/mxs-dcp.c
> drivers/crypto/n2_core.c
> drivers/crypto/ux500/hash/hash_core.c
> 
> I have no documentation for them, so I sended patches with the behaviour taken
> from crypto framework, but maybe that hardware is capable of import/export,
> so proper implementation is possible. Unfortunatly, there is no maintainer
> for any of these files.
> 
> Please take this patch after these remainig drivers will be patched.
> 
>  crypto/ahash.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/crypto/ahash.c b/crypto/ahash.c
> index 3a35d67de7d9..7a8906d5af53 100644
> --- a/crypto/ahash.c
> +++ b/crypto/ahash.c
> @@ -434,16 +434,6 @@ static int ahash_def_finup(struct ahash_request *req)
>  	return ahash_def_finup_finish1(req, err);
>  }
>  
> -static int ahash_no_export(struct ahash_request *req, void *out)
> -{
> -	return -ENOSYS;
> -}
> -
> -static int ahash_no_import(struct ahash_request *req, const void *in)
> -{
> -	return -ENOSYS;
> -}
> -
>  static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
>  {
>  	struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
> @@ -451,8 +441,8 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
>  
>  	hash->setkey = ahash_nosetkey;
>  	hash->has_setkey = false;
> -	hash->export = ahash_no_export;
> -	hash->import = ahash_no_import;
> +	hash->export = alg->export;
> +	hash->import = alg->import;
>  
>  	if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
>  		return crypto_init_shash_ops_async(tfm);
> @@ -467,10 +457,6 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
>  		hash->setkey = alg->setkey;
>  		hash->has_setkey = true;
>  	}
> -	if (alg->export)
> -		hash->export = alg->export;
> -	if (alg->import)
> -		hash->import = alg->import;
>  
>  	return 0;
>  }
> 

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

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53@eucas1p1.samsung.com>
2018-01-16 18:38 ` [PATCH v2] crypto/ahash: Require export/import in ahash Kamil Konieczny
2018-01-18 10:51   ` Kamil Konieczny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.