diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 16 | ||||
-rw-r--r-- | scripts/Makefile.in | 236 | ||||
-rw-r--r-- | scripts/bin2array.c | 14 | ||||
-rw-r--r-- | scripts/bin2sql.c | 14 | ||||
-rw-r--r-- | scripts/crypt_burn.c | 49 | ||||
-rw-r--r-- | scripts/dh_speed.c | 18 | ||||
-rw-r--r-- | scripts/dnssec.c | 142 | ||||
-rw-r--r-- | scripts/fetch.c | 4 | ||||
-rw-r--r-- | scripts/hash_burn.c | 74 | ||||
-rw-r--r-- | scripts/id2sql.c | 14 | ||||
-rw-r--r-- | scripts/key2keyid.c | 18 | ||||
-rw-r--r-- | scripts/keyid2sql.c | 18 | ||||
-rw-r--r-- | scripts/malloc_speed.c | 85 | ||||
-rw-r--r-- | scripts/oid2der.c | 14 | ||||
-rw-r--r-- | scripts/pubkey_speed.c | 4 | ||||
-rw-r--r-- | scripts/tls_test.c | 65 |
16 files changed, 679 insertions, 106 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 5f303be17..06d4609cf 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,9 +1,11 @@ -INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtls -AM_CFLAGS = \ --DPLUGINS="\"${scripts_plugins}\"" +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/libstrongswan \ + -I$(top_srcdir)/src/libtls \ + -DPLUGINS="\"${scripts_plugins}\"" noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql oid2der \ - thread_analysis dh_speed pubkey_speed crypt_burn fetch + thread_analysis dh_speed pubkey_speed crypt_burn hash_burn fetch \ + dnssec malloc_speed if USE_TLS noinst_PROGRAMS += tls_test @@ -22,7 +24,10 @@ thread_analysis_SOURCES = thread_analysis.c dh_speed_SOURCES = dh_speed.c pubkey_speed_SOURCES = pubkey_speed.c crypt_burn_SOURCES = crypt_burn.c +hash_burn_SOURCES = hash_burn.c +malloc_speed_SOURCES = malloc_speed.c fetch_SOURCES = fetch.c +dnssec_SOURCES = dnssec.c id2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la key2keyid_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la keyid2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la @@ -30,7 +35,10 @@ oid2der_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la dh_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lrt pubkey_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lrt crypt_burn_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +hash_burn_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +malloc_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la fetch_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +dnssec_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la key2keyid.o : $(top_builddir)/config.status diff --git a/scripts/Makefile.in b/scripts/Makefile.in index f16ca8735..6808d2436 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,7 +54,8 @@ host_triplet = @host@ noinst_PROGRAMS = bin2array$(EXEEXT) bin2sql$(EXEEXT) id2sql$(EXEEXT) \ key2keyid$(EXEEXT) keyid2sql$(EXEEXT) oid2der$(EXEEXT) \ thread_analysis$(EXEEXT) dh_speed$(EXEEXT) \ - pubkey_speed$(EXEEXT) crypt_burn$(EXEEXT) fetch$(EXEEXT) \ + pubkey_speed$(EXEEXT) crypt_burn$(EXEEXT) hash_burn$(EXEEXT) \ + fetch$(EXEEXT) dnssec$(EXEEXT) malloc_speed$(EXEEXT) \ $(am__EXEEXT_1) @USE_TLS_TRUE@am__append_1 = tls_test subdir = scripts @@ -51,10 +69,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \ $(top_srcdir)/m4/macros/with.m4 \ $(top_srcdir)/m4/macros/enable-disable.m4 \ $(top_srcdir)/m4/macros/add-plugin.m4 \ - $(top_srcdir)/configure.in + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @USE_TLS_TRUE@am__EXEEXT_1 = tls_test$(EXEEXT) @@ -62,6 +81,9 @@ PROGRAMS = $(noinst_PROGRAMS) am_bin2array_OBJECTS = bin2array.$(OBJEXT) bin2array_OBJECTS = $(am_bin2array_OBJECTS) bin2array_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent am_bin2sql_OBJECTS = bin2sql.$(OBJEXT) bin2sql_OBJECTS = $(am_bin2sql_OBJECTS) bin2sql_LDADD = $(LDADD) @@ -73,10 +95,18 @@ am_dh_speed_OBJECTS = dh_speed.$(OBJEXT) dh_speed_OBJECTS = $(am_dh_speed_OBJECTS) dh_speed_DEPENDENCIES = \ $(top_builddir)/src/libstrongswan/libstrongswan.la +am_dnssec_OBJECTS = dnssec.$(OBJEXT) +dnssec_OBJECTS = $(am_dnssec_OBJECTS) +dnssec_DEPENDENCIES = \ + $(top_builddir)/src/libstrongswan/libstrongswan.la am_fetch_OBJECTS = fetch.$(OBJEXT) fetch_OBJECTS = $(am_fetch_OBJECTS) fetch_DEPENDENCIES = \ $(top_builddir)/src/libstrongswan/libstrongswan.la +am_hash_burn_OBJECTS = hash_burn.$(OBJEXT) +hash_burn_OBJECTS = $(am_hash_burn_OBJECTS) +hash_burn_DEPENDENCIES = \ + $(top_builddir)/src/libstrongswan/libstrongswan.la am_id2sql_OBJECTS = id2sql.$(OBJEXT) id2sql_OBJECTS = $(am_id2sql_OBJECTS) id2sql_DEPENDENCIES = \ @@ -89,6 +119,10 @@ am_keyid2sql_OBJECTS = keyid2sql.$(OBJEXT) keyid2sql_OBJECTS = $(am_keyid2sql_OBJECTS) keyid2sql_DEPENDENCIES = \ $(top_builddir)/src/libstrongswan/libstrongswan.la +am_malloc_speed_OBJECTS = malloc_speed.$(OBJEXT) +malloc_speed_OBJECTS = $(am_malloc_speed_OBJECTS) +malloc_speed_DEPENDENCIES = \ + $(top_builddir)/src/libstrongswan/libstrongswan.la am_oid2der_OBJECTS = oid2der.$(OBJEXT) oid2der_OBJECTS = $(am_oid2der_OBJECTS) oid2der_DEPENDENCIES = \ @@ -105,50 +139,79 @@ am__tls_test_SOURCES_DIST = tls_test.c tls_test_OBJECTS = $(am_tls_test_OBJECTS) @USE_TLS_TRUE@tls_test_DEPENDENCIES = $(top_builddir)/src/libstrongswan/libstrongswan.la \ @USE_TLS_TRUE@ $(top_builddir)/src/libtls/libtls.la -DEFAULT_INCLUDES = -I.@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(bin2array_SOURCES) $(bin2sql_SOURCES) \ - $(crypt_burn_SOURCES) $(dh_speed_SOURCES) $(fetch_SOURCES) \ - $(id2sql_SOURCES) $(key2keyid_SOURCES) $(keyid2sql_SOURCES) \ - $(oid2der_SOURCES) $(pubkey_speed_SOURCES) \ - $(thread_analysis_SOURCES) $(tls_test_SOURCES) + $(crypt_burn_SOURCES) $(dh_speed_SOURCES) $(dnssec_SOURCES) \ + $(fetch_SOURCES) $(hash_burn_SOURCES) $(id2sql_SOURCES) \ + $(key2keyid_SOURCES) $(keyid2sql_SOURCES) \ + $(malloc_speed_SOURCES) $(oid2der_SOURCES) \ + $(pubkey_speed_SOURCES) $(thread_analysis_SOURCES) \ + $(tls_test_SOURCES) DIST_SOURCES = $(bin2array_SOURCES) $(bin2sql_SOURCES) \ - $(crypt_burn_SOURCES) $(dh_speed_SOURCES) $(fetch_SOURCES) \ - $(id2sql_SOURCES) $(key2keyid_SOURCES) $(keyid2sql_SOURCES) \ - $(oid2der_SOURCES) $(pubkey_speed_SOURCES) \ - $(thread_analysis_SOURCES) $(am__tls_test_SOURCES_DIST) + $(crypt_burn_SOURCES) $(dh_speed_SOURCES) $(dnssec_SOURCES) \ + $(fetch_SOURCES) $(hash_burn_SOURCES) $(id2sql_SOURCES) \ + $(key2keyid_SOURCES) $(keyid2sql_SOURCES) \ + $(malloc_speed_SOURCES) $(oid2der_SOURCES) \ + $(pubkey_speed_SOURCES) $(thread_analysis_SOURCES) \ + $(am__tls_test_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BFDLIB = @BFDLIB@ BTLIB = @BTLIB@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLIB = @DLLIB@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -157,13 +220,16 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GPERF = @GPERF@ +GPRBUILD = @GPRBUILD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ @@ -176,6 +242,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MYSQLCFLAG = @MYSQLCFLAG@ MYSQLCONFIG = @MYSQLCONFIG@ @@ -203,11 +270,13 @@ RANLIB = @RANLIB@ RTLIB = @RTLIB@ RUBY = @RUBY@ RUBYINCLUDE = @RUBYINCLUDE@ +RUBYLIB = @RUBYLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKLIB = @SOCKLIB@ STRIP = @STRIP@ +UNWINDLIB = @UNWINDLIB@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ @@ -215,6 +284,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -223,8 +293,6 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ attest_plugins = @attest_plugins@ -axis2c_CFLAGS = @axis2c_CFLAGS@ -axis2c_LIBS = @axis2c_LIBS@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -233,14 +301,19 @@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ c_plugins = @c_plugins@ +charon_natt_port = @charon_natt_port@ +charon_plugins = @charon_plugins@ +charon_udp_port = @charon_udp_port@ clearsilver_LIBS = @clearsilver_LIBS@ +cmd_plugins = @cmd_plugins@ datadir = @datadir@ datarootdir = @datarootdir@ dbusservicedir = @dbusservicedir@ -default_pkcs11 = @default_pkcs11@ +dev_headers = @dev_headers@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +fips_mode = @fips_mode@ gtk_CFLAGS = @gtk_CFLAGS@ gtk_LIBS = @gtk_LIBS@ h_plugins = @h_plugins@ @@ -254,17 +327,17 @@ imcvdir = @imcvdir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +ipsec_script = @ipsec_script@ +ipsec_script_upper = @ipsec_script_upper@ ipsecdir = @ipsecdir@ ipsecgroup = @ipsecgroup@ ipseclibdir = @ipseclibdir@ ipsecuser = @ipsecuser@ -libcharon_plugins = @libcharon_plugins@ libdir = @libdir@ libexecdir = @libexecdir@ linux_headers = @linux_headers@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ maemo_CFLAGS = @maemo_CFLAGS@ maemo_LIBS = @maemo_LIBS@ manager_plugins = @manager_plugins@ @@ -274,16 +347,15 @@ mkdir_p = @mkdir_p@ nm_CFLAGS = @nm_CFLAGS@ nm_LIBS = @nm_LIBS@ nm_ca_dir = @nm_ca_dir@ +nm_plugins = @nm_plugins@ oldincludedir = @oldincludedir@ openac_plugins = @openac_plugins@ -p_plugins = @p_plugins@ pcsclite_CFLAGS = @pcsclite_CFLAGS@ pcsclite_LIBS = @pcsclite_LIBS@ pdfdir = @pdfdir@ piddir = @piddir@ pki_plugins = @pki_plugins@ plugindir = @plugindir@ -pluto_plugins = @pluto_plugins@ pool_plugins = @pool_plugins@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -311,9 +383,10 @@ top_srcdir = @top_srcdir@ urandom_device = @urandom_device@ xml_CFLAGS = @xml_CFLAGS@ xml_LIBS = @xml_LIBS@ -INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtls -AM_CFLAGS = \ --DPLUGINS="\"${scripts_plugins}\"" +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/libstrongswan \ + -I$(top_srcdir)/src/libtls \ + -DPLUGINS="\"${scripts_plugins}\"" @USE_TLS_TRUE@tls_test_SOURCES = tls_test.c @USE_TLS_TRUE@tls_test_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la \ @@ -329,7 +402,10 @@ thread_analysis_SOURCES = thread_analysis.c dh_speed_SOURCES = dh_speed.c pubkey_speed_SOURCES = pubkey_speed.c crypt_burn_SOURCES = crypt_burn.c +hash_burn_SOURCES = hash_burn.c +malloc_speed_SOURCES = malloc_speed.c fetch_SOURCES = fetch.c +dnssec_SOURCES = dnssec.c id2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la key2keyid_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la keyid2sql_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la @@ -337,7 +413,10 @@ oid2der_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la dh_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lrt pubkey_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lrt crypt_burn_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +hash_burn_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +malloc_speed_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la fetch_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la +dnssec_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la all: all-am .SUFFIXES: @@ -381,42 +460,51 @@ clean-noinstPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -bin2array$(EXEEXT): $(bin2array_OBJECTS) $(bin2array_DEPENDENCIES) +bin2array$(EXEEXT): $(bin2array_OBJECTS) $(bin2array_DEPENDENCIES) $(EXTRA_bin2array_DEPENDENCIES) @rm -f bin2array$(EXEEXT) - $(LINK) $(bin2array_OBJECTS) $(bin2array_LDADD) $(LIBS) -bin2sql$(EXEEXT): $(bin2sql_OBJECTS) $(bin2sql_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(bin2array_OBJECTS) $(bin2array_LDADD) $(LIBS) +bin2sql$(EXEEXT): $(bin2sql_OBJECTS) $(bin2sql_DEPENDENCIES) $(EXTRA_bin2sql_DEPENDENCIES) @rm -f bin2sql$(EXEEXT) - $(LINK) $(bin2sql_OBJECTS) $(bin2sql_LDADD) $(LIBS) -crypt_burn$(EXEEXT): $(crypt_burn_OBJECTS) $(crypt_burn_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(bin2sql_OBJECTS) $(bin2sql_LDADD) $(LIBS) +crypt_burn$(EXEEXT): $(crypt_burn_OBJECTS) $(crypt_burn_DEPENDENCIES) $(EXTRA_crypt_burn_DEPENDENCIES) @rm -f crypt_burn$(EXEEXT) - $(LINK) $(crypt_burn_OBJECTS) $(crypt_burn_LDADD) $(LIBS) -dh_speed$(EXEEXT): $(dh_speed_OBJECTS) $(dh_speed_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(crypt_burn_OBJECTS) $(crypt_burn_LDADD) $(LIBS) +dh_speed$(EXEEXT): $(dh_speed_OBJECTS) $(dh_speed_DEPENDENCIES) $(EXTRA_dh_speed_DEPENDENCIES) @rm -f dh_speed$(EXEEXT) - $(LINK) $(dh_speed_OBJECTS) $(dh_speed_LDADD) $(LIBS) -fetch$(EXEEXT): $(fetch_OBJECTS) $(fetch_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(dh_speed_OBJECTS) $(dh_speed_LDADD) $(LIBS) +dnssec$(EXEEXT): $(dnssec_OBJECTS) $(dnssec_DEPENDENCIES) $(EXTRA_dnssec_DEPENDENCIES) + @rm -f dnssec$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(dnssec_OBJECTS) $(dnssec_LDADD) $(LIBS) +fetch$(EXEEXT): $(fetch_OBJECTS) $(fetch_DEPENDENCIES) $(EXTRA_fetch_DEPENDENCIES) @rm -f fetch$(EXEEXT) - $(LINK) $(fetch_OBJECTS) $(fetch_LDADD) $(LIBS) -id2sql$(EXEEXT): $(id2sql_OBJECTS) $(id2sql_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(fetch_OBJECTS) $(fetch_LDADD) $(LIBS) +hash_burn$(EXEEXT): $(hash_burn_OBJECTS) $(hash_burn_DEPENDENCIES) $(EXTRA_hash_burn_DEPENDENCIES) + @rm -f hash_burn$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(hash_burn_OBJECTS) $(hash_burn_LDADD) $(LIBS) +id2sql$(EXEEXT): $(id2sql_OBJECTS) $(id2sql_DEPENDENCIES) $(EXTRA_id2sql_DEPENDENCIES) @rm -f id2sql$(EXEEXT) - $(LINK) $(id2sql_OBJECTS) $(id2sql_LDADD) $(LIBS) -key2keyid$(EXEEXT): $(key2keyid_OBJECTS) $(key2keyid_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(id2sql_OBJECTS) $(id2sql_LDADD) $(LIBS) +key2keyid$(EXEEXT): $(key2keyid_OBJECTS) $(key2keyid_DEPENDENCIES) $(EXTRA_key2keyid_DEPENDENCIES) @rm -f key2keyid$(EXEEXT) - $(LINK) $(key2keyid_OBJECTS) $(key2keyid_LDADD) $(LIBS) -keyid2sql$(EXEEXT): $(keyid2sql_OBJECTS) $(keyid2sql_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(key2keyid_OBJECTS) $(key2keyid_LDADD) $(LIBS) +keyid2sql$(EXEEXT): $(keyid2sql_OBJECTS) $(keyid2sql_DEPENDENCIES) $(EXTRA_keyid2sql_DEPENDENCIES) @rm -f keyid2sql$(EXEEXT) - $(LINK) $(keyid2sql_OBJECTS) $(keyid2sql_LDADD) $(LIBS) -oid2der$(EXEEXT): $(oid2der_OBJECTS) $(oid2der_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(keyid2sql_OBJECTS) $(keyid2sql_LDADD) $(LIBS) +malloc_speed$(EXEEXT): $(malloc_speed_OBJECTS) $(malloc_speed_DEPENDENCIES) $(EXTRA_malloc_speed_DEPENDENCIES) + @rm -f malloc_speed$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(malloc_speed_OBJECTS) $(malloc_speed_LDADD) $(LIBS) +oid2der$(EXEEXT): $(oid2der_OBJECTS) $(oid2der_DEPENDENCIES) $(EXTRA_oid2der_DEPENDENCIES) @rm -f oid2der$(EXEEXT) - $(LINK) $(oid2der_OBJECTS) $(oid2der_LDADD) $(LIBS) -pubkey_speed$(EXEEXT): $(pubkey_speed_OBJECTS) $(pubkey_speed_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(oid2der_OBJECTS) $(oid2der_LDADD) $(LIBS) +pubkey_speed$(EXEEXT): $(pubkey_speed_OBJECTS) $(pubkey_speed_DEPENDENCIES) $(EXTRA_pubkey_speed_DEPENDENCIES) @rm -f pubkey_speed$(EXEEXT) - $(LINK) $(pubkey_speed_OBJECTS) $(pubkey_speed_LDADD) $(LIBS) -thread_analysis$(EXEEXT): $(thread_analysis_OBJECTS) $(thread_analysis_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(pubkey_speed_OBJECTS) $(pubkey_speed_LDADD) $(LIBS) +thread_analysis$(EXEEXT): $(thread_analysis_OBJECTS) $(thread_analysis_DEPENDENCIES) $(EXTRA_thread_analysis_DEPENDENCIES) @rm -f thread_analysis$(EXEEXT) - $(LINK) $(thread_analysis_OBJECTS) $(thread_analysis_LDADD) $(LIBS) -tls_test$(EXEEXT): $(tls_test_OBJECTS) $(tls_test_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(thread_analysis_OBJECTS) $(thread_analysis_LDADD) $(LIBS) +tls_test$(EXEEXT): $(tls_test_OBJECTS) $(tls_test_DEPENDENCIES) $(EXTRA_tls_test_DEPENDENCIES) @rm -f tls_test$(EXEEXT) - $(LINK) $(tls_test_OBJECTS) $(tls_test_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(tls_test_OBJECTS) $(tls_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -428,35 +516,38 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bin2sql.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt_burn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dh_speed.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnssec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fetch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash_burn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id2sql.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key2keyid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyid2sql.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc_speed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oid2der.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pubkey_speed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_analysis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -560,10 +651,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/scripts/bin2array.c b/scripts/bin2array.c index 5e0ad7c74..b82391a12 100644 --- a/scripts/bin2array.c +++ b/scripts/bin2array.c @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2008 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. + */ #include <stdio.h> diff --git a/scripts/bin2sql.c b/scripts/bin2sql.c index ce5e600a3..88edb7f7a 100644 --- a/scripts/bin2sql.c +++ b/scripts/bin2sql.c @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2008 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. + */ #include <stdio.h> diff --git a/scripts/crypt_burn.c b/scripts/crypt_burn.c index 5c41b191b..8101f9cbd 100644 --- a/scripts/crypt_burn.c +++ b/scripts/crypt_burn.c @@ -1,7 +1,20 @@ +/* + * Copyright (C) 2010 Martin Willi + * Copyright (C) 2010 revosec AG + * + * 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. + */ #include <stdio.h> #include <library.h> -#include <crypto/proposal/proposal_keywords.h> int main(int argc, char *argv[]) { @@ -14,7 +27,7 @@ int main(int argc, char *argv[]) library_init(NULL); - lib->plugins->load(lib->plugins, NULL, PLUGINS); + lib->plugins->load(lib->plugins, PLUGINS); atexit(library_deinit); printf("loaded: %s\n", PLUGINS); @@ -33,7 +46,7 @@ int main(int argc, char *argv[]) limit = atoi(argv[2]); } - token = proposal_get_token(argv[1], strlen(argv[1])); + token = lib->proposal->get_token(lib->proposal, argv[1]); if (!token) { fprintf(stderr, "algorithm '%s' unknown!\n", argv[1]); @@ -56,10 +69,14 @@ int main(int argc, char *argv[]) } while (TRUE) { - aead->encrypt(aead, + if (!aead->encrypt(aead, chunk_create(buffer, sizeof(buffer) - aead->get_icv_size(aead)), chunk_from_thing(assoc), - chunk_create(iv, aead->get_iv_size(aead)), NULL); + chunk_create(iv, aead->get_iv_size(aead)), NULL)) + { + fprintf(stderr, "aead encryption failed!\n"); + return 1; + } if (!aead->decrypt(aead, chunk_create(buffer, sizeof(buffer)), chunk_from_thing(assoc), chunk_create(iv, aead->get_iv_size(aead)), NULL)) @@ -72,6 +89,7 @@ int main(int argc, char *argv[]) break; } } + aead->destroy(aead); } else { @@ -84,19 +102,26 @@ int main(int argc, char *argv[]) } bs = crypter->get_block_size(crypter); - while (i--) + while (TRUE) { - crypter->encrypt(crypter, - chunk_create(buffer, sizeof(buffer) / bs * bs), - chunk_create(iv, crypter->get_iv_size(crypter)), NULL); - crypter->decrypt(crypter, - chunk_create(buffer, sizeof(buffer) / bs * bs), - chunk_create(iv, crypter->get_iv_size(crypter)), NULL); + if (!crypter->encrypt(crypter, + chunk_create(buffer, sizeof(buffer) / bs * bs), + chunk_create(iv, crypter->get_iv_size(crypter)), NULL)) + { + continue; + } + if (!crypter->decrypt(crypter, + chunk_create(buffer, sizeof(buffer) / bs * bs), + chunk_create(iv, crypter->get_iv_size(crypter)), NULL)) + { + continue; + } if (limit && ++i == limit) { break; } } + crypter->destroy(crypter); } return 0; } diff --git a/scripts/dh_speed.c b/scripts/dh_speed.c index ce102491b..dc0a2870f 100644 --- a/scripts/dh_speed.c +++ b/scripts/dh_speed.c @@ -1,8 +1,22 @@ +/* + * Copyright (C) 2009 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. + */ #include <stdio.h> #include <time.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> #include <crypto/diffie_hellman.h> static void usage() @@ -105,7 +119,7 @@ int main(int argc, char *argv[]) } library_init(NULL); - lib->plugins->load(lib->plugins, NULL, argv[1]); + lib->plugins->load(lib->plugins, argv[1]); atexit(library_deinit); rounds = atoi(argv[2]); diff --git a/scripts/dnssec.c b/scripts/dnssec.c new file mode 100644 index 000000000..0cddfc47e --- /dev/null +++ b/scripts/dnssec.c @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2011-2012 Reto Guadagnini + * 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. + */ + +#include <stdio.h> + +#include <library.h> +#include <utils/debug.h> + +/** + * Define debug level + */ +static level_t dbg_level = 1; + +static void dbg_dnssec(debug_t group, level_t level, char *fmt, ...) +{ + if ((level <= dbg_level) || level <= 1) + { + va_list args; + + va_start(args, fmt); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + va_end(args); + } +} + +int main(int argc, char *argv[]) +{ + resolver_t *resolver; + resolver_response_t *response; + enumerator_t *enumerator; + chunk_t rdata; + rr_set_t *rrset; + rr_t *rr; + + library_init(NULL); + atexit(library_deinit); + + dbg = dbg_dnssec; + + if (!lib->plugins->load(lib->plugins, PLUGINS)) + { + return 1; + } + if (argc != 2) + { + fprintf(stderr, "usage: dnssec <name>\n"); + return 1; + } + + resolver = lib->resolver->create(lib->resolver); + if (!resolver) + { + printf("failed to create a resolver!\n"); + return 1; + } + + response = resolver->query(resolver, argv[1], RR_CLASS_IN, RR_TYPE_A); + if (!response) + { + printf("no response received!\n"); + resolver->destroy(resolver); + return 1; + } + + printf("DNS response:\n"); + if (!response->has_data(response) || !response->query_name_exist(response)) + { + if (!response->has_data(response)) + { + printf(" no data in the response\n"); + } + if (!response->query_name_exist(response)) + { + printf(" query name does not exist\n"); + } + response->destroy(response); + resolver->destroy(resolver); + return 1; + } + + printf(" RRs in the response:\n"); + rrset = response->get_rr_set(response); + if (!rrset) + { + printf(" response contains no RRset!\n"); + response->destroy(response); + resolver->destroy(resolver); + return 1; + } + + enumerator = rrset->create_rr_enumerator(rrset); + while (enumerator->enumerate(enumerator, &rr)) + { + printf(" name: %s\n", rr->get_name(rr)); + } + + enumerator = rrset->create_rrsig_enumerator(rrset); + if (enumerator) + { + printf(" RRSIGs for the RRset:\n"); + while (enumerator->enumerate(enumerator, &rr)) + { + rdata = rr->get_rdata(rr); + + printf(" name: %s\n", rr->get_name(rr)); + printf(" RDATA: %#B\n", &rdata); + } + } + + printf(" security status of the response: "); + switch (response->get_security_state(response)) + { + case SECURE: + printf("SECURE\n\n"); + break; + case INSECURE: + printf("INSECURE\n\n"); + break; + case BOGUS: + printf("BOGUS\n\n"); + break; + case INDETERMINATE: + printf("INDETERMINATE\n\n"); + break; + } + response->destroy(response); + resolver->destroy(resolver); + return 0; +} diff --git a/scripts/fetch.c b/scripts/fetch.c index ad50d0cd6..f58b37f89 100644 --- a/scripts/fetch.c +++ b/scripts/fetch.c @@ -17,7 +17,7 @@ #include <unistd.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> static int count = 0; @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) library_init(NULL); atexit(library_deinit); - lib->plugins->load(lib->plugins, NULL, PLUGINS); + lib->plugins->load(lib->plugins, PLUGINS); if (argc != 3 || (!streq(argv[1], "a") && !streq(argv[1], "s"))) { diff --git a/scripts/hash_burn.c b/scripts/hash_burn.c new file mode 100644 index 000000000..20e5642d4 --- /dev/null +++ b/scripts/hash_burn.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 Martin Willi + * Copyright (C) 2012 revosec AG + * + * 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. + */ + +#include <stdio.h> +#include <library.h> + + + +int main(int argc, char *argv[]) +{ + hash_algorithm_t alg; + hasher_t *hasher; + char buffer[1024]; + int limit = 0, i = 0; + + library_init(NULL); + lib->plugins->load(lib->plugins, PLUGINS); + atexit(library_deinit); + + printf("loaded: %s\n", PLUGINS); + + memset(buffer, 0x12, sizeof(buffer)); + + if (argc < 2) + { + fprintf(stderr, "usage: %s <algorithm>!\n", argv[0]); + return 1; + } + if (argc > 2) + { + limit = atoi(argv[2]); + } + + alg = enum_from_name(hash_algorithm_short_names, argv[1]); + if (alg == -1) + { + fprintf(stderr, "unknown hash algorthm: %s\n", argv[1]); + return 1; + } + hasher = lib->crypto->create_hasher(lib->crypto, alg); + if (!hasher) + { + fprintf(stderr, "hash algorthm not supported: %N\n", + hash_algorithm_names, alg); + return 1; + } + + while (TRUE) + { + if (!hasher->get_hash(hasher, chunk_from_thing(buffer), buffer)) + { + fprintf(stderr, "hashing failed!\n"); + return 1; + } + if (limit && ++i == limit) + { + break; + } + } + hasher->destroy(hasher); + return 0; +} diff --git a/scripts/id2sql.c b/scripts/id2sql.c index 5bc94f5b6..0742c1c71 100644 --- a/scripts/id2sql.c +++ b/scripts/id2sql.c @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2008 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. + */ #include <stdio.h> #include <utils/identification.h> diff --git a/scripts/key2keyid.c b/scripts/key2keyid.c index 6a8301c6a..31f3bee82 100644 --- a/scripts/key2keyid.c +++ b/scripts/key2keyid.c @@ -1,7 +1,21 @@ +/* + * Copyright (C) 2008-2009 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. + */ #include <stdio.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> #include <credentials/keys/private_key.h> #include <credentials/keys/public_key.h> @@ -17,7 +31,7 @@ int main(int argc, char *argv[]) int read; library_init(NULL); - lib->plugins->load(lib->plugins, NULL, PLUGINS); + lib->plugins->load(lib->plugins, PLUGINS); atexit(library_deinit); read = fread(buf, 1, sizeof(buf), stdin); diff --git a/scripts/keyid2sql.c b/scripts/keyid2sql.c index e37303c08..6e9a1334e 100644 --- a/scripts/keyid2sql.c +++ b/scripts/keyid2sql.c @@ -1,7 +1,21 @@ +/* + * Copyright (C) 2008 Andreas Steffen + * 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. + */ #include <stdio.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> #include <credentials/keys/private_key.h> #include <credentials/keys/public_key.h> @@ -17,7 +31,7 @@ int main(int argc, char *argv[]) int read, n; library_init(NULL); - lib->plugins->load(lib->plugins, NULL, PLUGINS); + lib->plugins->load(lib->plugins, PLUGINS); atexit(library_deinit); read = fread(buf, 1, sizeof(buf), stdin); diff --git a/scripts/malloc_speed.c b/scripts/malloc_speed.c new file mode 100644 index 000000000..85d51a281 --- /dev/null +++ b/scripts/malloc_speed.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2013 Martin Willi + * Copyright (C) 2013 revosec aG + * + * 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. + */ + +#include <stdio.h> +#include <time.h> +#include <library.h> +#include <utils/debug.h> + +#ifdef HAVE_MALLINFO +#include <malloc.h> +#endif /* HAVE_MALLINFO */ + +static void start_timing(struct timespec *start) +{ + clock_gettime(CLOCK_THREAD_CPUTIME_ID, start); +} + +static double end_timing(struct timespec *start) +{ + struct timespec end; + + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end); + return (end.tv_nsec - start->tv_nsec) / 1000000000.0 + + (end.tv_sec - start->tv_sec) * 1.0; +} + +static void print_mallinfo() +{ +#ifdef HAVE_MALLINFO + struct mallinfo mi = mallinfo(); + + printf("malloc: sbrk %d, mmap %d, used %d, free %d\n", + mi.arena, mi.hblkhd, mi.uordblks, mi.fordblks); +#endif /* HAVE_MALLINFO */ +} + +#define ALLOCS 1024 +#define ROUNDS 2048 + +int main(int argc, char *argv[]) +{ + struct timespec timing; + int i, round; + void *m[ALLOCS]; + /* a random set of allocations we test */ + int sizes[16] = { 1, 13, 100, 1000, 16, 10000, 50, 17, + 123, 32, 8, 64, 8096, 1024, 123, 9 }; + + library_init(NULL); + atexit(library_deinit); + + print_mallinfo(); + + start_timing(&timing); + + for (round = 0; round < ROUNDS; round++) + { + for (i = 0; i < ALLOCS; i++) + { + m[i] = malloc(sizes[(round + i) % countof(sizes)]); + } + for (i = 0; i < ALLOCS; i++) + { + free(m[i]); + } + } + printf("time for %d malloc/frees, repeating %d rounds: %.4fs\n", + ALLOCS, ROUNDS, end_timing(&timing)); + + print_mallinfo(); + + return 0; +} diff --git a/scripts/oid2der.c b/scripts/oid2der.c index 0da3bbb62..793c9804a 100644 --- a/scripts/oid2der.c +++ b/scripts/oid2der.c @@ -1,3 +1,17 @@ +/* + * Copyright (C) 2010 Martin Willi + * Copyright (C) 2010 revosec AG + * + * 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. + */ #include <stdio.h> #include <asn1/asn1.h> diff --git a/scripts/pubkey_speed.c b/scripts/pubkey_speed.c index 6402e606d..ba3ad1f5e 100644 --- a/scripts/pubkey_speed.c +++ b/scripts/pubkey_speed.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <time.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> #include <credentials/keys/private_key.h> void start_timing(struct timespec *start) @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) } library_init(NULL); - lib->plugins->load(lib->plugins, NULL, argv[1]); + lib->plugins->load(lib->plugins, argv[1]); atexit(library_deinit); keydata = chunk_create(buf, 0); diff --git a/scripts/tls_test.c b/scripts/tls_test.c index 560c4a4ba..e1e8ca82b 100644 --- a/scripts/tls_test.c +++ b/scripts/tls_test.c @@ -22,9 +22,9 @@ #include <string.h> #include <library.h> -#include <debug.h> +#include <utils/debug.h> #include <tls_socket.h> -#include <utils/host.h> +#include <networking/host.h> #include <credentials/sets/mem_cred.h> /** @@ -33,15 +33,59 @@ static void usage(FILE *out, char *cmd) { fprintf(out, "usage:\n"); - fprintf(out, " %s --connect <address> --port <port> [--cert <file>]+ [--times <n>]\n", cmd); + fprintf(out, " %s --connect <address> --port <port> [--key <key] [--cert <file>]+ [--times <n>]\n", cmd); fprintf(out, " %s --listen <address> --port <port> --key <key> [--cert <file>]+ [--times <n>]\n", cmd); } /** + * Check, as client, if we have a client certificate with private key + */ +static identification_t *find_client_id() +{ + identification_t *client = NULL, *keyid; + enumerator_t *enumerator; + certificate_t *cert; + public_key_t *pubkey; + private_key_t *privkey; + chunk_t chunk; + + enumerator = lib->credmgr->create_cert_enumerator(lib->credmgr, + CERT_X509, KEY_ANY, NULL, FALSE); + while (enumerator->enumerate(enumerator, &cert)) + { + pubkey = cert->get_public_key(cert); + if (pubkey) + { + if (pubkey->get_fingerprint(pubkey, KEYID_PUBKEY_SHA1, &chunk)) + { + keyid = identification_create_from_encoding(ID_KEY_ID, chunk); + privkey = lib->credmgr->get_private(lib->credmgr, + pubkey->get_type(pubkey), keyid, NULL); + keyid->destroy(keyid); + if (privkey) + { + client = cert->get_subject(cert); + client = client->clone(client); + privkey->destroy(privkey); + } + } + pubkey->destroy(pubkey); + } + if (client) + { + break; + } + } + enumerator->destroy(enumerator); + + return client; +} + +/** * Client routine */ -static int client(host_t *host, identification_t *server, - int times, tls_cache_t *cache) +static int run_client(host_t *host, identification_t *server, + identification_t *client, int times, tls_cache_t *cache) { tls_socket_t *tls; int fd, res; @@ -61,7 +105,7 @@ static int client(host_t *host, identification_t *server, close(fd); return 1; } - tls = tls_socket_create(FALSE, server, NULL, fd, cache); + tls = tls_socket_create(FALSE, server, client, fd, cache); if (!tls) { close(fd); @@ -211,7 +255,7 @@ static void init() dbg = dbg_tls; - lib->plugins->load(lib->plugins, NULL, PLUGINS); + lib->plugins->load(lib->plugins, PLUGINS); creds = mem_cred_create(); lib->credmgr->add_set(lib->credmgr, &creds->set); @@ -224,7 +268,7 @@ int main(int argc, char *argv[]) char *address = NULL; bool listen = FALSE; int port = 0, times = -1, res; - identification_t *server; + identification_t *server, *client; tls_cache_t *cache; host_t *host; @@ -307,11 +351,12 @@ int main(int argc, char *argv[]) } else { - res = client(host, server, times, cache); + client = find_client_id(); + res = run_client(host, server, client, times, cache); + DESTROY_IF(client); } cache->destroy(cache); host->destroy(host); server->destroy(server); return res; } - |