2 * utils_crypt - cipher utilities for cryptsetup
4 * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
5 * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef _UTILS_CRYPT_H
22 #define _UTILS_CRYPT_H
27 #define MAX_CIPHER_LEN 32
28 #define MAX_CIPHER_LEN_STR "32"
32 int crypt_parse_name_and_mode(const char *s, char *cipher,
33 int *key_nums, char *cipher_mode);
35 int crypt_get_key(const char *prompt,
36 char **key, size_t *key_size,
37 size_t keyfile_offset, size_t keyfile_size_max,
39 int timeout, int verify,
40 struct crypt_device *cd);
42 void *crypt_safe_alloc(size_t size);
43 void crypt_safe_free(void *data);
44 void *crypt_safe_realloc(void *data, size_t size);
46 #endif /* _UTILS_CRYPT_H */