Petri Hintukainen pushed to branch master at VideoLAN / libaacs


Commits:
5ceca4fd by npzacs at 2020-07-22T18:04:34+03:00
keydbcfg: Add missing error checks (invalid hexstring)

- - - - -
f2972575 by npzacs at 2020-07-22T18:04:52+03:00
Minor optimization to hex string printing

Ensure nul termination.

- - - - -
2d97db7c by npzacs at 2020-07-22T18:06:33+03:00
comfigure: drop tests for unused headers

- - - - -
6b4839c6 by npzacs at 2020-07-22T18:09:36+03:00
configure: drop check for snprintf

It is part of C99 / POSIX. And not used in libaacs ...

- - - - -
d9ac148a by hpi1 at 2020-07-22T18:11:18+03:00
Clean up CFLAGS after ddd90a20

- - - - -
5f2c9858 by hpi1 at 2020-07-22T18:12:19+03:00
Update ChangeLog

- - - - -


5 changed files:

- ChangeLog
- Makefile.am
- configure.ac
- src/file/keydbcfg.c
- src/util/strutl.c


Changes:

=====================================
ChangeLog
=====================================
@@ -1,3 +1,15 @@
+2020-07-??: Version 0.11.0
+- Add more AACS2 support (still not complete).
+- Add support for partial unit keys in KEYDB.CFG.
+- Improve opening of UHD discs (~ 10 seconds faster).
+- Improve large KEYDB.CFG parsing (~ 4 times faster).
+- Improve error resilience.
+- Reduce memory usage (does not depend on config file size anymore).
+- Fix segfault on macOS when MMC opening fails.
+- Fix memory leak with multiple UK entries in KEYDB.cfg file.
+- Fix AACS2 with multiple unit keys.
+- Fix include flags order (do not include wrong headers outside of source 
tree).
+
 2020-03-22: Version 0.10.0
 - Add support for AACS2 content certificate.
 - Add aacs_set_key_caching().


=====================================
Makefile.am
=====================================
@@ -102,7 +102,7 @@ parser_test_SOURCES = \
        src/file/keydbcfg-lexer.l \
        src/util/strutl.c \
        src/util/logging.c
-parser_test_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES)
+parser_test_CFLAGS = -std=c99
 
 uk_dump_SOURCES = \
        src/devtools/uk_dump.c \
@@ -110,7 +110,7 @@ uk_dump_SOURCES = \
        src/libaacs/unit_key.h \
        src/libaacs/unit_key.c \
        src/util/logging.c
-uk_dump_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES)
+uk_dump_CFLAGS = -std=c99
 
 mkb_dump_SOURCES = \
        src/devtools/mkb_dump.c \
@@ -119,8 +119,8 @@ mkb_dump_SOURCES = \
        src/libaacs/mkb.c \
        src/util/strutl.c \
        src/util/logging.c
-mkb_dump_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES)
+mkb_dump_CFLAGS = -std=c99
 
 aacs_info_SOURCES = src/examples/aacs_info.c
-aacs_info_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES)
+aacs_info_CFLAGS = -std=c99
 aacs_info_LDADD = libaacs.la


=====================================
configure.ac
=====================================
@@ -62,10 +62,6 @@ esac
 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
 
-dnl messages
-library_not_found="Could not find required library!"
-function_not_found="Could not find required function!"
-
 dnl configure options
 AC_ARG_ENABLE([werror],
   [AS_HELP_STRING([--enable-werror], [set warnings as errors via -Werror 
@<:@default=disabled@:>@])])
@@ -93,20 +89,14 @@ dnl required types
 AC_TYPE_SIGNAL
 
 dnl required headers
-AC_CHECK_HEADERS([stdarg.h sys/types.h dirent.h errno.h libgen.h malloc.h])
+AC_CHECK_HEADERS([stdarg.h sys/types.h errno.h libgen.h malloc.h])
 AC_CHECK_HEADERS([stdlib.h mntent.h linux/cdrom.h inttypes.h])
-AC_CHECK_HEADERS([sys/time.h time.h sys/select.h limits.h sys/param.h])
+AC_CHECK_HEADERS([sys/select.h limits.h sys/param.h])
 AC_CHECK_HEADERS([sys/mount.h])
 
-dnl required structures
-AC_STRUCT_DIRENT_D_TYPE
-
 dnl required system services
 AC_SYS_LARGEFILE
 
-dnl required functions
-AC_CHECK_FUNC([snprintf],, [AC_MSG_ERROR($function_not_found)])
-
 dnl required libraries
 
 dnl gcrypt check


=====================================
src/file/keydbcfg.c
=====================================
@@ -168,9 +168,10 @@ static int _parse_pk_file(config_file *cf, AACS_FILE_H *fp)
 
                 pk_list *e = calloc(1, sizeof(pk_list));
                 if (e) {
-                    hexstring_to_hex_array(e->key, 16, str);
-
-                    if (_is_duplicate_pk(cf->pkl, e->key)) {
+                    if (!hexstring_to_hex_array(e->key, 16, str)) {
+                        BD_DEBUG(DBG_FILE, "Skipping invalid processing key 
%s\n", str);
+                        X_FREE(e);
+                    } else if (_is_duplicate_pk(cf->pkl, e->key)) {
                         BD_DEBUG(DBG_FILE, "Skipping duplicate processing key 
%s\n", str);
                         X_FREE(e);
                     } else {
@@ -229,10 +230,11 @@ static int _parse_cert_file(config_file *cf, AACS_FILE_H 
*fp)
 
             cert_list  *e = calloc(1, sizeof(cert_list));
             if (e) {
-                hexstring_to_hex_array(e->host_priv_key, 20, host_priv_key);
-                hexstring_to_hex_array(e->host_cert, 92, host_cert);
-
-                if (_is_duplicate_cert(cf->host_cert_list, e)) {
+                if (!hexstring_to_hex_array(e->host_priv_key, 20, 
host_priv_key) ||
+                    !hexstring_to_hex_array(e->host_cert, 92, host_cert)) {
+                    BD_DEBUG(DBG_FILE, "Skipping invalid certificate entry %s 
%s\n", host_priv_key, host_cert);
+                    X_FREE(e);
+                } else if (_is_duplicate_cert(cf->host_cert_list, e)) {
                     BD_DEBUG(DBG_FILE, "Skipping duplicate certificate entry 
%s %s\n", host_priv_key, host_cert);
                     X_FREE(e);
                 } else {


=====================================
src/util/strutl.c
=====================================
@@ -249,10 +249,13 @@ char *str_get_hex_string(const char *p, int n)
 
 char *str_print_hex(char *out, const uint8_t *buf, int count)
 {
+    static const char nibble[16] = "0123456789abcdef";
     int zz;
     for (zz = 0; zz < count; zz++) {
-        sprintf(out + (zz * 2), "%02x", buf[zz]);
+        out[zz*2    ] = nibble[buf[zz] >> 4];
+        out[zz*2 + 1] = nibble[buf[zz] & 0x0f];
     }
+    out[zz*2] = 0;
 
     return out;
 }



View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/58fb6beb63f0097f04f9a3a48d84b691bece2df4...5f2c9858b3756a91606164ed72d83ca26b5e0383

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/58fb6beb63f0097f04f9a3a48d84b691bece2df4...5f2c9858b3756a91606164ed72d83ca26b5e0383
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