mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 15:02:43 +02:00
test c**
Origin commit data
------------------
Branch: master
Commit: 91b9bb6c9e
Author: max_10 <max_10@gmx.de>
Date: 2015-11-18 (Wed, 18 Nov 2015)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
|
||||
static const char * FILENAME = "[descrambler]";
|
||||
|
||||
static int desc_fd;
|
||||
static const char *descrambler_filename = "/dev/dvb/adapter0/ca3";
|
||||
static int desc_fd = -1;
|
||||
static int desc_user_count = 0;
|
||||
|
||||
/* Byte 0 to 15 are AES Key, Byte 16 to 31 are IV */
|
||||
|
||||
@@ -23,22 +25,28 @@ int descrambler_set_key(int index, int parity, unsigned char *data)
|
||||
|
||||
index |= 0x100;
|
||||
|
||||
d.index = index;
|
||||
d.parity = (ca_descr_parity)parity;
|
||||
d.data_type = CA_DATA_KEY;
|
||||
d.length = 32;
|
||||
d.data = data;
|
||||
|
||||
printf("Index: %d Parity: (%d) -> ", d.index, d.parity);
|
||||
hexdump(d.data, 32);
|
||||
|
||||
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d))
|
||||
if (descrambler_open())
|
||||
{
|
||||
//printf("CA_SET_DESCR_DATA\n");
|
||||
d.index = index;
|
||||
d.parity = (ca_descr_parity)parity;
|
||||
d.data_type = CA_DATA_KEY;
|
||||
d.length = 32;
|
||||
d.data = data;
|
||||
|
||||
printf("Index: %d Parity: (%d) -> ", d.index, d.parity);
|
||||
hexdump(d.data, 32);
|
||||
|
||||
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d))
|
||||
{
|
||||
//printf("CA_SET_DESCR_DATA\n");
|
||||
}
|
||||
descrambler_close();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we don't use this for ci cam ! */
|
||||
/*
|
||||
int descrambler_set_pid(int index, int enable, int pid)
|
||||
{
|
||||
struct ca_pid p;
|
||||
@@ -54,23 +62,34 @@ int descrambler_set_pid(int index, int enable, int pid)
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
bool descrambler_open(void)
|
||||
{
|
||||
desc_fd = open(descrambler_filename, O_RDWR | O_NONBLOCK );
|
||||
if (desc_fd <= 0) {
|
||||
printf("cannot open %s\n", descrambler_filename);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void descrambler_close(void)
|
||||
{
|
||||
close(desc_fd);
|
||||
desc_fd = -1;
|
||||
}
|
||||
|
||||
int descrambler_init(void)
|
||||
{
|
||||
const char *filename = "/dev/dvb/adapter0/ca3";
|
||||
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
desc_fd = open(filename, O_RDWR | O_NONBLOCK );
|
||||
if (desc_fd <= 0) {
|
||||
printf("cannot open %s\n", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
desc_user_count++;
|
||||
printf("%s -> %s %d\n", FILENAME, __FUNCTION__, desc_user_count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void descrambler_deinit(void)
|
||||
{
|
||||
close(desc_fd);
|
||||
desc_user_count--;
|
||||
if (desc_user_count <= 0 && desc_fd > 0)
|
||||
descrambler_close();
|
||||
}
|
||||
|
@@ -3,7 +3,10 @@
|
||||
|
||||
int descrambler_init(void);
|
||||
void descrambler_deinit(void);
|
||||
bool descrambler_open(void);
|
||||
void descrambler_close(void);
|
||||
int descrambler_set_key(int index, int parity, unsigned char *data);
|
||||
int descrambler_set_pid(int index, int enable, int pid);
|
||||
/* we don't use this for ci cam ! */
|
||||
//int descrambler_set_pid(int index, int enable, int pid);
|
||||
|
||||
#endif
|
||||
|
@@ -1029,7 +1029,6 @@ bool eDVBCIContentControlManagerSession::data_initialize(tSlot *tslot)
|
||||
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
// if (session->private_data) {
|
||||
if (tslot->private_data) {
|
||||
fprintf(stderr, "strange private_data not null!\n");
|
||||
return false;
|
||||
@@ -1042,7 +1041,6 @@ bool eDVBCIContentControlManagerSession::data_initialize(tSlot *tslot)
|
||||
}
|
||||
|
||||
/* parent */
|
||||
// data->session = session;
|
||||
data->slot = tslot;
|
||||
|
||||
/* clear storage of credentials */
|
||||
@@ -1267,15 +1265,8 @@ eDVBCIContentControlManagerSession::~eDVBCIContentControlManagerSession()
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_doClose(tSlot *tslot)
|
||||
{
|
||||
struct cc_ctrl_data *data = (struct cc_ctrl_data*)(tslot->private_data);
|
||||
uint8_t clearData[32];
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
printf("close content_control\n");
|
||||
for (int i = 0; i < 32; i++)
|
||||
clearData[i] = 0;
|
||||
descrambler_set_key((int)data->slot->source, 0, clearData);
|
||||
descrambler_set_key((int)data->slot->source, 1, clearData);
|
||||
|
||||
descrambler_deinit();
|
||||
|
||||
element_init(data);
|
||||
@@ -1295,7 +1286,7 @@ int eDVBCIContentControlManagerSession::receivedAPDU(const unsigned char *tag, c
|
||||
switch (tag[2]) {
|
||||
case 0x01: ci_ccmgr_cc_open_cnf(slot); break;
|
||||
case 0x03: ci_ccmgr_cc_data_req(slot, (const uint8_t*)data, len); break;
|
||||
case 0x05: ci_ccmgr_cc_sync_req(); slot->ccmgr_ready = false; break;
|
||||
case 0x05: ci_ccmgr_cc_sync_req(); break;
|
||||
case 0x07: ci_ccmgr_cc_sac_data_req(slot, (const uint8_t*)data, len); break;
|
||||
case 0x09: ci_ccmgr_cc_sac_sync_req(slot, (const uint8_t*)data, len); break;
|
||||
default:
|
||||
@@ -1327,7 +1318,7 @@ int eDVBCIContentControlManagerSession::doAction()
|
||||
|
||||
void eDVBCIContentControlManagerSession::resendKey(tSlot *tslot)
|
||||
{
|
||||
if (!tslot->SidBlackListed)
|
||||
if (!tslot->SidBlackListed && (tslot->inUse || tslot->slot == cCA::GetInstance()->GetLiveSlot()))
|
||||
descrambler_set_key((int)tslot->source, tslot->lastParity, tslot->lastKey);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user