Commit d072e40d authored by Sam Hocevar's avatar Sam Hocevar

  * FreeBSD CSS decryption support.
parent 5e0ca682
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#===================# #===================#
HEAD HEAD
* FreeBSD CSS decryption support.
* Fixed a segfault in TS input (psi packets with adaptation field). * Fixed a segfault in TS input (psi packets with adaptation field).
* Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale * Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale
<arnaud@carrosse.frmug.org>. <arnaud@carrosse.frmug.org>.
......
...@@ -3211,7 +3211,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ...@@ -3211,7 +3211,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
EOF EOF
BUILTINS="${BUILTINS} dvd" BUILTINS="${BUILTINS} dvd"
for ac_hdr in linux/cdrom.h for ac_hdr in sys/cdio.h sys/dvdio.h linux/cdrom.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
...@@ -3251,17 +3251,60 @@ else ...@@ -3251,17 +3251,60 @@ else
fi fi
done done
cat > conftest.$ac_ext <<EOF BSD_DVD_STRUCT=0
#line 3256 "configure" cat > conftest.$ac_ext <<EOF
#line 3257 "configure"
#include "confdefs.h"
#include <sys/dvdio.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "dvd_struct" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define DVD_STRUCT_IN_SYS_DVDIO_H 1
EOF
BSD_DVD_STRUCT=1
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
#line 3275 "configure"
#include "confdefs.h"
#include <sys/cdio.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "dvd_struct" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define DVD_STRUCT_IN_SYS_CDIO_H 1
EOF
BSD_DVD_STRUCT=1
fi
rm -f conftest*
if test x$BSD_DVD_STRUCT = x1; then
cat >> confdefs.h <<\EOF
#define HAVE_BSD_DVD_STRUCT 1
EOF
fi
cat > conftest.$ac_ext <<EOF
#line 3299 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <linux/cdrom.h> #include <linux/cdrom.h>
EOF EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "dvd" >/dev/null 2>&1; then egrep "dvd_struct" >/dev/null 2>&1; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define LINUX_DVD 1 #define DVD_STRUCT_IN_LINUX_CDROM_H 1
EOF EOF
...@@ -3403,7 +3446,7 @@ if test "${enable_esd+set}" = set; then ...@@ -3403,7 +3446,7 @@ if test "${enable_esd+set}" = set; then
# Extract the first word of "esd-config", so it can be a program name with args. # Extract the first word of "esd-config", so it can be a program name with args.
set dummy esd-config; ac_word=$2 set dummy esd-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3407: checking for $ac_word" >&5 echo "configure:3450: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
...@@ -3468,17 +3511,17 @@ else ...@@ -3468,17 +3511,17 @@ else
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3472: checking for $ac_hdr" >&5 echo "configure:3515: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3477 "configure" #line 3520 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3549,17 +3592,17 @@ if test "${with_sdl+set}" = set; then ...@@ -3549,17 +3592,17 @@ if test "${with_sdl+set}" = set; then
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3553: checking for $ac_hdr" >&5 echo "configure:3596: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3558 "configure" #line 3601 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3597,17 +3640,17 @@ fi ...@@ -3597,17 +3640,17 @@ fi
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3601: checking for $ac_hdr" >&5 echo "configure:3644: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3606 "configure" #line 3649 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3707,7 +3750,7 @@ if test x$enable_gtk != xno; then ...@@ -3707,7 +3750,7 @@ if test x$enable_gtk != xno; then
# Extract the first word of "gtk-config", so it can be a program name with args. # Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2 set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3711: checking for $ac_word" >&5 echo "configure:3754: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
...@@ -3767,17 +3810,17 @@ if test x$enable_x11 != xno; then ...@@ -3767,17 +3810,17 @@ if test x$enable_x11 != xno; then
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3771: checking for $ac_hdr" >&5 echo "configure:3814: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3776 "configure" #line 3819 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3829,17 +3872,17 @@ if test x$enable_xvideo != xno; then ...@@ -3829,17 +3872,17 @@ if test x$enable_xvideo != xno; then
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3833: checking for $ac_hdr" >&5 echo "configure:3876: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3838 "configure" #line 3881 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3877,17 +3920,17 @@ if test "${enable_alsa+set}" = set; then ...@@ -3877,17 +3920,17 @@ if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa" enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:3881: checking for sys/asoundlib.h" >&5 echo "configure:3924: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3886 "configure" #line 3929 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/asoundlib.h> #include <sys/asoundlib.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:3934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3904,7 +3947,7 @@ fi ...@@ -3904,7 +3947,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6 echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3908: checking for main in -lasound" >&5 echo "configure:3951: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'` ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
...@@ -3912,14 +3955,14 @@ else ...@@ -3912,14 +3955,14 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS" LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3916 "configure" #line 3959 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
main() main()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:3966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
......
...@@ -153,9 +153,34 @@ dnl DVD module: check for DVD ioctls ...@@ -153,9 +153,34 @@ dnl DVD module: check for DVD ioctls
dnl dnl
AC_CHECK_HEADERS(sys/ioctl.h,[ AC_CHECK_HEADERS(sys/ioctl.h,[
BUILTINS="${BUILTINS} dvd" BUILTINS="${BUILTINS} dvd"
AC_CHECK_HEADERS(linux/cdrom.h) AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h)
AC_EGREP_HEADER(dvd,linux/cdrom.h,[ BSD_DVD_STRUCT=0
AC_DEFINE(LINUX_DVD,1, DVD support for linux) dnl
dnl Old FreeBSD: sys/cdio.h
dnl
AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
Define if <sys/dvdio.h> defines dvd_struct.)
BSD_DVD_STRUCT=1
])
dnl
dnl Newer FreeBSD: sys/dvdio.h
dnl
AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
Define if <sys/cdio.h> defines dvd_struct.)
BSD_DVD_STRUCT=1
])
if test x$BSD_DVD_STRUCT = x1; then
AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
Define if BSD-like dvd_struct is defined.)
fi
dnl
dnl Linux: linux/cdrom.h
dnl
AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
Define if <linux/cdrom.h> defines DVD_STRUCT.)
]) ])
]) ])
......
...@@ -115,6 +115,12 @@ ...@@ -115,6 +115,12 @@
/* Define if you have the <strings.h> header file. */ /* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H #undef HAVE_STRINGS_H
/* Define if you have the <sys/cdio.h> header file. */
#undef HAVE_SYS_CDIO_H
/* Define if you have the <sys/dvdio.h> header file. */
#undef HAVE_SYS_DVDIO_H
/* Define if you have the <sys/ioctl.h> header file. */ /* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H #undef HAVE_SYS_IOCTL_H
...@@ -154,8 +160,17 @@ ...@@ -154,8 +160,17 @@
/* Define if <pthread.h> defines boolean_t. */ /* Define if <pthread.h> defines boolean_t. */
#undef BOOLEAN_T_IN_PTHREAD_H #undef BOOLEAN_T_IN_PTHREAD_H
/* DVD support for linux */ /* Define if <sys/dvdio.h> defines dvd_struct. */
#undef LINUX_DVD #undef DVD_STRUCT_IN_SYS_DVDIO_H
/* Define if <sys/cdio.h> defines dvd_struct. */
#undef DVD_STRUCT_IN_SYS_CDIO_H
/* Define if BSD-like dvd_struct is defined. */
#undef HAVE_BSD_DVD_STRUCT
/* Define if <linux/cdrom.h> defines DVD_STRUCT. */
#undef DVD_STRUCT_IN_LINUX_CDROM_H
/* Define if you want DVD CSS decryption. */ /* Define if you want DVD CSS decryption. */
#undef HAVE_CSS #undef HAVE_CSS
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.26 2001/04/22 00:08:25 stef Exp $ * $Id: dvd_css.c,v 1.27 2001/05/02 20:01:44 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -120,7 +120,7 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -120,7 +120,7 @@ int CSSInit( int i_fd, css_t * p_css )
{ {
intf_WarnMsg( 3, "css info: requesting AGID %d", i ); intf_WarnMsg( 3, "css info: requesting AGID %d", i );
i_ret = ioctl_LUSendAgid( i_fd, &i_agid ); i_ret = ioctl_ReportAgid( i_fd, &i_agid );
if( i_ret != -1 ) if( i_ret != -1 )
{ {
...@@ -128,7 +128,7 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -128,7 +128,7 @@ int CSSInit( int i_fd, css_t * p_css )
break; break;
} }
intf_ErrMsg( "css error: ioctl_LUSendAgid failed, invalidating" ); intf_ErrMsg( "css error: ioctl_ReportAgid failed, invalidating" );
i_agid = 0; i_agid = 0;
ioctl_InvalidateAgid( i_fd, &i_agid ); ioctl_InvalidateAgid( i_fd, &i_agid );
...@@ -137,7 +137,7 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -137,7 +137,7 @@ int CSSInit( int i_fd, css_t * p_css )
/* Unable to authenticate without AGID */ /* Unable to authenticate without AGID */
if( i_ret == -1 ) if( i_ret == -1 )
{ {
intf_ErrMsg( "css error: ioctl_LUSendAgid failed, fatal" ); intf_ErrMsg( "css error: ioctl_ReportAgid failed, fatal" );
return -1; return -1;
} }
...@@ -153,16 +153,16 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -153,16 +153,16 @@ int CSSInit( int i_fd, css_t * p_css )
} }
/* Send challenge to LU */ /* Send challenge to LU */
if( ioctl_HostSendChallenge( i_fd, &i_agid, p_buffer ) < 0 ) if( ioctl_SendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
{ {
intf_ErrMsg( "css error: ioctl_HostSendChallenge failed" ); intf_ErrMsg( "css error: ioctl_SendChallenge failed" );
return -1; return -1;
} }
/* Get key1 from LU */ /* Get key1 from LU */
if( ioctl_LUSendKey1( i_fd, &i_agid, p_buffer ) < 0) if( ioctl_ReportKey1( i_fd, &i_agid, p_buffer ) < 0)
{ {
intf_ErrMsg( "css error: ioctl_LUSendKey1 failed" ); intf_ErrMsg( "css error: ioctl_ReportKey1 failed" );
return -1; return -1;
} }
...@@ -193,9 +193,9 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -193,9 +193,9 @@ int CSSInit( int i_fd, css_t * p_css )
} }
/* Get challenge from LU */ /* Get challenge from LU */
if( ioctl_LUSendChallenge( i_fd, &i_agid, p_buffer ) < 0 ) if( ioctl_ReportChallenge( i_fd, &i_agid, p_buffer ) < 0 )
{ {
intf_ErrMsg( "css error: ioctl_LUSendKeyChallenge failed" ); intf_ErrMsg( "css error: ioctl_ReportKeyChallenge failed" );
return -1; return -1;
} }
...@@ -215,9 +215,9 @@ int CSSInit( int i_fd, css_t * p_css ) ...@@ -215,9 +215,9 @@ int CSSInit( int i_fd, css_t * p_css )
} }
/* Send key2 to LU */ /* Send key2 to LU */
if( ioctl_HostSendKey2( i_fd, &i_agid, p_buffer ) < 0 ) if( ioctl_SendKey2( i_fd, &i_agid, p_buffer ) < 0 )
{ {
intf_ErrMsg( "css error: ioctl_HostSendKey2 failed" ); intf_ErrMsg( "css error: ioctl_SendKey2 failed" );
return -1; return -1;
} }
...@@ -456,7 +456,7 @@ static int CSSGetASF( int i_fd ) ...@@ -456,7 +456,7 @@ static int CSSGetASF( int i_fd )
for( i_agid = 0 ; i_agid < 4 ; i_agid++ ) for( i_agid = 0 ; i_agid < 4 ; i_agid++ )
{ {
if( ioctl_LUSendASF( i_fd, &i_agid, &i_asf ) == 0 ) if( ioctl_ReportASF( i_fd, &i_agid, &i_asf ) == 0 )
{ {
intf_WarnMsg( 3, "css info: GetASF %sauthenticated", intf_WarnMsg( 3, "css info: GetASF %sauthenticated",
i_asf ? "":"not " ); i_asf ? "":"not " );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ioctl.c: DVD ioctl replacement function * dvd_ioctl.c: DVD ioctl replacement function
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.10 2001/04/11 04:46:18 sam Exp $ * $Id: dvd_ioctl.c,v 1.11 2001/05/02 20:01:44 sam Exp $
* *
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com> * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -31,22 +31,21 @@ ...@@ -31,22 +31,21 @@
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#ifdef HAVE_SYS_DVDIO_H #include <sys/ioctl.h>
# include <sys/ioctl.h>
#ifdef DVD_STRUCT_IN_SYS_CDIO_H
# include <sys/cdio.h>
#endif
#ifdef DVD_STRUCT_IN_SYS_DVDIO_H
# include <sys/dvdio.h> # include <sys/dvdio.h>
#endif #endif
#ifdef LINUX_DVD #ifdef DVD_STRUCT_IN_LINUX_CDROM_H
# include <sys/ioctl.h>
# include <linux/cdrom.h> # include <linux/cdrom.h>
#endif #endif
#ifdef SYS_BEOS #ifdef SYS_BEOS
# include <sys/ioctl.h>
# include <malloc.h> # include <malloc.h>
# include <scsi.h> # include <scsi.h>
#endif #endif
#ifdef SYS_DARWIN1_3
# include <sys/ioctl.h>
#endif
#include "common.h" #include "common.h"
...@@ -77,7 +76,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) ...@@ -77,7 +76,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_struct dvd; dvd_struct dvd;
dvd.type = DVD_STRUCT_COPYRIGHT; dvd.type = DVD_STRUCT_COPYRIGHT;
...@@ -87,6 +86,16 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) ...@@ -87,6 +86,16 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvd.copyright.cpst; *pi_copyright = dvd.copyright.cpst;
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_struct dvd;
dvd.format = DVD_STRUCT_COPYRIGHT;
dvd.layer_num = i_layer;
i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
*pi_copyright = dvd.cpst;
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 8 ); INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 8 );
...@@ -120,12 +129,11 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -120,12 +129,11 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_struct dvd; dvd_struct dvd;
dvd.type = DVD_STRUCT_DISCKEY; dvd.type = DVD_STRUCT_DISCKEY;
dvd.disckey.agid = *pi_agid; dvd.disckey.agid = *pi_agid;
memset( dvd.disckey.value, 0, 2048 ); memset( dvd.disckey.value, 0, 2048 );
i_ret = ioctl( i_fd, DVD_READ_STRUCT, &dvd ); i_ret = ioctl( i_fd, DVD_READ_STRUCT, &dvd );
...@@ -137,6 +145,22 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -137,6 +145,22 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, dvd.disckey.value, 2048 ); memcpy( p_key, dvd.disckey.value, 2048 );
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_struct dvd;
dvd.format = DVD_STRUCT_DISCKEY;
dvd.agid = *pi_agid;
memset( dvd.data, 0, 2048 );
i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
if( i_ret < 0 )
{
return i_ret;
}
memcpy( p_key, dvd.data, 2048 );
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 2048 + 4 ); INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 2048 + 4 );
...@@ -161,13 +185,13 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -161,13 +185,13 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_LUSendAgid: get AGID from the drive * ioctl_ReportAgid: get AGID from the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_LUSendAgid( int i_fd, int *pi_agid ) int ioctl_ReportAgid( int i_fd, int *pi_agid )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_LU_SEND_AGID; auth_info.type = DVD_LU_SEND_AGID;
...@@ -177,6 +201,16 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid ) ...@@ -177,6 +201,16 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid )
*pi_agid = auth_info.lsa.agid; *pi_agid = auth_info.lsa.agid;
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_REPORT_AGID;
auth_info.agid = *pi_agid;
i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
*pi_agid = auth_info.agid;
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_REPORT_KEY, 8 ); INIT_RDC( GPCMD_REPORT_KEY, 8 );
...@@ -195,13 +229,13 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid ) ...@@ -195,13 +229,13 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_LUSendChallenge: get challenge from the drive * ioctl_ReportChallenge: get challenge from the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_LU_SEND_CHALLENGE; auth_info.type = DVD_LU_SEND_CHALLENGE;
...@@ -211,6 +245,16 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -211,6 +245,16 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, auth_info.lsc.chal, sizeof(dvd_challenge) ); memcpy( p_challenge, auth_info.lsc.chal, sizeof(dvd_challenge) );
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_REPORT_CHALLENGE;
auth_info.agid = *pi_agid;
i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
memcpy( p_challenge, auth_info.keychal, 10 );
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_REPORT_KEY, 16 ); INIT_RDC( GPCMD_REPORT_KEY, 16 );
...@@ -229,13 +273,13 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -229,13 +273,13 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_LUSendASF: get ASF from the drive * ioctl_ReportASF: get ASF from the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf ) int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_LU_SEND_ASF; auth_info.type = DVD_LU_SEND_ASF;
...@@ -246,6 +290,17 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf ) ...@@ -246,6 +290,17 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = auth_info.lsasf.asf; *pi_asf = auth_info.lsasf.asf;
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_REPORT_ASF;
auth_info.agid = *pi_agid;
auth_info.asf = *pi_asf;
i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
*pi_asf = auth_info.asf;
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_REPORT_KEY, 8 ); INIT_RDC( GPCMD_REPORT_KEY, 8 );
...@@ -278,13 +333,13 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf ) ...@@ -278,13 +333,13 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_LUSendKey1: get the first key from the drive * ioctl_ReportKey1: get the first key from the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_LUSendKey1( int i_fd, int *pi_agid, u8 *p_key ) int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_LU_SEND_KEY1; auth_info.type = DVD_LU_SEND_KEY1;
...@@ -294,6 +349,16 @@ int ioctl_LUSendKey1( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -294,6 +349,16 @@ int ioctl_LUSendKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, auth_info.lsk.key, sizeof(dvd_key) ); memcpy( p_key, auth_info.lsk.key, sizeof(dvd_key) );
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_REPORT_KEY1;
auth_info.agid = *pi_agid;
i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
memcpy( p_key, auth_info.keychal, 8 );
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_REPORT_KEY, 12 ); INIT_RDC( GPCMD_REPORT_KEY, 12 );
...@@ -318,7 +383,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid ) ...@@ -318,7 +383,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
{ {
int i_ret; int i_ret;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_INVALIDATE_AGID; auth_info.type = DVD_INVALIDATE_AGID;
...@@ -328,6 +393,16 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid ) ...@@ -328,6 +393,16 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
*pi_agid = auth_info.lsa.agid; *pi_agid = auth_info.lsa.agid;
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_INVALIDATE_AGID;
auth_info.agid = *pi_agid;
i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
*pi_agid = auth_info.agid;
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_REPORT_KEY, 0 ); INIT_RDC( GPCMD_REPORT_KEY, 0 );
...@@ -344,11 +419,11 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid ) ...@@ -344,11 +419,11 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_HostSendChallenge: send challenge to the drive * ioctl_SendChallenge: send challenge to the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
{ {
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_HOST_SEND_CHALLENGE; auth_info.type = DVD_HOST_SEND_CHALLENGE;
...@@ -358,6 +433,16 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -358,6 +433,16 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, DVD_AUTH, &auth_info ); return ioctl( i_fd, DVD_AUTH, &auth_info );
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_SEND_CHALLENGE;
auth_info.agid = *pi_agid;
memcpy( auth_info.keychal, p_challenge, 12 );
return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_SEND_KEY, 16 ); INIT_RDC( GPCMD_SEND_KEY, 16 );
...@@ -376,11 +461,11 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge ) ...@@ -376,11 +461,11 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
} }
/***************************************************************************** /*****************************************************************************
* ioctl_HostSendKey2: send the second key to the drive * ioctl_SendKey2: send the second key to the drive
*****************************************************************************/ *****************************************************************************/
int ioctl_HostSendKey2( int i_fd, int *pi_agid, u8 *p_key ) int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
{ {
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD ) #if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
dvd_authinfo auth_info; dvd_authinfo auth_info;
auth_info.type = DVD_HOST_SEND_KEY2; auth_info.type = DVD_HOST_SEND_KEY2;
...@@ -390,6 +475,16 @@ int ioctl_HostSendKey2( int i_fd, int *pi_agid, u8 *p_key ) ...@@ -390,6 +475,16 @@ int ioctl_HostSendKey2( int i_fd, int *pi_agid, u8 *p_key )
return ioctl( i_fd, DVD_AUTH, &auth_info ); return ioctl( i_fd, DVD_AUTH, &auth_info );
#elif defined( HAVE_BSD_DVD_STRUCT )
struct dvd_authinfo auth_info;
auth_info.format = DVD_SEND_KEY2;
auth_info.agid = *pi_agid;
memcpy( auth_info.keychal, p_key, 8 );
return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
#elif defined( SYS_BEOS ) #elif defined( SYS_BEOS )
INIT_RDC( GPCMD_SEND_KEY, 12 ); INIT_RDC( GPCMD_SEND_KEY, 12 );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ioctl.h: DVD ioctl replacement function * dvd_ioctl.h: DVD ioctl replacement function
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.h,v 1.6 2001/04/11 04:31:59 sam Exp $ * $Id: dvd_ioctl.h,v 1.7 2001/05/02 20:01:44 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
int ioctl_ReadCopyright ( int, int, int * ); int ioctl_ReadCopyright ( int, int, int * );
int ioctl_ReadKey ( int, int *, u8 * ); int ioctl_ReadKey ( int, int *, u8 * );
int ioctl_LUSendAgid ( int, int * ); int ioctl_ReportAgid ( int, int * );
int ioctl_LUSendChallenge ( int, int *, u8 * ); int ioctl_ReportChallenge ( int, int *, u8 * );
int ioctl_LUSendKey1 ( int, int *, u8 * ); int ioctl_ReportKey1 ( int, int *, u8 * );
int ioctl_LUSendASF ( int, int *, int * ); int ioctl_ReportASF ( int, int *, int * );
int ioctl_InvalidateAgid ( int, int * ); int ioctl_InvalidateAgid ( int, int * );
int ioctl_HostSendChallenge ( int, int *, u8 * ); int ioctl_SendChallenge ( int, int *, u8 * );
int ioctl_HostSendKey2 ( int, int *, u8 * ); int ioctl_SendKey2 ( int, int *, u8 * );
#ifdef SYS_BEOS #ifdef SYS_BEOS
......
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