vboot: fix vboot_api_kernel_tests after ctx change

CL:1517061 pulled vb2_context storage up to a higher level in the
call stack.  It also changed vboot_api_kernel{4,5}_tests to use
the same context object as that used for VbExNvStorageRead and
VbExNvStorageWrite calls.

These tests were already initializing the vb2_context workbuf.
Since VbSelectAndLoadKernel and VbVerifyMemoryBootImage both
initialize the context object internally, ctx.workbuf was being
overwritten as part of the call, causing issues later on when
calling free().  (See chromium:946970 for more details.)

Separate these two context objects to clarify which one is being
used as an NVRAM backend, and which one is the classical
"context" object passed around in vboot flow.  Also remove the
NVRAM context's workbuf, since it is not used.

BUG=b:124141368, chromium:946970
TEST=make clean && make runtests

Change-Id: Ic1da92ce754e61d4102ca8a6eb9587cd8d9eca10
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1547711
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
2 files changed