summaryrefslogtreecommitdiff
path: root/tests/tpm_lite/tpmtest_enable.c
blob: c2fe54b029212145bd551f3942f338b7a1273ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Testing: ownership testing code, ForceClear, and nvram write limit.
 */

#include <stdio.h>

#include "2common.h"
#include "host_common.h"
#include "tlcl.h"
#include "tlcl_tests.h"


int main(int argc, char** argv) {
	uint8_t disable, deactivated;

	TlclLibInit();
	TPM_CHECK(TlclStartupIfNeeded());
	TPM_CHECK(TlclSelfTestFull());
	TPM_CHECK(TlclAssertPhysicalPresence());
	TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
	printf("disable is %d, deactivated is %d\n", disable, deactivated);
	TPM_CHECK(TlclSetEnable());
	TPM_CHECK(TlclSetDeactivated(0));
	TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
	printf("disable is %d, deactivated is %d\n", disable, deactivated);
	if (disable == 1 || deactivated == 1) {
		VB2_DEBUG("failed to enable or activate");
		return 1;
	}
	printf("TEST SUCCEEDED\n");
	return 0;
}