Commit 8ce08d0d authored by cRTrn13's avatar cRTrn13

fptr to libaacs unit decryptor in libbluray placed in bluray struct

parent ee8c2672
......@@ -10,10 +10,10 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path)
// open aacs decryptor if present
bd->aacs = NULL;
if ((bd->libaacs_h = dlopen("libaacs", RTLD_NOW))) {
if ((bd->h_libaacs = dlopen("libaacs", RTLD_NOW))) {
typedef AACS_KEYS* (*fptr)();
fptr fptr_s = dlsym(bd->libaacs_h, "aacs_open");
fptr fptr_s = dlsym(bd->h_libaacs, "aacs_open");
bd->aacs = fptr_s(device_path, keyfile_path);
}
......@@ -22,16 +22,16 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path)
void bd_close(BLURAY *bd)
{
if (bd->libaacs_h) {
if (bd->h_libaacs) {
typedef void* (*fptr)();
fptr fptr_s = dlsym(bd->libaacs_h, "aacs_close");
fptr fptr_s = dlsym(bd->h_libaacs, "aacs_close");
fptr_s(bd->aacs);
}
X_FREE(bd);
dlclose(bd->libaacs_h);
dlclose(bd->h_libaacs);
}
off_t bd_seek(BLURAY *bd, off_t pos)
......@@ -51,11 +51,9 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
int read;
if ((read = file_read(bd->fp, buf, len))) {
if (bd->libaacs_h) {
typedef int* (*fptr)();
fptr fptr_s = dlsym(bd->libaacs_h, "aacs_decrypt_unit");
if (!fptr_s(bd->aacs, buf, len)) {
if (bd->h_libaacs) {
bd->libaacs_decrypt_unit = dlsym(bd->h_libaacs, "aacs_decrypt_unit");
if (!bd->libaacs_decrypt_unit(bd->aacs, buf, len)) {
return 0;
}
}
......
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