From: Mats Klepsland Date: Mon, 7 Aug 2017 07:53:25 +0000 (+0200) Subject: unittests: initialize NSS in unittests runmode X-Git-Tag: suricata-4.1.0-beta1~567 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ab5d42c92ab55a6ea59d442d6c6a01e8282bbc6;p=thirdparty%2Fsuricata.git unittests: initialize NSS in unittests runmode Initialize NSS in unittests runmode when Suricata is compiled with libnss. Otherwise, calculating SHA-1 sums for TLS fingerprints will fail. --- diff --git a/src/runmode-unittests.c b/src/runmode-unittests.c index daceaf12ea..7a99aa93fd 100644 --- a/src/runmode-unittests.c +++ b/src/runmode-unittests.c @@ -122,6 +122,11 @@ #include "util-streaming-buffer.h" #include "util-lua.h" +#ifdef HAVE_NSS +#include +#include +#endif + #endif /* UNITTESTS */ void TmqhSetup (void); @@ -283,6 +288,13 @@ void RunUnittests(int list_unittests, const char *regex_arg) UtRunSelftest(regex_arg); /* inits and cleans up again */ } +#ifdef HAVE_NSS + /* init NSS for hashing */ + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); + NSS_NoDB_Init(NULL); +#endif + + AppLayerHtpEnableRequestBodyCallback(); AppLayerHtpNeedFileInspection();