Petri Hintukainen pushed to branch master at VideoLAN / libaacs


Commits:
eb8676e6 by npzacs at 2020-02-28T21:55:54+02:00
aacs_get_bdj_root_cert_hash(): do not return AACS2 content certificate hash

Application expects to get AACS1 SHA1 hash, not AACS2 SHA256 hash.

- - - - -
5795c79c by npzacs at 2020-02-28T21:55:54+02:00
Fix parsing multiple KEYDB.cfg files

Title entries from previous file were lost (and memory leaked)

- - - - -
1aefe1c8 by npzacs at 2020-02-28T21:55:54+02:00
Add aacs_error_str()

- - - - -


5 changed files:

- ChangeLog
- src/examples/aacs_info.c
- src/file/keydbcfg-parser.y
- src/libaacs/aacs.c
- src/libaacs/aacs.h


Changes:

=====================================
ChangeLog
=====================================
@@ -1,6 +1,9 @@
 - Add support for AACS2 content certificate.
 - Add aacs_set_key_caching().
+- Add aacs_error_str().
 - Issue a warning when using AACS2 capable drive.
+- Fix parsing title entries from multiple KEYDB.cfg files.
+- Fix memory leak with multiple KEYDB.cfg files.
 - Fix data corruption when structs are not packed.
 
 2017-05-04: Version 0.9.0


=====================================
src/examples/aacs_info.c
=====================================
@@ -41,29 +41,6 @@ static const char *_hex2str(const uint8_t *s, unsigned n)
     return str;
 }
 
-static const char *_error_str(int error_code)
-{
-  switch (error_code) {
-      case AACS_SUCCESS:
-        return "No errors";
-      case AACS_ERROR_CORRUPTED_DISC:
-        return "Corrupted BluRay disc";
-      case AACS_ERROR_NO_CONFIG:
-        return "Missing configuration file(s)";
-      case AACS_ERROR_NO_PK:
-        return "No matching processing key in configuration file(s)";
-      case AACS_ERROR_NO_CERT:
-        return "No valid certificates in configuration file(s)";
-      case AACS_ERROR_CERT_REVOKED:
-        return "All available certificates have been revoked";
-      case AACS_ERROR_MMC_OPEN:
-        return "MMC open failed";
-      case AACS_ERROR_MMC_FAILURE:
-        return "MMC authentication failed";
-  }
-  return "Unknown error";
-}
-
 static void _dump_rl(const char *type, AACS_RL_ENTRY *rl, int num_entries, int 
mkb_version)
 {
     int ii;
@@ -107,7 +84,7 @@ int main (int argc, char **argv)
     error_code = aacs_open_device(aacs, argv[1], argc > 2 ? argv[2] : NULL);
 
     if (error_code) {
-        fprintf(stderr, "libaacs open failed: %s\n", _error_str(error_code));
+        fprintf(stderr, "libaacs open failed: %s\n", 
aacs_error_str(error_code));
     } else {
         printf("libaacs open succeed.\n");
     }


=====================================
src/file/keydbcfg-parser.y
=====================================
@@ -286,6 +286,7 @@ disc_info
       if (!cf->list) {
         celist = cf->list = new_title_entry_list();
       } else {
+        for (; celist->next; celist = celist->next) ;
         celist->next = new_title_entry_list();
         celist = celist->next;
       }


=====================================
src/libaacs/aacs.c
=====================================
@@ -1121,6 +1121,26 @@ void aacs_get_version(int *major, int *minor, int *micro)
     *micro = AACS_VERSION_MICRO;
 }
 
+const char *aacs_error_str(int err)
+{
+    static const char * const str[] = {
+       [-AACS_SUCCESS]                = "Success",
+       [-AACS_ERROR_CORRUPTED_DISC]   = "Corrupt disc",
+       [-AACS_ERROR_NO_CONFIG]        = "Missing configuration file",
+       [-AACS_ERROR_NO_PK]            = "No matching processing key",
+       [-AACS_ERROR_NO_CERT]          = "No valid certificate",
+       [-AACS_ERROR_CERT_REVOKED]     = "Revoked certificate",
+       [-AACS_ERROR_MMC_OPEN]         = "Failed opening MMC device",
+       [-AACS_ERROR_MMC_FAILURE]      = "MMC failure",
+       [-AACS_ERROR_NO_DK]            = "No matching device key",
+    };
+    err = -err;
+    if (err < 0 || (size_t)err >= sizeof(str) / sizeof(str[0]) || !str[err]) {
+        return "Unknown error code";
+    }
+    return str[err];
+}
+
 /* aacs_open2() wrapper for backwards compability */
 AACS *aacs_open(const char *path, const char *configfile_path)
 {
@@ -1337,7 +1357,9 @@ const uint8_t *aacs_get_content_cert_id(AACS *aacs)
 const uint8_t *aacs_get_bdj_root_cert_hash(AACS *aacs)
 {
     if (aacs && aacs->cc) {
+        if (!aacs->cc->aacs2) {
         return aacs->cc->bdj_root_cert_hash;
+        }
     }
     return NULL;
 }


=====================================
src/libaacs/aacs.h
=====================================
@@ -40,6 +40,8 @@
 #define AACS_ERROR_MMC_FAILURE    -7 /* MMC failed */
 #define AACS_ERROR_NO_DK          -8 /* no matching device key */
 
+AACS_PUBLIC const char *aacs_error_str(int error);
+
 /**
  * Opaque type for AACS object
  */



View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/d21f488eb8c8c23ed693f4551e1428e4622ec25b...1aefe1c8adad97a632984896986d7baeb871e0aa

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/d21f488eb8c8c23ed693f4551e1428e4622ec25b...1aefe1c8adad97a632984896986d7baeb871e0aa
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