blob: 6629cc5cb0b6280a730559a194fba8f134239afc [file] [log] [blame]
Randall Spangler29e88072012-06-19 10:03:53 -07001/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Randall Spanglercbaf6962010-08-05 16:42:43 -07002 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
Bill Richardson0b8f35c2010-05-26 09:18:38 -07005
Bill Richardson0c3ba242013-03-29 11:09:30 -07006#include "sysincludes.h"
7
Randall Spangler3003c1d2010-05-27 09:20:11 -07008#include "cgptlib.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -07009#include "load_kernel_fw.h"
10#include "rollback_index.h"
11#include "tlcl.h"
Randall Spanglerd1836442010-06-10 09:59:04 -070012#include "vboot_common.h"
Randall Spanglerd1836442010-06-10 09:59:04 -070013#include "vboot_kernel.h"
Randall Spangler9e162cd2011-02-22 13:06:53 -080014#include "vboot_nvstorage.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -070015
Randall Spangler39f66112010-07-14 09:10:23 -070016
Bill Richardson0b8f35c2010-05-26 09:18:38 -070017int main(void)
18{
Bill Richardsonf4f395e2014-10-22 17:42:20 -070019 /* cgptlib.h */
20 GptInit(0);
21 GptNextKernelEntry(0, 0, 0);
22 GptUpdateKernelEntry(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070023
Bill Richardsonf4f395e2014-10-22 17:42:20 -070024 /* load_kernel_fw.h */
25 LoadKernel(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070026
Bill Richardsonf4f395e2014-10-22 17:42:20 -070027 /* rollback_index.h */
Bill Richardsonf4f395e2014-10-22 17:42:20 -070028 RollbackKernelRead(0);
29 RollbackKernelWrite(0);
30 RollbackKernelLock(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070031
Bill Richardsonf4f395e2014-10-22 17:42:20 -070032 /* tlcl.h */
33 TlclStartup();
34 TlclResume();
35 TlclSelfTestFull();
36 TlclContinueSelfTest();
37 TlclDefineSpace(0, 0, 0);
38 TlclWrite(0, 0, 0);
39 TlclRead(0, 0, 0);
40 TlclWriteLock(0);
41 TlclReadLock(0);
Bill Richardsonf4f395e2014-10-22 17:42:20 -070042 TlclIsOwned();
43 TlclForceClear();
44 TlclSetEnable();
Bill Richardsonf4f395e2014-10-22 17:42:20 -070045 TlclSetDeactivated(0);
46 TlclGetFlags(0, 0, 0);
Andrey Pronin3e0a3522016-07-22 18:45:37 -070047 TlclSetGlobalLock();
Bill Richardsonf4f395e2014-10-22 17:42:20 -070048 TlclExtend(0, 0, 0);
49 TlclGetPermissions(0, 0);
Andrey Pronin1becb0d2016-07-06 19:10:46 -070050#ifndef TPM2_MODE
51 TlclAssertPhysicalPresence();
52 TlclSetNvLocked();
53 TlclClearEnable();
Andrey Pronin1becb0d2016-07-06 19:10:46 -070054#endif
Bill Richardson0b8f35c2010-05-26 09:18:38 -070055
Bill Richardsonf4f395e2014-10-22 17:42:20 -070056 /* vboot_api.h - entry points INTO vboot_reference */
Bill Richardsonf4f395e2014-10-22 17:42:20 -070057 VbSelectAndLoadKernel(0, 0);
Randall Spangler1b1998d2011-07-01 16:12:47 -070058
Bill Richardsonf4f395e2014-10-22 17:42:20 -070059 /* vboot_common.h */
60 OffsetOf(0, 0);
61 GetPublicKeyData(0);
62 GetPublicKeyDataC(0);
63 GetSignatureData(0);
64 GetSignatureDataC(0);
65 VerifyMemberInside(0, 0, 0, 0, 0, 0);
66 VerifyPublicKeyInside(0, 0, 0);
67 VerifySignatureInside(0, 0, 0);
68 PublicKeyInit(0, 0, 0);
69 PublicKeyCopy(0, 0);
Bill Richardsonf4f395e2014-10-22 17:42:20 -070070 VbSharedDataInit(0, 0);
71 VbSharedDataReserve(0, 0);
72 VbSharedDataSetKernelKey(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070073
Bill Richardsonf4f395e2014-10-22 17:42:20 -070074 VbNvSetup(0);
75 VbNvGet(0, 0, 0);
76 VbNvSet(0, 0, 0);
77 VbNvTeardown(0);
Randall Spangler9e162cd2011-02-22 13:06:53 -080078
Bill Richardsonf4f395e2014-10-22 17:42:20 -070079 return 0;
Bill Richardson0b8f35c2010-05-26 09:18:38 -070080}