]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
07d46372 YW |
2 | #pragma once |
3 | ||
4 | /*** | |
96b2fb93 | 5 | Copyright © 2017 Yu Watanabe |
07d46372 YW |
6 | ***/ |
7 | ||
8 | #include "securebits.h" | |
9 | ||
10 | int secure_bits_to_string_alloc(int i, char **s); | |
11 | int secure_bits_from_string(const char *s); | |
33d12153 | 12 | |
07d46372 YW |
13 | static inline bool secure_bits_is_valid(int i) { |
14 | return ((SECURE_ALL_BITS | SECURE_ALL_LOCKS) & i) == i; | |
15 | } | |
33d12153 YW |
16 | |
17 | static inline int secure_bits_to_string_alloc_with_check(int n, char **s) { | |
18 | if (!secure_bits_is_valid(n)) | |
19 | return -EINVAL; | |
20 | ||
21 | return secure_bits_to_string_alloc(n, s); | |
22 | } |