libmmbd / libaacs VID discrepancy.

The place to discuss linux version of MakeMKV
Post Reply
EdibleFungi
Posts: 6
Joined: Tue Jan 13, 2026 10:34 pm

libmmbd / libaacs VID discrepancy.

Post by EdibleFungi » Sun Jan 25, 2026 11:32 pm

I am making a project using both libaacs and libmmbd.

Ever since a MKBv82 disc failed to decrypt and noticing that a combination of the MKB tarball, libaacs (via aacs_info) and then makemkv could solve the issue together, I wanted to integrate the two together to make the process more streamlined using the libraries directly, however I noticed that the VID provided via libmmbd differs from the VID on the discatt.dat file provided on the MKB_vXX_... or the VID provided by regular libaacs.

Namely, for the film "The Martian"

Code: Select all

# libaacs (correct VID)
Disc ID: 5092F78585795CC0973D891202FA9BA7B51C1649
VID    : 3304ABC79A028FE377D4C1F6B3D42BCD

Code: Select all

# libmmbd (wrong VID and some different bytes every time)
Disc ID: 5092F78585795CC0973D891202FA9BA7B51C1649
VID    : 95F5540E781B4244CFFC3ECDA5215CC9
...
Disc ID: 5092F78585795CC0973D891202FA9BA7B51C1649
VID    : 9555C235351842440B0A23CCF965A9B9
Is there anything i can do to fix that up?

EdibleFungi
Posts: 6
Joined: Tue Jan 13, 2026 10:34 pm

Re: libmmbd / libaacs VID discrepancy.

Post by EdibleFungi » Wed Jan 28, 2026 1:23 pm

The result from libmmbd's aacs_get_vid looks like dirty memory. Library might be returning some stale memory instead of the correct value pointer (or a null pointer / null key if not valid).

Code: Select all

95 f5 54 0e 78 1b 42 44  cf fc 3e cd a5 21 5c c9  |..T.x.BD..>..!\.|
95 55 c2 35 35 18 42 44  0b 0a 23 cc f9 65 a9 b9  |.U.55.BD..#..e..|

MrPenguin
Posts: 1652
Joined: Thu Oct 19, 2023 11:31 pm

Re: libmmbd / libaacs VID discrepancy.

Post by MrPenguin » Wed Jan 28, 2026 6:41 pm

EdibleFungi wrote:
Wed Jan 28, 2026 1:23 pm
The result from libmmbd's aacs_get_vid looks like dirty memory. Library might be returning some stale memory instead of the correct value pointer (or a null pointer / null key if not valid).
According to the source code, libmmbd's aacs_get_vid() function doesn't even try to return the VID.

As I understand it, libmmbd contains an alternative implementation of libaacs, so you should link your application to either libmmbd or libaacs, but not both as they are mutually exclusive. The Open Source libbluray library can load a libaacs library dynamically, thus choosing libmmbd over the OpenSource libaacs variant, and so allowing applications linked to libbluray to use MakeMKV's "hashed keys" database instead of the usual KEYDB.cfg file.

EdibleFungi
Posts: 6
Joined: Tue Jan 13, 2026 10:34 pm

Re: libmmbd / libaacs VID discrepancy.

Post by EdibleFungi » Thu Jan 29, 2026 9:41 am

I can (and I do) dynamically load both and use both at the same time (in sequence, one after the other, not both at the same same time ;) ) is just a case of using dlopen/dlsym, although i tried using libmmbd exclusively and the same issue arises, hence why I'm certain libmmbd's implementation is incorrect.

Namely, on my code i do the libmmbd runtime load like follows:

Code: Select all

  this->mmbd_handle = dlopen("libmmbd.so.0", RTLD_NOW);
  if(this->mmbd_handle){
    this->mmbd_init = (AACS* (*)()) dlsym(this->mmbd_handle, "aacs_init");
    //... Load the reast of the libmmbd's symbols
  }

MrPenguin
Posts: 1652
Joined: Thu Oct 19, 2023 11:31 pm

Re: libmmbd / libaacs VID discrepancy.

Post by MrPenguin » Thu Jan 29, 2026 11:31 am

EdibleFungi wrote:
Thu Jan 29, 2026 9:41 am
..., hence why I'm certain libmmbd's implementation is incorrect.
I think you'll find libmmbd is behaving exactly as designed. The problem is just that you are expecting its aacs_get_vid() function to return the disk's VID, whereas I think libmmbd has actually been implemented specifically to allow libbluray to use MakeMKV's private "hashed keys" database instead of the public KEYDB.cfg file but without leaking any value from the "hashed keys" database.

EdibleFungi
Posts: 6
Joined: Tue Jan 13, 2026 10:34 pm

Re: libmmbd / libaacs VID discrepancy.

Post by EdibleFungi » Thu Jan 29, 2026 1:12 pm

So not giving out the correct VID is a "feature"?

Post Reply