blob: e6659a991a7ee2a87dd43dc8d198bbffab76eea1 [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 Semenzato2666f102010-06-15 08:12:32 -070027 SetupTPM(0, 0);
Luigi Semenzato52a8d2d2010-05-28 10:34:31 -070028 GetStoredVersions(0, &x, &y);
29 WriteStoredVersions(0, 0, 0);
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070030 LockFirmwareVersions();
31 LockKernelVersionsByLockingPP();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070032
Randall Spanglerd1836442010-06-10 09:59:04 -070033 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070034 TlclLibInit();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070035 TlclStartup();
36 TlclSelftestfull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070037 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070038 TlclDefineSpace(0, 0, 0);
39 TlclWrite(0, 0, 0);
40 TlclRead(0, 0, 0);
41 TlclWriteLock(0);
42 TlclReadLock(0);
43 TlclAssertPhysicalPresence();
44 TlclSetNvLocked();
45 TlclIsOwned();
46 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070047 TlclSetEnable();
48 TlclSetDeactivated(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070049 TlclGetFlags(0, 0);
50
Randall Spanglerd1836442010-06-10 09:59:04 -070051 /* vboot_common.h */
52 OffsetOf(0, 0);
53 GetPublicKeyData(0);
54 GetPublicKeyDataC(0);
55 GetSignatureData(0);
56 GetSignatureDataC(0);
57 VerifyMemberInside(0, 0, 0, 0, 0, 0);
58 VerifyPublicKeyInside(0, 0, 0);
59 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070060 PublicKeyInit(0, 0, 0);
61 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070062 PublicKeyToRSA(0);
63 VerifyData(0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070064 VerifyDigest(0, 0, 0);
Randall Spangler729b8722010-06-11 11:16:20 -070065 KeyBlockVerify(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070066 VerifyFirmwarePreamble2(0, 0, 0);
67 VerifyKernelPreamble2(0, 0, 0);
68
Bill Richardson0b8f35c2010-05-26 09:18:38 -070069 return 0;
70}