From 014206399ae0a6bd4499595c2f6527dc30d3cae5 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Sun, 14 Nov 2010 20:06:35 +0000 Subject: [PATCH] Move LUKS library to lib subdir. git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@366 36d66b0a-2a48-0410-832c-cd162a569da5 --- Makefile.am | 1 - TODO | 12 ------------ configure.in | 2 +- lib/Makefile.am | 6 ++++-- {luks => lib/luks1}/Makefile.am | 6 +++--- {luks => lib/luks1}/af.c | 8 ++++---- {luks => lib/luks1}/af.h | 0 {luks => lib/luks1}/keyencryption.c | 20 +++++++++----------- {luks => lib/luks1}/keymanage.c | 14 +++++++------- {luks => lib/luks1}/luks.h | 0 {luks => lib/luks1}/pbkdf.c | 0 {luks => lib/luks1}/pbkdf.h | 2 -- po/POTFILES.in | 8 ++++---- 13 files changed, 32 insertions(+), 47 deletions(-) rename {luks => lib/luks1}/Makefile.am (71%) rename {luks => lib/luks1}/af.c (95%) rename {luks => lib/luks1}/af.h (100%) rename {luks => lib/luks1}/keyencryption.c (94%) rename {luks => lib/luks1}/keymanage.c (99%) rename {luks => lib/luks1}/luks.h (100%) rename {luks => lib/luks1}/pbkdf.c (100%) rename {luks => lib/luks1}/pbkdf.h (98%) diff --git a/Makefile.am b/Makefile.am index ddd102b..887dd74 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,5 @@ EXTRA_DIST = FAQ SUBDIRS = \ - luks \ lib \ src \ man \ diff --git a/TODO b/TODO index ed71fd7..e69de29 100644 --- a/TODO +++ b/TODO @@ -1,12 +0,0 @@ -For 1.02 - -* Add LUKS key copy cmd: luksKeyCopy -* Add option to supply a master key directly. For LUKS commands: luksFormat, luksOpen and luksAddKey. - -For 2.0 - -* LUKS header version bump: - * Add LUKS partition footer. - * change luks_write_phdr stuff. - * change luks_read_phdr stuff - * change hashing according to conversation with Sarah. diff --git a/configure.in b/configure.in index 2532852..7a289b0 100644 --- a/configure.in +++ b/configure.in @@ -184,9 +184,9 @@ dnl ========================================================================== AC_CONFIG_FILES([ Makefile lib/Makefile lib/libcryptsetup.pc +lib/luks1/Makefile src/Makefile po/Makefile.in -luks/Makefile man/Makefile tests/Makefile ]) diff --git a/lib/Makefile.am b/lib/Makefile.am index dc78b3c..a624e5b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = luks1 + moduledir = $(libdir)/cryptsetup pkgconfigdir = $(libdir)/pkgconfig @@ -5,7 +7,7 @@ pkgconfig_DATA = libcryptsetup.pc INCLUDES = \ -I$(top_srcdir) \ - -I$(top_srcdir)/luks \ + -I$(top_srcdir)/lib/luks1 \ -DDATADIR=\""$(datadir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DPREFIX=\""$(prefix)"\" \ @@ -29,7 +31,7 @@ libcryptsetup_la_LIBADD = \ @UUID_LIBS@ \ @DEVMAPPER_LIBS@ \ @LIBGCRYPT_LIBS@ \ - ../luks/libluks.la + luks1/libluks1.la libcryptsetup_la_SOURCES = \ setup.c \ diff --git a/luks/Makefile.am b/lib/luks1/Makefile.am similarity index 71% rename from luks/Makefile.am rename to lib/luks1/Makefile.am index 0ff1d9f..18292c3 100644 --- a/luks/Makefile.am +++ b/lib/luks1/Makefile.am @@ -1,10 +1,10 @@ moduledir = $(libdir)/cryptsetup -noinst_LTLIBRARIES = libluks.la +noinst_LTLIBRARIES = libluks1.la -libluks_la_CFLAGS = -Wall @LIBGCRYPT_CFLAGS@ +libluks1_la_CFLAGS = -Wall @LIBGCRYPT_CFLAGS@ -libluks_la_SOURCES = \ +libluks1_la_SOURCES = \ af.c \ pbkdf.c \ keymanage.c \ diff --git a/luks/af.c b/lib/luks1/af.c similarity index 95% rename from luks/af.c rename to lib/luks1/af.c index e86af78..aad6691 100644 --- a/luks/af.c +++ b/lib/luks1/af.c @@ -3,7 +3,7 @@ * Copyright 2004, Clemens Fruhwirth * Copyright (C) 2009 Red Hat, Inc. All rights reserved. * - * AFsplitter diffuses information over a large stripe of data, + * AFsplitter diffuses information over a large stripe of data, * therefor supporting secure data destruction. * * This program is free software; you can redistribute it and/or @@ -19,14 +19,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #include #include #include #include #include #include -#include <../lib/internal.h> +#include "internal.h" static void XORblock(char const *src1, char const *src2, char *dst, size_t n) { @@ -81,7 +81,7 @@ static int diffuse(char *src, char *dst, size_t size, int hash_id) /* * Information splitting. The amount of data is multiplied by - * blocknumbers. The same blocksize and blocknumbers values + * blocknumbers. The same blocksize and blocknumbers values * must be supplied to AF_merge to recover information. */ diff --git a/luks/af.h b/lib/luks1/af.h similarity index 100% rename from luks/af.h rename to lib/luks1/af.h diff --git a/luks/keyencryption.c b/lib/luks1/keyencryption.c similarity index 94% rename from luks/keyencryption.c rename to lib/luks1/keyencryption.c index 6ab3819..ed18025 100644 --- a/luks/keyencryption.c +++ b/lib/luks1/keyencryption.c @@ -1,8 +1,8 @@ /* - * LUKS - Linux Unified Key Setup + * LUKS - Linux Unified Key Setup * * Copyright (C) 2004-2006, Clemens Fruhwirth - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. @@ -33,9 +33,7 @@ #include #include "luks.h" -//#include "../lib/libcryptsetup.h" -#include "../lib/internal.h" -//#include "../lib/blockdev.h" +#include "internal.h" #define div_round_up(a,b) ({ \ typeof(a) __a = (a); \ @@ -80,7 +78,7 @@ static void sigint_handler(int sig) if(devfd >= 0) close(devfd); devfd = -1; - if(cleaner_name) + if(cleaner_name) dm_remove_device(cleaner_name, 1, cleaner_size); signal(SIGINT, SIG_DFL); @@ -118,10 +116,10 @@ static char *_error_hint(char *cipherName, char *cipherMode, size_t keyLength) /* This function is not reentrant safe, as it installs a signal handler and global vars for cleaning */ -static int LUKS_endec_template(char *src, size_t srcLength, - struct luks_phdr *hdr, - char *key, size_t keyLength, - const char *device, +static int LUKS_endec_template(char *src, size_t srcLength, + struct luks_phdr *hdr, + char *key, size_t keyLength, + const char *device, unsigned int sector, ssize_t (*func)(int, void *, size_t), int mode, @@ -130,7 +128,7 @@ static int LUKS_endec_template(char *src, size_t srcLength, char *name = NULL; char *fullpath = NULL; char *dmCipherSpec = NULL; - const char *dmDir = dm_get_dir(); + const char *dmDir = dm_get_dir(); int r = -1; if(dmDir == NULL) { diff --git a/luks/keymanage.c b/lib/luks1/keymanage.c similarity index 99% rename from luks/keymanage.c rename to lib/luks1/keymanage.c index 472cc69..b75e645 100644 --- a/luks/keymanage.c +++ b/lib/luks1/keymanage.c @@ -1,5 +1,5 @@ /* - * LUKS - Linux Unified Key Setup + * LUKS - Linux Unified Key Setup * * Copyright (C) 2004-2006, Clemens Fruhwirth * @@ -29,12 +29,12 @@ #include #include #include +#include #include "luks.h" #include "af.h" #include "pbkdf.h" -#include -#include <../lib/internal.h> +#include "internal.h" #define div_round_up(a,b) ({ \ typeof(a) __a = (a); \ @@ -327,8 +327,8 @@ int LUKS_write_phdr(const char *device, struct luks_phdr *hdr, struct crypt_device *ctx) { - int devfd = 0; - unsigned int i; + int devfd = 0; + unsigned int i; struct luks_phdr convHdr; int r; @@ -336,7 +336,7 @@ int LUKS_write_phdr(const char *device, sizeof(struct luks_phdr), device); devfd = open(device,O_RDWR | O_DIRECT | O_SYNC); - if(-1 == devfd) { + if(-1 == devfd) { log_err(ctx, _("Cannot open device %s.\n"), device); return -EINVAL; } @@ -696,7 +696,7 @@ int LUKS_open_key_with_hdr(const char *device, /* Do not retry for errors that are no -EPERM or -ENOENT, former meaning password wrong, latter key slot inactive */ - if ((r != -EPERM) && (r != -ENOENT)) + if ((r != -EPERM) && (r != -ENOENT)) return r; } /* Warning, early returns above */ diff --git a/luks/luks.h b/lib/luks1/luks.h similarity index 100% rename from luks/luks.h rename to lib/luks1/luks.h diff --git a/luks/pbkdf.c b/lib/luks1/pbkdf.c similarity index 100% rename from luks/pbkdf.c rename to lib/luks1/pbkdf.c diff --git a/luks/pbkdf.h b/lib/luks1/pbkdf.h similarity index 98% rename from luks/pbkdf.h rename to lib/luks1/pbkdf.h index ae602fe..9bbd8f3 100644 --- a/luks/pbkdf.h +++ b/lib/luks1/pbkdf.h @@ -3,8 +3,6 @@ #include -/* */ - int PBKDF2_HMAC(const char *hash, const char *password, size_t passwordLen, const char *salt, size_t saltLen, unsigned int iterations, diff --git a/po/POTFILES.in b/po/POTFILES.in index 3c1ee49..343a3d2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,8 +6,8 @@ lib/setup.c lib/utils.c lib/utils_crypt.c lib/utils_debug.c -luks/af.c -luks/keyencryption.c -luks/keymanage.c -luks/pbkdf.c +lib/luks1/af.c +lib/luks1/keyencryption.c +lib/luks1/keymanage.c +lib/luks1/pbkdf.c src/cryptsetup.c -- 2.7.4