]> Git Repo - u-boot.git/blobdiff - cmd/tpm_test.c
Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm
[u-boot.git] / cmd / tpm_test.c
index 65332d11177791a7796e6bec5c38b20aa8728b6c..f21ad5d3cf9496b750af13f133efe3e9d0f0ce80 100644 (file)
@@ -1,13 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <command.h>
 #include <environment.h>
-#include <tpm.h>
+#include <tpm-v1.h>
 
 /* Prints error and returns on failure */
 #define TPM_CHECK(tpm_command) do { \
@@ -63,14 +62,6 @@ static uint32_t tpm_get_flags(uint8_t *disable, uint8_t *deactivated,
        return 0;
 }
 
-static uint32_t tpm_set_global_lock(void)
-{
-       uint32_t x;
-
-       debug("TPM: Set global lock\n");
-       return tpm_nv_write_value(INDEX0, (uint8_t *)&x, 0);
-}
-
 static uint32_t tpm_nv_write_value_lock(uint32_t index)
 {
        debug("TPM: Write lock 0x%x\n", index);
@@ -78,13 +69,6 @@ static uint32_t tpm_nv_write_value_lock(uint32_t index)
        return tpm_nv_write_value(index, NULL, 0);
 }
 
-static uint32_t tpm_nv_set_locked(void)
-{
-       debug("TPM: Set NV locked\n");
-
-       return tpm_nv_define_space(TPM_NV_INDEX_LOCK, 0, 0);
-}
-
 static int tpm_is_owned(void)
 {
        uint8_t response[TPM_PUBEK_SIZE];
@@ -303,12 +287,12 @@ static int test_readonly(void)
        index_0 += 1;
        if (tpm_nv_write_value(INDEX0, (uint8_t *)&index_0, sizeof(index_0) !=
                TPM_SUCCESS)) {
-               error("\tcould not write index 0\n");
+               pr_err("\tcould not write index 0\n");
        }
        tpm_nv_write_value_lock(INDEX0);
        if (tpm_nv_write_value(INDEX0, (uint8_t *)&index_0, sizeof(index_0)) ==
                        TPM_SUCCESS)
-               error("\tindex 0 is not locked\n");
+               pr_err("\tindex 0 is not locked\n");
 
        printf("\tdone\n");
        return 0;
@@ -471,7 +455,7 @@ static int test_write_limit(void)
                case TPM_MAXNVWRITES:
                        assert(i >= TPM_MAX_NV_WRITES_NOOWNER);
                default:
-                       error("\tunexpected error code %d (0x%x)\n",
+                       pr_err("\tunexpected error code %d (0x%x)\n",
                              result, result);
                }
        }
@@ -532,15 +516,15 @@ static cmd_tbl_t cmd_cros_tpm_sub[] = {
 static int do_tpmtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        cmd_tbl_t *c;
+       int i;
 
        printf("argc = %d, argv = ", argc);
-       do {
-               int i = 0;
 
-               for (i = 0; i < argc; i++)
-                       printf(" %s", argv[i]);
-                       printf("\n------\n");
-               } while (0);
+       for (i = 0; i < argc; i++)
+               printf(" %s", argv[i]);
+
+       printf("\n------\n");
+
        argc--;
        argv++;
        c = find_cmd_tbl(argv[0], cmd_cros_tpm_sub,
This page took 0.028971 seconds and 4 git commands to generate.