forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ekeyd-1.1.4-gentoo.patch
133 lines (121 loc) · 6.41 KB
/
ekeyd-1.1.4-gentoo.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Index: ekeyd-1.1.4/host/ekeyd.c
===================================================================
--- ekeyd-1.1.4.orig/host/ekeyd.c
+++ ekeyd-1.1.4/host/ekeyd.c
@@ -209,7 +209,7 @@ open_foldback_output(void)
return (output_stream != NULL);
}
-static const char *usage=
+static const char usage[]=
"Usage: %s [-f <configfile>] [-p <pidfile>] [-v] [-h]\n"
"Entropy Key Daemon\n\n"
"\t-f Read configuration from configfile\n"
Index: ekeyd-1.1.4/host/ekey-setkey.c
===================================================================
--- ekeyd-1.1.4.orig/host/ekey-setkey.c
+++ ekeyd-1.1.4/host/ekey-setkey.c
@@ -79,7 +79,7 @@ calc_mac(uint8_t *snum, uint8_t *mkey, u
return mac;
}
-static const char *usage =
+static const char usage[] =
"Usage: %s [-d] [-h] [-n] [-f <keyring>] [-m <master>]\n"
" [-s <serial>] <path>\n"
"Entropy key device long term session key tool\n\n"
Index: ekeyd-1.1.4/host/ekey-ulusbd.c
===================================================================
--- ekeyd-1.1.4.orig/host/ekey-ulusbd.c
+++ ekeyd-1.1.4/host/ekey-ulusbd.c
@@ -100,7 +100,8 @@ find_usb_device(char *busmatch, char *de
#if LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
if ((r = usb_detach_kernel_driver_np(devh, EKEY_IFACE)) != 0) {
- if (r != -ENODATA) {
+ /* libusb_compat-0.1.3 mistakenly translate ENODATA to ENOENT */
+ if (r != -ENODATA && r != -ENOENT) {
fprintf(stderr,
"Unable to detach Entropy Key at %s/%s from kernel\n",
busmatch, devmatch);
Index: ekeyd-1.1.4/udev/entropykey.sh
===================================================================
--- ekeyd-1.1.4.orig/udev/entropykey.sh
+++ ekeyd-1.1.4/udev/entropykey.sh
@@ -19,9 +19,9 @@ wait_for_usb () {
COUNTER=$(( ${COUNTER} + 1 ))
test ${COUNTER} -ge 10 && exit 1
done
- $BINPATH/ekey-ulusbd -b${BUSNUM} -d${DEVNUM} -P/var/run/ekey-ulusbd-${ENTROPY_KEY_SERIAL}.pid -p/var/run/entropykeys/${ENTROPY_KEY_SERIAL} -D
+ /usr/libexec/ekey-ulusbd -b${BUSNUM} -d${DEVNUM} -P/dev/.ekey-ulusbd/${ENTROPY_KEY_SERIAL}.pid -p/dev/entropykey/${ENTROPY_KEY_SERIAL} -D
sleep 1
- $BINPATH/ekeydctl ${ACTION} /var/run/entropykeys/${ENTROPY_KEY_SERIAL}
+ $BINPATH/ekeydctl ${ACTION} /dev/entropykey/${ENTROPY_KEY_SERIAL}
exit 0
}
@@ -34,18 +34,18 @@ else
if test "x${BUSNUM}" = "x" -o "x${DEVNUM}" = "x"; then
exit 0
fi
- if test -r "/var/run/ekey-ulusbd-${ENTROPY_KEY_SERIAL}.pid"; then
- kill $(cat "/var/run/ekey-ulusbd-${ENTROPY_KEY_SERIAL}.pid") || true
+ if test -r "/dev/.ekey-ulusbd/${ENTROPY_KEY_SERIAL}.pid"; then
+ kill $(< "/dev/.ekey-ulusbd/${ENTROPY_KEY_SERIAL}.pid") || true
fi
- mkdir -p /var/run/entropykeys
+ mkdir -p /dev/entropykey /dev/.ekeyd-ulusb
wait_for_usb &
exit 0
fi
# Update ekeyd with device operation
- $BINPATH/ekeydctl ${ACTION} /var/run/entropykeys/${ENTROPY_KEY_SERIAL}
+ $BINPATH/ekeydctl ${ACTION} /dev/entropykey/${ENTROPY_KEY_SERIAL}
if test "x$ACTION" = "xremove"; then
- rm "/var/run/ekey-ulusbd-${ENTROPYKEY_KEY_SERIAL}.pid"
- rm "/var/run/entropykeys/${ENTROPYKEY_KEY_SERIAL}"
+ rm "/dev/.ekey-ulusbd/${ENTROPYKEY_KEY_SERIAL}.pid"
+ rm "/dev/entropykey/${ENTROPYKEY_KEY_SERIAL}"
fi
fi
Index: ekeyd-1.1.4/udev/fedora15/60-entropykey.rules
===================================================================
--- ekeyd-1.1.4.orig/udev/fedora15/60-entropykey.rules
+++ ekeyd-1.1.4/udev/fedora15/60-entropykey.rules
@@ -9,10 +9,10 @@
# For licence terms refer to the COPYING file distributed with the source.
# Detect an Entropy Key being inserted and add info values to environment
-ACTION=="add|change|remove", SUBSYSTEM=="tty", KERNEL=="ttyACM[0-9]*", BUS=="usb", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="usb_id --export %p"
+ACTION=="add|change|remove", SUBSYSTEM=="tty", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="usb_id --export %p"
# Detect an Entropy Key being inserted and extract serial number
-ACTION=="add|change|remove", SUBSYSTEM=="tty", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="/bin/echo ENTROPY_KEY_SERIAL=$env{ID_SERIAL_SHORT}"
+ACTION=="add|change|remove", SUBSYSTEM=="tty", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="/bin/sh -c '/bin/echo ENTROPY_KEY_SERIAL=$env{ID_SERIAL_SHORT} | /bin/sed -e s:/:_:g'"
# Add the /dev/entropykey/<serialnumber> symbolic link
ENV{ENTROPY_KEY_SERIAL}!="", SYMLINK+="entropykey/$env{ENTROPY_KEY_SERIAL}"
Index: ekeyd-1.1.4/udev/fedora15/60-entropykey-uds.rules
===================================================================
--- ekeyd-1.1.4.orig/udev/fedora15/60-entropykey-uds.rules
+++ ekeyd-1.1.4/udev/fedora15/60-entropykey-uds.rules
@@ -9,7 +9,7 @@
# For licence terms refer to the COPYING file.
# Detect an Entropy Key being inserted and extract serial number
-ACTION=="add|change|remove", SUBSYSTEM=="usb", BUS=="usb", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="/bin/echo ENTROPY_KEY_SERIAL=$attr{serial}"
+ACTION=="add|change|remove", SUBSYSTEM=="usb", ATTRS{idVendor}=="20df", ATTRS{idProduct}=="0001", IMPORT{program}="/bin/sh -c '/bin/echo ENTROPY_KEY_SERIAL=$env{ID_SERIAL_SHORT} | /bin/sed -e s:/:_:g'"
# And tell the ekeyd about the device action.
ENV{ENTROPY_KEY_SERIAL}!="", RUN+="/lib/udev/entropykey.sh"
Index: ekeyd-1.1.4/host/Makefile
===================================================================
--- ekeyd-1.1.4.orig/host/Makefile
+++ ekeyd-1.1.4/host/Makefile
@@ -107,7 +107,7 @@ OPT ?= -O2
CFLAGS += $(INCLUDES)
CFLAGS += -g -Wall $(OPT)
CFLAGS += -fno-strict-aliasing
-CFLAGS += -std=c99 -Wall -pedantic -Wshadow -Werror -D_GNU_SOURCE
+CFLAGS += -std=c99 -Wall -pedantic -Wshadow -D_GNU_SOURCE
CFLAGS += '-DCONFIGFILE="$(SYSCONFPREFIX)/ekeyd.conf"'
CFLAGS += '-DPIDFILE="$(RUNTIMEPREFIX)/ekeyd.pid"'
CFLAGS += '-DKEYRINGFILE="$(SYSCONFPREFIX)/keyring"'
@@ -148,7 +148,7 @@ daemonise_ulusbd.o: daemonise.c
$(COMPILE.c) $(OUTPUT_OPTION) $(PTHFLAGS) $^
egd-linux: egd-linux.o daemonise.o
- $(CC) $(CFLAGS) -o $@ $^
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
ekeyd: ekeyd.o daemonise.o lstate.o connection.o stream.o frame.o packet.o keydb.o util.o fds.o krnlop.o foldback.o stats.o nonce.o ../device/frames/pem.o ../device/skeinwrap.o ../device/skein/skein.o ../device/skein/skein_block.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)