Commit 7896fdff authored by Stephan Müller's avatar Stephan Müller Committed by Treehugger Robot
Browse files

UPSTREAM: crypto: jitter - reuse allocated entropy collector



In case a health test error occurs during runtime, the power-up health
tests are rerun to verify that the noise source is still good and
that the reported health test error was an outlier. For performing this
power-up health test, the already existing entropy collector instance
is used instead of allocating a new one. This change has the following
implications:

* The noise that is collected as part of the newly run health tests is
  inserted into the entropy collector and thus stirs the existing
  data present in there further. Thus, the entropy collected during
  the health test is not wasted. This is also allowed by SP800-90B.

* The power-on health test is not affected by the state of the entropy
  collector, because it resets the APT / RCT state. The remainder of
  the state is unrelated to the health test as it is only applied to
  newly obtained time stamps.

This change also fixes a bug report about an allocation while in an
atomic lock (the lock is taken in jent_kcapi_random, jent_read_entropy
is called and this can call jent_entropy_init).

Fixes: 04597c8d ("jitter - add RCT/APT support for different OSRs")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>

(cherry picked from commit 8405ec8e)
Bug: 452983442
Bug: 425813935
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Cherrypick-From: https://android-review.googlesource.com/q/commit:ede62837296dd4429bb19725dab8b487d68147f1


Merged-In: Ie83cafde9e9be41003445cc1cedd89d10bdb50f7
Change-Id: Ie83cafde9e9be41003445cc1cedd89d10bdb50f7
Signed-off-by: default avatarGina Ko <yichunko@google.com>
parent d5ae5eff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment