mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added CRC check of the CAT in cCaPidReceiver::Receive()
This commit is contained in:
parent
488a13543e
commit
848c65fe4f
@ -3611,6 +3611,7 @@ Helmut Binder <cco@aon.at>
|
|||||||
for changing the country code in the generated ParentalRatingDescriptor from 'DEU' to
|
for changing the country code in the generated ParentalRatingDescriptor from 'DEU' to
|
||||||
'902' to make it valid for all countries
|
'902' to make it valid for all countries
|
||||||
for adjusting device selection in GetDeviceForTransponder() to that in GetDevice()
|
for adjusting device selection in GetDeviceForTransponder() to that in GetDevice()
|
||||||
|
for adding CRC check of the CAT in cCaPidReceiver::Receive()
|
||||||
|
|
||||||
Ulrich Eckhardt <uli@uli-eckhardt.de>
|
Ulrich Eckhardt <uli@uli-eckhardt.de>
|
||||||
for reporting a problem with shutdown after user inactivity in case a plugin is
|
for reporting a problem with shutdown after user inactivity in case a plugin is
|
||||||
|
1
HISTORY
1
HISTORY
@ -9490,3 +9490,4 @@ Video Disk Recorder Revision History
|
|||||||
to Helmut Binder).
|
to Helmut Binder).
|
||||||
- Now adding CPPFLAGS to CXXFLAGS to allow extra preprocessor flags to be given when
|
- Now adding CPPFLAGS to CXXFLAGS to allow extra preprocessor flags to be given when
|
||||||
doing make (suggested by Tobisa Grimm).
|
doing make (suggested by Tobisa Grimm).
|
||||||
|
- Added CRC check of the CAT in cCaPidReceiver::Receive() (thanks to Helmut Binder).
|
||||||
|
68
ci.c
68
ci.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: ci.c 4.28 2020/06/16 14:33:32 kls Exp $
|
* $Id: ci.c 4.29 2020/06/27 10:05:56 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ci.h"
|
#include "ci.h"
|
||||||
@ -230,38 +230,44 @@ void cCaPidReceiver::Receive(const uchar *Data, int Length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
DelEmmPids();
|
if (!SI::CRC32::crc32((const char *)p - 8, length + 8, 0xFFFFFFFF)) { // <TableIdCAT,....,crc32>
|
||||||
for (int i = 0; i < length - 4; i++) { // -4 = checksum
|
DelEmmPids();
|
||||||
if (p[i] == 0x09) {
|
for (int i = 0; i < length - 4; i++) { // -4 = checksum
|
||||||
int CaId = int(p[i + 2] << 8) | p[i + 3];
|
if (p[i] == 0x09) {
|
||||||
int EmmPid = Peek13(p + i + 4);
|
int CaId = int(p[i + 2] << 8) | p[i + 3];
|
||||||
AddEmmPid(EmmPid);
|
int EmmPid = Peek13(p + i + 4);
|
||||||
if (MtdCamSlot)
|
AddEmmPid(EmmPid);
|
||||||
MtdMapPid(const_cast<uchar *>(p + i + 4), MtdCamSlot->MtdMapper());
|
if (MtdCamSlot)
|
||||||
switch (CaId >> 8) {
|
MtdMapPid(const_cast<uchar *>(p + i + 4), MtdCamSlot->MtdMapper());
|
||||||
case 0x01: for (int j = i + 7; j < p[i + 1] + 2; j += 4) {
|
switch (CaId >> 8) {
|
||||||
EmmPid = Peek13(p + j);
|
case 0x01: for (int j = i + 7; j < p[i + 1] + 2; j += 4) {
|
||||||
AddEmmPid(EmmPid);
|
EmmPid = Peek13(p + j);
|
||||||
if (MtdCamSlot)
|
AddEmmPid(EmmPid);
|
||||||
MtdMapPid(const_cast<uchar *>(p + j), MtdCamSlot->MtdMapper());
|
if (MtdCamSlot)
|
||||||
}
|
MtdMapPid(const_cast<uchar *>(p + j), MtdCamSlot->MtdMapper());
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
i += p[i + 1] + 2 - 1; // -1 to compensate for the loop increment
|
}
|
||||||
|
i += p[i + 1] + 2 - 1; // -1 to compensate for the loop increment
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (MtdCamSlot) {
|
||||||
if (MtdCamSlot) {
|
if (!bufp && length) {
|
||||||
if (!bufp && length) {
|
// update crc32 - but only single packet CAT is handled for now:
|
||||||
// update crc32 - but only single packet CAT is handled for now:
|
uint32_t crc = SI::CRC32::crc32((const char *)p - 8, length + 8 - 4, 0xFFFFFFFF); // <TableIdCAT....>[crc32]
|
||||||
uint32_t crc = SI::CRC32::crc32((const char *)p - 8, length + 8 - 4, 0xFFFFFFFF); // <TableIdCAT....>[crc32]
|
uchar *c = const_cast<uchar *>(p + length - 4);
|
||||||
uchar *c = const_cast<uchar *>(p + length - 4);
|
*c++ = crc >> 24;
|
||||||
*c++ = crc >> 24;
|
*c++ = crc >> 16;
|
||||||
*c++ = crc >> 16;
|
*c++ = crc >> 8;
|
||||||
*c++ = crc >> 8;
|
*c++ = crc;
|
||||||
*c++ = crc;
|
}
|
||||||
|
memcpy(mtdCatBuffer, Data, TS_SIZE);
|
||||||
|
MtdCamSlot->PutCat(mtdCatBuffer, TS_SIZE);
|
||||||
}
|
}
|
||||||
memcpy(mtdCatBuffer, Data, TS_SIZE);
|
}
|
||||||
MtdCamSlot->PutCat(mtdCatBuffer, TS_SIZE);
|
else {
|
||||||
|
esyslog("ERROR: wrong checksum in CAT");
|
||||||
|
catVersion = -1;
|
||||||
}
|
}
|
||||||
p = NULL;
|
p = NULL;
|
||||||
bufp = NULL;
|
bufp = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user