libaacs | branch: master | npzacs <npz...@gmail.com> | Thu Jan 14 14:31:12 2016 
+0200| [9da2b6842a8f1212f0cd5cbd68e9a7a7ffabefa6] | committer: npzacs

Fix opening unencrypted discs without valid MKB.

Fix leak.
Simplify handling of unencrypted CPS units.

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

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

diff --git a/src/libaacs/aacs.c b/src/libaacs/aacs.c
index 21e1c9e..46ae538 100644
--- a/src/libaacs/aacs.c
+++ b/src/libaacs/aacs.c
@@ -864,8 +864,8 @@ static int _calc_uks(AACS *aacs, config_file *cf)
     uint8_t  buf[16];
     uint64_t f_pos;
     unsigned int i;
-    int error_code;
-    int vuk_tried = 0, vuk_error_code = AACS_SUCCESS;
+    int error_code = AACS_SUCCESS;
+    int vuk_error_code;
 
     uint8_t mk[16] = {0}, vuk[16] = {0};
 
@@ -879,11 +879,8 @@ static int _calc_uks(AACS *aacs, config_file *cf)
         }
     }
 
-    /* Make sure we have VUK */
-    error_code = _calc_vuk(aacs, mk, vuk, cf);
-    if (error_code != AACS_SUCCESS) {
-        return error_code;
-    }
+    /* Try to calculate VUK */
+    vuk_error_code = _calc_vuk(aacs, mk, vuk, cf);
 
     BD_DEBUG(DBG_AACS, "Calculate CPS unit keys...\n");
 
@@ -915,16 +912,13 @@ static int _calc_uks(AACS *aacs, config_file *cf)
         // Read keys
         for (i = 0; i < aacs->num_uks; i++) {
 
-            int plain = _check_cci_unencrypted(aacs, i + 1);
-
-            if (!vuk_tried) {
-                /* Make sure we have VUK */
-                vuk_error_code = _calc_vuk(aacs, mk, vuk, cf);
-                vuk_tried = 1;
-            }
             /* error out if VUK calculation fails and encrypted CPS unit is 
found */
-            if (!plain && vuk_error_code != AACS_SUCCESS) {
-                return vuk_error_code;
+            if (vuk_error_code != AACS_SUCCESS) {
+                if (!_check_cci_unencrypted(aacs, i + 1)) {
+                    error_code = vuk_error_code;
+                    break;
+                }
+                BD_DEBUG(DBG_AACS | DBG_CRIT, "WARNING: VUK calculation failed 
but disc seems to be unencrypted.\n");
             }
 
             f_pos += 48;

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

Reply via email to