[PATCH] centos 6 compatibility

Mieczysław Nalewaj namiltd at poczta.onet.pl
Wed Mar 27 15:48:22 CET 2019


Is there any chance to add this code?

W dniu 2019-03-03 o 14:30, namiltd at poczta.onet.pl pisze:
> ---
> src/crypto/zinc/blake2s/blake2s.c | 17 +++++++++++++++++
> src/socket.c                      |  7 +++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/src/crypto/zinc/blake2s/blake2s.c
> b/src/crypto/zinc/blake2s/blake2s.c
> index b881db0..60b7763 100644
> --- a/src/crypto/zinc/blake2s/blake2s.c
> +++ b/src/crypto/zinc/blake2s/blake2s.c
> @@ -19,9 +19,16 @@
> #include <linux/init.h>
> #include <linux/bug.h>
> #include <asm/unaligned.h>
> +#define GCC_VERSION (__GNUC__ * 10000 \
> +            + __GNUC_MINOR__ * 100 \
> +            + __GNUC_PATCHLEVEL__)
>
> +#if GCC_VERSION > 40407
> typedef union {
>     struct {
> +#else
> +typedef struct {
> +#endif
>         u8 digest_length;
>         u8 key_length;
>         u8 fanout;
> @@ -33,8 +40,10 @@ typedef union {
>         u8 inner_length;
>         u8 salt[8];
>         u8 personal[8];
> +#if GCC_VERSION > 40407
>     };
>     __le32 words[8];
> +#endif
> } __packed blake2s_param;
>
> static const u32 blake2s_iv[8] = {
> @@ -74,9 +83,17 @@ static inline void blake2s_init_param(struct
> blake2s_state *state,
> {
>     int i;
>
> +#if GCC_VERSION <= 40407
> +    const __le32 *words;
> +    words = (const __le32 *)param;
> +#endif
>     memset(state, 0, sizeof(*state));
>     for (i = 0; i < 8; ++i)
> +#if GCC_VERSION > 40407
>         state->h[i] = blake2s_iv[i] ^ le32_to_cpu(param->words[i]);
> +#else
> +        state->h[i] = blake2s_iv[i] ^ le32_to_cpu(words[i]);
> +#endif
> }
>
> void blake2s_init(struct blake2s_state *state, const size_t outlen)
> diff --git a/src/socket.c b/src/socket.c
> index 652d798..dfc98d3 100644
> --- a/src/socket.c
> +++ b/src/socket.c
> @@ -16,6 +16,9 @@
> #include <linux/inetdevice.h>
> #include <net/udp_tunnel.h>
> #include <net/ipv6.h>
> +#define GCC_VERSION (__GNUC__ * 10000 \
> +            + __GNUC_MINOR__ * 100 \
> +            + __GNUC_PATCHLEVEL__)
>
> static int send4(struct wg_device *wg, struct sk_buff *skb,
>          struct endpoint *endpoint, u8 ds, struct dst_cache *cache)
> @@ -363,7 +366,9 @@ int wg_socket_init(struct wg_device *wg, u16 port)
>     struct socket *new4 = NULL, *new6 = NULL;
>     struct udp_port_cfg port4 = {
>         .family = AF_INET,
> +#if GCC_VERSION > 40407
>         .local_ip.s_addr = htonl(INADDR_ANY),
> +#endif
>         .local_udp_port = htons(port),
>         .use_udp_checksums = true
>     };
> @@ -371,7 +376,9 @@ int wg_socket_init(struct wg_device *wg, u16 port)
>     int retries = 0;
>     struct udp_port_cfg port6 = {
>         .family = AF_INET6,
> +#if GCC_VERSION > 40407
>         .local_ip6 = IN6ADDR_ANY_INIT,
> +#endif
>         .use_udp6_tx_checksums = true,
>         .use_udp6_rx_checksums = true,
>         .ipv6_v6only = true


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20190327/038b2d07/attachment-0001.html>


More information about the WireGuard mailing list