summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am3
-rw-r--r--scripts/Makefile.in118
-rw-r--r--scripts/bin2array.c2
-rw-r--r--scripts/bin2sql.c2
-rw-r--r--scripts/dh_speed.c28
-rw-r--r--scripts/id2sql.c4
-rw-r--r--scripts/key2keyid.c50
-rw-r--r--scripts/keyid2sql.c49
-rw-r--r--scripts/pubkey_speed.c43
-rw-r--r--scripts/thread_analysis.c22
10 files changed, 183 insertions, 138 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index f8d62b3bc..24e3cd164 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,7 +1,6 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = \
--DIPSEC_PLUGINDIR=\"${plugindir}\" \
--DSTRONGSWAN_CONF=\"${strongswan_conf}\"
+-DPLUGINS="\"${libstrongswan_plugins}\""
noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql \
thread_analysis dh_speed pubkey_speed
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 63f0242fe..7d1af0803 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -38,11 +40,19 @@ noinst_PROGRAMS = bin2array$(EXEEXT) bin2sql$(EXEEXT) id2sql$(EXEEXT) \
subdir = scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
+ $(top_srcdir)/m4/config/ltoptions.m4 \
+ $(top_srcdir)/m4/config/ltsugar.m4 \
+ $(top_srcdir)/m4/config/ltversion.m4 \
+ $(top_srcdir)/m4/config/lt~obsolete.m4 \
+ $(top_srcdir)/m4/macros/with.m4 \
+ $(top_srcdir)/m4/macros/enable-disable.m4 \
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_bin2array_OBJECTS = bin2array.$(OBJEXT)
bin2array_OBJECTS = $(am_bin2array_OBJECTS)
@@ -76,6 +86,7 @@ thread_analysis_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@
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) \
@@ -128,25 +139,22 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IPSEC_ROUTING_TABLE = @IPSEC_ROUTING_TABLE@
-IPSEC_ROUTING_TABLE_PRIO = @IPSEC_ROUTING_TABLE_PRIO@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_HEADERS = @LINUX_HEADERS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MYSQLCFLAG = @MYSQLCFLAG@
+MYSQLCONFIG = @MYSQLCONFIG@
+MYSQLLIB = @MYSQLLIB@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
@@ -158,11 +166,14 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
+PTHREADLIB = @PTHREADLIB@
RANLIB = @RANLIB@
+RTLIB = @RTLIB@
RUBY = @RUBY@
RUBYINCLUDE = @RUBYINCLUDE@
SED = @SED@
@@ -191,9 +202,9 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
-confdir = @confdir@
datadir = @datadir@
datarootdir = @datarootdir@
+default_pkcs11 = @default_pkcs11@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
@@ -216,7 +227,7 @@ ipsecuser = @ipsecuser@
libdir = @libdir@
libexecdir = @libexecdir@
libstrongswan_plugins = @libstrongswan_plugins@
-linuxdir = @linuxdir@
+linux_headers = @linux_headers@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
@@ -224,6 +235,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
nm_CFLAGS = @nm_CFLAGS@
nm_LIBS = @nm_LIBS@
+nm_ca_dir = @nm_ca_dir@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
piddir = @piddir@
@@ -232,10 +244,12 @@ pluto_plugins = @pluto_plugins@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+random_device = @random_device@
resolv_conf = @resolv_conf@
+routing_table = @routing_table@
+routing_table_prio = @routing_table_prio@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-simreader = @simreader@
srcdir = @srcdir@
strongswan_conf = @strongswan_conf@
sysconfdir = @sysconfdir@
@@ -243,12 +257,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+urandom_device = @urandom_device@
xml_CFLAGS = @xml_CFLAGS@
xml_LIBS = @xml_LIBS@
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = \
--DIPSEC_PLUGINDIR=\"${plugindir}\" \
--DSTRONGSWAN_CONF=\"${strongswan_conf}\"
+-DPLUGINS="\"${libstrongswan_plugins}\""
bin2array_SOURCES = bin2array.c
bin2sql_SOURCES = bin2sql.c
@@ -276,9 +290,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu scripts/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu scripts/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -296,13 +310,16 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
- @list='$(noinst_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ 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)
@rm -f bin2array$(EXEEXT)
$(LINK) $(bin2array_OBJECTS) $(bin2array_LDADD) $(LIBS)
@@ -345,21 +362,21 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
@@ -382,7 +399,7 @@ tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -390,29 +407,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -433,13 +455,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -467,6 +493,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -488,6 +515,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -496,18 +525,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -545,6 +584,7 @@ uninstall-am:
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/scripts/bin2array.c b/scripts/bin2array.c
index 4778b446a..5e0ad7c74 100644
--- a/scripts/bin2array.c
+++ b/scripts/bin2array.c
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
{
break;
}
- }
+ }
printf("};\n");
return 0;
}
diff --git a/scripts/bin2sql.c b/scripts/bin2sql.c
index 4f83dd3f2..8bc72f842 100644
--- a/scripts/bin2sql.c
+++ b/scripts/bin2sql.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
break;
}
printf("%02x", (unsigned int)byte);
- }
+ }
printf("'\n");
return 0;
}
diff --git a/scripts/dh_speed.c b/scripts/dh_speed.c
index 76dafe752..b85bf1ad8 100644
--- a/scripts/dh_speed.c
+++ b/scripts/dh_speed.c
@@ -38,7 +38,7 @@ static void start_timing(struct timespec *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;
@@ -50,7 +50,7 @@ static void run_test(diffie_hellman_group_t group, int rounds)
chunk_t chunk;
struct timespec timing;
int round;
-
+
r = lib->crypto->create_dh(lib->crypto, group);
if (!r)
{
@@ -58,24 +58,24 @@ static void run_test(diffie_hellman_group_t group, int rounds)
diffie_hellman_group_names, group);
return;
}
-
+
printf("%N:\t",
diffie_hellman_group_names, group);
-
+
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
l[round] = lib->crypto->create_dh(lib->crypto, group);
}
printf("A = g^a/s: %8.1f", rounds / end_timing(&timing));
-
+
for (round = 0; round < rounds; round++)
{
l[round]->get_my_public_value(l[round], &chunk);
r->set_other_public_value(r, chunk);
chunk_free(&chunk);
}
-
+
r->get_my_public_value(r, &chunk);
start_timing(&timing);
for (round = 0; round < rounds; round++)
@@ -84,7 +84,7 @@ static void run_test(diffie_hellman_group_t group, int rounds)
}
printf(" | S = B^a/s: %8.1f\n", rounds / end_timing(&timing));
chunk_free(&chunk);
-
+
for (round = 0; round < rounds; round++)
{
l[round]->destroy(l[round]);
@@ -95,22 +95,22 @@ static void run_test(diffie_hellman_group_t group, int rounds)
int main(int argc, char *argv[])
{
int rounds, i, j;
-
+
if (argc < 4)
{
usage();
}
-
- library_init(STRONGSWAN_CONF);
- lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, argv[1]);
+
+ library_init(NULL);
+ lib->plugins->load(lib->plugins, NULL, argv[1]);
atexit(library_deinit);
-
+
rounds = atoi(argv[2]);
-
+
for (i = 3; i < argc; i++)
{
bool found = FALSE;
-
+
for (j = 0; j < countof(groups); j++)
{
if (streq(groups[j].name, argv[i]))
diff --git a/scripts/id2sql.c b/scripts/id2sql.c
index 5b0bd1d7d..5bc94f5b6 100644
--- a/scripts/id2sql.c
+++ b/scripts/id2sql.c
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
identification_t *id;
chunk_t enc;
int i;
-
+
if (argc < 2)
{
return -1;
@@ -29,7 +29,7 @@ int main(int argc, char *argv[])
for (i = 0; i < enc.len; i++)
{
printf("%02x", (unsigned int)enc.ptr[i]);
- }
+ }
printf("'\n");
return 0;
}
diff --git a/scripts/key2keyid.c b/scripts/key2keyid.c
index 201670e43..cd6ebc1ed 100644
--- a/scripts/key2keyid.c
+++ b/scripts/key2keyid.c
@@ -15,9 +15,9 @@ int main(int argc, char *argv[])
chunk_t chunk;
char buf[8096];
int read;
-
+
library_init(NULL);
- lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, "gmp pubkey sha1");
+ lib->plugins->load(lib->plugins, NULL, PLUGINS);
atexit(library_deinit);
read = fread(buf, 1, sizeof(buf), stdin);
@@ -26,32 +26,40 @@ int main(int argc, char *argv[])
fprintf(stderr, "reading key failed.\n");
return -1;
}
-
+
chunk = chunk_create(buf, read);
-
+
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
if (private)
{
printf("parsed %d bits %N private key.\n",
private->get_keysize(private)*8,
key_type_names, private->get_type(private));
- printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_INFO_SHA1,
- private->get_id(private, ID_PUBKEY_INFO_SHA1));
- printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_SHA1,
- private->get_id(private, ID_PUBKEY_SHA1));
+ if (private->get_fingerprint(private, KEY_ID_PUBKEY_INFO_SHA1, &chunk))
+ {
+ printf("subjectPublicKeyInfo keyid: %#B\n", &chunk);
+ }
+ if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &chunk))
+ {
+ printf("subjectPublicKey keyid: %#B\n", &chunk);
+ }
+ if (private->get_fingerprint(private, KEY_ID_PGPV3, &chunk))
+ {
+ printf("PGP verison 3 keyid: %#B\n", &chunk);
+ }
private->destroy(private);
return 0;
}
-
+
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
if (!public)
{
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
}
if (public)
@@ -59,14 +67,22 @@ int main(int argc, char *argv[])
printf("parsed %d bits %N public key.\n",
public->get_keysize(public)*8,
key_type_names, public->get_type(public));
- printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_INFO_SHA1,
- public->get_id(public, ID_PUBKEY_INFO_SHA1));
- printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_SHA1,
- public->get_id(public, ID_PUBKEY_SHA1));
+ if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &chunk))
+ {
+ printf("subjectPublicKeyInfo keyid: %#B\n", &chunk);
+ }
+ if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &chunk))
+ {
+ printf("subjectPublicKey keyid: %#B\n", &chunk);
+ }
+ if (public->get_fingerprint(public, KEY_ID_PGPV3, &chunk))
+ {
+ printf("PGP verison 3 keyid: %#B\n", &chunk);
+ }
public->destroy(public);
return 0;
}
-
+
fprintf(stderr, "unable to parse input key.\n");
return -1;
}
diff --git a/scripts/keyid2sql.c b/scripts/keyid2sql.c
index 588bd7ac0..2d17c273d 100644
--- a/scripts/keyid2sql.c
+++ b/scripts/keyid2sql.c
@@ -2,11 +2,9 @@
#include <stdio.h>
#include <library.h>
#include <debug.h>
-#include <utils/identification.h>
#include <credentials/keys/private_key.h>
#include <credentials/keys/public_key.h>
-
/**
* print the keyids of a private or public key in sql format
*/
@@ -14,13 +12,12 @@ int main(int argc, char *argv[])
{
public_key_t *public;
private_key_t *private;
- identification_t *keyid;
chunk_t chunk;
char buf[8096];
int read, n;
-
+
library_init(NULL);
- lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, "gmp pubkey sha1");
+ lib->plugins->load(lib->plugins, NULL, PLUGINS);
atexit(library_deinit);
read = fread(buf, 1, sizeof(buf), stdin);
@@ -29,51 +26,51 @@ int main(int argc, char *argv[])
fprintf(stderr, "reading key failed.\n");
return -1;
}
-
+
chunk = chunk_create(buf, read);
-
+
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
if (private)
{
- keyid = private->get_id(private, ID_PUBKEY_INFO_SHA1);
- chunk = keyid->get_encoding(keyid);
-
- printf("%d, X'", ID_PUBKEY_INFO_SHA1);
- for (n = 0; n < chunk.len; n++)
+ if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &chunk))
{
- printf("%.2x", chunk.ptr[n]);
+ printf("%d, X'", ID_KEY_ID);
+ for (n = 0; n < chunk.len; n++)
+ {
+ printf("%.2x", chunk.ptr[n]);
+ }
+ printf("'\n");
}
- printf("'\n");
private->destroy(private);
return 0;
}
-
+
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
if (!public)
{
public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
- BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+ BUILD_BLOB_PEM, chunk_clone(chunk),
BUILD_END);
}
if (public)
{
- keyid = public->get_id(public, ID_PUBKEY_INFO_SHA1);
- chunk = keyid->get_encoding(keyid);
-
- printf("%d, X'", ID_PUBKEY_INFO_SHA1);
- for (n = 0; n < chunk.len; n++)
+ if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &chunk))
{
- printf("%.2x", chunk.ptr[n]);
+ printf("%d, X'", ID_KEY_ID);
+ for (n = 0; n < chunk.len; n++)
+ {
+ printf("%.2x", chunk.ptr[n]);
+ }
+ printf("'\n");
}
- printf("'\n");
public->destroy(public);
return 0;
}
-
+
fprintf(stderr, "unable to parse input key.\n");
return -1;
}
diff --git a/scripts/pubkey_speed.c b/scripts/pubkey_speed.c
index 86a4e105b..255f650f5 100644
--- a/scripts/pubkey_speed.c
+++ b/scripts/pubkey_speed.c
@@ -4,7 +4,6 @@
#include <library.h>
#include <debug.h>
#include <credentials/keys/private_key.h>
-#include <asn1/pem.h>
void start_timing(struct timespec *start)
{
@@ -14,7 +13,7 @@ void start_timing(struct timespec *start)
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;
@@ -26,8 +25,6 @@ static void usage()
exit(1);
}
-static char data_buf[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07};
-
int main(int argc, char *argv[])
{
private_key_t *private;
@@ -37,15 +34,15 @@ int main(int argc, char *argv[])
char buf[8096], *pos = buf;
key_type_t type = KEY_ANY;
signature_scheme_t scheme = SIGN_UNKNOWN;
- chunk_t keydata, *sigs, data = chunk_from_buf(data_buf);
-
+ chunk_t keydata, *sigs, data;
+
if (argc < 4)
{
usage();
}
-
+
rounds = atoi(argv[3]);
-
+
if (streq(argv[2], "rsa"))
{
type = KEY_RSA;
@@ -59,25 +56,20 @@ int main(int argc, char *argv[])
{
usage();
}
-
- library_init(STRONGSWAN_CONF);
- lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, argv[1]);
+
+ library_init(NULL);
+ lib->plugins->load(lib->plugins, NULL, argv[1]);
atexit(library_deinit);
-
+
keydata = chunk_create(buf, 0);
while ((read = fread(pos, 1, sizeof(buf) - (pos - buf), stdin)))
{
pos += read;
keydata.len += read;
}
- if (pem_to_bin(&keydata, chunk_empty, NULL) != SUCCESS)
- {
- printf("converting PEM private key failed.\n");
- exit(1);
- }
-
+
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
- BUILD_BLOB_ASN1_DER, keydata, BUILD_END);
+ BUILD_BLOB_PEM, keydata, BUILD_END);
if (!private)
{
printf("parsing private key failed.\n");
@@ -88,7 +80,7 @@ int main(int argc, char *argv[])
switch (private->get_keysize(private))
{
case 32:
- scheme = SIGN_ECDSA_256;
+ scheme = SIGN_ECDSA_256;
break;
case 48:
scheme = SIGN_ECDSA_384;
@@ -102,12 +94,13 @@ int main(int argc, char *argv[])
exit(1);
}
}
-
+
printf("%4d bit %N: ", private->get_keysize(private)*8,
key_type_names, type);
-
+
sigs = malloc(sizeof(chunk_t) * rounds);
-
+
+ data = chunk_from_chars(0x01,0x02,0x03,0x04,0x05,0x06,0x07);
start_timing(&timing);
for (round = 0; round < rounds; round++)
{
@@ -118,7 +111,7 @@ int main(int argc, char *argv[])
}
};
printf("sign()/s: %8.1f ", rounds / end_timing(&timing));
-
+
public = private->get_public_key(private);
if (!public)
{
@@ -137,7 +130,7 @@ int main(int argc, char *argv[])
printf("verify()/s: %8.1f\n", rounds / end_timing(&timing));
public->destroy(public);
private->destroy(private);
-
+
for (round = 0; round < rounds; round++)
{
free(sigs[round].ptr);
diff --git a/scripts/thread_analysis.c b/scripts/thread_analysis.c
index 53cd04359..7670ce1f8 100644
--- a/scripts/thread_analysis.c
+++ b/scripts/thread_analysis.c
@@ -1,5 +1,5 @@
/* Analyzes the concurrent use of charon's threads
- *
+ *
* Copyright (C) 2008 Andreas Steffen
* Hochschule fuer Technik Rapperswil
*
@@ -52,7 +52,7 @@ static int readline(FILE *fd, char *line)
*line = '\0';
return 1;
}
- line++;
+ line++;
}
*line = '\0';
return 0;
@@ -69,14 +69,14 @@ static void printline(state_t *state, char *timestamp)
for (th = 1; th <= THREADS; th++)
{
states[state[th]]++;
- printf("<td class=\"%s\"></td>", state_names[state[th]]);
+ printf("<td class=\"%s\"></td>", state_names[state[th]]);
}
total = states[STATE_INIT] + states[STATE_AUTH] + states[STATE_BUSY] + states[STATE_RETRY];
printf("<td class=\"init\">%d</td><td class=\"auth\">%d</td><td class=\"busy\">%d</td>",
states[STATE_INIT], states[STATE_AUTH], total);
for (th = 10; th <= (THREADS + 2); th += 5)
{
- printf("<td class=\"%s\"></td>", (th <= total + 2)? "busy":"idle");
+ printf("<td class=\"%s\"></td>", (th <= total + 2)? "busy":"idle");
}
printf("\n");
printf(" </tr>\n");
@@ -91,13 +91,13 @@ int main(int argc, char *argv[])
FILE *fd;
state_t state[THREADS + 1];
-
+
/* threads 1..5 and 9 are always busy */
for (th = 1; th <= THREADS; th++)
{
state[th] = (th <= 7 && th != 3)? STATE_BUSY : STATE_IDLE;
}
-
+
/* open the log file */
fd = fopen(LOGFILE, "r");
if (!fd)
@@ -135,16 +135,16 @@ int main(int argc, char *argv[])
printf(" <td class=\"log\">Timestamp</td>");
for (th = 1 ; th <= THREADS; th++)
{
- printf("<td>%02d</td>", th);
+ printf("<td>%02d</td>", th);
}
printf("<td class=\"init\">I</td><td class=\"auth\">A</td><td class=\"busy\">B</td>");
for (th = 10; th <= (THREADS + 2); th += 5)
{
- printf("<td class=\"busy\">%d</td>", (th == 100)? 99:th);
+ printf("<td class=\"busy\">%d</td>", (th == 100)? 99:th);
}
printf("\n");
printf(" </tr>\n");
-
+
while (readline(fd, line))
{
char *p_section, *p_charon, *p_thread, *p_log;
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
{
continue;
}
-
+
/* determine thread */
p_thread = p_charon + 8;
th = atol(p_thread);
@@ -268,6 +268,6 @@ int main(int argc, char *argv[])
printf("</body>\n");
printf("</html>\n");
- fclose(fd);
+ fclose(fd);
return 0;
}