replaced magic 60 with COOKIE_SEED_LEN

This commit is contained in:
Maximilian Münchow 2016-10-13 12:45:48 +02:00
parent 9e2162ad63
commit 5a002888d0
3 changed files with 7 additions and 5 deletions

View File

@ -27,9 +27,10 @@ static void ts3init_set_cookie_tg_help(void)
printf(
"TS3INIT_SET_COOKIE target options:\n"
" --zero-random-sequence Always return 0 as random sequence.\n"
" --seed <seed> Seed is a 60 byte lowercase hex number in.\n"
" --seed <seed> Seed is a %i byte lowercase hex number in.\n"
" A source could be /dev/random.\n"
" --seed-file <file> Read the seed from a file.\n");
" --seed-file <file> Read the seed from a file.\n",
COOKIE_SEED_LEN);
}
static const struct option ts3init_set_cookie_tg_opts[] = {

View File

@ -29,9 +29,10 @@ static void ts3init_get_puzzle_help(void)
"ts3init_get_puzzle match options:\n"
" --min-client n The sending client needs to be at least version.\n"
" --check-cookie Check that the cookie was generated by same seed.\n"
" --seed <seed> Seed is a 60 byte lowercase hex number in.\n"
" --seed <seed> Seed is a %i byte lowercase hex number in.\n"
" A source could be /dev/random.\n"
" --seed-file <file> Read the seed from a file.\n"
" --seed-file <file> Read the seed from a file.\n",
COOKIE_SEED_LEN
);
}

View File

@ -9,7 +9,7 @@ enum {
static inline bool hex2int_seed(const char *src, __u8* dst)
{
int i, j;
for (i = 0; i < 60; ++i)
for (i = 0; i < COOKIE_SEED_LEN; ++i)
{
int v = 0;
for ( j = 0; j < 2; ++j)