Thread Closed
OpenELEC Testbuilds for RaspberryPi (Kodi 17.0)
(2015-12-05, 21:08)popcornmix Wrote:
(2015-12-05, 20:56)nalor Wrote: I analyzed the aacs.c a little bit and I think I know where it crashed - there's a division by zero in one of the procedures because of the len=0 return value.

But I think we need to decide what the result of those fixes should be - should the iso finally play? After fixing the code above libaacs finally exits with 'AACS_ERROR_CORRUPTED_DISC' because the disc contains an AACS folder - but no valid AACS data....

So I think in the end all we can reach is that nothing is crashing, but as the disc is still corrupt it won't play Sad

Ideally it should behave the same as it does when libaacs is not present.
The disk is playable on the Pi - at least with 3D/MVC enabled where we just play the ssif file.

Today I've found time to fix the problem - at least on my windows kodi I can play the 'special' iso and encrypted iso's without problems - so hopefully it's also working on the RPi2 Smile

Here's the additional patch (the other one from the previous post is also necessary):

--- aacs_orig.c    2015-03-13 10:20:13.000000000 +0100
+++ aacs.c    2015-12-08 10:54:21.636131922 +0100
@@ -282,6 +282,7 @@
     num_uvs = len / 5;

     if (num_uvs < 1) {
+        BD_DEBUG(DBG_AACS, "No UVS detected - corrupted disc\n");

@@ -663,6 +664,7 @@
                                uint8_t *mk, uint8_t *vuk)
     char str[48];
+    char str2[48];

     aacs->uks = NULL;
     aacs->num_uks = 0;
@@ -684,7 +686,7 @@
             hexstring_to_hex_array(mk, 16, ce->entry.mek);

             BD_DEBUG(DBG_AACS, "Found media key for %s: %s\n",
-                  ce->entry.discid, str_print_hex(str, mk, 16));
+                  str_print_hex(str2, ce->entry.discid, 20), str_print_hex(str, mk, 16));

         if (ce->entry.vid) {
@@ -692,14 +694,14 @@

             BD_DEBUG(DBG_AACS, "Found volume id for %s: %s\n",
-                  ce->entry.discid, str_print_hex(str, aacs->vid, 16));
+                  str_print_hex(str2, ce->entry.discid, 20), str_print_hex(str, aacs->vid, 16));

         if (ce->entry.vuk) {
             hexstring_to_hex_array(vuk, 16, ce->entry.vuk);

             BD_DEBUG(DBG_AACS, "Found volume unique key for %s: %s\n",
-                  ce->entry.discid, str_print_hex(str, vuk, 16));
+                  str_print_hex(str2, ce->entry.discid, 20), str_print_hex(str, vuk, 16));

         if (ce-> {
@@ -1007,12 +1009,17 @@
     config_file *cf;
     int error_code;
+    /* in case the unit_key_ro.inf contains only NULL byte values it's SHA1 hash is 'ec6afe5df8a1325068b95313f82bd72c09d4f963' - there are a few unencrypted discs available that need a special workaround */
+    const uint8_t null_byte_discid[20] = { 0xec, 0x6a, 0xfe, 0x5d, 0xf8, 0xa1, 0x32, 0x50, 0x68, 0xb9, 0x53, 0x13, 0xf8, 0x2b, 0xd7, 0x2c, 0x09, 0xd4, 0xf9, 0x63 };

     aacs->path = path ? str_printf("%s", path) : NULL;

     error_code = _calc_title_hash(aacs);
     if (error_code != AACS_SUCCESS) {
         return error_code;
+    } else if (memcmp(aacs->disc_id, null_byte_discid, 20)==0) {
+        BD_DEBUG(DBG_AACS, "Detected 0-Byte AACS file - no AACS processing necessary\n");
+        return AACS_SUCCESS;

     cf = keydbcfg_config_load(configfile_path);
@@ -1299,3 +1306,4 @@

     BD_DEBUG(DBG_AACS|DBG_CRIT, "aacs_set_title(%d): invalid title !\n", title);

Finally it includes only very little changes:

  1. one additional debug line
  2. a correction of the debug output in procedure '_find_config_entry'
  3. and finally the change that corrects the problem: the discid for those 'special' discs is always identical because the file 'UNIT_KEY_RO.INF' contains only NULL-bytes and so I've simply created a constant for this special 'null_byte_discid' and in case the procedure '_calc_title_hash' (that calculates the discid for the current disc) successfully returns there's now a comparison to check if the current disc is a special disc or not - and in case it is simply return 'AACS_SUCCESS' and everything is fine. This is working because the final decryption of the disc is done in procedure 'aacs_decrypt_unit' and the first action inside this procedure is to check if the unit is encrypted at all and in case it isn't it simply returns success (and in our 'special' case nothing is encrypted so everything is working well Smile )

Hopefully this is working for Milhouse too and we can reenable libaacs support Smile

PS: there's no division by zero error....
  Thread Closed
Thread Rating:
  • 6 Vote(s) - 5 Average

Messages In This Thread
RE: OpenELEC Testbuilds for RaspberryPi (Kodi 17.0) - by nalor - 2015-12-08, 12:21
RPI 3 no internet access on wifi - by b1m1 - 2016-03-09, 14:44

Logout Mark Read Team Forum Stats Members Help
OpenELEC Testbuilds for RaspberryPi (Kodi 17.0)56
This forum uses Lukasz Tkacz MyBB addons.