Browse Source

Init cryptobox library properly.

tags/0.9.0
Vsevolod Stakhov 9 years ago
parent
commit
e97b0030be
3 changed files with 5 additions and 1 deletions
  1. 1
    0
      src/libcryptobox/cryptobox.c
  2. 3
    0
      src/main.c
  3. 1
    1
      test/rspamd_http_test.c

+ 1
- 0
src/libcryptobox/cryptobox.c View File

@@ -87,6 +87,7 @@ rspamd_cryptobox_init (void)

rspamd_cryptobox_cpuid (cpu, 0);
nid = cpu[0];
rspamd_cryptobox_cpuid (cpu, 1);

if (nid > 1) {
if ((cpu[3] & ((gint)1 << 26))) {

+ 3
- 0
src/main.c View File

@@ -35,6 +35,7 @@
#include "xxhash.h"
#include "utlist.h"
#include "libstat/stat_api.h"
#include "cryptobox.h"
#ifdef HAVE_OPENSSL
#include <openssl/rand.h>
#include <openssl/err.h>
@@ -1139,6 +1140,8 @@ rspamd_init_libs (void)
struct rlimit rlim;

ottery_init (NULL);

rspamd_cryptobox_init ();
#ifdef HAVE_SETLOCALE
/* Set locale setting to C locale to avoid problems in future */
setlocale (LC_ALL, "C");

+ 1
- 1
test/rspamd_http_test.c View File

@@ -167,10 +167,10 @@ rspamd_http_test_func (void)
GString *b32_key;
double diff, total_diff = 0.0;

rspamd_cryptobox_init ();
rspamd_snprintf (filepath, sizeof (filepath), "/tmp/http-test-XXXXXX");
g_assert ((fd = mkstemp (filepath)) != -1);


for (i = 0; i < file_blocks; i ++) {
memset (buf, 0, sizeof (buf));
g_assert (write (fd, buf, sizeof (buf)) == sizeof (buf));

Loading…
Cancel
Save