summaryrefslogtreecommitdiff
path: root/src/checksum/checksum_builder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/checksum/checksum_builder.c')
-rw-r--r--src/checksum/checksum_builder.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/checksum/checksum_builder.c b/src/checksum/checksum_builder.c
index dc1de99c3..670ec76bd 100644
--- a/src/checksum/checksum_builder.c
+++ b/src/checksum/checksum_builder.c
@@ -19,6 +19,8 @@
#include <dlfcn.h>
#include <library.h>
+#include <hydra.h>
+#include <daemon.h>
#include <utils/enumerator.h>
/* we need to fake the pluto symbol to dlopen() the xauth plugin */
@@ -62,16 +64,16 @@ static void build_checksum(char *path, char *name, char *sname)
fprintf(stderr, "dlopen failed: %s\n", dlerror());
}
}
- printf("\t{\"%-20s%7u, 0x%08x, %6u, 0x%08x},\n",
+ printf("\t{\"%-25s%7u, 0x%08x, %6u, 0x%08x},\n",
name, fsize, fsum, ssize, ssum);
- fprintf(stderr, "\"%-20s%7u / 0x%08x %6u / 0x%08x\n",
+ fprintf(stderr, "\"%-25s%7u / 0x%08x %6u / 0x%08x\n",
name, fsize, fsum, ssize, ssum);
}
/**
- * Build checksums for a set of plugins in a given path prefix
+ * Build checksums for a set of plugins
*/
-static void build_plugin_checksums(char *plugins, char *prefix)
+static void build_plugin_checksums(char *plugins)
{
enumerator_t *enumerator;
char *plugin, path[256], under[128], sname[128], name[128];
@@ -81,8 +83,8 @@ static void build_plugin_checksums(char *plugins, char *prefix)
{
snprintf(under, sizeof(under), "%s", plugin);
translate(under, "-", "_");
- snprintf(path, sizeof(path), "%s/%s/.libs/libstrongswan-%s.so",
- prefix, under, plugin);
+ snprintf(path, sizeof(path), "%s/libstrongswan-%s.so",
+ PLUGINDIR, plugin);
snprintf(sname, sizeof(sname), "%s_plugin_create", under);
snprintf(name, sizeof(name), "%s\",", plugin);
build_checksum(path, name, sname);
@@ -127,9 +129,15 @@ int main(int argc, char* argv[])
{
int i;
+ /* forces link against libhydra/libcharon, imports symbols needed to
+ * dlopen plugins */
+ hydra = NULL;
+ charon = NULL;
+
/* avoid confusing leak reports in build process */
setenv("LEAK_DETECTIVE_DISABLE", "1", 0);
- library_init(NULL);
+ /* don't use a strongswan.conf, forces integrity check to disabled */
+ library_init("");
atexit(library_deinit);
integrity = integrity_checker_create(NULL);
@@ -143,15 +151,24 @@ int main(int argc, char* argv[])
printf("\n");
printf("integrity_checksum_t checksums[] = {\n");
fprintf(stderr, "integrity test data:\n");
- fprintf(stderr, "module name, file size / checksum segment size / checksum\n");
+ fprintf(stderr, "module name, file size / checksum "
+ "segment size / checksum\n");
for (i = 1; i < argc; i++)
{
build_binary_checksum(argv[i]);
}
- build_plugin_checksums(S_PLUGINS, S_PATH);
- build_plugin_checksums(H_PLUGINS, H_PATH);
- build_plugin_checksums(P_PLUGINS, P_PATH);
- build_plugin_checksums(C_PLUGINS, C_PATH);
+#ifdef S_PLUGINS
+ build_plugin_checksums(S_PLUGINS);
+#endif
+#ifdef H_PLUGINS
+ build_plugin_checksums(H_PLUGINS);
+#endif
+#ifdef P_PLUGINS
+ build_plugin_checksums(P_PLUGINS);
+#endif
+#ifdef C_PLUGINS
+ build_plugin_checksums(C_PLUGINS);
+#endif
printf("};\n");
printf("\n");