[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0402MB3485F1AF6DC4B74FF373B16998320@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Date: Mon, 20 Jan 2020 16:38:46 +0000
From: Horia Geanta <horia.geanta@....com>
To: Andrey Smirnov <andrew.smirnov@...il.com>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
CC: Chris Healy <cphealy@...il.com>,
Lucas Stach <l.stach@...gutronix.de>,
Herbert Xu <herbert@...dor.apana.org.au>,
Iuliana Prodan <iuliana.prodan@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH v6 6/7] crypto: caam - enable prediction resistance in
HRWNG
On 1/8/2020 5:42 PM, Andrey Smirnov wrote:
> @@ -275,12 +276,25 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
> return -ENOMEM;
>
> for (sh_idx = 0; sh_idx < RNG4_MAX_HANDLES; sh_idx++) {
> + const u32 rdsta_if = RDSTA_IF0 << sh_idx;
> + const u32 rdsta_pr = RDSTA_PR0 << sh_idx;
> + const u32 rdsta_mask = rdsta_if | rdsta_pr;
> /*
> * If the corresponding bit is set, this state handle
> * was initialized by somebody else, so it's left alone.
> */
> - if ((1 << sh_idx) & state_handle_mask)
> - continue;
> + if (rdsta_if & state_handle_mask) {
> + if (rdsta_pr & state_handle_mask)
> + continue;
> +
> + dev_info(ctrldev,
> + "RNG4 SH%d was previously instantiated without prediction resistance. Tearing it down\n",
> + sh_idx);
> +
> + ret = deinstantiate_rng(ctrldev, rdsta_if);
> + if (ret)
> + break;
In case state handle 0 is deinstantiated, its reinstantiation with PR support
will have the side effect of re-generating JDKEK, TDKEK, TDSK.
This needs to be avoided, since other SW components (like OP-TEE f/w)
could have black keys in use. Overwriting the KEK registers would no longer
allow CAAM to decrypt them.
Horia
Powered by blists - more mailing lists