Skip to content

Commit ecec111

Browse files
committed
Add exported function to check if security keys are configured
1 parent b2041fa commit ecec111

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/target.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static bool valid_application() {
104104

105105
}
106106

107-
static bool empty_keys() {
107+
int target_empty_keys() {
108108
unsigned int i;
109109
extern const unsigned char enc_priv_key[];
110110
extern const unsigned int enc_priv_key_len;
@@ -113,15 +113,15 @@ static bool empty_keys() {
113113

114114
for(i = 0; i < enc_priv_key_len; i++) {
115115
if(enc_priv_key[i] != 0xFF)
116-
return false;
116+
return 0;
117117
}
118118

119119
for(i = 0; i < ecdsa_pub_key_len; i++) {
120120
if(ecdsa_pub_key[i] != 0xFF)
121-
return false;
121+
return 0;
122122
}
123123

124-
return true;
124+
return 1;
125125
}
126126

127127
int target_debug_init(void) {
@@ -243,7 +243,7 @@ int target_init(void) {
243243
return 1;
244244
}
245245

246-
if (empty_keys()) {
246+
if (target_empty_keys()) {
247247
BOOT_LOG_INF("Secure keys not configured");
248248
if ( magic == 0x07AA ) {
249249
/* Try unsecure OTA */

app/target.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ int target_debug_init(void);
8181
int target_loop(void);
8282
int target_debug(void);
8383
int target_led_off(void);
84+
int target_empty_keys(void);
8485

8586
#endif /* __TARGET_INIT_H */

0 commit comments

Comments
 (0)