/modules/softcam/cas/nagra.c
https://bitbucket.org/cesbo/astra · C · 94 lines · 55 code · 9 blank · 30 comment · 13 complexity · 955767a862c6f0bc3e25353ec23865a0 MD5 · raw file
- /*
- * Astra Module: SoftCAM
- * http://cesbo.com/astra
- *
- * Copyright (C) 2012-2013, Andrey Dyldin <and@cesbo.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "../module_cam.h"
- struct module_data_t
- {
- MODULE_CAS_DATA();
- };
- static bool cas_check_em(module_data_t *mod, mpegts_psi_t *em)
- {
- const uint8_t em_type = em->buffer[0];
- switch(em_type)
- {
- // ECM
- case 0x80:
- case 0x81:
- {
- return true;
- }
- // EMM ( ret = MPEGTS_PACKET_EMM )
- case 0x83:
- {
- const uint8_t *ua = mod->__cas.decrypt->cam->ua;
- if(em->buffer[5] == ua[4]
- && em->buffer[4] == ua[5]
- && em->buffer[3] == ua[6])
- {
- if(em->buffer[7] == 0x10) // shared
- return true;
- else if(em->buffer[6] == ua[7]) // unique
- return true;
- }
- break;
- }
- case 0x82: // global
- {
- return true;
- }
- default:
- break;
- }
- return false;
- }
- static bool cas_check_keys(module_data_t *mod, const uint8_t *keys)
- {
- __uarg(mod);
- __uarg(keys);
- return true;
- }
- /*
- * CA descriptor (iso13818-1):
- * tag :8 (must be 0x09)
- * length :8
- * caid :16
- * reserved :3
- * pid :13
- * data :length-4
- */
- static bool cas_check_descriptor(module_data_t *mod, const uint8_t *desc)
- {
- __uarg(mod);
- __uarg(desc);
- return true;
- }
- static bool cas_check_caid(uint16_t caid)
- {
- return ((caid & 0xFF00) == 0x1800);
- }
- MODULE_CAS(nagra)