blob: f91da9950e1c8aec28d820645ef35c61e29d0ab2 [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 */
Randall Spangler10788382010-06-23 15:35:31 -070027 RollbackFirmwareSetup(0, &x, &y);
28 RollbackFirmwareWrite(0, 0);
29 RollbackFirmwareLock();
30 RollbackKernelRecovery(0);
31 RollbackKernelRead(&x, &y);
32 RollbackKernelWrite(0, 0);
33 RollbackKernelLock();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070034
Randall Spanglerd1836442010-06-10 09:59:04 -070035 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070036 TlclLibInit();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070037 TlclStartup();
38 TlclSelftestfull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070039 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070040 TlclDefineSpace(0, 0, 0);
41 TlclWrite(0, 0, 0);
42 TlclRead(0, 0, 0);
43 TlclWriteLock(0);
44 TlclReadLock(0);
45 TlclAssertPhysicalPresence();
46 TlclSetNvLocked();
47 TlclIsOwned();
48 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070049 TlclSetEnable();
50 TlclSetDeactivated(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070051 TlclGetFlags(0, 0);
52
Randall Spanglerd1836442010-06-10 09:59:04 -070053 /* vboot_common.h */
54 OffsetOf(0, 0);
55 GetPublicKeyData(0);
56 GetPublicKeyDataC(0);
57 GetSignatureData(0);
58 GetSignatureDataC(0);
59 VerifyMemberInside(0, 0, 0, 0, 0, 0);
60 VerifyPublicKeyInside(0, 0, 0);
61 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070062 PublicKeyInit(0, 0, 0);
63 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070064 PublicKeyToRSA(0);
65 VerifyData(0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070066 VerifyDigest(0, 0, 0);
Randall Spangler729b8722010-06-11 11:16:20 -070067 KeyBlockVerify(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070068 VerifyFirmwarePreamble2(0, 0, 0);
69 VerifyKernelPreamble2(0, 0, 0);
70
Bill Richardson0b8f35c2010-05-26 09:18:38 -070071 return 0;
72}