<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-2">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><span class="tlid-translation
translation" lang="en"><span title="" class="">Is there any
chance to add this code?</span></span></div>
<div class="moz-cite-prefix"><span class="tlid-translation
translation" lang="en"><span title="" class=""><br>
</span></span></div>
<div class="moz-cite-prefix">W dniu 2019-03-03 o 14:30,
<a class="moz-txt-link-abbreviated" href="mailto:namiltd@poczta.onet.pl">namiltd@poczta.onet.pl</a> pisze:<br>
</div>
<blockquote type="cite"
cite="mid:dd1d1bde-dd6b-6f36-e08f-3552ee0686a2@poczta.onet.pl">---
<br>
src/crypto/zinc/blake2s/blake2s.c | 17 +++++++++++++++++
<br>
src/socket.c | 7 +++++++
<br>
2 files changed, 24 insertions(+)
<br>
<br>
diff --git a/src/crypto/zinc/blake2s/blake2s.c
b/src/crypto/zinc/blake2s/blake2s.c
<br>
index b881db0..60b7763 100644
<br>
--- a/src/crypto/zinc/blake2s/blake2s.c
<br>
+++ b/src/crypto/zinc/blake2s/blake2s.c
<br>
@@ -19,9 +19,16 @@
<br>
#include <linux/init.h>
<br>
#include <linux/bug.h>
<br>
#include <asm/unaligned.h>
<br>
+#define GCC_VERSION (__GNUC__ * 10000 \
<br>
+ + __GNUC_MINOR__ * 100 \
<br>
+ + __GNUC_PATCHLEVEL__)
<br>
<br>
+#if GCC_VERSION > 40407
<br>
typedef union {
<br>
struct {
<br>
+#else
<br>
+typedef struct {
<br>
+#endif
<br>
u8 digest_length;
<br>
u8 key_length;
<br>
u8 fanout;
<br>
@@ -33,8 +40,10 @@ typedef union {
<br>
u8 inner_length;
<br>
u8 salt[8];
<br>
u8 personal[8];
<br>
+#if GCC_VERSION > 40407
<br>
};
<br>
__le32 words[8];
<br>
+#endif
<br>
} __packed blake2s_param;
<br>
<br>
static const u32 blake2s_iv[8] = {
<br>
@@ -74,9 +83,17 @@ static inline void blake2s_init_param(struct
blake2s_state *state,
<br>
{
<br>
int i;
<br>
<br>
+#if GCC_VERSION <= 40407
<br>
+ const __le32 *words;
<br>
+ words = (const __le32 *)param;
<br>
+#endif
<br>
memset(state, 0, sizeof(*state));
<br>
for (i = 0; i < 8; ++i)
<br>
+#if GCC_VERSION > 40407
<br>
state->h[i] = blake2s_iv[i] ^
le32_to_cpu(param->words[i]);
<br>
+#else
<br>
+ state->h[i] = blake2s_iv[i] ^ le32_to_cpu(words[i]);
<br>
+#endif
<br>
}
<br>
<br>
void blake2s_init(struct blake2s_state *state, const size_t
outlen)
<br>
diff --git a/src/socket.c b/src/socket.c
<br>
index 652d798..dfc98d3 100644
<br>
--- a/src/socket.c
<br>
+++ b/src/socket.c
<br>
@@ -16,6 +16,9 @@
<br>
#include <linux/inetdevice.h>
<br>
#include <net/udp_tunnel.h>
<br>
#include <net/ipv6.h>
<br>
+#define GCC_VERSION (__GNUC__ * 10000 \
<br>
+ + __GNUC_MINOR__ * 100 \
<br>
+ + __GNUC_PATCHLEVEL__)
<br>
<br>
static int send4(struct wg_device *wg, struct sk_buff *skb,
<br>
struct endpoint *endpoint, u8 ds, struct dst_cache
*cache)
<br>
@@ -363,7 +366,9 @@ int wg_socket_init(struct wg_device *wg, u16
port)
<br>
struct socket *new4 = NULL, *new6 = NULL;
<br>
struct udp_port_cfg port4 = {
<br>
.family = AF_INET,
<br>
+#if GCC_VERSION > 40407
<br>
.local_ip.s_addr = htonl(INADDR_ANY),
<br>
+#endif
<br>
.local_udp_port = htons(port),
<br>
.use_udp_checksums = true
<br>
};
<br>
@@ -371,7 +376,9 @@ int wg_socket_init(struct wg_device *wg, u16
port)
<br>
int retries = 0;
<br>
struct udp_port_cfg port6 = {
<br>
.family = AF_INET6,
<br>
+#if GCC_VERSION > 40407
<br>
.local_ip6 = IN6ADDR_ANY_INIT,
<br>
+#endif
<br>
.use_udp6_tx_checksums = true,
<br>
.use_udp6_rx_checksums = true,
<br>
.ipv6_v6only = true
<br>
</blockquote>
<p><br>
</p>
</body>
</html>