blob: e726db324d69dc26fcec68e89a3e65c4e5be361c [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
Randall Spangler39f66112010-07-14 09:10:23 -070010
Bill Richardson0b8f35c2010-05-26 09:18:38 -070011int main(void)
12{
Luigi Semenzato52a8d2d2010-05-28 10:34:31 -070013 uint16_t x, y;
14
Randall Spanglerd1836442010-06-10 09:59:04 -070015 /* cgptlib.h */
Randall Spangler3003c1d2010-05-27 09:20:11 -070016 GptInit(0);
17 GptNextKernelEntry(0, 0, 0);
18 GptUpdateKernelEntry(0, 0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070019
Randall Spanglerd1836442010-06-10 09:59:04 -070020 /* load_firmware_fw.h */
Randall Spanglerd471f2a2010-06-16 12:05:10 -070021 UpdateFirmwareBodyHash(0, 0, 0);
Randall Spangler7202eae2010-06-08 11:02:17 -070022 LoadFirmware(0);
23
Randall Spanglerd1836442010-06-10 09:59:04 -070024 /* load_kernel_fw.h */
Randall Spangler0ff6fea2010-05-27 18:36:02 -070025 LoadKernel(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070026
Randall Spanglerd1836442010-06-10 09:59:04 -070027 /* rollback_index.h */
Luigi Semenzato2b9ddae2010-06-28 13:34:31 -070028 RollbackFirmwareSetup(0);
29 RollbackFirmwareRead(&x, &y);
Randall Spangler10788382010-06-23 15:35:31 -070030 RollbackFirmwareWrite(0, 0);
31 RollbackFirmwareLock();
32 RollbackKernelRecovery(0);
33 RollbackKernelRead(&x, &y);
34 RollbackKernelWrite(0, 0);
35 RollbackKernelLock();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070036
Randall Spanglerd1836442010-06-10 09:59:04 -070037 /* tlcl.h */
Luigi Semenzato59204c52010-06-09 13:37:15 -070038 TlclLibInit();
Luigi Semenzato416f6812010-07-08 12:12:12 -070039 TlclCloseDevice();
40 TlclOpenDevice();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070041 TlclStartup();
42 TlclSelftestfull();
Luigi Semenzato59204c52010-06-09 13:37:15 -070043 TlclContinueSelfTest();
Bill Richardson0b8f35c2010-05-26 09:18:38 -070044 TlclDefineSpace(0, 0, 0);
45 TlclWrite(0, 0, 0);
46 TlclRead(0, 0, 0);
47 TlclWriteLock(0);
48 TlclReadLock(0);
49 TlclAssertPhysicalPresence();
50 TlclSetNvLocked();
51 TlclIsOwned();
52 TlclForceClear();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070053 TlclSetEnable();
Luigi Semenzato416f6812010-07-08 12:12:12 -070054 TlclClearEnable();
Luigi Semenzatoded1cec2010-05-27 15:19:58 -070055 TlclSetDeactivated(0);
Bill Richardson0b8f35c2010-05-26 09:18:38 -070056 TlclGetFlags(0, 0);
57
Randall Spanglerd1836442010-06-10 09:59:04 -070058 /* vboot_common.h */
59 OffsetOf(0, 0);
60 GetPublicKeyData(0);
61 GetPublicKeyDataC(0);
62 GetSignatureData(0);
63 GetSignatureDataC(0);
64 VerifyMemberInside(0, 0, 0, 0, 0, 0);
65 VerifyPublicKeyInside(0, 0, 0);
66 VerifySignatureInside(0, 0, 0);
Randall Spanglera55e5ca2010-06-15 18:45:09 -070067 PublicKeyInit(0, 0, 0);
68 PublicKeyCopy(0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070069 PublicKeyToRSA(0);
70 VerifyData(0, 0, 0);
Randall Spangler39ed88e2010-06-15 14:53:01 -070071 VerifyDigest(0, 0, 0);
Randall Spangler729b8722010-06-11 11:16:20 -070072 KeyBlockVerify(0, 0, 0);
Randall Spanglerd1836442010-06-10 09:59:04 -070073 VerifyFirmwarePreamble2(0, 0, 0);
74 VerifyKernelPreamble2(0, 0, 0);
75
Bill Richardson0b8f35c2010-05-26 09:18:38 -070076 return 0;
77}