BD_AACS *libaacs_load(void) { BD_AACS *p = calloc(1, sizeof(BD_AACS)); p->h_libaacs = _open_libaacs(); if (!p->h_libaacs) { X_FREE(p); return NULL; } BD_DEBUG(DBG_BLURAY, "Loading aacs library (%p)\n", p->h_libaacs); *(void **)(&p->decrypt_unit) = dl_dlsym(p->h_libaacs, "aacs_decrypt_unit"); *(void **)(&p->get_vid) = dl_dlsym(p->h_libaacs, "aacs_get_vid"); *(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"); if (!p->decrypt_unit) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libaacs dlsym failed! (%p)\n", p->h_libaacs); libaacs_unload(&p); return NULL; } BD_DEBUG(DBG_BLURAY, "Loaded libaacs (%p)\n", p->h_libaacs); if (file_open != file_open_default()) { BD_DEBUG(DBG_BLURAY, "Registering libaacs filesystem handler %p (%p)\n", (void *)(intptr_t)file_open, p->h_libaacs); DL_CALL(p->h_libaacs, aacs_register_file, file_open); } return p; }
static BD_AACS *_load(int impl_id) { BD_AACS *p = calloc(1, sizeof(BD_AACS)); if (!p) { return NULL; } p->impl_id = impl_id; p->h_libaacs = _open_libaacs(&p->impl_id); if (!p->h_libaacs) { X_FREE(p); return NULL; } BD_DEBUG(DBG_BLURAY, "Loading aacs library (%p)\n", p->h_libaacs); *(void **)(&p->decrypt_unit) = dl_dlsym(p->h_libaacs, "aacs_decrypt_unit"); *(void **)(&p->decrypt_bus) = dl_dlsym(p->h_libaacs, "aacs_decrypt_bus"); if (!p->decrypt_unit) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libaacs dlsym failed! (%p)\n", p->h_libaacs); libaacs_unload(&p); return NULL; } BD_DEBUG(DBG_BLURAY, "Loaded libaacs (%p)\n", p->h_libaacs); if (file_open != file_open_default()) { BD_DEBUG(DBG_BLURAY, "Registering libaacs filesystem handler %p (%p)\n", (void *)(intptr_t)file_open, p->h_libaacs); DL_CALL(p->h_libaacs, aacs_register_file, file_open); } return p; }