Petri Hintukainen pushed to branch master at VideoLAN / libaacs


Commits:
40a7fac3 by John Doe at 2020-06-21T03:05:21+03:00
Add support for parsing AACS 2.x media key verification data record

MKB 2.x seems to use record type 0x86 for media key verification data.
However, specifications are not available in the public so this should be
considered experimental.

- - - - -


2 changed files:

- src/libaacs/mkb.c
- src/libaacs/mkb.h


Changes:

=====================================
src/libaacs/mkb.c
=====================================
@@ -77,6 +77,7 @@ MKB *mkb_init(uint8_t *data, size_t len)
     mkb->buf  = data;
 
     BD_DEBUG(DBG_MKB, "MKB size: %u\n", (unsigned)mkb->size);
+    BD_DEBUG(DBG_MKB, "MKB type: 0x%x\n", mkb_type(mkb));
     BD_DEBUG(DBG_MKB, "MKB version: %d\n", mkb_version(mkb));
 
     return mkb;
@@ -207,12 +208,29 @@ const uint8_t *mkb_cvalues(MKB *mkb, size_t *len)
 
 const uint8_t *mkb_mk_dv(MKB *mkb)
 {
+    const uint8_t *rec;
+    uint8_t dv_record;
     size_t len;
-    const uint8_t *rec = _record(mkb, 0x81, &len);
+
+    switch (mkb_type(mkb)) {
+        case MKB_20_CATEGORY_C:
+        case MKB_21_CATEGORY_C:
+            dv_record = 0x86;
+            break;
+        case MKB_TYPE_3:
+        case MKB_TYPE_4:
+        case MKB_TYPE_10_CLASS_II:
+        default:
+            dv_record = 0x81;
+            break;
+    }
+
+    rec = _record(mkb, dv_record, &len);
 
     if (len < 20) {
         return NULL;
     }
+
     if (rec) {
         rec += 4;
     }


=====================================
src/libaacs/mkb.h
=====================================
@@ -29,6 +29,12 @@ typedef struct mkb MKB;
 
 struct aacs_file_s;
 
+#define MKB_TYPE_3           0x00031003
+#define MKB_TYPE_4           0x00041003
+#define MKB_TYPE_10_CLASS_II 0x000A1003
+#define MKB_20_CATEGORY_C    0x48141003
+#define MKB_21_CATEGORY_C    0x48151003
+
 BD_PRIVATE MKB *mkb_init(uint8_t *data, size_t len); // init MKB from data
 BD_PRIVATE void mkb_close(MKB *mkb);           // free MKB
 



View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/commit/40a7fac382574968f548dade8dd0bca309105cca

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/commit/40a7fac382574968f548dade8dd0bca309105cca
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
libaacs-devel mailing list
libaacs-devel@videolan.org
https://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to