Re: [PATCH v5 2/3] hw_random: cctrng: introduce Arm CryptoCell driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Hadar,

On Sun, 2020-03-22 at 17:31 +0200, Hadar Gat wrote:
> Introduce low level Arm CryptoCell TRNG HW support.
> 
> Signed-off-by: Hadar Gat <hadar.gat@xxxxxxx>
> ---
>  drivers/char/hw_random/Kconfig  |  12 +
>  drivers/char/hw_random/Makefile |   1 +
>  drivers/char/hw_random/cctrng.c | 735
> ++++++++++++++++++++++++++++++++++++++++
>  drivers/char/hw_random/cctrng.h |  69 ++++
>  4 files changed, 817 insertions(+)
>  create mode 100644 drivers/char/hw_random/cctrng.c
>  create mode 100644 drivers/char/hw_random/cctrng.h
> 
> [...]
> +static int cctrng_probe(struct platform_device *pdev)
> +{
> +	struct resource *req_mem_cc_regs = NULL;
> +	struct cctrng_drvdata *drvdata;
> +	struct device *dev = &pdev->dev;
> +	int rc = 0;
> +	u32 val;
> +	int irq;
> +
> +	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> +	if (!drvdata)
> +		return -ENOMEM;
> +
> +	drvdata->rng.name = devm_kstrdup(dev, dev_name(dev),
> GFP_KERNEL);
> +	if (!drvdata->rng.name)
> +		return -ENOMEM;
> +
> +	drvdata->rng.read = cctrng_read;
> +	drvdata->rng.priv = (unsigned long)drvdata;

You are not initializing drvdata->rng.quality to a default value, which
results in the TRNG not being used by the kernel by default. If its a
perfect TRNG this should be set to 1024, i.e. 1024 bits of entropy per
1024 bits of input.

Regards,
Rouven Czerwinski




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux