From 79db2df2283b7b2da7be2760337238ab308c1034 Mon Sep 17 00:00:00 2001 From: zvecr Date: Mon, 11 Apr 2022 01:07:22 +0100 Subject: [PATCH] Allow secure to be slightly more optional --- quantum/xap/xap.c | 6 +++++- quantum/xap/xap_handlers.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/quantum/xap/xap.c b/quantum/xap/xap.c index 806ce7f160..15b56297c9 100644 --- a/quantum/xap/xap.c +++ b/quantum/xap/xap.c @@ -69,7 +69,7 @@ struct __attribute__((packed)) xap_route_t { // XAP_VALUE / XAP_CONST_MEM struct { - const void * const_data; + const void *const_data; 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; memcpy_P(&route, &routes[id], sizeof(xap_route_t)); +#ifdef SECURE_ENABLE if (route.flags.is_secure && secure_get_status() != SECURE_UNLOCKED) { xap_respond_failure(token, XAP_RESPONSE_FLAG_SECURE_FAILURE); 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); // return; // } +#endif switch (route.flags.type) { 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) { +#ifdef SECURE_ENABLE static secure_status_t last_status = -1; secure_status_t status = secure_get_status(); @@ -149,4 +152,5 @@ void xap_event_task(void) { last_status = status; xap_broadcast_secure_status(status); } +#endif } diff --git a/quantum/xap/xap_handlers.c b/quantum/xap/xap_handlers.c index e16a586dbb..8d0b2e4725 100644 --- a/quantum/xap/xap_handlers.c +++ b/quantum/xap/xap_handlers.c @@ -16,7 +16,13 @@ #include #include + #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) { xap_send(token, XAP_RESPONSE_FLAG_SUCCESS, NULL, 0);