diff --git a/libdvbci/descrambler.cpp b/libdvbci/descrambler.cpp index 5ec6147..faad6ea 100644 --- a/libdvbci/descrambler.cpp +++ b/libdvbci/descrambler.cpp @@ -135,7 +135,6 @@ int descrambler_set_key(int index, int parity, unsigned char *data) printf("Index: %d Parity: (%d) -> ", d.index, d.parity); hexdump(d.data, 32); - } return 0; } @@ -172,7 +171,6 @@ int descrambler_set_pid(int index, int enable, int pid) return 0; } - bool descrambler_open(void) { if (desc_fd > 0) diff --git a/libdvbci/dh_rsa_misc.cpp b/libdvbci/dh_rsa_misc.cpp index 84f4cb6..8575679 100644 --- a/libdvbci/dh_rsa_misc.cpp +++ b/libdvbci/dh_rsa_misc.cpp @@ -52,8 +52,8 @@ static int pkcs_1_mgf1(const uint8_t *seed, unsigned long seedlen, uint8_t *mask } static int pkcs_1_pss_encode(const uint8_t *msghash, unsigned int msghashlen, - unsigned long saltlen, unsigned long modulus_bitlen, - uint8_t *out, unsigned int outlen) + unsigned long saltlen, unsigned long modulus_bitlen, + uint8_t *out, unsigned int outlen) { unsigned char *DB, *mask, *salt, *hash; unsigned long x, y, hLen, modulus_len; @@ -211,7 +211,6 @@ int dh_mod_exp(uint8_t *dest, int dest_len, uint8_t *base, int base_len, uint8_t BN_mod_exp(bn_dest, bn_base, bn_exp, bn_mod, ctx); BN_CTX_free(ctx); - len = BN_num_bytes(bn_dest); if (len > dest_len) { diff --git a/libdvbci/dvbci_appmgr.cpp b/libdvbci/dvbci_appmgr.cpp index aab8157..f3a438b 100644 --- a/libdvbci/dvbci_appmgr.cpp +++ b/libdvbci/dvbci_appmgr.cpp @@ -130,10 +130,12 @@ bool eDVBCIApplicationManagerSession::readBlist() for (i = 0; i < 4; i++) { rc = fgetc(fd); - if (rc == ',' || rc == EOF) break; + if (rc == ',' || rc == EOF) + break; cSid[i] = (char)rc; } - if (rc == EOF) goto fin; + if (rc == EOF) + goto fin; if (i == 4) { Sid = (u16)strtol(cSid, NULL, 16); diff --git a/libdvbci/dvbci_camgr.h b/libdvbci/dvbci_camgr.h index 932ebff..d85f09d 100644 --- a/libdvbci/dvbci_camgr.h +++ b/libdvbci/dvbci_camgr.h @@ -18,10 +18,7 @@ class eDVBCICAManagerSession: public eDVBCISession eDVBCICAManagerSession(eDVBCISlot *tslot); ~eDVBCICAManagerSession(); - const std::vector &getCAIDs() const - { - return caids; - } + const std::vector &getCAIDs() const { return caids; } int sendCAPMT(unsigned char *pmt, int len); }; diff --git a/libdvbci/dvbci_ccmgr.cpp b/libdvbci/dvbci_ccmgr.cpp index a6e065b..14e8a4d 100644 --- a/libdvbci/dvbci_ccmgr.cpp +++ b/libdvbci/dvbci_ccmgr.cpp @@ -340,7 +340,6 @@ static X509 *certificate_import_and_check(struct cert_ctx *ctx, const uint8_t *d return cert; } - /* CI+ credentials */ #define MAX_ELEMENTS 33 @@ -394,7 +393,6 @@ struct cc_ctrl_data RSA *rsa_device_key; }; - static struct element *element_get(struct cc_ctrl_data *cc_data, unsigned int id) { /* array index */ @@ -964,20 +962,16 @@ static int data_get_handle_new(struct cc_ctrl_data *cc_data, unsigned int id) /* generate DHSK & AKH */ check_dh_challenge(cc_data); break; - case 19: /* auth_nonce - triggers new dh keychallenge - invalidates DHSK & AKH */ /* generate DHPH & Signature_A */ restart_dh_challenge(cc_data); break; - case 21: /* Ns_module - triggers SAC key calculation */ generate_ns_host(cc_data); generate_key_seed(cc_data); generate_SAK_SEK(cc_data->sak, cc_data->sek, cc_data->ks_host); break; - /* SAC data messages */ - case 6: //CICAM_id case 12: //keyprecursor check_new_key(cc_data); @@ -989,7 +983,6 @@ static int data_get_handle_new(struct cc_ctrl_data *cc_data, unsigned int id) case 28: //key register check_new_key(cc_data); break; - default: printf("%s -> %s unhandled ID (%d)\n", FILENAME, __FUNCTION__, id); break; @@ -1218,7 +1211,7 @@ bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_data_req(eDVBCISlot *tslot, void eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_sync_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int #if y_debug - len + len #endif ) { @@ -1406,7 +1399,6 @@ int eDVBCIContentControlManagerSession::receivedAPDU(const unsigned char *tag, c int eDVBCIContentControlManagerSession::doAction() { - printf("%s > %s\n", FILENAME, __FUNCTION__); switch (state) { diff --git a/libdvbci/dvbci_resmgr.cpp b/libdvbci/dvbci_resmgr.cpp index 3af04a7..26f92e5 100644 --- a/libdvbci/dvbci_resmgr.cpp +++ b/libdvbci/dvbci_resmgr.cpp @@ -76,16 +76,16 @@ int eDVBCIResourceManagerSession::doAction() { const unsigned char data[][4] = { - {0x00, 0x01, 0x00, 0x41}, // resource - {0x00, 0x02, 0x00, 0x41}, // application V1 - {0x00, 0x02, 0x00, 0x43}, // application V3 - {0x00, 0x03, 0x00, 0x41}, // conditional access - {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, 0x8e, 0x10, 0x01} // cam upgrade (dummy) -// {0x00, 0x10, 0x00, 0x41} // auth. + {0x00, 0x01, 0x00, 0x41}, // resource + {0x00, 0x02, 0x00, 0x41}, // application V1 + {0x00, 0x02, 0x00, 0x43}, // application V3 + {0x00, 0x03, 0x00, 0x41}, // conditional access + {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, 0x8e, 0x10, 0x01} // cam upgrade (dummy) +// {0x00, 0x10, 0x00, 0x41} // auth. }; sendAPDU(tag, data, sizeof(data)); } @@ -93,14 +93,14 @@ int eDVBCIResourceManagerSession::doAction() { const unsigned char data[][4] = { - {0x00, 0x01, 0x00, 0x41}, // resource - {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, 0x40, 0x00, 0x41}, // mmi - {0x00, 0x24, 0x00, 0x41} // date-time -// {0x00, 0x10, 0x00, 0x41} // auth. + {0x00, 0x01, 0x00, 0x41}, // resource + {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, 0x40, 0x00, 0x41}, // mmi + {0x00, 0x24, 0x00, 0x41} // date-time +// {0x00, 0x10, 0x00, 0x41} // auth. }; sendAPDU(tag, data, sizeof(data)); } diff --git a/libdvbci/dvbci_session.h b/libdvbci/dvbci_session.h index 37580dd..c17cf9c 100644 --- a/libdvbci/dvbci_session.h +++ b/libdvbci/dvbci_session.h @@ -33,15 +33,7 @@ class eDVBCISession static void deleteSessions(const eDVBCISlot *slot); void sendSPDU(unsigned char tag, const void *data, int len, const void *apdu = 0, int alen = 0); - int poll() - { - if (action) - { - action = doAction(); - return 1; - } - return 0; - } + int poll() { if (action) { action = doAction(); return 1; } return 0; } enum { stateInCreation, stateBusy, stateInDeletion, stateStarted, statePrivate}; static int parseLengthField(const unsigned char *pkt, int &len); @@ -49,14 +41,8 @@ class eDVBCISession static void receiveData(eDVBCISlot *slot, const unsigned char *ptr, size_t len); - int getState() - { - return state; - } - int getStatus() - { - return status; - } + int getState() { return state; } + int getStatus() { return status; } static int pollAll(); }; @@ -75,5 +61,4 @@ class eDVBCIHostControlSession: public eDVBCISession ~eDVBCIHostControlSession(); }; - #endif