Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp_tinyuf2: fix nvs hidden key (AEGHB-961) #462

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/usb/esp_tinyuf2/esp_tinyuf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ static void _usb_otg_phy_init(bool enable)
// Configure USB JTAG PHY
#if SOC_USB_SERIAL_JTAG_SUPPORTED
phy_conf.controller = USB_PHY_CTRL_SERIAL_JTAG;
phy_conf.otg_mode = USB_PHY_MODE_DEFAULT;
phy_conf.otg_speed = USB_PHY_SPEED_UNDEFINED;
usb_new_phy(&phy_conf, &phy_hdl);
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions components/usb/esp_tinyuf2/esp_tinyuf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void esp_restart_from_tinyuf2(void);
* @return
* - ESP_OK: Operation was successful.
*/
esp_err_t esp_tinyuf2_set_all_key_hidden(bool if_hidden)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wormyrocks, is there any difference? Whether there is a formal parameter or not, makes no difference to the function itself.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my machine it won't compile without this change - something to do with the compiler settings in tinyuf2.
Outside of the include guards, all the other declarations in that file follow the same style.

esp_err_t esp_tinyuf2_set_all_key_hidden(bool);

/**
* @brief Add a key to the hidden keys list.
Expand All @@ -134,7 +134,7 @@ esp_err_t esp_tinyuf2_set_all_key_hidden(bool if_hidden)
* - ESP_ERR_INVALID_ARG: Provided key is NULL.
* - ESP_ERR_NO_MEM: Memory allocation failed or maximum number of hidden keys exceeded.
*/
esp_err_t esp_tinyuf2_add_key_hidden(const char *key)
esp_err_t esp_tinyuf2_add_key_hidden(const char *);
#endif

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions components/usb/esp_tinyuf2/uf2/board_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static nvs_modified_cb_t _modified_cb = NULL;
static char _part_name[16] = "";
static char _namespace_name[16] = "";
#ifdef CONFIG_UF2_INI_NVS_VALUE_HIDDEN
char *HIDDEN_STR[CONFIG_UF2_INI_NVS_HIDDEN_MAX_NUM];
char *hidden_str[CONFIG_UF2_INI_NVS_HIDDEN_MAX_NUM];
size_t hidden_str_num = 0;
bool if_all_hidden = false;
#endif
Expand Down Expand Up @@ -232,7 +232,7 @@ static void ini_gen_from_nvs(const char *part, const char *name)
char *str = (char *)malloc(len);
if ((result = nvs_get_str(nvs, info.key, str, &len)) == ESP_OK) {
#ifdef CONFIG_UF2_INI_NVS_VALUE_HIDDEN
if (!check_value_if_hidden(info.key)) {
if (check_value_if_hidden(info.key)) {
ini_insert_pair(info.key, "****");
} else
#endif
Expand Down
Loading