Imported Upstream version 2.3.7
[platform/upstream/cryptsetup.git] / lib / utils_crypt.h
index 3da4842..9b74969 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * utils_crypt - cipher utilities for cryptsetup
  *
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2021 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2021 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #ifndef _UTILS_CRYPT_H
 #define _UTILS_CRYPT_H
 
+#include <stdbool.h>
 #include <unistd.h>
 
 #define MAX_CIPHER_LEN         32
 #define MAX_CIPHER_LEN_STR     "31"
 #define MAX_KEYFILES           32
 
-struct crypt_device;
-
 int crypt_parse_name_and_mode(const char *s, char *cipher,
                              int *key_nums, char *cipher_mode);
-
-int crypt_get_key(const char *prompt,
-                 char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
-                 const char *key_file,
-                 int timeout, int verify,
-                 struct crypt_device *cd);
-
-void *crypt_safe_alloc(size_t size);
-void crypt_safe_free(void *data);
-void *crypt_safe_realloc(void *data, size_t size);
-
-void crypt_memzero(void *s, size_t n);
+int crypt_parse_hash_integrity_mode(const char *s, char *integrity);
+int crypt_parse_integrity_mode(const char *s, char *integrity,
+                              int *integrity_key_size);
+int crypt_parse_pbkdf(const char *s, const char **pbkdf);
 
 ssize_t crypt_hex_to_bytes(const char *hex, char **result, int safe_alloc);
-int crypt_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size);
+
+bool crypt_is_cipher_null(const char *cipher_spec);
 
 #endif /* _UTILS_CRYPT_H */