1 /*****************************************************************************
2 * dvd_css.c: Functions for DVD authentification and unscrambling
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: dvd_css.c,v 1.26 2001/04/22 00:08:25 stef 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 *****************************************************************************/
48 #include "dvd_csstables.h"
50 #include "dvd_ioctl.h"
53 #include "input_dvd.h"
55 /*****************************************************************************
57 *****************************************************************************/
59 static int CSSGetASF ( int i_fd );
60 static void CSSCryptKey ( int i_key_type, int i_varient,
61 u8 const * pi_challenge, u8* pi_key );
62 static int CSSCracker ( int i_start, unsigned char * p_crypted,
63 unsigned char * p_decrypted,
64 dvd_key_t * p_sector_key, dvd_key_t * p_key );
67 /*****************************************************************************
68 * CSSTest : check if the disc is encrypted or not
69 *****************************************************************************/
70 int CSSTest( int i_fd )
72 int i_ret, i_copyright;
74 i_ret = ioctl_ReadCopyright( i_fd, 0 /* i_layer */, &i_copyright );
78 /* Since it's the first ioctl we try to issue, we add a notice */
79 intf_ErrMsg( "css error: ioctl_ReadCopyright failed, "
80 "make sure DVD ioctls were compiled in" );
88 /*****************************************************************************
89 * CSSInit : CSS Structure initialisation and DVD authentication.
90 *****************************************************************************
91 * It simulates the mutual authentication between logical unit and host.
92 * Since we don't need the disc key to find the title key, we just run the
93 * basic unavoidable commands to authenticate device and disc.
94 *****************************************************************************/
95 int CSSInit( int i_fd, css_t * p_css )
98 /* structures defined in cdrom.h or dvdio.h */
99 char p_buffer[2048 + 4 + 1];
104 /* Test authentication success */
105 switch( CSSGetASF( i_fd ) )
111 intf_WarnMsg( 3, "css info: already authenticated" );
115 intf_WarnMsg( 3, "css info: need to authenticate" );
118 /* Init sequence, request AGID */
119 for( i = 1; i < 4 ; ++i )
121 intf_WarnMsg( 3, "css info: requesting AGID %d", i );
123 i_ret = ioctl_LUSendAgid( i_fd, &i_agid );
127 /* No error during ioctl: we know the device is authenticated */
131 intf_ErrMsg( "css error: ioctl_LUSendAgid failed, invalidating" );
134 ioctl_InvalidateAgid( i_fd, &i_agid );
137 /* Unable to authenticate without AGID */
140 intf_ErrMsg( "css error: ioctl_LUSendAgid failed, fatal" );
144 for( i = 0 ; i < 10; ++i )
146 p_css->disc.pi_challenge[i] = i;
149 /* Get challenge from host */
150 for( i = 0 ; i < 10 ; ++i )
152 p_buffer[9-i] = p_css->disc.pi_challenge[i];
155 /* Send challenge to LU */
156 if( ioctl_HostSendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
158 intf_ErrMsg( "css error: ioctl_HostSendChallenge failed" );
162 /* Get key1 from LU */
163 if( ioctl_LUSendKey1( i_fd, &i_agid, p_buffer ) < 0)
165 intf_ErrMsg( "css error: ioctl_LUSendKey1 failed" );
169 /* Send key1 to host */
170 for( i = 0 ; i < KEY_SIZE ; i++ )
172 p_css->disc.pi_key1[i] = p_buffer[4-i];
175 for( i = 0 ; i < 32 ; ++i )
177 CSSCryptKey( 0, i, p_css->disc.pi_challenge,
178 p_css->disc.pi_key_check );
180 if( memcmp( p_css->disc.pi_key_check,
181 p_css->disc.pi_key1, KEY_SIZE ) == 0 )
183 intf_WarnMsg( 3, "css info: drive authentic, using variant %d", i);
184 p_css->disc.i_varient = i;
191 intf_ErrMsg( "css error: drive would not authenticate" );
195 /* Get challenge from LU */
196 if( ioctl_LUSendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
198 intf_ErrMsg( "css error: ioctl_LUSendKeyChallenge failed" );
202 /* Send challenge to host */
203 for( i = 0 ; i < 10 ; ++i )
205 p_css->disc.pi_challenge[i] = p_buffer[9-i];
208 CSSCryptKey( 1, p_css->disc.i_varient, p_css->disc.pi_challenge,
209 p_css->disc.pi_key2 );
211 /* Get key2 from host */
212 for( i = 0 ; i < KEY_SIZE ; ++i )
214 p_buffer[4-i] = p_css->disc.pi_key2[i];
217 /* Send key2 to LU */
218 if( ioctl_HostSendKey2( i_fd, &i_agid, p_buffer ) < 0 )
220 intf_ErrMsg( "css error: ioctl_HostSendKey2 failed" );
224 intf_WarnMsg( 3, "css info: authentication established" );
226 memcpy( p_css->disc.pi_challenge, p_css->disc.pi_key1, KEY_SIZE );
227 memcpy( p_css->disc.pi_challenge+KEY_SIZE, p_css->disc.pi_key2, KEY_SIZE );
229 CSSCryptKey( 2, p_css->disc.i_varient, p_css->disc.pi_challenge,
230 p_css->disc.pi_key_check );
232 intf_WarnMsg( 1, "css info: received session key" );
239 /* Test authentication success */
240 switch( CSSGetASF( i_fd ) )
246 intf_WarnMsg( 3, "css info: already authenticated" );
250 intf_WarnMsg( 3, "css info: need to get disc key" );
253 /* Get encrypted disc key */
254 if( ioctl_ReadKey( i_fd, &i_agid, p_buffer ) < 0 )
256 intf_ErrMsg( "css error: ioctl_ReadKey failed" );
260 /* Unencrypt disc key using bus key */
261 for( i = 0 ; i < 2048 ; i++ )
263 p_buffer[ i ] ^= p_css->disc.pi_key_check[ 4 - (i % KEY_SIZE) ];
265 memcpy( p_css->disc.pi_key_check, p_buffer, 2048 );
267 /* initialize title key to know it empty */
268 for( i = 0 ; i < KEY_SIZE ; i++ )
270 p_css->pi_title_key[i] = 0;
273 /* Test authentication success */
274 switch( CSSGetASF( i_fd ) )
280 intf_WarnMsg( 3, "css info: successfully authenticated" );
284 intf_ErrMsg( "css error: no way to authenticate" );
289 intf_ErrMsg( "css error: CSS decryption is disabled in this module" );
291 #endif /* HAVE_CSS */
296 /*****************************************************************************
297 * CSSGetKey : get title key.
298 *****************************************************************************
299 * The DVD should have been opened and authenticated before.
300 *****************************************************************************/
301 int CSSGetKey( int i_fd, css_t * p_css )
305 * Title key cracking method from Ethan Hawke,
306 * with Frank A. Stevenson algorithm.
307 * 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++ )
327 /* Position of the title on the disc */
328 i_pos = p_css->i_title_pos;
331 i_pos = lseek( i_fd, i_pos, SEEK_SET );
332 i_bytes_read = read( i_fd, pi_buf, 0x800 );
334 /* PES_scrambling_control */
335 if( pi_buf[0x14] & 0x30 )
341 for( i = 2 ; i < 0x30 ; i++ )
343 for( j = i ; ( j < 0x80 ) &&
344 ( pi_buf[0x7F - (j%i)] == pi_buf[0x7F-j] ) ; j++ );
346 if( ( j > i_best_plen ) && ( j > i ) )
354 if( ( i_best_plen > 20 ) && ( i_best_plen / i_best_p >= 2) )
356 i = CSSCracker( 0, &pi_buf[0x80],
357 &pi_buf[0x80 - ( i_best_plen / i_best_p) *i_best_p],
358 (dvd_key_t*)&pi_buf[0x54],
360 b_stop_scanning = ( i >= 0 );
364 i_pos += i_bytes_read;
365 } while( i_bytes_read == 0x800 && !b_stop_scanning);
369 memcpy( p_css->pi_title_key,
370 &pi_key, sizeof(dvd_key_t) );
371 intf_WarnMsg( 2, "css info: vts key initialized" );
377 intf_WarnMsg( 3, "css warning: this file was _NOT_ encrypted!" );
384 intf_ErrMsg( "css error: css decryption unavailable" );
387 #endif /* HAVE_CSS */
390 /*****************************************************************************
391 * CSSDescrambleSector
392 *****************************************************************************
393 * sec : sector to descramble
394 * key : title key for this sector
395 *****************************************************************************/
396 int CSSDescrambleSector( dvd_key_t pi_key, u8* pi_sec )
399 unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
400 u8* pi_end = pi_sec + 0x800;
402 /* PES_scrambling_control */
403 if( pi_sec[0x14] & 0x30)
405 i_t1 = ((pi_key)[0] ^ pi_sec[0x54]) | 0x100;
406 i_t2 = (pi_key)[1] ^ pi_sec[0x55];
407 i_t3 = (((pi_key)[2]) | ((pi_key)[3] << 8) |
408 ((pi_key)[4] << 16)) ^ ((pi_sec[0x56]) |
409 (pi_sec[0x57] << 8) | (pi_sec[0x58] << 16));
411 i_t3 = i_t3 * 2 + 8 - i_t4;
415 while( pi_sec != pi_end )
417 i_t4 = pi_css_tab2[i_t2] ^ pi_css_tab3[i_t1];
419 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
420 i_t4 = pi_css_tab5[i_t4];
421 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
422 i_t3 ) >> 8 ) ^ i_t3 ) >> 5) & 0xff;
423 i_t3 = (i_t3 << 8 ) | i_t6;
424 i_t6 = pi_css_tab4[i_t6];
426 *pi_sec = pi_css_tab1[*pi_sec] ^( i_t5 & 0xff );
437 #endif /* HAVE_CSS */
442 /* Following functions are local */
444 /*****************************************************************************
445 * CSSGetASF : Get Authentification success flag
446 *****************************************************************************
449 * 0 if the device needs to be authenticated,
451 *****************************************************************************/
452 static int CSSGetASF( int i_fd )
457 for( i_agid = 0 ; i_agid < 4 ; i_agid++ )
459 if( ioctl_LUSendASF( i_fd, &i_agid, &i_asf ) == 0 )
461 intf_WarnMsg( 3, "css info: GetASF %sauthenticated",
468 /* The ioctl process has failed */
469 intf_ErrMsg( "css error: GetASF fatal error" );
473 /*****************************************************************************
474 * CSSCryptKey : shuffles bits and unencrypt keys.
475 *****************************************************************************
476 * Used during authentication and disc key negociation in CSSInit.
477 * i_key_type : 0->key1, 1->key2, 2->buskey.
478 * i_varient : between 0 and 31.
479 *****************************************************************************/
480 static void CSSCryptKey( int i_key_type, int i_varient,
481 u8 const * pi_challenge, u8* pi_key )
483 /* Permutation table for challenge */
484 u8 ppi_perm_challenge[3][10] =
485 { { 1, 3, 0, 7, 5, 2, 9, 6, 4, 8 },
486 { 6, 1, 9, 3, 8, 5, 7, 4, 0, 2 },
487 { 4, 0, 3, 5, 7, 2, 8, 6, 1, 9 } };
489 /* Permutation table for varient table for key2 and buskey */
490 u8 ppi_perm_varient[2][32] =
491 { { 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d,
492 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d,
493 0x02, 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05,
494 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15 },
495 { 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e,
496 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c,
497 0x13, 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f,
498 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d } };
501 { 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73,
502 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42,
503 0x63, 0x16, 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B,
504 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01 };
506 /* The "secret" key */
507 u8 pi_secret[5] = { 0x55, 0xD6, 0xC4, 0xC5, 0x28 };
513 u8 i_lfsr0_o; /* 1 bit used */
514 u8 i_lfsr1_o; /* 1 bit used */
527 for (i = 9; i >= 0; --i)
528 pi_scratch[i] = pi_challenge[ppi_perm_challenge[i_key_type][i]];
530 i_css_varient = ( i_key_type == 0 ) ? i_varient :
531 ppi_perm_varient[i_key_type-1][i_varient];
534 * This encryption engine implements one of 32 variations
535 * one the same theme depending upon the choice in the
536 * varient parameter (0 - 31).
538 * The algorithm itself manipulates a 40 bit input into
540 * The parameter 'input' is 80 bits. It consists of
541 * the 40 bit input value that is to be encrypted followed
542 * by a 40 bit seed value for the pseudo random number
546 /* Feed the secret into the input values such that
547 * we alter the seed to the LFSR's used above, then
548 * generate the bits to play with.
550 for( i = 5 ; --i >= 0 ; )
552 pi_tmp1[i] = pi_scratch[5 + i] ^ pi_secret[i] ^ pi_crypt_tab2[i];
556 * We use two LFSR's (seeded from some of the input data bytes) to
557 * generate two streams of pseudo-random bits. These two bit streams
558 * are then combined by simply adding with carry to generate a final
559 * sequence of pseudo-random bits which is stored in the buffer that
560 * 'output' points to the end of - len is the size of this buffer.
562 * The first LFSR is of degree 25, and has a polynomial of:
563 * x^13 + x^5 + x^4 + x^1 + 1
565 * The second LSFR is of degree 17, and has a (primitive) polynomial of:
568 * I don't know if these polynomials are primitive modulo 2, and thus
569 * represent maximal-period LFSR's.
572 * Note that we take the output of each LFSR from the new shifted in
573 * bit, not the old shifted out bit. Thus for ease of use the LFSR's
574 * are implemented in bit reversed order.
578 /* In order to ensure that the LFSR works we need to ensure that the
579 * initial values are non-zero. Thus when we initialise them from
580 * the seed, we ensure that a bit is set.
582 i_lfsr0 = ( pi_tmp1[0] << 17 ) | ( pi_tmp1[1] << 9 ) |
583 (( pi_tmp1[2] & ~7 ) << 1 ) | 8 | ( pi_tmp1[2] & 7 );
584 i_lfsr1 = ( pi_tmp1[3] << 9 ) | 0x100 | pi_tmp1[4];
586 i_index = sizeof(pi_bits);
591 for( i_bit = 0, i_val = 0 ; i_bit < 8 ; ++i_bit )
594 i_lfsr0_o = ( ( i_lfsr0 >> 24 ) ^ ( i_lfsr0 >> 21 ) ^
595 ( i_lfsr0 >> 20 ) ^ ( i_lfsr0 >> 12 ) ) & 1;
596 i_lfsr0 = ( i_lfsr0 << 1 ) | i_lfsr0_o;
598 i_lfsr1_o = ( ( i_lfsr1 >> 16 ) ^ ( i_lfsr1 >> 2 ) ) & 1;
599 i_lfsr1 = ( i_lfsr1 << 1 ) | i_lfsr1_o;
601 i_combined = !i_lfsr1_o + i_carry + !i_lfsr0_o;
603 i_carry = ( i_combined >> 1 ) & 1;
604 i_val |= ( i_combined & 1 ) << i_bit;
607 pi_bits[--i_index] = i_val;
608 } while( i_index > 0 );
610 /* This term is used throughout the following to
611 * select one of 32 different variations on the
614 i_cse = pi_varients[i_css_varient] ^ pi_crypt_tab2[i_css_varient];
616 /* Now the actual blocks doing the encryption. Each
617 * of these works on 40 bits at a time and are quite
621 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_scratch[i] )
623 i_index = pi_bits[25 + i] ^ pi_scratch[i];
624 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
626 pi_tmp1[i] = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
628 pi_tmp1[4] ^= pi_tmp1[0];
630 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_tmp1[i] )
632 i_index = pi_bits[20 + i] ^ pi_tmp1[i];
633 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
635 pi_tmp2[i] = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
637 pi_tmp2[4] ^= pi_tmp2[0];
639 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_tmp2[i] )
641 i_index = pi_bits[15 + i] ^ pi_tmp2[i];
642 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
643 i_index = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
645 pi_tmp1[i] = pi_crypt_tab0[i_index] ^ pi_crypt_tab2[i_index];
647 pi_tmp1[4] ^= pi_tmp1[0];
649 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_tmp1[i] )
651 i_index = pi_bits[10 + i] ^ pi_tmp1[i];
652 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
654 i_index = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
656 pi_tmp2[i] = pi_crypt_tab0[i_index] ^ pi_crypt_tab2[i_index];
658 pi_tmp2[4] ^= pi_tmp2[0];
660 for( i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_tmp2[i] )
662 i_index = pi_bits[5 + i] ^ pi_tmp2[i];
663 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
665 pi_tmp1[i] = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
667 pi_tmp1[4] ^= pi_tmp1[0];
669 for(i = 5, i_term = 0 ; --i >= 0 ; i_term = pi_tmp1[i] )
671 i_index = pi_bits[i] ^ pi_tmp1[i];
672 i_index = pi_crypt_tab1[i_index] ^ ~pi_crypt_tab2[i_index] ^ i_cse;
674 pi_key[i] = pi_crypt_tab2[i_index] ^ pi_crypt_tab3[i_index] ^ i_term;
680 /*****************************************************************************
681 * CSSCracker : title key decryption by cracking
682 *****************************************************************************
683 * This function is called by CSSGetKeys to find a key
684 *****************************************************************************/
685 static int CSSCracker( int i_start,
686 unsigned char * p_crypted,
687 unsigned char * p_decrypted,
688 dvd_key_t * p_sector_key,
691 unsigned char pi_buffer[10];
692 unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
694 unsigned int i_candidate;
699 for( i = 0 ; i < 10 ; i++ )
701 pi_buffer[i] = pi_css_tab1[p_crypted[i]] ^ p_decrypted[i];
704 for( i_try = i_start ; i_try < 0x10000 ; i_try++ )
706 i_t1 = i_try >> 8 | 0x100;
708 i_t3 = 0; /* not needed */
711 /* iterate cipher 4 times to reconstruct LFSR2 */
712 for( i = 0 ; i < 4 ; i++ )
714 /* advance LFSR1 normaly */
715 i_t4 = pi_css_tab2[i_t2] ^ pi_css_tab3[i_t1];
717 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
718 i_t4 = pi_css_tab5[i_t4];
719 /* deduce i_t6 & i_t5 */
723 i_t6 = ( i_t6 + 0xff ) & 0x0ff;
731 i_t6 = pi_css_tab4[ i_t6 ];
732 /* feed / advance i_t3 / i_t5 */
733 i_t3 = ( i_t3 << 8 ) | i_t6;
739 /* iterate 6 more times to validate candidate key */
740 for( ; i < 10 ; i++ )
742 i_t4 = pi_css_tab2[i_t2] ^ pi_css_tab3[i_t1];
744 i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
745 i_t4 = pi_css_tab5[i_t4];
746 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
747 i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
748 i_t3 = ( i_t3 << 8 ) | i_t6;
749 i_t6 = pi_css_tab4[i_t6];
751 if( ( i_t5 & 0xff ) != pi_buffer[i] )
761 /* Do 4 backwards steps of iterating t3 to deduce initial state */
763 for( i = 0 ; i < 4 ; i++ )
766 i_t3 = ( i_t3 >> 8 );
767 /* easy to code, and fast enough bruteforce
768 * search for byte shifted in */
769 for( j = 0 ; j < 256 ; j++ )
771 i_t3 = ( i_t3 & 0x1ffff) | ( j << 17 );
772 i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
773 i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
781 i_t4 = ( i_t3 >> 1 ) - 4;
782 for( i_t5 = 0 ; i_t5 < 8; i_t5++ )
784 if( ( ( i_t4 + i_t5 ) * 2 + 8 - ( (i_t4 + i_t5 ) & 7 ) )
787 (*p_key)[0] = i_try>>8;
788 (*p_key)[1] = i_try & 0xFF;
789 (*p_key)[2] = ( ( i_t4 + i_t5 ) >> 0) & 0xFF;
790 (*p_key)[3] = ( ( i_t4 + i_t5 ) >> 8) & 0xFF;
791 (*p_key)[4] = ( ( i_t4 + i_t5 ) >> 16) & 0xFF;
800 (*p_key)[0] ^= (*p_sector_key)[0];
801 (*p_key)[1] ^= (*p_sector_key)[1];
802 (*p_key)[2] ^= (*p_sector_key)[2];
803 (*p_key)[3] ^= (*p_sector_key)[3];
804 (*p_key)[4] ^= (*p_sector_key)[4];
810 #endif /* HAVE_CSS */