blob: 6f5b83e4394ca89c6b273a7e3627bc8a9136b6c3 [file] [log] [blame]
Randall Spanglercbaf6962010-08-05 16:42:43 -07001/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * 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
Randall Spangler3003c1d2010-05-27 09:20:11 -07006#include "cgptlib.h"
Randall Spangler7202eae2010-06-08 11:02:17 -07007#include "load_firmware_fw.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -07008#include "load_kernel_fw.h"
9#include "rollback_index.h"
10#include "tlcl.h"
Randall Spanglerd1836442010-06-10 09:59:04 -070011#include "vboot_common.h"
Randall Spanglerd1836442010-06-10 09:59:04 -070012#include "vboot_kernel.h"
Randall Spangler9e162cd2011-02-22 13:06:53 -080013#include "vboot_nvstorage.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -070014
Randall Spangler39f66112010-07-14 09:10:23 -070015
Bill Richardson0b8f35c2010-05-26 09:18:38 -070016int main(void)
17{
Randall Spanglerd1836442010-06-10 09:59:04 -070018 /* cgptlib.h */
Randall Spangler3003c1d2010-05-27 09:20:11 -070019 GptInit(0);
20 GptNextKernelEntry(0, 0, 0);
21 GptUpdateKernelEntry(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070022
Randall Spanglerd1836442010-06-10 09:59:04 -070023 /* load_firmware_fw.h */
Randall Spanglerd471f2a2010-06-16 12:05:10 -070024 UpdateFirmwareBodyHash(0, 0, 0);
Randall Spangler7202eae2010-06-08 11:02:17 -070025 LoadFirmware(0);
26
Randall Spanglerd1836442010-06-10 09:59:04 -070027 /* load_kernel_fw.h */
Randall Spangler0ff6fea2010-05-27 18:36:02 -070028 LoadKernel(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070029
Randall Spanglerd1836442010-06-10 09:59:04 -070030 /* rollback_index.h */
Randall Spangler1fe16072010-09-02 11:37:51 -070031 RollbackS3Resume();
Randall Spangler66680282010-08-16 12:33:44 -070032 RollbackFirmwareSetup(0, 0);
33 RollbackFirmwareWrite(0);
Randall Spangler10788382010-06-23 15:35:31 -070034 RollbackFirmwareLock();
35 RollbackKernelRecovery(0);
Randall Spangler66680282010-08-16 12:33:44 -070036 RollbackKernelRead(0);
37 RollbackKernelWrite(0);
Randall Spangler10788382010-06-23 15:35:31 -070038 RollbackKernelLock();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070039
Randall Spanglerd1836442010-06-10 09:59:04 -070040 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070041 TlclLibInit();
Luigi Semenzato416f6812010-07-08 12:12:12 -070042 TlclCloseDevice();
43 TlclOpenDevice();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070044 TlclStartup();
Randall Spangler1fe16072010-09-02 11:37:51 -070045 TlclResume();
Randall Spangler3e1081f2010-07-19 10:04:21 -070046 TlclSelfTestFull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070047 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070048 TlclDefineSpace(0, 0, 0);
49 TlclWrite(0, 0, 0);
50 TlclRead(0, 0, 0);
51 TlclWriteLock(0);
52 TlclReadLock(0);
53 TlclAssertPhysicalPresence();
54 TlclSetNvLocked();
55 TlclIsOwned();
56 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070057 TlclSetEnable();
Luigi Semenzato416f6812010-07-08 12:12:12 -070058 TlclClearEnable();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070059 TlclSetDeactivated(0);
Randall Spangler3e1081f2010-07-19 10:04:21 -070060 TlclGetFlags(0, 0, 0);
Gaurav Shah2447dd22010-08-30 11:43:57 -070061 TlclSetGlobalLock();
62 TlclExtend(0, 0, 0);
63 TlclGetPermissions(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070064
Randall Spanglerd1836442010-06-10 09:59:04 -070065 /* vboot_common.h */
66 OffsetOf(0, 0);
67 GetPublicKeyData(0);
68 GetPublicKeyDataC(0);
69 GetSignatureData(0);
70 GetSignatureDataC(0);
71 VerifyMemberInside(0, 0, 0, 0, 0, 0);
72 VerifyPublicKeyInside(0, 0, 0);
73 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070074 PublicKeyInit(0, 0, 0);
75 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070076 PublicKeyToRSA(0);
Randall Spangler87c13d82010-07-19 10:35:40 -070077 VerifyData(0, 0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070078 VerifyDigest(0, 0, 0);
Randall Spangler138acfe2010-08-17 15:45:21 -070079 KeyBlockVerify(0, 0, 0, 0);
Randall Spangler87c13d82010-07-19 10:35:40 -070080 VerifyFirmwarePreamble(0, 0, 0);
81 VerifyKernelPreamble(0, 0, 0);
Randall Spangler95c40312011-03-09 15:54:16 -080082 VbSharedDataInit(0, 0);
83 VbSharedDataReserve(0, 0);
84 VbSharedDataSetKernelKey(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070085
Randall Spangler9e162cd2011-02-22 13:06:53 -080086 VbNvSetup(0);
87 VbNvGet(0, 0, 0);
88 VbNvSet(0, 0, 0);
89 VbNvTeardown(0);
90
Bill Richardson0b8f35c2010-05-26 09:18:38 -070091 return 0;
92}