2020-04-17 20:39:36

by Hadar Gat

[permalink] [raw]
Subject: [PATCH] hwrng: cctrng - add missing include to linux/fips.h

This fixes build failure when CONFIG_CRYPTO_FIPS is defined.

Signed-off-by: Hadar Gat <[email protected]>
---
drivers/char/hw_random/cctrng.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index bdcd562..e82716c 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -15,6 +15,7 @@
#include <linux/completion.h>
#include <linux/of.h>
#include <linux/bitfield.h>
+#include <linux/fips.h>

#include "cctrng.h"

--
2.7.4


2020-04-20 08:24:05

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] hwrng: cctrng - add missing include to linux/fips.h

On Fri, Apr 17, 2020 at 11:38:45PM +0300, Hadar Gat wrote:
> This fixes build failure when CONFIG_CRYPTO_FIPS is defined.
>
> Signed-off-by: Hadar Gat <[email protected]>
> ---
> drivers/char/hw_random/cctrng.c | 1 +
> 1 file changed, 1 insertion(+)

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

2020-04-20 08:29:19

by Herbert Xu

[permalink] [raw]
Subject: hwrng: cctrng - Remove unnecessary FIPS ifdef

This patch removes the unnecessary FIPS ifdef in cctrng.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index e82716c12c3a..49fb65a221f3 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -331,13 +331,11 @@ void cc_trng_compwork_handler(struct work_struct *w)
ehr_valid = CC_REG_FLD_GET(RNG_ISR, EHR_VALID, isr);
dev_dbg(dev, "Got RNG_ISR=0x%08X (EHR_VALID=%u)\n", isr, ehr_valid);

-#ifdef CONFIG_CRYPTO_FIPS
- if (CC_REG_FLD_GET(RNG_ISR, CRNGT_ERR, isr) && fips_enabled) {
+ if (fips_enabled && CC_REG_FLD_GET(RNG_ISR, CRNGT_ERR, isr)) {
fips_fail_notify();
/* FIPS error is fatal */
panic("Got HW CRNGT error while fips is enabled!\n");
}
-#endif

/* Clear all pending RNG interrupts */
cc_iowrite(drvdata, CC_RNG_ICR_REG_OFFSET, isr);
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2020-04-20 08:36:43

by Hadar Gat

[permalink] [raw]
Subject: RE: hwrng: cctrng - Remove unnecessary FIPS ifdef


> -----Original Message-----
> From: Herbert Xu <[email protected]>
> Sent: Monday, 20 April 2020 11:28
> To: Hadar Gat <[email protected]>
> Cc: Matt Mackall <[email protected]>; Arnd Bergmann <[email protected]>;
> Greg Kroah-Hartman <[email protected]>; Gilad Ben-Yossef
> <[email protected]>; Ofir Drang <[email protected]>; linux-
> [email protected]; [email protected]
> Subject: hwrng: cctrng - Remove unnecessary FIPS ifdef
>
> This patch removes the unnecessary FIPS ifdef in cctrng.
>
> Signed-off-by: Herbert Xu <[email protected]>
>

Acked-by: Hadar Gat <[email protected]>


> diff --git a/drivers/char/hw_random/cctrng.c
> b/drivers/char/hw_random/cctrng.c index e82716c12c3a..49fb65a221f3
> 100644
> --- a/drivers/char/hw_random/cctrng.c
> +++ b/drivers/char/hw_random/cctrng.c
> @@ -331,13 +331,11 @@ void cc_trng_compwork_handler(struct
> work_struct *w)
> ehr_valid = CC_REG_FLD_GET(RNG_ISR, EHR_VALID, isr);
> dev_dbg(dev, "Got RNG_ISR=0x%08X (EHR_VALID=%u)\n", isr,
> ehr_valid);
>
> -#ifdef CONFIG_CRYPTO_FIPS
> - if (CC_REG_FLD_GET(RNG_ISR, CRNGT_ERR, isr) && fips_enabled) {
> + if (fips_enabled && CC_REG_FLD_GET(RNG_ISR, CRNGT_ERR, isr)) {
> fips_fail_notify();
> /* FIPS error is fatal */
> panic("Got HW CRNGT error while fips is enabled!\n");
> }
> -#endif
>
> /* Clear all pending RNG interrupts */
> cc_iowrite(drvdata, CC_RNG_ICR_REG_OFFSET, isr);
> --
> Email: Herbert Xu <[email protected]> Home Page:
> http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt