2007-06-05 04:29:16 +02:00
|
|
|
fix implicit function declarations
|
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
From: Ludwig Nussel <ludwig.nussel@suse.de>
|
|
|
|
|
2007-06-05 04:29:16 +02:00
|
|
|
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
|
2007-10-16 17:49:45 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
lib/internal.h | 13 +++++++++++++
|
|
|
|
lib/libcryptsetup.h | 5 ++++-
|
|
|
|
lib/utils.c | 1 +
|
|
|
|
luks/af.c | 1 +
|
|
|
|
luks/keyencryption.c | 6 ------
|
|
|
|
luks/keymanage.c | 10 ----------
|
|
|
|
luks/luks.h | 1 +
|
|
|
|
src/cryptsetup.c | 4 ++++
|
|
|
|
8 files changed, 24 insertions(+), 17 deletions(-)
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
diff --git a/lib/internal.h b/lib/internal.h
|
|
|
|
index 8877c01..7a7354e 100644
|
|
|
|
--- a/lib/internal.h
|
|
|
|
+++ b/lib/internal.h
|
|
|
|
@@ -62,6 +62,9 @@ int hash(const char *backend_name, const char *hash_name,
|
2007-06-05 04:29:16 +02:00
|
|
|
struct setup_backend *get_setup_backend(const char *name);
|
|
|
|
void put_setup_backend(struct setup_backend *backend);
|
|
|
|
|
|
|
|
+void hexprint(char *d, int n);
|
|
|
|
+
|
|
|
|
+int sector_size_for_device(const char *device);
|
|
|
|
ssize_t write_blockwise(int fd, const void *buf, size_t count);
|
|
|
|
ssize_t read_blockwise(int fd, void *_buf, size_t count);
|
|
|
|
ssize_t write_lseek_blockwise(int fd, const char *buf, size_t count, off_t offset);
|
2007-10-16 17:49:45 +02:00
|
|
|
@@ -69,4 +72,14 @@ ssize_t write_lseek_blockwise(int fd, const char *buf, size_t count, off_t offse
|
|
|
|
|
|
|
|
int get_key(char *prompt, char **key, int *passLen, int key_size, const char *key_file, int passphrase_fd, int timeout, int how2verify);
|
|
|
|
|
|
|
|
+#define div_round_up(a,b) ({ \
|
|
|
|
+ typeof(a) __a = (a); \
|
|
|
|
+ typeof(b) __b = (b); \
|
|
|
|
+ (__a - 1) / __b + 1; \
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+static inline int round_up_modulo(int x, int m) {
|
|
|
|
+ return div_round_up(x, m) * m;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
#endif /* INTERNAL_H */
|
|
|
|
diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h
|
|
|
|
index 53846ef..69b9ba4 100644
|
|
|
|
--- a/lib/libcryptsetup.h
|
|
|
|
+++ b/lib/libcryptsetup.h
|
|
|
|
@@ -53,10 +53,13 @@ int crypt_query_device(struct crypt_options *options);
|
|
|
|
int crypt_remove_device(struct crypt_options *options);
|
|
|
|
int crypt_luksInit(struct crypt_options *options);
|
|
|
|
int crypt_luksOpen(struct crypt_options *options);
|
|
|
|
-int crypt_luksDelKey(struct crypt_options *options);
|
|
|
|
+int crypt_luksKillSlot(struct crypt_options *options);
|
|
|
|
+int crypt_luksRemoveKey(struct crypt_options *options);
|
2007-06-05 04:29:16 +02:00
|
|
|
int crypt_luksAddKey(struct crypt_options *options);
|
|
|
|
int crypt_luksUUID(struct crypt_options *options);
|
|
|
|
int crypt_isLuks(struct crypt_options *options);
|
|
|
|
+int crypt_luksFormat(struct crypt_options *options);
|
|
|
|
+int crypt_luksDump(struct crypt_options *options);
|
|
|
|
|
|
|
|
void crypt_get_error(char *buf, size_t size);
|
|
|
|
void crypt_put_options(struct crypt_options *options);
|
2007-10-16 17:49:45 +02:00
|
|
|
diff --git a/lib/utils.c b/lib/utils.c
|
|
|
|
index 23ddae1..718d418 100644
|
|
|
|
--- a/lib/utils.c
|
|
|
|
+++ b/lib/utils.c
|
2007-06-05 04:29:16 +02:00
|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
+#include <sys/ioctl.h>
|
|
|
|
#include <fcntl.h>
|
2007-10-16 17:49:45 +02:00
|
|
|
#include <termios.h>
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
diff --git a/luks/af.c b/luks/af.c
|
|
|
|
index 7166669..66c4861 100644
|
|
|
|
--- a/luks/af.c
|
|
|
|
+++ b/luks/af.c
|
2007-06-05 04:29:16 +02:00
|
|
|
@@ -30,6 +30,7 @@
|
|
|
|
#include <errno.h>
|
|
|
|
#include "sha1.h"
|
|
|
|
#include "XORblock.h"
|
|
|
|
+#include "random.h"
|
|
|
|
|
|
|
|
/* diffuse: Information spreading over the whole dataset with
|
|
|
|
* the help of sha512.
|
2007-10-16 17:49:45 +02:00
|
|
|
diff --git a/luks/keyencryption.c b/luks/keyencryption.c
|
|
|
|
index f154a01..b09aa83 100644
|
|
|
|
--- a/luks/keyencryption.c
|
|
|
|
+++ b/luks/keyencryption.c
|
|
|
|
@@ -35,12 +35,6 @@
|
|
|
|
#include "../lib/internal.h"
|
|
|
|
#include "../lib/blockdev.h"
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
-#define div_round_up(a,b) ({ \
|
|
|
|
- typeof(a) __a = (a); \
|
|
|
|
- typeof(b) __b = (b); \
|
|
|
|
- (__a - 1) / __b + 1; \
|
|
|
|
-})
|
|
|
|
-
|
2007-06-05 04:29:16 +02:00
|
|
|
static int setup_mapping(const char *cipher, const char *name,
|
|
|
|
const char *device, unsigned int payloadOffset,
|
2007-10-16 17:49:45 +02:00
|
|
|
const char *key, size_t keyLength,
|
|
|
|
diff --git a/luks/keymanage.c b/luks/keymanage.c
|
|
|
|
index 77d8414..81929cd 100644
|
|
|
|
--- a/luks/keymanage.c
|
|
|
|
+++ b/luks/keymanage.c
|
|
|
|
@@ -37,16 +37,6 @@
|
|
|
|
#include <uuid/uuid.h>
|
|
|
|
#include <../lib/internal.h>
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
-#define div_round_up(a,b) ({ \
|
|
|
|
- typeof(a) __a = (a); \
|
|
|
|
- typeof(b) __b = (b); \
|
|
|
|
- (__a - 1) / __b + 1; \
|
|
|
|
-})
|
|
|
|
-
|
2007-06-05 04:29:16 +02:00
|
|
|
-inline int round_up_modulo(int x, int m) {
|
2007-10-16 17:49:45 +02:00
|
|
|
- return div_round_up(x, m) * m;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
struct luks_masterkey *LUKS_alloc_masterkey(int keylength)
|
|
|
|
{
|
|
|
|
struct luks_masterkey *mk=malloc(sizeof(*mk) + keylength);
|
|
|
|
diff --git a/luks/luks.h b/luks/luks.h
|
|
|
|
index 7356c92..f11516d 100644
|
|
|
|
--- a/luks/luks.h
|
|
|
|
+++ b/luks/luks.h
|
|
|
|
@@ -133,4 +133,5 @@ int LUKS_decrypt_from_storage(char *dst, size_t dstLength,
|
|
|
|
const char *device,
|
|
|
|
unsigned int sector, struct setup_backend *backend);
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2007-10-16 17:49:45 +02:00
|
|
|
+int LUKS_device_ready(char *device, int mode);
|
|
|
|
#endif
|
|
|
|
diff --git a/src/cryptsetup.c b/src/cryptsetup.c
|
|
|
|
index edb155a..e7f47a2 100644
|
|
|
|
--- a/src/cryptsetup.c
|
|
|
|
+++ b/src/cryptsetup.c
|
2007-06-05 04:29:16 +02:00
|
|
|
@@ -4,6 +4,7 @@
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <errno.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include <libcryptsetup.h>
|
|
|
|
@@ -13,6 +14,9 @@
|
|
|
|
|
|
|
|
#include "cryptsetup.h"
|
|
|
|
|
|
|
|
+// XXX!
|
|
|
|
+int LUKS_is_last_keyslot(const char *device, unsigned int keyIndex);
|
|
|
|
+
|
|
|
|
static int opt_verbose = 1;
|
|
|
|
static char *opt_cipher = NULL;
|
|
|
|
static char *opt_hash = DEFAULT_HASH;
|