diff options
-rw-r--r-- | board/cr50/wp.c | 11 | ||||
-rw-r--r-- | include/tpm_vendor_cmds.h | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/board/cr50/wp.c b/board/cr50/wp.c index 55c7edcdc4..d8d8f760b9 100644 --- a/board/cr50/wp.c +++ b/board/cr50/wp.c @@ -129,9 +129,18 @@ static enum vendor_cmd_rc vc_set_wp(enum vendor_cmd_cc code, *response_size = 0; /* There shouldn't be any args */ - if (input_size) + if (input_size > 1) return VENDOR_RC_BOGUS_ARGS; + if (input_size == 1) { + uint8_t *cmd = buf; + + if (*cmd != WP_ENABLE) + return VENDOR_RC_BOGUS_ARGS; + + set_wp_state(1); + } + /* Get current wp settings */ if (board_forcing_wp()) response |= WPV_FORCE; diff --git a/include/tpm_vendor_cmds.h b/include/tpm_vendor_cmds.h index 9f37e1a33c..4cb3683d49 100644 --- a/include/tpm_vendor_cmds.h +++ b/include/tpm_vendor_cmds.h @@ -198,6 +198,13 @@ enum vendor_cmd_rc { VENDOR_RC_ERR = 0x500, }; +/* VENDOR_CC_WP options, only WP_ENABLE is accepted. */ +enum wp_options { + WP_NONE, + WP_CHECK, + WP_ENABLE +}; + /* * The TPMv2 Spec mandates that vendor-specific command codes have bit 29 set, * while bits 15-0 indicate the command. All other bits should be zero. |