lkml.org 
[lkml]   [2020]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v6 6/7] crypto: caam - enable prediction resistance in HRWNG
Date
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)
instantiate_rng() is called with
state_handle_mask = rd_reg32(&ctrl->r4tst[0].rdsta) & RDSTA_IFMASK;
so if (rdsta_pr & state_handle_mask) will always be false,
leading to unneeded state handle re-initialization.

Horia




\
 
 \ /
  Last update: 2020-01-21 17:38    [W:0.447 / U:4.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site