diff --git a/src/descrambler/libaesdec/libaesdec.c b/src/descrambler/libaesdec/libaesdec.c index 3bd30245..8e754b20 100755 --- a/src/descrambler/libaesdec/libaesdec.c +++ b/src/descrambler/libaesdec/libaesdec.c @@ -64,15 +64,16 @@ void aes_decrypt_packet(void *keys, unsigned char *packet) { AES_KEY k; xc0 = pkt[3] & 0xc0; + //skip clear pkt - if (xc0 == 0x00) { + if (xc0 == 0x00) return; - } + //skip reserved pkt - if (xc0 == 0x40) { + if (xc0 == 0x40) return; - } - if (xc0 == 0x80 || xc0 == 0xc0) { // encrypted + + if (xc0 == 0x80 || xc0 == 0xc0) { // encrypted ev_od = (xc0 & 0x40) >> 6; // 0 even, 1 odd pkt[3] &= 0x3f; // consider it decrypted now if (pkt[3] & 0x20) { // incomplete packet @@ -81,7 +82,7 @@ void aes_decrypt_packet(void *keys, unsigned char *packet) { n = len >> 3; if (n == 0) { // decrypted==encrypted! return; // this doesn't need more processing - } + } } else { len = 184; offset = 4; diff --git a/src/descrambler/libaesdec/libaesdec.h b/src/descrambler/libaesdec/libaesdec.h index 354804af..912670f3 100755 --- a/src/descrambler/libaesdec/libaesdec.h +++ b/src/descrambler/libaesdec/libaesdec.h @@ -8,22 +8,27 @@ #ifndef LIBAESDEC_H_ #define LIBAESDEC_H_ - #include "build.h" +#include "build.h" + +#if ENABLE_SSL + +void *aes_get_key_struct(void); +void aes_free_key_struct(void *keys); +void aes_set_control_words(void *keys, const unsigned char *even, const unsigned char *odd); +void aes_set_even_control_word(void *keys, const unsigned char *even); +void aes_set_odd_control_word(void *keys, const unsigned char *odd); +void aes_decrypt_packet(void *keys, unsigned char *packet); + +#else + +// empty functions +static inline void *aes_get_key_struct(void) { return 0; }; +static inline void aes_free_key_struct(void *keys) { return; }; +static inline void aes_set_control_words(void *keys, const unsigned char *even, const unsigned char *odd) { return; }; +static inline void aes_set_even_control_word(void *keys, const unsigned char *even) { return; }; +static inline void aes_set_odd_control_word(void *keys, const unsigned char *odd) { return; }; +static inline void aes_decrypt_packet(void *keys, unsigned char *packet) { return; }; + +#endif - #if ENABLE_SSL - void *aes_get_key_struct(void); - void aes_free_key_struct(void *keys); - void aes_set_control_words(void *keys, const unsigned char *even, const unsigned char *odd); - void aes_set_even_control_word(void *keys, const unsigned char *even); - void aes_set_odd_control_word(void *keys, const unsigned char *odd); - void aes_decrypt_packet(void *keys, unsigned char *packet); - #else - // empty functions - static inline void *aes_get_key_struct(void) { return 0; }; - static inline void aes_free_key_struct(void *keys) { return; }; - static inline void aes_set_control_words(void *keys, const unsigned char *even, const unsigned char *odd) { return; }; - static inline void aes_set_even_control_word(void *keys, const unsigned char *even) { return; }; - static inline void aes_set_odd_control_word(void *keys, const unsigned char *odd) { return; }; - static inline void aes_decrypt_packet(void *keys, unsigned char *packet) { return; }; - #endif #endif /* LIBAESDEC_H_ */