summaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/base64/base64.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-29 14:54:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-29 14:54:48 +0100
commitf305fb7394a3e80a2487889834b37e4f66fe43e6 (patch)
treed59197aac3041c41a922bcf63c3ff1e6f98741a1 /src/libcryptobox/base64/base64.c
parent6ac7be499b330a26348253a80b082b744f346711 (diff)
downloadrspamd-f305fb7394a3e80a2487889834b37e4f66fe43e6.tar.gz
rspamd-f305fb7394a3e80a2487889834b37e4f66fe43e6.zip
[Feature] Add avx2 codec for base64
Diffstat (limited to 'src/libcryptobox/base64/base64.c')
-rw-r--r--src/libcryptobox/base64/base64.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcryptobox/base64/base64.c b/src/libcryptobox/base64/base64.c
index a0115cad3..a0a68d7d6 100644
--- a/src/libcryptobox/base64/base64.c
+++ b/src/libcryptobox/base64/base64.c
@@ -69,8 +69,21 @@ BASE64_DECLARE(sse42);
# endif
#endif
+#ifdef RSPAMD_HAS_TARGET_ATTR
+# if defined(HAVE_AVX2)
+int base64_decode_avx2 (const char *in, size_t inlen,
+ unsigned char *out, size_t *outlen) __attribute__((__target__("avx2")));
+
+BASE64_DECLARE(avx2);
+# define BASE64_AVX2 BASE64_IMPL(CPUID_AVX2, "avx2", avx2)
+# endif
+#endif
+
static const base64_impl_t base64_list[] = {
BASE64_REF,
+#ifdef BASE64_AVX2
+ BASE64_AVX2,
+#endif
#ifdef BASE64_SSE42
BASE64_SSE42,
#endif
@@ -118,6 +131,7 @@ base64_test (bool generic, size_t niters, size_t len)
impl = generic ? &base64_list[0] : base64_opt;
+ printf("hui: %s\n", impl->desc);
out = rspamd_encode_base64 (in, len, 0, &outlen);
impl->decode (out, outlen, tmp, &len);