../svn-commit.tmp
This commit is contained in:
parent
3dbbbf3e16
commit
6862128151
|
@ -0,0 +1,88 @@
|
||||||
|
# Copyright (C) 2005 Jan Hutter, Martin Willi
|
||||||
|
# Hochschule fuer Technik Rapperswil
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
# for more details.
|
||||||
|
#
|
||||||
|
|
||||||
|
FREESWANSRCDIR=../..
|
||||||
|
# include strongswan Makefile, if charon sits in its tree
|
||||||
|
ifeq ($(shell ls $(FREESWANSRCDIR)/Makefile.inc 2>&1), ../../Makefile.inc)
|
||||||
|
include ${FREESWANSRCDIR}/Makefile.inc
|
||||||
|
endif
|
||||||
|
|
||||||
|
BUILD_DIR= ./bin/
|
||||||
|
|
||||||
|
BINNAMECHARON= $(BUILD_DIR)charon
|
||||||
|
BINNAMESTROKE= $(BUILD_DIR)stroke
|
||||||
|
BINNAMETEST= $(BUILD_DIR)run_tests
|
||||||
|
BINNAMELIB= $(BUILD_DIR)libstrong.so
|
||||||
|
|
||||||
|
MAIN_DIR= ./
|
||||||
|
|
||||||
|
LDFLAGS= -lgmp -lpthread
|
||||||
|
|
||||||
|
CFLAGS= -Icharon -Ilib -Istroke -Wall -g -fPIC -DLEAK_DETECTIVE
|
||||||
|
|
||||||
|
# objects is extended by each included Makefile
|
||||||
|
CHARON_OBJS=
|
||||||
|
LIB_OBJS=
|
||||||
|
TEST_OBJS=
|
||||||
|
|
||||||
|
all : programs
|
||||||
|
|
||||||
|
include $(MAIN_DIR)charon/Makefile.charon
|
||||||
|
include $(MAIN_DIR)lib/Makefile.lib
|
||||||
|
include $(MAIN_DIR)stroke/Makefile.stroke
|
||||||
|
include $(MAIN_DIR)testing/Makefile.testcases
|
||||||
|
|
||||||
|
programs : $(BINNAMECHARON) $(BINNAMESTROKE)
|
||||||
|
|
||||||
|
test : $(BINNAMETEST)
|
||||||
|
LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMETEST)
|
||||||
|
|
||||||
|
run : $(BINNAMECHARON)
|
||||||
|
LD_LIBRARY_PATH=$(BUILD_DIR) $(BINNAMECHARON)
|
||||||
|
|
||||||
|
apidoc :
|
||||||
|
doxygen Doxyfile
|
||||||
|
|
||||||
|
build_dir:
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
|
$(BINNAMELIB) : build_dir $(LIB_OBJS)
|
||||||
|
$(CC) -shared $(LIB_OBJS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
$(BINNAMECHARON) : build_dir $(CHARON_OBJS) $(BINNAMELIB) $(BUILD_DIR)daemon.o
|
||||||
|
$(CC) $(LDFLAGS) -L./bin -lstrong $(CHARON_OBJS) $(BUILD_DIR)daemon.o -o $@
|
||||||
|
|
||||||
|
$(BINNAMETEST) : build_dir $(CHARON_OBJS) $(TEST_OBJS) $(BINNAMELIB) $(BUILD_DIR)testcases.o
|
||||||
|
$(CC) $(LDFLAGS) -L./bin -lstrong $(CHARON_OBJS) $(TEST_OBJS) $(BUILD_DIR)testcases.o -o $@
|
||||||
|
|
||||||
|
$(BINNAMESTROKE) : build_dir $(BINNAMELIB) $(BUILD_DIR)stroke.o
|
||||||
|
$(CC) $(LDFLAGS) $(CFLAGS) $(BUILD_DIR)stroke.o -o $@
|
||||||
|
|
||||||
|
install : $(BINNAMECHARON) $(BINNAMESTROKE)
|
||||||
|
$(INSTALL) $(INSTBINFLAGS) $(BINNAMECHARON) $(BINNAMESTROKE) $(LIBEXECDIR)
|
||||||
|
|
||||||
|
install_file_list:
|
||||||
|
@echo $(LIBEXECDIR)/charon
|
||||||
|
@echo $(LIBEXECDIR)/stroke
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -fR $(BUILD_DIR)
|
||||||
|
|
||||||
|
cleanall: clean
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
|
||||||
|
mostlyclean: clean
|
||||||
|
|
||||||
|
realclean: clean
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?xml version = '1.0'?>
|
||||||
|
<kdevelop>
|
||||||
|
<general>
|
||||||
|
<author>Martin Willi</author>
|
||||||
|
<email>martin@strongswan.org</email>
|
||||||
|
<version>$VERSION$</version>
|
||||||
|
<projectmanagement>KDevCustomProject</projectmanagement>
|
||||||
|
<primarylanguage>C</primarylanguage>
|
||||||
|
<ignoreparts/>
|
||||||
|
</general>
|
||||||
|
<kdevcustomproject>
|
||||||
|
<run>
|
||||||
|
<mainprogram>Source</mainprogram>
|
||||||
|
<directoryradio>executable</directoryradio>
|
||||||
|
</run>
|
||||||
|
</kdevcustomproject>
|
||||||
|
<kdevdebugger>
|
||||||
|
<general>
|
||||||
|
<dbgshell/>
|
||||||
|
</general>
|
||||||
|
</kdevdebugger>
|
||||||
|
<kdevdoctreeview>
|
||||||
|
<ignoretocs>
|
||||||
|
<toc>ada</toc>
|
||||||
|
<toc>ada_bugs_gcc</toc>
|
||||||
|
<toc>bash</toc>
|
||||||
|
<toc>bash_bugs</toc>
|
||||||
|
<toc>clanlib</toc>
|
||||||
|
<toc>fortran_bugs_gcc</toc>
|
||||||
|
<toc>gnome1</toc>
|
||||||
|
<toc>gnustep</toc>
|
||||||
|
<toc>gtk</toc>
|
||||||
|
<toc>gtk_bugs</toc>
|
||||||
|
<toc>haskell</toc>
|
||||||
|
<toc>haskell_bugs_ghc</toc>
|
||||||
|
<toc>java_bugs_gcc</toc>
|
||||||
|
<toc>java_bugs_sun</toc>
|
||||||
|
<toc>kde2book</toc>
|
||||||
|
<toc>libstdc++</toc>
|
||||||
|
<toc>opengl</toc>
|
||||||
|
<toc>pascal_bugs_fp</toc>
|
||||||
|
<toc>php</toc>
|
||||||
|
<toc>php_bugs</toc>
|
||||||
|
<toc>perl</toc>
|
||||||
|
<toc>perl_bugs</toc>
|
||||||
|
<toc>python</toc>
|
||||||
|
<toc>python_bugs</toc>
|
||||||
|
<toc>qt-kdev3</toc>
|
||||||
|
<toc>ruby</toc>
|
||||||
|
<toc>ruby_bugs</toc>
|
||||||
|
<toc>sdl</toc>
|
||||||
|
<toc>stl</toc>
|
||||||
|
<toc>sw</toc>
|
||||||
|
<toc>w3c-dom-level2-html</toc>
|
||||||
|
<toc>w3c-svg</toc>
|
||||||
|
<toc>w3c-uaag10</toc>
|
||||||
|
<toc>wxwidgets_bugs</toc>
|
||||||
|
</ignoretocs>
|
||||||
|
<ignoreqt_xml>
|
||||||
|
<toc>Guide to the Qt Translation Tools</toc>
|
||||||
|
<toc>Qt Assistant Manual</toc>
|
||||||
|
<toc>Qt Designer Manual</toc>
|
||||||
|
<toc>Qt Reference Documentation</toc>
|
||||||
|
<toc>qmake User Guide</toc>
|
||||||
|
</ignoreqt_xml>
|
||||||
|
<ignoredoxygen>
|
||||||
|
<toc>KDE Libraries (Doxygen)</toc>
|
||||||
|
</ignoredoxygen>
|
||||||
|
</kdevdoctreeview>
|
||||||
|
<kdevfilecreate>
|
||||||
|
<filetypes/>
|
||||||
|
<useglobaltypes>
|
||||||
|
<type ext="c" />
|
||||||
|
<type ext="h" />
|
||||||
|
</useglobaltypes>
|
||||||
|
</kdevfilecreate>
|
||||||
|
<kdevcppsupport>
|
||||||
|
<references/>
|
||||||
|
<codecompletion>
|
||||||
|
<includeGlobalFunctions>true</includeGlobalFunctions>
|
||||||
|
<includeTypes>true</includeTypes>
|
||||||
|
<includeEnums>true</includeEnums>
|
||||||
|
<includeTypedefs>false</includeTypedefs>
|
||||||
|
<automaticCodeCompletion>true</automaticCodeCompletion>
|
||||||
|
<automaticArgumentsHint>true</automaticArgumentsHint>
|
||||||
|
<automaticHeaderCompletion>true</automaticHeaderCompletion>
|
||||||
|
<codeCompletionDelay>250</codeCompletionDelay>
|
||||||
|
<argumentsHintDelay>400</argumentsHintDelay>
|
||||||
|
<headerCompletionDelay>250</headerCompletionDelay>
|
||||||
|
</codecompletion>
|
||||||
|
</kdevcppsupport>
|
||||||
|
<kdevfileview>
|
||||||
|
<groups>
|
||||||
|
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||||
|
<hidenonlocation>false</hidenonlocation>
|
||||||
|
</groups>
|
||||||
|
<tree>
|
||||||
|
<hidepatterns>*.o,*.lo,CVS</hidepatterns>
|
||||||
|
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||||
|
</tree>
|
||||||
|
</kdevfileview>
|
||||||
|
</kdevelop>
|
|
@ -1,100 +0,0 @@
|
||||||
# Copyright (C) 2005 Jan Hutter, Martin Willi
|
|
||||||
# Hochschule fuer Technik Rapperswil
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by the
|
|
||||||
# Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# for more details.
|
|
||||||
#
|
|
||||||
|
|
||||||
FREESWANSRCDIR=../..
|
|
||||||
# include strongswan Makefile, if charon sits in its tree
|
|
||||||
ifeq ($(shell ls $(FREESWANSRCDIR)/Makefile.inc 2>&1), ../../Makefile.inc)
|
|
||||||
include ${FREESWANSRCDIR}/Makefile.inc
|
|
||||||
endif
|
|
||||||
|
|
||||||
BUILD_DIR= ./bin/
|
|
||||||
|
|
||||||
BINNAMECHARON= $(BUILD_DIR)charon
|
|
||||||
BINNAMESTROKE= $(BUILD_DIR)stroke
|
|
||||||
BINNAMETEST= $(BUILD_DIR)run_tests
|
|
||||||
|
|
||||||
MAIN_DIR= ./
|
|
||||||
|
|
||||||
LDFLAGS= -lgmp -lpthread
|
|
||||||
|
|
||||||
CFLAGS+= -I. -O3#-Wall -g -DLEAK_DETECTIVE
|
|
||||||
|
|
||||||
# objects is extended by each included Makefile
|
|
||||||
OBJS=
|
|
||||||
|
|
||||||
all : build_dir $(BINNAMECHARON) $(BINNAMESTROKE)
|
|
||||||
|
|
||||||
programs : all
|
|
||||||
|
|
||||||
test : build_dir $(BINNAMETEST)
|
|
||||||
$(BINNAMETEST)
|
|
||||||
|
|
||||||
apidoc :
|
|
||||||
doxygen Doxyfile
|
|
||||||
|
|
||||||
|
|
||||||
include $(MAIN_DIR)network/Makefile.network
|
|
||||||
include $(MAIN_DIR)config/Makefile.config
|
|
||||||
include $(MAIN_DIR)encoding/Makefile.encoding
|
|
||||||
include $(MAIN_DIR)queues/Makefile.queues
|
|
||||||
include $(MAIN_DIR)sa/Makefile.sa
|
|
||||||
include $(MAIN_DIR)threads/Makefile.threads
|
|
||||||
include $(MAIN_DIR)transforms/Makefile.transforms
|
|
||||||
include $(MAIN_DIR)utils/Makefile.utils
|
|
||||||
include $(MAIN_DIR)asn1/Makefile.asn1
|
|
||||||
|
|
||||||
|
|
||||||
build_dir:
|
|
||||||
mkdir -p $(BUILD_DIR)
|
|
||||||
|
|
||||||
$(BUILD_DIR)daemon.o : daemon.c daemon.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
OBJS+=$(BUILD_DIR)types.o
|
|
||||||
$(BUILD_DIR)types.o : types.c types.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
OBJS+=$(BUILD_DIR)definitions.o
|
|
||||||
$(BUILD_DIR)definitions.o : definitions.c definitions.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(BINNAMECHARON) : $(OBJS) $(BUILD_DIR)daemon.o
|
|
||||||
$(CC) $(LDFLAGS) $(OBJS) $(BUILD_DIR)daemon.o -o $@
|
|
||||||
|
|
||||||
$(BINNAMESTROKE) : stroke.c
|
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) stroke.c -o $@
|
|
||||||
|
|
||||||
TEST_OBJS = $(OBJS)
|
|
||||||
include $(MAIN_DIR)testcases/Makefile.testcases
|
|
||||||
|
|
||||||
$(BUILD_DIR)run_tests : build_dir $(TEST_OBJS)
|
|
||||||
$(CC) $(LDFLAGS) $(TEST_OBJS) -o $@
|
|
||||||
|
|
||||||
install : $(BINNAMECHARON)
|
|
||||||
$(INSTALL) $(INSTBINFLAGS) $(BINNAMECHARON) $(BINNAMESTROKE) $(LIBEXECDIR)
|
|
||||||
|
|
||||||
install_file_list:
|
|
||||||
@echo $(LIBEXECDIR)/charon
|
|
||||||
@echo $(LIBEXECDIR)/stroke
|
|
||||||
|
|
||||||
clean :
|
|
||||||
rm -fR $(BUILD_DIR); rm -Rf doc/api
|
|
||||||
|
|
||||||
cleanall: clean
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
|
|
||||||
mostlyclean: clean
|
|
||||||
|
|
||||||
realclean: clean
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Copyright (C) 2006 Martin Willi
|
||||||
|
# Hochschule fuer Technik Rapperswil
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
# for more details.
|
||||||
|
#
|
||||||
|
CHARON_DIR= $(MAIN_DIR)charon/
|
||||||
|
|
||||||
|
$(BUILD_DIR)daemon.o : $(CHARON_DIR)daemon.c $(CHARON_DIR)daemon.h
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
|
include $(CHARON_DIR)network/Makefile.network
|
||||||
|
include $(CHARON_DIR)config/Makefile.config
|
||||||
|
include $(CHARON_DIR)encoding/Makefile.encoding
|
||||||
|
include $(CHARON_DIR)queues/Makefile.queues
|
||||||
|
include $(CHARON_DIR)sa/Makefile.sa
|
||||||
|
include $(CHARON_DIR)threads/Makefile.threads
|
|
@ -1,867 +0,0 @@
|
||||||
diff -Naur strongswan-2.6.3/Makefile.inc strongswan-2.6.3-charon/Makefile.inc
|
|
||||||
--- strongswan-2.6.3/Makefile.inc 2006-01-25 18:23:15.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/Makefile.inc 2006-03-21 09:26:23.000000000 +0100
|
|
||||||
@@ -284,6 +284,9 @@
|
|
||||||
# include PKCS11-based smartcard support
|
|
||||||
USE_SMARTCARD?=false
|
|
||||||
|
|
||||||
+# support IKEv2 via charon
|
|
||||||
+USE_IKEV2?=true
|
|
||||||
+
|
|
||||||
# Default PKCS11 library
|
|
||||||
# Uncomment this line if using OpenSC <= 0.9.6
|
|
||||||
PKCS11_DEFAULT_LIB=\"/usr/lib/pkcs11/opensc-pkcs11.so\"
|
|
||||||
diff -Naur strongswan-2.6.3/programs/Makefile strongswan-2.6.3-charon/programs/Makefile
|
|
||||||
--- strongswan-2.6.3/programs/Makefile 2006-01-01 16:14:08.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/Makefile 2006-03-21 09:26:23.000000000 +0100
|
|
||||||
@@ -32,6 +32,10 @@
|
|
||||||
SUBDIRS+=showpolicy
|
|
||||||
endif
|
|
||||||
|
|
||||||
+ifeq ($(USE_IKEV2),true)
|
|
||||||
+SUBDIRS+=charon
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
def:
|
|
||||||
@echo "Please read doc/intro.html or INSTALL before running make"
|
|
||||||
@false
|
|
||||||
diff -Naur strongswan-2.6.3/programs/ipsec/ipsec.in strongswan-2.6.3-charon/programs/ipsec/ipsec.in
|
|
||||||
--- strongswan-2.6.3/programs/ipsec/ipsec.in 2006-03-09 21:09:33.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/ipsec/ipsec.in 2006-03-21 09:49:10.000000000 +0100
|
|
||||||
@@ -123,6 +123,10 @@
|
|
||||||
down)
|
|
||||||
shift
|
|
||||||
$IPSEC_EXECDIR/whack --name "$1" --terminate
|
|
||||||
+ if test -e $IPSEC_EXECDIR/stroke
|
|
||||||
+ then
|
|
||||||
+ $IPSEC_EXECDIR/stroke --name "$1" --terminate
|
|
||||||
+ fi
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
listalgs|listpubkeys|listcerts|listcacerts|\
|
|
||||||
@@ -134,11 +138,19 @@
|
|
||||||
op="$1"
|
|
||||||
shift
|
|
||||||
$IPSEC_EXECDIR/whack "$@" "--$op"
|
|
||||||
+ if test -e $IPSEC_EXECDIR/stroke
|
|
||||||
+ then
|
|
||||||
+ $IPSEC_EXECDIR/stroke "$@" "--$op"
|
|
||||||
+ fi
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
ready)
|
|
||||||
shift
|
|
||||||
$IPSEC_EXECDIR/whack --listen
|
|
||||||
+ if test -e $IPSEC_EXECDIR/stroke
|
|
||||||
+ then
|
|
||||||
+ $IPSEC_EXECDIR/stroke --listen
|
|
||||||
+ fi
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
reload)
|
|
||||||
@@ -180,8 +192,16 @@
|
|
||||||
if test $# -eq 0
|
|
||||||
then
|
|
||||||
$IPSEC_EXECDIR/whack "--$op"
|
|
||||||
+ if test -e $IPSEC_EXECDIR/stroke
|
|
||||||
+ then
|
|
||||||
+ $IPSEC_EXECDIR/stroke "--$op"
|
|
||||||
+ fi
|
|
||||||
else
|
|
||||||
$IPSEC_EXECDIR/whack --name "$1" "--$op"
|
|
||||||
+ if test -e $IPSEC_EXECDIR/stroke
|
|
||||||
+ then
|
|
||||||
+ $IPSEC_EXECDIR/stroke --name "$1" "--$op"
|
|
||||||
+ fi
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
diff -Naur strongswan-2.6.3/programs/pluto/Makefile strongswan-2.6.3-charon/programs/pluto/Makefile
|
|
||||||
--- strongswan-2.6.3/programs/pluto/Makefile 2006-01-25 18:22:19.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/pluto/Makefile 2006-03-21 10:00:41.000000000 +0100
|
|
||||||
@@ -170,6 +170,11 @@
|
|
||||||
LIBSPLUTO+= -ldl
|
|
||||||
endif
|
|
||||||
|
|
||||||
+# enable IKEv2 support
|
|
||||||
+ifeq ($(USE_IKEV2),true)
|
|
||||||
+ DEFINES+= -DIKEV2
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
# This compile option activates the leak detective
|
|
||||||
ifeq ($(USE_LEAK_DETECTIVE),true)
|
|
||||||
DEFINES+= -DLEAK_DETECTIVE
|
|
||||||
diff -Naur strongswan-2.6.3/programs/pluto/demux.c strongswan-2.6.3-charon/programs/pluto/demux.c
|
|
||||||
--- strongswan-2.6.3/programs/pluto/demux.c 2005-02-18 22:08:59.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/pluto/demux.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -1229,6 +1229,15 @@
|
|
||||||
if (md->packet_pbs.roof - md->packet_pbs.cur >= (ptrdiff_t)isakmp_hdr_desc.size)
|
|
||||||
{
|
|
||||||
struct isakmp_hdr *hdr = (struct isakmp_hdr *)md->packet_pbs.cur;
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if ((hdr->isa_version >> ISA_MAJ_SHIFT) == 0x2 &&
|
|
||||||
+ (hdr->isa_version & ISA_MIN_MASK) == 0x0)
|
|
||||||
+ {
|
|
||||||
+ /* IKEv2 is handled from charon, ignore */
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
if ((hdr->isa_version >> ISA_MAJ_SHIFT) != ISAKMP_MAJOR_VERSION)
|
|
||||||
{
|
|
||||||
SEND_NOTIFICATION(INVALID_MAJOR_VERSION);
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/Makefile strongswan-2.6.3-charon/programs/starter/Makefile
|
|
||||||
--- strongswan-2.6.3/programs/starter/Makefile 2006-02-17 20:34:02.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/Makefile 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -34,6 +34,11 @@
|
|
||||||
DEFINES+= -DLEAK_DETECTIVE
|
|
||||||
endif
|
|
||||||
|
|
||||||
+# Enable charon support
|
|
||||||
+ifeq ($(USE_IKEV2),true)
|
|
||||||
+ DEFINES+= -DIKEV2
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
INCLUDES=-I${FREESWANDIR}/linux/include
|
|
||||||
CFLAGS=$(DEFINES) $(INCLUDES) -Wall
|
|
||||||
CFLAGS+=-DIPSEC_EXECDIR=\"${FINALLIBEXECDIR}\" -DIPSEC_CONFDDIR=\"${FINALCONFDDIR}\"
|
|
||||||
@@ -46,6 +51,11 @@
|
|
||||||
starterwhack.o klips.o netkey.o interfaces.o exec.o cmp.o confread.o \
|
|
||||||
loglite.o ${PLUTO_OBJS}
|
|
||||||
|
|
||||||
+# Build charon-only objs
|
|
||||||
+ifeq ($(USE_IKEV2),true)
|
|
||||||
+ OBJS+= invokecharon.o starterstroke.o
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
DISTSRC=$(OBJS:.o=.c)
|
|
||||||
DISTSRC+=cmp.h confread.h confwrite.h exec.h files.h interfaces.h klips.h netkey.h
|
|
||||||
DISTSRC+=parser.h args.h invokepluto.h starterwhack.h keywords.h keywords.txt
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/args.c strongswan-2.6.3-charon/programs/starter/args.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/args.c 2006-03-10 21:37:10.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/args.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -86,6 +86,10 @@
|
|
||||||
|
|
||||||
static const char *LST_keyexchange[] = {
|
|
||||||
"ike",
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ "ikev1",
|
|
||||||
+ "ikev2",
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/files.h strongswan-2.6.3-charon/programs/starter/files.h
|
|
||||||
--- strongswan-2.6.3/programs/starter/files.h 2006-02-04 19:52:58.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/files.h 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -37,8 +37,15 @@
|
|
||||||
#define SECRETS_FILE IPSEC_CONFDIR"/ipsec.secrets"
|
|
||||||
|
|
||||||
#define PLUTO_CMD IPSEC_EXECDIR"/pluto"
|
|
||||||
-#define CTL_FILE DEFAULT_CTLBASE CTL_SUFFIX
|
|
||||||
-#define PID_FILE DEFAULT_CTLBASE PID_SUFFIX
|
|
||||||
+#define PLUTO_CTL_FILE DEFAULT_CTLBASE CTL_SUFFIX
|
|
||||||
+#define PLUTO_PID_FILE DEFAULT_CTLBASE PID_SUFFIX
|
|
||||||
+
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+#define CHARON_CMD IPSEC_EXECDIR"/charon"
|
|
||||||
+#define CHARON_BASE "/var/run/charon"
|
|
||||||
+#define CHARON_CTL_FILE CHARON_BASE CTL_SUFFIX
|
|
||||||
+#define CHARON_PID_FILE CHARON_BASE PID_SUFFIX
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
|
|
||||||
#define DYNIP_DIR "/var/run/dynip"
|
|
||||||
#define INFO_FILE "/var/run/ipsec.info"
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/invokecharon.c strongswan-2.6.3-charon/programs/starter/invokecharon.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/invokecharon.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/invokecharon.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -0,0 +1,168 @@
|
|
||||||
+/* strongSwan charon launcher
|
|
||||||
+ * Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security
|
|
||||||
+ * Copyright (C) 2006 Martin Willi - Hochschule fuer Technik Rapperswil
|
|
||||||
+ *
|
|
||||||
+ * Ported from invokepluto.c to fit charons needs.
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
+ * for more details.
|
|
||||||
+ *
|
|
||||||
+ * RCSID $Id: invokecharon.c $
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <signal.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <errno.h>
|
|
||||||
+
|
|
||||||
+#include <freeswan.h>
|
|
||||||
+
|
|
||||||
+#include "../pluto/constants.h"
|
|
||||||
+#include "../pluto/defs.h"
|
|
||||||
+#include "../pluto/log.h"
|
|
||||||
+
|
|
||||||
+#include "confread.h"
|
|
||||||
+#include "invokecharon.h"
|
|
||||||
+#include "files.h"
|
|
||||||
+
|
|
||||||
+static int _charon_pid = 0;
|
|
||||||
+static int _stop_requested;
|
|
||||||
+
|
|
||||||
+pid_t
|
|
||||||
+starter_charon_pid(void)
|
|
||||||
+{
|
|
||||||
+ return _charon_pid;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+starter_charon_sigchild(pid_t pid)
|
|
||||||
+{
|
|
||||||
+ if (pid == _charon_pid)
|
|
||||||
+ {
|
|
||||||
+ _charon_pid = 0;
|
|
||||||
+ if (!_stop_requested)
|
|
||||||
+ {
|
|
||||||
+ plog("charon has died -- restart scheduled (%dsec)"
|
|
||||||
+ , CHARON_RESTART_DELAY);
|
|
||||||
+ alarm(CHARON_RESTART_DELAY); // restart in 5 sec
|
|
||||||
+ }
|
|
||||||
+ unlink(CHARON_PID_FILE);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+starter_stop_charon (void)
|
|
||||||
+{
|
|
||||||
+ pid_t pid;
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ pid = _charon_pid;
|
|
||||||
+ if (pid)
|
|
||||||
+ {
|
|
||||||
+ _stop_requested = 1;
|
|
||||||
+
|
|
||||||
+ /* be more and more aggressive */
|
|
||||||
+ for (i = 0; i < 20 && (pid = _charon_pid) != 0; i++)
|
|
||||||
+ {
|
|
||||||
+ if (i == 0)
|
|
||||||
+ kill(pid, SIGINT);
|
|
||||||
+ else if (i < 10)
|
|
||||||
+ kill(pid, SIGTERM);
|
|
||||||
+ else
|
|
||||||
+ kill(pid, SIGKILL);
|
|
||||||
+ usleep(20000);
|
|
||||||
+ }
|
|
||||||
+ if (_charon_pid == 0)
|
|
||||||
+ return 0;
|
|
||||||
+ plog("starter_stop_charon(): can't stop charon !!!");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ plog("stater_stop_charon(): charon is not started...");
|
|
||||||
+ }
|
|
||||||
+ return -1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+starter_start_charon (starter_config_t *cfg, bool debug)
|
|
||||||
+{
|
|
||||||
+ int pid, i;
|
|
||||||
+ struct stat stb;
|
|
||||||
+ char *arg[] = {
|
|
||||||
+ CHARON_CMD, NULL
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ if (_charon_pid)
|
|
||||||
+ {
|
|
||||||
+ plog("starter_start_charon(): charon already started...");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ unlink(CHARON_CTL_FILE);
|
|
||||||
+ _stop_requested = 0;
|
|
||||||
+
|
|
||||||
+ pid = fork();
|
|
||||||
+ switch (pid)
|
|
||||||
+ {
|
|
||||||
+ case -1:
|
|
||||||
+ plog("can't fork(): %s", strerror(errno));
|
|
||||||
+ return -1;
|
|
||||||
+ case 0:
|
|
||||||
+ /* child */
|
|
||||||
+ setsid();
|
|
||||||
+ sigprocmask(SIG_SETMASK, 0, NULL);
|
|
||||||
+ execv(arg[0], arg);
|
|
||||||
+ plog("can't execv(%s,...): %s", arg[0], strerror(errno));
|
|
||||||
+ exit(1);
|
|
||||||
+ default:
|
|
||||||
+ /* father */
|
|
||||||
+ _charon_pid = pid;
|
|
||||||
+ for (i = 0; i < 50 && _charon_pid; i++)
|
|
||||||
+ {
|
|
||||||
+ /* wait for charon */
|
|
||||||
+ usleep(20000);
|
|
||||||
+ if (stat(CHARON_PID_FILE, &stb) == 0)
|
|
||||||
+ {
|
|
||||||
+ DBG(DBG_CONTROL,
|
|
||||||
+ DBG_log("charon (%d) started", _charon_pid)
|
|
||||||
+ )
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (_charon_pid)
|
|
||||||
+ {
|
|
||||||
+ /* If charon is started but with no ctl file, stop it */
|
|
||||||
+ plog("charon too long to start... - kill kill");
|
|
||||||
+ for (i = 0; i < 20 && (pid = _charon_pid) != 0; i++)
|
|
||||||
+ {
|
|
||||||
+ if (i == 0)
|
|
||||||
+ kill(pid, SIGINT);
|
|
||||||
+ else if (i < 10)
|
|
||||||
+ kill(pid, SIGTERM);
|
|
||||||
+ else
|
|
||||||
+ kill(pid, SIGKILL);
|
|
||||||
+ usleep(20000);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ plog("charon refused to be started");
|
|
||||||
+ }
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return -1;
|
|
||||||
+}
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/invokecharon.h strongswan-2.6.3-charon/programs/starter/invokecharon.h
|
|
||||||
--- strongswan-2.6.3/programs/starter/invokecharon.h 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/invokecharon.h 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -0,0 +1,31 @@
|
|
||||||
+/* strongSwan charon launcher
|
|
||||||
+ * Copyright (C) 2001-2002 Mathieu Lafon - Arkoon Network Security
|
|
||||||
+ * Copyright (C) 2006 Martin Willi - Hochschule fuer Technik Rapperswil
|
|
||||||
+ *
|
|
||||||
+ * Ported from invokepluto.h to fit charons needs.
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
+ * for more details.
|
|
||||||
+ *
|
|
||||||
+ * RCSID $Id: invokecharon.h $
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifndef _STARTER_CHARON_H_
|
|
||||||
+#define _STARTER_CHARON_H_
|
|
||||||
+
|
|
||||||
+#define CHARON_RESTART_DELAY 5
|
|
||||||
+
|
|
||||||
+extern void starter_charon_sigchild (pid_t pid);
|
|
||||||
+extern pid_t starter_charon_pid (void);
|
|
||||||
+extern int starter_stop_charon (void);
|
|
||||||
+extern int starter_start_charon(struct starter_config *cfg, bool debug);
|
|
||||||
+
|
|
||||||
+#endif /* _STARTER_CHARON_H_ */
|
|
||||||
+
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/invokepluto.c strongswan-2.6.3-charon/programs/starter/invokepluto.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/invokepluto.c 2006-02-17 22:41:50.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/invokepluto.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -54,7 +54,7 @@
|
|
||||||
, PLUTO_RESTART_DELAY);
|
|
||||||
alarm(PLUTO_RESTART_DELAY); // restart in 5 sec
|
|
||||||
}
|
|
||||||
- unlink(PID_FILE);
|
|
||||||
+ unlink(PLUTO_PID_FILE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- unlink(CTL_FILE);
|
|
||||||
+ unlink(PLUTO_CTL_FILE);
|
|
||||||
_stop_requested = 0;
|
|
||||||
|
|
||||||
if (cfg->setup.prepluto)
|
|
||||||
@@ -252,7 +252,7 @@
|
|
||||||
{
|
|
||||||
/* wait for pluto */
|
|
||||||
usleep(20000);
|
|
||||||
- if (stat(CTL_FILE, &stb) == 0)
|
|
||||||
+ if (stat(PLUTO_CTL_FILE, &stb) == 0)
|
|
||||||
{
|
|
||||||
DBG(DBG_CONTROL,
|
|
||||||
DBG_log("pluto (%d) started", _pluto_pid)
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/starter.c strongswan-2.6.3-charon/programs/starter/starter.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/starter.c 2006-02-15 19:37:46.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/starter.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -37,6 +37,7 @@
|
|
||||||
#include "files.h"
|
|
||||||
#include "starterwhack.h"
|
|
||||||
#include "invokepluto.h"
|
|
||||||
+#include "invokecharon.h"
|
|
||||||
#include "klips.h"
|
|
||||||
#include "netkey.h"
|
|
||||||
#include "cmp.h"
|
|
||||||
@@ -47,6 +48,9 @@
|
|
||||||
#define FLAG_ACTION_RELOAD 0x04
|
|
||||||
#define FLAG_ACTION_QUIT 0x08
|
|
||||||
#define FLAG_ACTION_LISTEN 0x10
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+#define FLAG_ACTION_START_CHARON 0x20
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
|
|
||||||
static unsigned int _action_ = 0;
|
|
||||||
|
|
||||||
@@ -65,6 +69,10 @@
|
|
||||||
{
|
|
||||||
if (pid == starter_pluto_pid())
|
|
||||||
name = " (Pluto)";
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (pid == starter_charon_pid())
|
|
||||||
+ name = " (Charon)";
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
if (WIFSIGNALED(status))
|
|
||||||
DBG(DBG_CONTROL,
|
|
||||||
DBG_log("child %d%s has been killed by sig %d\n",
|
|
||||||
@@ -87,6 +95,10 @@
|
|
||||||
|
|
||||||
if (pid == starter_pluto_pid())
|
|
||||||
starter_pluto_sigchild(pid);
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (pid == starter_charon_pid())
|
|
||||||
+ starter_charon_sigchild(pid);
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
@@ -97,6 +109,9 @@
|
|
||||||
|
|
||||||
case SIGALRM:
|
|
||||||
_action_ |= FLAG_ACTION_START_PLUTO;
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ _action_ |= FLAG_ACTION_START_CHARON;
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGHUP:
|
|
||||||
@@ -193,6 +208,9 @@
|
|
||||||
signal(SIGQUIT, fsig);
|
|
||||||
signal(SIGALRM, fsig);
|
|
||||||
signal(SIGUSR1, fsig);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ plog("Starting strongSwan IPsec %s [starter]...", ipsec_version_code());
|
|
||||||
|
|
||||||
/* verify that we can start */
|
|
||||||
if (getuid() != 0)
|
|
||||||
@@ -201,12 +219,24 @@
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (stat(PID_FILE, &stb) == 0)
|
|
||||||
+ if (stat(PLUTO_PID_FILE, &stb) == 0)
|
|
||||||
{
|
|
||||||
- plog("pluto is already running (%s exists) -- aborting", PID_FILE);
|
|
||||||
- exit(1);
|
|
||||||
+ plog("pluto is already running (%s exists) -- skipping pluto start", PLUTO_PID_FILE);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ _action_ |= FLAG_ACTION_START_PLUTO;
|
|
||||||
+ }
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (stat(CHARON_PID_FILE, &stb) == 0)
|
|
||||||
+ {
|
|
||||||
+ plog("charon is already running (%s exists) -- skipping charon start", CHARON_PID_FILE);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ _action_ |= FLAG_ACTION_START_CHARON;
|
|
||||||
+ }
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
if (stat(DEV_RANDOM, &stb) != 0)
|
|
||||||
{
|
|
||||||
plog("unable to start strongSwan IPsec -- no %s!", DEV_RANDOM);
|
|
||||||
@@ -247,7 +277,11 @@
|
|
||||||
|
|
||||||
last_reload = time(NULL);
|
|
||||||
|
|
||||||
- plog("Starting strongSwan IPsec %s [starter]...", ipsec_version_code());
|
|
||||||
+ if (stat(MY_PID_FILE, &stb) == 0)
|
|
||||||
+ {
|
|
||||||
+ plog("starter is already running (%s exists) -- no fork done", MY_PID_FILE);
|
|
||||||
+ exit(0);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* fork if we're not debugging stuff */
|
|
||||||
if (!no_fork)
|
|
||||||
@@ -296,17 +330,19 @@
|
|
||||||
, &cfg->defaultroute);
|
|
||||||
}
|
|
||||||
|
|
||||||
- _action_ = FLAG_ACTION_START_PLUTO;
|
|
||||||
-
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
- * Stop pluto (if started) and exit
|
|
||||||
- */
|
|
||||||
+ * Stop pluto/charon (if started) and exit
|
|
||||||
+ */
|
|
||||||
if (_action_ & FLAG_ACTION_QUIT)
|
|
||||||
{
|
|
||||||
if (starter_pluto_pid())
|
|
||||||
starter_stop_pluto();
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (starter_charon_pid())
|
|
||||||
+ starter_stop_charon();
|
|
||||||
+#endif IKEV2
|
|
||||||
if (has_netkey)
|
|
||||||
starter_netkey_cleanup();
|
|
||||||
else
|
|
||||||
@@ -337,6 +373,9 @@
|
|
||||||
if (conn->state == STATE_ADDED)
|
|
||||||
{
|
|
||||||
starter_whack_del_conn(conn);
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ starter_stroke_del_conn(conn);
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
conn->state = STATE_TO_ADD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -427,6 +466,9 @@
|
|
||||||
{
|
|
||||||
if (conn->state == STATE_ADDED)
|
|
||||||
starter_whack_del_conn(conn);
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ starter_stroke_del_conn(conn);
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look for new ca sections that are already loaded */
|
|
||||||
@@ -502,6 +544,27 @@
|
|
||||||
conn->state = STATE_TO_ADD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ /*
|
|
||||||
+ * Start charon
|
|
||||||
+ */
|
|
||||||
+ if (_action_ & FLAG_ACTION_START_CHARON)
|
|
||||||
+ {
|
|
||||||
+ if (starter_charon_pid() == 0)
|
|
||||||
+ {
|
|
||||||
+ DBG(DBG_CONTROL,
|
|
||||||
+ DBG_log("Attempting to start charon...")
|
|
||||||
+ )
|
|
||||||
+ if (starter_start_charon(cfg, no_fork) != 0)
|
|
||||||
+ {
|
|
||||||
+ /* schedule next try */
|
|
||||||
+ alarm(PLUTO_RESTART_DELAY);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ _action_ &= ~FLAG_ACTION_START_CHARON;
|
|
||||||
+ }
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell pluto to reread its interfaces
|
|
||||||
@@ -536,11 +599,36 @@
|
|
||||||
conn->id = id++;
|
|
||||||
}
|
|
||||||
starter_whack_add_conn(conn);
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ starter_stroke_add_conn(conn);
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
conn->state = STATE_ADDED;
|
|
||||||
if (conn->startup == STARTUP_START)
|
|
||||||
- starter_whack_initiate_conn(conn);
|
|
||||||
+ {
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (conn->keyexchange == 2)
|
|
||||||
+ {
|
|
||||||
+ starter_stroke_initiate_conn(conn);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
+ {
|
|
||||||
+ starter_whack_initiate_conn(conn);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
else if (conn->startup == STARTUP_ROUTE)
|
|
||||||
- starter_whack_route_conn(conn);
|
|
||||||
+ {
|
|
||||||
+#ifdef IKEV2
|
|
||||||
+ if (conn->keyexchange == 2)
|
|
||||||
+ {
|
|
||||||
+ starter_stroke_route_conn(conn);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+#endif /* IKEV2 */
|
|
||||||
+ {
|
|
||||||
+ starter_whack_route_conn(conn);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/starterstroke.c strongswan-2.6.3-charon/programs/starter/starterstroke.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/starterstroke.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/starterstroke.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -0,0 +1,193 @@
|
|
||||||
+/* Stroke for charon is the counterpart to whack from pluto
|
|
||||||
+ * Copyright (C) 2006 Martin Willi - Hochschule fuer Technik Rapperswil
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
+ * for more details.
|
|
||||||
+ *
|
|
||||||
+ * RCSID $Id: starterstroke.c $
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <sys/socket.h>
|
|
||||||
+#include <sys/un.h>
|
|
||||||
+#include <linux/stddef.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <netinet/in.h>
|
|
||||||
+#include <arpa/inet.h>
|
|
||||||
+
|
|
||||||
+#include <freeswan.h>
|
|
||||||
+
|
|
||||||
+#include "../pluto/constants.h"
|
|
||||||
+#include "../pluto/defs.h"
|
|
||||||
+#include "../pluto/log.h"
|
|
||||||
+
|
|
||||||
+#include "starterstroke.h"
|
|
||||||
+#include "confread.h"
|
|
||||||
+#include "files.h"
|
|
||||||
+
|
|
||||||
+typedef struct stroke_msg_t stroke_msg_t;
|
|
||||||
+
|
|
||||||
+struct stroke_msg_t {
|
|
||||||
+ /* length of this message with all strings */
|
|
||||||
+ u_int16_t length;
|
|
||||||
+ /* type of the message */
|
|
||||||
+ enum {
|
|
||||||
+ /* initiate a connection */
|
|
||||||
+ STR_INITIATE,
|
|
||||||
+ /* install SPD entries for a connection */
|
|
||||||
+ STR_INSTALL,
|
|
||||||
+ /* add a connection */
|
|
||||||
+ STR_ADD_CONN,
|
|
||||||
+ /* delete a connection */
|
|
||||||
+ STR_DEL_CONN,
|
|
||||||
+ /* more to come */
|
|
||||||
+ } type;
|
|
||||||
+ union {
|
|
||||||
+ /* data for STR_INITIATE, STR_INSTALL */
|
|
||||||
+ struct {
|
|
||||||
+ char *name;
|
|
||||||
+ } initiate, install;
|
|
||||||
+ /* data for STR_ADD_CONN */
|
|
||||||
+ struct {
|
|
||||||
+ char *name;
|
|
||||||
+ struct {
|
|
||||||
+ char *id;
|
|
||||||
+ char *address;
|
|
||||||
+ char *subnet;
|
|
||||||
+ u_int8_t subnet_mask;
|
|
||||||
+ } me, other;
|
|
||||||
+ } add_conn;
|
|
||||||
+ };
|
|
||||||
+ u_int8_t buffer[];
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static char* push_string(stroke_msg_t **strm, char *string)
|
|
||||||
+{
|
|
||||||
+ stroke_msg_t *stroke_msg;
|
|
||||||
+ size_t string_length;
|
|
||||||
+
|
|
||||||
+ if (string == NULL)
|
|
||||||
+ {
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
+ stroke_msg = *strm;
|
|
||||||
+ string_length = strlen(string) + 1;
|
|
||||||
+ stroke_msg->length += string_length;
|
|
||||||
+
|
|
||||||
+ stroke_msg = realloc(stroke_msg, stroke_msg->length);
|
|
||||||
+ strcpy((char*)stroke_msg + stroke_msg->length - string_length, string);
|
|
||||||
+
|
|
||||||
+ *strm = stroke_msg;
|
|
||||||
+ return (char*)(u_int)stroke_msg->length - string_length;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+send_stroke_msg (stroke_msg_t *msg)
|
|
||||||
+{
|
|
||||||
+ struct sockaddr_un ctl_addr = { AF_UNIX, CHARON_CTL_FILE };
|
|
||||||
+ int sock;
|
|
||||||
+
|
|
||||||
+ sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
|
||||||
+ if (sock < 0)
|
|
||||||
+ {
|
|
||||||
+ plog("socket() failed: %s", strerror(errno));
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ if (connect(sock, (struct sockaddr *)&ctl_addr,
|
|
||||||
+ offsetof(struct sockaddr_un, sun_path) + strlen(ctl_addr.sun_path)) < 0)
|
|
||||||
+ {
|
|
||||||
+ plog("connect(charon_ctl) failed: %s", strerror(errno));
|
|
||||||
+ close(sock);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* send message */
|
|
||||||
+ if (write(sock, msg, msg->length) != msg->length)
|
|
||||||
+ {
|
|
||||||
+ plog("write(charon_ctl) failed: %s", strerror(errno));
|
|
||||||
+ close(sock);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ close(sock);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static char *
|
|
||||||
+connection_name(starter_conn_t *conn)
|
|
||||||
+{
|
|
||||||
+ /* if connection name is '%auto', create a new name like conn_xxxxx */
|
|
||||||
+ static char buf[32];
|
|
||||||
+
|
|
||||||
+ if (streq(conn->name, "%auto"))
|
|
||||||
+ {
|
|
||||||
+ sprintf(buf, "conn_%ld", conn->id);
|
|
||||||
+ return buf;
|
|
||||||
+ }
|
|
||||||
+ return conn->name;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+int starter_stroke_add_conn(starter_conn_t *conn)
|
|
||||||
+{
|
|
||||||
+ stroke_msg_t *msg = malloc(sizeof(stroke_msg_t));
|
|
||||||
+ int res;
|
|
||||||
+
|
|
||||||
+ msg->length = sizeof(stroke_msg_t);
|
|
||||||
+ msg->type = STR_ADD_CONN;
|
|
||||||
+
|
|
||||||
+ msg->add_conn.name = push_string(&msg, connection_name(conn));
|
|
||||||
+
|
|
||||||
+ msg->add_conn.me.id = push_string(&msg, conn->left.id);
|
|
||||||
+ msg->add_conn.me.address = push_string(&msg, inet_ntoa(conn->left.addr.u.v4.sin_addr));
|
|
||||||
+ msg->add_conn.me.subnet = push_string(&msg, inet_ntoa(conn->left.subnet.addr.u.v4.sin_addr));
|
|
||||||
+ msg->add_conn.me.subnet_mask = conn->left.subnet.maskbits;
|
|
||||||
+
|
|
||||||
+ msg->add_conn.other.id = push_string(&msg, conn->right.id);
|
|
||||||
+ msg->add_conn.other.address = push_string(&msg, inet_ntoa(conn->right.addr.u.v4.sin_addr));
|
|
||||||
+ msg->add_conn.other.subnet = push_string(&msg, inet_ntoa(conn->right.subnet.addr.u.v4.sin_addr));
|
|
||||||
+ msg->add_conn.other.subnet_mask = conn->right.subnet.maskbits;
|
|
||||||
+
|
|
||||||
+ res = send_stroke_msg(msg);
|
|
||||||
+ free(msg);
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int starter_stroke_del_conn(starter_conn_t *conn)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+int starter_stroke_route_conn(starter_conn_t *conn)
|
|
||||||
+{
|
|
||||||
+ stroke_msg_t *msg = malloc(sizeof(stroke_msg_t));
|
|
||||||
+ int res;
|
|
||||||
+
|
|
||||||
+ msg->length = sizeof(stroke_msg_t);
|
|
||||||
+ msg->type = STR_INSTALL;
|
|
||||||
+ msg->install.name = push_string(&msg, connection_name(conn));
|
|
||||||
+ res = send_stroke_msg(msg);
|
|
||||||
+ free(msg);
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int starter_stroke_initiate_conn(starter_conn_t *conn)
|
|
||||||
+{
|
|
||||||
+ stroke_msg_t *msg = malloc(sizeof(stroke_msg_t));
|
|
||||||
+ int res;
|
|
||||||
+
|
|
||||||
+ msg->length = sizeof(stroke_msg_t);
|
|
||||||
+ msg->type = STR_INITIATE;
|
|
||||||
+ msg->initiate.name = push_string(&msg, connection_name(conn));
|
|
||||||
+ res = send_stroke_msg(msg);
|
|
||||||
+ free(msg);
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/starterstroke.h strongswan-2.6.3-charon/programs/starter/starterstroke.h
|
|
||||||
--- strongswan-2.6.3/programs/starter/starterstroke.h 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/starterstroke.h 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -0,0 +1,27 @@
|
|
||||||
+/* Stroke for charon is the counterpart to whack from pluto
|
|
||||||
+ * Copyright (C) 2006 Martin Willi - Hochschule fuer Technik Rapperswil
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
+ * for more details.
|
|
||||||
+ *
|
|
||||||
+ * RCSID $Id: starterstroke.h $
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifndef _STARTER_STROKE_H_
|
|
||||||
+#define _STARTER_STROKE_H_
|
|
||||||
+
|
|
||||||
+#include "confread.h"
|
|
||||||
+
|
|
||||||
+extern int starter_stroke_add_conn(starter_conn_t *conn);
|
|
||||||
+extern int starter_stroke_del_conn(starter_conn_t *conn);
|
|
||||||
+extern int starter_stroke_route_conn(starter_conn_t *conn);
|
|
||||||
+extern int starter_stroke_initiate_conn(starter_conn_t *conn);
|
|
||||||
+
|
|
||||||
+#endif /* _STARTER_STROKE_H_ */
|
|
||||||
diff -Naur strongswan-2.6.3/programs/starter/starterwhack.c strongswan-2.6.3-charon/programs/starter/starterwhack.c
|
|
||||||
--- strongswan-2.6.3/programs/starter/starterwhack.c 2006-02-08 21:56:07.000000000 +0100
|
|
||||||
+++ strongswan-2.6.3-charon/programs/starter/starterwhack.c 2006-03-21 09:26:24.000000000 +0100
|
|
||||||
@@ -54,7 +54,7 @@
|
|
||||||
static int
|
|
||||||
send_whack_msg (whack_message_t *msg)
|
|
||||||
{
|
|
||||||
- struct sockaddr_un ctl_addr = { AF_UNIX, CTL_FILE };
|
|
||||||
+ struct sockaddr_un ctl_addr = { AF_UNIX, PLUTO_CTL_FILE };
|
|
||||||
int sock;
|
|
||||||
ssize_t len;
|
|
||||||
char *str_next, *str_roof;
|
|
|
@ -12,26 +12,26 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
CONFIG_DIR= $(MAIN_DIR)config/
|
CONFIG_DIR= $(CHARON_DIR)config/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)connection.o
|
CHARON_OBJS+= $(BUILD_DIR)connection.o
|
||||||
$(BUILD_DIR)connection.o : $(CONFIG_DIR)connection.c $(CONFIG_DIR)connection.h
|
$(BUILD_DIR)connection.o : $(CONFIG_DIR)connection.c $(CONFIG_DIR)connection.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)policy.o
|
CHARON_OBJS+= $(BUILD_DIR)policy.o
|
||||||
$(BUILD_DIR)policy.o : $(CONFIG_DIR)policy.c $(CONFIG_DIR)policy.h
|
$(BUILD_DIR)policy.o : $(CONFIG_DIR)policy.c $(CONFIG_DIR)policy.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)traffic_selector.o
|
CHARON_OBJS+= $(BUILD_DIR)traffic_selector.o
|
||||||
$(BUILD_DIR)traffic_selector.o : $(CONFIG_DIR)traffic_selector.c $(CONFIG_DIR)traffic_selector.h
|
$(BUILD_DIR)traffic_selector.o : $(CONFIG_DIR)traffic_selector.c $(CONFIG_DIR)traffic_selector.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)proposal.o
|
CHARON_OBJS+= $(BUILD_DIR)proposal.o
|
||||||
$(BUILD_DIR)proposal.o : $(CONFIG_DIR)proposal.c $(CONFIG_DIR)proposal.h
|
$(BUILD_DIR)proposal.o : $(CONFIG_DIR)proposal.c $(CONFIG_DIR)proposal.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)configuration.o
|
CHARON_OBJS+= $(BUILD_DIR)configuration.o
|
||||||
$(BUILD_DIR)configuration.o : $(CONFIG_DIR)configuration.c $(CONFIG_DIR)configuration.h
|
$(BUILD_DIR)configuration.o : $(CONFIG_DIR)configuration.c $(CONFIG_DIR)configuration.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -24,11 +24,11 @@
|
||||||
#define CONNECTION_H_
|
#define CONNECTION_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <utils/identification.h>
|
#include <utils/identification.h>
|
||||||
#include <config/proposal.h>
|
#include <config/proposal.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
|
|
||||||
|
|
||||||
typedef enum auth_method_t auth_method_t;
|
typedef enum auth_method_t auth_method_t;
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#define CREDENTIAL_STORE_H_
|
#define CREDENTIAL_STORE_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <transforms/rsa/rsa_private_key.h>
|
#include <crypto/rsa/rsa_private_key.h>
|
||||||
#include <transforms/rsa/rsa_public_key.h>
|
#include <crypto/rsa/rsa_public_key.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct credential_store_t credential_store_t;
|
typedef struct credential_store_t credential_store_t;
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <utils/identification.h>
|
#include <utils/identification.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
#include <config/traffic_selector.h>
|
#include <config/traffic_selector.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define TRAFFIC_SELECTOR_H_
|
#define TRAFFIC_SELECTOR_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
|
|
||||||
typedef enum ts_type_t ts_type_t;
|
typedef enum ts_type_t ts_type_t;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,61 @@
|
||||||
#include <config/policy_store.h>
|
#include <config/policy_store.h>
|
||||||
#include <config/credential_store.h>
|
#include <config/credential_store.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mainpage
|
||||||
|
*
|
||||||
|
* @section Threading Architecture
|
||||||
|
*
|
||||||
|
* All IKEv2 stuff is handled in charon. It uses a newer and more flexible
|
||||||
|
* architecture than pluto. Charon uses a thread-pool, which allows parallel
|
||||||
|
* execution SA-management. Beside the thread-pool, there are some special purpose
|
||||||
|
* threads which do their job for the common health of the daemon.
|
||||||
|
@verbatim
|
||||||
|
+------+
|
||||||
|
| E Q |
|
||||||
|
| v u |---+ +------+ +------+
|
||||||
|
| e e | | | | | IKE- |
|
||||||
|
| n u | +-----------+ | |--| SA |
|
||||||
|
| t e | | | | I M | +------+
|
||||||
|
+------------+ | - | | Scheduler | | K a |
|
||||||
|
| receiver | +------+ | | | E n | +------+
|
||||||
|
+----+-------+ +-----------+ | - a | | IKE- |
|
||||||
|
| | +------+ | | S g |--| SA |
|
||||||
|
+-------+--+ +-----| J Q |---+ +------------+ | A e | +------+
|
||||||
|
-| socket | | o u | | | | - r |
|
||||||
|
+-------+--+ | b e | | Thread- | | |
|
||||||
|
| | - u | | Pool | | |
|
||||||
|
+----+-------+ | e |------| |---| |
|
||||||
|
| sender | +------+ +------------+ +------+
|
||||||
|
+----+-------+
|
||||||
|
| +------+
|
||||||
|
| | S Q |
|
||||||
|
| | e u |
|
||||||
|
| | n e |
|
||||||
|
+------------| d u |
|
||||||
|
| - e |
|
||||||
|
+--+---+
|
||||||
|
@endverbatim
|
||||||
|
* The thread-pool is the heart of the architecture. It processes jobs from a
|
||||||
|
* (fully synchronized) job-queue. Mostly, a job is associated with a specific
|
||||||
|
* IKE SA. These IKE SAs are synchronized, only one thread can work one an IKE SA.
|
||||||
|
* This makes it unnecesary to use further synchronisation methods once a IKE SA
|
||||||
|
* is checked out. The (rather complex) synchronization of IKE SAs is completely
|
||||||
|
* done in the IKE SA manager.
|
||||||
|
* The sceduler is responsible for event firing. It waits until a event in the
|
||||||
|
* (fully synchronized) event-queue is ready for processing and pushes the event
|
||||||
|
* down to the job-queue. A thread form the pool will pick it up as quick as
|
||||||
|
* possible. Every thread can queue events or jobs. Furter, an event can place a
|
||||||
|
* packet in the send-queue. The sender thread waits for those packets and sends
|
||||||
|
* them over the wire, via the socket. The receiver does exactly the opposite of
|
||||||
|
* the sender. It waits on the socket, reads in packets an places them on the
|
||||||
|
* job-queue for further processing by a thread from the pool.
|
||||||
|
* There are even more threads, not drawn in the upper scheme. The stroke thread
|
||||||
|
* is responsible for reading and processessing commands from another process. The
|
||||||
|
* kernel interface thread handles communication from and to the kernel via a
|
||||||
|
* netlink socket. It waits for kernel events and processes them appropriately.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the daemon.
|
* Name of the daemon.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,17 +12,17 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
ENCODING_DIR= $(MAIN_DIR)encoding/
|
ENCODING_DIR= $(CHARON_DIR)encoding/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)generator.o
|
CHARON_OBJS+= $(BUILD_DIR)generator.o
|
||||||
$(BUILD_DIR)generator.o : $(ENCODING_DIR)generator.c $(ENCODING_DIR)generator.h
|
$(BUILD_DIR)generator.o : $(ENCODING_DIR)generator.c $(ENCODING_DIR)generator.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)parser.o
|
CHARON_OBJS+= $(BUILD_DIR)parser.o
|
||||||
$(BUILD_DIR)parser.o : $(ENCODING_DIR)parser.c $(ENCODING_DIR)parser.h
|
$(BUILD_DIR)parser.o : $(ENCODING_DIR)parser.c $(ENCODING_DIR)parser.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)message.o
|
CHARON_OBJS+= $(BUILD_DIR)message.o
|
||||||
$(BUILD_DIR)message.o : $(ENCODING_DIR)message.c $(ENCODING_DIR)message.h
|
$(BUILD_DIR)message.o : $(ENCODING_DIR)message.c $(ENCODING_DIR)message.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include <encoding/payloads/ike_header.h>
|
#include <encoding/payloads/ike_header.h>
|
||||||
#include <encoding/payloads/notify_payload.h>
|
#include <encoding/payloads/notify_payload.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct message_t message_t;
|
typedef struct message_t message_t;
|
||||||
|
|
|
@ -14,95 +14,95 @@
|
||||||
|
|
||||||
PAYLOADS_DIR= $(ENCODING_DIR)payloads/
|
PAYLOADS_DIR= $(ENCODING_DIR)payloads/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)encodings.o
|
CHARON_OBJS+= $(BUILD_DIR)encodings.o
|
||||||
$(BUILD_DIR)encodings.o : $(PAYLOADS_DIR)encodings.c $(PAYLOADS_DIR)encodings.h
|
$(BUILD_DIR)encodings.o : $(PAYLOADS_DIR)encodings.c $(PAYLOADS_DIR)encodings.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_header.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_header.o
|
||||||
$(BUILD_DIR)ike_header.o : $(PAYLOADS_DIR)ike_header.c $(PAYLOADS_DIR)ike_header.h
|
$(BUILD_DIR)ike_header.o : $(PAYLOADS_DIR)ike_header.c $(PAYLOADS_DIR)ike_header.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ke_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)ke_payload.o
|
||||||
$(BUILD_DIR)ke_payload.o : $(PAYLOADS_DIR)ke_payload.c $(PAYLOADS_DIR)ke_payload.h
|
$(BUILD_DIR)ke_payload.o : $(PAYLOADS_DIR)ke_payload.c $(PAYLOADS_DIR)ke_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)nonce_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)nonce_payload.o
|
||||||
$(BUILD_DIR)nonce_payload.o : $(PAYLOADS_DIR)nonce_payload.c $(PAYLOADS_DIR)nonce_payload.h
|
$(BUILD_DIR)nonce_payload.o : $(PAYLOADS_DIR)nonce_payload.c $(PAYLOADS_DIR)nonce_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)notify_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)notify_payload.o
|
||||||
$(BUILD_DIR)notify_payload.o : $(PAYLOADS_DIR)notify_payload.c $(PAYLOADS_DIR)notify_payload.h
|
$(BUILD_DIR)notify_payload.o : $(PAYLOADS_DIR)notify_payload.c $(PAYLOADS_DIR)notify_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)id_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)id_payload.o
|
||||||
$(BUILD_DIR)id_payload.o : $(PAYLOADS_DIR)id_payload.c $(PAYLOADS_DIR)id_payload.h
|
$(BUILD_DIR)id_payload.o : $(PAYLOADS_DIR)id_payload.c $(PAYLOADS_DIR)id_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)auth_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)auth_payload.o
|
||||||
$(BUILD_DIR)auth_payload.o : $(PAYLOADS_DIR)auth_payload.c $(PAYLOADS_DIR)auth_payload.h
|
$(BUILD_DIR)auth_payload.o : $(PAYLOADS_DIR)auth_payload.c $(PAYLOADS_DIR)auth_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)cert_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)cert_payload.o
|
||||||
$(BUILD_DIR)cert_payload.o : $(PAYLOADS_DIR)cert_payload.c $(PAYLOADS_DIR)cert_payload.h
|
$(BUILD_DIR)cert_payload.o : $(PAYLOADS_DIR)cert_payload.c $(PAYLOADS_DIR)cert_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)certreq_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)certreq_payload.o
|
||||||
$(BUILD_DIR)certreq_payload.o : $(PAYLOADS_DIR)certreq_payload.c $(PAYLOADS_DIR)certreq_payload.h
|
$(BUILD_DIR)certreq_payload.o : $(PAYLOADS_DIR)certreq_payload.c $(PAYLOADS_DIR)certreq_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)delete_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)delete_payload.o
|
||||||
$(BUILD_DIR)delete_payload.o : $(PAYLOADS_DIR)delete_payload.c $(PAYLOADS_DIR)delete_payload.h
|
$(BUILD_DIR)delete_payload.o : $(PAYLOADS_DIR)delete_payload.c $(PAYLOADS_DIR)delete_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)vendor_id_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)vendor_id_payload.o
|
||||||
$(BUILD_DIR)vendor_id_payload.o : $(PAYLOADS_DIR)vendor_id_payload.c $(PAYLOADS_DIR)vendor_id_payload.h
|
$(BUILD_DIR)vendor_id_payload.o : $(PAYLOADS_DIR)vendor_id_payload.c $(PAYLOADS_DIR)vendor_id_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)cp_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)cp_payload.o
|
||||||
$(BUILD_DIR)cp_payload.o : $(PAYLOADS_DIR)cp_payload.c $(PAYLOADS_DIR)cp_payload.h
|
$(BUILD_DIR)cp_payload.o : $(PAYLOADS_DIR)cp_payload.c $(PAYLOADS_DIR)cp_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)configuration_attribute.o
|
CHARON_OBJS+= $(BUILD_DIR)configuration_attribute.o
|
||||||
$(BUILD_DIR)configuration_attribute.o : $(PAYLOADS_DIR)configuration_attribute.c $(PAYLOADS_DIR)configuration_attribute.h
|
$(BUILD_DIR)configuration_attribute.o : $(PAYLOADS_DIR)configuration_attribute.c $(PAYLOADS_DIR)configuration_attribute.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)eap_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)eap_payload.o
|
||||||
$(BUILD_DIR)eap_payload.o : $(PAYLOADS_DIR)eap_payload.c $(PAYLOADS_DIR)eap_payload.h
|
$(BUILD_DIR)eap_payload.o : $(PAYLOADS_DIR)eap_payload.c $(PAYLOADS_DIR)eap_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)unknown_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)unknown_payload.o
|
||||||
$(BUILD_DIR)unknown_payload.o : $(PAYLOADS_DIR)unknown_payload.c $(PAYLOADS_DIR)unknown_payload.h
|
$(BUILD_DIR)unknown_payload.o : $(PAYLOADS_DIR)unknown_payload.c $(PAYLOADS_DIR)unknown_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ts_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)ts_payload.o
|
||||||
$(BUILD_DIR)ts_payload.o : $(PAYLOADS_DIR)ts_payload.c $(PAYLOADS_DIR)ts_payload.h
|
$(BUILD_DIR)ts_payload.o : $(PAYLOADS_DIR)ts_payload.c $(PAYLOADS_DIR)ts_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)traffic_selector_substructure.o
|
CHARON_OBJS+= $(BUILD_DIR)traffic_selector_substructure.o
|
||||||
$(BUILD_DIR)traffic_selector_substructure.o : $(PAYLOADS_DIR)traffic_selector_substructure.c $(PAYLOADS_DIR)traffic_selector_substructure.h
|
$(BUILD_DIR)traffic_selector_substructure.o : $(PAYLOADS_DIR)traffic_selector_substructure.c $(PAYLOADS_DIR)traffic_selector_substructure.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)payload.o
|
CHARON_OBJS+= $(BUILD_DIR)payload.o
|
||||||
$(BUILD_DIR)payload.o : $(PAYLOADS_DIR)payload.c $(PAYLOADS_DIR)payload.h
|
$(BUILD_DIR)payload.o : $(PAYLOADS_DIR)payload.c $(PAYLOADS_DIR)payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)proposal_substructure.o
|
CHARON_OBJS+= $(BUILD_DIR)proposal_substructure.o
|
||||||
$(BUILD_DIR)proposal_substructure.o : $(PAYLOADS_DIR)proposal_substructure.c $(PAYLOADS_DIR)proposal_substructure.h
|
$(BUILD_DIR)proposal_substructure.o : $(PAYLOADS_DIR)proposal_substructure.c $(PAYLOADS_DIR)proposal_substructure.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)sa_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)sa_payload.o
|
||||||
$(BUILD_DIR)sa_payload.o : $(PAYLOADS_DIR)sa_payload.c $(PAYLOADS_DIR)sa_payload.h
|
$(BUILD_DIR)sa_payload.o : $(PAYLOADS_DIR)sa_payload.c $(PAYLOADS_DIR)sa_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)transform_attribute.o
|
CHARON_OBJS+= $(BUILD_DIR)transform_attribute.o
|
||||||
$(BUILD_DIR)transform_attribute.o : $(PAYLOADS_DIR)transform_attribute.c $(PAYLOADS_DIR)transform_attribute.h
|
$(BUILD_DIR)transform_attribute.o : $(PAYLOADS_DIR)transform_attribute.c $(PAYLOADS_DIR)transform_attribute.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)transform_substructure.o
|
CHARON_OBJS+= $(BUILD_DIR)transform_substructure.o
|
||||||
$(BUILD_DIR)transform_substructure.o : $(PAYLOADS_DIR)transform_substructure.c $(PAYLOADS_DIR)transform_substructure.h
|
$(BUILD_DIR)transform_substructure.o : $(PAYLOADS_DIR)transform_substructure.c $(PAYLOADS_DIR)transform_substructure.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)encryption_payload.o
|
CHARON_OBJS+= $(BUILD_DIR)encryption_payload.o
|
||||||
$(BUILD_DIR)encryption_payload.o : $(PAYLOADS_DIR)encryption_payload.c $(PAYLOADS_DIR)encryption_payload.h
|
$(BUILD_DIR)encryption_payload.o : $(PAYLOADS_DIR)encryption_payload.c $(PAYLOADS_DIR)encryption_payload.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <encoding/parser.h>
|
#include <encoding/parser.h>
|
||||||
#include <utils/iterator.h>
|
#include <utils/iterator.h>
|
||||||
#include <utils/randomizer.h>
|
#include <utils/randomizer.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,7 +294,12 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||||
/* build padding */
|
/* build padding */
|
||||||
block_size = this->crypter->get_block_size(this->crypter);
|
block_size = this->crypter->get_block_size(this->crypter);
|
||||||
padding.len = block_size - ((this->decrypted.len + 1) % block_size);
|
padding.len = block_size - ((this->decrypted.len + 1) % block_size);
|
||||||
randomizer->allocate_pseudo_random_bytes(randomizer, padding.len, &padding);
|
status = randomizer->allocate_pseudo_random_bytes(randomizer, padding.len, &padding);
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
randomizer->destroy(randomizer);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/* concatenate payload data, padding, padding len */
|
/* concatenate payload data, padding, padding len */
|
||||||
to_crypt.len = this->decrypted.len + padding.len + 1;
|
to_crypt.len = this->decrypted.len + padding.len + 1;
|
||||||
|
@ -306,8 +311,14 @@ static status_t encrypt(private_encryption_payload_t *this)
|
||||||
|
|
||||||
/* build iv */
|
/* build iv */
|
||||||
iv.len = block_size;
|
iv.len = block_size;
|
||||||
randomizer->allocate_pseudo_random_bytes(randomizer, iv.len, &iv);
|
status = randomizer->allocate_pseudo_random_bytes(randomizer, iv.len, &iv);
|
||||||
randomizer->destroy(randomizer);
|
randomizer->destroy(randomizer);
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
allocator_free_chunk(&to_crypt);
|
||||||
|
allocator_free_chunk(&padding);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before encryption with padding", to_crypt);
|
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before encryption with padding", to_crypt);
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#define ENCRYPTION_PAYLOAD_H_
|
#define ENCRYPTION_PAYLOAD_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <encoding/payloads/payload.h>
|
#include <encoding/payloads/payload.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <encoding/payloads/payload.h>
|
#include <encoding/payloads/payload.h>
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
#include <config/traffic_selector.h>
|
#include <config/traffic_selector.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
#include <encoding/payloads/payload.h>
|
#include <encoding/payloads/payload.h>
|
||||||
#include <encoding/payloads/transform_attribute.h>
|
#include <encoding/payloads/transform_attribute.h>
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <transforms/prfs/prf.h>
|
#include <crypto/prfs/prf.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <config/proposal.h>
|
#include <config/proposal.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,13 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
NETWORK_DIR= $(MAIN_DIR)network/
|
NETWORK_DIR= $(CHARON_DIR)network/
|
||||||
|
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)packet.o
|
CHARON_OBJS+= $(BUILD_DIR)packet.o
|
||||||
$(BUILD_DIR)packet.o : $(NETWORK_DIR)packet.c $(NETWORK_DIR)packet.h
|
$(BUILD_DIR)packet.o : $(NETWORK_DIR)packet.c $(NETWORK_DIR)packet.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)socket.o
|
CHARON_OBJS+= $(BUILD_DIR)socket.o
|
||||||
$(BUILD_DIR)socket.o : $(NETWORK_DIR)socket.c $(NETWORK_DIR)socket.h
|
$(BUILD_DIR)socket.o : $(NETWORK_DIR)socket.c $(NETWORK_DIR)socket.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)host.o
|
|
||||||
$(BUILD_DIR)host.o : $(NETWORK_DIR)host.c $(NETWORK_DIR)host.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct packet_t packet_t;
|
typedef struct packet_t packet_t;
|
||||||
|
|
|
@ -12,17 +12,17 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
QUEUES_DIR= $(MAIN_DIR)queues/
|
QUEUES_DIR= $(CHARON_DIR)queues/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)event_queue.o
|
CHARON_OBJS+= $(BUILD_DIR)event_queue.o
|
||||||
$(BUILD_DIR)event_queue.o : $(QUEUES_DIR)event_queue.c $(QUEUES_DIR)event_queue.h
|
$(BUILD_DIR)event_queue.o : $(QUEUES_DIR)event_queue.c $(QUEUES_DIR)event_queue.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)job_queue.o
|
CHARON_OBJS+= $(BUILD_DIR)job_queue.o
|
||||||
$(BUILD_DIR)job_queue.o : $(QUEUES_DIR)job_queue.c $(QUEUES_DIR)job_queue.h
|
$(BUILD_DIR)job_queue.o : $(QUEUES_DIR)job_queue.c $(QUEUES_DIR)job_queue.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)send_queue.o
|
CHARON_OBJS+= $(BUILD_DIR)send_queue.o
|
||||||
$(BUILD_DIR)send_queue.o : $(QUEUES_DIR)send_queue.c $(QUEUES_DIR)send_queue.h
|
$(BUILD_DIR)send_queue.o : $(QUEUES_DIR)send_queue.c $(QUEUES_DIR)send_queue.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -14,27 +14,27 @@
|
||||||
|
|
||||||
JOBS_DIR= $(QUEUES_DIR)jobs/
|
JOBS_DIR= $(QUEUES_DIR)jobs/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)delete_half_open_ike_sa_job.o
|
CHARON_OBJS+= $(BUILD_DIR)delete_half_open_ike_sa_job.o
|
||||||
$(BUILD_DIR)delete_half_open_ike_sa_job.o : $(JOBS_DIR)delete_half_open_ike_sa_job.c $(JOBS_DIR)delete_half_open_ike_sa_job.h
|
$(BUILD_DIR)delete_half_open_ike_sa_job.o : $(JOBS_DIR)delete_half_open_ike_sa_job.c $(JOBS_DIR)delete_half_open_ike_sa_job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)delete_established_ike_sa_job.o
|
CHARON_OBJS+= $(BUILD_DIR)delete_established_ike_sa_job.o
|
||||||
$(BUILD_DIR)delete_established_ike_sa_job.o : $(JOBS_DIR)delete_established_ike_sa_job.c $(JOBS_DIR)delete_established_ike_sa_job.h
|
$(BUILD_DIR)delete_established_ike_sa_job.o : $(JOBS_DIR)delete_established_ike_sa_job.c $(JOBS_DIR)delete_established_ike_sa_job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)incoming_packet_job.o
|
CHARON_OBJS+= $(BUILD_DIR)incoming_packet_job.o
|
||||||
$(BUILD_DIR)incoming_packet_job.o : $(JOBS_DIR)incoming_packet_job.c $(JOBS_DIR)incoming_packet_job.h
|
$(BUILD_DIR)incoming_packet_job.o : $(JOBS_DIR)incoming_packet_job.c $(JOBS_DIR)incoming_packet_job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)initiate_ike_sa_job.o
|
CHARON_OBJS+= $(BUILD_DIR)initiate_ike_sa_job.o
|
||||||
$(BUILD_DIR)initiate_ike_sa_job.o : $(JOBS_DIR)initiate_ike_sa_job.c $(JOBS_DIR)initiate_ike_sa_job.h
|
$(BUILD_DIR)initiate_ike_sa_job.o : $(JOBS_DIR)initiate_ike_sa_job.c $(JOBS_DIR)initiate_ike_sa_job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)retransmit_request_job.o
|
CHARON_OBJS+= $(BUILD_DIR)retransmit_request_job.o
|
||||||
$(BUILD_DIR)retransmit_request_job.o : $(JOBS_DIR)retransmit_request_job.c $(JOBS_DIR)retransmit_request_job.h
|
$(BUILD_DIR)retransmit_request_job.o : $(JOBS_DIR)retransmit_request_job.c $(JOBS_DIR)retransmit_request_job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)job.o
|
CHARON_OBJS+= $(BUILD_DIR)job.o
|
||||||
$(BUILD_DIR)job.o : $(JOBS_DIR)job.c $(JOBS_DIR)job.h
|
$(BUILD_DIR)job.o : $(JOBS_DIR)job.c $(JOBS_DIR)job.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
|
@ -12,25 +12,25 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
SA_DIR= $(MAIN_DIR)sa/
|
SA_DIR= $(CHARON_DIR)sa/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa_id.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa_id.o
|
||||||
$(BUILD_DIR)ike_sa_id.o : $(SA_DIR)ike_sa_id.c $(SA_DIR)ike_sa_id.h
|
$(BUILD_DIR)ike_sa_id.o : $(SA_DIR)ike_sa_id.c $(SA_DIR)ike_sa_id.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa_manager.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa_manager.o
|
||||||
$(BUILD_DIR)ike_sa_manager.o : $(SA_DIR)ike_sa_manager.c $(SA_DIR)ike_sa_manager.h
|
$(BUILD_DIR)ike_sa_manager.o : $(SA_DIR)ike_sa_manager.c $(SA_DIR)ike_sa_manager.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa.o
|
||||||
$(BUILD_DIR)ike_sa.o : $(SA_DIR)ike_sa.c $(SA_DIR)ike_sa.h
|
$(BUILD_DIR)ike_sa.o : $(SA_DIR)ike_sa.c $(SA_DIR)ike_sa.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)authenticator.o
|
CHARON_OBJS+= $(BUILD_DIR)authenticator.o
|
||||||
$(BUILD_DIR)authenticator.o : $(SA_DIR)authenticator.c $(SA_DIR)authenticator.h
|
$(BUILD_DIR)authenticator.o : $(SA_DIR)authenticator.c $(SA_DIR)authenticator.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)child_sa.o
|
CHARON_OBJS+= $(BUILD_DIR)child_sa.o
|
||||||
$(BUILD_DIR)child_sa.o : $(SA_DIR)child_sa.c $(SA_DIR)child_sa.h
|
$(BUILD_DIR)child_sa.o : $(SA_DIR)child_sa.c $(SA_DIR)child_sa.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#define CHILD_SA_H_
|
#define CHILD_SA_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <transforms/prf_plus.h>
|
#include <crypto/prf_plus.h>
|
||||||
#include <encoding/payloads/proposal_substructure.h>
|
#include <encoding/payloads/proposal_substructure.h>
|
||||||
|
|
||||||
typedef struct child_sa_t child_sa_t;
|
typedef struct child_sa_t child_sa_t;
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
#include <utils/linked_list.h>
|
#include <utils/linked_list.h>
|
||||||
#include <utils/logger_manager.h>
|
#include <utils/logger_manager.h>
|
||||||
#include <utils/randomizer.h>
|
#include <utils/randomizer.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
#include <transforms/prf_plus.h>
|
#include <crypto/prf_plus.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <encoding/payloads/sa_payload.h>
|
#include <encoding/payloads/sa_payload.h>
|
||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
#include <encoding/payloads/ke_payload.h>
|
#include <encoding/payloads/ke_payload.h>
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include <config/configuration.h>
|
#include <config/configuration.h>
|
||||||
#include <utils/logger.h>
|
#include <utils/logger.h>
|
||||||
#include <utils/randomizer.h>
|
#include <utils/randomizer.h>
|
||||||
#include <transforms/prfs/prf.h>
|
#include <crypto/prfs/prf.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <config/connection.h>
|
#include <config/connection.h>
|
||||||
#include <config/policy.h>
|
#include <config/policy.h>
|
||||||
|
|
||||||
|
|
|
@ -14,30 +14,30 @@
|
||||||
|
|
||||||
STATES_DIR= $(SA_DIR)states/
|
STATES_DIR= $(SA_DIR)states/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_auth_requested.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_auth_requested.o
|
||||||
$(BUILD_DIR)ike_auth_requested.o : $(STATES_DIR)ike_auth_requested.c $(STATES_DIR)ike_auth_requested.h
|
$(BUILD_DIR)ike_auth_requested.o : $(STATES_DIR)ike_auth_requested.c $(STATES_DIR)ike_auth_requested.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa_established.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa_established.o
|
||||||
$(BUILD_DIR)ike_sa_established.o : $(STATES_DIR)ike_sa_established.c $(STATES_DIR)ike_sa_established.h
|
$(BUILD_DIR)ike_sa_established.o : $(STATES_DIR)ike_sa_established.c $(STATES_DIR)ike_sa_established.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa_init_requested.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa_init_requested.o
|
||||||
$(BUILD_DIR)ike_sa_init_requested.o : $(STATES_DIR)ike_sa_init_requested.c $(STATES_DIR)ike_sa_init_requested.h
|
$(BUILD_DIR)ike_sa_init_requested.o : $(STATES_DIR)ike_sa_init_requested.c $(STATES_DIR)ike_sa_init_requested.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)ike_sa_init_responded.o
|
CHARON_OBJS+= $(BUILD_DIR)ike_sa_init_responded.o
|
||||||
$(BUILD_DIR)ike_sa_init_responded.o : $(STATES_DIR)ike_sa_init_responded.c $(STATES_DIR)ike_sa_init_responded.h
|
$(BUILD_DIR)ike_sa_init_responded.o : $(STATES_DIR)ike_sa_init_responded.c $(STATES_DIR)ike_sa_init_responded.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)initiator_init.o
|
CHARON_OBJS+= $(BUILD_DIR)initiator_init.o
|
||||||
$(BUILD_DIR)initiator_init.o : $(STATES_DIR)initiator_init.c $(STATES_DIR)initiator_init.h
|
$(BUILD_DIR)initiator_init.o : $(STATES_DIR)initiator_init.c $(STATES_DIR)initiator_init.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)responder_init.o
|
CHARON_OBJS+= $(BUILD_DIR)responder_init.o
|
||||||
$(BUILD_DIR)responder_init.o : $(STATES_DIR)responder_init.c $(STATES_DIR)responder_init.h
|
$(BUILD_DIR)responder_init.o : $(STATES_DIR)responder_init.c $(STATES_DIR)responder_init.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)state.o
|
CHARON_OBJS+= $(BUILD_DIR)state.o
|
||||||
$(BUILD_DIR)state.o : $(STATES_DIR)state.c $(STATES_DIR)state.h
|
$(BUILD_DIR)state.o : $(STATES_DIR)state.c $(STATES_DIR)state.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -29,8 +29,8 @@
|
||||||
#include <encoding/payloads/id_payload.h>
|
#include <encoding/payloads/id_payload.h>
|
||||||
#include <encoding/payloads/auth_payload.h>
|
#include <encoding/payloads/auth_payload.h>
|
||||||
#include <encoding/payloads/notify_payload.h>
|
#include <encoding/payloads/notify_payload.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <sa/states/ike_sa_established.h>
|
#include <sa/states/ike_sa_established.h>
|
||||||
#include <sa/authenticator.h>
|
#include <sa/authenticator.h>
|
||||||
#include <sa/child_sa.h>
|
#include <sa/child_sa.h>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <encoding/payloads/id_payload.h>
|
#include <encoding/payloads/id_payload.h>
|
||||||
#include <encoding/payloads/auth_payload.h>
|
#include <encoding/payloads/auth_payload.h>
|
||||||
#include <encoding/payloads/ts_payload.h>
|
#include <encoding/payloads/ts_payload.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
#include <sa/states/ike_auth_requested.h>
|
#include <sa/states/ike_auth_requested.h>
|
||||||
#include <sa/states/initiator_init.h>
|
#include <sa/states/initiator_init.h>
|
||||||
#include <sa/authenticator.h>
|
#include <sa/authenticator.h>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <sa/ike_sa.h>
|
#include <sa/ike_sa.h>
|
||||||
#include <sa/states/state.h>
|
#include <sa/states/state.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
|
|
||||||
typedef struct ike_sa_init_requested_t ike_sa_init_requested_t;
|
typedef struct ike_sa_init_requested_t ike_sa_init_requested_t;
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
#include <encoding/payloads/id_payload.h>
|
#include <encoding/payloads/id_payload.h>
|
||||||
#include <encoding/payloads/auth_payload.h>
|
#include <encoding/payloads/auth_payload.h>
|
||||||
#include <encoding/payloads/notify_payload.h>
|
#include <encoding/payloads/notify_payload.h>
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
#include <sa/states/ike_sa_established.h>
|
#include <sa/states/ike_sa_established.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <sa/states/ike_sa_init_requested.h>
|
#include <sa/states/ike_sa_init_requested.h>
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <queues/jobs/retransmit_request_job.h>
|
#include <queues/jobs/retransmit_request_job.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
#include <encoding/payloads/sa_payload.h>
|
#include <encoding/payloads/sa_payload.h>
|
||||||
#include <encoding/payloads/ke_payload.h>
|
#include <encoding/payloads/ke_payload.h>
|
||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
|
@ -92,7 +92,7 @@ struct private_initiator_init_t {
|
||||||
* @param this calling object
|
* @param this calling object
|
||||||
* @param request message_t object to add the NONCE payload
|
* @param request message_t object to add the NONCE payload
|
||||||
*/
|
*/
|
||||||
void (*build_nonce_payload) (private_initiator_init_t *this,message_t *request);
|
status_t (*build_nonce_payload) (private_initiator_init_t *this,message_t *request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy function called internally of this class after state change to state
|
* Destroy function called internally of this class after state change to state
|
||||||
|
@ -177,9 +177,14 @@ status_t retry_initiate_connection (private_initiator_init_t *this, diffie_hellm
|
||||||
this->build_ke_payload(this, message);
|
this->build_ke_payload(this, message);
|
||||||
|
|
||||||
/* build Nonce payload */
|
/* build Nonce payload */
|
||||||
this->build_nonce_payload(this,message);
|
status = this->build_nonce_payload(this, message);
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
this->logger->log(this->logger, ERROR, "Building nonce payload failed. Aborting");
|
||||||
|
message->destroy(message);
|
||||||
|
return DELETE_ME;
|
||||||
|
}
|
||||||
|
|
||||||
/* message can now be sent (must not be destroyed) */
|
/* message can now be sent (must not be destroyed) */
|
||||||
status = this->ike_sa->send_request(this->ike_sa, message);
|
status = this->ike_sa->send_request(this->ike_sa, message);
|
||||||
if (status != SUCCESS)
|
if (status != SUCCESS)
|
||||||
|
@ -251,17 +256,22 @@ static void build_ke_payload(private_initiator_init_t *this, message_t *request)
|
||||||
/**
|
/**
|
||||||
* Implementation of private_initiator_init_t.build_nonce_payload.
|
* Implementation of private_initiator_init_t.build_nonce_payload.
|
||||||
*/
|
*/
|
||||||
static void build_nonce_payload(private_initiator_init_t *this, message_t *request)
|
static status_t build_nonce_payload(private_initiator_init_t *this, message_t *request)
|
||||||
{
|
{
|
||||||
nonce_payload_t *nonce_payload;
|
nonce_payload_t *nonce_payload;
|
||||||
randomizer_t *randomizer;
|
randomizer_t *randomizer;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
this->logger->log(this->logger, CONTROL|LEVEL1, "Building NONCE payload");
|
this->logger->log(this->logger, CONTROL|LEVEL1, "Building NONCE payload");
|
||||||
|
|
||||||
this->logger->log(this->logger, CONTROL|LEVEL2, "Get pseudo random bytes for NONCE");
|
this->logger->log(this->logger, CONTROL|LEVEL2, "Get pseudo random bytes for NONCE");
|
||||||
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
|
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
|
||||||
|
|
||||||
randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
|
status = randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
this->logger->log(this->logger, RAW|LEVEL2, "Initiator NONCE",&(this->sent_nonce));
|
this->logger->log(this->logger, RAW|LEVEL2, "Initiator NONCE",&(this->sent_nonce));
|
||||||
|
|
||||||
|
@ -271,6 +281,7 @@ static void build_nonce_payload(private_initiator_init_t *this, message_t *reque
|
||||||
|
|
||||||
this->logger->log(this->logger, CONTROL|LEVEL2, "Add NONCE payload to message");
|
this->logger->log(this->logger, CONTROL|LEVEL2, "Add NONCE payload to message");
|
||||||
request->add_payload(request, (payload_t *) nonce_payload);
|
request->add_payload(request, (payload_t *) nonce_payload);
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <encoding/payloads/ke_payload.h>
|
#include <encoding/payloads/ke_payload.h>
|
||||||
#include <encoding/payloads/nonce_payload.h>
|
#include <encoding/payloads/nonce_payload.h>
|
||||||
#include <encoding/payloads/notify_payload.h>
|
#include <encoding/payloads/notify_payload.h>
|
||||||
#include <transforms/diffie_hellman.h>
|
#include <crypto/diffie_hellman.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct private_responder_init_t private_responder_init_t;
|
typedef struct private_responder_init_t private_responder_init_t;
|
||||||
|
@ -428,6 +428,7 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload
|
||||||
{
|
{
|
||||||
nonce_payload_t *nonce_payload;
|
nonce_payload_t *nonce_payload;
|
||||||
randomizer_t *randomizer;
|
randomizer_t *randomizer;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload");
|
this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload");
|
||||||
allocator_free(this->received_nonce.ptr);
|
allocator_free(this->received_nonce.ptr);
|
||||||
|
@ -439,7 +440,11 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload
|
||||||
this->logger->log(this->logger, CONTROL | LEVEL2, "Create new NONCE value.");
|
this->logger->log(this->logger, CONTROL | LEVEL2, "Create new NONCE value.");
|
||||||
|
|
||||||
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
|
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
|
||||||
randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
|
status = randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
this->logger->log(this->logger, CONTROL|LEVEL2, "Building NONCE payload");
|
this->logger->log(this->logger, CONTROL|LEVEL2, "Building NONCE payload");
|
||||||
nonce_payload = nonce_payload_create();
|
nonce_payload = nonce_payload_create();
|
||||||
|
|
|
@ -12,28 +12,28 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
THREADS_DIR= $(MAIN_DIR)threads/
|
THREADS_DIR= $(CHARON_DIR)threads/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)receiver.o
|
CHARON_OBJS+= $(BUILD_DIR)receiver.o
|
||||||
$(BUILD_DIR)receiver.o : $(THREADS_DIR)receiver.c $(THREADS_DIR)receiver.h
|
$(BUILD_DIR)receiver.o : $(THREADS_DIR)receiver.c $(THREADS_DIR)receiver.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)scheduler.o
|
CHARON_OBJS+= $(BUILD_DIR)scheduler.o
|
||||||
$(BUILD_DIR)scheduler.o : $(THREADS_DIR)scheduler.c $(THREADS_DIR)scheduler.h
|
$(BUILD_DIR)scheduler.o : $(THREADS_DIR)scheduler.c $(THREADS_DIR)scheduler.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)sender.o
|
CHARON_OBJS+= $(BUILD_DIR)sender.o
|
||||||
$(BUILD_DIR)sender.o : $(THREADS_DIR)sender.c $(THREADS_DIR)sender.h
|
$(BUILD_DIR)sender.o : $(THREADS_DIR)sender.c $(THREADS_DIR)sender.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)thread_pool.o
|
CHARON_OBJS+= $(BUILD_DIR)thread_pool.o
|
||||||
$(BUILD_DIR)thread_pool.o : $(THREADS_DIR)thread_pool.c $(THREADS_DIR)thread_pool.h
|
$(BUILD_DIR)thread_pool.o : $(THREADS_DIR)thread_pool.c $(THREADS_DIR)thread_pool.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)kernel_interface.o
|
CHARON_OBJS+= $(BUILD_DIR)kernel_interface.o
|
||||||
$(BUILD_DIR)kernel_interface.o :$(THREADS_DIR)kernel_interface.c $(THREADS_DIR)kernel_interface.h
|
$(BUILD_DIR)kernel_interface.o :$(THREADS_DIR)kernel_interface.c $(THREADS_DIR)kernel_interface.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)stroke_interface.o
|
CHARON_OBJS+= $(BUILD_DIR)stroke_interface.o
|
||||||
$(BUILD_DIR)stroke_interface.o :$(THREADS_DIR)stroke_interface.c $(THREADS_DIR)stroke_interface.h
|
$(BUILD_DIR)stroke_interface.o :$(THREADS_DIR)stroke_interface.c $(THREADS_DIR)stroke_interface.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <linux/xfrm.h>
|
#include <linux/xfrm.h>
|
||||||
|
|
||||||
#include <network/host.h>
|
#include <utils/host.h>
|
||||||
#include <encoding/payloads/proposal_substructure.h>
|
#include <encoding/payloads/proposal_substructure.h>
|
||||||
|
|
||||||
typedef struct kernel_interface_t kernel_interface_t;
|
typedef struct kernel_interface_t kernel_interface_t;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <stroke.h>
|
#include <stroke.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
#include <transforms/certificate.h>
|
#include <crypto/certificate.h>
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <queues/jobs/initiate_ike_sa_job.h>
|
#include <queues/jobs/initiate_ike_sa_job.h>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
Known bugs in charon
|
||||||
|
======================
|
||||||
|
|
||||||
|
- intiating the same connection twice makes trouble.
|
||||||
|
-
|
|
@ -19,9 +19,12 @@
|
||||||
+ stroke status
|
+ stroke status
|
||||||
|
|
||||||
- libx509
|
- libx509
|
||||||
- new charon build - libstrong?
|
+ new charon build - libstrong?
|
||||||
- transforms
|
+ transforms
|
||||||
- utils (plus host)
|
+ utils (plus host)
|
||||||
|
- doxygen fixes (two doxyfiles?)
|
||||||
|
- allocator cleanup (used in lib, charon and pluto(!))
|
||||||
|
- logger reimplementation? (one logger for lib, charon, pluto)
|
||||||
- integrate asn1 parser/oid (asn1/oid)
|
- integrate asn1 parser/oid (asn1/oid)
|
||||||
- integrate PEM loading (pem)
|
- integrate PEM loading (pem)
|
||||||
- ... (more to come, for sure)
|
- ... (more to come, for sure)
|
||||||
|
@ -38,4 +41,4 @@
|
||||||
|
|
||||||
- delete notify, when to send?
|
- delete notify, when to send?
|
||||||
- notifys on connection setup failure
|
- notifys on connection setup failure
|
||||||
- create child sa message
|
- create child sa message
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Copyright (C) 2006 Martin Willi
|
||||||
|
# Hochschule fuer Technik Rapperswil
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
# for more details.
|
||||||
|
#
|
||||||
|
|
||||||
|
LIB_DIR= $(MAIN_DIR)lib/
|
||||||
|
|
||||||
|
LIB_OBJS+= $(BUILD_DIR)types.o
|
||||||
|
$(BUILD_DIR)types.o : $(LIB_DIR)types.c $(LIB_DIR)types.h
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
LIB_OBJS+= $(BUILD_DIR)definitions.o
|
||||||
|
$(BUILD_DIR)definitions.o : $(LIB_DIR)definitions.c $(LIB_DIR)definitions.h
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
include $(MAIN_DIR)lib/crypto/Makefile.transforms
|
||||||
|
include $(MAIN_DIR)lib/utils/Makefile.utils
|
||||||
|
include $(MAIN_DIR)lib/asn1/Makefile.asn1
|
|
@ -12,13 +12,13 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
ASN1_DIR= $(MAIN_DIR)asn1/
|
ASN1_DIR= $(LIB_DIR)asn1/
|
||||||
|
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)asn1.o
|
LIB_OBJS+= $(BUILD_DIR)asn1.o
|
||||||
$(BUILD_DIR)asn1.o : $(ASN1_DIR)asn1.c $(ASN1_DIR)asn1.h
|
$(BUILD_DIR)asn1.o : $(ASN1_DIR)asn1.c $(ASN1_DIR)asn1.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)der_decoder.o
|
LIB_OBJS+= $(BUILD_DIR)der_decoder.o
|
||||||
$(BUILD_DIR)der_decoder.o : $(ASN1_DIR)der_decoder.c $(ASN1_DIR)der_decoder.h
|
$(BUILD_DIR)der_decoder.o : $(ASN1_DIR)der_decoder.c $(ASN1_DIR)der_decoder.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -480,6 +480,7 @@ status_t decode(private_der_decoder_t *this, chunk_t input, void *output)
|
||||||
*/
|
*/
|
||||||
static void destroy(private_der_decoder_t *this)
|
static void destroy(private_der_decoder_t *this)
|
||||||
{
|
{
|
||||||
|
this->logger->destroy(this->logger);
|
||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ der_decoder_t *der_decoder_create(asn1_rule_t *rules)
|
||||||
this->public.destroy = (void (*) (der_decoder_t*))destroy;
|
this->public.destroy = (void (*) (der_decoder_t*))destroy;
|
||||||
|
|
||||||
this->first_rule = rules;
|
this->first_rule = rules;
|
||||||
this->logger = charon->logger_manager->get_logger(charon->logger_manager, DER_DECODER);
|
this->logger = logger_create("[DERDC]", CONTROL, FALSE, NULL);
|
||||||
|
|
||||||
return &(this->public);
|
return &(this->public);
|
||||||
}
|
}
|
|
@ -48,9 +48,9 @@ struct private_der_encoder_t {
|
||||||
logger_t *logger;
|
logger_t *logger;
|
||||||
};
|
};
|
||||||
|
|
||||||
status_t read_hdr(private_der_encoder_t *this, chunk_t *data);
|
static status_t read_hdr(private_der_encoder_t *this, chunk_t *data);
|
||||||
|
|
||||||
status_t read_sequence(private_der_encoder_t *this, chunk_t data)
|
static status_t read_sequence(private_der_encoder_t *this, chunk_t data)
|
||||||
{
|
{
|
||||||
while (this->rule->type != ASN1_END)
|
while (this->rule->type != ASN1_END)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ status_t read_sequence(private_der_encoder_t *this, chunk_t data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t read_int(private_der_encoder_t *this, chunk_t data)
|
static status_t read_int(private_der_encoder_t *this, chunk_t data)
|
||||||
{
|
{
|
||||||
this->logger->log_chunk(this->logger, CONTROL|LEVEL2, "ASN1_INTEGER", data);
|
this->logger->log_chunk(this->logger, CONTROL|LEVEL2, "ASN1_INTEGER", data);
|
||||||
u_int *integ = (u_int*)((u_int8_t*)this->output + this->rule->data_offset);
|
u_int *integ = (u_int*)((u_int8_t*)this->output + this->rule->data_offset);
|
||||||
|
@ -73,7 +73,7 @@ status_t read_int(private_der_encoder_t *this, chunk_t data)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t read_mpz(private_der_encoder_t *this, chunk_t data)
|
static status_t read_mpz(private_der_encoder_t *this, chunk_t data)
|
||||||
{
|
{
|
||||||
this->logger->log_chunk(this->logger, CONTROL|LEVEL2, "ASN1_INTEGER as mpz", data);
|
this->logger->log_chunk(this->logger, CONTROL|LEVEL2, "ASN1_INTEGER as mpz", data);
|
||||||
mpz_t *mpz = (mpz_t*)((u_int8_t*)this->output + this->rule->data_offset);
|
mpz_t *mpz = (mpz_t*)((u_int8_t*)this->output + this->rule->data_offset);
|
||||||
|
@ -82,7 +82,7 @@ status_t read_mpz(private_der_encoder_t *this, chunk_t data)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t read_length(chunk_t *data)
|
static u_int32_t read_length(chunk_t *data)
|
||||||
{
|
{
|
||||||
u_int8_t n;
|
u_int8_t n;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -119,7 +119,7 @@ u_int32_t read_length(chunk_t *data)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t read_hdr(private_der_encoder_t *this, chunk_t *data)
|
static status_t read_hdr(private_der_encoder_t *this, chunk_t *data)
|
||||||
{
|
{
|
||||||
chunk_t inner;
|
chunk_t inner;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ status_t read_hdr(private_der_encoder_t *this, chunk_t *data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
status_t decode(private_der_encoder_t *this, chunk_t input, void *output)
|
static status_t decode(private_der_encoder_t *this, chunk_t input, void *output)
|
||||||
{
|
{
|
||||||
this->rule = this->first_rule - 1;
|
this->rule = this->first_rule - 1;
|
||||||
this->output = output;
|
this->output = output;
|
|
@ -12,26 +12,26 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
TRANSFORMS_DIR= $(MAIN_DIR)transforms/
|
CRYPTO_DIR= $(LIB_DIR)crypto/
|
||||||
|
|
||||||
include $(TRANSFORMS_DIR)crypters/Makefile.crypters
|
include $(CRYPTO_DIR)crypters/Makefile.crypters
|
||||||
include $(TRANSFORMS_DIR)hashers/Makefile.hashers
|
include $(CRYPTO_DIR)hashers/Makefile.hashers
|
||||||
include $(TRANSFORMS_DIR)prfs/Makefile.prfs
|
include $(CRYPTO_DIR)prfs/Makefile.prfs
|
||||||
include $(TRANSFORMS_DIR)signers/Makefile.signers
|
include $(CRYPTO_DIR)signers/Makefile.signers
|
||||||
include $(TRANSFORMS_DIR)rsa/Makefile.rsa
|
include $(CRYPTO_DIR)rsa/Makefile.rsa
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)diffie_hellman.o
|
LIB_OBJS+= $(BUILD_DIR)diffie_hellman.o
|
||||||
$(BUILD_DIR)diffie_hellman.o : $(TRANSFORMS_DIR)diffie_hellman.c $(TRANSFORMS_DIR)diffie_hellman.h
|
$(BUILD_DIR)diffie_hellman.o : $(CRYPTO_DIR)diffie_hellman.c $(CRYPTO_DIR)diffie_hellman.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)hmac.o
|
LIB_OBJS+= $(BUILD_DIR)hmac.o
|
||||||
$(BUILD_DIR)hmac.o : $(TRANSFORMS_DIR)hmac.c $(TRANSFORMS_DIR)hmac.h
|
$(BUILD_DIR)hmac.o : $(CRYPTO_DIR)hmac.c $(CRYPTO_DIR)hmac.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)prf_plus.o
|
LIB_OBJS+= $(BUILD_DIR)prf_plus.o
|
||||||
$(BUILD_DIR)prf_plus.o : $(TRANSFORMS_DIR)prf_plus.c $(TRANSFORMS_DIR)prf_plus.h
|
$(BUILD_DIR)prf_plus.o : $(CRYPTO_DIR)prf_plus.c $(CRYPTO_DIR)prf_plus.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)certificate.o
|
LIB_OBJS+= $(BUILD_DIR)certificate.o
|
||||||
$(BUILD_DIR)certificate.o : $(TRANSFORMS_DIR)certificate.c $(TRANSFORMS_DIR)certificate.h
|
$(BUILD_DIR)certificate.o : $(CRYPTO_DIR)certificate.c $(CRYPTO_DIR)certificate.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <definitions.h>
|
#include <definitions.h>
|
||||||
#include <transforms/rsa/rsa_public_key.h>
|
#include <crypto/rsa/rsa_public_key.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct certificate_t certificate_t;
|
typedef struct certificate_t certificate_t;
|
|
@ -12,12 +12,12 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
CRYPTERS_DIR= $(TRANSFORMS_DIR)crypters/
|
CRYPTERS_DIR= $(CRYPTO_DIR)crypters/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)crypter.o
|
LIB_OBJS+= $(BUILD_DIR)crypter.o
|
||||||
$(BUILD_DIR)crypter.o : $(CRYPTERS_DIR)crypter.c $(CRYPTERS_DIR)crypter.h
|
$(BUILD_DIR)crypter.o : $(CRYPTERS_DIR)crypter.c $(CRYPTERS_DIR)crypter.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)aes_cbc_crypter.o
|
LIB_OBJS+= $(BUILD_DIR)aes_cbc_crypter.o
|
||||||
$(BUILD_DIR)aes_cbc_crypter.o : $(CRYPTERS_DIR)aes_cbc_crypter.c $(CRYPTERS_DIR)aes_cbc_crypter.h
|
$(BUILD_DIR)aes_cbc_crypter.o : $(CRYPTERS_DIR)aes_cbc_crypter.c $(CRYPTERS_DIR)aes_cbc_crypter.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -24,7 +24,7 @@
|
||||||
#ifndef AES_CBC_CRYPTER_H_
|
#ifndef AES_CBC_CRYPTER_H_
|
||||||
#define AES_CBC_CRYPTER_H_
|
#define AES_CBC_CRYPTER_H_
|
||||||
|
|
||||||
#include <transforms/crypters/crypter.h>
|
#include <crypto/crypters/crypter.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct aes_cbc_crypter_t aes_cbc_crypter_t;
|
typedef struct aes_cbc_crypter_t aes_cbc_crypter_t;
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "crypter.h"
|
#include "crypter.h"
|
||||||
|
|
||||||
#include <transforms/crypters/aes_cbc_crypter.h>
|
#include <crypto/crypters/aes_cbc_crypter.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -596,7 +596,12 @@ diffie_hellman_t *diffie_hellman_create(diffie_hellman_group_t dh_group_number)
|
||||||
allocator_free(this);
|
allocator_free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
randomizer->allocate_pseudo_random_bytes(randomizer, this->modulus_length, &random_bytes);
|
if (randomizer->allocate_pseudo_random_bytes(randomizer, this->modulus_length, &random_bytes) != SUCCESS)
|
||||||
|
{
|
||||||
|
randomizer->destroy(randomizer);
|
||||||
|
allocator_free(this);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
mpz_import(this->my_private_value, random_bytes.len, 1, 1, 1, 0, random_bytes.ptr);
|
mpz_import(this->my_private_value, random_bytes.len, 1, 1, 1, 0, random_bytes.ptr);
|
||||||
allocator_free_chunk(&random_bytes);
|
allocator_free_chunk(&random_bytes);
|
|
@ -12,16 +12,16 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
HASHERS_DIR= $(TRANSFORMS_DIR)hashers/
|
HASHERS_DIR= $(CRYPTO_DIR)hashers/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)hasher.o
|
LIB_OBJS+= $(BUILD_DIR)hasher.o
|
||||||
$(BUILD_DIR)hasher.o : $(HASHERS_DIR)hasher.c $(HASHERS_DIR)hasher.h
|
$(BUILD_DIR)hasher.o : $(HASHERS_DIR)hasher.c $(HASHERS_DIR)hasher.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)sha1_hasher.o
|
LIB_OBJS+= $(BUILD_DIR)sha1_hasher.o
|
||||||
$(BUILD_DIR)sha1_hasher.o : $(HASHERS_DIR)sha1_hasher.c $(HASHERS_DIR)sha1_hasher.h
|
$(BUILD_DIR)sha1_hasher.o : $(HASHERS_DIR)sha1_hasher.c $(HASHERS_DIR)sha1_hasher.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)md5_hasher.o
|
LIB_OBJS+= $(BUILD_DIR)md5_hasher.o
|
||||||
$(BUILD_DIR)md5_hasher.o : $(HASHERS_DIR)md5_hasher.c $(HASHERS_DIR)md5_hasher.h
|
$(BUILD_DIR)md5_hasher.o : $(HASHERS_DIR)md5_hasher.c $(HASHERS_DIR)md5_hasher.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
#include "hasher.h"
|
#include "hasher.h"
|
||||||
|
|
||||||
#include <transforms/hashers/sha1_hasher.h>
|
#include <crypto/hashers/sha1_hasher.h>
|
||||||
#include <transforms/hashers/md5_hasher.h>
|
#include <crypto/hashers/md5_hasher.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String mappings for hash_algorithm_t.
|
* String mappings for hash_algorithm_t.
|
|
@ -23,7 +23,7 @@
|
||||||
#ifndef MD5_HASHER_H_
|
#ifndef MD5_HASHER_H_
|
||||||
#define MD5_HASHER_H_
|
#define MD5_HASHER_H_
|
||||||
|
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct md5_hasher_t md5_hasher_t;
|
typedef struct md5_hasher_t md5_hasher_t;
|
|
@ -23,7 +23,7 @@
|
||||||
#ifndef SHA1_HASHER_H_
|
#ifndef SHA1_HASHER_H_
|
||||||
#define SHA1_HASHER_H_
|
#define SHA1_HASHER_H_
|
||||||
|
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct sha1_hasher_t sha1_hasher_t;
|
typedef struct sha1_hasher_t sha1_hasher_t;
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef HMAC_H_
|
#ifndef HMAC_H_
|
||||||
#define HMAC_H_
|
#define HMAC_H_
|
||||||
|
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
#include <definitions.h>
|
#include <definitions.h>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define PRF_PLUS_H_
|
#define PRF_PLUS_H_
|
||||||
|
|
||||||
|
|
||||||
#include <transforms/prfs/prf.h>
|
#include <crypto/prfs/prf.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct prf_plus_t prf_plus_t;
|
typedef struct prf_plus_t prf_plus_t;
|
|
@ -12,12 +12,12 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
PRFS_DIR= $(TRANSFORMS_DIR)prfs/
|
PRFS_DIR= $(CRYPTO_DIR)prfs/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)prf.o
|
LIB_OBJS+= $(BUILD_DIR)prf.o
|
||||||
$(BUILD_DIR)prf.o : $(PRFS_DIR)prf.c $(PRFS_DIR)prf.h
|
$(BUILD_DIR)prf.o : $(PRFS_DIR)prf.c $(PRFS_DIR)prf.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)hmac_prf.o
|
LIB_OBJS+= $(BUILD_DIR)hmac_prf.o
|
||||||
$(BUILD_DIR)hmac_prf.o : $(PRFS_DIR)hmac_prf.c $(PRFS_DIR)hmac_prf.h
|
$(BUILD_DIR)hmac_prf.o : $(PRFS_DIR)hmac_prf.c $(PRFS_DIR)hmac_prf.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -23,7 +23,7 @@
|
||||||
#include "hmac_prf.h"
|
#include "hmac_prf.h"
|
||||||
|
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <transforms/hmac.h>
|
#include <crypto/hmac.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct private_hmac_prf_t private_hmac_prf_t;
|
typedef struct private_hmac_prf_t private_hmac_prf_t;
|
|
@ -24,8 +24,8 @@
|
||||||
#define PRF_HMAC_H_
|
#define PRF_HMAC_H_
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <transforms/prfs/prf.h>
|
#include <crypto/prfs/prf.h>
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
typedef struct hmac_prf_t hmac_prf_t;
|
typedef struct hmac_prf_t hmac_prf_t;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
#include "prf.h"
|
#include "prf.h"
|
||||||
|
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
#include <transforms/prfs/hmac_prf.h>
|
#include <crypto/prfs/hmac_prf.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -12,12 +12,12 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
RSA_DIR= $(TRANSFORMS_DIR)rsa/
|
RSA_DIR= $(CRYPTO_DIR)rsa/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)rsa_private_key.o
|
LIB_OBJS+= $(BUILD_DIR)rsa_private_key.o
|
||||||
$(BUILD_DIR)rsa_private_key.o : $(RSA_DIR)rsa_private_key.c $(RSA_DIR)rsa_private_key.h
|
$(BUILD_DIR)rsa_private_key.o : $(RSA_DIR)rsa_private_key.c $(RSA_DIR)rsa_private_key.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)rsa_public_key.o
|
LIB_OBJS+= $(BUILD_DIR)rsa_public_key.o
|
||||||
$(BUILD_DIR)rsa_public_key.o : $(RSA_DIR)rsa_public_key.c $(RSA_DIR)rsa_public_key.h
|
$(BUILD_DIR)rsa_public_key.o : $(RSA_DIR)rsa_public_key.c $(RSA_DIR)rsa_public_key.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -134,7 +134,7 @@ struct private_rsa_private_key_t {
|
||||||
* @param prime_size size of the prime, in bytes
|
* @param prime_size size of the prime, in bytes
|
||||||
* @param[out] prime uninitialized mpz
|
* @param[out] prime uninitialized mpz
|
||||||
*/
|
*/
|
||||||
void (*compute_prime) (private_rsa_private_key_t *this, size_t prime_size, mpz_t *prime);
|
status_t (*compute_prime) (private_rsa_private_key_t *this, size_t prime_size, mpz_t *prime);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -160,17 +160,24 @@ static private_rsa_private_key_t *rsa_private_key_create_empty();
|
||||||
/**
|
/**
|
||||||
* Implementation of private_rsa_private_key_t.compute_prime.
|
* Implementation of private_rsa_private_key_t.compute_prime.
|
||||||
*/
|
*/
|
||||||
static void compute_prime(private_rsa_private_key_t *this, size_t prime_size, mpz_t *prime)
|
static status_t compute_prime(private_rsa_private_key_t *this, size_t prime_size, mpz_t *prime)
|
||||||
{
|
{
|
||||||
randomizer_t *randomizer;
|
randomizer_t *randomizer;
|
||||||
chunk_t random_bytes;
|
chunk_t random_bytes;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
randomizer = randomizer_create();
|
randomizer = randomizer_create();
|
||||||
mpz_init(*prime);
|
mpz_init(*prime);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
randomizer->allocate_random_bytes(randomizer, prime_size, &random_bytes);
|
status = randomizer->allocate_random_bytes(randomizer, prime_size, &random_bytes);
|
||||||
|
if (status != SUCCESS)
|
||||||
|
{
|
||||||
|
randomizer->destroy(randomizer);
|
||||||
|
mpz_clear(*prime);
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
/* make sure most significant bit is set */
|
/* make sure most significant bit is set */
|
||||||
random_bytes.ptr[0] = random_bytes.ptr[0] | 0x80;
|
random_bytes.ptr[0] = random_bytes.ptr[0] | 0x80;
|
||||||
|
@ -187,6 +194,7 @@ static void compute_prime(private_rsa_private_key_t *this, size_t prime_size, mp
|
||||||
while (((mpz_sizeinbase(*prime, 2) + 7) / 8) > prime_size);
|
while (((mpz_sizeinbase(*prime, 2) + 7) / 8) > prime_size);
|
||||||
|
|
||||||
randomizer->destroy(randomizer);
|
randomizer->destroy(randomizer);
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -382,7 +390,7 @@ rsa_public_key_t *get_public_key(private_rsa_private_key_t *this)
|
||||||
/**
|
/**
|
||||||
* Implementation of rsa_private_key.belongs_to.
|
* Implementation of rsa_private_key.belongs_to.
|
||||||
*/
|
*/
|
||||||
bool belongs_to(private_rsa_private_key_t *this, rsa_public_key_t *public)
|
static bool belongs_to(private_rsa_private_key_t *this, rsa_public_key_t *public)
|
||||||
{
|
{
|
||||||
if (mpz_cmp(this->n, *public->get_modulus(public)) == 0)
|
if (mpz_cmp(this->n, *public->get_modulus(public)) == 0)
|
||||||
{
|
{
|
||||||
|
@ -461,9 +469,22 @@ rsa_private_key_t *rsa_private_key_create(size_t key_size)
|
||||||
private_rsa_private_key_t *this;
|
private_rsa_private_key_t *this;
|
||||||
|
|
||||||
this = rsa_private_key_create_empty();
|
this = rsa_private_key_create_empty();
|
||||||
|
|
||||||
key_size = key_size / 8;
|
key_size = key_size / 8;
|
||||||
|
|
||||||
|
/* Get values of primes p and q */
|
||||||
|
if (this->compute_prime(this, key_size/2, &p) != SUCCESS)
|
||||||
|
{
|
||||||
|
allocator_free(this);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (this->compute_prime(this, key_size/2, &q) != SUCCESS)
|
||||||
|
{
|
||||||
|
mpz_clear(p);
|
||||||
|
allocator_free(this);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mpz_init(t);
|
mpz_init(t);
|
||||||
mpz_init(n);
|
mpz_init(n);
|
||||||
mpz_init(d);
|
mpz_init(d);
|
||||||
|
@ -471,9 +492,6 @@ rsa_private_key_t *rsa_private_key_create(size_t key_size)
|
||||||
mpz_init(exp2);
|
mpz_init(exp2);
|
||||||
mpz_init(coeff);
|
mpz_init(coeff);
|
||||||
|
|
||||||
/* Get values of primes p and q */
|
|
||||||
this->compute_prime(this, key_size/2, &p);
|
|
||||||
this->compute_prime(this, key_size/2, &q);
|
|
||||||
|
|
||||||
/* Swapping Primes so p is larger then q */
|
/* Swapping Primes so p is larger then q */
|
||||||
if (mpz_cmp(p, q) < 0)
|
if (mpz_cmp(p, q) < 0)
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <definitions.h>
|
#include <definitions.h>
|
||||||
#include <transforms/rsa/rsa_public_key.h>
|
#include <crypto/rsa/rsa_public_key.h>
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct rsa_private_key_t rsa_private_key_t;
|
typedef struct rsa_private_key_t rsa_private_key_t;
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
#include <asn1/der_decoder.h>
|
#include <asn1/der_decoder.h>
|
||||||
|
|
||||||
/*
|
/*
|
|
@ -12,12 +12,12 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
SIGNERS_DIR= $(TRANSFORMS_DIR)signers/
|
SIGNERS_DIR= $(CRYPTO_DIR)signers/
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)signer.o
|
LIB_OBJS+= $(BUILD_DIR)signer.o
|
||||||
$(BUILD_DIR)signer.o : $(SIGNERS_DIR)signer.c $(SIGNERS_DIR)signer.h
|
$(BUILD_DIR)signer.o : $(SIGNERS_DIR)signer.c $(SIGNERS_DIR)signer.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)hmac_signer.o
|
LIB_OBJS+= $(BUILD_DIR)hmac_signer.o
|
||||||
$(BUILD_DIR)hmac_signer.o : $(SIGNERS_DIR)hmac_signer.c $(SIGNERS_DIR)hmac_signer.h
|
$(BUILD_DIR)hmac_signer.o : $(SIGNERS_DIR)hmac_signer.c $(SIGNERS_DIR)hmac_signer.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -23,7 +23,7 @@
|
||||||
#include "hmac_signer.h"
|
#include "hmac_signer.h"
|
||||||
|
|
||||||
#include <utils/allocator.h>
|
#include <utils/allocator.h>
|
||||||
#include <transforms/prfs/hmac_prf.h>
|
#include <crypto/prfs/hmac_prf.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a hmac signer with 12 byte (96 bit) output.
|
* This class represents a hmac signer with 12 byte (96 bit) output.
|
|
@ -23,8 +23,8 @@
|
||||||
#ifndef HMAC_SIGNER_H_
|
#ifndef HMAC_SIGNER_H_
|
||||||
#define HMAC_SIGNER_H_
|
#define HMAC_SIGNER_H_
|
||||||
|
|
||||||
#include <transforms/signers/signer.h>
|
#include <crypto/signers/signer.h>
|
||||||
#include <transforms/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
typedef struct hmac_signer_t hmac_signer_t;
|
typedef struct hmac_signer_t hmac_signer_t;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "signer.h"
|
#include "signer.h"
|
||||||
|
|
||||||
#include <transforms/signers/hmac_signer.h>
|
#include <crypto/signers/hmac_signer.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String mappings for integrity_algorithm_t.
|
* String mappings for integrity_algorithm_t.
|
|
@ -59,60 +59,7 @@
|
||||||
#error "BYTE_ORDER must be defined"
|
#error "BYTE_ORDER must be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @mainpage
|
|
||||||
*
|
|
||||||
* @section Threading Architecture
|
|
||||||
*
|
|
||||||
* All IKEv2 stuff is handled in charon. It uses a newer and more flexible
|
|
||||||
* architecture than pluto. Charon uses a thread-pool, which allows parallel
|
|
||||||
* execution SA-management. Beside the thread-pool, there are some special purpose
|
|
||||||
* threads which do their job for the common health of the daemon.
|
|
||||||
@verbatim
|
|
||||||
+------+
|
|
||||||
| E Q |
|
|
||||||
| v u |---+ +------+ +------+
|
|
||||||
| e e | | | | | IKE- |
|
|
||||||
| n u | +-----------+ | |--| SA |
|
|
||||||
| t e | | | | I M | +------+
|
|
||||||
+------------+ | - | | Scheduler | | K a |
|
|
||||||
| receiver | +------+ | | | E n | +------+
|
|
||||||
+----+-------+ +-----------+ | - a | | IKE- |
|
|
||||||
| | +------+ | | S g |--| SA |
|
|
||||||
+-------+--+ +-----| J Q |---+ +------------+ | A e | +------+
|
|
||||||
-| socket | | o u | | | | - r |
|
|
||||||
+-------+--+ | b e | | Thread- | | |
|
|
||||||
| | - u | | Pool | | |
|
|
||||||
+----+-------+ | e |------| |---| |
|
|
||||||
| sender | +------+ +------------+ +------+
|
|
||||||
+----+-------+
|
|
||||||
| +------+
|
|
||||||
| | S Q |
|
|
||||||
| | e u |
|
|
||||||
| | n e |
|
|
||||||
+------------| d u |
|
|
||||||
| - e |
|
|
||||||
+--+---+
|
|
||||||
@endverbatim
|
|
||||||
* The thread-pool is the heart of the architecture. It processes jobs from a
|
|
||||||
* (fully synchronized) job-queue. Mostly, a job is associated with a specific
|
|
||||||
* IKE SA. These IKE SAs are synchronized, only one thread can work one an IKE SA.
|
|
||||||
* This makes it unnecesary to use further synchronisation methods once a IKE SA
|
|
||||||
* is checked out. The (rather complex) synchronization of IKE SAs is completely
|
|
||||||
* done in the IKE SA manager.
|
|
||||||
* The sceduler is responsible for event firing. It waits until a event in the
|
|
||||||
* (fully synchronized) event-queue is ready for processing and pushes the event
|
|
||||||
* down to the job-queue. A thread form the pool will pick it up as quick as
|
|
||||||
* possible. Every thread can queue events or jobs. Furter, an event can place a
|
|
||||||
* packet in the send-queue. The sender thread waits for those packets and sends
|
|
||||||
* them over the wire, via the socket. The receiver does exactly the opposite of
|
|
||||||
* the sender. It waits on the socket, reads in packets an places them on the
|
|
||||||
* job-queue for further processing by a thread from the pool.
|
|
||||||
* There are even more threads, not drawn in the upper scheme. The stroke thread
|
|
||||||
* is responsible for reading and processessing commands from another process. The
|
|
||||||
* kernel interface thread handles communication from and to the kernel via a
|
|
||||||
* netlink socket. It waits for kernel events and processes them appropriately.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup config config
|
* @defgroup config config
|
|
@ -12,33 +12,37 @@
|
||||||
# for more details.
|
# for more details.
|
||||||
#
|
#
|
||||||
|
|
||||||
UTILS_DIR= $(MAIN_DIR)utils/
|
UTILS_DIR= $(LIB_DIR)utils/
|
||||||
|
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)allocator.o
|
LIB_OBJS+= $(BUILD_DIR)allocator.o
|
||||||
$(BUILD_DIR)allocator.o : $(UTILS_DIR)allocator.c $(UTILS_DIR)allocator.h
|
$(BUILD_DIR)allocator.o : $(UTILS_DIR)allocator.c $(UTILS_DIR)allocator.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)linked_list.o
|
LIB_OBJS+= $(BUILD_DIR)linked_list.o
|
||||||
$(BUILD_DIR)linked_list.o : $(UTILS_DIR)linked_list.c $(UTILS_DIR)linked_list.h
|
$(BUILD_DIR)linked_list.o : $(UTILS_DIR)linked_list.c $(UTILS_DIR)linked_list.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)logger.o
|
LIB_OBJS+= $(BUILD_DIR)logger.o
|
||||||
$(BUILD_DIR)logger.o : $(UTILS_DIR)logger.c $(UTILS_DIR)logger.h
|
$(BUILD_DIR)logger.o : $(UTILS_DIR)logger.c $(UTILS_DIR)logger.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)logger_manager.o
|
LIB_OBJS+= $(BUILD_DIR)logger_manager.o
|
||||||
$(BUILD_DIR)logger_manager.o : $(UTILS_DIR)logger_manager.c $(UTILS_DIR)logger_manager.h
|
$(BUILD_DIR)logger_manager.o : $(UTILS_DIR)logger_manager.c $(UTILS_DIR)logger_manager.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)randomizer.o
|
LIB_OBJS+= $(BUILD_DIR)randomizer.o
|
||||||
$(BUILD_DIR)randomizer.o : $(UTILS_DIR)randomizer.c $(UTILS_DIR)randomizer.h
|
$(BUILD_DIR)randomizer.o : $(UTILS_DIR)randomizer.c $(UTILS_DIR)randomizer.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)tester.o
|
LIB_OBJS+= $(BUILD_DIR)tester.o
|
||||||
$(BUILD_DIR)tester.o : $(UTILS_DIR)tester.c $(UTILS_DIR)tester.h
|
$(BUILD_DIR)tester.o : $(UTILS_DIR)tester.c $(UTILS_DIR)tester.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
OBJS+= $(BUILD_DIR)identification.o
|
LIB_OBJS+= $(BUILD_DIR)identification.o
|
||||||
$(BUILD_DIR)identification.o : $(UTILS_DIR)identification.c $(UTILS_DIR)identification.h
|
$(BUILD_DIR)identification.o : $(UTILS_DIR)identification.c $(UTILS_DIR)identification.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
LIB_OBJS+= $(BUILD_DIR)host.o
|
||||||
|
$(BUILD_DIR)host.o : $(UTILS_DIR)host.c $(UTILS_DIR)host.h
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
@ -335,7 +335,7 @@ static void insert_before(private_iterator_t * iterator, void *item)
|
||||||
/**
|
/**
|
||||||
* Implementation of iterator_t.replace.
|
* Implementation of iterator_t.replace.
|
||||||
*/
|
*/
|
||||||
status_t replace (private_iterator_t *this, void **old_item, void *new_item)
|
static status_t replace (private_iterator_t *this, void **old_item, void *new_item)
|
||||||
{
|
{
|
||||||
if (this->current == NULL)
|
if (this->current == NULL)
|
||||||
{
|
{
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue