blob: 4696c2e61d64125cf94fd73bf558a70c5807aff8 [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();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070038 TlclStartup();
39 TlclSelftestfull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070040 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070041 TlclDefineSpace(0, 0, 0);
42 TlclWrite(0, 0, 0);
43 TlclRead(0, 0, 0);
44 TlclWriteLock(0);
45 TlclReadLock(0);
46 TlclAssertPhysicalPresence();
47 TlclSetNvLocked();
48 TlclIsOwned();
49 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070050 TlclSetEnable();
51 TlclSetDeactivated(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070052 TlclGetFlags(0, 0);
53
Randall Spanglerd1836442010-06-10 09:59:04 -070054 /* vboot_common.h */
55 OffsetOf(0, 0);
56 GetPublicKeyData(0);
57 GetPublicKeyDataC(0);
58 GetSignatureData(0);
59 GetSignatureDataC(0);
60 VerifyMemberInside(0, 0, 0, 0, 0, 0);
61 VerifyPublicKeyInside(0, 0, 0);
62 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070063 PublicKeyInit(0, 0, 0);
64 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070065 PublicKeyToRSA(0);
66 VerifyData(0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070067 VerifyDigest(0, 0, 0);
Randall Spangler729b8722010-06-11 11:16:20 -070068 KeyBlockVerify(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070069 VerifyFirmwarePreamble2(0, 0, 0);
70 VerifyKernelPreamble2(0, 0, 0);
71
Bill Richardson0b8f35c2010-05-26 09:18:38 -070072 return 0;
73}