1 /*****************************************************************************
2 * css.c: Functions for DVD authentification and unscrambling
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: css.c,v 1.5 2001/07/11 02:01:03 sam Exp $
7 * Author: Stéphane Borel <stef@via.ecp.fr>
10 * - css-auth by Derek Fawcus <derek@spider.com>
11 * - DVD CSS ioctls example program by Andrew T. Veliath <andrewtv@usa.net>
12 * - The Divide and conquer attack by Frank A. Stevenson <frank@funcom.com>
13 * - DeCSSPlus by Ethan Hawke
15 * see http://www.lemuria.org/DeCSS/ by Tom Vogt for more information.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
30 *****************************************************************************/
32 /*****************************************************************************
34 *****************************************************************************/
45 #include "videolan/dvdcss.h"
46 #include "libdvdcss.h"
49 # include "csstables.h"
53 /*****************************************************************************
55 *****************************************************************************/
57 static int CSSGetASF ( dvdcss_handle dvdcss );
58 static void CSSCryptKey ( int i_key_type, int i_varient,
59 u8 const * p_challenge, u8* p_key );
60 static int CSSCracker ( int i_start, unsigned char * p_crypted,
61 unsigned char * p_decrypted,
62 dvd_key_t * p_sector_key, dvd_key_t * p_key );
65 /*****************************************************************************
66 * CSSTest : check if the disc is encrypted or not
67 *****************************************************************************/
68 int CSSTest( dvdcss_handle dvdcss )
70 int i_ret, i_copyright;
72 i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
76 /* Since it's the first ioctl we try to issue, we add a notice */
77 _dvdcss_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
78 "make sure DVD ioctls were compiled in" );
86 /*****************************************************************************
87 * CSSInit : CSS Structure initialisation and DVD authentication.
88 *****************************************************************************
89 * It simulates the mutual authentication between logical unit and host.
90 * Since we don't need the disc key to find the title key, we just run the
91 * basic unavoidable commands to authenticate device and disc.
92 *****************************************************************************/
93 int CSSInit( dvdcss_handle dvdcss )
96 /* structures defined in cdrom.h or dvdio.h */
97 unsigned char p_buffer[2048 + 4 + 1];
103 /* Test authentication success */
104 switch( CSSGetASF( dvdcss ) )
110 _dvdcss_debug( dvdcss, "already authenticated" );
114 _dvdcss_debug( dvdcss, "need to authenticate" );
117 /* Init sequence, request AGID */
118 for( i = 1; i < 4 ; ++i )
120 sprintf( psz_warning, "requesting AGID %d", i );
121 _dvdcss_debug( dvdcss, psz_warning );
123 i_ret = ioctl_ReportAgid( dvdcss->i_fd, &i_agid );
127 /* No error during ioctl: we know the device is authenticated */
131 _dvdcss_error( dvdcss, "ioctl_ReportAgid failed, invalidating" );
134 ioctl_InvalidateAgid( dvdcss->i_fd, &i_agid );
137 /* Unable to authenticate without AGID */
140 _dvdcss_error( dvdcss, "ioctl_ReportAgid failed, fatal" );
144 for( i = 0 ; i < 10; ++i )
146 dvdcss->css.disc.p_challenge[i] = i;
149 /* Get challenge from host */
150 for( i = 0 ; i < 10 ; ++i )
152 p_buffer[9-i] = dvdcss->css.disc.p_challenge[i];
155 /* Send challenge to LU */
156 if( ioctl_SendChallenge( dvdcss->i_fd, &i_agid, p_buffer ) < 0 )
158 _dvdcss_error( dvdcss, "ioctl_SendChallenge failed" );
162 /* Get key1 from LU */
163 if( ioctl_ReportKey1( dvdcss->i_fd, &i_agid, p_buffer ) < 0)
165 _dvdcss_error( dvdcss, "ioctl_ReportKey1 failed" );
169 /* Send key1 to host */
170 for( i = 0 ; i < KEY_SIZE ; i++ )
172 dvdcss->css.disc.p_key1[i] = p_buffer[4-i];
175 for( i = 0 ; i < 32 ; ++i )
177 CSSCryptKey( 0, i, dvdcss->css.disc.p_challenge,
178 dvdcss->css.disc.p_key_check );
180 if( memcmp( dvdcss->css.disc.p_key_check,
181 dvdcss->css.disc.p_key1, KEY_SIZE ) == 0 )
183 sprintf( psz_warning, "drive authentic, using variant %d", i );
184 _dvdcss_debug( dvdcss, psz_warning );
185 dvdcss->css.disc.i_varient = i;
192 _dvdcss_error( dvdcss, "drive would not authenticate" );
196 /* Get challenge from LU */
197 if( ioctl_ReportChallenge( dvdcss->i_fd, &i_agid, p_buffer ) < 0 )
199 _dvdcss_error( dvdcss, "ioctl_ReportKeyChallenge failed" );
203 /* Send challenge to host */
204 for( i = 0 ; i < 10 ; ++i )
206 dvdcss->css.disc.p_challenge[i] = p_buffer[9-i];
209 CSSCryptKey( 1, dvdcss->css.disc.i_varient,
210 dvdcss->css.disc.p_challenge,
211 dvdcss->css.disc.p_key2 );
213 /* Get key2 from host */
214 for( i = 0 ; i < KEY_SIZE ; ++i )
216 p_buffer[4-i] = dvdcss->css.disc.p_key2[i];
219 /* Send key2 to LU */
220 if( ioctl_SendKey2( dvdcss->i_fd, &i_agid, p_buffer ) < 0 )
222 _dvdcss_error( dvdcss, "ioctl_SendKey2 failed" );
226 _dvdcss_debug( dvdcss, "authentication established" );
228 memcpy( dvdcss->css.disc.p_challenge,
229 dvdcss->css.disc.p_key1, KEY_SIZE );
230 memcpy( dvdcss->css.disc.p_challenge+KEY_SIZE,
231 dvdcss->css.disc.p_key2, KEY_SIZE );
233 CSSCryptKey( 2, dvdcss->css.disc.i_varient,
234 dvdcss->css.disc.p_challenge,
235 dvdcss->css.disc.p_key_check );
237 _dvdcss_debug( dvdcss, "received session key" );
244 /* Test authentication success */
245 switch( CSSGetASF( dvdcss ) )
251 _dvdcss_debug( dvdcss, "already authenticated" );
255 _dvdcss_debug( dvdcss, "need to get disc key" );
258 /* Get encrypted disc key */
259 if( ioctl_ReadKey( dvdcss->i_fd, &i_agid, p_buffer ) < 0 )
261 _dvdcss_error( dvdcss, "ioctl_ReadKey failed" );
265 fprintf( stderr, "DISK KEY: %02x %02x %02x %02x %02x\n", p_buffer[0], p_buffer[1], p_buffer[2], p_buffer[3], p_buffer[4] );
267 /* Unencrypt disc key using bus key */
268 for( i = 0 ; i < 2048 ; i++ )
270 p_buffer[ i ] ^= dvdcss->css.disc.p_key_check[ 4 - (i % KEY_SIZE) ];
272 memcpy( dvdcss->css.disc.p_key_check, p_buffer, 2048 );
274 /* Test authentication success */
275 switch( CSSGetASF( dvdcss ) )
281 _dvdcss_debug( dvdcss, "successfully authenticated" );
285 _dvdcss_error( dvdcss, "no way to authenticate" );
290 _dvdcss_error( dvdcss, "CSS decryption is disabled in this module" );
292 #endif /* HAVE_CSS */
297 /*****************************************************************************
298 * CSSGetKey : get title key.
299 *****************************************************************************
300 * The DVD should have been opened and authenticated before.
301 *****************************************************************************/
302 int CSSGetKey( dvdcss_handle dvdcss, int i_pos, dvd_key_t p_titlekey )
306 * Title key cracking method from Ethan Hawke,
307 * with Frank A. Stevenson algorithm.
308 * Does not use any player key table and ioctls.
312 boolean_t b_encrypted;
313 boolean_t b_stop_scanning;
319 for( i = 0 ; i < KEY_SIZE ; i++ )
329 i_pos = dvdcss_seek( dvdcss, i_pos );
330 i_blocks_read = dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS );
332 /* PES_scrambling_control */
333 if( p_buf[0x14] & 0x30 )
339 for( i = 2 ; i < 0x30 ; i++ )
342 j < 0x80 && ( p_buf[0x7F - (j%i)] == p_buf[0x7F-j] );
345 if( j > i_best_plen )
353 if( ( i_best_plen > 20 ) && ( i_best_plen / i_best_p >= 2) )
355 i = CSSCracker( 0, &p_buf[0x80],
356 &p_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p],
357 (dvd_key_t*)&p_buf[0x54],
359 b_stop_scanning = ( i >= 0 );
363 i_pos += i_blocks_read;
365 } while( i_blocks_read == 0x1 && !b_stop_scanning );
367 if( b_stop_scanning )
369 memcpy( p_titlekey, &p_key, sizeof(dvd_key_t) );
370 _dvdcss_debug( dvdcss, "vts key initialized" );
376 _dvdcss_debug( dvdcss, "file was unscrambled" );
383 _dvdcss_error( dvdcss, "css decryption unavailable" );
386 #endif /* HAVE_CSS */
389 /*****************************************************************************
390 * CSSDescrambleSector
391 *****************************************************************************
392 * sec : sector to descramble
393 * key : title key for this sector
394 *****************************************************************************/
395 int CSSDescrambleSector( dvd_key_t p_key, u8* p_sec )
398 unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
399 u8* p_end = p_sec + 0x800;
401 /* PES_scrambling_control */
402 if( p_sec[0x14] & 0x30)
404 i_t1 = ((p_key)[0] ^ p_sec[0x54]) | 0x100;
405 i_t2 = (p_key)[1] ^ p_sec[0x55];
406 i_t3 = (((p_key)[2]) | ((p_key)[3] << 8) |
407 ((p_key)[4] << 16)) ^ ((p_sec[0x56]) |
408 (p_sec[0x57] << 8) | (p_sec[0x58] << 16));
410 i_t3 = i_t3 * 2 + 8 - i_t4;
414 while( p_sec != p_end )
416 i_t4 = p_css_tab2[i_t2] ^ p_css_tab3[i_t1];
418 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
419 i_t4 = p_css_tab5[i_t4];
420 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
421 i_t3 ) >> 8 ) ^ i_t3 ) >> 5) & 0xff;
422 i_t3 = (i_t3 << 8 ) | i_t6;
423 i_t6 = p_css_tab4[i_t6];
425 *p_sec = p_css_tab1[*p_sec] ^( i_t5 & 0xff );
436 #endif /* HAVE_CSS */
441 /* Following functions are local */
443 /*****************************************************************************
444 * CSSGetASF : Get Authentification success flag
445 *****************************************************************************
448 * 0 if the device needs to be authenticated,
450 *****************************************************************************/
451 static int CSSGetASF( dvdcss_handle dvdcss )
456 for( i_agid = 0 ; i_agid < 4 ; i_agid++ )
458 if( ioctl_ReportASF( dvdcss->i_fd, &i_agid, &i_asf ) == 0 )
462 _dvdcss_debug( dvdcss, "GetASF authenticated" );
466 _dvdcss_debug( dvdcss, "GetASF not authenticated" );
473 /* The ioctl process has failed */
474 _dvdcss_error( dvdcss, "GetASF fatal error" );
478 /*****************************************************************************
479 * CSSCryptKey : shuffles bits and unencrypt keys.
480 *****************************************************************************
481 * Used during authentication and disc key negociation in CSSInit.
482 * i_key_type : 0->key1, 1->key2, 2->buskey.
483 * i_varient : between 0 and 31.
484 *****************************************************************************/
485 static void CSSCryptKey( int i_key_type, int i_varient,
486 u8 const * p_challenge, u8* p_key )
488 /* Permutation table for challenge */
489 u8 pp_perm_challenge[3][10] =
490 { { 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 },
491 { 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 },
492 { 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 } };
494 /* Permutation table for varient table for key2 and buskey */
495 u8 pp_perm_varient[2][32] =
496 { { 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d,
497 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d,
498 0x02, 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05,
499 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 },
500 { 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e,
501 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c,
502 0x13, 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f,
503 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d } };
506 { 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73,
507 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42,
508 0x63, 0x16, 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B,
509 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 };
511 /* The "secret" key */
512 u8 p_secret[5] = { 0x55, 0xD6, 0xC4, 0xC5, 0x28 };
518 u8 i_lfsr0_o; /* 1 bit used */
519 u8 i_lfsr1_o; /* 1 bit used */
532 for (i = 9; i >= 0; --i)
533 p_scratch[i] = p_challenge[pp_perm_challenge[i_key_type][i]];
535 i_css_varient = ( i_key_type == 0 ) ? i_varient :
536 pp_perm_varient[i_key_type-1][i_varient];
539 * This encryption engine implements one of 32 variations
540 * one the same theme depending upon the choice in the
541 * varient parameter (0 - 31).
543 * The algorithm itself manipulates a 40 bit input into
545 * The parameter 'input' is 80 bits. It consists of
546 * the 40 bit input value that is to be encrypted followed
547 * by a 40 bit seed value for the pseudo random number
551 /* Feed the secret into the input values such that
552 * we alter the seed to the LFSR's used above, then
553 * generate the bits to play with.
555 for( i = 5 ; --i >= 0 ; )
557 p_tmp1[i] = p_scratch[5 + i] ^ p_secret[i] ^ p_crypt_tab2[i];
561 * We use two LFSR's (seeded from some of the input data bytes) to
562 * generate two streams of pseudo-random bits. These two bit streams
563 * are then combined by simply adding with carry to generate a final
564 * sequence of pseudo-random bits which is stored in the buffer that
565 * 'output' points to the end of - len is the size of this buffer.
567 * The first LFSR is of degree 25, and has a polynomial of:
568 * x^13 + x^5 + x^4 + x^1 + 1
570 * The second LSFR is of degree 17, and has a (primitive) polynomial of:
573 * I don't know if these polynomials are primitive modulo 2, and thus
574 * represent maximal-period LFSR's.
577 * Note that we take the output of each LFSR from the new shifted in
578 * bit, not the old shifted out bit. Thus for ease of use the LFSR's
579 * are implemented in bit reversed order.
583 /* In order to ensure that the LFSR works we need to ensure that the
584 * initial values are non-zero. Thus when we initialise them from
585 * the seed, we ensure that a bit is set.
587 i_lfsr0 = ( p_tmp1[0] << 17 ) | ( p_tmp1[1] << 9 ) |
588 (( p_tmp1[2] & ~7 ) << 1 ) | 8 | ( p_tmp1[2] & 7 );
589 i_lfsr1 = ( p_tmp1[3] << 9 ) | 0x100 | p_tmp1[4];
591 i_index = sizeof(p_bits);
596 for( i_bit = 0, i_val = 0 ; i_bit < 8 ; ++i_bit )
599 i_lfsr0_o = ( ( i_lfsr0 >> 24 ) ^ ( i_lfsr0 >> 21 ) ^
600 ( i_lfsr0 >> 20 ) ^ ( i_lfsr0 >> 12 ) ) & 1;
601 i_lfsr0 = ( i_lfsr0 << 1 ) | i_lfsr0_o;
603 i_lfsr1_o = ( ( i_lfsr1 >> 16 ) ^ ( i_lfsr1 >> 2 ) ) & 1;
604 i_lfsr1 = ( i_lfsr1 << 1 ) | i_lfsr1_o;
606 i_combined = !i_lfsr1_o + i_carry + !i_lfsr0_o;
608 i_carry = ( i_combined >> 1 ) & 1;
609 i_val |= ( i_combined & 1 ) << i_bit;
612 p_bits[--i_index] = i_val;
613 } while( i_index > 0 );
615 /* This term is used throughout the following to
616 * select one of 32 different variations on the
619 i_cse = p_varients[i_css_varient] ^ p_crypt_tab2[i_css_varient];
621 /* Now the actual blocks doing the encryption. Each
622 * of these works on 40 bits at a time and are quite
626 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = p_scratch[i] )
628 i_index = p_bits[25 + i] ^ p_scratch[i];
629 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
631 p_tmp1[i] = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
633 p_tmp1[4] ^= p_tmp1[0];
635 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = p_tmp1[i] )
637 i_index = p_bits[20 + i] ^ p_tmp1[i];
638 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
640 p_tmp2[i] = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
642 p_tmp2[4] ^= p_tmp2[0];
644 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = p_tmp2[i] )
646 i_index = p_bits[15 + i] ^ p_tmp2[i];
647 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
648 i_index = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
650 p_tmp1[i] = p_crypt_tab0[i_index] ^ p_crypt_tab2[i_index];
652 p_tmp1[4] ^= p_tmp1[0];
654 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = p_tmp1[i] )
656 i_index = p_bits[10 + i] ^ p_tmp1[i];
657 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
659 i_index = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
661 p_tmp2[i] = p_crypt_tab0[i_index] ^ p_crypt_tab2[i_index];
663 p_tmp2[4] ^= p_tmp2[0];
665 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = p_tmp2[i] )
667 i_index = p_bits[5 + i] ^ p_tmp2[i];
668 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
670 p_tmp1[i] = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
672 p_tmp1[4] ^= p_tmp1[0];
674 for(i = 5, i_term = 0 ; --i >= 0 ; i_term = p_tmp1[i] )
676 i_index = p_bits[i] ^ p_tmp1[i];
677 i_index = p_crypt_tab1[i_index] ^ ~p_crypt_tab2[i_index] ^ i_cse;
679 p_key[i] = p_crypt_tab2[i_index] ^ p_crypt_tab3[i_index] ^ i_term;
685 /*****************************************************************************
686 * CSSCracker : title key decryption by cracking
687 *****************************************************************************
688 * This function is called by CSSGetKeys to find a key
689 *****************************************************************************/
690 static int CSSCracker( int i_start,
691 unsigned char * p_crypted,
692 unsigned char * p_decrypted,
693 dvd_key_t * p_sector_key,
696 unsigned char p_buffer[10];
697 unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
699 unsigned int i_candidate;
704 for( i = 0 ; i < 10 ; i++ )
706 p_buffer[i] = p_css_tab1[p_crypted[i]] ^ p_decrypted[i];
709 for( i_try = i_start ; i_try < 0x10000 ; i_try++ )
711 i_t1 = i_try >> 8 | 0x100;
713 i_t3 = 0; /* not needed */
716 /* iterate cipher 4 times to reconstruct LFSR2 */
717 for( i = 0 ; i < 4 ; i++ )
719 /* advance LFSR1 normaly */
720 i_t4 = p_css_tab2[i_t2] ^ p_css_tab3[i_t1];
722 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
723 i_t4 = p_css_tab5[i_t4];
724 /* deduce i_t6 & i_t5 */
728 i_t6 = ( i_t6 + 0xff ) & 0x0ff;
736 i_t6 = p_css_tab4[ i_t6 ];
737 /* feed / advance i_t3 / i_t5 */
738 i_t3 = ( i_t3 << 8 ) | i_t6;
744 /* iterate 6 more times to validate candidate key */
745 for( ; i < 10 ; i++ )
747 i_t4 = p_css_tab2[i_t2] ^ p_css_tab3[i_t1];
749 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
750 i_t4 = p_css_tab5[i_t4];
751 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
752 i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
753 i_t3 = ( i_t3 << 8 ) | i_t6;
754 i_t6 = p_css_tab4[i_t6];
756 if( ( i_t5 & 0xff ) != p_buffer[i] )
766 /* Do 4 backwards steps of iterating t3 to deduce initial state */
768 for( i = 0 ; i < 4 ; i++ )
771 i_t3 = ( i_t3 >> 8 );
772 /* easy to code, and fast enough bruteforce
773 * search for byte shifted in */
774 for( j = 0 ; j < 256 ; j++ )
776 i_t3 = ( i_t3 & 0x1ffff) | ( j << 17 );
777 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
778 i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
786 i_t4 = ( i_t3 >> 1 ) - 4;
787 for( i_t5 = 0 ; i_t5 < 8; i_t5++ )
789 if( ( ( i_t4 + i_t5 ) * 2 + 8 - ( (i_t4 + i_t5 ) & 7 ) )
792 (*p_key)[0] = i_try>>8;
793 (*p_key)[1] = i_try & 0xFF;
794 (*p_key)[2] = ( ( i_t4 + i_t5 ) >> 0) & 0xFF;
795 (*p_key)[3] = ( ( i_t4 + i_t5 ) >> 8) & 0xFF;
796 (*p_key)[4] = ( ( i_t4 + i_t5 ) >> 16) & 0xFF;
805 (*p_key)[0] ^= (*p_sector_key)[0];
806 (*p_key)[1] ^= (*p_sector_key)[1];
807 (*p_key)[2] ^= (*p_sector_key)[2];
808 (*p_key)[3] ^= (*p_sector_key)[3];
809 (*p_key)[4] ^= (*p_sector_key)[4];
815 #endif /* HAVE_CSS */