mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
test c**
This commit is contained in:
@@ -643,6 +643,7 @@ SlotIt cCA::FindFreeSlot(ca_map_t camap, unsigned char scrambled)
|
||||
printf("%04x ", (*it)->cam_caids[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
(*it)->scrambled = scrambled;
|
||||
if (scrambled)
|
||||
{
|
||||
for (i = 0; i < (*it)->cam_caids.size(); i++)
|
||||
@@ -666,7 +667,7 @@ SlotIt cCA::FindFreeSlot(ca_map_t camap, unsigned char scrambled)
|
||||
}
|
||||
|
||||
/* erstmal den capmt wie er von Neutrino kommt in den Slot puffern */
|
||||
bool cCA::SendCAPMT(u64 tpid, u8 source_demux, u8 camask, const unsigned char * cabuf, u32 calen, const unsigned char * /*rawpmt*/, u32 /*rawlen*/, enum CA_SLOT_TYPE SlotType, unsigned char scrambled, ca_map_t cm, int mode, bool enabled)
|
||||
bool cCA::SendCAPMT(u64 tpid, u8 source_demux, u8 camask, const unsigned char * cabuf, u32 calen, const unsigned char * /*rawpmt*/, u32 /*rawlen*/, enum CA_SLOT_TYPE /*SlotType*/, unsigned char scrambled, ca_map_t cm, int mode, bool enabled)
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
if (!num_slots) return true; /* stb's without ci-slots */
|
||||
@@ -1141,6 +1142,13 @@ void cCA::slot_pollthread(void *c)
|
||||
{
|
||||
SendCaPMT(slot);
|
||||
slot->newCapmt = false;
|
||||
if (slot->ccmgr_ready && slot->hasCCManager)
|
||||
{
|
||||
if (slot->scrambled)
|
||||
{
|
||||
slot->ccmgrSession->resendKey(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -203,6 +203,9 @@ typedef struct
|
||||
CaIdVector cam_caids;
|
||||
std::priority_queue<queueData> sendqueue;
|
||||
|
||||
unsigned char lastKey[32];
|
||||
unsigned char scrambled;
|
||||
u8 lastParity;
|
||||
bool DataLast;
|
||||
bool DataRCV;
|
||||
/* private data */
|
||||
|
@@ -21,6 +21,7 @@ int descrambler_set_key(int index, int parity, unsigned char *data)
|
||||
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
index |= 0x100;
|
||||
|
||||
d.index = index;
|
||||
d.parity = (ca_descr_parity)parity;
|
||||
@@ -56,7 +57,7 @@ int descrambler_set_pid(int index, int enable, int pid)
|
||||
|
||||
int descrambler_init(void)
|
||||
{
|
||||
const char *filename = "/dev/dvb/adapter0/ca1";
|
||||
const char *filename = "/dev/dvb/adapter0/ca3";
|
||||
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
|
@@ -869,9 +869,14 @@ static void check_new_key(struct cc_ctrl_data *cc_data)
|
||||
AES_ecb_encrypt(&kp[i], &dec[i], &aes_ctx, 1);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
dec[i] ^= kp[i];
|
||||
cc_data->slot->lastKey[i] = dec[i];
|
||||
}
|
||||
cc_data->slot->lastParity = slot;
|
||||
|
||||
descrambler_set_key((int)cc_data->slot->source, slot, dec);
|
||||
if (cc_data->slot->scrambled)
|
||||
cc_data->slot->ccmgrSession->resendKey(cc_data->slot);
|
||||
|
||||
/* reset */
|
||||
element_invalidate(cc_data, 12);
|
||||
@@ -1268,8 +1273,8 @@ void eDVBCIContentControlManagerSession::ci_ccmgr_doClose(tSlot *tslot)
|
||||
printf("close content_control\n");
|
||||
for (int i = 0; i < 32; i++)
|
||||
clearData[i] = 0;
|
||||
descrambler_set_key(data->slot->slot, 0, clearData);
|
||||
descrambler_set_key(data->slot->slot, 1, clearData);
|
||||
descrambler_set_key((int)data->slot->source, 0, clearData);
|
||||
descrambler_set_key((int)data->slot->source, 1, clearData);
|
||||
|
||||
descrambler_deinit();
|
||||
|
||||
@@ -1319,3 +1324,9 @@ int eDVBCIContentControlManagerSession::doAction()
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void eDVBCIContentControlManagerSession::resendKey(tSlot *tslot)
|
||||
{
|
||||
descrambler_set_key((int)tslot->source, tslot->lastParity, tslot->lastKey);
|
||||
}
|
||||
|
||||
|
@@ -22,5 +22,6 @@ public:
|
||||
eDVBCIContentControlManagerSession(tSlot *tslot);
|
||||
~eDVBCIContentControlManagerSession();
|
||||
void ci_ccmgr_doClose(tSlot *tslot);
|
||||
void resendKey(tSlot *tslot);
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user