xref: /aosp_15_r20/external/vboot_reference/tests/tpm_lite/tpmtest_earlynvram.c (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2010 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 /* Test of early writing to the NVRAM.
7  */
8 
9 #include <stdio.h>
10 #include <stdint.h>
11 #include <stdlib.h>
12 
13 #include "tlcl.h"
14 #include "tlcl_tests.h"
15 
16 #define INDEX0 0xcafe
17 
main(int argc,char ** argv)18 int main(int argc, char** argv) {
19 	uint32_t x;
20 
21 	TlclLibInit();
22 	TPM_CHECK(TlclStartup());
23 	TPM_CHECK(TlclContinueSelfTest());
24 	TPM_CHECK(TlclAssertPhysicalPresence());
25 	TPM_CHECK(TlclRead(INDEX0, (uint8_t*) &x, sizeof(x)));
26 	printf("TEST SUCCEEDED\n");
27 	return 0;
28 }
29