Пример #1
0
void ts_packet_set_scrambled(uint8_t *ts_packet, enum ts_scrambled_type stype) {
	ts_packet_set_not_scrambled(ts_packet);
	if (stype == scrambled_with_even_key)
		ts_packet[3] |= 2 << 6;
	if (stype == scrambled_with_odd_key)
		ts_packet[3] |= 3 << 6;
	if (stype == scrambled_reserved)
		ts_packet[3] |= 1 << 6;
}
Пример #2
0
inline void csa_decrypt_single_packet(csakey_t *csakey, uint8_t *ts_packet) {
	struct csakey *key = (struct csakey *)csakey;
	if (use_dvbcsa) {
		unsigned int key_idx = ts_packet_get_scrambled(ts_packet) - 2;
		unsigned int payload_offset = ts_packet_get_payload_offset(ts_packet);
		ts_packet_set_not_scrambled(ts_packet);
		dvbcsa_decrypt(key->s_csakey[key_idx], ts_packet + payload_offset, 188 - payload_offset);
	}
	if (use_ffdecsa) {
		uint8_t *cluster[3] = { ts_packet, ts_packet + 188, NULL };
		ffdecsa_decrypt_packets(key->ff_csakey, cluster);
	}
}