Browse Source

Implement unalgined tests.

tags/0.9.0
Vsevolod Stakhov 9 years ago
parent
commit
1c090ffdca
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      test/rspamd_cryptobox_test.c

+ 2
- 2
test/rspamd_cryptobox_test.c View File

#include "ottery.h" #include "ottery.h"
#include "cryptobox.h" #include "cryptobox.h"


static const int mapping_size = 64 * 8192;
static const int mapping_size = 64 * 8192 + 1;
static const int max_seg = 1024; static const int max_seg = 1024;


static void * static void *
map = mmap (NULL, mapping_len + psize * 3, PROT_READ|PROT_WRITE, map = mmap (NULL, mapping_len + psize * 3, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_SHARED, -1, 0); MAP_ANON|MAP_SHARED, -1, 0);
g_assert (map != 0); g_assert (map != 0);
memset (map, 0, mapping_len + psize * 3);
mprotect (map, psize, PROT_NONE); mprotect (map, psize, PROT_NONE);
/* Misalign pointer */ /* Misalign pointer */
*beg = ((guchar *)map) + psize + 1; *beg = ((guchar *)map) + psize + 1;
ottery_rand_bytes (nonce, sizeof (nonce)); ottery_rand_bytes (nonce, sizeof (nonce));


memset (mac, 0, sizeof (mac)); memset (mac, 0, sizeof (mac));
memset (begin, 0, end - begin);
seg = g_slice_alloc0 (sizeof (*seg) * max_seg); seg = g_slice_alloc0 (sizeof (*seg) * max_seg);


/* Test baseline */ /* Test baseline */

Loading…
Cancel
Save