blob: daa424727c47bd1f50ff19a09ee83b41fb9c0cdf [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"
Bill Richardson0b8f35c2010-05-26 09:18:38 -070013
Randall Spangler39f66112010-07-14 09:10:23 -070014
Bill Richardson0b8f35c2010-05-26 09:18:38 -070015int main(void)
16{
Randall Spanglerd1836442010-06-10 09:59:04 -070017 /* cgptlib.h */
Randall Spangler3003c1d2010-05-27 09:20:11 -070018 GptInit(0);
19 GptNextKernelEntry(0, 0, 0);
20 GptUpdateKernelEntry(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070021
Randall Spanglerd1836442010-06-10 09:59:04 -070022 /* load_firmware_fw.h */
Randall Spanglerd471f2a2010-06-16 12:05:10 -070023 UpdateFirmwareBodyHash(0, 0, 0);
Randall Spangler7202eae2010-06-08 11:02:17 -070024 LoadFirmware(0);
25
Randall Spanglerd1836442010-06-10 09:59:04 -070026 /* load_kernel_fw.h */
Randall Spangler0ff6fea2010-05-27 18:36:02 -070027 LoadKernel(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070028
Randall Spanglerd1836442010-06-10 09:59:04 -070029 /* rollback_index.h */
Randall Spangler66680282010-08-16 12:33:44 -070030 RollbackFirmwareSetup(0, 0);
31 RollbackFirmwareWrite(0);
Randall Spangler10788382010-06-23 15:35:31 -070032 RollbackFirmwareLock();
33 RollbackKernelRecovery(0);
Randall Spangler66680282010-08-16 12:33:44 -070034 RollbackKernelRead(0);
35 RollbackKernelWrite(0);
Randall Spangler10788382010-06-23 15:35:31 -070036 RollbackKernelLock();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070037
Randall Spanglerd1836442010-06-10 09:59:04 -070038 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070039 TlclLibInit();
Luigi Semenzato416f6812010-07-08 12:12:12 -070040 TlclCloseDevice();
41 TlclOpenDevice();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070042 TlclStartup();
Randall Spangler3e1081f2010-07-19 10:04:21 -070043 TlclSelfTestFull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070044 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070045 TlclDefineSpace(0, 0, 0);
46 TlclWrite(0, 0, 0);
47 TlclRead(0, 0, 0);
48 TlclWriteLock(0);
49 TlclReadLock(0);
50 TlclAssertPhysicalPresence();
51 TlclSetNvLocked();
52 TlclIsOwned();
53 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070054 TlclSetEnable();
Luigi Semenzato416f6812010-07-08 12:12:12 -070055 TlclClearEnable();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070056 TlclSetDeactivated(0);
Randall Spangler3e1081f2010-07-19 10:04:21 -070057 TlclGetFlags(0, 0, 0);
Gaurav Shah2447dd22010-08-30 11:43:57 -070058 TlclSetGlobalLock();
59 TlclExtend(0, 0, 0);
60 TlclGetPermissions(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070061
Randall Spanglerd1836442010-06-10 09:59:04 -070062 /* vboot_common.h */
63 OffsetOf(0, 0);
64 GetPublicKeyData(0);
65 GetPublicKeyDataC(0);
66 GetSignatureData(0);
67 GetSignatureDataC(0);
68 VerifyMemberInside(0, 0, 0, 0, 0, 0);
69 VerifyPublicKeyInside(0, 0, 0);
70 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070071 PublicKeyInit(0, 0, 0);
72 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070073 PublicKeyToRSA(0);
Randall Spangler87c13d82010-07-19 10:35:40 -070074 VerifyData(0, 0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070075 VerifyDigest(0, 0, 0);
Randall Spangler138acfe2010-08-17 15:45:21 -070076 KeyBlockVerify(0, 0, 0, 0);
Randall Spangler87c13d82010-07-19 10:35:40 -070077 VerifyFirmwarePreamble(0, 0, 0);
78 VerifyKernelPreamble(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070079
Bill Richardson0b8f35c2010-05-26 09:18:38 -070080 return 0;
81}