summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/chapoly
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libstrongswan/plugins/chapoly
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libstrongswan/plugins/chapoly')
-rw-r--r--src/libstrongswan/plugins/chapoly/Makefile.in27
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_aead.c8
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c42
-rw-r--r--src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c66
4 files changed, 79 insertions, 64 deletions
diff --git a/src/libstrongswan/plugins/chapoly/Makefile.in b/src/libstrongswan/plugins/chapoly/Makefile.in
index b3506587d..d5b77a990 100644
--- a/src/libstrongswan/plugins/chapoly/Makefile.in
+++ b/src/libstrongswan/plugins/chapoly/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,17 @@
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -80,8 +90,6 @@ build_triplet = @build@
host_triplet = @host@
@MONOLITHIC_TRUE@am__append_1 = libstrongswan-chapoly.la
subdir = src/libstrongswan/plugins/chapoly
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
$(top_srcdir)/m4/config/ltoptions.m4 \
@@ -95,6 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/config/libtool.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -215,12 +224,14 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
+ATOMICLIB = @ATOMICLIB@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -270,6 +281,7 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -304,6 +316,7 @@ PTHREADLIB = @PTHREADLIB@
PYTHON = @PYTHON@
PYTHONEGGINSTALLDIR = @PYTHONEGGINSTALLDIR@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PACKAGE_VERSION = @PYTHON_PACKAGE_VERSION@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
@@ -415,6 +428,7 @@ random_device = @random_device@
resolv_conf = @resolv_conf@
routing_table = @routing_table@
routing_table_prio = @routing_table_prio@
+runstatedir = @runstatedir@
s_plugins = @s_plugins@
sbindir = @sbindir@
scepclient_plugins = @scepclient_plugins@
@@ -479,7 +493,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/libstrongswan/plugins/chapoly/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/libstrongswan/plugins/chapoly/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -806,6 +819,8 @@ uninstall-am: uninstall-pluginLTLIBRARIES
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pluginLTLIBRARIES
+.PRECIOUS: Makefile
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_aead.c b/src/libstrongswan/plugins/chapoly/chapoly_aead.c
index 50ad84b21..39d51e9f8 100644
--- a/src/libstrongswan/plugins/chapoly/chapoly_aead.c
+++ b/src/libstrongswan/plugins/chapoly/chapoly_aead.c
@@ -84,8 +84,8 @@ static bool poly_head(private_chapoly_aead_t *this, u_char *assoc, size_t len)
static bool poly_tail(private_chapoly_aead_t *this, size_t alen, size_t clen)
{
struct {
- u_int64_t alen;
- u_int64_t clen;
+ uint64_t alen;
+ uint64_t clen;
} b;
b.alen = htole64(alen);
@@ -190,7 +190,7 @@ METHOD(aead_t, encrypt, bool,
{
u_char *out;
- if (sizeof(plain.len) > sizeof(u_int32_t) && plain.len > P_MAX)
+ if (sizeof(plain.len) > sizeof(uint32_t) && plain.len > P_MAX)
{
return FALSE;
}
@@ -220,7 +220,7 @@ METHOD(aead_t, decrypt, bool,
return FALSE;
}
encr.len -= POLY_ICV_SIZE;
- if (sizeof(encr.len) > sizeof(u_int32_t) && encr.len > P_MAX)
+ if (sizeof(encr.len) > sizeof(uint32_t) && encr.len > P_MAX)
{
return FALSE;
}
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c b/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c
index dfed4d53d..59962b819 100644
--- a/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c
+++ b/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c
@@ -39,30 +39,30 @@ struct private_chapoly_drv_portable_t {
/**
* ChaCha20 state matrix
*/
- u_int32_t m[16];
+ uint32_t m[16];
/**
* Poly1305 update key
*/
- u_int32_t r[5];
+ uint32_t r[5];
/**
* Poly1305 state
*/
- u_int32_t h[5];
+ uint32_t h[5];
/**
* Poly1305 finalize key
*/
- u_int32_t s[4];
+ uint32_t s[4];
};
/**
* XOR a 32-bit integer into an unaligned destination
*/
-static inline void xor32u(void *p, u_int32_t x)
+static inline void xor32u(void *p, uint32_t x)
{
- u_int32_t y;
+ uint32_t y;
memcpy(&y, p, sizeof(y));
y ^= x;
@@ -72,7 +72,7 @@ static inline void xor32u(void *p, u_int32_t x)
/**
* Multiply two 64-bit words
*/
-static inline u_int64_t mlt(u_int64_t a, u_int64_t b)
+static inline uint64_t mlt(uint64_t a, uint64_t b)
{
return a * b;
}
@@ -80,7 +80,7 @@ static inline u_int64_t mlt(u_int64_t a, u_int64_t b)
/**
* Shift a 64-bit unsigned integer v right by n bits, clamp to 32 bit
*/
-static inline u_int32_t sr(u_int64_t v, u_char n)
+static inline uint32_t sr(uint64_t v, u_char n)
{
return v >> n;
}
@@ -88,13 +88,13 @@ static inline u_int32_t sr(u_int64_t v, u_char n)
/**
* Circular left shift by n bits
*/
-static inline u_int32_t rotl32(u_int32_t v, u_char n)
+static inline uint32_t rotl32(uint32_t v, u_char n)
{
return (v << n) | (v >> (sizeof(v) * 8 - n));
}
/**
- * AND two values, using a native integer size >= sizeof(u_int32_t)
+ * AND two values, using a native integer size >= sizeof(uint32_t)
*/
static inline u_long and(u_long v, u_long mask)
{
@@ -106,8 +106,8 @@ static inline u_long and(u_long v, u_long mask)
*/
static void chacha_block_xor(private_chapoly_drv_portable_t *this, void *data)
{
- u_int32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf;
- u_int32_t *out = data;
+ uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf;
+ uint32_t *out = data;
u_int i;
x0 = this->m[ 0];
@@ -246,10 +246,10 @@ METHOD(chapoly_drv_t, init, bool,
METHOD(chapoly_drv_t, poly, bool,
private_chapoly_drv_portable_t *this, u_char *data, u_int blocks)
{
- u_int32_t r0, r1, r2, r3, r4;
- u_int32_t s1, s2, s3, s4;
- u_int32_t h0, h1, h2, h3, h4;
- u_int64_t d0, d1, d2, d3, d4;
+ uint32_t r0, r1, r2, r3, r4;
+ uint32_t s1, s2, s3, s4;
+ uint32_t h0, h1, h2, h3, h4;
+ uint64_t d0, d1, d2, d3, d4;
u_int i;
r0 = this->r[0];
@@ -345,10 +345,10 @@ METHOD(chapoly_drv_t, decrypt, bool,
METHOD(chapoly_drv_t, finish, bool,
private_chapoly_drv_portable_t *this, u_char *mac)
{
- u_int32_t h0, h1, h2, h3, h4;
- u_int32_t g0, g1, g2, g3, g4;
- u_int32_t mask;
- u_int64_t f = 0;
+ uint32_t h0, h1, h2, h3, h4;
+ uint32_t g0, g1, g2, g3, g4;
+ uint32_t mask;
+ uint64_t f = 0;
/* fully carry h */
h0 = this->h[0];
@@ -371,7 +371,7 @@ METHOD(chapoly_drv_t, finish, bool,
g4 = h4 + (g3 >> 26) - (1 << 26); g3 &= 0x3ffffff;
/* select h if h < p, or h + -p if h >= p */
- mask = (g4 >> ((sizeof(u_int32_t) * 8) - 1)) - 1;
+ mask = (g4 >> ((sizeof(uint32_t) * 8) - 1)) - 1;
g0 &= mask;
g1 &= mask;
g2 &= mask;
diff --git a/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c b/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c
index df88e7d77..3981ed522 100644
--- a/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c
+++ b/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c
@@ -45,30 +45,30 @@ struct private_chapoly_drv_ssse3_t {
/**
* Poly1305 update key
*/
- u_int32_t r[5];
+ uint32_t r[5];
/**
* Poly1305 update key r^2
*/
- u_int32_t u[5];
+ uint32_t u[5];
/**
* Poly1305 state
*/
- u_int32_t h[5];
+ uint32_t h[5];
/**
* Poly1305 finalize key
*/
- u_int32_t s[4];
+ uint32_t s[4];
};
/**
* Read a 32-bit integer from an unaligned address
*/
-static inline u_int32_t ru32(void *p)
+static inline uint32_t ru32(void *p)
{
- u_int32_t ret;
+ uint32_t ret;
memcpy(&ret, p, sizeof(ret));
return ret;
@@ -77,7 +77,7 @@ static inline u_int32_t ru32(void *p)
/**
* Write a 32-bit word to an unaligned address
*/
-static inline void wu32(void *p, u_int32_t v)
+static inline void wu32(void *p, uint32_t v)
{
memcpy(p, &v, sizeof(v));
}
@@ -85,13 +85,13 @@ static inline void wu32(void *p, u_int32_t v)
/**
* Shift a 64-bit unsigned integer v right by n bits, clamp to 32 bit
*/
-static inline u_int32_t sr(u_int64_t v, u_char n)
+static inline uint32_t sr(uint64_t v, u_char n)
{
return v >> n;
}
/**
- * AND two values, using a native integer size >= sizeof(u_int32_t)
+ * AND two values, using a native integer size >= sizeof(uint32_t)
*/
static inline u_long and(u_long v, u_long mask)
{
@@ -189,7 +189,7 @@ static void chacha_4block_xor(private_chapoly_drv_ssse3_t *this, void *data)
{
__m128i x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf;
__m128i r8, r16, ctrinc, t, *out = data;
- u_int32_t *m = (u_int32_t*)this->m;
+ uint32_t *m = (uint32_t*)this->m;
u_int i;
r8 = _mm_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3);
@@ -364,7 +364,7 @@ METHOD(chapoly_drv_t, set_key, bool,
/**
* r[127:64] = h[95:64] * a, r[63:0] = h[31:0] * b
*/
-static inline __m128i mul2(__m128i h, u_int32_t a, u_int32_t b)
+static inline __m128i mul2(__m128i h, uint32_t a, uint32_t b)
{
return _mm_mul_epu32(h, _mm_set_epi32(0, a, 0, b));
}
@@ -374,7 +374,7 @@ static inline __m128i mul2(__m128i h, u_int32_t a, u_int32_t b)
* z = x[127:64] + x[63:0] + y[127:64] + y[63:0]
*/
static inline void sum2(__m128i a, __m128i b, __m128i x, __m128i y,
- u_int64_t *c, u_int64_t *z)
+ uint64_t *c, uint64_t *z)
{
__m128i r, s;
@@ -392,10 +392,10 @@ static inline void sum2(__m128i a, __m128i b, __m128i x, __m128i y,
* r = a[127:64] + b[127:64] + c[127:64] + d[127:64] + e[127:64]
* + a[63:0] + b[63:0] + c[63:0] + d[63:0] + e[63:0]
*/
-static inline u_int64_t sum5(__m128i a, __m128i b, __m128i c,
+static inline uint64_t sum5(__m128i a, __m128i b, __m128i c,
__m128i d, __m128i e)
{
- u_int64_t r;
+ uint64_t r;
a = _mm_add_epi64(a, b);
c = _mm_add_epi64(c, d);
@@ -414,10 +414,10 @@ static inline u_int64_t sum5(__m128i a, __m128i b, __m128i c,
static void make_u(private_chapoly_drv_ssse3_t *this)
{
__m128i r01, r23, r44, x0, x1, y0, y1, z0;
- u_int32_t r0, r1, r2, r3, r4;
- u_int32_t u0, u1, u2, u3, u4;
- u_int32_t s1, s2, s3, s4;
- u_int64_t d0, d1, d2, d3, d4;
+ uint32_t r0, r1, r2, r3, r4;
+ uint32_t u0, u1, u2, u3, u4;
+ uint32_t s1, s2, s3, s4;
+ uint64_t d0, d1, d2, d3, d4;
r0 = this->r[0];
r1 = this->r[1];
@@ -513,12 +513,12 @@ METHOD(chapoly_drv_t, init, bool,
*/
static void poly2(private_chapoly_drv_ssse3_t *this, u_char *data, u_int dblks)
{
- u_int32_t r0, r1, r2, r3, r4, u0, u1, u2, u3, u4;
- u_int32_t s1, s2, s3, s4, v1, v2, v3, v4;
+ uint32_t r0, r1, r2, r3, r4, u0, u1, u2, u3, u4;
+ uint32_t s1, s2, s3, s4, v1, v2, v3, v4;
__m128i hc0, hc1, hc2, hc3, hc4;
- u_int32_t h0, h1, h2, h3, h4;
- u_int32_t c0, c1, c2, c3, c4;
- u_int64_t d0, d1, d2, d3, d4;
+ uint32_t h0, h1, h2, h3, h4;
+ uint32_t c0, c1, c2, c3, c4;
+ uint64_t d0, d1, d2, d3, d4;
u_int i;
r0 = this->r[0];
@@ -622,13 +622,13 @@ static void poly2(private_chapoly_drv_ssse3_t *this, u_char *data, u_int dblks)
*/
static void poly1(private_chapoly_drv_ssse3_t *this, u_char *data)
{
- u_int32_t r0, r1, r2, r3, r4;
- u_int32_t s1, s2, s3, s4;
- u_int32_t h0, h1, h2, h3, h4;
- u_int64_t d0, d1, d2, d3, d4;
+ uint32_t r0, r1, r2, r3, r4;
+ uint32_t s1, s2, s3, s4;
+ uint32_t h0, h1, h2, h3, h4;
+ uint64_t d0, d1, d2, d3, d4;
__m128i h01, h23, h44;
__m128i x0, x1, y0, y1, z0;
- u_int32_t t0, t1;
+ uint32_t t0, t1;
r0 = this->r[0];
r1 = this->r[1];
@@ -764,10 +764,10 @@ METHOD(chapoly_drv_t, decrypt, bool,
METHOD(chapoly_drv_t, finish, bool,
private_chapoly_drv_ssse3_t *this, u_char *mac)
{
- u_int32_t h0, h1, h2, h3, h4;
- u_int32_t g0, g1, g2, g3, g4;
- u_int32_t mask;
- u_int64_t f = 0;
+ uint32_t h0, h1, h2, h3, h4;
+ uint32_t g0, g1, g2, g3, g4;
+ uint32_t mask;
+ uint64_t f = 0;
/* fully carry h */
h0 = this->h[0];
@@ -790,7 +790,7 @@ METHOD(chapoly_drv_t, finish, bool,
g4 = h4 + (g3 >> 26) - (1 << 26); g3 &= 0x3ffffff;
/* select h if h < p, or h + -p if h >= p */
- mask = (g4 >> ((sizeof(u_int32_t) * 8) - 1)) - 1;
+ mask = (g4 >> ((sizeof(uint32_t) * 8) - 1)) - 1;
g0 &= mask;
g1 &= mask;
g2 &= mask;