libbluray | branch: master | anonymous <[email protected]> | Wed Dec 18 13:18:41 2013 +0200| [7448382176cc9cf881cf7e23179534a6b9e48463] | committer: anonymous
Set aacs media key for bd+ > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=7448382176cc9cf881cf7e23179534a6b9e48463 --- src/file/libaacs.c | 15 +++++++++++++++ src/file/libaacs.h | 1 + src/file/libbdplus.c | 4 +++- src/file/libbdplus.h | 2 +- src/libbluray/bluray.c | 4 +++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/file/libaacs.c b/src/file/libaacs.c index a5ec3d5..3dc36c9 100644 --- a/src/file/libaacs.c +++ b/src/file/libaacs.c @@ -42,6 +42,7 @@ struct bd_aacs { fptr_p_void get_pmsn; fptr_p_void get_device_binding_id; fptr_p_void get_device_nonce; + fptr_p_void get_media_key; }; @@ -126,6 +127,7 @@ BD_AACS *libaacs_load(void) *(void **)(&p->get_pmsn) = dl_dlsym(p->h_libaacs, "aacs_get_pmsn"); *(void **)(&p->get_device_binding_id) = dl_dlsym(p->h_libaacs, "aacs_get_device_binding_id"); *(void **)(&p->get_device_nonce) = dl_dlsym(p->h_libaacs, "aacs_get_device_nonce"); + *(void **)(&p->get_media_key) = dl_dlsym(p->h_libaacs, "aacs_get_mk"); if (!p->decrypt_unit) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libaacs dlsym failed! (%p)\n", p->h_libaacs); @@ -249,6 +251,16 @@ static const uint8_t *_get_device_nonce(BD_AACS *p) return (const uint8_t*)p->get_device_nonce(p->aacs); } +static const uint8_t *_get_media_key(BD_AACS *p) +{ + if (!p->get_media_key) { + BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_mk() dlsym failed!\n"); + return NULL; + } + + return (const uint8_t*)p->get_media_key(p->aacs); +} + uint32_t libaacs_get_mkbv(BD_AACS *p) { return p ? p->mkbv : 0; @@ -276,6 +288,9 @@ BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type) case BD_AACS_DEVICE_NONCE: return _get_device_nonce(p); + + case BD_AACS_MEDIA_KEY: + return _get_media_key(p); } BD_DEBUG(DBG_BLURAY | DBG_CRIT, "get_aacs_data(): unknown query %d\n", type); diff --git a/src/file/libaacs.h b/src/file/libaacs.h index ca17184..90d480c 100644 --- a/src/file/libaacs.h +++ b/src/file/libaacs.h @@ -42,6 +42,7 @@ BD_PRIVATE uint32_t libaacs_get_mkbv(BD_AACS *p); #define BD_AACS_MEDIA_PMSN 3 #define BD_AACS_DEVICE_BINDING_ID 4 #define BD_AACS_DEVICE_NONCE 5 +#define BD_AACS_MEDIA_KEY 6 BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type); diff --git a/src/file/libbdplus.c b/src/file/libbdplus.c index dab219f..f0f1ec5 100644 --- a/src/file/libbdplus.c +++ b/src/file/libbdplus.c @@ -152,7 +152,7 @@ BD_BDPLUS *libbdplus_load(void) return p; } -int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid) +int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid, const uint8_t *mk) { fptr_p_void bdplus_init; @@ -171,6 +171,8 @@ int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid) return -1; } + DL_CALL(p->h_libbdplus, bdplus_set_mk, p->bdplus, mk); + return 0; } diff --git a/src/file/libbdplus.h b/src/file/libbdplus.h index e8fe8e6..10e65b1 100644 --- a/src/file/libbdplus.h +++ b/src/file/libbdplus.h @@ -29,7 +29,7 @@ typedef struct bd_bdplus BD_BDPLUS; BD_PRIVATE int libbdplus_required(const char *device_path); BD_PRIVATE BD_BDPLUS *libbdplus_load(void); -BD_PRIVATE int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid); +BD_PRIVATE int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid, const uint8_t *mk); BD_PRIVATE void libbdplus_unload(BD_BDPLUS **p); BD_PRIVATE int libbdplus_get_gen(BD_BDPLUS *p); diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index 3848e67..4f6d3a3 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -864,13 +864,14 @@ static int _libbdplus_init(BLURAY *bd) } const uint8_t *vid = libaacs_get_aacs_data(bd->libaacs, BD_AACS_MEDIA_VID); + const uint8_t *mk = libaacs_get_aacs_data(bd->libaacs, BD_AACS_MEDIA_KEY); if (!vid) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "BD+ initialization failed (no AACS ?)\n"); libaacs_unload(&bd->libaacs); return 0; } - if (libbdplus_init(bd->libbdplus, bd->device_path, vid)) { + if (libbdplus_init(bd->libbdplus, bd->device_path, vid, mk)) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bdplus_init() failed\n"); bd->disc_info.bdplus_handled = 0; @@ -922,6 +923,7 @@ static int _meta_open(BLURAY *bd) return !!bd->meta; } + /* * disc info */ _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
