Allow secure to be slightly more optional
This commit is contained in:
parent
3e4de1ebd0
commit
79db2df228
2 changed files with 11 additions and 1 deletions
|
@ -69,7 +69,7 @@ struct __attribute__((packed)) xap_route_t {
|
||||||
|
|
||||||
// XAP_VALUE / XAP_CONST_MEM
|
// XAP_VALUE / XAP_CONST_MEM
|
||||||
struct {
|
struct {
|
||||||
const void * const_data;
|
const void *const_data;
|
||||||
const uint8_t const_data_len;
|
const uint8_t const_data_len;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -85,6 +85,7 @@ void xap_execute_route(xap_token_t token, const xap_route_t *routes, size_t max_
|
||||||
xap_route_t route;
|
xap_route_t route;
|
||||||
memcpy_P(&route, &routes[id], sizeof(xap_route_t));
|
memcpy_P(&route, &routes[id], sizeof(xap_route_t));
|
||||||
|
|
||||||
|
#ifdef SECURE_ENABLE
|
||||||
if (route.flags.is_secure && secure_get_status() != SECURE_UNLOCKED) {
|
if (route.flags.is_secure && secure_get_status() != SECURE_UNLOCKED) {
|
||||||
xap_respond_failure(token, XAP_RESPONSE_FLAG_SECURE_FAILURE);
|
xap_respond_failure(token, XAP_RESPONSE_FLAG_SECURE_FAILURE);
|
||||||
return;
|
return;
|
||||||
|
@ -96,6 +97,7 @@ void xap_execute_route(xap_token_t token, const xap_route_t *routes, size_t max_
|
||||||
// xap_respond_failure(token, XAP_RESPONSE_FLAG_UNLOCK_IN_PROGRESS);
|
// xap_respond_failure(token, XAP_RESPONSE_FLAG_UNLOCK_IN_PROGRESS);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (route.flags.type) {
|
switch (route.flags.type) {
|
||||||
case XAP_ROUTE:
|
case XAP_ROUTE:
|
||||||
|
@ -142,6 +144,7 @@ void xap_receive(xap_token_t token, const uint8_t *data, size_t length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void xap_event_task(void) {
|
void xap_event_task(void) {
|
||||||
|
#ifdef SECURE_ENABLE
|
||||||
static secure_status_t last_status = -1;
|
static secure_status_t last_status = -1;
|
||||||
|
|
||||||
secure_status_t status = secure_get_status();
|
secure_status_t status = secure_get_status();
|
||||||
|
@ -149,4 +152,5 @@ void xap_event_task(void) {
|
||||||
last_status = status;
|
last_status = status;
|
||||||
xap_broadcast_secure_status(status);
|
xap_broadcast_secure_status(status);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,13 @@
|
||||||
|
|
||||||
#include <quantum.h>
|
#include <quantum.h>
|
||||||
#include <xap.h>
|
#include <xap.h>
|
||||||
|
|
||||||
#include "secure.h"
|
#include "secure.h"
|
||||||
|
#ifndef SECURE_ENABLE
|
||||||
|
# define secure_get_status() SECURE_UNLOCKED
|
||||||
|
# define secure_request_unlock()
|
||||||
|
# define secure_lock()
|
||||||
|
#endif
|
||||||
|
|
||||||
void xap_respond_success(xap_token_t token) {
|
void xap_respond_success(xap_token_t token) {
|
||||||
xap_send(token, XAP_RESPONSE_FLAG_SUCCESS, NULL, 0);
|
xap_send(token, XAP_RESPONSE_FLAG_SUCCESS, NULL, 0);
|
||||||
|
|
Loading…
Reference in a new issue