g: check the return value of the DCRYPTO_aes_block function

There's no indication that the h/w AES function fails,
but checking the return value prevents applications
from silently proceeding and failing at a future time
(e.g. NVMEM encryption).

BRANCH=none
BUG=chrome-os-partner:55331
TEST=tpmtest.py passes

Change-Id: I8e3a9426ec31a1b0798aface55c636dc1c707b34
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/430371
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
nagendra modadugu
2017-01-18 16:27:48 -08:00
committed by chrome-bot
parent 2ad394d5c0
commit b828305a9b

View File

@@ -140,7 +140,8 @@ int DCRYPTO_aes_ctr(uint8_t *out, const uint8_t *key, uint32_t key_bits,
inp = in;
outp = out;
}
DCRYPTO_aes_block(inp, outp);
if (!DCRYPTO_aes_block(inp, outp))
return 0;
if (outp != out)
memcpy(out, outp, count);