Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
* crypto: atmel - Fix authenc support when it is set to m
@ 2019-10-28  7:39 Herbert Xu
  2019-11-01 16:40 ` [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC Tudor.Ambarus
  2019-11-01 16:42 ` crypto: atmel - Fix authenc support when it is set to m Tudor.Ambarus
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2019-10-28  7:39 UTC (permalink / raw)
  To: Linux Crypto Mailing List, Cyrille Pitchen, Tudor Ambarus

As it is if CONFIG_CRYPTO_DEV_ATMEL_AUTHENC is set to m it is in
effect disabled.  This patch fixes it by using IS_ENABLED instead
of ifdef.

Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 33a76d1f4a6e..c5ec74171fbf 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -145,7 +145,7 @@ struct atmel_aes_xts_ctx {
 	u32			key2[AES_KEYSIZE_256 / sizeof(u32)];
 };
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 struct atmel_aes_authenc_ctx {
 	struct atmel_aes_base_ctx	base;
 	struct atmel_sha_authenc_ctx	*auth;
@@ -157,7 +157,7 @@ struct atmel_aes_reqctx {
 	u32			lastc[AES_BLOCK_SIZE / sizeof(u32)];
 };
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 struct atmel_aes_authenc_reqctx {
 	struct atmel_aes_reqctx	base;
 
@@ -486,7 +486,7 @@ static inline bool atmel_aes_is_encrypt(const struct atmel_aes_dev *dd)
 	return (dd->flags & AES_FLAGS_ENCRYPT);
 }
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 static void atmel_aes_authenc_complete(struct atmel_aes_dev *dd, int err);
 #endif
 
@@ -515,7 +515,7 @@ static void atmel_aes_set_iv_as_last_ciphertext_block(struct atmel_aes_dev *dd)
 
 static inline int atmel_aes_complete(struct atmel_aes_dev *dd, int err)
 {
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 	if (dd->ctx->is_aead)
 		atmel_aes_authenc_complete(dd, err);
 #endif
@@ -1980,7 +1980,7 @@ static struct crypto_alg aes_xts_alg = {
 	}
 };
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 /* authenc aead functions */
 
 static int atmel_aes_authenc_start(struct atmel_aes_dev *dd);
@@ -2467,7 +2467,7 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd)
 {
 	int i;
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 	if (dd->caps.has_authenc)
 		for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++)
 			crypto_unregister_aead(&aes_authenc_algs[i]);
@@ -2514,7 +2514,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
 			goto err_aes_xts_alg;
 	}
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 	if (dd->caps.has_authenc) {
 		for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) {
 			err = crypto_register_aead(&aes_authenc_algs[i]);
@@ -2526,7 +2526,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
 
 	return 0;
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 	/* i = ARRAY_SIZE(aes_authenc_algs); */
 err_aes_authenc_alg:
 	for (j = 0; j < i; j++)
@@ -2716,7 +2716,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
 
 	atmel_aes_get_cap(aes_dd);
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 	if (aes_dd->caps.has_authenc && !atmel_sha_authenc_is_ready()) {
 		err = -EPROBE_DEFER;
 		goto iclk_unprepare;
diff --git a/drivers/crypto/atmel-authenc.h b/drivers/crypto/atmel-authenc.h
index cbd37a2edada..d6de810df44f 100644
--- a/drivers/crypto/atmel-authenc.h
+++ b/drivers/crypto/atmel-authenc.h
@@ -12,7 +12,7 @@
 #ifndef __ATMEL_AUTHENC_H__
 #define __ATMEL_AUTHENC_H__
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 
 #include <crypto/authenc.h>
 #include <crypto/hash.h>
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 84cb8748a795..d32626458e67 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -2212,7 +2212,7 @@ static struct ahash_alg sha_hmac_algs[] = {
 },
 };
 
-#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
+#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
 /* authenc functions */
 
 static int atmel_sha_authenc_init2(struct atmel_sha_dev *dd);
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC
  2019-10-28  7:39 crypto: atmel - Fix authenc support when it is set to m Herbert Xu
@ 2019-11-01 16:40 ` Tudor.Ambarus
  2019-11-08 15:21   ` Herbert Xu
  2019-11-01 16:42 ` crypto: atmel - Fix authenc support when it is set to m Tudor.Ambarus
  1 sibling, 1 reply; 4+ messages in thread
From: Tudor.Ambarus @ 2019-11-01 16:40 UTC (permalink / raw)
  To: herbert, Nicolas.Ferre, alexandre.belloni, Ludovic.Desroches
  Cc: linux-crypto, linux-arm-kernel, Tudor.Ambarus

From: Tudor Ambarus <tudor.ambarus@microchip.com>

The following error is raised when CONFIG_CRYPTO_DEV_ATMEL_AES=y and
CONFIG_CRYPTO_DEV_ATMEL_AUTHENC=m:
drivers/crypto/atmel-aes.o: In function `atmel_aes_authenc_setkey':
atmel-aes.c:(.text+0x9bc): undefined reference to `crypto_authenc_extractkeys'
Makefile:1094: recipe for target 'vmlinux' failed

Fix it by moving the selection of CRYPTO_AUTHENC under
config CRYPTO_DEV_ATMEL_AES.

Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to...")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/crypto/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 8a1d04805428..c5cc04ddc4fb 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -494,7 +494,6 @@ endif # if CRYPTO_DEV_UX500
 config CRYPTO_DEV_ATMEL_AUTHENC
 	tristate "Support for Atmel IPSEC/SSL hw accelerator"
 	depends on ARCH_AT91 || COMPILE_TEST
-	select CRYPTO_AUTHENC
 	select CRYPTO_DEV_ATMEL_AES
 	select CRYPTO_DEV_ATMEL_SHA
 	help
@@ -508,6 +507,7 @@ config CRYPTO_DEV_ATMEL_AES
 	depends on ARCH_AT91 || COMPILE_TEST
 	select CRYPTO_AES
 	select CRYPTO_AEAD
+	select CRYPTO_AUTHENC
 	select CRYPTO_SKCIPHER
 	help
 	  Some Atmel processors have AES hw accelerator.
-- 
2.9.5


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

* Re: crypto: atmel - Fix authenc support when it is set to m
  2019-10-28  7:39 crypto: atmel - Fix authenc support when it is set to m Herbert Xu
  2019-11-01 16:40 ` [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC Tudor.Ambarus
@ 2019-11-01 16:42 ` Tudor.Ambarus
  1 sibling, 0 replies; 4+ messages in thread
From: Tudor.Ambarus @ 2019-11-01 16:42 UTC (permalink / raw)
  To: herbert, linux-crypto, cyrille.pitchen



On 10/28/2019 09:39 AM, Herbert Xu wrote:
> External E-Mail
> 
> 
> As it is if CONFIG_CRYPTO_DEV_ATMEL_AUTHENC is set to m it is in
> effect disabled.  This patch fixes it by using IS_ENABLED instead
> of ifdef.
> 
> Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to...")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 

Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>

> diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
> index 33a76d1f4a6e..c5ec74171fbf 100644
> --- a/drivers/crypto/atmel-aes.c
> +++ b/drivers/crypto/atmel-aes.c
> @@ -145,7 +145,7 @@ struct atmel_aes_xts_ctx {
>  	u32			key2[AES_KEYSIZE_256 / sizeof(u32)];
>  };
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  struct atmel_aes_authenc_ctx {
>  	struct atmel_aes_base_ctx	base;
>  	struct atmel_sha_authenc_ctx	*auth;
> @@ -157,7 +157,7 @@ struct atmel_aes_reqctx {
>  	u32			lastc[AES_BLOCK_SIZE / sizeof(u32)];
>  };
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  struct atmel_aes_authenc_reqctx {
>  	struct atmel_aes_reqctx	base;
>  
> @@ -486,7 +486,7 @@ static inline bool atmel_aes_is_encrypt(const struct atmel_aes_dev *dd)
>  	return (dd->flags & AES_FLAGS_ENCRYPT);
>  }
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  static void atmel_aes_authenc_complete(struct atmel_aes_dev *dd, int err);
>  #endif
>  
> @@ -515,7 +515,7 @@ static void atmel_aes_set_iv_as_last_ciphertext_block(struct atmel_aes_dev *dd)
>  
>  static inline int atmel_aes_complete(struct atmel_aes_dev *dd, int err)
>  {
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  	if (dd->ctx->is_aead)
>  		atmel_aes_authenc_complete(dd, err);
>  #endif
> @@ -1980,7 +1980,7 @@ static struct crypto_alg aes_xts_alg = {
>  	}
>  };
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  /* authenc aead functions */
>  
>  static int atmel_aes_authenc_start(struct atmel_aes_dev *dd);
> @@ -2467,7 +2467,7 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd)
>  {
>  	int i;
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  	if (dd->caps.has_authenc)
>  		for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++)
>  			crypto_unregister_aead(&aes_authenc_algs[i]);
> @@ -2514,7 +2514,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
>  			goto err_aes_xts_alg;
>  	}
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  	if (dd->caps.has_authenc) {
>  		for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) {
>  			err = crypto_register_aead(&aes_authenc_algs[i]);
> @@ -2526,7 +2526,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
>  
>  	return 0;
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  	/* i = ARRAY_SIZE(aes_authenc_algs); */
>  err_aes_authenc_alg:
>  	for (j = 0; j < i; j++)
> @@ -2716,7 +2716,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
>  
>  	atmel_aes_get_cap(aes_dd);
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  	if (aes_dd->caps.has_authenc && !atmel_sha_authenc_is_ready()) {
>  		err = -EPROBE_DEFER;
>  		goto iclk_unprepare;
> diff --git a/drivers/crypto/atmel-authenc.h b/drivers/crypto/atmel-authenc.h
> index cbd37a2edada..d6de810df44f 100644
> --- a/drivers/crypto/atmel-authenc.h
> +++ b/drivers/crypto/atmel-authenc.h
> @@ -12,7 +12,7 @@
>  #ifndef __ATMEL_AUTHENC_H__
>  #define __ATMEL_AUTHENC_H__
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  
>  #include <crypto/authenc.h>
>  #include <crypto/hash.h>
> diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
> index 84cb8748a795..d32626458e67 100644
> --- a/drivers/crypto/atmel-sha.c
> +++ b/drivers/crypto/atmel-sha.c
> @@ -2212,7 +2212,7 @@ static struct ahash_alg sha_hmac_algs[] = {
>  },
>  };
>  
> -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
>  /* authenc functions */
>  
>  static int atmel_sha_authenc_init2(struct atmel_sha_dev *dd);
> 

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

* Re: [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC
  2019-11-01 16:40 ` [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC Tudor.Ambarus
@ 2019-11-08 15:21   ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2019-11-08 15:21 UTC (permalink / raw)
  To: Tudor.Ambarus
  Cc: Nicolas.Ferre, alexandre.belloni, Ludovic.Desroches,
	linux-crypto, linux-arm-kernel

On Fri, Nov 01, 2019 at 04:40:37PM +0000, Tudor.Ambarus@microchip.com wrote:
> From: Tudor Ambarus <tudor.ambarus@microchip.com>
> 
> The following error is raised when CONFIG_CRYPTO_DEV_ATMEL_AES=y and
> CONFIG_CRYPTO_DEV_ATMEL_AUTHENC=m:
> drivers/crypto/atmel-aes.o: In function `atmel_aes_authenc_setkey':
> atmel-aes.c:(.text+0x9bc): undefined reference to `crypto_authenc_extractkeys'
> Makefile:1094: recipe for target 'vmlinux' failed
> 
> Fix it by moving the selection of CRYPTO_AUTHENC under
> config CRYPTO_DEV_ATMEL_AES.
> 
> Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to...")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/crypto/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28  7:39 crypto: atmel - Fix authenc support when it is set to m Herbert Xu
2019-11-01 16:40 ` [PATCH] crypto: atmel - Fix selection of CRYPTO_AUTHENC Tudor.Ambarus
2019-11-08 15:21   ` Herbert Xu
2019-11-01 16:42 ` crypto: atmel - Fix authenc support when it is set to m Tudor.Ambarus

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git