Commit 072068b5 authored by Geoff Simmons's avatar Geoff Simmons

Fix what appears to be a bug in clang.

After the derive_prenonce() call, the local array cek, which had
the right value after the prior call to derive_cek(), was apparently
overwritten. So copy it before that can happen.
parent b188e606
......@@ -268,14 +268,15 @@ crypto_init(struct vfp_ctx *ctx, struct ece_crypto *crypto, uint8_t *salt,
if (vp == VFP_ERROR)
return (vp);
if (derive_cek(prk, cek, errmsg) != 0
|| derive_prenonce(prk, prenonce, errmsg) != 0)
if (derive_cek(prk, cek, errmsg) != 0)
return (VERR_DEC(ctx, "%s", errmsg));
memcpy(crypto->cek, cek, AES128_KEYLEN);
if (derive_prenonce(prk, prenonce, errmsg) != 0)
return (VERR_DEC(ctx, "%s", errmsg));
KEY_Wipe(prk);
crypto->prenonce_hi = vbe32dec(prenonce);
crypto->prenonce_lo = vbe64dec(prenonce + 4);
memcpy(crypto->cek, cek, AES128_KEYLEN);
return (VFP_OK);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment