Commit 5ee0c76
committed
fix(tpm2_loadexternal): check return value of RAND_bytes
RAND_bytes() can fail with return code 0 or -1 when the OpenSSL CSPRNG has
not been sufficiently seeded.
If RAND_bytes() fails, seed->buffer is left uninitialised. This seed value
is stored in ctx.priv.sensitiveArea.seedValue and used in the consistency
checks by TPM.
Check the return value and return tool_rc_general_error on failure so that
the operation is aborted rather than proceeding with a bad seed.
Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>1 parent d15fc36 commit 5ee0c76
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
288 | 292 | | |
289 | 293 | | |
290 | 294 | | |
| |||
0 commit comments