]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
libaesdec: more cosmetic tweaks
authorJaroslav Kysela <perex@perex.cz>
Wed, 6 Aug 2014 06:59:25 +0000 (08:59 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 6 Aug 2014 06:59:41 +0000 (08:59 +0200)
src/descrambler/libaesdec/libaesdec.c
src/descrambler/libaesdec/libaesdec.h

index 3bd30245864df1e2d0a4f5be2505e050a2809ef7..8e754b204fcf17ecd06690cc2d768cee4a60bc41 100755 (executable)
@@ -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;
index 354804af9627b353097db06d39d204be12c527e9..912670f38d62540dbda7fad5327ae383ed91e7b7 100755 (executable)
@@ -8,22 +8,27 @@
 #ifndef LIBAESDEC_H_
 #define LIBAESDEC_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 
+#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
+
 #endif /* LIBAESDEC_H_ */