28 |
extern int width; |
extern int width; |
29 |
extern int height; |
extern int height; |
30 |
extern int keylayout; |
extern int keylayout; |
31 |
|
extern BOOL use_encryption; |
32 |
|
extern BOOL licence_issued; |
33 |
|
|
34 |
static int rc4_key_len; |
static int rc4_key_len; |
35 |
static RC4_KEY rc4_decrypt_key; |
static RC4_KEY rc4_decrypt_key; |
314 |
int hdrlen; |
int hdrlen; |
315 |
STREAM s; |
STREAM s; |
316 |
|
|
317 |
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4; |
if (!licence_issued) |
318 |
|
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4; |
319 |
|
else |
320 |
|
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0; |
321 |
s = mcs_init(maxlen + hdrlen); |
s = mcs_init(maxlen + hdrlen); |
322 |
s_push_layer(s, sec_hdr, hdrlen); |
s_push_layer(s, sec_hdr, hdrlen); |
323 |
|
|
331 |
int datalen; |
int datalen; |
332 |
|
|
333 |
s_pop_layer(s, sec_hdr); |
s_pop_layer(s, sec_hdr); |
334 |
out_uint32_le(s, flags); |
if (!licence_issued || (flags & SEC_ENCRYPT)) |
335 |
|
out_uint32_le(s, flags); |
336 |
|
|
337 |
if (flags & SEC_ENCRYPT) |
if (flags & SEC_ENCRYPT) |
338 |
{ |
{ |
418 |
/* Client encryption settings */ |
/* Client encryption settings */ |
419 |
out_uint16_le(s, SEC_TAG_CLI_CRYPT); |
out_uint16_le(s, SEC_TAG_CLI_CRYPT); |
420 |
out_uint16(s, 8); /* length */ |
out_uint16(s, 8); /* length */ |
421 |
out_uint32_le(s, 1); /* encryption enabled */ |
out_uint32_le(s, use_encryption ? 1 : 0); /* encryption enabled */ |
422 |
s_mark_end(s); |
s_mark_end(s); |
423 |
} |
} |
424 |
|
|
575 |
|
|
576 |
while ((s = mcs_recv()) != NULL) |
while ((s = mcs_recv()) != NULL) |
577 |
{ |
{ |
578 |
in_uint32_le(s, sec_flags); |
if (use_encryption || !licence_issued) |
|
|
|
|
if (sec_flags & SEC_LICENCE_NEG) |
|
579 |
{ |
{ |
580 |
licence_process(s); |
in_uint32_le(s, sec_flags); |
|
continue; |
|
|
} |
|
581 |
|
|
582 |
if (sec_flags & SEC_ENCRYPT) |
if (sec_flags & SEC_LICENCE_NEG) |
583 |
{ |
{ |
584 |
in_uint8s(s, 8); /* signature */ |
licence_process(s); |
585 |
sec_decrypt(s->p, s->end - s->p); |
continue; |
586 |
|
} |
587 |
|
|
588 |
|
if (sec_flags & SEC_ENCRYPT) |
589 |
|
{ |
590 |
|
in_uint8s(s, 8); /* signature */ |
591 |
|
sec_decrypt(s->p, s->end - s->p); |
592 |
|
} |
593 |
} |
} |
594 |
|
|
595 |
return s; |
return s; |
613 |
return False; |
return False; |
614 |
|
|
615 |
sec_process_mcs_data(&mcs_data); |
sec_process_mcs_data(&mcs_data); |
616 |
sec_establish_key(); |
if (use_encryption) |
617 |
|
sec_establish_key(); |
618 |
return True; |
return True; |
619 |
} |
} |
620 |
|
|