Commit f0ba1f9c authored by npzacs's avatar npzacs
Browse files

Added aacs_get_mk()

parent 0837c5fa
2013-12-11: Version 0.7.0
2013-12-18: Version 0.7.0
- Add aacs_get_device_binding_id() and aacs_get_device_nonce().
- Add aacs_get_mk().
- Add support for bus encryption.
- Add support for device keys.
- Add support for internal keys.
......
......@@ -54,6 +54,8 @@ struct aacs {
uint8_t vid[16];
/* PMSN is cached for BD-J */
uint8_t pmsn[16];
/* Media key is cached for BD+ */
uint8_t mk[16];
/* unit key for each CPS unit */
uint32_t num_uks;
......@@ -364,6 +366,7 @@ static int _calc_mk(AACS *aacs, uint8_t *mk, pk_list *pkl, dk_list *dkl)
/* try device keys first */
if (dkl && _calc_pk_mk(mkb, dkl, mk) == AACS_SUCCESS) {
memcpy(aacs->mk, mk, sizeof(aacs->mk));
mkb_close(mkb);
return AACS_SUCCESS;
}
......@@ -391,6 +394,7 @@ static int _calc_mk(AACS *aacs, uint8_t *mk, pk_list *pkl, dk_list *dkl)
char str[40];
DEBUG(DBG_AACS, "Media key: %s\n", print_hex(str, mk, 16));
memcpy(aacs->mk, mk, sizeof(aacs->mk));
return AACS_SUCCESS;
}
}
......@@ -1139,6 +1143,25 @@ const uint8_t *aacs_get_disc_id(AACS *aacs)
return aacs->disc_id;
}
const uint8_t *aacs_get_mk(AACS *aacs)
{
if (!memcmp(aacs->mk, empty_key, 16)) {
config_file *cf = keydbcfg_config_load(NULL);
if (cf) {
_calc_mk(aacs, aacs->mk, cf->pkl, cf->dkl);
keydbcfg_config_file_close(cf);
}
if (!memcmp(aacs->mk, empty_key, 16)) {
DEBUG(DBG_AACS | DBG_CRIT, "aacs_get_mk() failed\n");
return NULL;
}
}
return aacs->mk;
}
const uint8_t *aacs_get_vid(AACS *aacs)
{
if (!memcmp(aacs->vid, empty_key, 16)) {
......
/*
* This file is part of libaacs
* Copyright (C) 2009-2010 Obliter0n
* Copyright (C) 2009-2013 npzacz
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -52,6 +53,7 @@ AACS_PUBLIC int aacs_get_mkb_version(AACS *aacs);
AACS_PUBLIC const uint8_t *aacs_get_disc_id(AACS *aacs);
AACS_PUBLIC const uint8_t *aacs_get_vid(AACS *aacs); /* may fail even if disc can be decrypted */
AACS_PUBLIC const uint8_t *aacs_get_pmsn(AACS *aacs); /* may fail even if disc can be decrypted */
AACS_PUBLIC const uint8_t *aacs_get_mk(AACS *aacs); /* may fail even if disc can be decrypted */
/* AACS Online */
AACS_PUBLIC const uint8_t *aacs_get_device_binding_id(AACS *aacs);
......
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