Let the "allowed" config parameter work in a data file section.
[pwmd.git] / src / cipher.h
blob55163cb4b9d7c4dd16954db8cae4da30c9efb354
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef CIPHER_H
21 #define CIPHER_H
23 #include <stdint.h>
25 #define PWMD_CIPHER_OFFSET (1)
26 #define PWMD_CIPHER(n) (PWMD_CIPHER_OFFSET << n)
27 #define PWMD_CIPHER_AES128 PWMD_CIPHER (0)
28 #define PWMD_CIPHER_AES192 PWMD_CIPHER (1)
29 #define PWMD_CIPHER_AES256 PWMD_CIPHER (2)
30 #define PWMD_CIPHER_SERPENT128 PWMD_CIPHER (3)
31 #define PWMD_CIPHER_SERPENT192 PWMD_CIPHER (4)
32 #define PWMD_CIPHER_SERPENT256 PWMD_CIPHER (5)
33 #define PWMD_CIPHER_CAMELLIA128 PWMD_CIPHER (6)
34 #define PWMD_CIPHER_CAMELLIA192 PWMD_CIPHER (7)
35 #define PWMD_CIPHER_CAMELLIA256 PWMD_CIPHER (8)
36 #define PWMD_CIPHER_3DES PWMD_CIPHER (9)
37 #define PWMD_CIPHER_CAST5 PWMD_CIPHER (10)
38 #define PWMD_CIPHER_BLOWFISH PWMD_CIPHER (11)
39 #define PWMD_CIPHER_TWOFISH PWMD_CIPHER (12)
40 #define PWMD_CIPHER_TWOFISH128 PWMD_CIPHER (13)
42 #define PWMD_FLAG_OFFSET (PWMD_CIPHER_OFFSET << 15)
43 #define PWMD_FLAG(n) (PWMD_FLAG_OFFSET << n)
44 #define PWMD_FLAG_PKI PWMD_FLAG (1)
46 int cipher_string_to_gcrypt (const char *str);
47 int cipher_to_gcrypt (int flags);
48 unsigned gcrypt_to_cipher (int n);
49 int cipher_string_to_cipher (const char *str);
50 uint64_t set_cipher_flag (uint64_t flags, int algo);
52 #endif