[libaacs-devel] Reject empty keys
libaacs | branch: master | npzacs | Fri Mar 11 13:37:10 2016 +0200| [7f2a5ff3d304c42bc624f8d8ae30b21f2b4b68cf] | committer: npzacs Reject empty keys > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=7f2a5ff3d304c42bc624f8d8ae30b21f2b4b68cf --- src/file/keydbcfg.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/file/keydbcfg.c b/src/file/keydbcfg.c index 318e6fd..1e12972 100644 --- a/src/file/keydbcfg.c +++ b/src/file/keydbcfg.c @@ -570,6 +570,7 @@ static int _parse_embedded(config_file *cf) { int result = 0, jj; unsigned ii; +static const uint8_t empty_key[20] = {0}; /* reverse order to maintain key positions (items are added to list head) */ for (jj = sizeof(internal_dk_list) / sizeof(internal_dk_list[0]) - 1; jj >= 0; --jj) { @@ -601,7 +602,9 @@ static int _parse_embedded(config_file *cf) decrypt_key(e->key, internal_pk_list[ii], 16); -if (_is_duplicate_pk(cf->pkl, e->key)) { +if (!memcmp(e->key, empty_key, 16) || +_is_duplicate_pk(cf->pkl, e->key)) { + X_FREE(e); } else { @@ -620,7 +623,9 @@ static int _parse_embedded(config_file *cf) decrypt_key(e->host_priv_key, internal_hc_list[ii], 20); decrypt_key(e->host_cert, internal_hc_list[ii] + 20, 92); -if (_is_duplicate_cert(cf->host_cert_list, e)) { +if (!memcmp(e->host_priv_key, empty_key, 20) || +_is_duplicate_cert(cf->host_cert_list, e)) { + X_FREE(e); } else { ___ libaacs-devel mailing list libaacs-devel@videolan.org https://mailman.videolan.org/listinfo/libaacs-devel
[libaacs-devel] aacs_info: use aacs_init() + aacs_open_device()
libaacs | branch: master | npzacs | Thu Feb 25 18:21:10 2016 +0200| [262b1af900cb7f102406106af7ff0a616dc57bd4] | committer: npzacs aacs_info: use aacs_init() + aacs_open_device() > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=262b1af900cb7f102406106af7ff0a616dc57bd4 --- src/examples/aacs_info.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/examples/aacs_info.c b/src/examples/aacs_info.c index 8e88c92..ff78f73 100644 --- a/src/examples/aacs_info.c +++ b/src/examples/aacs_info.c @@ -1,6 +1,6 @@ /* * This file is part of libaacs - * Copyright (C) 2010 npzacs + * Copyright (C) 2010-2016 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -89,6 +89,7 @@ static void _dump_rl(const char *type, AACS_RL_ENTRY *rl, int num_entries, int m int main (int argc, char **argv) { int major, minor, micro, error_code = AACS_SUCCESS; +AACS *aacs = NULL; if (argc < 2) { fprintf(stderr, "Usage: aacs_info []\n"); @@ -98,16 +99,19 @@ int main (int argc, char **argv) aacs_get_version(&major, &minor, ยต); printf("Opening %s using libaacs %d.%d.%d ...\n", argv[1], major, minor, micro); -AACS *aacs = aacs_open2(argv[1], argc > 2 ? argv[2] : NULL, &error_code); +aacs = aacs_init(); +if (!aacs) { + exit(EXIT_FAILURE); +} + +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)); } else { printf("libaacs open succeed.\n"); } -if (!aacs) { - exit(EXIT_FAILURE); -} const uint8_t *vid = aacs_get_vid(aacs); const uint8_t *mk = aacs_get_mk(aacs); ___ libaacs-devel mailing list libaacs-devel@videolan.org https://mailman.videolan.org/listinfo/libaacs-devel
[libaacs-devel] Load multiple KEYDB.cfg files (and merge data)
libaacs | branch: master | npzacs | Wed Feb 24 11:09:46 2016 +0200| [8e6c2e6943a7d94ae5810e0eb0e6714f897ba432] | committer: npzacs Load multiple KEYDB.cfg files (and merge data) Load file from both system and user config dirs (earlier only one file was loaded). > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=8e6c2e6943a7d94ae5810e0eb0e6714f897ba432 --- src/file/keydbcfg.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/file/keydbcfg.c b/src/file/keydbcfg.c index 1e12972..ec1a412 100644 --- a/src/file/keydbcfg.c +++ b/src/file/keydbcfg.c @@ -544,24 +544,29 @@ int config_get(const char *name, uint32_t *len, void *buf) } -static char *_find_config_file(void) +static int _load_config_file(config_file *cf, int system) { static const char cfg_file_name[] = CFG_FILE_NAME; char*cfg_file = NULL; AACS_FILE_H *fp = NULL; +int result = 0; -fp = _open_cfg_file_user(cfg_file_name, &cfg_file, "r"); -if (!fp) { +if (system) { fp = _open_cfg_file_system(cfg_file_name, &cfg_file); +} else { +fp = _open_cfg_file_user(cfg_file_name, &cfg_file, "r"); } if (fp) { BD_DEBUG(DBG_FILE, "found config file: %s\n", cfg_file); file_close(fp); + +result = keydbcfg_parse_config(cf, cfg_file); } -return cfg_file; +X_FREE(cfg_file); +return result; } #include "keydb.h" @@ -653,12 +658,11 @@ config_file *keydbcfg_config_load(const char *configfile_path) config_ok = keydbcfg_parse_config(cf, configfile_path); } else { -/* If no configfile path given, check for config files in user's home or +/* If no configfile path given, check for config files in user's home and * under /etc. */ -char *cfgfile = _find_config_file(); -config_ok = keydbcfg_parse_config(cf, cfgfile); -X_FREE(cfgfile); +config_ok = _load_config_file(cf, 0); +config_ok = _load_config_file(cf, 1) || config_ok; } /* Try to load simple (aacskeys) config files */ ___ libaacs-devel mailing list libaacs-devel@videolan.org https://mailman.videolan.org/listinfo/libaacs-devel