g: remove superfluous DCRYPTO_SHA256_init in HMAC implementation

DCRYPTO_HMAC_SHA256_init makes two calls to DCRYPTO_SHA256_init()
without an intervening HASH_final() call.  This is incorrect usage
of the the hashing API, and results in the hardware SHA engine
getting locked for the life-time of the process (and resulting
in all future hash calls falling back to the software implementation).

This bug manifested itself when introducing NVRAM encryption, which
requires the hardware SHA engine to be available for key generation.

BRANCH=none
BUG=chrome-os-partner:55331
TEST=TCG tests pass

Change-Id: Ia4ccb6a6d64636c4618ef775291442975f3f1f92
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/430154
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
nagendra modadugu
2017-01-18 11:55:28 -08:00
committed by chrome-bot
parent 383fea37f6
commit eeb0ea9a6e

View File

@@ -40,7 +40,6 @@ static void HMAC_init(LITE_HMAC_CTX *ctx, const void *key, unsigned int len)
void DCRYPTO_HMAC_SHA256_init(LITE_HMAC_CTX *ctx, const void *key,
unsigned int len)
{
DCRYPTO_SHA256_init(&ctx->hash, 0);
HMAC_init(ctx, key, len);
}