mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-31 05:08:45 +00:00
chore(core): introduce basic logical operations on secbool
[no changelog]
This commit is contained in:
parent
996f81924f
commit
9708d329e1
@ -17,8 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TREZORHAL_SECBOOL_H
|
#pragma once
|
||||||
#define TREZORHAL_SECBOOL_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@ -26,8 +25,20 @@ typedef uint32_t secbool;
|
|||||||
#define sectrue 0xAAAAAAAAU
|
#define sectrue 0xAAAAAAAAU
|
||||||
#define secfalse 0x00000000U
|
#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
|
#ifndef __wur
|
||||||
#define __wur __attribute__((warn_unused_result))
|
#define __wur __attribute__((warn_unused_result))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user