Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
4619c0a5
Commit
4619c0a5
authored
Jun 04, 2008
by
Kaloyan Kovachev
Committed by
Rémi Denis-Courmont
Jun 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the CSA Key parsing inside csa_SetCW function
Signed-off-by:
Rémi Denis-Courmont
<
rdenis@simphalempin.com
>
parent
d9810ce0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
81 deletions
+80
-81
modules/demux/ts.c
modules/demux/ts.c
+18
-40
modules/mux/mpeg/csa.c
modules/mux/mpeg/csa.c
+45
-5
modules/mux/mpeg/csa.h
modules/mux/mpeg/csa.h
+1
-1
modules/mux/mpeg/ts.c
modules/mux/mpeg/ts.c
+16
-35
No files found.
modules/demux/ts.c
View file @
4619c0a5
...
...
@@ -777,41 +777,20 @@ static int Open( vlc_object_t *p_this )
var_Get
(
p_demux
,
"ts-csa-ck"
,
&
val
);
if
(
val
.
psz_string
&&
*
val
.
psz_string
)
{
char
*
psz
=
val
.
psz_string
;
if
(
psz
[
0
]
==
'0'
&&
(
psz
[
1
]
==
'x'
||
psz
[
1
]
==
'X'
)
)
{
psz
+=
2
;
}
if
(
strlen
(
psz
)
!=
16
)
{
msg_Warn
(
p_demux
,
"invalid csa ck (it must be 16 chars long)"
);
}
else
{
#ifndef UNDER_CE
uint64_t
i_ck
=
strtoull
(
psz
,
NULL
,
16
);
#else
uint64_t
i_ck
=
strtoll
(
psz
,
NULL
,
16
);
#endif
uint8_t
ck
[
8
];
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
int
i_res
;
p_sys
->
csa
=
csa_New
();
i_res
=
csa_SetCW
(
(
vlc_object_t
*
)
p_demux
,
p_sys
->
csa
,
val
.
psz_string
,
1
);
if
(
i_res
!=
VLC_SUCCESS
||
csa_SetCW
(
(
vlc_object_t
*
)
p_demux
,
p_sys
->
csa
,
val
.
psz_string
,
0
)
!=
VLC_SUCCESS
)
{
ck
[
i
]
=
(
i_ck
>>
(
56
-
8
*
i
)
)
&
0xff
;
csa_Delete
(
p_sys
->
csa
)
;
}
#ifndef TS_NO_CSA_CK_MSG
msg_Dbg
(
p_demux
,
"using CSA scrambling with "
"ck=%x:%x:%x:%x:%x:%x:%x:%x"
,
ck
[
0
],
ck
[
1
],
ck
[
2
],
ck
[
3
],
ck
[
4
],
ck
[
5
],
ck
[
6
],
ck
[
7
]
);
#endif
p_sys
->
csa
=
csa_New
();
if
(
p_sys
->
csa
)
{
vlc_value_t
pkt_val
;
csa_SetCW
(
p_sys
->
csa
,
ck
,
ck
);
var_Create
(
p_demux
,
"ts-csa-pkt"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"ts-csa-pkt"
,
&
pkt_val
);
if
(
pkt_val
.
i_int
<
4
||
pkt_val
.
i_int
>
188
)
...
...
@@ -824,7 +803,6 @@ static int Open( vlc_object_t *p_this )
msg_Dbg
(
p_demux
,
"decrypting %d bytes of packet"
,
p_sys
->
i_csa_pkt_size
);
}
}
}
free
(
val
.
psz_string
);
var_Create
(
p_demux
,
"ts-silent"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
...
...
modules/mux/mpeg/csa.c
View file @
4619c0a5
...
...
@@ -81,13 +81,53 @@ void csa_Delete( csa_t *c )
/*****************************************************************************
* csa_SetCW:
*****************************************************************************/
void
csa_SetCW
(
csa_t
*
c
,
uint8_t
o_ck
[
8
],
uint8_t
e_ck
[
8
]
)
int
csa_SetCW
(
vlc_object_t
*
p_caller
,
csa_t
*
c
,
char
*
psz_ck
,
int
set_odd
)
{
memcpy
(
c
->
o_ck
,
o_ck
,
8
);
csa_ComputeKey
(
c
->
o_kk
,
o_ck
);
if
(
!
c
)
{
msg_Dbg
(
p_caller
,
"no CSA found"
);
return
VLC_EGENERIC
;
}
/* skip 0x */
if
(
psz_ck
[
0
]
==
'0'
&&
(
psz_ck
[
1
]
==
'x'
||
psz_ck
[
1
]
==
'X'
)
)
{
psz_ck
+=
2
;
}
if
(
strlen
(
psz_ck
)
!=
16
)
{
msg_Warn
(
p_caller
,
"invalid csa ck (it must be 16 chars long)"
);
return
VLC_EGENERIC
;
}
else
{
#ifndef UNDER_CE
uint64_t
i_ck
=
strtoull
(
psz_ck
,
NULL
,
16
);
#else
uint64_t
i_ck
=
strtoll
(
psz_ck
,
NULL
,
16
);
#endif
uint8_t
ck
[
8
];
int
i
;
memcpy
(
c
->
e_ck
,
e_ck
,
8
);
csa_ComputeKey
(
c
->
e_kk
,
e_ck
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
ck
[
i
]
=
(
i_ck
>>
(
56
-
8
*
i
)
)
&
0xff
;
}
#ifndef TS_NO_CSA_CK_MSG
msg_Dbg
(
p_caller
,
"using CSA (de)scrambling with %s key=%x:%x:%x:%x:%x:%x:%x:%x"
,
((
set_odd
==
1
)
?
"odd"
:
"even"
),
ck
[
0
],
ck
[
1
],
ck
[
2
],
ck
[
3
],
ck
[
4
],
ck
[
5
],
ck
[
6
],
ck
[
7
]
);
#endif
if
(
set_odd
==
1
)
{
memcpy
(
c
->
o_ck
,
ck
,
8
);
csa_ComputeKey
(
c
->
o_kk
,
ck
);
}
else
{
memcpy
(
c
->
e_ck
,
ck
,
8
);
csa_ComputeKey
(
c
->
e_kk
,
ck
);
}
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
...
...
modules/mux/mpeg/csa.h
View file @
4619c0a5
...
...
@@ -34,7 +34,7 @@ typedef struct csa_t csa_t;
csa_t
*
csa_New
(
void
);
void
csa_Delete
(
csa_t
*
);
void
csa_SetCW
(
csa_t
*
,
uint8_t
o_ck
[
8
],
uint8_t
e_ck
[
8
]
);
int
csa_SetCW
(
vlc_object_t
*
p_caller
,
csa_t
*
c
,
char
*
psz_ck
,
int
set_odd
);
void
csa_Decrypt
(
csa_t
*
,
uint8_t
*
pkt
,
int
i_pkt_size
);
void
csa_Encrypt
(
csa_t
*
,
uint8_t
*
pkt
,
int
i_pkt_size
,
int
b_odd
);
...
...
modules/mux/mpeg/ts.c
View file @
4619c0a5
...
...
@@ -771,38 +771,20 @@ static int Open( vlc_object_t *p_this )
var_Get
(
p_mux
,
SOUT_CFG_PREFIX
"csa-ck"
,
&
val
);
if
(
val
.
psz_string
&&
*
val
.
psz_string
)
{
char
*
psz
=
val
.
psz_string
;
int
i_res
;
/* skip 0x */
if
(
psz
[
0
]
==
'0'
&&
(
psz
[
1
]
==
'x'
||
psz
[
1
]
==
'X'
)
)
{
psz
+=
2
;
}
if
(
strlen
(
psz
)
!=
16
)
{
msg_Dbg
(
p_mux
,
"invalid csa ck (it must be 16 chars long)"
);
}
else
{
uint64_t
i_ck
=
strtoull
(
psz
,
NULL
,
16
);
uint8_t
ck
[
8
];
int
i
;
p_sys
->
csa
=
csa_New
();
for
(
i
=
0
;
i
<
8
;
i
++
)
i_res
=
csa_SetCW
(
(
vlc_object_t
*
)
p_mux
,
p_sys
->
csa
,
val
.
psz_string
,
1
);
if
(
i_res
!=
VLC_SUCCESS
||
csa_SetCW
(
(
vlc_object_t
*
)
p_mux
,
p_sys
->
csa
,
val
.
psz_string
,
0
)
!=
VLC_SUCCESS
)
{
ck
[
i
]
=
(
i_ck
>>
(
56
-
8
*
i
)
)
&
0xff
;
csa_Delete
(
p_sys
->
csa
)
;
}
#ifndef TS_NO_CSA_CK_MSG
msg_Dbg
(
p_mux
,
"using CSA scrambling with ck=%x:%x:%x:%x:%x:%x:%x:%x"
,
ck
[
0
],
ck
[
1
],
ck
[
2
],
ck
[
3
],
ck
[
4
],
ck
[
5
],
ck
[
6
],
ck
[
7
]
);
#endif
p_sys
->
csa
=
csa_New
();
if
(
p_sys
->
csa
)
{
vlc_value_t
pkt_val
;
csa_SetCW
(
p_sys
->
csa
,
ck
,
ck
);
var_Get
(
p_mux
,
SOUT_CFG_PREFIX
"csa-pkt"
,
&
pkt_val
);
if
(
pkt_val
.
i_int
<
12
||
pkt_val
.
i_int
>
188
)
{
...
...
@@ -814,7 +796,6 @@ static int Open( vlc_object_t *p_this )
msg_Dbg
(
p_mux
,
"encrypting %d bytes of packet"
,
p_sys
->
i_csa_pkt_size
);
}
}
}
free
(
val
.
psz_string
);
var_Get
(
p_mux
,
SOUT_CFG_PREFIX
"crypt-audio"
,
&
val
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment