[libbluray-devel] libaacs_decrypt_bus()

npzacs git at videolan.org
Wed Feb 24 11:50:59 CET 2016


libbluray | branch: master | npzacs <npzacs at gmail.com> | Mon Feb  8 16:29:40 2016 +0200| [975c49bf71750d3b0e09413764933b627bf05ece] | committer: npzacs

libaacs_decrypt_bus()

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=975c49bf71750d3b0e09413764933b627bf05ece
---

 src/libbluray/disc/aacs.c |   30 ++++++++++++++++++++++++++++++
 src/libbluray/disc/aacs.h |    2 ++
 2 files changed, 32 insertions(+)

diff --git a/src/libbluray/disc/aacs.c b/src/libbluray/disc/aacs.c
index 9ae8efb..cd4836e 100644
--- a/src/libbluray/disc/aacs.c
+++ b/src/libbluray/disc/aacs.c
@@ -41,6 +41,7 @@ struct bd_aacs {
 
     /* function pointers */
     fptr_int       decrypt_unit;
+    fptr_int       decrypt_bus;
 
     fptr_p_void    get_vid;
     fptr_p_void    get_pmsn;
@@ -129,6 +130,7 @@ static BD_AACS *_load(int impl_id)
     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");
     *(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");
@@ -246,6 +248,18 @@ int libaacs_decrypt_unit(BD_AACS *p, uint8_t *buf)
     return 0;
 }
 
+int libaacs_decrypt_bus(BD_AACS *p, uint8_t *buf)
+{
+    if (p && p->aacs && p->decrypt_bus) {
+        if (p->decrypt_bus(p->aacs, buf) > 0) {
+            return 0;
+        }
+    }
+
+    BD_DEBUG(DBG_AACS | DBG_CRIT, "Unable to BUS decrypt unit (AACS)!\n");
+    return -1;
+}
+
 /*
  *
  */
@@ -305,6 +319,22 @@ uint32_t libaacs_get_mkbv(BD_AACS *p)
     return p ? p->mkbv : 0;
 }
 
+int libaacs_get_bec_enabled(BD_AACS *p)
+{
+    fptr_int get_bec;
+
+    if (!p || !p->h_libaacs) {
+        return 0;
+    }
+
+    *(void **)(&get_bec) = dl_dlsym(p->h_libaacs, "aacs_get_bus_encryption");
+    if (!get_bec) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_bus_encryption() dlsym failed!\n");
+    }
+
+    return get_bec(p->aacs) == 3;
+}
+
 static const char *_type2str(int type)
 {
     switch (type) {
diff --git a/src/libbluray/disc/aacs.h b/src/libbluray/disc/aacs.h
index 856bf87..0f397a5 100644
--- a/src/libbluray/disc/aacs.h
+++ b/src/libbluray/disc/aacs.h
@@ -36,8 +36,10 @@ BD_PRIVATE void libaacs_unload(BD_AACS **p);
 
 BD_PRIVATE void libaacs_select_title(BD_AACS *p, uint32_t title);
 BD_PRIVATE int  libaacs_decrypt_unit(BD_AACS *p, uint8_t *buf);
+BD_PRIVATE int  libaacs_decrypt_bus(BD_AACS *p, uint8_t *buf);
 
 BD_PRIVATE uint32_t libaacs_get_mkbv(BD_AACS *p);
+BD_PRIVATE int      libaacs_get_bec_enabled(BD_AACS *p);
 
 #define BD_AACS_DISC_ID            1
 #define BD_AACS_MEDIA_VID          2



More information about the libbluray-devel mailing list