aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-04-05 12:10:50 +0000
committerMartin Willi <martin@strongswan.org>2006-04-05 12:10:50 +0000
commit6862128151fb78f63685a8da5575783c426d64a7 (patch)
tree75920a6688ed5654fb917ecccc1e0e469480fd1f /Source
parent3dbbbf3e16366b0da33b29bbc1a4ba9a976e43a0 (diff)
downloadstrongswan-6862128151fb78f63685a8da5575783c426d64a7.tar.bz2
strongswan-6862128151fb78f63685a8da5575783c426d64a7.tar.xz
../svn-commit.tmp
Diffstat (limited to 'Source')
-rw-r--r--Source/Doxyfile (renamed from Source/charon/Doxyfile)0
-rw-r--r--Source/Makefile88
-rw-r--r--Source/charon.kdevelop102
-rw-r--r--Source/charon/Makefile100
-rw-r--r--Source/charon/Makefile.charon25
-rw-r--r--Source/charon/charon-support.patch867
-rw-r--r--Source/charon/config/Makefile.config12
-rw-r--r--Source/charon/config/connection.h4
-rwxr-xr-xSource/charon/config/credential_store.h4
-rw-r--r--Source/charon/config/proposal.h8
-rw-r--r--Source/charon/config/traffic_selector.h2
-rw-r--r--Source/charon/daemon.h55
-rw-r--r--Source/charon/encoding/Makefile.encoding8
-rw-r--r--Source/charon/encoding/message.h4
-rw-r--r--Source/charon/encoding/payloads/Makefile.payloads46
-rw-r--r--Source/charon/encoding/payloads/encryption_payload.c17
-rw-r--r--Source/charon/encoding/payloads/encryption_payload.h4
-rw-r--r--Source/charon/encoding/payloads/traffic_selector_substructure.h2
-rw-r--r--Source/charon/encoding/payloads/transform_substructure.h8
-rw-r--r--Source/charon/network/Makefile.network10
-rw-r--r--Source/charon/network/packet.h2
-rw-r--r--Source/charon/queues/Makefile.queues8
-rw-r--r--Source/charon/queues/jobs/Makefile.jobs12
-rw-r--r--Source/charon/sa/Makefile.sa12
-rw-r--r--Source/charon/sa/child_sa.h2
-rw-r--r--Source/charon/sa/ike_sa.c6
-rw-r--r--Source/charon/sa/ike_sa.h6
-rw-r--r--Source/charon/sa/states/Makefile.states14
-rw-r--r--Source/charon/sa/states/ike_auth_requested.c4
-rw-r--r--Source/charon/sa/states/ike_sa_init_requested.c2
-rw-r--r--Source/charon/sa/states/ike_sa_init_requested.h2
-rw-r--r--Source/charon/sa/states/ike_sa_init_responded.c4
-rw-r--r--Source/charon/sa/states/initiator_init.c25
-rw-r--r--Source/charon/sa/states/responder_init.c9
-rw-r--r--Source/charon/threads/Makefile.threads14
-rw-r--r--Source/charon/threads/kernel_interface.h2
-rwxr-xr-xSource/charon/threads/stroke_interface.c2
-rw-r--r--Source/doc/Architecture.txt (renamed from Source/charon/doc/Architecture.txt)0
-rw-r--r--Source/doc/Known-bugs.txt5
-rw-r--r--Source/doc/Todo-list.txt (renamed from Source/charon/doc/Todo-list.txt)11
-rw-r--r--Source/lib/Makefile.lib27
-rw-r--r--Source/lib/asn1/Makefile.asn1 (renamed from Source/charon/asn1/Makefile.asn1)6
-rw-r--r--Source/lib/asn1/asn1.c (renamed from Source/charon/asn1/asn1.c)0
-rw-r--r--Source/lib/asn1/asn1.h (renamed from Source/charon/asn1/asn1.h)0
-rw-r--r--Source/lib/asn1/der_decoder.c (renamed from Source/charon/asn1/der_decoder.c)3
-rw-r--r--Source/lib/asn1/der_decoder.h (renamed from Source/charon/asn1/der_decoder.h)0
-rw-r--r--Source/lib/asn1/der_encoder.c (renamed from Source/charon/asn1/der_encoder.c)14
-rw-r--r--Source/lib/asn1/der_encoder.h (renamed from Source/charon/asn1/der_encoder.h)0
-rw-r--r--Source/lib/crypto/Makefile.transforms (renamed from Source/charon/transforms/Makefile.transforms)28
-rwxr-xr-xSource/lib/crypto/certificate.c (renamed from Source/charon/transforms/certificate.c)0
-rwxr-xr-xSource/lib/crypto/certificate.h (renamed from Source/charon/transforms/certificate.h)2
-rw-r--r--Source/lib/crypto/crypters/Makefile.crypters (renamed from Source/charon/transforms/crypters/Makefile.crypters)6
-rw-r--r--Source/lib/crypto/crypters/aes_cbc_crypter.c (renamed from Source/charon/transforms/crypters/aes_cbc_crypter.c)0
-rw-r--r--Source/lib/crypto/crypters/aes_cbc_crypter.h (renamed from Source/charon/transforms/crypters/aes_cbc_crypter.h)2
-rw-r--r--Source/lib/crypto/crypters/crypter.c (renamed from Source/charon/transforms/crypters/crypter.c)2
-rw-r--r--Source/lib/crypto/crypters/crypter.h (renamed from Source/charon/transforms/crypters/crypter.h)0
-rw-r--r--Source/lib/crypto/diffie_hellman.c (renamed from Source/charon/transforms/diffie_hellman.c)7
-rw-r--r--Source/lib/crypto/diffie_hellman.h (renamed from Source/charon/transforms/diffie_hellman.h)0
-rw-r--r--Source/lib/crypto/hashers/Makefile.hashers (renamed from Source/charon/transforms/hashers/Makefile.hashers)8
-rw-r--r--Source/lib/crypto/hashers/hasher.c (renamed from Source/charon/transforms/hashers/hasher.c)4
-rw-r--r--Source/lib/crypto/hashers/hasher.h (renamed from Source/charon/transforms/hashers/hasher.h)0
-rw-r--r--Source/lib/crypto/hashers/md5_hasher.c (renamed from Source/charon/transforms/hashers/md5_hasher.c)0
-rw-r--r--Source/lib/crypto/hashers/md5_hasher.h (renamed from Source/charon/transforms/hashers/md5_hasher.h)2
-rw-r--r--Source/lib/crypto/hashers/sha1_hasher.c (renamed from Source/charon/transforms/hashers/sha1_hasher.c)0
-rw-r--r--Source/lib/crypto/hashers/sha1_hasher.h (renamed from Source/charon/transforms/hashers/sha1_hasher.h)2
-rw-r--r--Source/lib/crypto/hmac.c (renamed from Source/charon/transforms/hmac.c)0
-rw-r--r--Source/lib/crypto/hmac.h (renamed from Source/charon/transforms/hmac.h)2
-rw-r--r--Source/lib/crypto/prf_plus.c (renamed from Source/charon/transforms/prf_plus.c)0
-rw-r--r--Source/lib/crypto/prf_plus.h (renamed from Source/charon/transforms/prf_plus.h)2
-rw-r--r--Source/lib/crypto/prfs/Makefile.prfs (renamed from Source/charon/transforms/prfs/Makefile.prfs)6
-rw-r--r--Source/lib/crypto/prfs/hmac_prf.c (renamed from Source/charon/transforms/prfs/hmac_prf.c)2
-rw-r--r--Source/lib/crypto/prfs/hmac_prf.h (renamed from Source/charon/transforms/prfs/hmac_prf.h)4
-rw-r--r--Source/lib/crypto/prfs/prf.c (renamed from Source/charon/transforms/prfs/prf.c)4
-rw-r--r--Source/lib/crypto/prfs/prf.h (renamed from Source/charon/transforms/prfs/prf.h)0
-rw-r--r--Source/lib/crypto/rsa/Makefile.rsa (renamed from Source/charon/transforms/rsa/Makefile.rsa)6
-rw-r--r--Source/lib/crypto/rsa/rsa_private_key.c (renamed from Source/charon/transforms/rsa/rsa_private_key.c)34
-rw-r--r--Source/lib/crypto/rsa/rsa_private_key.h (renamed from Source/charon/transforms/rsa/rsa_private_key.h)4
-rw-r--r--Source/lib/crypto/rsa/rsa_public_key.c (renamed from Source/charon/transforms/rsa/rsa_public_key.c)2
-rw-r--r--Source/lib/crypto/rsa/rsa_public_key.h (renamed from Source/charon/transforms/rsa/rsa_public_key.h)0
-rw-r--r--Source/lib/crypto/signers/Makefile.signers (renamed from Source/charon/transforms/signers/Makefile.signers)6
-rw-r--r--Source/lib/crypto/signers/hmac_signer.c (renamed from Source/charon/transforms/signers/hmac_signer.c)2
-rw-r--r--Source/lib/crypto/signers/hmac_signer.h (renamed from Source/charon/transforms/signers/hmac_signer.h)4
-rw-r--r--Source/lib/crypto/signers/signer.c (renamed from Source/charon/transforms/signers/signer.c)2
-rw-r--r--Source/lib/crypto/signers/signer.h (renamed from Source/charon/transforms/signers/signer.h)0
-rw-r--r--Source/lib/definitions.c (renamed from Source/charon/definitions.c)0
-rw-r--r--Source/lib/definitions.h (renamed from Source/charon/definitions.h)55
-rw-r--r--Source/lib/types.c (renamed from Source/charon/types.c)0
-rw-r--r--Source/lib/types.h (renamed from Source/charon/types.h)0
-rw-r--r--Source/lib/utils/Makefile.utils (renamed from Source/charon/utils/Makefile.utils)20
-rw-r--r--Source/lib/utils/allocator.c (renamed from Source/charon/utils/allocator.c)0
-rw-r--r--Source/lib/utils/allocator.h (renamed from Source/charon/utils/allocator.h)0
-rw-r--r--Source/lib/utils/host.c (renamed from Source/charon/network/host.c)0
-rw-r--r--Source/lib/utils/host.h (renamed from Source/charon/network/host.h)0
-rw-r--r--Source/lib/utils/identification.c (renamed from Source/charon/utils/identification.c)0
-rw-r--r--Source/lib/utils/identification.h (renamed from Source/charon/utils/identification.h)0
-rw-r--r--Source/lib/utils/iterator.h (renamed from Source/charon/utils/iterator.h)0
-rw-r--r--Source/lib/utils/linked_list.c (renamed from Source/charon/utils/linked_list.c)2
-rw-r--r--Source/lib/utils/linked_list.h (renamed from Source/charon/utils/linked_list.h)0
-rw-r--r--Source/lib/utils/logger.c (renamed from Source/charon/utils/logger.c)0
-rw-r--r--Source/lib/utils/logger.h (renamed from Source/charon/utils/logger.h)0
-rw-r--r--Source/lib/utils/logger_manager.c (renamed from Source/charon/utils/logger_manager.c)0
-rw-r--r--Source/lib/utils/logger_manager.h (renamed from Source/charon/utils/logger_manager.h)0
-rw-r--r--Source/lib/utils/randomizer.c (renamed from Source/charon/utils/randomizer.c)86
-rw-r--r--Source/lib/utils/randomizer.h (renamed from Source/charon/utils/randomizer.h)42
-rw-r--r--Source/lib/utils/tester.c (renamed from Source/charon/utils/tester.c)0
-rw-r--r--Source/lib/utils/tester.h (renamed from Source/charon/utils/tester.h)0
-rw-r--r--Source/stroke/Makefile.stroke17
-rw-r--r--Source/stroke/stroke.c (renamed from Source/charon/stroke.c)0
-rw-r--r--Source/stroke/stroke.h (renamed from Source/charon/stroke.h)0
-rw-r--r--Source/testing/Makefile.testcases (renamed from Source/charon/testcases/Makefile.testcases)10
-rw-r--r--Source/testing/aes_cbc_crypter_test.c (renamed from Source/charon/testcases/aes_cbc_crypter_test.c)0
-rw-r--r--Source/testing/aes_cbc_crypter_test.h (renamed from Source/charon/testcases/aes_cbc_crypter_test.h)2
-rw-r--r--Source/testing/certificate_test.c (renamed from Source/charon/testcases/certificate_test.c)2
-rw-r--r--Source/testing/certificate_test.h (renamed from Source/charon/testcases/certificate_test.h)0
-rw-r--r--Source/testing/child_sa_test.c (renamed from Source/charon/testcases/child_sa_test.c)0
-rw-r--r--Source/testing/child_sa_test.h (renamed from Source/charon/testcases/child_sa_test.h)0
-rw-r--r--Source/testing/connection_test.c (renamed from Source/charon/testcases/connection_test.c)2
-rw-r--r--Source/testing/connection_test.h (renamed from Source/charon/testcases/connection_test.h)0
-rw-r--r--Source/testing/der_decoder_test.c (renamed from Source/charon/testcases/der_decoder_test.c)0
-rw-r--r--Source/testing/der_decoder_test.h (renamed from Source/charon/testcases/der_decoder_test.h)0
-rw-r--r--Source/testing/diffie_hellman_test.c (renamed from Source/charon/testcases/diffie_hellman_test.c)2
-rw-r--r--Source/testing/diffie_hellman_test.h (renamed from Source/charon/testcases/diffie_hellman_test.h)0
-rw-r--r--Source/testing/encryption_payload_test.c (renamed from Source/charon/testcases/encryption_payload_test.c)4
-rw-r--r--Source/testing/encryption_payload_test.h (renamed from Source/charon/testcases/encryption_payload_test.h)0
-rw-r--r--Source/testing/event_queue_test.c (renamed from Source/charon/testcases/event_queue_test.c)0
-rw-r--r--Source/testing/event_queue_test.h (renamed from Source/charon/testcases/event_queue_test.h)0
-rw-r--r--Source/testing/generator_test.c (renamed from Source/charon/testcases/generator_test.c)0
-rw-r--r--Source/testing/generator_test.h (renamed from Source/charon/testcases/generator_test.h)0
-rw-r--r--Source/testing/hasher_test.c (renamed from Source/charon/testcases/hasher_test.c)0
-rw-r--r--Source/testing/hasher_test.h (renamed from Source/charon/testcases/hasher_test.h)6
-rw-r--r--Source/testing/hmac_signer_test.c (renamed from Source/charon/testcases/hmac_signer_test.c)2
-rw-r--r--Source/testing/hmac_signer_test.h (renamed from Source/charon/testcases/hmac_signer_test.h)0
-rw-r--r--Source/testing/hmac_test.c (renamed from Source/charon/testcases/hmac_test.c)2
-rw-r--r--Source/testing/hmac_test.h (renamed from Source/charon/testcases/hmac_test.h)2
-rw-r--r--Source/testing/ike_sa_id_test.c (renamed from Source/charon/testcases/ike_sa_id_test.c)0
-rw-r--r--Source/testing/ike_sa_id_test.h (renamed from Source/charon/testcases/ike_sa_id_test.h)0
-rw-r--r--Source/testing/ike_sa_manager_test.c (renamed from Source/charon/testcases/ike_sa_manager_test.c)0
-rw-r--r--Source/testing/ike_sa_manager_test.h (renamed from Source/charon/testcases/ike_sa_manager_test.h)0
-rw-r--r--Source/testing/ike_sa_test.c (renamed from Source/charon/testcases/ike_sa_test.c)0
-rw-r--r--Source/testing/ike_sa_test.h (renamed from Source/charon/testcases/ike_sa_test.h)0
-rw-r--r--Source/testing/job_queue_test.c (renamed from Source/charon/testcases/job_queue_test.c)0
-rw-r--r--Source/testing/job_queue_test.h (renamed from Source/charon/testcases/job_queue_test.h)0
-rw-r--r--Source/testing/kernel_interface_test.c (renamed from Source/charon/testcases/kernel_interface_test.c)2
-rw-r--r--Source/testing/kernel_interface_test.h (renamed from Source/charon/testcases/kernel_interface_test.h)0
-rw-r--r--Source/testing/linked_list_test.c (renamed from Source/charon/testcases/linked_list_test.c)0
-rw-r--r--Source/testing/linked_list_test.h (renamed from Source/charon/testcases/linked_list_test.h)0
-rw-r--r--Source/testing/packet_test.c (renamed from Source/charon/testcases/packet_test.c)0
-rw-r--r--Source/testing/packet_test.h (renamed from Source/charon/testcases/packet_test.h)0
-rw-r--r--Source/testing/parser_test.c (renamed from Source/charon/testcases/parser_test.c)0
-rw-r--r--Source/testing/parser_test.h (renamed from Source/charon/testcases/parser_test.h)0
-rw-r--r--Source/testing/policy_test.c (renamed from Source/charon/testcases/policy_test.c)0
-rw-r--r--Source/testing/policy_test.h (renamed from Source/charon/testcases/policy_test.h)0
-rw-r--r--Source/testing/prf_plus_test.c (renamed from Source/charon/testcases/prf_plus_test.c)2
-rw-r--r--Source/testing/prf_plus_test.h (renamed from Source/charon/testcases/prf_plus_test.h)2
-rw-r--r--Source/testing/proposal_test.c (renamed from Source/charon/testcases/proposal_test.c)0
-rw-r--r--Source/testing/proposal_test.h (renamed from Source/charon/testcases/proposal_test.h)0
-rw-r--r--Source/testing/receiver_test.c (renamed from Source/charon/testcases/receiver_test.c)0
-rw-r--r--Source/testing/receiver_test.h (renamed from Source/charon/testcases/receiver_test.h)0
-rw-r--r--Source/testing/rsa_test.c (renamed from Source/charon/testcases/rsa_test.c)2
-rw-r--r--Source/testing/rsa_test.h (renamed from Source/charon/testcases/rsa_test.h)4
-rw-r--r--Source/testing/scheduler_test.c (renamed from Source/charon/testcases/scheduler_test.c)0
-rw-r--r--Source/testing/scheduler_test.h (renamed from Source/charon/testcases/scheduler_test.h)0
-rw-r--r--Source/testing/send_queue_test.c (renamed from Source/charon/testcases/send_queue_test.c)0
-rw-r--r--Source/testing/send_queue_test.h (renamed from Source/charon/testcases/send_queue_test.h)0
-rw-r--r--Source/testing/sender_test.c (renamed from Source/charon/testcases/sender_test.c)0
-rw-r--r--Source/testing/sender_test.h (renamed from Source/charon/testcases/sender_test.h)0
-rw-r--r--Source/testing/socket_test.c (renamed from Source/charon/testcases/socket_test.c)0
-rw-r--r--Source/testing/socket_test.h (renamed from Source/charon/testcases/socket_test.h)0
-rw-r--r--Source/testing/testcases.c (renamed from Source/charon/testcases/testcases.c)60
-rw-r--r--Source/testing/thread_pool_test.c (renamed from Source/charon/testcases/thread_pool_test.c)0
-rw-r--r--Source/testing/thread_pool_test.h (renamed from Source/charon/testcases/thread_pool_test.h)0
171 files changed, 674 insertions, 1355 deletions
diff --git a/Source/charon/Doxyfile b/Source/Doxyfile
index f9481b391..f9481b391 100644
--- a/Source/charon/Doxyfile
+++ b/Source/Doxyfile
diff --git a/Source/Makefile b/Source/Makefile
new file mode 100644
index 000000000..7a1f865b2
--- /dev/null
+++ b/Source/Makefile
@@ -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
diff --git a/Source/charon.kdevelop b/Source/charon.kdevelop
new file mode 100644
index 000000000..4ab9354b8
--- /dev/null
+++ b/Source/charon.kdevelop
@@ -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>
diff --git a/Source/charon/Makefile b/Source/charon/Makefile
deleted file mode 100644
index c4d65ca26..000000000
--- a/Source/charon/Makefile
+++ /dev/null
@@ -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
diff --git a/Source/charon/Makefile.charon b/Source/charon/Makefile.charon
new file mode 100644
index 000000000..336495db9
--- /dev/null
+++ b/Source/charon/Makefile.charon
@@ -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 \ No newline at end of file
diff --git a/Source/charon/charon-support.patch b/Source/charon/charon-support.patch
deleted file mode 100644
index 20004d42f..000000000
--- a/Source/charon/charon-support.patch
+++ /dev/null
@@ -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;
diff --git a/Source/charon/config/Makefile.config b/Source/charon/config/Makefile.config
index 58ff4e69e..c95bccb8d 100644
--- a/Source/charon/config/Makefile.config
+++ b/Source/charon/config/Makefile.config
@@ -12,26 +12,26 @@
# 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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $< \ No newline at end of file
diff --git a/Source/charon/config/connection.h b/Source/charon/config/connection.h
index 9ec26b778..8ecce9d66 100644
--- a/Source/charon/config/connection.h
+++ b/Source/charon/config/connection.h
@@ -24,11 +24,11 @@
#define CONNECTION_H_
#include <types.h>
-#include <network/host.h>
+#include <utils/host.h>
#include <utils/linked_list.h>
#include <utils/identification.h>
#include <config/proposal.h>
-#include <transforms/diffie_hellman.h>
+#include <crypto/diffie_hellman.h>
typedef enum auth_method_t auth_method_t;
diff --git a/Source/charon/config/credential_store.h b/Source/charon/config/credential_store.h
index 27f957aa1..27f1a287d 100755
--- a/Source/charon/config/credential_store.h
+++ b/Source/charon/config/credential_store.h
@@ -24,8 +24,8 @@
#define CREDENTIAL_STORE_H_
#include <types.h>
-#include <transforms/rsa/rsa_private_key.h>
-#include <transforms/rsa/rsa_public_key.h>
+#include <crypto/rsa/rsa_private_key.h>
+#include <crypto/rsa/rsa_public_key.h>
typedef struct credential_store_t credential_store_t;
diff --git a/Source/charon/config/proposal.h b/Source/charon/config/proposal.h
index 9c75406cc..48e3ad8d5 100644
--- a/Source/charon/config/proposal.h
+++ b/Source/charon/config/proposal.h
@@ -26,10 +26,10 @@
#include <types.h>
#include <utils/identification.h>
#include <utils/linked_list.h>
-#include <network/host.h>
-#include <transforms/crypters/crypter.h>
-#include <transforms/signers/signer.h>
-#include <transforms/diffie_hellman.h>
+#include <utils/host.h>
+#include <crypto/crypters/crypter.h>
+#include <crypto/signers/signer.h>
+#include <crypto/diffie_hellman.h>
#include <config/traffic_selector.h>
diff --git a/Source/charon/config/traffic_selector.h b/Source/charon/config/traffic_selector.h
index 7e59b53fc..5ac5bdeb1 100644
--- a/Source/charon/config/traffic_selector.h
+++ b/Source/charon/config/traffic_selector.h
@@ -24,7 +24,7 @@
#define TRAFFIC_SELECTOR_H_
#include <types.h>
-#include <network/host.h>
+#include <utils/host.h>
typedef enum ts_type_t ts_type_t;
diff --git a/Source/charon/daemon.h b/Source/charon/daemon.h
index a64845e4e..9f4d73887 100644
--- a/Source/charon/daemon.h
+++ b/Source/charon/daemon.h
@@ -41,6 +41,61 @@
#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.
*/
#define DAEMON_NAME "charon"
diff --git a/Source/charon/encoding/Makefile.encoding b/Source/charon/encoding/Makefile.encoding
index 2f5576ae6..ccdb42f79 100644
--- a/Source/charon/encoding/Makefile.encoding
+++ b/Source/charon/encoding/Makefile.encoding
@@ -12,17 +12,17 @@
# 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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/encoding/message.h b/Source/charon/encoding/message.h
index ef4491c80..e3a72f439 100644
--- a/Source/charon/encoding/message.h
+++ b/Source/charon/encoding/message.h
@@ -29,8 +29,8 @@
#include <encoding/payloads/ike_header.h>
#include <encoding/payloads/notify_payload.h>
#include <utils/linked_list.h>
-#include <transforms/crypters/crypter.h>
-#include <transforms/signers/signer.h>
+#include <crypto/crypters/crypter.h>
+#include <crypto/signers/signer.h>
typedef struct message_t message_t;
diff --git a/Source/charon/encoding/payloads/Makefile.payloads b/Source/charon/encoding/payloads/Makefile.payloads
index 19b9a3bb4..61d920907 100644
--- a/Source/charon/encoding/payloads/Makefile.payloads
+++ b/Source/charon/encoding/payloads/Makefile.payloads
@@ -14,95 +14,95 @@
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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/encoding/payloads/encryption_payload.c b/Source/charon/encoding/payloads/encryption_payload.c
index da48c8349..70bbe9701 100644
--- a/Source/charon/encoding/payloads/encryption_payload.c
+++ b/Source/charon/encoding/payloads/encryption_payload.c
@@ -34,7 +34,7 @@
#include <encoding/parser.h>
#include <utils/iterator.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 */
block_size = this->crypter->get_block_size(this->crypter);
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 */
to_crypt.len = this->decrypted.len + padding.len + 1;
@@ -306,8 +311,14 @@ static status_t encrypt(private_encryption_payload_t *this)
/* build iv */
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);
+ 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);
diff --git a/Source/charon/encoding/payloads/encryption_payload.h b/Source/charon/encoding/payloads/encryption_payload.h
index 7119a72a0..77be246c5 100644
--- a/Source/charon/encoding/payloads/encryption_payload.h
+++ b/Source/charon/encoding/payloads/encryption_payload.h
@@ -23,8 +23,8 @@
#define ENCRYPTION_PAYLOAD_H_
#include <types.h>
-#include <transforms/crypters/crypter.h>
-#include <transforms/signers/signer.h>
+#include <crypto/crypters/crypter.h>
+#include <crypto/signers/signer.h>
#include <encoding/payloads/payload.h>
#include <utils/linked_list.h>
diff --git a/Source/charon/encoding/payloads/traffic_selector_substructure.h b/Source/charon/encoding/payloads/traffic_selector_substructure.h
index 1129ac845..755917055 100644
--- a/Source/charon/encoding/payloads/traffic_selector_substructure.h
+++ b/Source/charon/encoding/payloads/traffic_selector_substructure.h
@@ -26,7 +26,7 @@
#include <types.h>
#include <encoding/payloads/payload.h>
-#include <network/host.h>
+#include <utils/host.h>
#include <config/traffic_selector.h>
/**
diff --git a/Source/charon/encoding/payloads/transform_substructure.h b/Source/charon/encoding/payloads/transform_substructure.h
index 62def3309..f6af3ee59 100644
--- a/Source/charon/encoding/payloads/transform_substructure.h
+++ b/Source/charon/encoding/payloads/transform_substructure.h
@@ -28,10 +28,10 @@
#include <encoding/payloads/payload.h>
#include <encoding/payloads/transform_attribute.h>
#include <utils/linked_list.h>
-#include <transforms/diffie_hellman.h>
-#include <transforms/signers/signer.h>
-#include <transforms/prfs/prf.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/diffie_hellman.h>
+#include <crypto/signers/signer.h>
+#include <crypto/prfs/prf.h>
+#include <crypto/crypters/crypter.h>
#include <config/proposal.h>
diff --git a/Source/charon/network/Makefile.network b/Source/charon/network/Makefile.network
index 034468354..fd99bd085 100644
--- a/Source/charon/network/Makefile.network
+++ b/Source/charon/network/Makefile.network
@@ -12,17 +12,13 @@
# 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
$(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
- $(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 $@ $< \ No newline at end of file
diff --git a/Source/charon/network/packet.h b/Source/charon/network/packet.h
index ddebf5f9b..a2620d391 100644
--- a/Source/charon/network/packet.h
+++ b/Source/charon/network/packet.h
@@ -25,7 +25,7 @@
#include <types.h>
-#include <network/host.h>
+#include <utils/host.h>
typedef struct packet_t packet_t;
diff --git a/Source/charon/queues/Makefile.queues b/Source/charon/queues/Makefile.queues
index 8f671d899..eeb012d2b 100644
--- a/Source/charon/queues/Makefile.queues
+++ b/Source/charon/queues/Makefile.queues
@@ -12,17 +12,17 @@
# 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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/queues/jobs/Makefile.jobs b/Source/charon/queues/jobs/Makefile.jobs
index 658dd1293..db89987bc 100644
--- a/Source/charon/queues/jobs/Makefile.jobs
+++ b/Source/charon/queues/jobs/Makefile.jobs
@@ -14,27 +14,27 @@
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
$(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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
\ No newline at end of file
diff --git a/Source/charon/sa/Makefile.sa b/Source/charon/sa/Makefile.sa
index 4c3e11bbc..825c19959 100644
--- a/Source/charon/sa/Makefile.sa
+++ b/Source/charon/sa/Makefile.sa
@@ -12,25 +12,25 @@
# 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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/sa/child_sa.h b/Source/charon/sa/child_sa.h
index 34542274c..96978dae3 100644
--- a/Source/charon/sa/child_sa.h
+++ b/Source/charon/sa/child_sa.h
@@ -25,7 +25,7 @@
#define CHILD_SA_H_
#include <types.h>
-#include <transforms/prf_plus.h>
+#include <crypto/prf_plus.h>
#include <encoding/payloads/proposal_substructure.h>
typedef struct child_sa_t child_sa_t;
diff --git a/Source/charon/sa/ike_sa.c b/Source/charon/sa/ike_sa.c
index 89f3fff29..43de291d1 100644
--- a/Source/charon/sa/ike_sa.c
+++ b/Source/charon/sa/ike_sa.c
@@ -29,9 +29,9 @@
#include <utils/linked_list.h>
#include <utils/logger_manager.h>
#include <utils/randomizer.h>
-#include <transforms/diffie_hellman.h>
-#include <transforms/prf_plus.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/diffie_hellman.h>
+#include <crypto/prf_plus.h>
+#include <crypto/crypters/crypter.h>
#include <encoding/payloads/sa_payload.h>
#include <encoding/payloads/nonce_payload.h>
#include <encoding/payloads/ke_payload.h>
diff --git a/Source/charon/sa/ike_sa.h b/Source/charon/sa/ike_sa.h
index 16c0111f6..92c73391f 100644
--- a/Source/charon/sa/ike_sa.h
+++ b/Source/charon/sa/ike_sa.h
@@ -32,9 +32,9 @@
#include <config/configuration.h>
#include <utils/logger.h>
#include <utils/randomizer.h>
-#include <transforms/prfs/prf.h>
-#include <transforms/crypters/crypter.h>
-#include <transforms/signers/signer.h>
+#include <crypto/prfs/prf.h>
+#include <crypto/crypters/crypter.h>
+#include <crypto/signers/signer.h>
#include <config/connection.h>
#include <config/policy.h>
diff --git a/Source/charon/sa/states/Makefile.states b/Source/charon/sa/states/Makefile.states
index 69517ea96..a258ebef0 100644
--- a/Source/charon/sa/states/Makefile.states
+++ b/Source/charon/sa/states/Makefile.states
@@ -14,30 +14,30 @@
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
$(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
$(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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $< \ No newline at end of file
diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c
index 16eea7b03..b037cfcd9 100644
--- a/Source/charon/sa/states/ike_auth_requested.c
+++ b/Source/charon/sa/states/ike_auth_requested.c
@@ -29,8 +29,8 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_payload.h>
#include <encoding/payloads/notify_payload.h>
-#include <transforms/signers/signer.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/signers/signer.h>
+#include <crypto/crypters/crypter.h>
#include <sa/states/ike_sa_established.h>
#include <sa/authenticator.h>
#include <sa/child_sa.h>
diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c
index a5b7fbcbd..8d3ae55ed 100644
--- a/Source/charon/sa/states/ike_sa_init_requested.c
+++ b/Source/charon/sa/states/ike_sa_init_requested.c
@@ -31,7 +31,7 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_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/initiator_init.h>
#include <sa/authenticator.h>
diff --git a/Source/charon/sa/states/ike_sa_init_requested.h b/Source/charon/sa/states/ike_sa_init_requested.h
index 1fe0a6d1d..0a43afad1 100644
--- a/Source/charon/sa/states/ike_sa_init_requested.h
+++ b/Source/charon/sa/states/ike_sa_init_requested.h
@@ -27,7 +27,7 @@
#include <types.h>
#include <sa/ike_sa.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;
diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c
index eef8ea3c4..52548749a 100644
--- a/Source/charon/sa/states/ike_sa_init_responded.c
+++ b/Source/charon/sa/states/ike_sa_init_responded.c
@@ -31,8 +31,8 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_payload.h>
#include <encoding/payloads/notify_payload.h>
-#include <transforms/signers/signer.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/signers/signer.h>
+#include <crypto/crypters/crypter.h>
#include <sa/states/ike_sa_established.h>
diff --git a/Source/charon/sa/states/initiator_init.c b/Source/charon/sa/states/initiator_init.c
index 18ffe0e0a..85885130f 100644
--- a/Source/charon/sa/states/initiator_init.c
+++ b/Source/charon/sa/states/initiator_init.c
@@ -28,7 +28,7 @@
#include <sa/states/ike_sa_init_requested.h>
#include <utils/allocator.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/ke_payload.h>
#include <encoding/payloads/nonce_payload.h>
@@ -92,7 +92,7 @@ struct private_initiator_init_t {
* @param this calling object
* @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
@@ -177,9 +177,14 @@ status_t retry_initiate_connection (private_initiator_init_t *this, diffie_hellm
this->build_ke_payload(this, message);
/* 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) */
status = this->ike_sa->send_request(this->ike_sa, message);
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.
*/
-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;
randomizer_t *randomizer;
+ status_t status;
this->logger->log(this->logger, CONTROL|LEVEL1, "Building NONCE payload");
this->logger->log(this->logger, CONTROL|LEVEL2, "Get pseudo random bytes for NONCE");
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));
@@ -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");
request->add_payload(request, (payload_t *) nonce_payload);
+ return SUCCESS;
}
/**
diff --git a/Source/charon/sa/states/responder_init.c b/Source/charon/sa/states/responder_init.c
index 2710080a0..32aa6db86 100644
--- a/Source/charon/sa/states/responder_init.c
+++ b/Source/charon/sa/states/responder_init.c
@@ -30,7 +30,7 @@
#include <encoding/payloads/ke_payload.h>
#include <encoding/payloads/nonce_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;
@@ -428,6 +428,7 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload
{
nonce_payload_t *nonce_payload;
randomizer_t *randomizer;
+ status_t status;
this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload");
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.");
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");
nonce_payload = nonce_payload_create();
diff --git a/Source/charon/threads/Makefile.threads b/Source/charon/threads/Makefile.threads
index 043f547bc..949c1ad24 100644
--- a/Source/charon/threads/Makefile.threads
+++ b/Source/charon/threads/Makefile.threads
@@ -12,28 +12,28 @@
# 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
$(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
$(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
$(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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/threads/kernel_interface.h b/Source/charon/threads/kernel_interface.h
index f7621afd9..ceafa6468 100644
--- a/Source/charon/threads/kernel_interface.h
+++ b/Source/charon/threads/kernel_interface.h
@@ -25,7 +25,7 @@
#include <linux/xfrm.h>
-#include <network/host.h>
+#include <utils/host.h>
#include <encoding/payloads/proposal_substructure.h>
typedef struct kernel_interface_t kernel_interface_t;
diff --git a/Source/charon/threads/stroke_interface.c b/Source/charon/threads/stroke_interface.c
index 5ef2737ff..4468a37cf 100755
--- a/Source/charon/threads/stroke_interface.c
+++ b/Source/charon/threads/stroke_interface.c
@@ -36,7 +36,7 @@
#include <stroke.h>
#include <types.h>
#include <daemon.h>
-#include <transforms/certificate.h>
+#include <crypto/certificate.h>
#include <utils/allocator.h>
#include <queues/jobs/initiate_ike_sa_job.h>
diff --git a/Source/charon/doc/Architecture.txt b/Source/doc/Architecture.txt
index 3e8855fa9..3e8855fa9 100644
--- a/Source/charon/doc/Architecture.txt
+++ b/Source/doc/Architecture.txt
diff --git a/Source/doc/Known-bugs.txt b/Source/doc/Known-bugs.txt
new file mode 100644
index 000000000..079d4d0f9
--- /dev/null
+++ b/Source/doc/Known-bugs.txt
@@ -0,0 +1,5 @@
+ Known bugs in charon
+======================
+
+- intiating the same connection twice makes trouble.
+-
diff --git a/Source/charon/doc/Todo-list.txt b/Source/doc/Todo-list.txt
index 404e45e9e..4915ea7c7 100644
--- a/Source/charon/doc/Todo-list.txt
+++ b/Source/doc/Todo-list.txt
@@ -19,9 +19,12 @@
+ stroke status
- libx509
- - new charon build - libstrong?
- - transforms
- - utils (plus host)
+ + new charon build - libstrong?
+ + transforms
+ + 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 PEM loading (pem)
- ... (more to come, for sure)
@@ -38,4 +41,4 @@
- delete notify, when to send?
- notifys on connection setup failure
-- create child sa message \ No newline at end of file
+- create child sa message
diff --git a/Source/lib/Makefile.lib b/Source/lib/Makefile.lib
new file mode 100644
index 000000000..389a31b63
--- /dev/null
+++ b/Source/lib/Makefile.lib
@@ -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
diff --git a/Source/charon/asn1/Makefile.asn1 b/Source/lib/asn1/Makefile.asn1
index 4aaedf4fe..51ac17e3c 100644
--- a/Source/charon/asn1/Makefile.asn1
+++ b/Source/lib/asn1/Makefile.asn1
@@ -12,13 +12,13 @@
# 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
$(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
$(CC) $(CFLAGS) -c -o $@ $< \ No newline at end of file
diff --git a/Source/charon/asn1/asn1.c b/Source/lib/asn1/asn1.c
index 01952386c..01952386c 100644
--- a/Source/charon/asn1/asn1.c
+++ b/Source/lib/asn1/asn1.c
diff --git a/Source/charon/asn1/asn1.h b/Source/lib/asn1/asn1.h
index 894f048d2..894f048d2 100644
--- a/Source/charon/asn1/asn1.h
+++ b/Source/lib/asn1/asn1.h
diff --git a/Source/charon/asn1/der_decoder.c b/Source/lib/asn1/der_decoder.c
index 9ded40f59..f9a8425c1 100644
--- a/Source/charon/asn1/der_decoder.c
+++ b/Source/lib/asn1/der_decoder.c
@@ -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)
{
+ this->logger->destroy(this->logger);
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->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);
}
diff --git a/Source/charon/asn1/der_decoder.h b/Source/lib/asn1/der_decoder.h
index 68731b5d9..68731b5d9 100644
--- a/Source/charon/asn1/der_decoder.h
+++ b/Source/lib/asn1/der_decoder.h
diff --git a/Source/charon/asn1/der_encoder.c b/Source/lib/asn1/der_encoder.c
index 669a140ed..07beb5891 100644
--- a/Source/charon/asn1/der_encoder.c
+++ b/Source/lib/asn1/der_encoder.c
@@ -48,9 +48,9 @@ struct private_der_encoder_t {
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)
{
@@ -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);
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;
}
-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);
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;
}
-u_int32_t read_length(chunk_t *data)
+static u_int32_t read_length(chunk_t *data)
{
u_int8_t n;
size_t len;
@@ -119,7 +119,7 @@ u_int32_t read_length(chunk_t *data)
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;
@@ -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->output = output;
diff --git a/Source/charon/asn1/der_encoder.h b/Source/lib/asn1/der_encoder.h
index ee4443eb8..ee4443eb8 100644
--- a/Source/charon/asn1/der_encoder.h
+++ b/Source/lib/asn1/der_encoder.h
diff --git a/Source/charon/transforms/Makefile.transforms b/Source/lib/crypto/Makefile.transforms
index 4be5d270b..0ffb107fe 100644
--- a/Source/charon/transforms/Makefile.transforms
+++ b/Source/lib/crypto/Makefile.transforms
@@ -12,26 +12,26 @@
# for more details.
#
-TRANSFORMS_DIR= $(MAIN_DIR)transforms/
+CRYPTO_DIR= $(LIB_DIR)crypto/
-include $(TRANSFORMS_DIR)crypters/Makefile.crypters
-include $(TRANSFORMS_DIR)hashers/Makefile.hashers
-include $(TRANSFORMS_DIR)prfs/Makefile.prfs
-include $(TRANSFORMS_DIR)signers/Makefile.signers
-include $(TRANSFORMS_DIR)rsa/Makefile.rsa
+include $(CRYPTO_DIR)crypters/Makefile.crypters
+include $(CRYPTO_DIR)hashers/Makefile.hashers
+include $(CRYPTO_DIR)prfs/Makefile.prfs
+include $(CRYPTO_DIR)signers/Makefile.signers
+include $(CRYPTO_DIR)rsa/Makefile.rsa
-OBJS+= $(BUILD_DIR)diffie_hellman.o
-$(BUILD_DIR)diffie_hellman.o : $(TRANSFORMS_DIR)diffie_hellman.c $(TRANSFORMS_DIR)diffie_hellman.h
+LIB_OBJS+= $(BUILD_DIR)diffie_hellman.o
+$(BUILD_DIR)diffie_hellman.o : $(CRYPTO_DIR)diffie_hellman.c $(CRYPTO_DIR)diffie_hellman.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)hmac.o
-$(BUILD_DIR)hmac.o : $(TRANSFORMS_DIR)hmac.c $(TRANSFORMS_DIR)hmac.h
+LIB_OBJS+= $(BUILD_DIR)hmac.o
+$(BUILD_DIR)hmac.o : $(CRYPTO_DIR)hmac.c $(CRYPTO_DIR)hmac.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)prf_plus.o
-$(BUILD_DIR)prf_plus.o : $(TRANSFORMS_DIR)prf_plus.c $(TRANSFORMS_DIR)prf_plus.h
+LIB_OBJS+= $(BUILD_DIR)prf_plus.o
+$(BUILD_DIR)prf_plus.o : $(CRYPTO_DIR)prf_plus.c $(CRYPTO_DIR)prf_plus.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)certificate.o
-$(BUILD_DIR)certificate.o : $(TRANSFORMS_DIR)certificate.c $(TRANSFORMS_DIR)certificate.h
+LIB_OBJS+= $(BUILD_DIR)certificate.o
+$(BUILD_DIR)certificate.o : $(CRYPTO_DIR)certificate.c $(CRYPTO_DIR)certificate.h
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/transforms/certificate.c b/Source/lib/crypto/certificate.c
index 2c8f30bf3..2c8f30bf3 100755
--- a/Source/charon/transforms/certificate.c
+++ b/Source/lib/crypto/certificate.c
diff --git a/Source/charon/transforms/certificate.h b/Source/lib/crypto/certificate.h
index 69baed0da..2b5459efb 100755
--- a/Source/charon/transforms/certificate.h
+++ b/Source/lib/crypto/certificate.h
@@ -25,7 +25,7 @@
#include <types.h>
#include <definitions.h>
-#include <transforms/rsa/rsa_public_key.h>
+#include <crypto/rsa/rsa_public_key.h>
typedef struct certificate_t certificate_t;
diff --git a/Source/charon/transforms/crypters/Makefile.crypters b/Source/lib/crypto/crypters/Makefile.crypters
index 232787cd8..612477de8 100644
--- a/Source/charon/transforms/crypters/Makefile.crypters
+++ b/Source/lib/crypto/crypters/Makefile.crypters
@@ -12,12 +12,12 @@
# 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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/transforms/crypters/aes_cbc_crypter.c b/Source/lib/crypto/crypters/aes_cbc_crypter.c
index d5d0f9a60..d5d0f9a60 100644
--- a/Source/charon/transforms/crypters/aes_cbc_crypter.c
+++ b/Source/lib/crypto/crypters/aes_cbc_crypter.c
diff --git a/Source/charon/transforms/crypters/aes_cbc_crypter.h b/Source/lib/crypto/crypters/aes_cbc_crypter.h
index b2c93348e..d7a3c0f5b 100644
--- a/Source/charon/transforms/crypters/aes_cbc_crypter.h
+++ b/Source/lib/crypto/crypters/aes_cbc_crypter.h
@@ -24,7 +24,7 @@
#ifndef 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;
diff --git a/Source/charon/transforms/crypters/crypter.c b/Source/lib/crypto/crypters/crypter.c
index 37b96304e..827d10228 100644
--- a/Source/charon/transforms/crypters/crypter.c
+++ b/Source/lib/crypto/crypters/crypter.c
@@ -23,7 +23,7 @@
#include "crypter.h"
-#include <transforms/crypters/aes_cbc_crypter.h>
+#include <crypto/crypters/aes_cbc_crypter.h>
/**
diff --git a/Source/charon/transforms/crypters/crypter.h b/Source/lib/crypto/crypters/crypter.h
index 9c219f5cc..9c219f5cc 100644
--- a/Source/charon/transforms/crypters/crypter.h
+++ b/Source/lib/crypto/crypters/crypter.h
diff --git a/Source/charon/transforms/diffie_hellman.c b/Source/lib/crypto/diffie_hellman.c
index 88900eb61..84cf1e54a 100644
--- a/Source/charon/transforms/diffie_hellman.c
+++ b/Source/lib/crypto/diffie_hellman.c
@@ -596,7 +596,12 @@ diffie_hellman_t *diffie_hellman_create(diffie_hellman_group_t dh_group_number)
allocator_free(this);
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);
allocator_free_chunk(&random_bytes);
diff --git a/Source/charon/transforms/diffie_hellman.h b/Source/lib/crypto/diffie_hellman.h
index 48a165557..48a165557 100644
--- a/Source/charon/transforms/diffie_hellman.h
+++ b/Source/lib/crypto/diffie_hellman.h
diff --git a/Source/charon/transforms/hashers/Makefile.hashers b/Source/lib/crypto/hashers/Makefile.hashers
index fc26f8ade..e05d41af3 100644
--- a/Source/charon/transforms/hashers/Makefile.hashers
+++ b/Source/lib/crypto/hashers/Makefile.hashers
@@ -12,16 +12,16 @@
# 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
$(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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/transforms/hashers/hasher.c b/Source/lib/crypto/hashers/hasher.c
index 71811c16a..c15f41804 100644
--- a/Source/charon/transforms/hashers/hasher.c
+++ b/Source/lib/crypto/hashers/hasher.c
@@ -23,8 +23,8 @@
#include "hasher.h"
-#include <transforms/hashers/sha1_hasher.h>
-#include <transforms/hashers/md5_hasher.h>
+#include <crypto/hashers/sha1_hasher.h>
+#include <crypto/hashers/md5_hasher.h>
/**
* String mappings for hash_algorithm_t.
diff --git a/Source/charon/transforms/hashers/hasher.h b/Source/lib/crypto/hashers/hasher.h
index a4d6f14d7..a4d6f14d7 100644
--- a/Source/charon/transforms/hashers/hasher.h
+++ b/Source/lib/crypto/hashers/hasher.h
diff --git a/Source/charon/transforms/hashers/md5_hasher.c b/Source/lib/crypto/hashers/md5_hasher.c
index cd883d92c..cd883d92c 100644
--- a/Source/charon/transforms/hashers/md5_hasher.c
+++ b/Source/lib/crypto/hashers/md5_hasher.c
diff --git a/Source/charon/transforms/hashers/md5_hasher.h b/Source/lib/crypto/hashers/md5_hasher.h
index b32acc062..1e6d95d19 100644
--- a/Source/charon/transforms/hashers/md5_hasher.h
+++ b/Source/lib/crypto/hashers/md5_hasher.h
@@ -23,7 +23,7 @@
#ifndef 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;
diff --git a/Source/charon/transforms/hashers/sha1_hasher.c b/Source/lib/crypto/hashers/sha1_hasher.c
index 2fa659f74..2fa659f74 100644
--- a/Source/charon/transforms/hashers/sha1_hasher.c
+++ b/Source/lib/crypto/hashers/sha1_hasher.c
diff --git a/Source/charon/transforms/hashers/sha1_hasher.h b/Source/lib/crypto/hashers/sha1_hasher.h
index 43ad0ae20..5124ea1a8 100644
--- a/Source/charon/transforms/hashers/sha1_hasher.h
+++ b/Source/lib/crypto/hashers/sha1_hasher.h
@@ -23,7 +23,7 @@
#ifndef 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;
diff --git a/Source/charon/transforms/hmac.c b/Source/lib/crypto/hmac.c
index dc31af3eb..dc31af3eb 100644
--- a/Source/charon/transforms/hmac.c
+++ b/Source/lib/crypto/hmac.c
diff --git a/Source/charon/transforms/hmac.h b/Source/lib/crypto/hmac.h
index efc96eff9..8945fc1fc 100644
--- a/Source/charon/transforms/hmac.h
+++ b/Source/lib/crypto/hmac.h
@@ -22,7 +22,7 @@
#ifndef HMAC_H_
#define HMAC_H_
-#include <transforms/hashers/hasher.h>
+#include <crypto/hashers/hasher.h>
#include <definitions.h>
diff --git a/Source/charon/transforms/prf_plus.c b/Source/lib/crypto/prf_plus.c
index f0f4a11c6..f0f4a11c6 100644
--- a/Source/charon/transforms/prf_plus.c
+++ b/Source/lib/crypto/prf_plus.c
diff --git a/Source/charon/transforms/prf_plus.h b/Source/lib/crypto/prf_plus.h
index 829191786..bdcd01966 100644
--- a/Source/charon/transforms/prf_plus.h
+++ b/Source/lib/crypto/prf_plus.h
@@ -24,7 +24,7 @@
#define PRF_PLUS_H_
-#include <transforms/prfs/prf.h>
+#include <crypto/prfs/prf.h>
typedef struct prf_plus_t prf_plus_t;
diff --git a/Source/charon/transforms/prfs/Makefile.prfs b/Source/lib/crypto/prfs/Makefile.prfs
index 378d8bd0b..a98894346 100644
--- a/Source/charon/transforms/prfs/Makefile.prfs
+++ b/Source/lib/crypto/prfs/Makefile.prfs
@@ -12,12 +12,12 @@
# 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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/transforms/prfs/hmac_prf.c b/Source/lib/crypto/prfs/hmac_prf.c
index ce4330090..2ea0869f7 100644
--- a/Source/charon/transforms/prfs/hmac_prf.c
+++ b/Source/lib/crypto/prfs/hmac_prf.c
@@ -23,7 +23,7 @@
#include "hmac_prf.h"
#include <utils/allocator.h>
-#include <transforms/hmac.h>
+#include <crypto/hmac.h>
typedef struct private_hmac_prf_t private_hmac_prf_t;
diff --git a/Source/charon/transforms/prfs/hmac_prf.h b/Source/lib/crypto/prfs/hmac_prf.h
index 6ccfceef2..3a68960f7 100644
--- a/Source/charon/transforms/prfs/hmac_prf.h
+++ b/Source/lib/crypto/prfs/hmac_prf.h
@@ -24,8 +24,8 @@
#define PRF_HMAC_H_
#include <types.h>
-#include <transforms/prfs/prf.h>
-#include <transforms/hashers/hasher.h>
+#include <crypto/prfs/prf.h>
+#include <crypto/hashers/hasher.h>
typedef struct hmac_prf_t hmac_prf_t;
diff --git a/Source/charon/transforms/prfs/prf.c b/Source/lib/crypto/prfs/prf.c
index b9bd7a51a..bb7015e64 100644
--- a/Source/charon/transforms/prfs/prf.c
+++ b/Source/lib/crypto/prfs/prf.c
@@ -23,8 +23,8 @@
#include "prf.h"
-#include <transforms/hashers/hasher.h>
-#include <transforms/prfs/hmac_prf.h>
+#include <crypto/hashers/hasher.h>
+#include <crypto/prfs/hmac_prf.h>
/**
diff --git a/Source/charon/transforms/prfs/prf.h b/Source/lib/crypto/prfs/prf.h
index b1c1e6a66..b1c1e6a66 100644
--- a/Source/charon/transforms/prfs/prf.h
+++ b/Source/lib/crypto/prfs/prf.h
diff --git a/Source/charon/transforms/rsa/Makefile.rsa b/Source/lib/crypto/rsa/Makefile.rsa
index 4afe373e7..1a0204c83 100644
--- a/Source/charon/transforms/rsa/Makefile.rsa
+++ b/Source/lib/crypto/rsa/Makefile.rsa
@@ -12,12 +12,12 @@
# 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
$(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
$(CC) $(CFLAGS) -c -o $@ $< \ No newline at end of file
diff --git a/Source/charon/transforms/rsa/rsa_private_key.c b/Source/lib/crypto/rsa/rsa_private_key.c
index 231aee962..0afadd179 100644
--- a/Source/charon/transforms/rsa/rsa_private_key.c
+++ b/Source/lib/crypto/rsa/rsa_private_key.c
@@ -134,7 +134,7 @@ struct private_rsa_private_key_t {
* @param prime_size size of the prime, in bytes
* @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.
*/
-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;
chunk_t random_bytes;
+ status_t status;
randomizer = randomizer_create();
mpz_init(*prime);
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 */
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);
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.
*/
-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)
{
@@ -461,9 +469,22 @@ rsa_private_key_t *rsa_private_key_create(size_t key_size)
private_rsa_private_key_t *this;
this = rsa_private_key_create_empty();
-
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(n);
mpz_init(d);
@@ -471,9 +492,6 @@ rsa_private_key_t *rsa_private_key_create(size_t key_size)
mpz_init(exp2);
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 */
if (mpz_cmp(p, q) < 0)
diff --git a/Source/charon/transforms/rsa/rsa_private_key.h b/Source/lib/crypto/rsa/rsa_private_key.h
index 3ca760042..b3b8ae87f 100644
--- a/Source/charon/transforms/rsa/rsa_private_key.h
+++ b/Source/lib/crypto/rsa/rsa_private_key.h
@@ -25,8 +25,8 @@
#include <types.h>
#include <definitions.h>
-#include <transforms/rsa/rsa_public_key.h>
-#include <transforms/hashers/hasher.h>
+#include <crypto/rsa/rsa_public_key.h>
+#include <crypto/hashers/hasher.h>
typedef struct rsa_private_key_t rsa_private_key_t;
diff --git a/Source/charon/transforms/rsa/rsa_public_key.c b/Source/lib/crypto/rsa/rsa_public_key.c
index 5a3df1f10..57ad10128 100644
--- a/Source/charon/transforms/rsa/rsa_public_key.c
+++ b/Source/lib/crypto/rsa/rsa_public_key.c
@@ -28,7 +28,7 @@
#include <daemon.h>
#include <utils/allocator.h>
-#include <transforms/hashers/hasher.h>
+#include <crypto/hashers/hasher.h>
#include <asn1/der_decoder.h>
/*
diff --git a/Source/charon/transforms/rsa/rsa_public_key.h b/Source/lib/crypto/rsa/rsa_public_key.h
index ef79153d6..ef79153d6 100644
--- a/Source/charon/transforms/rsa/rsa_public_key.h
+++ b/Source/lib/crypto/rsa/rsa_public_key.h
diff --git a/Source/charon/transforms/signers/Makefile.signers b/Source/lib/crypto/signers/Makefile.signers
index 861125c56..8f161a09d 100644
--- a/Source/charon/transforms/signers/Makefile.signers
+++ b/Source/lib/crypto/signers/Makefile.signers
@@ -12,12 +12,12 @@
# 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
$(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
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/transforms/signers/hmac_signer.c b/Source/lib/crypto/signers/hmac_signer.c
index ee029011f..e4311da1b 100644
--- a/Source/charon/transforms/signers/hmac_signer.c
+++ b/Source/lib/crypto/signers/hmac_signer.c
@@ -23,7 +23,7 @@
#include "hmac_signer.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.
diff --git a/Source/charon/transforms/signers/hmac_signer.h b/Source/lib/crypto/signers/hmac_signer.h
index 8cbe80ecd..62427167e 100644
--- a/Source/charon/transforms/signers/hmac_signer.h
+++ b/Source/lib/crypto/signers/hmac_signer.h
@@ -23,8 +23,8 @@
#ifndef HMAC_SIGNER_H_
#define HMAC_SIGNER_H_
-#include <transforms/signers/signer.h>
-#include <transforms/hashers/hasher.h>
+#include <crypto/signers/signer.h>
+#include <crypto/hashers/hasher.h>
typedef struct hmac_signer_t hmac_signer_t;
diff --git a/Source/charon/transforms/signers/signer.c b/Source/lib/crypto/signers/signer.c
index 55e3cfc45..3e6378957 100644
--- a/Source/charon/transforms/signers/signer.c
+++ b/Source/lib/crypto/signers/signer.c
@@ -22,7 +22,7 @@
#include "signer.h"
-#include <transforms/signers/hmac_signer.h>
+#include <crypto/signers/hmac_signer.h>
/**
* String mappings for integrity_algorithm_t.
diff --git a/Source/charon/transforms/signers/signer.h b/Source/lib/crypto/signers/signer.h
index 9625af813..9625af813 100644
--- a/Source/charon/transforms/signers/signer.h
+++ b/Source/lib/crypto/signers/signer.h
diff --git a/Source/charon/definitions.c b/Source/lib/definitions.c
index 59c97a29b..59c97a29b 100644
--- a/Source/charon/definitions.c
+++ b/Source/lib/definitions.c
diff --git a/Source/charon/definitions.h b/Source/lib/definitions.h
index 4ca46063a..2acec8d0a 100644
--- a/Source/charon/definitions.h
+++ b/Source/lib/definitions.h
@@ -59,60 +59,7 @@
#error "BYTE_ORDER must be defined"
#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
diff --git a/Source/charon/types.c b/Source/lib/types.c
index 47a763e83..47a763e83 100644
--- a/Source/charon/types.c
+++ b/Source/lib/types.c
diff --git a/Source/charon/types.h b/Source/lib/types.h
index 9c405dee5..9c405dee5 100644
--- a/Source/charon/types.h
+++ b/Source/lib/types.h
diff --git a/Source/charon/utils/Makefile.utils b/Source/lib/utils/Makefile.utils
index 01e3bab32..ab513ff7a 100644
--- a/Source/charon/utils/Makefile.utils
+++ b/Source/lib/utils/Makefile.utils
@@ -12,33 +12,37 @@
# 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
$(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
$(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
$(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
$(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
$(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
$(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
$(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 $@ $<
diff --git a/Source/charon/utils/allocator.c b/Source/lib/utils/allocator.c
index 0ed197c62..0ed197c62 100644
--- a/Source/charon/utils/allocator.c
+++ b/Source/lib/utils/allocator.c
diff --git a/Source/charon/utils/allocator.h b/Source/lib/utils/allocator.h
index 5b00496f6..5b00496f6 100644
--- a/Source/charon/utils/allocator.h
+++ b/Source/lib/utils/allocator.h
diff --git a/Source/charon/network/host.c b/Source/lib/utils/host.c
index 245df8b05..245df8b05 100644
--- a/Source/charon/network/host.c
+++ b/Source/lib/utils/host.c
diff --git a/Source/charon/network/host.h b/Source/lib/utils/host.h
index d81efffa6..d81efffa6 100644
--- a/Source/charon/network/host.h
+++ b/Source/lib/utils/host.h
diff --git a/Source/charon/utils/identification.c b/Source/lib/utils/identification.c
index 72d1610af..72d1610af 100644
--- a/Source/charon/utils/identification.c
+++ b/Source/lib/utils/identification.c
diff --git a/Source/charon/utils/identification.h b/Source/lib/utils/identification.h
index b973da9a4..b973da9a4 100644
--- a/Source/charon/utils/identification.h
+++ b/Source/lib/utils/identification.h
diff --git a/Source/charon/utils/iterator.h b/Source/lib/utils/iterator.h
index de81db8e9..de81db8e9 100644
--- a/Source/charon/utils/iterator.h
+++ b/Source/lib/utils/iterator.h
diff --git a/Source/charon/utils/linked_list.c b/Source/lib/utils/linked_list.c
index 7ad07dbdd..407065d24 100644
--- a/Source/charon/utils/linked_list.c
+++ b/Source/lib/utils/linked_list.c
@@ -335,7 +335,7 @@ static void insert_before(private_iterator_t * iterator, void *item)
/**
* 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)
{
diff --git a/Source/charon/utils/linked_list.h b/Source/lib/utils/linked_list.h
index 8647f064d..8647f064d 100644
--- a/Source/charon/utils/linked_list.h
+++ b/Source/lib/utils/linked_list.h
diff --git a/Source/charon/utils/logger.c b/Source/lib/utils/logger.c
index c66de481e..c66de481e 100644
--- a/Source/charon/utils/logger.c
+++ b/Source/lib/utils/logger.c
diff --git a/Source/charon/utils/logger.h b/Source/lib/utils/logger.h
index 637915e8b..637915e8b 100644
--- a/Source/charon/utils/logger.h
+++ b/Source/lib/utils/logger.h
diff --git a/Source/charon/utils/logger_manager.c b/Source/lib/utils/logger_manager.c
index 8270191a9..8270191a9 100644
--- a/Source/charon/utils/logger_manager.c
+++ b/Source/lib/utils/logger_manager.c
diff --git a/Source/charon/utils/logger_manager.h b/Source/lib/utils/logger_manager.h
index bc8f0e62f..bc8f0e62f 100644
--- a/Source/charon/utils/logger_manager.h
+++ b/Source/lib/utils/logger_manager.h
diff --git a/Source/charon/utils/randomizer.c b/Source/lib/utils/randomizer.c
index bab2c071e..efe51af71 100644
--- a/Source/charon/utils/randomizer.c
+++ b/Source/lib/utils/randomizer.c
@@ -19,17 +19,16 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
+
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-
+
#include "randomizer.h"
#include <utils/allocator.h>
-#include <daemon.h>
typedef struct private_randomizer_t private_randomizer_t;
@@ -53,38 +52,25 @@ struct private_randomizer_t {
* @param[out] buffer pointer to buffer where to write the data in.
* Size of buffer has to be at least bytes.
*/
- void (*get_bytes_from_device) (private_randomizer_t *this,bool pseudo_random, size_t bytes, u_int8_t *buffer);
-
- /**
- * Random device name.
- */
- char *random_dev_name;
-
- /**
- * Pseudo random device name.
- */
- char *pseudo_random_dev_name;
+ status_t (*get_bytes_from_device) (private_randomizer_t *this,bool pseudo_random, size_t bytes, u_int8_t *buffer);
};
/**
* Implementation of private_randomizer_t.get_bytes_from_device.
*/
-static void get_bytes_from_device(private_randomizer_t *this,bool pseudo_random, size_t bytes, u_int8_t *buffer)
+static status_t get_bytes_from_device(private_randomizer_t *this,bool pseudo_random, size_t bytes, u_int8_t *buffer)
{
- /* number of bytes already done */
size_t ndone;
- /* device file descriptor */
int device;
size_t got;
char * device_name;
- device_name = (pseudo_random) ? this->pseudo_random_dev_name : this->random_dev_name;
+ device_name = pseudo_random ? RANDOM_DEVICE : PSEUDO_RANDOM_DEVICE;
- // open device
device = open(device_name, 0);
if (device < 0) {
- charon->kill(charon,"Random device could not be opened");
+ return FAILED;
}
ndone = 0;
@@ -92,40 +78,44 @@ static void get_bytes_from_device(private_randomizer_t *this,bool pseudo_random,
while (ndone < bytes)
{
got = read(device, buffer + ndone, bytes - ndone);
- if (got < 0) {
- charon->kill(charon,"Read from random device failed");
- }
- if (got == 0) {
- charon->kill(charon,"Read from random device failed");
+ if (got <= 0) {
+ close(device);
+ return FAILED;
}
ndone += got;
}
- /* close device */
close(device);
+ return SUCCESS;
}
/**
* Implementation of randomizer_t.get_random_bytes.
*/
-static void get_random_bytes(private_randomizer_t *this,size_t bytes, u_int8_t *buffer)
+static status_t get_random_bytes(private_randomizer_t *this,size_t bytes, u_int8_t *buffer)
{
- return (this->get_bytes_from_device(this, FALSE, bytes, buffer));
+ return this->get_bytes_from_device(this, FALSE, bytes, buffer);
}
/**
* Implementation of randomizer_t.allocate_random_bytes.
*/
-static void allocate_random_bytes(private_randomizer_t *this, size_t bytes, chunk_t *chunk)
+static status_t allocate_random_bytes(private_randomizer_t *this, size_t bytes, chunk_t *chunk)
{
+ status_t status;
chunk->len = bytes;
chunk->ptr = allocator_alloc(bytes);
- return (this->get_bytes_from_device(this, FALSE, bytes, chunk->ptr));
+ status = this->get_bytes_from_device(this, FALSE, bytes, chunk->ptr);
+ if (status != SUCCESS)
+ {
+ allocator_free(chunk->ptr);
+ }
+ return status;
}
/**
* Implementation of randomizer_t.get_pseudo_random_bytes.
*/
-static void get_pseudo_random_bytes(private_randomizer_t *this,size_t bytes, u_int8_t *buffer)
+static status_t get_pseudo_random_bytes(private_randomizer_t *this,size_t bytes, u_int8_t *buffer)
{
return (this->get_bytes_from_device(this, TRUE, bytes, buffer));
}
@@ -133,11 +123,17 @@ static void get_pseudo_random_bytes(private_randomizer_t *this,size_t bytes, u_i
/**
* Implementation of randomizer_t.allocate_pseudo_random_bytes.
*/
-static void allocate_pseudo_random_bytes(private_randomizer_t *this, size_t bytes, chunk_t *chunk)
+static status_t allocate_pseudo_random_bytes(private_randomizer_t *this, size_t bytes, chunk_t *chunk)
{
+ status_t status;
chunk->len = bytes;
chunk->ptr = allocator_alloc(bytes);
- return (this->get_bytes_from_device(this, TRUE, bytes, chunk->ptr));
+ status = this->get_bytes_from_device(this, TRUE, bytes, chunk->ptr);
+ if (status != SUCCESS)
+ {
+ allocator_free(chunk->ptr);
+ }
+ return status;
}
/**
@@ -145,8 +141,6 @@ static void allocate_pseudo_random_bytes(private_randomizer_t *this, size_t byte
*/
static void destroy(private_randomizer_t *this)
{
- allocator_free(this->random_dev_name);
- allocator_free(this->pseudo_random_dev_name);
allocator_free(this);
}
@@ -155,31 +149,17 @@ static void destroy(private_randomizer_t *this)
*/
randomizer_t *randomizer_create(void)
{
- return randomizer_create_on_devices(DEFAULT_RANDOM_DEVICE,DEFAULT_PSEUDO_RANDOM_DEVICE);
-}
-
-/*
- * Described in header.
- */
-randomizer_t *randomizer_create_on_devices(char * random_dev_name,char * prandom_dev_name)
-{
private_randomizer_t *this = allocator_alloc_thing(private_randomizer_t);
/* public functions */
- this->public.get_random_bytes = (void (*) (randomizer_t *,size_t, u_int8_t *)) get_random_bytes;
- this->public.allocate_random_bytes = (void (*) (randomizer_t *,size_t, chunk_t *)) allocate_random_bytes;
- this->public.get_pseudo_random_bytes = (void (*) (randomizer_t *,size_t, u_int8_t *)) get_pseudo_random_bytes;
- this->public.allocate_pseudo_random_bytes = (void (*) (randomizer_t *,size_t, chunk_t *)) allocate_pseudo_random_bytes;
+ this->public.get_random_bytes = (status_t (*) (randomizer_t *,size_t, u_int8_t *)) get_random_bytes;
+ this->public.allocate_random_bytes = (status_t (*) (randomizer_t *,size_t, chunk_t *)) allocate_random_bytes;
+ this->public.get_pseudo_random_bytes = (status_t (*) (randomizer_t *,size_t, u_int8_t *)) get_pseudo_random_bytes;
+ this->public.allocate_pseudo_random_bytes = (status_t (*) (randomizer_t *,size_t, chunk_t *)) allocate_pseudo_random_bytes;
this->public.destroy = (void (*) (randomizer_t *))destroy;
/* private functions */
this->get_bytes_from_device = get_bytes_from_device;
- /* private fields */
- this->random_dev_name = allocator_alloc(strlen(random_dev_name) + 1);
- strcpy(this->random_dev_name,random_dev_name);
- this->pseudo_random_dev_name = allocator_alloc(strlen(prandom_dev_name) + 1);
- strcpy(this->pseudo_random_dev_name,prandom_dev_name);
-
return &(this->public);
}
diff --git a/Source/charon/utils/randomizer.h b/Source/lib/utils/randomizer.h
index 509b7d515..55519550e 100644
--- a/Source/charon/utils/randomizer.h
+++ b/Source/lib/utils/randomizer.h
@@ -27,25 +27,22 @@
/**
- * Default random device used when no device is given.
+ * Device to read real random bytes
*/
-#define DEFAULT_RANDOM_DEVICE "/dev/random"
+#define RANDOM_DEVICE "/dev/random"
/**
- * Pseudo random device used when no device is given.
+ * Device to read pseudo random bytes
*/
-#define DEFAULT_PSEUDO_RANDOM_DEVICE "/dev/urandom"
+#define PSEUDO_RANDOM_DEVICE "/dev/urandom"
typedef struct randomizer_t randomizer_t;
/**
* @brief Class used to get random and pseudo random values.
- *
- * This class is thread save as file system read calls are thread save.
*
* @b Constructors:
* - randomizer_create()
- * - randomizer_create_on_devices()
*
* @ingroup utils
*/
@@ -58,8 +55,9 @@ struct randomizer_t {
* @param bytes number of bytes to read
* @param[out] buffer pointer to buffer where to write the data in.
* Size of buffer has to be at least bytes.
+ * @return SUCCESS, or FAILED
*/
- void (*get_random_bytes) (randomizer_t *this,size_t bytes, u_int8_t *buffer);
+ status_t (*get_random_bytes) (randomizer_t *this, size_t bytes, u_int8_t *buffer);
/**
* @brief Allocates space and writes in random bytes.
@@ -67,8 +65,9 @@ struct randomizer_t {
* @param this calling randomizer_t object
* @param bytes number of bytes to allocate
* @param[out] chunk chunk which will hold the allocated random bytes
+ * @return SUCCESS, or FAILED
*/
- void (*allocate_random_bytes) (randomizer_t *this, size_t bytes, chunk_t *chunk);
+ status_t (*allocate_random_bytes) (randomizer_t *this, size_t bytes, chunk_t *chunk);
/**
* @brief Reads a specific number of bytes from pseudo random device.
@@ -77,17 +76,19 @@ struct randomizer_t {
* @param bytes number of bytes to read
* @param[out] buffer pointer to buffer where to write the data in.
* size of buffer has to be at least bytes.
+ * @return SUCCESS, or FAILED
*/
- void (*get_pseudo_random_bytes) (randomizer_t *this,size_t bytes, u_int8_t *buffer);
+ status_t (*get_pseudo_random_bytes) (randomizer_t *this,size_t bytes, u_int8_t *buffer);
/**
* @brief Allocates space and writes in pseudo random bytes.
*
* @param this calling randomizer_t object
* @param bytes number of bytes to allocate
- * @param[out] chunk chunk which will hold the allocated random bytes
+ * @param[out] chunk chunk which will hold the allocated random bytes
+ * @return SUCCESS, or FAILED
*/
- void (*allocate_pseudo_random_bytes) (randomizer_t *this, size_t bytes, chunk_t *chunk);
+ status_t (*allocate_pseudo_random_bytes) (randomizer_t *this, size_t bytes, chunk_t *chunk);
/**
* @brief Destroys a randomizer_t object.
@@ -98,25 +99,12 @@ struct randomizer_t {
};
/**
- * @brief Creates a randomizer_t object
+ * @brief Creates a randomizer_t object.
*
- * @return
- * - created randomizer_t, or
- * - NULL if failed
+ * @return created randomizer_t, or
*
* @ingroup utils
*/
randomizer_t *randomizer_create();
-/**
- * @brief Creates an randomizer_t object with specific random device names.
- *
- * @param random_dev_name device name for random values, etc /dev/random
- * @param prandom_dev_name device name for pseudo random values, etc /dev/urandom
- * @return randomizer_t object
- *
- * @ingroup utils
- */
-randomizer_t *randomizer_create_on_devices(char * random_dev_name,char * prandom_dev_name);
-
#endif /*RANDOMIZER_H_*/
diff --git a/Source/charon/utils/tester.c b/Source/lib/utils/tester.c
index 20dea2e82..20dea2e82 100644
--- a/Source/charon/utils/tester.c
+++ b/Source/lib/utils/tester.c
diff --git a/Source/charon/utils/tester.h b/Source/lib/utils/tester.h
index 3decb2039..3decb2039 100644
--- a/Source/charon/utils/tester.h
+++ b/Source/lib/utils/tester.h
diff --git a/Source/stroke/Makefile.stroke b/Source/stroke/Makefile.stroke
new file mode 100644
index 000000000..c87445095
--- /dev/null
+++ b/Source/stroke/Makefile.stroke
@@ -0,0 +1,17 @@
+# 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.
+#
+STROKE_DIR= $(MAIN_DIR)stroke/
+
+$(BUILD_DIR)stroke.o : $(STROKE_DIR)stroke.c $(STROKE_DIR)stroke.h
+ $(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/stroke.c b/Source/stroke/stroke.c
index 5062c26f7..5062c26f7 100644
--- a/Source/charon/stroke.c
+++ b/Source/stroke/stroke.c
diff --git a/Source/charon/stroke.h b/Source/stroke/stroke.h
index 2f756798d..2f756798d 100644
--- a/Source/charon/stroke.h
+++ b/Source/stroke/stroke.h
diff --git a/Source/charon/testcases/Makefile.testcases b/Source/testing/Makefile.testcases
index b6113fa06..75023fda8 100644
--- a/Source/charon/testcases/Makefile.testcases
+++ b/Source/testing/Makefile.testcases
@@ -12,14 +12,16 @@
# for more details.
#
-TESTCASES_DIR= $(MAIN_DIR)testcases/
+TESTCASES_DIR= $(MAIN_DIR)testing/
+$(BUILD_DIR)testcases.o : $(TESTCASES_DIR)testcases.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
TEST_OBJS+= $(BUILD_DIR)aes_cbc_crypter_test.o
$(BUILD_DIR)aes_cbc_crypter_test.o : $(TESTCASES_DIR)aes_cbc_crypter_test.c $(TESTCASES_DIR)aes_cbc_crypter_test.h
$(CC) $(CFLAGS) -c -o $@ $<
-
TEST_OBJS+= $(BUILD_DIR)diffie_hellman_test.o
$(BUILD_DIR)diffie_hellman_test.o : $(TESTCASES_DIR)diffie_hellman_test.c $(TESTCASES_DIR)diffie_hellman_test.h
$(CC) $(CFLAGS) -c -o $@ $<
@@ -84,10 +86,6 @@ TEST_OBJS+= $(BUILD_DIR)packet_test.o
$(BUILD_DIR)packet_test.o : $(TESTCASES_DIR)packet_test.c $(TESTCASES_DIR)packet_test.h
$(CC) $(CFLAGS) -c -o $@ $<
-TEST_OBJS+= $(BUILD_DIR)testcases.o
-$(BUILD_DIR)testcases.o : $(TESTCASES_DIR)testcases.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
TEST_OBJS+= $(BUILD_DIR)receiver_test.o
$(BUILD_DIR)receiver_test.o : $(TESTCASES_DIR)receiver_test.c $(TESTCASES_DIR)receiver_test.h
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/Source/charon/testcases/aes_cbc_crypter_test.c b/Source/testing/aes_cbc_crypter_test.c
index 1ea2983cd..1ea2983cd 100644
--- a/Source/charon/testcases/aes_cbc_crypter_test.c
+++ b/Source/testing/aes_cbc_crypter_test.c
diff --git a/Source/charon/testcases/aes_cbc_crypter_test.h b/Source/testing/aes_cbc_crypter_test.h
index 611863636..c3897a4d6 100644
--- a/Source/charon/testcases/aes_cbc_crypter_test.h
+++ b/Source/testing/aes_cbc_crypter_test.h
@@ -23,7 +23,7 @@
#ifndef AES_CBC_CRYPTER_TEST_H_
#define AES_CBC_CRYPTER_TEST_H_
-#include <transforms/crypters/aes_cbc_crypter.h>
+#include <crypto/crypters/aes_cbc_crypter.h>
#include <utils/tester.h>
/**
diff --git a/Source/charon/testcases/certificate_test.c b/Source/testing/certificate_test.c
index c950e0094..5cdd31c29 100644
--- a/Source/charon/testcases/certificate_test.c
+++ b/Source/testing/certificate_test.c
@@ -23,7 +23,7 @@
#include "certificate_test.h"
#include <daemon.h>
-#include <transforms/certificate.h>
+#include <crypto/certificate.h>
#include <utils/allocator.h>
#include <utils/logger.h>
diff --git a/Source/charon/testcases/certificate_test.h b/Source/testing/certificate_test.h
index 8dcbd0f93..8dcbd0f93 100644
--- a/Source/charon/testcases/certificate_test.h
+++ b/Source/testing/certificate_test.h
diff --git a/Source/charon/testcases/child_sa_test.c b/Source/testing/child_sa_test.c
index 0a3aec9f2..0a3aec9f2 100644
--- a/Source/charon/testcases/child_sa_test.c
+++ b/Source/testing/child_sa_test.c
diff --git a/Source/charon/testcases/child_sa_test.h b/Source/testing/child_sa_test.h
index ef92499fe..ef92499fe 100644
--- a/Source/charon/testcases/child_sa_test.h
+++ b/Source/testing/child_sa_test.h
diff --git a/Source/charon/testcases/connection_test.c b/Source/testing/connection_test.c
index ae8ed3c04..3a356cd03 100644
--- a/Source/charon/testcases/connection_test.c
+++ b/Source/testing/connection_test.c
@@ -24,7 +24,7 @@
#include <config/connection.h>
#include <utils/allocator.h>
-#include <transforms/prfs/prf.h>
+#include <crypto/prfs/prf.h>
/**
diff --git a/Source/charon/testcases/connection_test.h b/Source/testing/connection_test.h
index 4d2a1d89e..4d2a1d89e 100644
--- a/Source/charon/testcases/connection_test.h
+++ b/Source/testing/connection_test.h
diff --git a/Source/charon/testcases/der_decoder_test.c b/Source/testing/der_decoder_test.c
index c5683fae8..c5683fae8 100644
--- a/Source/charon/testcases/der_decoder_test.c
+++ b/Source/testing/der_decoder_test.c
diff --git a/Source/charon/testcases/der_decoder_test.h b/Source/testing/der_decoder_test.h
index e7a7b7b62..e7a7b7b62 100644
--- a/Source/charon/testcases/der_decoder_test.h
+++ b/Source/testing/der_decoder_test.h
diff --git a/Source/charon/testcases/diffie_hellman_test.c b/Source/testing/diffie_hellman_test.c
index 7a7462268..66dc8aa93 100644
--- a/Source/charon/testcases/diffie_hellman_test.c
+++ b/Source/testing/diffie_hellman_test.c
@@ -22,7 +22,7 @@
#include "diffie_hellman_test.h"
-#include "../transforms/diffie_hellman.h"
+#include <crypto/diffie_hellman.h>
#include <daemon.h>
#include <utils/logger_manager.h>
diff --git a/Source/charon/testcases/diffie_hellman_test.h b/Source/testing/diffie_hellman_test.h
index e6e3ff608..e6e3ff608 100644
--- a/Source/charon/testcases/diffie_hellman_test.h
+++ b/Source/testing/diffie_hellman_test.h
diff --git a/Source/charon/testcases/encryption_payload_test.c b/Source/testing/encryption_payload_test.c
index 45572374b..05945a3a8 100644
--- a/Source/charon/testcases/encryption_payload_test.c
+++ b/Source/testing/encryption_payload_test.c
@@ -29,8 +29,8 @@
#include <encoding/parser.h>
#include <encoding/payloads/encryption_payload.h>
#include <encoding/payloads/nonce_payload.h>
-#include <transforms/crypters/crypter.h>
-#include <transforms/signers/signer.h>
+#include <crypto/crypters/crypter.h>
+#include <crypto/signers/signer.h>
/*
* described in Header-File
diff --git a/Source/charon/testcases/encryption_payload_test.h b/Source/testing/encryption_payload_test.h
index 5e6353bfd..5e6353bfd 100644
--- a/Source/charon/testcases/encryption_payload_test.h
+++ b/Source/testing/encryption_payload_test.h
diff --git a/Source/charon/testcases/event_queue_test.c b/Source/testing/event_queue_test.c
index 5366dca07..5366dca07 100644
--- a/Source/charon/testcases/event_queue_test.c
+++ b/Source/testing/event_queue_test.c
diff --git a/Source/charon/testcases/event_queue_test.h b/Source/testing/event_queue_test.h
index 5f8c47fad..5f8c47fad 100644
--- a/Source/charon/testcases/event_queue_test.h
+++ b/Source/testing/event_queue_test.h
diff --git a/Source/charon/testcases/generator_test.c b/Source/testing/generator_test.c
index c611a3e6c..c611a3e6c 100644
--- a/Source/charon/testcases/generator_test.c
+++ b/Source/testing/generator_test.c
diff --git a/Source/charon/testcases/generator_test.h b/Source/testing/generator_test.h
index 204255fb7..204255fb7 100644
--- a/Source/charon/testcases/generator_test.h
+++ b/Source/testing/generator_test.h
diff --git a/Source/charon/testcases/hasher_test.c b/Source/testing/hasher_test.c
index e9df91258..e9df91258 100644
--- a/Source/charon/testcases/hasher_test.c
+++ b/Source/testing/hasher_test.c
diff --git a/Source/charon/testcases/hasher_test.h b/Source/testing/hasher_test.h
index 8590cabec..cc6fe52c8 100644
--- a/Source/charon/testcases/hasher_test.h
+++ b/Source/testing/hasher_test.h
@@ -23,9 +23,9 @@
#ifndef HASHER_TEST_H_
#define HASHER_TEST_H_
-#include <transforms/hashers/hasher.h>
-#include <transforms/hashers/md5_hasher.h>
-#include <transforms/hashers/sha1_hasher.h>
+#include <crypto/hashers/hasher.h>
+#include <crypto/hashers/md5_hasher.h>
+#include <crypto/hashers/sha1_hasher.h>
#include <utils/tester.h>
/**
diff --git a/Source/charon/testcases/hmac_signer_test.c b/Source/testing/hmac_signer_test.c
index 0cfbfdbd0..5dbe302a0 100644
--- a/Source/charon/testcases/hmac_signer_test.c
+++ b/Source/testing/hmac_signer_test.c
@@ -25,7 +25,7 @@
#include "hmac_signer_test.h"
-#include <transforms/signers/signer.h>
+#include <crypto/signers/signer.h>
#include <utils/allocator.h>
#include <daemon.h>
diff --git a/Source/charon/testcases/hmac_signer_test.h b/Source/testing/hmac_signer_test.h
index 4a2459a8e..4a2459a8e 100644
--- a/Source/charon/testcases/hmac_signer_test.h
+++ b/Source/testing/hmac_signer_test.h
diff --git a/Source/charon/testcases/hmac_test.c b/Source/testing/hmac_test.c
index 1ad17f659..e33315f77 100644
--- a/Source/charon/testcases/hmac_test.c
+++ b/Source/testing/hmac_test.c
@@ -24,7 +24,7 @@
#include "hmac_test.h"
-#include <transforms/hmac.h>
+#include <crypto/hmac.h>
#include <utils/allocator.h>
diff --git a/Source/charon/testcases/hmac_test.h b/Source/testing/hmac_test.h
index a61666e04..1eef93cd3 100644
--- a/Source/charon/testcases/hmac_test.h
+++ b/Source/testing/hmac_test.h
@@ -23,7 +23,7 @@
#ifndef HMAC_TEST_H_
#define HMAC_TEST_H_
-#include <transforms/hmac.h>
+#include <crypto/hmac.h>
#include <utils/tester.h>
/**
diff --git a/Source/charon/testcases/ike_sa_id_test.c b/Source/testing/ike_sa_id_test.c
index ba44363fb..ba44363fb 100644
--- a/Source/charon/testcases/ike_sa_id_test.c
+++ b/Source/testing/ike_sa_id_test.c
diff --git a/Source/charon/testcases/ike_sa_id_test.h b/Source/testing/ike_sa_id_test.h
index 75429e4fb..75429e4fb 100644
--- a/Source/charon/testcases/ike_sa_id_test.h
+++ b/Source/testing/ike_sa_id_test.h
diff --git a/Source/charon/testcases/ike_sa_manager_test.c b/Source/testing/ike_sa_manager_test.c
index 5247be7f0..5247be7f0 100644
--- a/Source/charon/testcases/ike_sa_manager_test.c
+++ b/Source/testing/ike_sa_manager_test.c
diff --git a/Source/charon/testcases/ike_sa_manager_test.h b/Source/testing/ike_sa_manager_test.h
index c3e9f99f1..c3e9f99f1 100644
--- a/Source/charon/testcases/ike_sa_manager_test.h
+++ b/Source/testing/ike_sa_manager_test.h
diff --git a/Source/charon/testcases/ike_sa_test.c b/Source/testing/ike_sa_test.c
index 798b5edc9..798b5edc9 100644
--- a/Source/charon/testcases/ike_sa_test.c
+++ b/Source/testing/ike_sa_test.c
diff --git a/Source/charon/testcases/ike_sa_test.h b/Source/testing/ike_sa_test.h
index e93bc34fd..e93bc34fd 100644
--- a/Source/charon/testcases/ike_sa_test.h
+++ b/Source/testing/ike_sa_test.h
diff --git a/Source/charon/testcases/job_queue_test.c b/Source/testing/job_queue_test.c
index e7c93b68c..e7c93b68c 100644
--- a/Source/charon/testcases/job_queue_test.c
+++ b/Source/testing/job_queue_test.c
diff --git a/Source/charon/testcases/job_queue_test.h b/Source/testing/job_queue_test.h
index f2d3edc4c..f2d3edc4c 100644
--- a/Source/charon/testcases/job_queue_test.h
+++ b/Source/testing/job_queue_test.h
diff --git a/Source/charon/testcases/kernel_interface_test.c b/Source/testing/kernel_interface_test.c
index 400531072..ca01cc876 100644
--- a/Source/charon/testcases/kernel_interface_test.c
+++ b/Source/testing/kernel_interface_test.c
@@ -27,7 +27,7 @@
#include <threads/kernel_interface.h>
#include <utils/allocator.h>
#include <utils/logger.h>
-#include <network/host.h>
+#include <utils/host.h>
/*
diff --git a/Source/charon/testcases/kernel_interface_test.h b/Source/testing/kernel_interface_test.h
index fc8dab4b6..fc8dab4b6 100644
--- a/Source/charon/testcases/kernel_interface_test.h
+++ b/Source/testing/kernel_interface_test.h
diff --git a/Source/charon/testcases/linked_list_test.c b/Source/testing/linked_list_test.c
index 3d5666f64..3d5666f64 100644
--- a/Source/charon/testcases/linked_list_test.c
+++ b/Source/testing/linked_list_test.c
diff --git a/Source/charon/testcases/linked_list_test.h b/Source/testing/linked_list_test.h
index a9773f8f0..a9773f8f0 100644
--- a/Source/charon/testcases/linked_list_test.h
+++ b/Source/testing/linked_list_test.h
diff --git a/Source/charon/testcases/packet_test.c b/Source/testing/packet_test.c
index 9ba099cd2..9ba099cd2 100644
--- a/Source/charon/testcases/packet_test.c
+++ b/Source/testing/packet_test.c
diff --git a/Source/charon/testcases/packet_test.h b/Source/testing/packet_test.h
index 8bc297e1b..8bc297e1b 100644
--- a/Source/charon/testcases/packet_test.h
+++ b/Source/testing/packet_test.h
diff --git a/Source/charon/testcases/parser_test.c b/Source/testing/parser_test.c
index 81a6556f3..81a6556f3 100644
--- a/Source/charon/testcases/parser_test.c
+++ b/Source/testing/parser_test.c
diff --git a/Source/charon/testcases/parser_test.h b/Source/testing/parser_test.h
index 4956df13e..4956df13e 100644
--- a/Source/charon/testcases/parser_test.h
+++ b/Source/testing/parser_test.h
diff --git a/Source/charon/testcases/policy_test.c b/Source/testing/policy_test.c
index d511f4ae4..d511f4ae4 100644
--- a/Source/charon/testcases/policy_test.c
+++ b/Source/testing/policy_test.c
diff --git a/Source/charon/testcases/policy_test.h b/Source/testing/policy_test.h
index 6c8072a9c..6c8072a9c 100644
--- a/Source/charon/testcases/policy_test.h
+++ b/Source/testing/policy_test.h
diff --git a/Source/charon/testcases/prf_plus_test.c b/Source/testing/prf_plus_test.c
index b91d84124..6773def87 100644
--- a/Source/charon/testcases/prf_plus_test.c
+++ b/Source/testing/prf_plus_test.c
@@ -24,7 +24,7 @@
#include "prf_plus_test.h"
-#include <transforms/prf_plus.h>
+#include <crypto/prf_plus.h>
#include <utils/allocator.h>
diff --git a/Source/charon/testcases/prf_plus_test.h b/Source/testing/prf_plus_test.h
index 702589d1e..2ad8ce0c1 100644
--- a/Source/charon/testcases/prf_plus_test.h
+++ b/Source/testing/prf_plus_test.h
@@ -23,7 +23,7 @@
#ifndef PRF_PLUS_TEST_H_
#define PRF_PLUS_TEST_H_
-#include <transforms/prf_plus.h>
+#include <crypto/prf_plus.h>
#include <utils/tester.h>
/**
diff --git a/Source/charon/testcases/proposal_test.c b/Source/testing/proposal_test.c
index 8df2bf403..8df2bf403 100644
--- a/Source/charon/testcases/proposal_test.c
+++ b/Source/testing/proposal_test.c
diff --git a/Source/charon/testcases/proposal_test.h b/Source/testing/proposal_test.h
index 059af11cc..059af11cc 100644
--- a/Source/charon/testcases/proposal_test.h
+++ b/Source/testing/proposal_test.h
diff --git a/Source/charon/testcases/receiver_test.c b/Source/testing/receiver_test.c
index ed93a9f44..ed93a9f44 100644
--- a/Source/charon/testcases/receiver_test.c
+++ b/Source/testing/receiver_test.c
diff --git a/Source/charon/testcases/receiver_test.h b/Source/testing/receiver_test.h
index 59b87df16..59b87df16 100644
--- a/Source/charon/testcases/receiver_test.h
+++ b/Source/testing/receiver_test.h
diff --git a/Source/charon/testcases/rsa_test.c b/Source/testing/rsa_test.c
index fcc3008d2..2b8015a51 100644
--- a/Source/charon/testcases/rsa_test.c
+++ b/Source/testing/rsa_test.c
@@ -27,7 +27,7 @@
#include <daemon.h>
#include <utils/allocator.h>
#include <utils/logger.h>
-#include <transforms/certificate.h>
+#include <crypto/certificate.h>
char private_key_buffer[] = {
0x30,0x82,0x04,0xa2,0x02,0x00,0x02,0x82,0x01,0x00,0x6f,0x25,0x74,0x63,0x2a,0x2f,
diff --git a/Source/charon/testcases/rsa_test.h b/Source/testing/rsa_test.h
index aba5b869c..baeccf402 100644
--- a/Source/charon/testcases/rsa_test.h
+++ b/Source/testing/rsa_test.h
@@ -23,8 +23,8 @@
#ifndef RSA_TEST_H
#define RSA_TEST_H
-#include <transforms/rsa/rsa_public_key.h>
-#include <transforms/rsa/rsa_private_key.h>
+#include <crypto/rsa/rsa_public_key.h>
+#include <crypto/rsa/rsa_private_key.h>
#include <utils/tester.h>
diff --git a/Source/charon/testcases/scheduler_test.c b/Source/testing/scheduler_test.c
index de7346d83..de7346d83 100644
--- a/Source/charon/testcases/scheduler_test.c
+++ b/Source/testing/scheduler_test.c
diff --git a/Source/charon/testcases/scheduler_test.h b/Source/testing/scheduler_test.h
index 746848e49..746848e49 100644
--- a/Source/charon/testcases/scheduler_test.h
+++ b/Source/testing/scheduler_test.h
diff --git a/Source/charon/testcases/send_queue_test.c b/Source/testing/send_queue_test.c
index a56f8e5a2..a56f8e5a2 100644
--- a/Source/charon/testcases/send_queue_test.c
+++ b/Source/testing/send_queue_test.c
diff --git a/Source/charon/testcases/send_queue_test.h b/Source/testing/send_queue_test.h
index 138657e10..138657e10 100644
--- a/Source/charon/testcases/send_queue_test.h
+++ b/Source/testing/send_queue_test.h
diff --git a/Source/charon/testcases/sender_test.c b/Source/testing/sender_test.c
index 003cf761e..003cf761e 100644
--- a/Source/charon/testcases/sender_test.c
+++ b/Source/testing/sender_test.c
diff --git a/Source/charon/testcases/sender_test.h b/Source/testing/sender_test.h
index 1fdfed69d..1fdfed69d 100644
--- a/Source/charon/testcases/sender_test.h
+++ b/Source/testing/sender_test.h
diff --git a/Source/charon/testcases/socket_test.c b/Source/testing/socket_test.c
index 360bf697c..360bf697c 100644
--- a/Source/charon/testcases/socket_test.c
+++ b/Source/testing/socket_test.c
diff --git a/Source/charon/testcases/socket_test.h b/Source/testing/socket_test.h
index a59995297..a59995297 100644
--- a/Source/charon/testcases/socket_test.h
+++ b/Source/testing/socket_test.h
diff --git a/Source/charon/testcases/testcases.c b/Source/testing/testcases.c
index 627ab6e88..c79680673 100644
--- a/Source/charon/testcases/testcases.c
+++ b/Source/testing/testcases.c
@@ -34,36 +34,36 @@
#include <utils/logger_manager.h>
#include <utils/allocator.h>
#include <utils/tester.h>
-#include <testcases/linked_list_test.h>
-#include <testcases/thread_pool_test.h>
-#include <testcases/job_queue_test.h>
-#include <testcases/event_queue_test.h>
-#include <testcases/send_queue_test.h>
-#include <testcases/socket_test.h>
-#include <testcases/sender_test.h>
-#include <testcases/scheduler_test.h>
-#include <testcases/receiver_test.h>
-#include <testcases/ike_sa_id_test.h>
-#include <testcases/ike_sa_test.h>
-#include <testcases/ike_sa_manager_test.h>
-#include <testcases/generator_test.h>
-#include <testcases/parser_test.h>
-#include <testcases/packet_test.h>
-#include <testcases/diffie_hellman_test.h>
-#include <testcases/hasher_test.h>
-#include <testcases/hmac_test.h>
-#include <testcases/prf_plus_test.h>
-#include <testcases/aes_cbc_crypter_test.h>
-#include <testcases/hmac_signer_test.h>
-#include <testcases/encryption_payload_test.h>
-#include <testcases/connection_test.h>
-#include <testcases/policy_test.h>
-#include <testcases/proposal_test.h>
-#include <testcases/rsa_test.h>
-#include <testcases/kernel_interface_test.h>
-#include <testcases/child_sa_test.h>
-#include <testcases/der_decoder_test.h>
-#include <testcases/certificate_test.h>
+#include "linked_list_test.h"
+#include "thread_pool_test.h"
+#include "job_queue_test.h"
+#include "event_queue_test.h"
+#include "send_queue_test.h"
+#include "socket_test.h"
+#include "sender_test.h"
+#include "scheduler_test.h"
+#include "receiver_test.h"
+#include "ike_sa_id_test.h"
+#include "ike_sa_test.h"
+#include "ike_sa_manager_test.h"
+#include "generator_test.h"
+#include "parser_test.h"
+#include "packet_test.h"
+#include "diffie_hellman_test.h"
+#include "hasher_test.h"
+#include "hmac_test.h"
+#include "prf_plus_test.h"
+#include "aes_cbc_crypter_test.h"
+#include "hmac_signer_test.h"
+#include "encryption_payload_test.h"
+#include "connection_test.h"
+#include "policy_test.h"
+#include "proposal_test.h"
+#include "rsa_test.h"
+#include "kernel_interface_test.h"
+#include "child_sa_test.h"
+#include "der_decoder_test.h"
+#include "certificate_test.h"
/* output for test messages */
extern FILE * stderr;
diff --git a/Source/charon/testcases/thread_pool_test.c b/Source/testing/thread_pool_test.c
index ee7a5101f..ee7a5101f 100644
--- a/Source/charon/testcases/thread_pool_test.c
+++ b/Source/testing/thread_pool_test.c
diff --git a/Source/charon/testcases/thread_pool_test.h b/Source/testing/thread_pool_test.h
index bdae797b7..bdae797b7 100644
--- a/Source/charon/testcases/thread_pool_test.h
+++ b/Source/testing/thread_pool_test.h