blob: 5e900a96171a3f7727f94fe4a3d661c649606443 [file] [log] [blame]
Bill Richardson0b8f35c2010-05-26 09:18:38 -07001
Randall Spangler3003c1d2010-05-27 09:20:11 -07002#include "cgptlib.h"
Randall Spangler7202eae2010-06-08 11:02:17 -07003#include "load_firmware_fw.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -07004#include "load_kernel_fw.h"
5#include "rollback_index.h"
6#include "tlcl.h"
Randall Spanglerd1836442010-06-10 09:59:04 -07007#include "vboot_common.h"
Randall Spanglerd1836442010-06-10 09:59:04 -07008#include "vboot_kernel.h"
Bill Richardson0b8f35c2010-05-26 09:18:38 -07009
10int main(void)
11{
Luigi Semenzato52a8d2d2010-05-28 10:34:31 -070012 uint16_t x, y;
13
Randall Spanglerd1836442010-06-10 09:59:04 -070014 /* cgptlib.h */
Randall Spangler3003c1d2010-05-27 09:20:11 -070015 GptInit(0);
16 GptNextKernelEntry(0, 0, 0);
17 GptUpdateKernelEntry(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070018
Randall Spanglerd1836442010-06-10 09:59:04 -070019 /* load_firmware_fw.h */
Randall Spanglerd471f2a2010-06-16 12:05:10 -070020 UpdateFirmwareBodyHash(0, 0, 0);
Randall Spangler7202eae2010-06-08 11:02:17 -070021 LoadFirmware(0);
22
Randall Spanglerd1836442010-06-10 09:59:04 -070023 /* load_kernel_fw.h */
Randall Spangler0ff6fea2010-05-27 18:36:02 -070024 LoadKernel(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070025
Randall Spanglerd1836442010-06-10 09:59:04 -070026 /* rollback_index.h */
Luigi Semenzato2b9ddae2010-06-28 13:34:31 -070027 RollbackFirmwareSetup(0);
28 RollbackFirmwareRead(&x, &y);
Randall Spangler10788382010-06-23 15:35:31 -070029 RollbackFirmwareWrite(0, 0);
30 RollbackFirmwareLock();
31 RollbackKernelRecovery(0);
32 RollbackKernelRead(&x, &y);
33 RollbackKernelWrite(0, 0);
34 RollbackKernelLock();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070035
Randall Spanglerd1836442010-06-10 09:59:04 -070036 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070037 TlclLibInit();
Luigi Semenzato416f6812010-07-08 12:12:12 -070038 TlclCloseDevice();
39 TlclOpenDevice();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070040 TlclStartup();
41 TlclSelftestfull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070042 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070043 TlclDefineSpace(0, 0, 0);
44 TlclWrite(0, 0, 0);
45 TlclRead(0, 0, 0);
46 TlclWriteLock(0);
47 TlclReadLock(0);
48 TlclAssertPhysicalPresence();
49 TlclSetNvLocked();
50 TlclIsOwned();
51 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070052 TlclSetEnable();
Luigi Semenzato416f6812010-07-08 12:12:12 -070053 TlclClearEnable();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070054 TlclSetDeactivated(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070055 TlclGetFlags(0, 0);
56
Randall Spanglerd1836442010-06-10 09:59:04 -070057 /* vboot_common.h */
58 OffsetOf(0, 0);
59 GetPublicKeyData(0);
60 GetPublicKeyDataC(0);
61 GetSignatureData(0);
62 GetSignatureDataC(0);
63 VerifyMemberInside(0, 0, 0, 0, 0, 0);
64 VerifyPublicKeyInside(0, 0, 0);
65 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070066 PublicKeyInit(0, 0, 0);
67 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070068 PublicKeyToRSA(0);
69 VerifyData(0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070070 VerifyDigest(0, 0, 0);
Randall Spangler729b8722010-06-11 11:16:20 -070071 KeyBlockVerify(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070072 VerifyFirmwarePreamble2(0, 0, 0);
73 VerifyKernelPreamble2(0, 0, 0);
74
Bill Richardson0b8f35c2010-05-26 09:18:38 -070075 return 0;
76}