[libbluray-devel] hook BD-J to aacs_get_device_nonce()
npzacs
git at videolan.org
Mon Oct 14 09:18:33 CEST 2013
libbluray | branch: master | npzacs <npzacs at gmail.com> | Mon Oct 14 09:59:11 2013 +0300| [ef9a8a183bad877d7fe6d64bf8b31dd5bce6693d] | committer: npzacs
hook BD-J to aacs_get_device_nonce()
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ef9a8a183bad877d7fe6d64bf8b31dd5bce6693d
---
src/file/libaacs.c | 15 +++++++++++++++
src/file/libaacs.h | 1 +
.../java/com/aacsla/bluray/online/EnablePermission.java | 9 ++++++---
src/libbluray/bdj/java/org/videolan/Libbluray.java | 1 +
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/file/libaacs.c b/src/file/libaacs.c
index 7dbdb1a..1bb9902 100644
--- a/src/file/libaacs.c
+++ b/src/file/libaacs.c
@@ -41,6 +41,7 @@ struct bd_aacs {
fptr_p_void get_vid;
fptr_p_void get_pmsn;
fptr_p_void get_device_binding_id;
+ fptr_p_void get_device_nonce;
};
@@ -102,6 +103,7 @@ BD_AACS *libaacs_load(void)
*(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);
@@ -215,6 +217,16 @@ static const uint8_t *_get_device_binding_id(BD_AACS *p)
return (const uint8_t*)p->get_device_binding_id(p->aacs);
}
+static const uint8_t *_get_device_nonce(BD_AACS *p)
+{
+ if (!p->get_device_nonce) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_device_nonce() dlsym failed!\n");
+ return NULL;
+ }
+
+ return (const uint8_t*)p->get_device_nonce(p->aacs);
+}
+
uint32_t libaacs_get_mkbv(BD_AACS *p)
{
return p ? p->mkbv : 0;
@@ -239,6 +251,9 @@ BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type)
case BD_AACS_DEVICE_BINDING_ID:
return _get_device_binding_id(p);
+
+ case BD_AACS_DEVICE_NONCE:
+ return _get_device_nonce(p);
}
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "get_aacs_data(): unknown query %d\n", type);
diff --git a/src/file/libaacs.h b/src/file/libaacs.h
index 0534233..ca17184 100644
--- a/src/file/libaacs.h
+++ b/src/file/libaacs.h
@@ -41,6 +41,7 @@ BD_PRIVATE uint32_t libaacs_get_mkbv(BD_AACS *p);
#define BD_AACS_MEDIA_VID 2
#define BD_AACS_MEDIA_PMSN 3
#define BD_AACS_DEVICE_BINDING_ID 4
+#define BD_AACS_DEVICE_NONCE 5
BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type);
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/EnablePermission.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/EnablePermission.java
index 9b6c32b..ed15ac7 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/EnablePermission.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/EnablePermission.java
@@ -19,6 +19,7 @@
package com.aacsla.bluray.online;
+import org.videolan.Libbluray;
import org.videolan.Logger;
public class EnablePermission {
@@ -32,9 +33,11 @@ public class EnablePermission {
}
public byte[] getNonce() {
- // TODO
- logger.unimplemented("getNonce");
- return null;
+ byte nonce[] = Libbluray.getAacsData(Libbluray.AACS_DEVICE_NONCE);
+ if (nonce == null) {
+ Logger.getLogger(DeviceAttribute.class.getName()).warning("getNonce() failed");
+ }
+ return nonce;
}
public boolean isCacheable() {
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 12a41e8..e669349 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -431,6 +431,7 @@ public class Libbluray {
public static final int AACS_MEDIA_VID = 2;
public static final int AACS_MEDIA_PMSN = 3;
public static final int AACS_DEVICE_BINDING_ID = 4;
+ public static final int AACS_DEVICE_NONCE = 5;
private static native byte[] getAacsDataN(long np, int type);
private static native TitleInfo getTitleInfoN(long np, int title);
More information about the libbluray-devel
mailing list