small fix dvbci

This commit is contained in:
DboxOldie
2020-01-17 21:29:00 +01:00
committed by Thilo Graf
parent 6eb082c12a
commit 8658177951
4 changed files with 60 additions and 4 deletions

View File

@@ -713,7 +713,7 @@ static int generate_akh(struct cc_ctrl_data *cc_data)
uint8_t akh[32];
SHA256_CTX sha;
printf("%s>%s\n", FILENAME, __FUNCTION__);
printf("%s -> %s\n", FILENAME, __FUNCTION__);
SHA256_Init(&sha);
SHA256_Update(&sha, element_get_ptr(cc_data, 6), element_get_buf(cc_data, NULL, 6));
@@ -926,9 +926,11 @@ static int data_get_handle_new(struct cc_ctrl_data *cc_data, unsigned int id)
/* SAC data messages */
case 6: //CICAM_id
case 12: //keyprecursor
check_new_key(cc_data);
break;
case 26: //programm number
case 25: //uri_message
generate_uri_confirm(cc_data, cc_data->sak);
break;
@@ -937,6 +939,7 @@ static int data_get_handle_new(struct cc_ctrl_data *cc_data, unsigned int id)
break;
default:
printf("%s -> %s unhandled ID (%d)\n", FILENAME, __FUNCTION__, id);
break;
}

View File

@@ -80,10 +80,11 @@ int eDVBCIResourceManagerSession::doAction()
{0x00, 0x02, 0x00, 0x41}, // application V1
{0x00, 0x02, 0x00, 0x43}, // application V3
{0x00, 0x03, 0x00, 0x41}, // conditional access
// {0x00, 0x20, 0x00, 0x41}, // host control
{0x00, 0x20, 0x00, 0x41}, // host control (dummy)
{0x00, 0x40, 0x00, 0x41}, // mmi
{0x00, 0x24, 0x00, 0x41}, // date-time
{0x00, 0x8c, 0x10, 0x01} // content control
{0x00, 0x8c, 0x10, 0x01}, // content control
{0x00, 0x8e, 0x10, 0x01} // cam upgrade (dummy)
// {0x00, 0x10, 0x00, 0x41} // auth.
};
sendAPDU(tag, data, sizeof(data));

View File

@@ -14,6 +14,40 @@
eDVBCISession* eDVBCISession::sessions[SLMS];
eDVBCIHostControlSession::eDVBCIHostControlSession(eDVBCISlot *tslot)
{
slot = tslot;
}
eDVBCIHostControlSession::~eDVBCIHostControlSession()
{
}
int eDVBCIHostControlSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
{
printf("CI HC SESSION(%d)/TAG %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
for (int i=0; i<len; i++)
printf("%02x ", ((const unsigned char*)data)[i]);
printf("\n");
return 0;
}
int eDVBCIHostControlSession::doAction()
{
switch (state)
{
case stateStarted:
{
const unsigned char tag[3] = {0x9F, 0x80, 0x20}; // application manager info
sendAPDU(tag);
state = stateFinal;
return 1;
}
default:
return 0;
}
}
int eDVBCISession::buildLengthField(unsigned char *pkt, int len)
{
if (len < 127)
@@ -180,12 +214,16 @@ eDVBCISession* eDVBCISession::createSession(eDVBCISlot *slot, const unsigned cha
sessions[session_nb - 1] = new eDVBCIContentControlManagerSession(slot);
break;
} // fall through
case 0x00200041:
sessions[session_nb - 1] = new eDVBCIHostControlSession(slot);
printf("[CI SESS] Host Control\n");
break;
case 0x00100041:
// session=new eDVBCIAuthSession;
printf("[CI SESS] AuthSession\n");
// break;
// fall through
case 0x00200041:
case 0x008e1001:
default:
printf("[CI SESS] unknown resource type %02x %02x %02x %02x\n", resource_identifier[0], resource_identifier[1], resource_identifier[2], resource_identifier[3]);
sessions[session_nb - 1] = 0;

View File

@@ -47,4 +47,18 @@ public:
static int pollAll();
};
class eDVBCIHostControlSession: public eDVBCISession
{
enum {
stateFinal=statePrivate
};
eDVBCISlot *slot;
int receivedAPDU(const unsigned char *tag,const void *data, int len);
int doAction();
public:
eDVBCIHostControlSession(eDVBCISlot *tslot);
~eDVBCIHostControlSession();
};
#endif