From 2a335650b8ba7f5b2a3b45c07bdbbbcb0c84c9e9 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Sun, 6 Apr 2025 18:15:23 +0200 Subject: [PATCH] chore(core): introduce basic logical operations on secbool [no changelog] --- core/embed/rtl/inc/rtl/secbool.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/embed/rtl/inc/rtl/secbool.h b/core/embed/rtl/inc/rtl/secbool.h index 356c715930..db4e1a8c7c 100644 --- a/core/embed/rtl/inc/rtl/secbool.h +++ b/core/embed/rtl/inc/rtl/secbool.h @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef TREZORHAL_SECBOOL_H -#define TREZORHAL_SECBOOL_H +#pragma once #include @@ -26,8 +25,20 @@ typedef uint32_t secbool; #define sectrue 0xAAAAAAAAU #define secfalse 0x00000000U +static inline secbool secbool_or(secbool a, secbool b) { + if (sectrue == a || sectrue == b) { + return sectrue; + } + return secfalse; +} + +static inline secbool secbool_and(secbool a, secbool b) { + if (sectrue == a && sectrue == b) { + return sectrue; + } + return secfalse; +} + #ifndef __wur #define __wur __attribute__((warn_unused_result)) #endif - -#endif