lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230420124858.GA2645094-robh@kernel.org>
Date:   Thu, 20 Apr 2023 07:48:58 -0500
From:   Rob Herring <robh@...nel.org>
To:     David Yang <mmyangfl@...il.com>
Cc:     linux-crypto@...r.kernel.org, Weili Qian <qianweili@...wei.com>,
        Zhou Wang <wangzhou1@...ilicon.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] crypto: hisilicon/trng - add support for HiSTB TRNG

On Sun, Apr 02, 2023 at 12:44:40AM +0800, David Yang wrote:
> HiSTB TRNG are found on some HiSilicon STB SoCs.
> 
> Signed-off-by: David Yang <mmyangfl@...il.com>
> ---
> v2: fix typo
> v3: add option for post process depth, adjust timeout
> v4: do not case to __iomem, as requested
> v5: do not use rng->priv at all
>  drivers/crypto/hisilicon/Kconfig         |   7 +
>  drivers/crypto/hisilicon/Makefile        |   2 +-
>  drivers/crypto/hisilicon/trng/Makefile   |   3 +
>  drivers/crypto/hisilicon/trng/trng-stb.c | 176 +++++++++++++++++++++++
>  4 files changed, 187 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/crypto/hisilicon/trng/trng-stb.c
> 
> diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig
> index 4137a8bf131f..e8690c223584 100644
> --- a/drivers/crypto/hisilicon/Kconfig
> +++ b/drivers/crypto/hisilicon/Kconfig
> @@ -82,3 +82,10 @@ config CRYPTO_DEV_HISI_TRNG
>  	select CRYPTO_RNG
>  	help
>  	  Support for HiSilicon TRNG Driver.
> +
> +config CRYPTO_DEV_HISTB_TRNG
> +	tristate "Support for HiSTB TRNG Driver"
> +	depends on ARCH_HISI || COMPILE_TEST
> +	select HW_RANDOM
> +	help
> +	  Support for HiSTB TRNG Driver.
> diff --git a/drivers/crypto/hisilicon/Makefile b/drivers/crypto/hisilicon/Makefile
> index 8595a5a5d228..fc51e0edec69 100644
> --- a/drivers/crypto/hisilicon/Makefile
> +++ b/drivers/crypto/hisilicon/Makefile
> @@ -5,4 +5,4 @@ obj-$(CONFIG_CRYPTO_DEV_HISI_SEC2) += sec2/
>  obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o
>  hisi_qm-objs = qm.o sgl.o debugfs.o
>  obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/
> -obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += trng/
> +obj-y += trng/
> diff --git a/drivers/crypto/hisilicon/trng/Makefile b/drivers/crypto/hisilicon/trng/Makefile
> index d909079f351c..cf20b057c66b 100644
> --- a/drivers/crypto/hisilicon/trng/Makefile
> +++ b/drivers/crypto/hisilicon/trng/Makefile
> @@ -1,2 +1,5 @@
>  obj-$(CONFIG_CRYPTO_DEV_HISI_TRNG) += hisi-trng-v2.o
>  hisi-trng-v2-objs = trng.o
> +
> +obj-$(CONFIG_CRYPTO_DEV_HISTB_TRNG) += histb-trng.o
> +histb-trng-objs += trng-stb.o
> diff --git a/drivers/crypto/hisilicon/trng/trng-stb.c b/drivers/crypto/hisilicon/trng/trng-stb.c
> new file mode 100644
> index 000000000000..29200a7d3d81
> --- /dev/null
> +++ b/drivers/crypto/hisilicon/trng/trng-stb.c
> @@ -0,0 +1,176 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/*
> + * Device driver for True RNG in HiSTB SoCs
> + *
> + * Copyright (c) 2023 David Yang
> + */
> +
> +#include <crypto/internal/rng.h>
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/hw_random.h>
> +#include <linux/io.h>
> +#include <linux/iopoll.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/of_device.h>

You don't need anything from this header...

You need platform_device.h and mod_devicetable.h

[...]


> +static const struct of_device_id histb_trng_of_match[] = {
> +	{ .compatible = "hisilicon,histb-trng", },

This binding isn't documented. Please submit a schema.

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ