Re: [PATCH v8 7/8] crypto: caam - enable prediction resistance in HRWNG

From: Horia GeantÄ
Date: Tue Mar 17 2020 - 13:41:45 EST


On 3/16/2020 5:01 PM, Andrey Smirnov wrote:
> Instantiate CAAM RNG with prediction resistance enabled to improve its
> quality (with PR on DRNG is forced to reseed from TRNG every time
> random data is generated).
>
> Management Complex firmware with version lower than 10.20.0
> doesn't provide prediction resistance support. Consider this
> and only instantiate rng when mc f/w version is lower.
>
As mentioned previously, this does not compile.

Please include the dependency
"bus: fsl-mc: add api to retrieve mc version"
https://patchwork.kernel.org/patch/11352493/
in the patch set.

> @@ -564,6 +579,26 @@ static void caam_remove_debugfs(void *root)
> }
> #endif
>
> +#ifdef CONFIG_FSL_MC_BUS
> +static bool check_version(struct fsl_mc_version *mc_version, u32 major,
> + u32 minor, u32 revision)
> +{
> + if (mc_version->major > major)
> + return true;
> +
> + if (mc_version->major == major) {
> + if (mc_version->minor > minor)
> + return true;
> +
> + if (mc_version->minor == minor && mc_version->revision > 0)
There's a typo in the code we provided, sorry for this.
Should be:
if (mc_version->minor == minor && mc_version->revision > revision)

Thanks,
Horia