linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: inside-secure - Fix randbuild error
@ 2019-10-08  7:15 YueHaibing
  2019-10-08  7:32 ` Pascal Van Leeuwen
  0 siblings, 1 reply; 5+ messages in thread
From: YueHaibing @ 2019-10-08  7:15 UTC (permalink / raw)
  To: herbert, davem, pascalvanl, antoine.tenart
  Cc: linux-crypto, linux-kernel, YueHaibing

If CRYPTO_DEV_SAFEXCEL is y but CRYPTO_SM3 is m,
building fails:

drivers/crypto/inside-secure/safexcel_hash.o: In function `safexcel_ahash_final':
safexcel_hash.c:(.text+0xbc0): undefined reference to `sm3_zero_message_hash'

Select CRYPTO_SM3 to fix this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 0f2bc13181ce ("crypto: inside-secure - Added support for basic SM3 ahash")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 3e51bae..5af17db 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -751,6 +751,7 @@ config CRYPTO_DEV_SAFEXCEL
 	select CRYPTO_SHA512
 	select CRYPTO_CHACHA20POLY1305
 	select CRYPTO_SHA3
+	select CRYPTO_SM3
 	help
 	  This driver interfaces with the SafeXcel EIP-97 and EIP-197 cryptographic
 	  engines designed by Inside Secure. It currently accelerates DES, 3DES and
-- 
2.7.4



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

* RE: [PATCH -next] crypto: inside-secure - Fix randbuild error
  2019-10-08  7:15 [PATCH -next] crypto: inside-secure - Fix randbuild error YueHaibing
@ 2019-10-08  7:32 ` Pascal Van Leeuwen
  2019-10-08  7:35   ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Pascal Van Leeuwen @ 2019-10-08  7:32 UTC (permalink / raw)
  To: YueHaibing, herbert, davem, pascalvanl, antoine.tenart
  Cc: linux-crypto, linux-kernel

> -----Original Message-----
> From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> YueHaibing
> Sent: Tuesday, October 8, 2019 9:15 AM
> To: herbert@gondor.apana.org.au; davem@davemloft.net; pascalvanl@gmail.com;
> antoine.tenart@bootlin.com
> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; YueHaibing
> <yuehaibing@huawei.com>
> Subject: [PATCH -next] crypto: inside-secure - Fix randbuild error
> 
> If CRYPTO_DEV_SAFEXCEL is y but CRYPTO_SM3 is m,
> building fails:
> 
> drivers/crypto/inside-secure/safexcel_hash.o: In function `safexcel_ahash_final':
> safexcel_hash.c:(.text+0xbc0): undefined reference to `sm3_zero_message_hash'
> 
> Select CRYPTO_SM3 to fix this.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 0f2bc13181ce ("crypto: inside-secure - Added support for basic SM3 ahash")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/crypto/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
> index 3e51bae..5af17db 100644
> --- a/drivers/crypto/Kconfig
> +++ b/drivers/crypto/Kconfig
> @@ -751,6 +751,7 @@ config CRYPTO_DEV_SAFEXCEL
>  	select CRYPTO_SHA512
>  	select CRYPTO_CHACHA20POLY1305
>  	select CRYPTO_SHA3
> +	select CRYPTO_SM3
>  	help
>  	  This driver interfaces with the SafeXcel EIP-97 and EIP-197 cryptographic
>  	  engines designed by Inside Secure. It currently accelerates DES, 3DES and
> --
> 2.7.4
> 
But ... I don't really want to build SM3 into the kernel for all Inside
Secure drivers, since in the majority of cases, the HW will not actually
support SM3 and I don't want to bloat the kernel image in that case.

So maybe it's better to #ifdef out the failing part of the driver if
CONFIG_SM3 is not set?

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

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

* Re: [PATCH -next] crypto: inside-secure - Fix randbuild error
  2019-10-08  7:32 ` Pascal Van Leeuwen
@ 2019-10-08  7:35   ` Ard Biesheuvel
  2019-10-08  7:57     ` Pascal Van Leeuwen
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2019-10-08  7:35 UTC (permalink / raw)
  To: Pascal Van Leeuwen
  Cc: YueHaibing, herbert, davem, pascalvanl, antoine.tenart,
	linux-crypto, linux-kernel

On Tue, 8 Oct 2019 at 09:32, Pascal Van Leeuwen
<pvanleeuwen@verimatrix.com> wrote:
>
> > -----Original Message-----
> > From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> > YueHaibing
> > Sent: Tuesday, October 8, 2019 9:15 AM
> > To: herbert@gondor.apana.org.au; davem@davemloft.net; pascalvanl@gmail.com;
> > antoine.tenart@bootlin.com
> > Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; YueHaibing
> > <yuehaibing@huawei.com>
> > Subject: [PATCH -next] crypto: inside-secure - Fix randbuild error
> >
> > If CRYPTO_DEV_SAFEXCEL is y but CRYPTO_SM3 is m,
> > building fails:
> >
> > drivers/crypto/inside-secure/safexcel_hash.o: In function `safexcel_ahash_final':
> > safexcel_hash.c:(.text+0xbc0): undefined reference to `sm3_zero_message_hash'
> >
> > Select CRYPTO_SM3 to fix this.
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Fixes: 0f2bc13181ce ("crypto: inside-secure - Added support for basic SM3 ahash")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> >  drivers/crypto/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
> > index 3e51bae..5af17db 100644
> > --- a/drivers/crypto/Kconfig
> > +++ b/drivers/crypto/Kconfig
> > @@ -751,6 +751,7 @@ config CRYPTO_DEV_SAFEXCEL
> >       select CRYPTO_SHA512
> >       select CRYPTO_CHACHA20POLY1305
> >       select CRYPTO_SHA3
> > +     select CRYPTO_SM3
> >       help
> >         This driver interfaces with the SafeXcel EIP-97 and EIP-197 cryptographic
> >         engines designed by Inside Secure. It currently accelerates DES, 3DES and
> > --
> > 2.7.4
> >
> But ... I don't really want to build SM3 into the kernel for all Inside
> Secure drivers, since in the majority of cases, the HW will not actually
> support SM3 and I don't want to bloat the kernel image in that case.
>
> So maybe it's better to #ifdef out the failing part of the driver if
> CONFIG_SM3 is not set?
>

Since you are only using the zero length message hash, can we just
copy that into your driver instead?

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

* RE: [PATCH -next] crypto: inside-secure - Fix randbuild error
  2019-10-08  7:35   ` Ard Biesheuvel
@ 2019-10-08  7:57     ` Pascal Van Leeuwen
  2019-10-17 16:14       ` Pascal Van Leeuwen
  0 siblings, 1 reply; 5+ messages in thread
From: Pascal Van Leeuwen @ 2019-10-08  7:57 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: YueHaibing, herbert, davem, pascalvanl, antoine.tenart,
	linux-crypto, linux-kernel

> -----Original Message-----
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Sent: Tuesday, October 8, 2019 9:35 AM
> To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Cc: YueHaibing <yuehaibing@huawei.com>; herbert@gondor.apana.org.au; davem@davemloft.net;
> pascalvanl@gmail.com; antoine.tenart@bootlin.com; linux-crypto@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH -next] crypto: inside-secure - Fix randbuild error
> 
> On Tue, 8 Oct 2019 at 09:32, Pascal Van Leeuwen
> <pvanleeuwen@verimatrix.com> wrote:
> >
> > > -----Original Message-----
> > > From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> > > YueHaibing
> > > Sent: Tuesday, October 8, 2019 9:15 AM
> > > To: herbert@gondor.apana.org.au; davem@davemloft.net; pascalvanl@gmail.com;
> > > antoine.tenart@bootlin.com
> > > Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; YueHaibing
> > > <yuehaibing@huawei.com>
> > > Subject: [PATCH -next] crypto: inside-secure - Fix randbuild error
> > >
> > > If CRYPTO_DEV_SAFEXCEL is y but CRYPTO_SM3 is m,
> > > building fails:
> > >
> > > drivers/crypto/inside-secure/safexcel_hash.o: In function `safexcel_ahash_final':
> > > safexcel_hash.c:(.text+0xbc0): undefined reference to `sm3_zero_message_hash'
> > >
> > > Select CRYPTO_SM3 to fix this.
> > >
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Fixes: 0f2bc13181ce ("crypto: inside-secure - Added support for basic SM3 ahash")
> > > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > > ---
> > >  drivers/crypto/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
> > > index 3e51bae..5af17db 100644
> > > --- a/drivers/crypto/Kconfig
> > > +++ b/drivers/crypto/Kconfig
> > > @@ -751,6 +751,7 @@ config CRYPTO_DEV_SAFEXCEL
> > >       select CRYPTO_SHA512
> > >       select CRYPTO_CHACHA20POLY1305
> > >       select CRYPTO_SHA3
> > > +     select CRYPTO_SM3
> > >       help
> > >         This driver interfaces with the SafeXcel EIP-97 and EIP-197 cryptographic
> > >         engines designed by Inside Secure. It currently accelerates DES, 3DES and
> > > --
> > > 2.7.4
> > >
> > But ... I don't really want to build SM3 into the kernel for all Inside
> > Secure drivers, since in the majority of cases, the HW will not actually
> > support SM3 and I don't want to bloat the kernel image in that case.
> >
> > So maybe it's better to #ifdef out the failing part of the driver if
> > CONFIG_SM3 is not set?
> >
> 
> Since you are only using the zero length message hash, can we just
> copy that into your driver instead?
If that is really the case - don't have time to look into that right now -
then I would be fine with that too. If no one objects, then I will make a
patch for that when I can find some time to do so (~early next week).

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

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

* RE: [PATCH -next] crypto: inside-secure - Fix randbuild error
  2019-10-08  7:57     ` Pascal Van Leeuwen
@ 2019-10-17 16:14       ` Pascal Van Leeuwen
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal Van Leeuwen @ 2019-10-17 16:14 UTC (permalink / raw)
  To: Pascal Van Leeuwen, Ard Biesheuvel
  Cc: YueHaibing, herbert, davem, pascalvanl, antoine.tenart,
	linux-crypto, linux-kernel

> -----Original Message-----
> From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf Of
> Pascal Van Leeuwen
> Sent: Tuesday, October 8, 2019 9:57 AM
> To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: YueHaibing <yuehaibing@huawei.com>; herbert@gondor.apana.org.au; davem@davemloft.net;
> pascalvanl@gmail.com; antoine.tenart@bootlin.com; linux-crypto@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: RE: [PATCH -next] crypto: inside-secure - Fix randbuild error
> 
> > -----Original Message-----
> > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Sent: Tuesday, October 8, 2019 9:35 AM
> > To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> > Cc: YueHaibing <yuehaibing@huawei.com>; herbert@gondor.apana.org.au; davem@davemloft.net;
> > pascalvanl@gmail.com; antoine.tenart@bootlin.com; linux-crypto@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > Subject: Re: [PATCH -next] crypto: inside-secure - Fix randbuild error
> >
> > On Tue, 8 Oct 2019 at 09:32, Pascal Van Leeuwen
> > <pvanleeuwen@verimatrix.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On Behalf
> Of
> > > > YueHaibing
> > > > Sent: Tuesday, October 8, 2019 9:15 AM
> > > > To: herbert@gondor.apana.org.au; davem@davemloft.net; pascalvanl@gmail.com;
> > > > antoine.tenart@bootlin.com
> > > > Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; YueHaibing
> > > > <yuehaibing@huawei.com>
> > > > Subject: [PATCH -next] crypto: inside-secure - Fix randbuild error
> > > >
> > > > If CRYPTO_DEV_SAFEXCEL is y but CRYPTO_SM3 is m,
> > > > building fails:
> > > >
> > > > drivers/crypto/inside-secure/safexcel_hash.o: In function `safexcel_ahash_final':
> > > > safexcel_hash.c:(.text+0xbc0): undefined reference to `sm3_zero_message_hash'
> > > >
> > > > Select CRYPTO_SM3 to fix this.
> > > >
> > > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > > Fixes: 0f2bc13181ce ("crypto: inside-secure - Added support for basic SM3 ahash")
> > > > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > > > ---
> > > >  drivers/crypto/Kconfig | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
> > > > index 3e51bae..5af17db 100644
> > > > --- a/drivers/crypto/Kconfig
> > > > +++ b/drivers/crypto/Kconfig
> > > > @@ -751,6 +751,7 @@ config CRYPTO_DEV_SAFEXCEL
> > > >       select CRYPTO_SHA512
> > > >       select CRYPTO_CHACHA20POLY1305
> > > >       select CRYPTO_SHA3
> > > > +     select CRYPTO_SM3
> > > >       help
> > > >         This driver interfaces with the SafeXcel EIP-97 and EIP-197 cryptographic
> > > >         engines designed by Inside Secure. It currently accelerates DES, 3DES and
> > > > --
> > > > 2.7.4
> > > >
> > > But ... I don't really want to build SM3 into the kernel for all Inside
> > > Secure drivers, since in the majority of cases, the HW will not actually
> > > support SM3 and I don't want to bloat the kernel image in that case.
> > >
> > > So maybe it's better to #ifdef out the failing part of the driver if
> > > CONFIG_SM3 is not set?
> > >
> >
> > Since you are only using the zero length message hash, can we just
> > copy that into your driver instead?
> If that is really the case - don't have time to look into that right now -
> then I would be fine with that too. If no one objects, then I will make a
> patch for that when I can find some time to do so (~early next week).
> 
> Regards,
> Pascal van Leeuwen
> Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
> www.insidesecure.com

Actually, I just looked into this and:

1)The driver already takes a local version if IS_ENABLED(CONFIG_CRYPTO_SM3)
  is false. I'm not sure what happens there is the module is configured to
  be a loadable module though.
2)I cannot reproduce the build error when I set CONFIG_CRYPTO_SM3 to "m".

But I think I'll just spin a patch that *always* takes the local version
independent of the CONFIG switch. That should always work.

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

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

end of thread, other threads:[~2019-10-17 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  7:15 [PATCH -next] crypto: inside-secure - Fix randbuild error YueHaibing
2019-10-08  7:32 ` Pascal Van Leeuwen
2019-10-08  7:35   ` Ard Biesheuvel
2019-10-08  7:57     ` Pascal Van Leeuwen
2019-10-17 16:14       ` Pascal Van Leeuwen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).