switched cookie to 64 bit
This commit is contained in:
parent
e0877e6aff
commit
68d2388973
@ -52,7 +52,7 @@ static void check_update_seed_cache(time_t time, __u8 index,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = crypto_hash_digest(&desc, sg, 64, cache->seed + index * SHA512_SIZE);
|
||||
ret = crypto_hash_digest(&desc, sg, 64, cache->seed8 + index * SHA512_SIZE);
|
||||
if (ret != 0)
|
||||
{
|
||||
printk(KERN_ERR KBUILD_MODNAME ": could not digest sha512\n");
|
||||
@ -62,7 +62,7 @@ static void check_update_seed_cache(time_t time, __u8 index,
|
||||
crypto_free_hash(desc.tfm);
|
||||
}
|
||||
|
||||
__u8* ts3init_get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
__u64* ts3init_get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
struct xt_ts3init_cookie_cache* cache,
|
||||
const __u8* cookie_seed)
|
||||
{
|
||||
@ -74,19 +74,19 @@ __u8* ts3init_get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
|
||||
if (packet_index >= 8) return NULL;
|
||||
|
||||
current_cache_index = (current_time >> 2) & 1;
|
||||
packet_cache_index = packet_index >> 2 /* &1 */;
|
||||
current_cache_index = (current_time % 8) / 4;
|
||||
packet_cache_index = packet_index / 4;
|
||||
|
||||
/* get cache time of packet */
|
||||
current_cache_time = current_time & ~((time_t)3);
|
||||
packet_cache_time = current_cache_index == packet_cache_index ?
|
||||
current_cache_time : current_cache_time - (1*4);
|
||||
packet_cache_time = current_cache_time
|
||||
- ((current_cache_index ^ packet_cache_index)*4);
|
||||
|
||||
/* make sure the cache is up-to-date */
|
||||
check_update_seed_cache(packet_cache_time, packet_cache_index, cache,
|
||||
cookie_seed);
|
||||
|
||||
/* return the proper seed */
|
||||
return cache->seed + (SIP_KEY_SIZE * packet_index );
|
||||
return cache->seed64 + ((SIP_KEY_SIZE/sizeof(__u64)) * packet_index );
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,14 @@ enum {
|
||||
struct xt_ts3init_cookie_cache
|
||||
{
|
||||
time_t time[2];
|
||||
__u8 __attribute__((aligned(8))) seed[SHA512_SIZE*2];
|
||||
union
|
||||
{
|
||||
__u8 seed8[SHA512_SIZE*2];
|
||||
__u64 seed64[(SHA512_SIZE/sizeof(__u64))*2];
|
||||
};
|
||||
};
|
||||
|
||||
__u8* ts3init_get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
__u64* ts3init_get_cookie_seed(time_t current_time, __u8 packet_index,
|
||||
struct xt_ts3init_cookie_cache* cache,
|
||||
const __u8* cookie_seed);
|
||||
|
||||
|
@ -183,7 +183,7 @@ ts3init_get_puzzle_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
{
|
||||
struct ts3init_cache_t* cache;
|
||||
struct ts3_init_header* ts3_header = header_data.ts3_header;
|
||||
__u8* cookie_seed;
|
||||
__u64* cookie_seed;
|
||||
/*__u8 cookie[8];*/
|
||||
unsigned long jifs;
|
||||
time_t current_unix_time;
|
||||
|
Loading…
x
Reference in New Issue
Block a user