{
STREAM s;
- s = sec_init(/*g_encryption ? SEC_ENCRYPT :*/ 0, length + 8);
+ s = sec_init(g_encryption ? SEC_ENCRYPT : 0, length + 8);
s_push_layer(s, channel_hdr, 8);
return s;
}
out_uint32_le(s, flags);
data = s->end = s->p + thislength;
DEBUG_CLIPBOARD(("Sending %d bytes with FLAG_FIRST\n", thislength));
- sec_send_to_channel(s, /*g_encryption ? SEC_ENCRYPT :*/ 0, channel->mcs_id);
+ sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
/* subsequent segments copied (otherwise would have to generate headers backwards) */
while (remaining > 0)
DEBUG_CLIPBOARD(("Sending %d bytes with flags %d\n", thislength, flags));
- s = sec_init(/*g_encryption ? SEC_ENCRYPT : */0, thislength + 8);
+ s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
out_uint32_le(s, length);
out_uint32_le(s, flags);
out_uint8p(s, data, thislength);
s_mark_end(s);
- sec_send_to_channel(s, /*g_encryption ? SEC_ENCRYPT : */0, channel->mcs_id);
+ sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
data += thislength;
}
printf("0x%02x ", sec_encrypt_key[i]);
printf("\n");
}
+
+ g_encryption = 1;
}
static uint8 pad_54[40] = {
use_count = 0;
}
+ printf("RC4-ing %u bytes with DECRYPT, uc=%u\n", length, use_count);
+
RC4(&rc4_decrypt_key, length, data, data);
use_count++;
}
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 4;
else
hdrlen = (flags & SEC_ENCRYPT) ? 12 : 0;
+ printf("HDRLEN is %u\n", hdrlen);
s = mcs_init(maxlen + hdrlen);
s_push_layer(s, sec_hdr, hdrlen);
if (tag == LICENCE_TAG_PRESENT) {
process_presented_license(s);
- s = sec_init(sizeof(result_license), SEC_LICENCE_NEG);
- out_uint8p(s, result_license, sizeof(result_license));
- s_mark_end(s);
- sec_send(s, SEC_LICENCE_NEG);
-
- //g_licence_issued = 1;
+ {
+ STREAM s;
+ s = sec_init(SEC_LICENCE_NEG, sizeof(result_license));
+ out_uint8p(s, result_license, sizeof(result_license));
+ s_mark_end(s);
+ sec_send(s, SEC_LICENCE_NEG);
+ }
- printf("Sending DEMAND_ACTIVE (0x%x bytes)\n", sizeof(demand_active));
- s = sec_init(sizeof(demand_active), SEC_ENCRYPT);
- out_uint8p(s, demand_active, sizeof(demand_active));
- s_mark_end(s);
- sec_send(s, SEC_ENCRYPT);
+ {
+ STREAM s;
+ printf("Sending DEMAND_ACTIVE (0x%x bytes)\n", sizeof(demand_active));
+ s = sec_init(SEC_ENCRYPT, sizeof(demand_active));
+ out_uint8p(s, demand_active, sizeof(demand_active));
+ s_mark_end(s);
+ sec_send(s, SEC_ENCRYPT);
+ }
}
continue;
{
STREAM s;
- s = sec_init(sizeof(demand_license), SEC_LICENCE_NEG);
+ s = sec_init(SEC_LICENCE_NEG, sizeof(demand_license));
out_uint8p(s, demand_license, sizeof(demand_license));
s_mark_end(s);
sec_send(s, SEC_LICENCE_NEG);