Bug 280633 - multimedia/libaacs: add MMC drive support
Summary: multimedia/libaacs: add MMC drive support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-05 14:50 UTC by Stefan Ehmann
Modified: 2024-08-07 13:14 UTC (History)
2 users (show)

See Also:


Attachments
patch for MMC drive support (5.36 KB, patch)
2024-08-05 14:50 UTC, Stefan Ehmann
no flags Details | Diff
improved patched (5.35 KB, patch)
2024-08-06 16:28 UTC, Stefan Ehmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Ehmann 2024-08-05 14:50:29 UTC
Created attachment 252521 [details]
patch for MMC drive support

Currently, Blu-ray playback only works if the VUK of the disc is available in KEYDB.cfg.

Otherwise it fails. Tested with bd_info from libbluray:
$ bd_info /dev/cd0 
Using libbluray version 1.3.4
aacs.c:365: device 0x800 is revoked
aacs.c:380: could not find applying subset-difference for device 0x800
aacs.c:365: device 0xc00 is revoked
aacs.c:380: could not find applying subset-difference for device 0xc00
mmc_device_linux.c:188: Only block devices supported
aacs.c:121: No usable AACS libraries found!
dec.c:197: aacs_open() failed: -6!
Volume Identifier   : <redacted>
BluRay detected     : yes
First Play supported: yes
Top menu supported  : yes
HDMV titles         : 7
BD-J titles         : 0
UNSUPPORTED titles  : 0

BD-J detected       : no

AACS detected       : yes
libaacs detected    : yes
Disc ID             : <redacted>
AACS MKB version    : 81
AACS handled        : no
                      (MMC authentication failed)

BD+ detected        : no

Application info:
  initial mode preference : 2D
  3D content exists       : No
  video format            : ignored (0x0)
  frame rate              : ignored (0x0)
  initial dynamic range   : SDR (0x0)
  provider data           : '                                '

No disc library metadata


With this patch, libaacs will compute the key if non-revoked device keys and host certificate are present in KEYDB.cfg.

The patch provides an MMC device implementation based on libcam. The linux implementation uses the CDROM_SEND_PACKET ioctl which is not available on FreeBSD.

AACS decryption is now working in bd_info (vlc also works)

$ bd_info /dev/cd0 
Using libbluray version 1.3.4
aacs.c:365: device 0x800 is revoked
aacs.c:380: could not find applying subset-difference for device 0x800
aacs.c:365: device 0xc00 is revoked
aacs.c:380: could not find applying subset-difference for device 0xc00
Volume Identifier   : <redacted>
BluRay detected     : yes
First Play supported: yes
Top menu supported  : yes
HDMV titles         : 7
BD-J titles         : 0
UNSUPPORTED titles  : 0

BD-J detected       : no

AACS detected       : yes
libaacs detected    : yes
Disc ID             : <redacted>
AACS MKB version    : 81
AACS handled        : yes

BD+ detected        : no

Application info:
  initial mode preference : 2D
  3D content exists       : No
  video format            : ignored (0x0)
  frame rate              : ignored (0x0)
  initial dynamic range   : SDR (0x0)
  provider data           : '                                '

No disc library metadata


To run with debug enabled:
$ AACS_DEBUG_MASK=0xffff bd_info /dev/cd0
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-06 13:33:57 UTC
Do you want to become the maintainer of this port?
Comment 2 Stefan Ehmann 2024-08-06 16:28:21 UTC
Created attachment 252565 [details]
improved patched

New version of the patch. Minor fix to correctly log success/failure.

The last upstream release was February 2022, so maintainership is probably not very intensive. I guess you can add me as maintainer.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-06 16:56:50 UTC
Can you send this patch to upstream?

Ofc patch for Makefile.am need rework for build on Linux.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-08-06 17:03:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c8a5e838dba41d61d970347baa0dc7cd38423011

commit c8a5e838dba41d61d970347baa0dc7cd38423011
Author:     Stefan Ehmann <shoesoft@gmx.net>
AuthorDate: 2024-08-06 16:58:38 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-06 16:58:38 +0000

    multimedia/libaacs: add MMC drive support, take maintainership

    Currently, Blu-ray playback only works if the VUK of the disc is
    available in KEYDB.cfg. Otherwise it fails.
    With this patch, libaacs will compute the key if non-revoked device keys
    and host certificate are present in KEYDB.cfg.
    The patch provides an MMC device implementation based on libcam. The
    linux implementation uses the CDROM_SEND_PACKET ioctl which is not
    available on FreeBSD.
    AACS decryption is now working in bd_info from libbluray (vlc also works).

    PR:     280633

 multimedia/libaacs/Makefile                        |   5 +-
 .../libaacs/files/mmc_device_freebsd.c (new)       | 111 +++++++++++++++++++++
 multimedia/libaacs/files/patch-Makefile.am         |  26 ++++-
 3 files changed, 138 insertions(+), 4 deletions(-)
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-06 17:07:31 UTC
Thanks.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-08-06 17:10:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=80d61e166800df9a34f4b517ef564d14823648be

commit 80d61e166800df9a34f4b517ef564d14823648be
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-08-06 17:09:03 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-06 17:09:03 +0000

    multimedia/libaacs: bump after "add MMC drive support"

    PR:     280633
    Fixes:  c8a5e838dba4 (add MMC drive support)

 multimedia/libaacs/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2024-08-06 17:51:32 UTC
Before adding custom patches please upstream them otherwise they're very likely to become bitrot.
Comment 8 Stefan Ehmann 2024-08-07 13:14:32 UTC
(In reply to Daniel Engberg from comment #7)

I fear that it is a waste of time to fix Makefile.am for Linux, register with code.videolan.org and create a merge request.

The last upstream commit was in March 2022. There are 3 open merge requests with no response whatsover from upstream. The last successful merge was in 2021.