patch for broken DVD drives/kernels

H}kan Hjort d95hjort at dtek.chalmers.se
Thu Oct 10 19:22:25 CEST 2002


I've gotten several bugreports where the disc key isn't read from
the DVD drives properly i.e. libdvdcss says 
 "failed to decrypt the disc key, trying to crack it instead"
This means that no player key managed to produce a vaild decryption of 
any of the keys entried in the disc key block.
So it fallsback to cracking it, only the disc key is infact just
random data (lots of ffff followed by random garbage).
This is what that the kernel/drive has delivered to us.

Have anyone else seen this, or have any idea what could be causing it?

I have managed to repoduce it here on some FreeBSD machines..
but on an identical machine (execpt for the DVD drive brand) it
does works.  Some of the reports are from Linux users, and there have
been seveal different drive brands.

This is with libdvdcss 1.2.2, though even 0.0.3.ogle3 gets the same
data (only it works as it doesn't know how to crack the disc keys).

It doesn't matter if the region is unset, set to a matching region or
some other region.

I think that we shouldn't fall back to cracking the key, we have 
_all_ (I think) of the player keys, so if it fails it's really an
error indicating that the disc key block is invalid.  So we should 
insead fall back to cracking the title keys directly.
This will not guard users how have set DVDCSS_METHOD to disc though.

I still wonder if it's the drives, the kernel, the ide chipset or 
our css-auth sequence that is messing things up.

-- 
Håkan Hjort
-------------- next part --------------
Index: src/css.c
===================================================================
RCS file: /var/cvs/videolan/libdvdcss/src/css.c,v
retrieving revision 1.16
diff -p -u -d -r1.16 css.c
--- src/css.c	10 Oct 2002 12:44:28 -0000	1.16
+++ src/css.c	10 Oct 2002 17:05:30 -0000
@@ -391,9 +391,12 @@ int _dvdcss_disckey( dvdcss_t dvdcss )
                 break;
             }
             _dvdcss_debug( dvdcss, "failed to decrypt the disc key, "
-                                   "trying to crack it instead" );
+			           "faulty drive/kernel? "
+			           "cracking title keys instead" );
 
-            /* Fallback */
+	    /* Fallback, but not to DISC as the disc key might be faulty */
+            dvdcss->i_method = DVDCSS_METHOD_TITLE;
+	    break;
 
         case DVDCSS_METHOD_DISC:
 
@@ -407,6 +410,7 @@ int _dvdcss_disckey( dvdcss_t dvdcss )
                 break;
             }
             _dvdcss_debug( dvdcss, "failed to crack the disc key" );
+            memset( p_disc_key, 0, KEY_SIZE );
             dvdcss->i_method = DVDCSS_METHOD_TITLE;
             break;
 
@@ -942,7 +946,7 @@ static int DecryptDiscKey( u8 const *p_s
             DecryptKey( 0, p_disc_key, p_struct_disckey, p_verify );
 
             /* If the position / player key pair worked then return. */
-            if( memcmp( p_disc_key, p_verify, 5 ) == 0 )
+            if( memcmp( p_disc_key, p_verify, KEY_SIZE ) == 0 )
             {
                 return 0;
             }
@@ -952,6 +956,7 @@ static int DecryptDiscKey( u8 const *p_s
 
     /* Have tried all combinations of positions and keys, 
      * and we still didn't succeed. */
+    memset( p_disc_key, 0, KEY_SIZE );
     return -1;
 }
 


More information about the libdvdcss-devel mailing list