diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | bin/Makefile | 4 | ||||
-rw-r--r-- | bin/ykfde-cpio.c | 5 | ||||
-rw-r--r-- | bin/ykfde.c | 8 | ||||
-rw-r--r-- | config.def.h | 32 | ||||
-rw-r--r-- | udev/Makefile | 2 | ||||
-rw-r--r-- | udev/ykfde.c | 7 |
8 files changed, 51 insertions, 21 deletions
@@ -1,3 +1,4 @@ +config.h README.html bin/ykfde bin/ykfde-cpio @@ -2,18 +2,25 @@ INSTALL := install MD := markdown RM := rm +CP := cp # this is just a fallback in case you do not use git but downloaded # a release tarball... VERSION := 0.5.0 -all: bin/ykfde udev/ykfde README.html +all: bin/ykfde bin/ykfde-cpio udev/ykfde README.html -bin/ykfde: bin/ykfde.c +bin/ykfde: bin/ykfde.c config.h $(MAKE) -C bin -udev/ykfde: udev/ykfde.c +bin/ykfde-cpio: bin/ykfde-cpio.c config.h + $(MAKE) -C bin + +udev/ykfde: udev/ykfde.c config.h $(MAKE) -C udev +config.h: config.def.h + $(CP) config.def.h config.h + README.html: README.md $(MD) README.md > README.html diff --git a/bin/Makefile b/bin/Makefile index 4fcd6fb..6e77de8 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -7,10 +7,10 @@ CFLAGS += -std=c11 -O2 -fpic -pie -Wall -Werror all: ykfde ykfde-cpio -ykfde: ykfde.c +ykfde: ykfde.c ../config.h $(CC) $(CFLAGS) -lykpers-1 -lyubikey -liniparser -lcryptsetup $(LDFLAGS) -o ykfde ykfde.c -ykfde-cpio: ykfde-cpio.c +ykfde-cpio: ykfde-cpio.c ../config.h $(CC) $(CFLAGS) -larchive $(LDFLAGS) -o ykfde-cpio ykfde-cpio.c install: ykfde ykfde-cpio diff --git a/bin/ykfde-cpio.c b/bin/ykfde-cpio.c index ca6f61b..3122a1f 100644 --- a/bin/ykfde-cpio.c +++ b/bin/ykfde-cpio.c @@ -22,10 +22,7 @@ #include <archive.h> #include <archive_entry.h> -#define CONFIGFILE "/etc/ykfde.conf" -#define CHALLENGEDIR "/etc/ykfde.d/" -#define CPIOFILE "/boot/ykfde-challenges.img" -#define CPIOTMPFILE CPIOFILE "-XXXXXX" +#include "../config.h" int add_dir(struct archive *archive, const char * path) { struct stat st; diff --git a/bin/ykfde.c b/bin/ykfde.c index 77bb86b..30a4665 100644 --- a/bin/ykfde.c +++ b/bin/ykfde.c @@ -27,18 +27,14 @@ #include <libcryptsetup.h> +#include "../config.h" + /* challenge is 64 byte, * HMAC-SHA1 response is 40 byte */ #define CHALLENGELEN 64 #define RESPONSELEN SHA1_MAX_BLOCK_SIZE #define PASSPHRASELEN SHA1_DIGEST_SIZE * 2 -#define CONFIGFILE "/etc/ykfde.conf" -#define CHALLENGEDIR "/etc/ykfde.d/" -#define CONFYKSLOT "yk slot" -#define CONFLUKSSLOT "luks slot" -#define CONFDEVNAME "device name" - int main(int argc, char **argv) { char challenge_old[CHALLENGELEN + 1], challenge_new[CHALLENGELEN + 1], diff --git a/config.def.h b/config.def.h new file mode 100644 index 0000000..1fafba2 --- /dev/null +++ b/config.def.h @@ -0,0 +1,32 @@ +/* + * (C) 2014 by Christian Hesse <mail@eworm.de> + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#ifndef _CONFIG_H +#define _CONFIG_H + +/* path to the configuration file */ +#define CONFIGFILE "/etc/ykfde.conf" + +/* path to challenge files + * make sure this is an absolute path with trailing slash */ +#define CHALLENGEDIR "/etc/ykfde.d/" + +/* config file device name */ +#define CONFDEVNAME "device name" +/* config file Yubikey slot */ +#define CONFYKSLOT "yk slot" +/* config file LUKS slot */ +#define CONFLUKSSLOT "luks slot" + +/* path to cpio archive (initramfs image) */ +#define CPIOFILE "/boot/ykfde-challenges.img" +/* path to temporary cpio archive (initramfs image) */ +#define CPIOTMPFILE CPIOFILE "-XXXXXX" + +#endif /* _CONFIG_H */ + +// vim: set syntax=c: diff --git a/udev/Makefile b/udev/Makefile index b8ddc84..7821b8e 100644 --- a/udev/Makefile +++ b/udev/Makefile @@ -7,7 +7,7 @@ CFLAGS += -std=c11 -O2 -fpic -pie -Wall -Werror all: ykfde -ykfde: ykfde.c +ykfde: ykfde.c ../config.h $(CC) $(CFLAGS) -lykpers-1 -lyubikey -liniparser $(LDFLAGS) -o ykfde ykfde.c install: ykfde diff --git a/udev/ykfde.c b/udev/ykfde.c index 2adedbb..c96d84e 100644 --- a/udev/ykfde.c +++ b/udev/ykfde.c @@ -34,6 +34,8 @@ #include <iniparser.h> +#include "../config.h" + #define EVENT_SIZE (sizeof (struct inotify_event)) #define EVENT_BUF_LEN (1024 * (EVENT_SIZE + 16)) @@ -44,11 +46,6 @@ #define ASK_PATH "/run/systemd/ask-password/" #define ASK_MESSAGE "Please enter passphrase for disk" -#define CONFIGFILE "/etc/ykfde.conf" -#define CHALLENGEDIR "/etc/ykfde.d/" - -#define CONFYKSLOT "yk slot" - static int send_on_socket(int fd, const char *socket_name, const void *packet, size_t size) { union { struct sockaddr sa; |