~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 216c942dd48bafc4140d39be6774a38de891501d (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-2.0+
/*
 * (C) Copyright 2021, Foundries.IO
 *
 */

#include <common.h>
#include <command.h>
#include <env.h>
#include <scp03.h>

int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc,
		    char *const argv[])
{
	if (argc != 1)
		return CMD_RET_USAGE;

	if (tee_enable_scp03()) {
		printf("TEE failed to enable SCP03\n");
		return CMD_RET_FAILURE;
	}

	printf("SCP03 is enabled\n");

	return CMD_RET_SUCCESS;
}

int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc,
		       char *const argv[])
{
	if (argc != 1)
		return CMD_RET_USAGE;

	if (tee_provision_scp03()) {
		printf("TEE failed to provision SCP03 keys\n");
		return CMD_RET_FAILURE;
	}

	printf("SCP03 is provisioned\n");

	return CMD_RET_SUCCESS;
}

static char text[] =
	"provides a command to enable SCP03 and provision the SCP03 keys\n"
	" enable    - enable SCP03 on the TEE\n"
	" provision - provision SCP03 on the TEE\n";

U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", text,
	U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable),
	U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision));