fixed bug in shiphash23

This commit is contained in:
Niels Werensteijn 2016-10-11 11:15:41 +02:00
parent 9f80476ca4
commit 4e3670842d
3 changed files with 20 additions and 8 deletions

View File

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

View File

@ -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
{

View File

@ -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"