#endif
+#ifndef RSPAMD_ALIGNED
+#if defined(_MSC_VER)
+# define RSPAMD_ALIGNED(x) __declspec(align(x))
+#elif defined(__GNUC__)
+# define RSPAMD_ALIGNED(x) __attribute__((aligned(x)))
+#else
+# define RSPAMD_ALIGNED(x)
+#endif
+#endif
+
+
+
#cmakedefine HAVE_SYS_QUEUE_H 1
#cmakedefine HAVE_SYS_MMAN_H 1
#cmakedefine HAVE_SYS_SOCKET_H 1
#ifndef PARAM_H_HAS_BITSET
/* Bit map related macros. */
-#define NBBY 8 /* number of bits in a byte */
+#ifndef NBBY
+# define NBBY 8 /* number of bits in a byte */
+#endif
#define setbit(a, \
i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY))
#define clrbit(a, \
#define ottery_state_nolock ottery_state
-struct __attribute__((aligned(16))) ottery_state {
+struct RSPAMD_ALIGNED(16) ottery_state {
/**
* Holds up to prf.output_len bytes that have been generated by the
* pseudorandom function. */
- __attribute__ ((aligned (16))) uint8_t buffer[MAX_OUTPUT_LEN];
+ uint8_t buffer[MAX_OUTPUT_LEN] RSPAMD_ALIGNED(16);
/**
* Holds the state information (typically nonces and keys) used by the
* pseudorandom function. */
- __attribute__ ((aligned (16))) uint8_t state[MAX_STATE_LEN];
+ uint8_t state[MAX_STATE_LEN] RSPAMD_ALIGNED(16);
/**
* Parameters and function pointers for the cryptographic pseudorandom
* function that we're using. */
#include <string.h>
#endif
+#include "config.h"
#include "cryptobox.h"
#include "platform_config.h"
#include "chacha20/chacha.h"
#include <cpuid.h>
#endif
-
-#ifndef ALIGNED
-#if defined(_MSC_VER)
-# define ALIGNED(x) __declspec(align(x))
-#else
-# define ALIGNED(x) __attribute__((aligned(x)))
-#endif
-#endif
-
unsigned long cpu_config = 0;
static const guchar n0[16] = {0};
const rspamd_nm_t nm, rspamd_sig_t sig)
{
poly1305_state mac_ctx;
- guchar ALIGNED(32) subkey[CHACHA_BLOCKBYTES];
+ guchar RSPAMD_ALIGNED(32) subkey[CHACHA_BLOCKBYTES];
chacha_state s;
gsize r;
const rspamd_nm_t nm, rspamd_sig_t sig)
{
struct rspamd_cryptobox_segment *cur = segments, *start_seg = segments;
- guchar ALIGNED(32) subkey[CHACHA_BLOCKBYTES],
+ guchar RSPAMD_ALIGNED(32) subkey[CHACHA_BLOCKBYTES],
outbuf[CHACHA_BLOCKBYTES * 16];
poly1305_state mac_ctx;
guchar *out, *in;
const rspamd_nonce_t nonce, const rspamd_nm_t nm, const rspamd_sig_t sig)
{
poly1305_state mac_ctx;
- guchar ALIGNED(32) subkey[CHACHA_BLOCKBYTES];
+ guchar RSPAMD_ALIGNED(32) subkey[CHACHA_BLOCKBYTES];
rspamd_sig_t mac;
chacha_state s;
gsize r;
rc = pcre_config (PCRE_CONFIG_JIT, &jit);
if (rc == 0 && jit == 1) {
+#ifdef PCRE_CONFIG_JITTARGET
pcre_config (PCRE_CONFIG_JITTARGET, &str);
-
msg_info ("pcre is compiled with JIT for %s", str);
+#else
+ msg_info ("pcre is compiled with JIT for unknown target");
+#endif
can_jit = TRUE;
}