1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-20 09:09:02 +00:00

chore(core): introduce basic logical operations on secbool

[no changelog]
This commit is contained in:
tychovrahe 2025-04-06 18:15:23 +02:00
parent d506abd9db
commit 2a335650b8

View File

@ -17,8 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TREZORHAL_SECBOOL_H
#define TREZORHAL_SECBOOL_H
#pragma once
#include <stdint.h>
@ -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