]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/securebits-util.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / basic / securebits-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright © 2017 Yu Watanabe
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);
12
13 static inline bool secure_bits_is_valid(int i) {
14 return ((SECURE_ALL_BITS | SECURE_ALL_LOCKS) & i) == i;
15 }
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 }