annotate dvdauth.c @ 1106:7255ea9a55d5

*** empty log message ***
author gabucino
date Tue, 12 Jun 2001 09:07:36 +0000
parents b333271f4e7c
children ac1341d4a2a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
1 /* (C)2001 by LGB (Gabor Lenart), based on example programs in libcss
559
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
2 lgb@lgb.hu */
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
3
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
4 /* don't do anything with this source if css support was not requested */
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
5 #include "config.h"
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
6 #ifdef HAVE_LIBCSS
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
7
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
8 #include <stdio.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
9 #include <stdlib.h>
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
10 //#include <string.h> // FIXME: conflicts with fs.h
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
11 #include <unistd.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
12 #include <fcntl.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
13 #include <sys/types.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
14 #include <sys/ioctl.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
15 #include <sys/stat.h>
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
16 #include <css.h>
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
17 #if CSS_MAJOR_VERSION > 0 || (CSS_MAJOR_VERSION == 0 && CSS_MINOR_VERSION > 1)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
18 # include <dvd.h>
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
19 # undef OLD_CSS_API
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
20 #else
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
21 # if defined(__NetBSD__) || defined(__OpenBSD__)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
22 # include <sys/dvdio.h>
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
23 # elif defined(__linux__)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
24 # include <linux/cdrom.h>
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
25 # elif defined(__sun)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
26 # include <sun/dvdio.h>
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
27 # else
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
28 # error "Need the DVD ioctls"
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
29 # endif
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
30 # define OLD_CSS_API 1
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
31 #endif
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
32
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
33 #include "dvdauth.h"
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
34
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
35
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
36 #if OLD_CSS_API
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
37 /*
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
38 * provide some backward compatibiliy macros to compile this
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
39 * code using the old libcss-0.1
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
40 */
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
41 #define DVDHandle int
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
42 #define DVDOpenFailed (-1)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
43
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
44 #define DVDAuth(hdl, s) ioctl(hdl, DVD_AUTH, s)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
45 #define DVDOpenDevice(path) open(path, O_RDONLY)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
46 #define DVDCloseDevice(hdl) close(hdl)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
47 #define CSSDVDisEncrypted(hdl) CSSisEncrypted(hdl)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
48 #define CSSDVDAuthDisc CSSAuthDisc
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
49 #define CSSDVDAuthTitlePath(hdl,key_title,path) \
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
50 CSSAuthTitle(hdl,key_title,path_to_lba(path))
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
51
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
52 #else /*OLD_CSS_API*/
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
53
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
54 #define DVDHandle struct dvd_device *
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
55 #define DVDOpenFailed NULL
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
56
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
57 #endif /*OLD_CSS_API*/
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
58
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
59
1018
e5fc7ec51fa3 -dvd is renamed to -dvdauth, variable dvd_device is renamed to dvd_auth_device. These changes are needed for future DVD playback developmenting
lgb
parents: 559
diff changeset
60 char *dvd_auth_device=NULL;
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
61 unsigned char key_disc[2048];
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
62 unsigned char key_title[5];
546
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
63 unsigned char *dvdimportkey=NULL;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
64 int descrambling=0;
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
65
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
66
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
67 #if OLD_CSS_API
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
68 /*
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
69 * With the old libcss-0.1 api, we have to find out the LBA for
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
70 * a title for title authentication.
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
71 */
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
72 #ifdef __linux__
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
73 #include <linux/fs.h>
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
74 #include <errno.h>
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
75
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
76 #ifndef FIBMAP
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
77 #define FIBMAP 1
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
78 #endif
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
79
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
80 static int path_to_lba (char *path)
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
81 {
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
82 int fd, lba = 0;
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
83
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
84 if ((fd = open(path, O_RDONLY)) == -1) {
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
85 fprintf(stderr, "Cannot open file %s: %s",
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
86 path ? path : "(NULL)", strerror(errno));
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
87 return -1;
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
88 }
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
89 if (ioctl(fd, FIBMAP, &lba) != 0) {
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
90 perror ("ioctl FIBMAP");
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
91 fprintf(stderr,"Hint: run mplayer as root!\n");
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
92 close(fd);
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
93 return -1;
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
94 }
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
95
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
96 close(fd);
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
97
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
98 return lba;
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
99 }
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
100 #else /*linux*/
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
101 static int path_to_lba (char *path)
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
102 {
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
103 #warning translating pathname to iso9660 LBA is not supported on this platform
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
104 fprintf(stderr, "Translating pathname to iso9660 LBA is not supported on this platform\n");
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
105 return -1;
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
106 }
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
107 #endif /*linux*/
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
108 #endif /*OLD_CSS_API*/
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
109
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
110
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
111 static void reset_agids ( DVDHandle dvd )
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
112 {
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
113 dvd_authinfo ai;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
114 int i;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
115 for (i = 0; i < 4; i++) {
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
116 memset(&ai, 0, sizeof(ai));
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
117 ai.type = DVD_INVALIDATE_AGID;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
118 ai.lsa.agid = i;
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
119 DVDAuth(dvd, &ai);
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
120 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
121 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
122
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
123
546
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
124 int dvd_import_key ( unsigned char *hexkey )
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
125 {
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
126 unsigned char *t=key_title;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
127 int digit=4,len;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
128 bzero(key_title,sizeof(key_title));
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
129 // printf("DVD key: %s\n",hexkey);
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
130 for (len=0;len<10;len++) {
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
131 // printf("-> %c\n",*hexkey);
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
132 if (!*hexkey) return 1;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
133 if (*hexkey>='A'&&*hexkey<='F') *t|=(*hexkey-'A'+10)<<digit;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
134 else if (*hexkey>='0'&&*hexkey<='9') *t|=(*hexkey-'0')<<digit;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
135 else return 1;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
136 if (digit) digit=0; else {
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
137 digit=4;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
138 t++;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
139 }
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
140 hexkey++;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
141 }
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
142 if (*hexkey) return 1;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
143 printf("DVD key (requested): %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]);
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
144 descrambling=1;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
145 return 0;
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
146 }
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
147
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
148
559
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
149
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
150 int dvd_auth ( char *dev , char *filename )
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
151 {
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
152 DVDHandle dvd; /* DVD device handle */
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
153
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
154 if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) {
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
155 fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev);
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
156 return 1;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
157 }
559
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
158
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
159 if (!CSSDVDisEncrypted(dvd)) {
559
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
160 printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n");
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
161 DVDCloseDevice(dvd);
559
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
162 return 0;
6fbd39309b87 Detect unencrypted DVDs and not try to auth them
lgb
parents: 546
diff changeset
163 } else printf("DVD is encrypted, issuing authentication ...\n");
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
164
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
165 /* reset AGIDs */
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
166 reset_agids(dvd);
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
167
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
168 /* authenticate disc */
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
169 if (CSSDVDAuthDisc(dvd,key_disc)) {
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
170 fprintf(stderr,"DVD: CSSDVDAuthDisc() failed.\n");
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
171 DVDCloseDevice(dvd);
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
172 return 1;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
173 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
174
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
175 if (CSSDVDAuthTitlePath(dvd,key_title,filename)) {
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
176 fprintf(stderr,"DVD: CSSDVDAuthTitle() failed.\n");
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
177 DVDCloseDevice(dvd);
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
178 return 1;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
179 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
180
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
181 /* decrypting title */
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
182 if (CSSDecryptTitleKey (key_title, key_disc) < 0) {
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
183 fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n");
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
184 DVDCloseDevice(dvd);
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
185 return 1;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
186 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
187
1042
b333271f4e7c Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents: 1018
diff changeset
188 DVDCloseDevice(dvd);
546
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
189 printf("DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]);
22ed5f5821e2 command line requested DVD key support for Arpi :)
lgb
parents: 492
diff changeset
190 descrambling=1;
492
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
191 return 0;
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
192 }
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
193
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
194
888a85621f50 preliminary DVD support using libcss
lgb
parents:
diff changeset
195 #endif