libaacs | branch: master | npzacs <npz...@gmail.com> | Fri Feb  5 10:46:01 2016 
+0200| [a7cd56cc00b6d1667bf3d2c492b44b08747bdb82] | committer: npzacs

Split unit bus decryption to separate function

> http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=a7cd56cc00b6d1667bf3d2c492b44b08747bdb82
---

 src/libaacs/aacs.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/libaacs/aacs.c b/src/libaacs/aacs.c
index 46ae538..822bd36 100644
--- a/src/libaacs/aacs.c
+++ b/src/libaacs/aacs.c
@@ -1218,6 +1218,16 @@ void aacs_close(AACS *aacs)
     X_FREE(aacs);
 }
 
+static void _decrypt_unit_bus(AACS *aacs, uint8_t *buf)
+{
+    if (aacs->bee && aacs->bec) {
+        unsigned int i;
+        for (i = 0; i < ALIGNED_UNIT_LEN; i += SECTOR_LEN) {
+            _decrypt_bus(aacs, buf + i);
+        }
+    }
+}
+
 int aacs_decrypt_unit(AACS *aacs, uint8_t *buf)
 {
     unsigned int i;
@@ -1228,11 +1238,7 @@ int aacs_decrypt_unit(AACS *aacs, uint8_t *buf)
     }
 
     /* handle bus encryption first */
-    if (aacs->bee && aacs->bec) {
-        for (i = 0; i < ALIGNED_UNIT_LEN; i += SECTOR_LEN) {
-            _decrypt_bus(aacs, buf + i);
-        }
-    }
+    _decrypt_unit_bus(aacs, buf);
 
     /* decrypt in-place if current unit key is known */
     if (BD_LIKELY(aacs->cps_unit_selected) || BD_LIKELY(aacs->num_uks == 1)) {

_______________________________________________
libaacs-devel mailing list
libaacs-devel@videolan.org
https://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to