Commit 16247a75 authored by Stéphane Borel's avatar Stéphane Borel

-New more recent css authentication code.

-Beginning of udf support (not in Makefile)
parent 0f601455
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* *
* Authors: * Authors: Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
......
This diff is collapsed.
...@@ -2,10 +2,16 @@ ...@@ -2,10 +2,16 @@
* dvd_css.h: Structures for DVD authentification and unscrambling * dvd_css.h: Structures for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.h,v 1.2 2001/02/13 10:08:51 stef Exp $ * $Id: dvd_css.h,v 1.3 2001/02/15 21:03:27 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
* based on:
* - css-auth by Derek Fawcus <derek@spider.com>
* - DVD CSS ioctls example program by Andrew T. Veliath <andrewtv@usa.net>
* - DeCSSPlus by Ethan Hawke
* - The Divide and conquer attack by Frank A. Stevenson<frank@funcom.com>
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
......
...@@ -2,10 +2,15 @@ ...@@ -2,10 +2,15 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.7 2001/02/14 04:11:01 stef Exp $ * $Id: dvd_ifo.c,v 1.8 2001/02/15 21:03:27 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
* based on:
* - libifo by Thomas Mirlacher <dent@cosy.sbg.ac.at>
* - IFO structure documentation by Thomas Mirlacher, Bjrn Englund,
* Hkan Hjort
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -62,7 +67,7 @@ static int IfoFindVMG( ifo_t* p_ifo ) ...@@ -62,7 +67,7 @@ static int IfoFindVMG( ifo_t* p_ifo )
} }
p_ifo->i_off = p_ifo->i_pos; p_ifo->i_off = p_ifo->i_pos;
//fprintf( stderr, "VMG Off : %lld\n", (long long)(p_ifo->i_off) ); fprintf( stderr, "VMG Off : %lld\n", (long long)(p_ifo->i_off) );
return 0; return 0;
} }
...@@ -87,7 +92,7 @@ static int IfoFindVTS( ifo_t* p_ifo ) ...@@ -87,7 +92,7 @@ static int IfoFindVTS( ifo_t* p_ifo )
} }
p_ifo->i_off = p_ifo->i_pos; p_ifo->i_off = p_ifo->i_pos;
//fprintf( stderr, "VTS Off : %lld\n", (long long)(p_ifo->i_off) ); fprintf( stderr, "VTS Off : %lld\n", (long long)(p_ifo->i_off) );
return 0; return 0;
} }
...@@ -1115,7 +1120,7 @@ void IfoRead( ifo_t* p_ifo ) ...@@ -1115,7 +1120,7 @@ void IfoRead( ifo_t* p_ifo )
i_off = (off_t)(p_ifo->vmg.ptt_srpt.p_tts[i].i_ssector) *DVD_LB_SIZE; i_off = (off_t)(p_ifo->vmg.ptt_srpt.p_tts[i].i_ssector) *DVD_LB_SIZE;
p_ifo->i_pos = lseek( p_ifo->i_fd, i_off, SEEK_SET ); p_ifo->i_pos = lseek( p_ifo->i_fd, i_off, SEEK_SET );
//fprintf( stderr, "%lld\n" , p_ifo->i_pos ); fprintf( stderr, "%lld\n" , p_ifo->i_pos );
/* FIXME : use udf filesystem to avoid this */ /* FIXME : use udf filesystem to avoid this */
IfoFindVTS( p_ifo ); IfoFindVTS( p_ifo );
......
...@@ -2,10 +2,15 @@ ...@@ -2,10 +2,15 @@
* dvd_ifo.h: Structures for ifo parsing * dvd_ifo.h: Structures for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.5 2001/02/14 04:11:01 stef Exp $ * $Id: dvd_ifo.h,v 1.6 2001/02/15 21:03:27 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
* based on:
* - libifo by Thomas Mirlacher <dent@cosy.sbg.ac.at>
* - IFO structure documentation by Thomas Mirlacher, Bjrn Englund,
* Hkan Hjort
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
......
/*****************************************************************************
* dvd_udf.c: udf filesystem tools.
* ---
* Mainly used to find asolute logical block adress of *.ifo files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.c,v 1.1 2001/02/15 21:03:27 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
* based on:
* - dvdudf by Christian Wolff <scarabaeus@convergence.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*
* Preamble
*/
#include "defs.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <netinet/in.h>
#include "common.h"
#include "intf_msg.h"
#include "input_dvd.h"
/*
* Local structures
*/
typedef struct partition_s
{
int i_valid;
u8 pi_volume_desc[128];
u16 i_flags;
u16 i_number;
u8 pi_contents[32];
u32 i_accessType;
u32 i_start;
u32 i_length;
} partition_t;
typedef struct ad_s
{
u32 i_location;
u32 i_length;
u8 i_flags;
u16 i_partition;
} ad_t;
/*
* Local functions
*/
/*****************************************************************************
* UDFDecode: decode udf data that is unicode encoded
*****************************************************************************/
static int UDFDecode( u8 * pi_data, int i_len, char * psz_target )
{
int p = 1;
int i = 0;
if( !( pi_data[0] & 0x18 ) )
{
psz_target[0] ='\0';
return 0;
}
if( data[0] & 0x10 )
{
/* ignore MSB of unicode16 */
p++;
while( p < i_len )
{
psz_target[i++] = pi_data[p+=2];
}
}
else
{
while( p < i_len )
{
psz_target[i++] = pi_data[p++];
}
}
psz_target[i]='\0';
return 0;
}
/*****************************************************************************
* UDFInit: some check and initialization in udf filesystem
*****************************************************************************/
int UDFInit( u8 * pi_data, udf_t * p_udf )
{
u32i lbsize,MT_L,N_PM;
UDFDecode( &pi_data[84], 128, p_udf->psz_volume_desc );
lbsize = GETN4(212); // should be 2048
MT_L = GETN4(264); // should be 6
N_PM = GETN4(268); // should be 1
if( lbsize != DVD_LB_SIZE )
{
return 1;
}
return 0;
}
/*****************************************************************************
* UDFFileEntry:
*****************************************************************************/
int UDFFileEntry (uint8_t *data, uint8_t *FileType, struct AD *ad)
{
uint8_t filetype;
uint16_t flags;
uint32_t L_EA,L_AD;
int p;
UDFICB(&data[16],&filetype,&flags);
FileType[0]=filetype;
L_EA=GETN4(168);
L_AD=GETN4(172);
p=176+L_EA;
while (p<176+L_EA+L_AD) {
switch (flags&0x07) {
case 0:
UDFAD (&data[p], ad, UDFADshort);
p += 0x08;
break;
case 1:
UDFAD (&data[p], ad, UDFADlong);
p += 0x10;
break;
case 2: UDFAD (&data[p], ad, UDFADext);
p += 0x14;
break;
case 3:
switch (L_AD) {
case 0x08:
UDFAD (&data[p], ad, UDFADshort);
break;
case 0x10:
UDFAD (&data[p], ad, UDFADlong);
break;
case 0x14:
UDFAD (&data[p], ad, UDFADext);
break;
}
default:
p += L_AD;
break;
}
}
return 0;
}
/*****************************************************************************
* UDFFileIdentifier:
*****************************************************************************/
int UDFFileIdentifier (uint8_t *data, uint8_t *FileCharacteristics, char *FileName, struct AD *FileICB)
{
uint8_t L_FI;
uint16_t L_IU;
FileCharacteristics[0]=GETN1(18);
L_FI=GETN1(19);
UDFAD(&data[20],FileICB,UDFADlong);
L_IU=GETN2(36);
if (L_FI)
_Unicodedecode (&data[38+L_IU],L_FI,FileName);
else
FileName[0]='\0';
return 4*((38+L_FI+L_IU+3)/4);
}
/*****************************************************************************
* dvd_udf.h: structures for udf filesystem tools.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.h,v 1.1 2001/02/15 21:03:27 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* based on:
* - dvdudf by Christian Wolff <scarabaeus@convergence.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
/* Logical block size for DVD-VIDEO */
#define DVD_LB_SIZE 2048 #define DVD_LB_SIZE 2048
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment