mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
VbLockDevice() would be inconvenient to port to 64-byte NV storage records because it doesn't take VbSharedData flags or a vb2_context. So, just have depthcharge call vbnv_write() directly (as it does in other places in fastboot.c) and get rid of this API. BUG=chromium:789276 BRANCH=none TEST=make runtests CQ-DEPEND=CL:944183 Change-Id: I2aeaecf7f929cd1a1ebd1f6850d0dd96c6fabb49 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/944243 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
52 lines
951 B
C
52 lines
951 B
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Tests for vboot_api_kernel.c
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "test_common.h"
|
|
#include "vboot_api.h"
|
|
|
|
/* Mock data */
|
|
static uint32_t virtual_dev_mode_fail;
|
|
|
|
/**
|
|
* Reset mock data (for use before each test)
|
|
*/
|
|
static void ResetMocks(void)
|
|
{
|
|
virtual_dev_mode_fail = 0;
|
|
}
|
|
|
|
/* Mocks */
|
|
uint32_t SetVirtualDevMode(int val)
|
|
{
|
|
if (virtual_dev_mode_fail)
|
|
return VBERROR_SIMULATED;
|
|
return VBERROR_SUCCESS;
|
|
}
|
|
|
|
static void VbUnlockDeviceTest(void)
|
|
{
|
|
ResetMocks();
|
|
TEST_EQ(VbUnlockDevice(), 0, "unlock success");
|
|
|
|
ResetMocks();
|
|
virtual_dev_mode_fail = 1;
|
|
TEST_EQ(VbUnlockDevice(), VBERROR_TPM_SET_BOOT_MODE_STATE,
|
|
"set dev fail");
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
VbUnlockDeviceTest();
|
|
|
|
return gTestSuccess ? 0 : 255;
|
|
}
|