Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Baptiste Kempf
libaacs
Commits
9f7be2b2
Commit
9f7be2b2
authored
Apr 28, 2015
by
npzacs
Browse files
Factorize common code
parent
67d80d2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libaacs/aacs.c
View file @
9f7be2b2
...
...
@@ -846,36 +846,22 @@ static int _calc_uks(AACS *aacs, config_file *cf)
static
int
_calc_title_hash
(
AACS
*
aacs
)
{
AACS_FILE_H
*
fp
=
NULL
;
uint8_t
*
ukf_buf
;
void
*
data
;
size_t
size
;
char
str
[
48
];
int64_t
f_size
;
int
result
=
AACS_SUCCESS
;
fp
=
_file_open
(
aacs
,
"AACS"
DIR_SEP
"Unit_Key_RO.inf"
);
if
(
!
fp
)
{
BD_DEBUG
(
DBG_AACS
|
DBG_CRIT
,
"Error opening unit key file (AACS/Unit_Key_RO.inf)
\n
"
);
return
AACS_ERROR_CORRUPTED_DISC
;
}
file_seek
(
fp
,
0
,
SEEK_END
);
f_size
=
file_tell
(
fp
);
file_seek
(
fp
,
0
,
SEEK_SET
);
ukf_buf
=
malloc
(
f_size
);
if
((
file_read
(
fp
,
ukf_buf
,
f_size
))
==
f_size
)
{
crypto_aacs_title_hash
(
ukf_buf
,
f_size
,
aacs
->
disc_id
);
size
=
_read_file
(
aacs
,
"AACS"
DIR_SEP
"Unit_Key_RO.inf"
,
&
data
);
if
(
size
)
{
crypto_aacs_title_hash
(
data
,
size
,
aacs
->
disc_id
);
BD_DEBUG
(
DBG_AACS
,
"Disc ID: %s
\n
"
,
str_print_hex
(
str
,
aacs
->
disc_id
,
20
));
X_FREE
(
data
);
}
else
{
result
=
AACS_ERROR_CORRUPTED_DISC
;
BD_DEBUG
(
DBG_AACS
|
DBG_CRIT
,
"Failed to read %lu bytes from unit key file (AACS/Unit_Key_RO.inf)"
,
(
unsigned
long
)
f_
size
);
BD_DEBUG
(
DBG_AACS
|
DBG_CRIT
,
"Failed to read %lu bytes from unit key file (AACS/Unit_Key_RO.inf)"
,
(
unsigned
long
)
size
);
}
file_close
(
fp
);
X_FREE
(
ukf_buf
);
return
result
;
}
...
...
Write
Preview
Supports
Markdown
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