Browse Source

fixed bug in shiphash23

pull/1/head
Niels Werensteijn 8 years ago
parent
commit
4e3670842d
  1. 13
      src/siphash24.c
  2. 14
      src/siphash24.h
  3. 1
      src/ts3init_cookie.c

13
src/siphash24.c

@ -101,24 +101,25 @@ void ts3init_siphash_update(struct ts3init_siphash_state* state, const u8 *in, s @@ -101,24 +101,25 @@ void ts3init_siphash_update(struct ts3init_siphash_state* state, const u8 *in, s
switch (next_byte)
{
case 1:
m |= ((u64)(*in++)) << 8;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 8;
case 2:
m |= ((u64)(*in++)) << 16;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 16;
case 3:
m |= ((u64)(*in++)) << 24;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 24;
case 4:
m |= ((u64)(*in++)) << 32;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 32;
case 5:
m |= ((u64)(*in++)) << 40;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 40;
case 6:
m |= ((u64)(*in++)) << 48;
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 48;
case 7:
if (in==end) goto __exit_update;
m |= ((u64)(*in++)) << 56;
v3 ^= m;

14
src/siphash24.h

@ -17,9 +17,19 @@ @@ -17,9 +17,19 @@
this software. If not, see
<http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#ifndef __KERNEL__
#include <stdint.h>
#include <stdio.h>
#define u8 uint8_t
#define u32 uint32_t
#define u64 uint64_t
#define printk printf
#define le64_to_cpu(x) x
#define cpu_to_le64(x) x
#define inline static inline
#else
#include <linux/kernel.h>
#include <linux/udp.h>
#endif
struct ts3init_siphash_state
{

1
src/ts3init_cookie.c

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
#include <linux/err.h>
#include <linux/scatterlist.h>
#include <linux/netfilter/x_tables.h>
#include <linux/udp.h>
#include "siphash24.h"
#include "ts3init_cookie.h"

Loading…
Cancel
Save