Projects
Essentials
libaacs
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 4
View file
libaacs.changes
Changed
@@ -1,4 +1,24 @@ ------------------------------------------------------------------- +Fri Apr 25 15:29:24 UTC 2014 - dnh@opensuse.org + +- update to 0.7.0 + * Add aacs_get_device_binding_id() and aacs_get_device_nonce(). + * Add aacs_get_mk(). + * Add support for bus encryption. + * Add support for device keys. + * Add support for internal keys. + * Fix reading PMSN. + * Fix reporting AACS version from AACS drive feature. + * Calculate bus key and use it to verify message authentication codes. + * Do not fail if VID is known but config file does not exist. + * Improve validating keys in KEYDB.cfg. + * Update KEYDB.cfg format (still backwards compatible): + * Host nonce and host key point are optional. + * Add device key UV values and masks. + * Build system updates. + * Drop support for compile-time PATCHED_DRIVE flag. + +------------------------------------------------------------------- Sat Mar 16 11:20:34 UTC 2013 - obs@botter.cc - update to 0.6.0
View file
libaacs.spec
Changed
@@ -19,7 +19,7 @@ Name: libaacs -Version: 0.6.0 +Version: 0.7.0 Release: 1.1 License: LGPL-2.1+ Summary: Open implentation of AACS specification
View file
libaacs-0.6.0.tar.bz2/src/examples/Makefile.am
Deleted
@@ -1,18 +0,0 @@ -SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT -SET_INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/file - -AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) - -AACS_LIB = $(top_builddir)/src/libaacs.la - -noinst_PROGRAMS=parser_test -bin_PROGRAMS=aacs_info - -parser_test_SOURCES=parser_test.c \ - $(top_builddir)/src/keydbcfg-lexer.c \ - $(top_builddir)/src/keydbcfg-parser.c - -parser_test_LDADD = $(AACS_LIB) - -aacs_info_SOURCE=libaacs_test.c -aacs_info_LDADD = $(AACS_LIB)
View file
libaacs-0.6.0.tar.bz2/src/examples/Makefile.in
Deleted
@@ -1,590 +0,0 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -noinst_PROGRAMS = parser_test$(EXEEXT) -bin_PROGRAMS = aacs_info$(EXEEXT) -subdir = src/examples -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -aacs_info_SOURCES = aacs_info.c -aacs_info_OBJECTS = aacs_info.$(OBJEXT) -aacs_info_DEPENDENCIES = $(AACS_LIB) -am_parser_test_OBJECTS = parser_test.$(OBJEXT) \ - keydbcfg-lexer.$(OBJEXT) keydbcfg-parser.$(OBJEXT) -parser_test_OBJECTS = $(am_parser_test_OBJECTS) -parser_test_DEPENDENCIES = $(AACS_LIB) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = aacs_info.c $(parser_test_SOURCES) -DIST_SOURCES = aacs_info.c $(parser_test_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -AACS_VERSION_MAJOR = @AACS_VERSION_MAJOR@ -AACS_VERSION_MICRO = @AACS_VERSION_MICRO@ -AACS_VERSION_MINOR = @AACS_VERSION_MINOR@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_VERSION_INFO = @LT_VERSION_INFO@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@
View file
libaacs-0.6.0.tar.bz2/src/file/darwin.c
Deleted
@@ -1,95 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2012 Konstantin Pavlov - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#include "darwin.h" - -#include <CoreFoundation/CoreFoundation.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "util/strutl.h" -#include "util/logging.h" - -#define USER_CFG_DIR "Library/Preferences" -#define USER_CACHE_DIR "Library/Caches" -#define SYSTEM_CFG_DIR "/Library/Preferences" - - -const char *darwin_get_config_home(void) -{ - static char *dir = NULL; - static int init_done = 0; - - if (!init_done) { - init_done = 1; - - const char *user_home = getenv("HOME"); - if (user_home && *user_home) { - return dir = str_printf("%s/%s", user_home, USER_CFG_DIR); - } - - DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); - } - - return dir; -} - -const char *darwin_get_cache_home(void) -{ - static char *dir = NULL; - static int init_done = 0; - - if (!init_done) { - init_done = 1; - - const char *user_home = getenv("HOME"); - if (user_home && *user_home) { - return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR); - } - - DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); - } - - return dir; -} - -const char *darwin_get_config_system(const char *dir) -{ - static char *dirs = NULL; // "dir1\0dir2\0...\0dirN\0\0" - - if (!dirs) { - dirs = str_printf("%s%c%c", SYSTEM_CFG_DIR, 0, 0); - } - - if (!dir) { - // first call - dir = dirs; - } else { - // next call - dir += strlen(dir) + 1; - if (!*dir) { - // end of list - dir = NULL; - } - } - - return dir; -}
View file
libaacs-0.6.0.tar.bz2/src/file/darwin.h
Deleted
@@ -1,29 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2012 Konstantin Pavlov - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#ifndef AACS_DARWIN_H -#define AACS_DARWIN_H - -#include <util/attributes.h> - -AACS_PRIVATE const char *darwin_get_config_home(void); -AACS_PRIVATE const char *darwin_get_config_system(const char *dir); -AACS_PRIVATE const char *darwin_get_cache_home(void); - -#endif
View file
libaacs-0.6.0.tar.bz2/src/file/win32.c
Deleted
@@ -1,89 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2011 VideoLAN - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#include "win32.h" - -#include "util/logging.h" - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <stdio.h> -#include <string.h> - -#include <shlobj.h> -#include <w32api.h> -#include <limits.h> -#include <direct.h> - -int win32_mkdir(const char *dir) -{ - wchar_t wdirMAX_PATH; - - MultiByteToWideChar(CP_UTF8, 0, dir, -1, wdir, MAX_PATH); - return _wmkdir(wdir); -} - -const char *win32_get_config_home(void) -{ - static char appdirPATH_MAX = ""; - wchar_t wdirMAX_PATH; - - if (*appdir) - return appdir; - - /* Get the "Application Data" folder for the user */ - if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, - NULL, SHGFP_TYPE_CURRENT, wdir)) { - WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, PATH_MAX, NULL, NULL); - return appdir; - } - - DEBUG(DBG_FILE, "Can't find user configuration directory !\n"); - return NULL; -} - -const char *win32_get_config_system(const char *dir) -{ - static char appdirPATH_MAX = ""; - wchar_t wdirMAX_PATH; - - if (!dir) { - // first call - - if (*appdir) - return appdir; - - /* Get the "Application Data" folder for all users */ - if (S_OK == SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, - NULL, SHGFP_TYPE_CURRENT, wdir)) { - WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, PATH_MAX, NULL, NULL); - return appdir; - } else { - DEBUG(DBG_FILE, "Can't find common configuration directory !\n"); - return NULL; - } - } else { - // next call - return NULL; - } - - return dir; -}
View file
libaacs-0.6.0.tar.bz2/src/file/win32.h
Deleted
@@ -1,29 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2011 VideoLAN - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#ifndef AACS_WIN32_H -#define AACS_WIN32_H - -#include <util/attributes.h> - -AACS_PRIVATE int win32_mkdir(const char *dir); -AACS_PRIVATE const char *win32_get_config_home(void); -AACS_PRIVATE const char *win32_get_config_system(const char *dir); - -#endif
View file
libaacs-0.6.0.tar.bz2/src/file/xdg.c
Deleted
@@ -1,122 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2010 npzacs - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#include "xdg.h" - -#include "util/strutl.h" -#include "util/logging.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* - * Based on XDG Base Directory Specification - * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - */ - -#define USER_CFG_DIR ".config" -#define USER_CACHE_DIR ".cache" -#define SYSTEM_CFG_DIR "/etc/xdg" - - -const char *xdg_get_config_home(void) -{ - static char *dir = NULL; - static int init_done = 0; - - if (!init_done) { - init_done = 1; - - const char *xdg_home = getenv("XDG_CONFIG_HOME"); - if (xdg_home && *xdg_home) { - return dir = str_printf("%s", xdg_home); - } - - const char *user_home = getenv("HOME"); - if (user_home && *user_home) { - return dir = str_printf("%s/%s", user_home, USER_CFG_DIR); - } - - DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); - } - - return dir; -} - -const char *xdg_get_cache_home(void) -{ - static char *dir = NULL; - static int init_done = 0; - - if (!init_done) { - init_done = 1; - - const char *xdg_cache = getenv("XDG_CACHE_HOME"); - if (xdg_cache && *xdg_cache) { - return dir = str_printf("%s", xdg_cache); - } - - const char *user_home = getenv("HOME"); - if (user_home && *user_home) { - return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR); - } - - DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); - } - - return dir; -} - -const char *xdg_get_config_system(const char *dir) -{ - static char *dirs = NULL; // "dir1\0dir2\0...\0dirN\0\0" - - if (!dirs) { - const char *xdg_sys = getenv("XDG_CONFIG_DIRS"); - - if (xdg_sys && *xdg_sys) { - - dirs = calloc(1, strlen(xdg_sys) + 2); - strcpy(dirs, xdg_sys); - - char *pt = dirs; - while (NULL != (pt = strchr(pt, ':'))) { - *pt++ = 0; - } - - } else { - dirs = str_printf("%s%c%c", SYSTEM_CFG_DIR, 0, 0); - } - } - - if (!dir) { - // first call - dir = dirs; - } else { - // next call - dir += strlen(dir) + 1; - if (!*dir) { - // end of list - dir = NULL; - } - } - - return dir; -}
View file
libaacs-0.6.0.tar.bz2/src/file/xdg.h
Deleted
@@ -1,29 +0,0 @@ -/* - * This file is part of libaacs - * Copyright (C) 2010 npzacs - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - */ - -#ifndef AACS_XDG_H -#define AACS_XDG_H - -#include <util/attributes.h> - -AACS_PRIVATE const char *xdg_get_config_home(void); -AACS_PRIVATE const char *xdg_get_config_system(const char *dir); -AACS_PRIVATE const char *xdg_get_cache_home(void); - -#endif
View file
libaacs-0.6.0.tar.bz2/src/keydbcfg-lexer.c
Deleted
@@ -1,2282 +0,0 @@ -#line 2 "keydbcfg-lexer.c" - -#line 4 "keydbcfg-lexer.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include <inttypes.h> -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* An opaque pointer. */ -#ifndef YY_TYPEDEF_YY_SCANNER_T -#define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; -#endif - -/* For convenience, these vars (plus the bison vars far below) - are macros in the reentrant scanner. */ -#define yyin yyg->yyin_r -#define yyout yyg->yyout_r -#define yyextra yyg->yyextra_r -#define yyleng yyg->yyleng_r -#define yytext yyg->yytext_r -#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) -#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) -#define yy_flex_debug yyg->yy_flex_debug_r - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yyg->yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yyg->yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE libaacs_yyrestart(yyin ,yyscanner ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE libaacs_yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytextyyl == '\n' )\ - --yylineno;\ - }while(0)
View file
libaacs-0.6.0.tar.bz2/src/keydbcfg-parser.c
Deleted
@@ -1,2494 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.5. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.5" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 1 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ -#define yyparse libaacs_yyparse -#define yylex libaacs_yylex -#define yyerror libaacs_yyerror -#define yylval libaacs_yylval -#define yychar libaacs_yychar -#define yydebug libaacs_yydebug -#define yynerrs libaacs_yynerrs - - -/* Copy the first part of user declarations. */ - - -/* Line 268 of yacc.c */ -#line 79 "keydbcfg-parser.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -/* "%code requires" blocks. */ - -/* Line 288 of yacc.c */ -#line 1 "keydbcfg-parser.y" - -#include "file/keydbcfg.h" - - - -/* Line 288 of yacc.c */ -#line 109 "keydbcfg-parser.c" - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - HEXSTRING = 258, - DISC_TITLE = 259, - DIGIT = 260, - KEYWORD_DEVICE_KEY = 261, - KEYWORD_DEVICE_NODE = 262, - KEYWORD_HOST_PRIV_KEY = 263, - KEYWORD_HOST_CERT = 264, - KEYWORD_HOST_NONCE = 265, - KEYWORD_HOST_KEY_POINT = 266, - PUNCT_EQUALS_SIGN = 267, - PUNCT_VERTICAL_BAR = 268, - PUNCT_HYPHEN = 269, - ENTRY_ID_DK = 270, - ENTRY_ID_PK = 271, - ENTRY_ID_HC = 272, - ENTRY_ID_DATE = 273, - ENTRY_ID_MEK = 274, - ENTRY_ID_VID = 275, - ENTRY_ID_BN = 276, - ENTRY_ID_VUK = 277, - ENTRY_ID_PAK = 278, - ENTRY_ID_TK = 279, - ENTRY_ID_UK = 280, - NEWLINE = 281, - BAD_ENTRY = 282 - }; -#endif -/* Tokens. */ -#define HEXSTRING 258 -#define DISC_TITLE 259 -#define DIGIT 260 -#define KEYWORD_DEVICE_KEY 261 -#define KEYWORD_DEVICE_NODE 262 -#define KEYWORD_HOST_PRIV_KEY 263 -#define KEYWORD_HOST_CERT 264 -#define KEYWORD_HOST_NONCE 265 -#define KEYWORD_HOST_KEY_POINT 266 -#define PUNCT_EQUALS_SIGN 267 -#define PUNCT_VERTICAL_BAR 268 -#define PUNCT_HYPHEN 269 -#define ENTRY_ID_DK 270 -#define ENTRY_ID_PK 271 -#define ENTRY_ID_HC 272 -#define ENTRY_ID_DATE 273 -#define ENTRY_ID_MEK 274 -#define ENTRY_ID_VID 275 -#define ENTRY_ID_BN 276 -#define ENTRY_ID_VUK 277 -#define ENTRY_ID_PAK 278 -#define ENTRY_ID_TK 279 -#define ENTRY_ID_UK 280 -#define NEWLINE 281 -#define BAD_ENTRY 282 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ - -/* Line 293 of yacc.c */ -#line 108 "keydbcfg-parser.y" - - char *string; - unsigned int digit; - - - -/* Line 293 of yacc.c */ -#line 187 "keydbcfg-parser.c" -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - - -/* Copy the second part of user declarations. */ - - -/* Line 343 of yacc.c */ -#line 199 "keydbcfg-parser.c" -/* Unqualified %code blocks. */
View file
libaacs-0.6.0.tar.bz2/ChangeLog -> libaacs-0.7.0.tar.bz2/ChangeLog
Changed
@@ -1,3 +1,20 @@ +2013-12-18: Version 0.7.0 + - Add aacs_get_device_binding_id() and aacs_get_device_nonce(). + - Add aacs_get_mk(). + - Add support for bus encryption. + - Add support for device keys. + - Add support for internal keys. + - Fix reading PMSN. + - Fix reporting AACS version from AACS drive feature. + - Calculate bus key and use it to verify message authentication codes. + - Do not fail if VID is known but config file does not exist. + - Improve validating keys in KEYDB.cfg. + - Update KEYDB.cfg format (still backwards compatible): + * Host nonce and host key point are optional. + * Add device key UV values and masks. + - Build system updates. + - Drop support for compile-time PATCHED_DRIVE flag. + 2013-03-04: Version 0.6.0 - Added reading of PMSN (Pre-recorded Media Serial Number) - Fix resource leak
View file
libaacs-0.6.0.tar.bz2/KEYDB.cfg -> libaacs-0.7.0.tar.bz2/KEYDB.cfg
Changed
@@ -38,14 +38,17 @@ ; ; Device Key entry ; ---------------- -; | DK | DEVICE_KEY <HEXSTRING> | DEVICE_NODE <HEXSTRING> +; | DK | DEVICE_KEY <HEXSTRING> \ +; | DEVICE_NODE <HEXSTRING> \ +; | KEY_UV <HEXSTRING> \ +; | KEY_U_MASK_SHIFT <HEXSTRING> ; ; The device key entry begins with the entry ID "| DK |". Within a device key -; entry are two hexadecimal strings. The first hexadecimal string is preceded by +; entry are four hexadecimal strings. The first hexadecimal string is preceded by ; the keyword "DEVICE_KEY" and is the hexadecimal string representing the device ; key. The second hexadecimal string is preceded by the keyword "DEVICE_NODE" ; and is the hexadecimal string representing the device node number. Each of -; two entries is delimited by a vertical bar '|'. Each device key entry must end +; four entries is delimited by a vertical bar '|'. Each device key entry must end ; with a newline. ; ; Note that each of these entries must end with at least one new line, as @@ -62,15 +65,12 @@ ; Host Certificate entry ; ---------------------- ; | HC | HOST_PRIV_KEY <HEXSTRING> \ -; | HOST_CERT <HEXSTRING> \ -; | HOST_NONCE <HEXSTRING> \ -; | HOST_KEY_POINT <HEXSTRING> +; | HOST_CERT <HEXSTRING> ; ; A Host Certificate entry begins with the entry ID "| HC |". Each host -; certificate entry must contain 4 hexadecimal strings preceded by a keyword that identifies the type of entry +; certificate entry must contain 2 hexadecimal strings preceded by a keyword that identifies the type of entry ; that the hexadecimal string corresponds to. The first hexstring is the host -; private key, the second is the host certificate, the third is the host nonce, -; and the fourth is the host key point. Each of these 4 entry types for a host +; private key, the second is the host certificate. Each of these entry types for a host ; certificate entry must be delimited by vertical bar '|'. A host certificate ; entry must end with a newline. ; @@ -156,7 +156,9 @@ ; foo's device key | DK | DEVICE_KEY 0x00000000000000000000000000000000 \ - | DEVICE_NODE 0x0 + | DEVICE_NODE 0x0 \ + | KEY_UV 0x00000000 \ + | KEY_U_MASK 0x00 ; bar's device key | DK | DEVICE_KEY 0x00000000000000000000000000000000 \
View file
libaacs-0.6.0.tar.bz2/Makefile.am -> libaacs-0.7.0.tar.bz2/Makefile.am
Changed
@@ -1,4 +1,4 @@ -SUBDIRS=src src/examples +SUBDIRS=src ACLOCAL_AMFLAGS=-I m4
View file
libaacs-0.6.0.tar.bz2/Makefile.in -> libaacs-0.7.0.tar.bz2/Makefile.in
Changed
@@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\\ \ *) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -64,6 +81,11 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -140,6 +162,9 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -244,7 +269,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = src src/examples +SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = bootstrap COPYING KEYDB.cfg README.txt ChangeLog all: config.h @@ -481,13 +506,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -572,7 +594,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir)
View file
libaacs-0.6.0.tar.bz2/aclocal.m4 -> libaacs-0.7.0.tar.bz2/aclocal.m4
Changed
@@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11.3 -*- Autoconf -*- +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, @@ -14,8 +14,8 @@ m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl -m4_if(m4_defn(AC_AUTOCONF_VERSION), 2.68,, -m4_warning(this file was generated for autoconf 2.68. +m4_if(m4_defn(AC_AUTOCONF_VERSION), 2.69,, +m4_warning(this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.)) @@ -38,7 +38,7 @@ am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if($1, 1.11.3, , +m4_if($1, 1.11.6, , AC_FATAL(Do not call $0, use AM_INIT_AUTOMAKE($1).))dnl ) @@ -54,7 +54,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN(AM_SET_CURRENT_AUTOMAKE_VERSION, -AM_AUTOMAKE_VERSION(1.11.3)dnl +AM_AUTOMAKE_VERSION(1.11.6)dnl m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl _AM_AUTOCONF_VERSION(m4_defn(AC_AUTOCONF_VERSION)))
View file
libaacs-0.6.0.tar.bz2/build-aux/config.sub -> libaacs-0.7.0.tar.bz2/build-aux/config.sub
Changed
@@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -225,6 +225,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -1537,6 +1543,9 @@ c4x-* | tic4x-*) os=-coff ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;;
View file
libaacs-0.6.0.tar.bz2/build-aux/depcomp -> libaacs-0.7.0.tar.bz2/build-aux/depcomp
Changed
@@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2011-12-04.11; # UTC +scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, -# 2011 Free Software Foundation, Inc. +# 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ case $1 in '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) @@ -40,8 +40,8 @@ Environment variables: depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. @@ -57,6 +57,12 @@ ;; esac +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' + if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 @@ -102,6 +108,12 @@ depmode=msvc7 fi +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -156,15 +168,14 @@ ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^^:*: / /' \ -e 's/^'$alpha':\/^:*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. +## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory + tr ' ' "$nl" < "$tmpdepfile" | +## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. @@ -203,18 +214,15 @@ # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the + # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ + tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> "$depfile" + tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ + tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else @@ -226,10 +234,17 @@ rm -f "$tmpdepfile" ;; +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the + # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/^/*$|/|'` @@ -259,12 +274,11 @@ test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. + # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. + # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.a-z*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the . - sed -e 's,^.*\.a-z*: *,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + sed -e 's,^.*\.a-z*:'"$tab"' *,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -275,23 +289,26 @@ ;; icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. + # However on + # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h - # which is wrong. We want: + # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : + # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... - + # tcc 0.9.26 (FIXME still under development at the moment of writing) + # will emit a similar output, but also prepend the continuation lines + # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : @@ -300,15 +317,21 @@ exit $stat fi rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Each line is of the form 'foo.o: dependent.h', + # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^^:*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^^:*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s/^ $tab $tab*/ /" -e "s,^^:*:,$object :," \ + < "$tmpdepfile" > "$depfile" + sed ' + s/ '"$tab"' '"$tab"'*/ /g + s/^ *// + s/ *\\*$// + s/^^:*: *// + /^$/d + /:$/d + s/$/ :/ + ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; @@ -344,7 +367,7 @@ done
View file
libaacs-0.6.0.tar.bz2/build-aux/ltmain.sh -> libaacs-0.7.0.tar.bz2/build-aux/ltmain.sh
Changed
@@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu1" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337
View file
libaacs-0.6.0.tar.bz2/config.h.in -> libaacs-0.7.0.tar.bz2/config.h.in
Changed
@@ -20,7 +20,7 @@ /* Define to 1 if you have the <libgen.h> header file. */ #undef HAVE_LIBGEN_H -/* Define to 1 if you have the `gpg-error' library (-lgpg-error). */ +/* Define to 1 if you have the gpg-error library */ #undef HAVE_LIBGPG_ERROR /* Define to 1 if you have the <limits.h> header file. */ @@ -44,9 +44,6 @@ /* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H -/* realpath */ -#undef HAVE_REALPATH - /* Define to 1 if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H @@ -144,6 +141,11 @@ `char'. */ #undef YYTEXT_POINTER +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS
View file
libaacs-0.6.0.tar.bz2/configure -> libaacs-0.7.0.tar.bz2/configure
Changed
@@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for libaacs 0.6.0. +# Generated by GNU Autoconf 2.69 for libaacs 0.7.0. # # Report bugs to <http://www.videolan.org/developers/libaacs.html>. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -136,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -169,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -222,21 +246,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -339,6 +367,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -460,6 +496,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $0, causing all sort of problems # (the dirname of $0 is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -494,16 +534,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -515,28 +555,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???sx*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%^_$as_cr_alnum%_%g'" @@ -570,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libaacs' PACKAGE_TARNAME='libaacs' -PACKAGE_VERSION='0.6.0' -PACKAGE_STRING='libaacs 0.6.0' +PACKAGE_VERSION='0.7.0' +PACKAGE_STRING='libaacs 0.7.0' PACKAGE_BUGREPORT='http://www.videolan.org/developers/libaacs.html' PACKAGE_URL='' @@ -620,6 +640,9 @@ AACS_VERSION_MICRO AACS_VERSION_MINOR AACS_VERSION_MAJOR +GPG_ERROR_LIBS +GPG_ERROR_CFLAGS +GPG_ERROR_CONFIG LIBGCRYPT_LIBS LIBGCRYPT_CFLAGS LIBGCRYPT_CONFIG @@ -765,6 +788,7 @@ enable_libtool_lock
View file
libaacs-0.6.0.tar.bz2/configure.ac -> libaacs-0.7.0.tar.bz2/configure.ac
Changed
@@ -1,6 +1,6 @@ dnl library version number m4_define(aacs_major, 0) -m4_define(aacs_minor, 6) +m4_define(aacs_minor, 7) m4_define(aacs_micro, 0) m4_define(aacs_version,aacs_major.aacs_minor.aacs_micro) @@ -14,8 +14,8 @@ # dnl Library file name will be libaacs.(current-age).age.revision # -m4_define(lt_current, 3) -m4_define(lt_age, 3) +m4_define(lt_current, 4) +m4_define(lt_age, 4) m4_define(lt_revision, 0) dnl initilization @@ -104,8 +104,6 @@ dnl required functions AC_CHECK_FUNC(snprintf,, AC_MSG_ERROR($function_not_found)) -AC_CHECK_FUNC(realpath,AC_DEFINE(HAVE_REALPATH,1,realpath)) - dnl required libraries dnl pthread check (not on win32) @@ -138,8 +136,29 @@ AC_SUBST(LIBGCRYPT_LIBS) fi AC_FUNC_STRERROR_R -AC_CHECK_LIB(gpg-error, gpg_strerror_r) +# use re-entrant version of gcrypt_error() from gpg-error + +AC_ARG_WITH(gpg-error-prefix, + AC_HELP_STRING(--with-gpg-error-prefix=PFX, + prefix where gpg-error is installed (optional)), + gpg_error_config_prefix="$withval", gpg_error_config_prefix="") +if test x$gpg_error_config_prefix != x ; then + if test x${GPG_ERROR_CONFIG+set} != xset ; then + GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config + fi +fi + +AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) +if test x"$GPG_ERROR_CONFIG" = xno; then + AC_MSG_ERROR(gpg-error not found on system) +else + GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` + GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` + AC_SUBST(GPG_ERROR_CFLAGS) + AC_SUBST(GPG_ERROR_LIBS) + AC_DEFINE(HAVE_LIBGPG_ERROR, 1, Define to 1 if you have the gpg-error library) +fi CC_CHECK_CFLAGS_APPEND(-Wall -Wdisabled-optimization -Wpointer-arith dnl -Wredundant-decls -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef dnl @@ -177,5 +196,5 @@ dnl generate output files AC_SUBST(SET_FEATURES) -AC_CONFIG_FILES(Makefile src/Makefile src/examples/Makefile src/libaacs.pc src/libaacs/aacs-version.h) +AC_CONFIG_FILES(Makefile src/Makefile src/libaacs.pc src/libaacs/aacs-version.h) AC_OUTPUT
View file
libaacs-0.6.0.tar.bz2/m4/libtool.m4 -> libaacs-0.7.0.tar.bz2/m4/libtool.m4
Changed
@@ -1324,7 +1324,14 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler
View file
libaacs-0.6.0.tar.bz2/src/Makefile.am -> libaacs-0.7.0.tar.bz2/src/Makefile.am
Changed
@@ -1,7 +1,7 @@ SET_FEATURES = @SET_FEATURES@ SET_INCLUDES = -I$(top_srcdir) -Ifile -Ilibaacs -AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS) +AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS) AM_YFLAGS = -d -p libaacs_yy lib_LTLIBRARIES = libaacs.la @@ -14,13 +14,16 @@ libaacs/crypto.c \ libaacs/crypto.h \ libaacs/mkb.c \ + file/dirs.h \ file/file.h \ file/filesystem.h \ file/file_posix.c \ file/keydbcfg.c \ file/keydbcfg.h \ + file/keydb.h \ file/keydbcfg-parser.y \ file/keydbcfg-lexer.l \ + file/path.h \ util/attributes.h \ util/macro.h \ util/logging.c \ @@ -33,17 +36,15 @@ if HAVE_DARWIN libaacs_la_SOURCES+= \ - file/darwin.c \ - file/darwin.h + file/dirs_darwin.c else if HAVE_WIN32 libaacs_la_SOURCES+= \ - file/win32.c \ - file/win32.h + file/dirs_win32.c else libaacs_la_SOURCES+= \ - file/xdg.c \ - file/xdg.h + file/dirs_xdg.c \ + file/path.c endif endif @@ -53,7 +54,7 @@ libaacs/aacs-version.h libaacs_la_LDFLAGS= -no-undefined -version-info $(LT_VERSION_INFO) -libaacs_la_LIBADD = $(LIBGCRYPT_LIBS) +libaacs_la_LIBADD = $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libaacs.pc @@ -67,3 +68,21 @@ # do not distribute files that should be generated by lex/yacc locally dist-hook: (cd $(distdir) && rm -f $(BUILT_SOURCES)) + +# +# programs +# + +noinst_PROGRAMS = parser_test +bin_PROGRAMS = aacs_info + +parser_test_SOURCES = examples/parser_test.c \ + file/keydbcfg-parser.y \ + file/keydbcfg-lexer.l \ + util/strutl.c \ + util/logging.c +parser_test_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) + +aacs_info_SOURCES = examples/aacs_info.c +aacs_info_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) +aacs_info_LDADD = libaacs.la
View file
libaacs-0.6.0.tar.bz2/src/Makefile.in -> libaacs-0.7.0.tar.bz2/src/Makefile.in
Changed
@@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -17,7 +17,25 @@ + VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\\ \ *) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -38,17 +56,17 @@ host_triplet = @host@ target_triplet = @target@ @HAVE_DARWIN_TRUE@am__append_1 = \ -@HAVE_DARWIN_TRUE@ file/darwin.c \ -@HAVE_DARWIN_TRUE@ file/darwin.h +@HAVE_DARWIN_TRUE@ file/dirs_darwin.c @HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@am__append_2 = \ -@HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@ file/win32.c \ -@HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@ file/win32.h +@HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@ file/dirs_win32.c @HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@am__append_3 = \ -@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@ file/xdg.c \ -@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@ file/xdg.h +@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@ file/dirs_xdg.c \ +@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@ file/path.c +noinst_PROGRAMS = parser_test$(EXEEXT) +bin_PROGRAMS = aacs_info$(EXEEXT) subdir = src DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/libaacs.pc.in keydbcfg-lexer.c \ @@ -91,22 +109,24 @@ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(pkgincludedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -libaacs_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libaacs_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__libaacs_la_SOURCES_DIST = libaacs/aacs.h libaacs/mmc.h \ libaacs/mkb.h libaacs/aacs.c libaacs/mmc.c libaacs/crypto.c \ - libaacs/crypto.h libaacs/mkb.c file/file.h file/filesystem.h \ - file/file_posix.c file/keydbcfg.c file/keydbcfg.h \ - file/keydbcfg-parser.y file/keydbcfg-lexer.l util/attributes.h \ + libaacs/crypto.h libaacs/mkb.c file/dirs.h file/file.h \ + file/filesystem.h file/file_posix.c file/keydbcfg.c \ + file/keydbcfg.h file/keydb.h file/keydbcfg-parser.y \ + file/keydbcfg-lexer.l file/path.h util/attributes.h \ util/macro.h util/logging.c util/logging.h util/strutl.c \ - util/strutl.h file/darwin.c file/darwin.h file/win32.c \ - file/win32.h file/xdg.c file/xdg.h -@HAVE_DARWIN_TRUE@am__objects_1 = darwin.lo -@HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@am__objects_2 = win32.lo -@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@am__objects_3 = xdg.lo + util/strutl.h file/dirs_darwin.c file/dirs_win32.c \ + file/dirs_xdg.c file/path.c +@HAVE_DARWIN_TRUE@am__objects_1 = dirs_darwin.lo +@HAVE_DARWIN_FALSE@@HAVE_WIN32_TRUE@am__objects_2 = dirs_win32.lo +@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@am__objects_3 = dirs_xdg.lo \ +@HAVE_DARWIN_FALSE@@HAVE_WIN32_FALSE@ path.lo am_libaacs_la_OBJECTS = aacs.lo mmc.lo crypto.lo mkb.lo file_posix.lo \ keydbcfg.lo keydbcfg-parser.lo keydbcfg-lexer.lo logging.lo \ strutl.lo $(am__objects_1) $(am__objects_2) $(am__objects_3) @@ -114,6 +134,22 @@ libaacs_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libaacs_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_aacs_info_OBJECTS = aacs_info-aacs_info.$(OBJEXT) +aacs_info_OBJECTS = $(am_aacs_info_OBJECTS) +aacs_info_DEPENDENCIES = libaacs.la +aacs_info_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(aacs_info_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_parser_test_OBJECTS = parser_test-parser_test.$(OBJEXT) \ + parser_test-keydbcfg-parser.$(OBJEXT) \ + parser_test-keydbcfg-lexer.$(OBJEXT) \ + parser_test-strutl.$(OBJEXT) parser_test-logging.$(OBJEXT) +parser_test_OBJECTS = $(am_parser_test_OBJECTS) +parser_test_LDADD = $(LDADD) +parser_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(parser_test_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -136,9 +172,16 @@ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) -SOURCES = $(libaacs_la_SOURCES) $(EXTRA_libaacs_la_SOURCES) +SOURCES = $(libaacs_la_SOURCES) $(EXTRA_libaacs_la_SOURCES) \ + $(aacs_info_SOURCES) $(parser_test_SOURCES) DIST_SOURCES = $(am__libaacs_la_SOURCES_DIST) \ - $(EXTRA_libaacs_la_SOURCES) + $(EXTRA_libaacs_la_SOURCES) $(aacs_info_SOURCES) \ + $(parser_test_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(pkgconfig_DATA) HEADERS = $(pkginclude_HEADERS) ETAGS = etags @@ -172,6 +215,9 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ +GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ +GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -277,16 +323,17 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SET_INCLUDES = -I$(top_srcdir) -Ifile -Ilibaacs -AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS) +AM_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) $(LIBGCRYPT_CFLAGS) $(GPG_ERROR_CFLAGS) AM_YFLAGS = -d -p libaacs_yy lib_LTLIBRARIES = libaacs.la libaacs_la_SOURCES = libaacs/aacs.h libaacs/mmc.h libaacs/mkb.h \ libaacs/aacs.c libaacs/mmc.c libaacs/crypto.c libaacs/crypto.h \ - libaacs/mkb.c file/file.h file/filesystem.h file/file_posix.c \ - file/keydbcfg.c file/keydbcfg.h file/keydbcfg-parser.y \ - file/keydbcfg-lexer.l util/attributes.h util/macro.h \ - util/logging.c util/logging.h util/strutl.c util/strutl.h \ - $(am__append_1) $(am__append_2) $(am__append_3) + libaacs/mkb.c file/dirs.h file/file.h file/filesystem.h \ + file/file_posix.c file/keydbcfg.c file/keydbcfg.h file/keydb.h \ + file/keydbcfg-parser.y file/keydbcfg-lexer.l file/path.h \ + util/attributes.h util/macro.h util/logging.c util/logging.h \ + util/strutl.c util/strutl.h $(am__append_1) $(am__append_2) \ + $(am__append_3) EXTRA_libaacs_la_SOURCES = \ libaacs/ec.c @@ -296,11 +343,21 @@ libaacs/aacs-version.h libaacs_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION_INFO) -libaacs_la_LIBADD = $(LIBGCRYPT_LIBS) +libaacs_la_LIBADD = $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libaacs.pc BUILT_SOURCES = keydbcfg-parser.h keydbcfg-parser.c keydbcfg-lexer.c CLEANFILES = $(BUILT_SOURCES) +parser_test_SOURCES = examples/parser_test.c \ + file/keydbcfg-parser.y \ + file/keydbcfg-lexer.l \ + util/strutl.c \ + util/logging.c + +parser_test_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) +aacs_info_SOURCES = examples/aacs_info.c +aacs_info_CFLAGS = -std=c99 $(SET_FEATURES) $(SET_INCLUDES) +aacs_info_LDADD = libaacs.la all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -340,7 +397,6 @@ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -348,6 +404,8 @@
View file
libaacs-0.6.0.tar.bz2/src/examples/aacs_info.c -> libaacs-0.7.0.tar.bz2/src/examples/aacs_info.c
Changed
@@ -17,8 +17,8 @@ * <http://www.gnu.org/licenses/>. */ -#include "../libaacs/aacs.h" -#include "../util/macro.h" /* MKINT_BE48 */ +#include "libaacs/aacs.h" +#include "util/macro.h" /* MKINT_BE48 */ #include <stdio.h> #include <stdlib.h> @@ -110,9 +110,17 @@ const uint8_t *vid = aacs_get_vid(aacs); const uint8_t *id = aacs_get_disc_id(aacs); + const uint8_t *pmsn = aacs_get_pmsn(aacs); + const int bec = aacs_get_bus_encryption(aacs); + const uint8_t *binding_id = aacs_get_device_binding_id(aacs); printf("Disc ID: %s\n", id ? _hex2str(id, 20) : "???"); printf("VID : %s\n", vid ? _hex2str(vid, 16) : "???"); printf("MKBv : %d\n", aacs_get_mkb_version(aacs)); + printf("PMSN : %s\n", pmsn ? _hex2str(pmsn, 16) : "???"); + printf("Bus encryption:\n"); + printf(" Device support: %s\n", (bec & AACS_BUS_ENCRYPTION_CAPABLE) ? "yes" : "no"); + printf(" Enabled in media: %s\n", (bec & AACS_BUS_ENCRYPTION_ENABLED) ? "yes" : "no"); + printf("Device binding ID: %s\n", binding_id ? _hex2str(binding_id, 16) : "???"); aacs_close(aacs); @@ -123,11 +131,11 @@ rl = aacs_get_hrl(&num_entries, &mkb_version); _dump_rl("Host", rl, num_entries, mkb_version); - X_FREE(rl); + aacs_free_rl(&rl); rl = aacs_get_drl(&num_entries, &mkb_version); _dump_rl("Drive", rl, num_entries, mkb_version); - X_FREE(rl); + aacs_free_rl(&rl); return EXIT_SUCCESS; }
View file
libaacs-0.6.0.tar.bz2/src/examples/parser_test.c -> libaacs-0.7.0.tar.bz2/src/examples/parser_test.c
Changed
@@ -18,6 +18,7 @@ */ #include "file/keydbcfg.h" +#include "util/logging.h" #include <stdio.h> #include <stdlib.h> @@ -51,6 +52,8 @@ /* Function that prints all entries parsed from a config file */ static int print_title_entries(title_entry_list *list) { + char tmp256; + if (!list) { printf("Error: No title list passed as parameter.\n"); @@ -63,7 +66,7 @@ if (!cursor->entry.discid) break; - printf("DISCID: %s\n", cursor->entry.discid); + printf("DISCID: %s\n", print_hex(tmp, cursor->entry.discid, 20)); printf(" Title: %s\n", cursor->entry.title); printf(" Date: %u-%u-%u\n", cursor->entry.date.year, cursor->entry.date.month, cursor->entry.date.day); @@ -103,23 +106,14 @@ /* Function to print certificate list from config file */ static int print_cert_list(cert_list *list) { - if (!list) - { - printf("Error: no certificate list object passed in as parameter\n"); - return 0; - } + char tmp256; printf("Available certificates:\n"); cert_list *cursor = list; while (cursor) { - if (!cursor->host_priv_key) - break; - - printf(" Host private key: %s\n", cursor->host_priv_key); - printf(" Host certificate: %s\n", cursor->host_cert); - printf(" Host nonce: %s\n", cursor->host_nonce); - printf(" Host key point: %s\n", cursor->host_key_point); + printf(" Host private key: %s\n", print_hex(tmp, cursor->host_priv_key, 20)); + printf(" Host certificate: %s\n", print_hex(tmp, cursor->host_cert, 92)); printf("\n"); cursor = cursor->next; @@ -133,14 +127,13 @@ /* Function to print config file */ static int print_config_file(config_file *cfgfile) { + char tmp256; + printf("Available device keys:\n"); dk_list *dkcursor = cfgfile->dkl; while (dkcursor) { - if (!dkcursor->key) - break; - - printf(" Device key: %s\n", dkcursor->key); + printf(" Device key: %s\n", print_hex(tmp, dkcursor->key, 16)); printf(" Device node: %lu\n", dkcursor->node); dkcursor = dkcursor->next; @@ -153,10 +146,7 @@ pk_list *cursor = cfgfile->pkl; while (cursor) { - if (!cursor->key) - break; - - printf(" %s\n", cursor->key); + printf(" %s\n", print_hex(tmp, cursor->key, 16)); cursor = cursor->next; }
View file
libaacs-0.7.0.tar.bz2/src/file/dirs.h
Added
@@ -0,0 +1,38 @@ +/* + * This file is part of libbluray + * Copyright (C) 2011-2013 VideoLAN + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifndef BLURAY_DIRS_H +#define BLURAY_DIRS_H + +#include <util/attributes.h> + +#ifdef _WIN32 +AACS_PRIVATE int win32_mkdir(const char *dir); +#endif + +/* + * Config, cache and data dirs + */ + +AACS_PRIVATE const char *file_get_config_home(void); +AACS_PRIVATE const char *file_get_config_system(const char *dir); +AACS_PRIVATE const char *file_get_cache_home(void); +AACS_PRIVATE const char *file_get_data_home(void); + +#endif
View file
libaacs-0.7.0.tar.bz2/src/file/dirs_darwin.c
Added
@@ -0,0 +1,119 @@ +/* + * This file is part of libbluray + * Copyright (C) 2012 Konstantin Pavlov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dirs.h" + +#include <CoreFoundation/CoreFoundation.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "util/strutl.h" +#include "util/logging.h" + +#define USER_CFG_DIR "Library/Preferences" +#define USER_CACHE_DIR "Library/Caches" +#define USER_DATA_DIR "Library" +#define SYSTEM_CFG_DIR "/Library/Preferences" + + +const char *file_get_config_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_CFG_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_data_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_DATA_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_cache_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_config_system(const char *dir) +{ + static char *dirs = NULL; // "dir1\0dir2\0...\0dirN\0\0" + + if (!dirs) { + dirs = str_printf("%s%c%c", SYSTEM_CFG_DIR, 0, 0); + } + + if (!dir) { + // first call + dir = dirs; + } else { + // next call + dir += strlen(dir) + 1; + if (!*dir) { + // end of list + dir = NULL; + } + } + + return dir; +}
View file
libaacs-0.7.0.tar.bz2/src/file/dirs_win32.c
Added
@@ -0,0 +1,104 @@ +/* + * This file is part of libbluray + * Copyright (C) 2011 VideoLAN + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dirs.h" + +#include "util/logging.h" + +#include <stdio.h> +#include <string.h> + +#include <shlobj.h> +#include <windows.h> +#include <limits.h> +#include <direct.h> + + +int win32_mkdir(const char *dir) +{ + wchar_t wdirMAX_PATH; + + MultiByteToWideChar(CP_UTF8, 0, dir, -1, wdir, MAX_PATH); + return _wmkdir(wdir); +} + +const char *file_get_config_home(void) +{ + return file_get_data_home(); +} + +const char *file_get_data_home(void) +{ + static char *appdir = NULL; + wchar_t wdirMAX_PATH; + + if (appdir) + return appdir; + + /* Get the "Application Data" folder for the user */ + if (S_OK == SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, + NULL, SHGFP_TYPE_CURRENT, wdir)) { + int len = WideCharToMultiByte (CP_UTF8, 0, wdir, -1, NULL, 0, NULL, NULL); + appdir = malloc(len); + WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, len, NULL, NULL); + return appdir; + } + + DEBUG(DBG_FILE, "Can't find user configuration directory !\n"); + return NULL; +} + +const char *file_get_cache_home(void) +{ + return file_get_data_home(); +} + +const char *file_get_config_system(const char *dir) +{ + static char *appdir = NULL; + wchar_t wdirMAX_PATH; + + if (!dir) { + // first call + + if (appdir) + return appdir; + + /* Get the "Application Data" folder for all users */ + if (S_OK == SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, + NULL, SHGFP_TYPE_CURRENT, wdir)) { + int len = WideCharToMultiByte (CP_UTF8, 0, wdir, -1, NULL, 0, NULL, NULL); + appdir = malloc(len); + WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, len, NULL, NULL); + return appdir; + } else { + DEBUG(DBG_FILE, "Can't find common configuration directory !\n"); + return NULL; + } + } else { + // next call + return NULL; + } + + return dir; +}
View file
libaacs-0.7.0.tar.bz2/src/file/dirs_xdg.c
Added
@@ -0,0 +1,151 @@ +/* + * This file is part of libbluray + * Copyright (C) 2013 Petri Hintukainen <phintuka@users.sourceforge.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dirs.h" + +#include "util/strutl.h" +#include "util/logging.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* + * Based on XDG Base Directory Specification + * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html + */ + +#define USER_CFG_DIR ".config" +#define USER_CACHE_DIR ".cache" +#define USER_DATA_DIR ".local/share" +#define SYSTEM_CFG_DIR "/etc/xdg" + + +const char *file_get_config_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *xdg_home = getenv("XDG_CONFIG_HOME"); + if (xdg_home && *xdg_home) { + return dir = str_printf("%s", xdg_home); + } + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_CFG_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_data_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *xdg_home = getenv("XDG_DATA_HOME"); + if (xdg_home && *xdg_home) { + return dir = str_printf("%s", xdg_home); + } + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_DATA_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_cache_home(void) +{ + static char *dir = NULL; + static int init_done = 0; + + if (!init_done) { + init_done = 1; + + const char *xdg_cache = getenv("XDG_CACHE_HOME"); + if (xdg_cache && *xdg_cache) { + return dir = str_printf("%s", xdg_cache); + } + + const char *user_home = getenv("HOME"); + if (user_home && *user_home) { + return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR); + } + + DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n"); + } + + return dir; +} + +const char *file_get_config_system(const char *dir) +{ + static char *dirs = NULL; // "dir1\0dir2\0...\0dirN\0\0" + + if (!dirs) { + const char *xdg_sys = getenv("XDG_CONFIG_DIRS"); + + if (xdg_sys && *xdg_sys) { + + dirs = calloc(1, strlen(xdg_sys) + 2); + strcpy(dirs, xdg_sys); + + char *pt = dirs; + while (NULL != (pt = strchr(pt, ':'))) { + *pt++ = 0; + } + + } else { + dirs = str_printf("%s%c%c", SYSTEM_CFG_DIR, 0, 0); + } + } + + if (!dir) { + // first call + dir = dirs; + } else { + // next call + dir += strlen(dir) + 1; + if (!*dir) { + // end of list + dir = NULL; + } + } + + return dir; +}
View file
libaacs-0.7.0.tar.bz2/src/file/keydb.h
Added
@@ -0,0 +1,26 @@ + +/* encrypted keys */ + +static const uint32_t internal_device_number = 0; + +static const uint8_t internal_dk_list21 = { + { + }, +}; + +static const uint8_t internal_pk_list16 = { + { + }, +}; + +static const uint8_t internal_hc_list112 = { + { + }, +}; + +/* customize this function to "hide" the keys in the binary */ + +static void decrypt_key(uint8_t *out, const uint8_t *in, size_t size) +{ + memcpy(out, in, size); +}
View file
libaacs-0.6.0.tar.bz2/src/file/keydbcfg-lexer.l -> libaacs-0.7.0.tar.bz2/src/file/keydbcfg-lexer.l
Changed
@@ -59,6 +59,8 @@ KEYWORD_DEVICE_KEY (DdEeVvIiCcEe_KkEeYy) KEYWORD_DEVICE_NODE (DdEeVvIiCcEe_NnOoDdEe) +KEYWORD_KEY_UV (KkEeYy_UuVv) +KEYWORD_KEY_U_MASK_SHIFT (KkEeYy_Uu_MmAaSsKk_SsHhIiFfTt) KEYWORD_HOST_PRIV_KEY (HhOoSsTt_PpRrIiVv_KkEeYy \t+) KEYWORD_HOST_CERT (HhOoSsTt_CcEeRrTt \t+) KEYWORD_HOST_NONCE (HhOoSsTt_NnOoNnCcEe \t+) @@ -112,6 +114,8 @@ {KEYWORD_DEVICE_KEY} { return KEYWORD_DEVICE_KEY; } {KEYWORD_DEVICE_NODE} { return KEYWORD_DEVICE_NODE; } +{KEYWORD_KEY_UV} { return KEYWORD_KEY_UV; } +{KEYWORD_KEY_U_MASK_SHIFT} { return KEYWORD_KEY_U_MASK_SHIFT; } {KEYWORD_HOST_PRIV_KEY} { return KEYWORD_HOST_PRIV_KEY; } {KEYWORD_HOST_CERT} { return KEYWORD_HOST_CERT; } {KEYWORD_HOST_NONCE} { return KEYWORD_HOST_NONCE; }
View file
libaacs-0.6.0.tar.bz2/src/file/keydbcfg-parser.y -> libaacs-0.7.0.tar.bz2/src/file/keydbcfg-parser.y
Changed
@@ -66,13 +66,13 @@ }; static dk_list *new_dk_list(void); -static dk_list *add_dk_list_entry(dk_list *list, char *key, char *node); static pk_list *new_pk_list(void); -static pk_list *add_pk_list_entry(pk_list *list, char *key); static cert_list *new_cert_list(void); -static cert_list *add_cert_list(cert_list *list, char *host_priv_key, - char *host_cert, char *host_nonce, - char *host_key_point); + +static void add_dk_entry(config_file *cf, char *key, char *node, char *uv, char *u_mask_shift); +static void add_pk_entry(config_file *cf, char *key); +static void add_cert_entry(config_file *cf, char *host_priv_key, char *host_cert); + static title_entry_list *new_title_entry_list(void); static int add_entry(title_entry_list *list, int type, char *entry); static digit_key_pair_list *new_digit_key_pair_list(void); @@ -80,7 +80,7 @@ int type, unsigned int digit, char *key); static int add_date_entry(title_entry_list *list, unsigned int year, unsigned int month, unsigned int day); -void yyerror (void *scanner, dk_list *dklist, pk_list *pklist, cert_list *clist, +void yyerror (void *scanner, config_file *cf, title_entry_list *celist, digit_key_pair_list *dkplist, const char *msg); extern int libaacs_yyget_lineno (void *scanner); @@ -98,9 +98,7 @@ %yacc %lex-param{void *scanner} %parse-param{void *scanner} -%parse-param{dk_list *dklist} -%parse-param{pk_list *pklist} -%parse-param{cert_list *clist} +%parse-param{config_file *cf} %parse-param{title_entry_list *celist} %parse-param{digit_key_pair_list *dkplist} @@ -116,6 +114,8 @@ %token KEYWORD_DEVICE_KEY %token KEYWORD_DEVICE_NODE +%token KEYWORD_KEY_UV +%token KEYWORD_KEY_U_MASK_SHIFT %token KEYWORD_HOST_PRIV_KEY %token KEYWORD_HOST_CERT %token KEYWORD_HOST_NONCE @@ -142,7 +142,7 @@ %type <string> discid disc_title %type <string> host_priv_key host_cert host_nonce host_key_point hexstring_list -%type <string> device_key device_node +%type <string> device_key device_node key_uv key_u_mask_shift %% config_file : config_entry_list newline_list @@ -170,13 +170,21 @@ ; dk_entry - : newline_list ENTRY_ID_DK device_key PUNCT_VERTICAL_BAR device_node NEWLINE + : newline_list ENTRY_ID_DK device_key PUNCT_VERTICAL_BAR device_node PUNCT_VERTICAL_BAR key_uv PUNCT_VERTICAL_BAR key_u_mask_shift NEWLINE + { + add_dk_entry(cf, $3, $5, $7, $9); + } + | newline_list ENTRY_ID_DK device_key PUNCT_VERTICAL_BAR device_node NEWLINE + { + add_dk_entry(cf, $3, $5, NULL, NULL); + } + | ENTRY_ID_DK device_key PUNCT_VERTICAL_BAR device_node PUNCT_VERTICAL_BAR key_uv PUNCT_VERTICAL_BAR key_u_mask_shift NEWLINE { - dklist = add_dk_list_entry(dklist, $3, $5); + add_dk_entry(cf, $2, $4, $6, $8); } | ENTRY_ID_DK device_key PUNCT_VERTICAL_BAR device_node NEWLINE { - dklist = add_dk_list_entry(dklist, $2, $4); + add_dk_entry(cf, $2, $4, NULL, NULL); } ; @@ -190,25 +198,49 @@ { $$ = $2; } ; +key_uv + : KEYWORD_KEY_UV hexstring_list + { $$ = $2; } + ; + +key_u_mask_shift + : KEYWORD_KEY_U_MASK_SHIFT hexstring_list + { $$ = $2; } + ; + pk_entry : newline_list ENTRY_ID_PK hexstring_list NEWLINE { - pklist = add_pk_list_entry(pklist, $3); + add_pk_entry(cf, $3); } | ENTRY_ID_PK hexstring_list NEWLINE { - pklist = add_pk_list_entry(pklist, $2); + add_pk_entry(cf, $2); } ; host_cert_entry : newline_list ENTRY_ID_HC host_priv_key PUNCT_VERTICAL_BAR host_cert PUNCT_VERTICAL_BAR host_nonce PUNCT_VERTICAL_BAR host_key_point NEWLINE { - clist = add_cert_list(clist, $3, $5, $7, $9); + /* host_nonce and host_key_point are ignored, keep this for backward compatibility */ + X_FREE($7); + X_FREE($9); + add_cert_entry(cf, $3, $5); } | ENTRY_ID_HC host_priv_key PUNCT_VERTICAL_BAR host_cert PUNCT_VERTICAL_BAR host_nonce PUNCT_VERTICAL_BAR host_key_point NEWLINE { - clist = add_cert_list(clist, $2, $4, $6, $8); + /* host_nonce and host_key_point are ignored, keep this for backward compatibility */ + X_FREE($6); + X_FREE($8); + add_cert_entry(cf, $2, $4); + } + | newline_list ENTRY_ID_HC host_priv_key PUNCT_VERTICAL_BAR host_cert NEWLINE + { + add_cert_entry(cf, $3, $5); + } + | ENTRY_ID_HC host_priv_key PUNCT_VERTICAL_BAR host_cert NEWLINE + { + add_cert_entry(cf, $2, $4); } ; @@ -234,15 +266,7 @@ title_entry : newline_list disc_info entry_list NEWLINE - { - celist->next = new_title_entry_list(); - celist = celist->next; - } | disc_info entry_list NEWLINE - { - celist->next = new_title_entry_list(); - celist = celist->next; - } ; newline_list @@ -253,6 +277,12 @@ disc_info : discid PUNCT_EQUALS_SIGN disc_title { + if (!cf->list) { + celist = cf->list = new_title_entry_list(); + } else { + celist->next = new_title_entry_list(); + celist = celist->next; + } add_entry(celist, ENTRY_TYPE_DISCID, $1); add_entry(celist, ENTRY_TYPE_TITLE, $3); } @@ -433,24 +463,12 @@ if (!fp) return 0; - dk_list *head_dklist = new_dk_list(); - pk_list *head_pklist = new_pk_list(); - cert_list *head_clist = new_cert_list(); - title_entry_list *head_celist = new_title_entry_list(); - digit_key_pair_list *dkplist = NULL; - void *scanner; libaacs_yylex_init(&scanner); libaacs_yyset_in(fp, scanner); - int retval = yyparse(scanner, head_dklist, head_pklist, head_clist, - head_celist, dkplist); + int retval = yyparse(scanner, cfgfile, NULL, NULL); libaacs_yylex_destroy(scanner); - cfgfile->dkl = head_dklist; - cfgfile->pkl = head_pklist; - cfgfile->host_cert_list = head_clist; - cfgfile->list = head_celist; - fclose(fp); if (retval) @@ -470,11 +488,14 @@ /* Function that closes and frees a config file object */ int keydbcfg_config_file_close(config_file *cfgfile) { + if (!cfgfile) { + return 0; + } + /* free pk list */
View file
libaacs-0.6.0.tar.bz2/src/file/keydbcfg.c -> libaacs-0.7.0.tar.bz2/src/file/keydbcfg.c
Changed
@@ -1,6 +1,6 @@ /* * This file is part of libaacs - * Copyright (C) 2010 npzacs + * Copyright (C) 2010-2013 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,22 +19,7 @@ #include "keydbcfg.h" -#if defined(__APPLE__) -# include "darwin.h" -# define get_config_home darwin_get_config_home -# define get_cache_home darwin_get_cache_home -# define get_config_system darwin_get_config_system -#elif defined(_WIN32) -# include "win32.h" -# define get_config_home win32_get_config_home -# define get_cache_home win32_get_config_home -# define get_config_system win32_get_config_system -#else -# include "xdg.h" -# define get_config_home xdg_get_config_home -# define get_cache_home xdg_get_cache_home -# define get_config_system xdg_get_config_system -#endif +#include "dirs.h" #include "util/strutl.h" #include "util/logging.h" @@ -60,6 +45,36 @@ #define MIN_FILE_SIZE 20 #define MAX_FILE_SIZE 65535 +static int _mkpath(const char *path) +{ + struct stat s; + int result = 1; + char *dir = str_printf("%s", path); + char *end = dir; + + while (*end == '/') + end++; + + while ((end = strchr(end, '/'))) { + *end = 0; + + if (stat(dir, &s) != 0 || !S_ISDIR(s.st_mode)) { + DEBUG(DBG_FILE, "Creating directory %s\n", dir); + + if (mkdir(dir, S_IRWXU|S_IRWXG|S_IRWXO) == -1) { + DEBUG(DBG_FILE | DBG_CRIT, "Error creating directory %s\n", dir); + result = 0; + break; + } + } + + *end++ = '/'; + } + + X_FREE(dir); + + return result; +} static char *_load_file(FILE *fp) { @@ -89,18 +104,35 @@ return data; } -static FILE *_open_cfg_file_user(const char *file_name, char **path) +static char *_config_file_user(const char *file_name) { - const char *cfg_dir = get_config_home(); + const char *cfg_dir = file_get_config_home(); if (!cfg_dir) { return NULL; } - char *cfg_file = str_printf("%s/%s/%s", cfg_dir, CFG_DIR, file_name); - FILE *fp = fopen(cfg_file, "r"); + return str_printf("%s/%s/%s", cfg_dir, CFG_DIR, file_name); +} + +static FILE *_open_cfg_file_user(const char *file_name, char **path, const char *mode) +{ + char *cfg_file = _config_file_user(file_name); + + if (!cfg_file) { + return NULL; + } + + if (*mode == 'w') { + if (!_mkpath(cfg_file)) { + X_FREE(cfg_file); + return NULL; + } + } - DEBUG(DBG_FILE, fp ? "Reading %s\n" : "%s not found\n", cfg_file); + FILE *fp = fopen(cfg_file, mode); + + DEBUG(DBG_FILE, fp ? "Opened %s for %s\n" : "%s not found\n", cfg_file, mode); if (fp && path) { *path = cfg_file; @@ -115,7 +147,7 @@ { const char *dir = NULL; - while (NULL != (dir = get_config_system(dir))) { + while (NULL != (dir = file_get_config_system(dir))) { char *cfg_file = str_printf("%s/%s/%s", dir, CFG_DIR, file_name); @@ -139,13 +171,11 @@ return NULL; } -static int _is_duplicate_pk(pk_list *list, const char *e) +static int _is_duplicate_pk(pk_list *list, const uint8_t *e) { while (list) { - if (list->key) { - if (!memcmp(list->key, e, 2*16)) { - return 1; - } + if (!memcmp(list->key, e, 16)) { + return 1; } list = list->next; } @@ -164,22 +194,24 @@ while (*p) { char *str = str_get_hex_string(p, 2*16); - if (str && _is_duplicate_pk(cf->pkl, str)) { - DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str); - X_FREE(str); - - } else if (str) { + if (str) { DEBUG(DBG_FILE, "Found processing key %s\n", str); pk_list *e = calloc(1, sizeof(pk_list)); - e->key = str; - e->next = cf->pkl; + hexstring_to_hex_array(e->key, 16, str); - cf->pkl = e; + if (_is_duplicate_pk(cf->pkl, e->key)) { + DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str); + X_FREE(e); + } else { + e->next = cf->pkl; + cf->pkl = e; + } result++; } + X_FREE(str); p = str_next_line(p); } @@ -193,13 +225,10 @@ static int _is_duplicate_cert(cert_list *list, cert_list *e) { while (list) { - if (list->host_priv_key && list->host_cert) { + if (!memcmp(list->host_priv_key, e->host_priv_key, 20) && + !memcmp(list->host_cert, e->host_cert, 92)) { - if (!memcmp(list->host_priv_key, e->host_priv_key, 2*20) && - !memcmp(list->host_cert, e->host_cert, 2*92)) { - - return 1; - } + return 1; } list = list->next; } @@ -207,13 +236,6 @@ return 0; } -static void _free_cert_entry(cert_list *e) -{ - X_FREE(e->host_priv_key); - X_FREE(e->host_cert); - X_FREE(e); -} - static int _parse_cert_file(config_file *cf, FILE *fp) { char *data = _load_file(fp);
View file
libaacs-0.6.0.tar.bz2/src/file/keydbcfg.h -> libaacs-0.7.0.tar.bz2/src/file/keydbcfg.h
Changed
@@ -53,16 +53,20 @@ typedef struct dk_entry dk_list; struct dk_entry { - char *key; + uint8_t key16; unsigned long node; dk_list *next; + + /* optional, can be calculated */ + uint32_t uv; + uint8_t u_mask_shift; }; /* pk entry */ typedef struct pk_entry pk_list; struct pk_entry { - char *key; + uint8_t key16; pk_list *next; }; @@ -70,10 +74,8 @@ typedef struct cert_entry cert_list; struct cert_entry { - char *host_priv_key; - char *host_cert; - char *host_nonce; - char *host_key_point; + uint8_t host_priv_key20; + uint8_t host_cert92; cert_list *next; }; @@ -81,7 +83,7 @@ typedef struct title_entry_t title_entry; struct title_entry_t { - char *discid; + uint8_t discid20; char *title; date_entry date; char *mek; @@ -131,4 +133,7 @@ AACS_PRIVATE void *cache_get_or_update(const char *type, const void *data, uint32_t *len, uint32_t version); +AACS_PRIVATE int config_get(const char *name, uint32_t *len, void *buf); /* use buf=NULL to get size */ +AACS_PRIVATE int config_save(const char *name, const void *data, uint32_t len); + #endif
View file
libaacs-0.7.0.tar.bz2/src/file/path.c
Added
@@ -0,0 +1,142 @@ +/* + * This file is part of libaacs + * Copyright (C) 2013 VideoLAN + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#include "path.h" + +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#define MAX_LINKS 32 + +char *aacs_resolve_path(const char *path, char *resolved_path) +{ + char tmp_pathAACS_PATH_MAX; + char linkAACS_PATH_MAX; + char *new_path = resolved_path; + char *path_end = tmp_path + AACS_PATH_MAX - 1; + int readlinks = 0; + int n; + + if (!path || !*path || strlen(path) >= AACS_PATH_MAX - 2) { + return NULL; + } + + /* shadow original path with a copy */ + strcpy(tmp_path, path); + path = tmp_path; + + /* handle relative path */ + if (*path != '/') { + if (!getcwd(new_path, AACS_PATH_MAX - 1)) { + return NULL; + } + new_path += strlen(new_path); + if (new_path-1 != '/') { + *new_path++ = '/'; + } + } else { + *new_path++ = '/'; + path++; + } + + + while (*path) { + /* "/" */ + if (*path == '/') { + path++; + continue; + } + /* "." */ + if (path0 == '.' && (!path1 || path1 == '/')) { + path++; + continue; + } + /* ".." */ + if (path0 == '.' && path1 == '.' && (!path2 || path2 == '/')) { + path += 2; + /* not at root ? -> back up one level */ + if (new_path != resolved_path + 1) { + while ((--new_path)-1 != '/'); + } + continue; + } + + /* copy next component */ + while (*path && *path != '/') { + if (path >= path_end) { + return NULL; + } + *new_path++ = *path++; + } + + /* avoid symlink loops */ + if (readlinks++ > MAX_LINKS) { + return NULL; + } + + /* resolve symlink */ + + *new_path = 0; + n = readlink(resolved_path, link, AACS_PATH_MAX - 1); + + if (n < 0) { + if (errno != EINVAL) { + return NULL; + } + /* file exists but isn't a symlink. */ + + } else if (n >= AACS_PATH_MAX - 1) { + return NULL; + + } else { + linkn = 0; + if (*link == '/') { + new_path = resolved_path; + } else { + while (*(--new_path) != '/'); + } + + if (path + n >= path_end) { + return NULL; + } + + /* update what's left */ + strcat(link, path); + strcpy(tmp_path, link); + path = tmp_path; + } + + if (*path) { + *new_path++ = '/'; + } + } + + *new_path = 0; + return resolved_path; +} + +#ifdef TEST_AACS_RESOLVE_PATH +#include <stdio.h> +void main(int argc, char *argv) { + char pathAACS_PATH_MAX; + printf("%s -> %s\n", argv0, aacs_resolve_path(argv0, path)); + printf("%s -> %s\n", argv1, aacs_resolve_path(argv1, path)); +} +#endif
View file
libaacs-0.7.0.tar.bz2/src/file/path.h
Added
@@ -0,0 +1,31 @@ +/* + * This file is part of libaacs + * Copyright (C) 2013 VideoLAN + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifndef AACS_PATH_H +#define AACS_PATH_H + +#include <util/attributes.h> + +#ifndef AACS_PATH_MAX +#define AACS_PATH_MAX 1024 +#endif + +AACS_PRIVATE char *aacs_resolve_path(const char *path, char *resolved_path); + +#endif /* AACS_PATH_H */
View file
libaacs-0.6.0.tar.bz2/src/libaacs/aacs-version.h -> libaacs-0.7.0.tar.bz2/src/libaacs/aacs-version.h
Changed
@@ -26,10 +26,10 @@ ((micro) * 1)) #define AACS_VERSION_MAJOR 0 -#define AACS_VERSION_MINOR 6 +#define AACS_VERSION_MINOR 7 #define AACS_VERSION_MICRO 0 -#define AACS_VERSION_STRING "0.6.0" +#define AACS_VERSION_STRING "0.7.0" #define AACS_VERSION \ AACS_VERSION_CODE(AACS_VERSION_MAJOR, AACS_VERSION_MINOR, AACS_VERSION_MICRO)
View file
libaacs-0.6.0.tar.bz2/src/libaacs/aacs.c -> libaacs-0.7.0.tar.bz2/src/libaacs/aacs.c
Changed
@@ -1,7 +1,7 @@ /* * This file is part of libaacs * Copyright (C) 2009-2010 Obliter0n - * Copyright (C) 2009-2010 npzacs + * Copyright (C) 2009-2013 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -54,6 +54,8 @@ uint8_t vid16; /* PMSN is cached for BD-J */ uint8_t pmsn16; + /* Media key is cached for BD+ */ + uint8_t mk16; /* unit key for each CPS unit */ uint32_t num_uks; @@ -65,10 +67,21 @@ /* title -> CPS unit mappings */ uint32_t num_titles; uint16_t *cps_units; /* 0 = first play ; 1 = top menu ; 2 = title 1 ... */ + + /* bus encryption */ + int bee; /* bus encryption enabled flag in content certificate */ + int bec; /* bus encryption capable flag in drive certificate */ + uint8_t read_data_key16; + + /* AACS Online (BD-J) */ + uint8_t device_nonce16; + uint8_t device_binding_id16; }; static const uint8_t empty_key = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00"; +static const uint8_t aacs_iv = "\x0b\xa0\xf8\xdd\xfe\xa6\x1f\xb3" + "\xd8\xdf\x9f\x56\x6a\x05\x0f\x78"; static int _validate_pk(const uint8_t *pk, const uint8_t *cvalue, const uint8_t *uv, const uint8_t *vd, @@ -118,38 +131,245 @@ return crypto_aacs_verify_aacsla(rl + len, rl, len); } -static void _update_drl(MKB *mkb) +static void _save_rl(const char *name, uint32_t version, const uint8_t *version_rec, + const uint8_t *rl_rec, size_t rl_len) +{ + int len = MKINT_BE24(rl_rec - 3); + int entries = MKINT_BE32(rl_rec + 4); /* entries in first signature block */ + if (len < 4 || !entries) { + DEBUG(DBG_AACS | DBG_CRIT, "ignoring empty %s\n", name); + return; + } + + if (rl_rec && version_rec) { + rl_rec -= 4; + rl_len += 4; + + uint8_t *data = malloc(12 + rl_len); + memcpy(data, version_rec, 12); + memcpy(data + 12, rl_rec, rl_len); + if (!_rl_verify_signature(data, rl_len + 12)) { + DEBUG(DBG_AACS | DBG_CRIT, "invalid %s signature, not using it\n", name); + } else { + cache_save(name, version, data, rl_len + 12); + } + X_FREE(data); + } +} + +static void _update_rl(MKB *mkb) { uint32_t version = mkb_version(mkb); uint32_t cache_version; + size_t rl_len; if (!cache_get("drl", &cache_version, NULL, NULL) || cache_version < version) { - size_t drl_len; - const uint8_t *drl_rec = mkb_drive_revokation_entries(mkb, &drl_len); - const uint8_t *v_rec = mkb_type_and_version_record(mkb); - - if (drl_rec && v_rec) { - drl_rec -= 4; - drl_len += 4; - - uint8_t *data = malloc(12 + drl_len); - memcpy(data, v_rec, 12); - memcpy(data + 12, drl_rec, drl_len); - if (!_rl_verify_signature(data, drl_len + 12)) { - DEBUG(DBG_AACS | DBG_CRIT, "invalid drive revocation list signature, not using it\n"); + const uint8_t *version_rec = mkb_type_and_version_record(mkb); + const uint8_t *drl_rec = mkb_drive_revokation_entries(mkb, &rl_len); + if (drl_rec && rl_len > 8) { + _save_rl("drl", version, version_rec, drl_rec, rl_len); + } + } + if (!cache_get("hrl", &cache_version, NULL, NULL) || cache_version < version) { + const uint8_t *version_rec = mkb_type_and_version_record(mkb); + const uint8_t *hrl_rec = mkb_host_revokation_entries(mkb, &rl_len); + if (hrl_rec && rl_len > 8) { + _save_rl("hrl", version, version_rec, hrl_rec, rl_len); + } + } +} + +static uint32_t _calc_v_mask(uint32_t uv) +{ + uint32_t v_mask = 0xffffffff; + + while (!(uv & ~v_mask)) { + v_mask <<= 1; + } + + return v_mask; +} + +static void _calc_pk(const uint8_t *dk, uint8_t *pk, uint32_t uv, uint32_t v_mask, uint32_t dev_key_v_mask) +{ + unsigned char left_child16, right_child16; + + crypto_aesg3(dk, left_child, right_child, pk); + + while (dev_key_v_mask != v_mask) { + + int i; + for (i = 31; i >= 0; i--) { + if (!(dev_key_v_mask & (1ul << i))) { + break; + } + } + + uint8_t curr_key16; + if (!(uv & (1ul << i))) { + memcpy(curr_key, left_child, 16); + } else { + memcpy(curr_key, right_child, 16); + } + + crypto_aesg3(curr_key, left_child, right_child, pk); + + dev_key_v_mask = ((int) dev_key_v_mask) >> 1; + } + + char str40; + DEBUG(DBG_AACS, "Processing key: %s\n", print_hex(str, pk, 16)); +} + +static dk_list *_find_dk(dk_list *dkl, uint32_t *p_dev_key_v_mask, uint32_t uv, uint32_t u_mask) +{ + uint32_t device_number = dkl->node; + uint32_t dev_key_uv, dev_key_u_mask, dev_key_v_mask; + unsigned key_idx = 0; + + for (; dkl; dkl = dkl->next) { + if (device_number != dkl->node) { + /* wrong device */ + continue; + } + if (!dkl->uv) { + continue; + } + key_idx++; + dev_key_uv = dkl->uv; + dev_key_u_mask = 0xffffffff << dkl->u_mask_shift; + dev_key_v_mask = _calc_v_mask(dev_key_uv); + + if ((u_mask == dev_key_u_mask) && + ((uv & dev_key_v_mask) == (dev_key_uv & dev_key_v_mask))) { + break; + } + } + + if (!dkl) { + DEBUG(DBG_AACS | DBG_CRIT, "could not find applying device key (device 0x%x)\n", device_number); + } else { + char str128; + DEBUG(DBG_AACS, "Applying device key is #%d %s\n", key_idx, print_hex(str, dkl->key, 16)); + DEBUG(DBG_AACS, " UV: 0x%08x U mask: 0x%08x V mask: 0x%08x\n", dev_key_uv, dev_key_u_mask, dev_key_v_mask); + *p_dev_key_v_mask = dev_key_v_mask; + } + + return dkl; +} + +static int _calc_pk_mk(MKB *mkb, dk_list *dkl, uint8_t *mk) +{ + /* calculate processing key and media key using device keys */ + + const uint8_t *uvs, *cvalues; + unsigned num_uvs; + size_t len; + char str128; + + /* get mkb data */ + + uvs = mkb_subdiff_records(mkb, &len); + cvalues = mkb_cvalues(mkb, &len); + num_uvs = len / 5; +
View file
libaacs-0.6.0.tar.bz2/src/libaacs/aacs.h -> libaacs-0.7.0.tar.bz2/src/libaacs/aacs.h
Changed
@@ -1,6 +1,7 @@ /* * This file is part of libaacs * Copyright (C) 2009-2010 Obliter0n + * Copyright (C) 2009-2013 npzacz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -35,6 +36,7 @@ #define AACS_ERROR_CERT_REVOKED -5 /* certificate has been revoked */ #define AACS_ERROR_MMC_OPEN -6 /* MMC open failed (no MMC drive ?) */ #define AACS_ERROR_MMC_FAILURE -7 /* MMC failed */ +#define AACS_ERROR_NO_DK -8 /* no matching device key */ typedef struct aacs AACS; @@ -51,6 +53,11 @@ AACS_PUBLIC const uint8_t *aacs_get_disc_id(AACS *aacs); AACS_PUBLIC const uint8_t *aacs_get_vid(AACS *aacs); /* may fail even if disc can be decrypted */ AACS_PUBLIC const uint8_t *aacs_get_pmsn(AACS *aacs); /* may fail even if disc can be decrypted */ +AACS_PUBLIC const uint8_t *aacs_get_mk(AACS *aacs); /* may fail even if disc can be decrypted */ + +/* AACS Online */ +AACS_PUBLIC const uint8_t *aacs_get_device_binding_id(AACS *aacs); +AACS_PUBLIC const uint8_t *aacs_get_device_nonce(AACS *aacs); /* revocation lists */ typedef struct { @@ -60,5 +67,13 @@ AACS_PUBLIC AACS_RL_ENTRY *aacs_get_hrl(int *num_entries, int *mkb_version); AACS_PUBLIC AACS_RL_ENTRY *aacs_get_drl(int *num_entries, int *mkb_version); +AACS_PUBLIC void aacs_free_rl(AACS_RL_ENTRY **rl); + +/* bus encryption info */ + +#define AACS_BUS_ENCRYPTION_ENABLED 0x01 /* Bus encryption enabled in the media */ +#define AACS_BUS_ENCRYPTION_CAPABLE 0x02 /* Bus encryption capable drive */ + +AACS_PUBLIC uint32_t aacs_get_bus_encryption(AACS *); #endif /* AACS_H_ */
View file
libaacs-0.6.0.tar.bz2/src/libaacs/crypto.c -> libaacs-0.7.0.tar.bz2/src/libaacs/crypto.c
Changed
@@ -1,7 +1,7 @@ /* * This file is part of libaacs * Copyright (C) 2009-2010 Obliter0n - * Copyright (C) 2010 npzacs + * Copyright (C) 2010-2013 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -103,15 +103,11 @@ static void _aesg3(const uint8_t *src_key, uint8_t *dst_key, uint8_t inc) { int a; - gcry_cipher_hd_t gcry_h; uint8_t seed16 = { 0x7B, 0x10, 0x3C, 0x5D, 0xCB, 0x08, 0xC4, 0xE5, 0x1A, 0x27, 0xB0, 0x17, 0x99, 0x05, 0x3B, 0xD9 }; seed15 += inc; - gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); - gcry_cipher_setkey(gcry_h, src_key, 16); - gcry_cipher_decrypt (gcry_h, dst_key, 16, seed, 16); - gcry_cipher_close(gcry_h); + crypto_aes128d(src_key, seed, dst_key); for (a = 0; a < 16; a++) { dst_keya ^= seeda; @@ -136,6 +132,16 @@ return crypto_init_check; } +void crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst) +{ + gcry_cipher_hd_t gcry_h; + + gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); + gcry_cipher_setkey(gcry_h, key, 16); + gcry_cipher_decrypt(gcry_h, dst, 16, data, 16); + gcry_cipher_close(gcry_h); +} + void crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, uint8_t *pk) { if (lsubk) { @@ -151,6 +157,67 @@ } } +/* + * AES CMAC + */ + +static void _shl_128(unsigned char *dst, const unsigned char *src) +{ + uint8_t overflow = 0; + int i; + + for (i = 15; i >= 0; i--) { + dsti = (srci << 1) | overflow; + overflow = srci >> 7; + } +} + +static void _cmac_key(const unsigned char *aes_key, unsigned char *k1, unsigned char *k2) +{ + uint8_t key16 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + gcry_cipher_hd_t gcry_h; + + gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); + gcry_cipher_setkey(gcry_h, aes_key, 16); + gcry_cipher_encrypt (gcry_h, key, 16, NULL, 0); + gcry_cipher_close(gcry_h); + + _shl_128(k1, key); + if (key0 & 0x80) { + k115 ^= 0x87; + } + + _shl_128(k2, k1); + if (k10 & 0x80) { + k215 ^= 0x87; + } +} + +void crypto_aes_cmac_16(const unsigned char *data, const unsigned char *aes_key, unsigned char *cmac) +{ + gcry_cipher_hd_t gcry_h; + uint8_t k116, k216; + unsigned ii; + + /* + * Somplified version of AES CMAC. Spports only 16-byte input data. + */ + + /* generate CMAC keys */ + _cmac_key(aes_key, k1, k2); + + memcpy(cmac, data, 16); + for (ii = 0; ii < 16; ii++) { + cmacii ^= k1ii; + } + + gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); + gcry_cipher_setkey(gcry_h, aes_key, 16); + gcry_cipher_encrypt (gcry_h, cmac, 16, 0, 16); + gcry_cipher_close(gcry_h); +} + + #if defined(HAVE_STRERROR_R) && defined(HAVE_LIBGPG_ERROR) #define LOG_GCRY_ERROR(msg, func, err) \ char errstr100 = {0}; \ @@ -503,6 +570,59 @@ gcry_create_nonce(buf, len); } +void crypto_create_bus_key(const uint8_t *priv_key, const uint8_t *drive_key_point, unsigned char *bus_key) +{ + /* init AACS curve */ + + elliptic_curve_t ec; + _aacs_curve_init(&ec); + + /* init ec context */ + + mpi_ec_t ctx = _gcry_mpi_ec_init (ec.p, ec.a); + + /* parse input data */ + + gcry_mpi_t mpi_priv_key = NULL; + gcry_mpi_scan (&mpi_priv_key, GCRYMPI_FMT_USG, priv_key, 20, NULL); + + mpi_point_t Q; + point_init (&Q); + gcry_mpi_scan (&Q.x, GCRYMPI_FMT_USG, drive_key_point, 20, NULL); + gcry_mpi_scan (&Q.y, GCRYMPI_FMT_USG, drive_key_point + 20, 20, NULL); + Q.z = mpi_alloc_set_ui(1); + + /* calculate bus key point: multiply drive key point with private key */ + + mpi_point_t bus_key_point; + point_init (&bus_key_point); + _gcry_mpi_ec_mul_point (&bus_key_point, mpi_priv_key, &Q, ctx); + + /* bus key is lowest 128 bits of bus_key_point x-coordinate */ + + /* get affine coordinates (Hv) */ + gcry_mpi_t q_x = mpi_new(0); + gcry_mpi_t q_y = mpi_new(0); + _gcry_mpi_ec_get_affine (q_x, q_y, &bus_key_point, ctx); + + /* convert to binary */ + uint8_t q_x_bin100; + size_t n = 0; + gcry_mpi_print (GCRYMPI_FMT_USG, q_x_bin, sizeof(q_x_bin), &n, q_x); + + memcpy(bus_key, q_x_bin + n - 16, 16); + + /* cleanup */ + + _gcry_mpi_ec_free (ctx); + _curve_free(&ec); + mpi_free(mpi_priv_key); + point_free(&Q); + point_free(&bus_key_point); + mpi_free(q_x); + mpi_free(q_y); +} + void crypto_create_host_key_pair(uint8_t *host_key, uint8_t *host_key_point) { /*
View file
libaacs-0.6.0.tar.bz2/src/libaacs/crypto.h -> libaacs-0.7.0.tar.bz2/src/libaacs/crypto.h
Changed
@@ -26,8 +26,11 @@ #include <stdint.h> AACS_PRIVATE int crypto_init(void); +AACS_PRIVATE void crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst); AACS_PRIVATE void crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, uint8_t *pk); // returns left, centre, right keys +AACS_PRIVATE void crypto_aes_cmac_16(const unsigned char *data, const unsigned char *aes_key, unsigned char *cmac); + AACS_PRIVATE void crypto_aacs_sign(const uint8_t *cert, const uint8_t *priv_key, uint8_t *signature, const uint8_t *nonce, const uint8_t *point); @@ -41,5 +44,6 @@ AACS_PRIVATE void crypto_create_host_key_pair(uint8_t *key, uint8_t *key_point); AACS_PRIVATE void crypto_create_nonce(uint8_t *buf, size_t len); +AACS_PRIVATE void crypto_create_bus_key(const uint8_t *priv_key, const uint8_t *drive_key_point, unsigned char *bus_key); #endif /* CRYPTO_H_ */
View file
libaacs-0.6.0.tar.bz2/src/libaacs/mkb.c -> libaacs-0.7.0.tar.bz2/src/libaacs/mkb.c
Changed
@@ -76,7 +76,7 @@ file_read(fp, mkb->buf, mkb->size); - DEBUG(DBG_MKB, "MKB size: %zd\n", mkb->size); + DEBUG(DBG_MKB, "MKB size: %u\n", (unsigned)mkb->size); DEBUG(DBG_MKB, "MKB version: %d\n", mkb_version(mkb)); file_close(fp); @@ -85,6 +85,8 @@ DEBUG(DBG_MKB, "Error opening MKB!\n"); + X_FREE(mkb); + return NULL; } @@ -221,7 +223,9 @@ uint16_t len = MKINT_BE16(rl); uint64_t id = MKINT_BE48(rl + 2); if (cert_id >= id && cert_id <= id + len) { - DEBUG(DBG_MKB, "Certificate %12llx has been revoked\n", (unsigned long long)cert_id); + char str16; + print_hex(str, rl + 2, 6); + DEBUG(DBG_MKB, "Certificate %s has been revoked\n", str); return 1; } rl += 8;
View file
libaacs-0.6.0.tar.bz2/src/libaacs/mmc.c -> libaacs-0.7.0.tar.bz2/src/libaacs/mmc.c
Changed
@@ -2,7 +2,7 @@ /* * This file is part of libaacs * Copyright (C) 2009-2010 Obliter0n - * Copyright (C) 2010 npzacs + * Copyright (C) 2010-2013 npzacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,7 @@ #include "mmc.h" #include "crypto.h" +#include "file/path.h" #include "util/macro.h" #include "util/logging.h" @@ -89,11 +90,6 @@ #include <winsock.h> #endif -/* define in CFLAGS to skip drive certificate checks */ -#ifndef PATCHED_DRIVE -#define PATCHED_DRIVE 0 -#endif - #ifndef DEBUG_KEYS #define DEBUG_KEYS 0 #endif @@ -146,6 +142,10 @@ uint8_t host_nonce20; uint8_t host_key20; uint8_t host_key_point40; + + uint8_t drive_cert92; + + uint8_t read_drive_cert; }; static int _mmc_send_cmd(MMC *mmc, const uint8_t *cmd, uint8_t *buf, size_t tx, @@ -388,6 +388,8 @@ memset(cmd, 0, sizeof(cmd)); memset(buf, 0, len); + DEBUG(DBG_MMC, "MMC report disc structure format 0x%x layer %d address %d ...\n", format, layer, address); + cmd0 = 0xad; // operation code cmd1 = 0x01; // BluRay cmd2 = (address >> 24) & 0xff; @@ -409,6 +411,8 @@ memset(cmd, 0, sizeof(cmd)); memset(buf, 0, len); + DEBUG(DBG_MMC, "MMC get configuration feature 0x%x ...\n", feature); + cmd0 = 0x46; // operation code cmd1 = 0x01; // BluRay cmd2 = (feature >> 8) & 0xff; @@ -467,8 +471,8 @@ return _mmc_send_key(mmc, agid, 0x01, buf, 116); } -static int _mmc_read_drive_cert(MMC *mmc, uint8_t agid, uint8_t *drive_nonce, - uint8_t *drive_cert) +static int _mmc_read_drive_cert_challenge(MMC *mmc, uint8_t agid, uint8_t *drive_nonce, + uint8_t *drive_cert) { uint8_t buf116; memset(buf, 0, sizeof(buf)); @@ -505,13 +509,16 @@ uint16_t feature = MKINT_BE16(buf+8); if (feature == 0x010d) { DEBUG(DBG_MMC, "AACS feature descriptor:\n"); - DEBUG(DBG_MMC, " AACS version: %d\n", buf5+8); + DEBUG(DBG_MMC, " AACS version: %d\n", buf7+8); DEBUG(DBG_MMC, " AACS active: %d\n", buf2+8 & 1); DEBUG(DBG_MMC, " Binding Nonce generation support: %d\n", buf4+8 & 1); DEBUG(DBG_MMC, " Binding Nonce block count: %d\n", buf5+8); - DEBUG(DBG_MMC, " Bus encryption support: %d\n", buf4+8 & 2); + DEBUG(DBG_MMC, " Bus encryption support: %d\n", !!(buf4+8 & 2)); + DEBUG(DBG_MMC, " Read drive certificate: %d\n", !!(buf4+8 & 0x10)); DEBUG(DBG_MMC, " AGID count: %d\n", buf6+8 & 0xf); + mmc->read_drive_cert = !!(buf4+8 & 0x10); + return buf2+8 & 1; } DEBUG(DBG_MMC, "incorrect feature ID %04x\n", feature); @@ -597,6 +604,19 @@ return 0; } +static int _mmc_read_data_keys(MMC *mmc, uint8_t agid, uint8_t *read_data_key, uint8_t *write_data_key) +{ + uint8_t buf36; + + if (_mmc_report_disc_structure(mmc, agid, 0x84, 0, 0, buf, 36)) { + memcpy(read_data_key, buf + 4, 16); + memcpy(write_data_key, buf + 20, 16); + return 1; + } + + return 0; +} + #ifdef USE_IOKIT static int get_mounted_device_from_path (MMC *mmc, const char *path) { struct statfs stat_info; @@ -857,18 +877,12 @@ #elif defined(HAVE_MNTENT_H) -#ifdef HAVE_REALPATH - char *file_path = malloc(PATH_MAX); - if (!file_path || !realpath(path, file_path)) { + char file_path AACS_PATH_MAX; + if (!aacs_resolve_path(path, file_path)) { DEBUG(DBG_MMC | DBG_CRIT, "Failed resolving path %s\n", path); X_FREE(mmc); - X_FREE(file_path); return NULL; } -#else - char *file_path = (char*)malloc(strlen(path) + 1); - strcpy(file_path, path); -#endif int path_len = strlen(file_path); FILE *proc_mounts; @@ -909,8 +923,6 @@ X_FREE(mmc); } - X_FREE(file_path); - #elif defined(_WIN32) char drive = { path0, ':', '\\', 0 }; char volume = {'\\', '\\', '.', '\\', path0, ':', 0}; @@ -948,13 +960,17 @@ #endif -#ifndef _WIN32 if (mmc && !_mmc_check_aacs(mmc)) { DEBUG(DBG_MMC | DBG_CRIT, "AACS not active or supported by the drive\n"); +#ifndef _WIN32 mmc_close (mmc); return NULL; - } #endif + } + + if (mmc && mmc->read_drive_cert) { + mmc_read_drive_cert(mmc, mmc->drive_cert); + } return mmc; } @@ -989,10 +1005,17 @@ DEBUG(DBG_MMC, "Closed MMC drive\n"); + /* erase sensitive data */ + memset(mmc, 0, sizeof(*mmc)); + X_FREE(mmc); } } +/* + * + */ + static int _verify_signature(const uint8_t *cert, const uint8_t *signature, const uint8_t *nonce, const uint8_t *point) { @@ -1004,119 +1027,270 @@ return crypto_aacs_verify(cert, signature, data, 60); } -int mmc_read_vid(MMC *mmc, const uint8_t *host_priv_key, const uint8_t *host_cert, uint8_t *vid, uint8_t *pmsn) +static int _mmc_aacs_auth(MMC *mmc, uint8_t agid, const uint8_t *host_priv_key, const uint8_t *host_cert, uint8_t *bus_key) { - uint8_t agid = 0, hks40, dn20, dc92, dkp40, dks40, mac16; + uint8_t hks40, dn20, dkp40, dks40; char str512; - int error_code = MMC_ERROR; memset(hks, 0, sizeof(hks)); - DEBUG(DBG_MMC, "Reading VID from drive...\n"); + if (DEBUG_KEYS) { + DEBUG(DBG_MMC, "Host certificate : %s\n", print_hex(str, host_cert, 92)); + DEBUG(DBG_MMC, "Host nonce : %s\n", print_hex(str, mmc->host_nonce, 20)); + } - _mmc_invalidate_agids(mmc); + // send host cert + nonce + if (!_mmc_send_host_cert(mmc, agid, mmc->host_nonce, host_cert)) {
View file
libaacs-0.6.0.tar.bz2/src/libaacs/mmc.h -> libaacs-0.7.0.tar.bz2/src/libaacs/mmc.h
Changed
@@ -31,10 +31,16 @@ #define MMC_ERROR -1 /* MMC failed */ #define MMC_ERROR_CERT_REVOKED -2 /* revoked certificate */ +#define MMC_READ_VID 0 +#define MMC_READ_PMSN 1 +#define MMC_READ_DATA_KEYS 2 + AACS_PRIVATE MMC *mmc_open(const char *path); AACS_PRIVATE void mmc_close(MMC *mmc); -AACS_PRIVATE int mmc_read_vid(MMC *mmc, const uint8_t *host_priv_key, const uint8_t *host_cert, - uint8_t *vid, uint8_t *pmsn); +AACS_PRIVATE int mmc_read_auth(MMC *mmc, const uint8_t *host_priv_key, const uint8_t *host_cert, + int request, uint8_t *p1, uint8_t *p2); +AACS_PRIVATE int mmc_read_drive_cert(MMC *mmc, uint8_t *drive_cert); +AACS_PRIVATE const uint8_t *mmc_get_drive_cert(MMC *mmc); /* read partial MKB */ AACS_PRIVATE uint8_t *mmc_read_mkb(MMC *mmc, int address, int *size);
View file
libaacs-0.6.0.tar.bz2/src/util/attributes.h -> libaacs-0.7.0.tar.bz2/src/util/attributes.h
Changed
@@ -17,8 +17,8 @@ * <http://www.gnu.org/licenses/>. */ -#ifndef LIBBLURAY_ATTRIBUTES_H_ -#define LIBBLURAY_ATTRIBUTES_H_ +#ifndef LIBAACS_ATTRIBUTES_H_ +#define LIBAACS_ATTRIBUTES_H_ #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3 )) # define AACS_ATTR_FORMAT_PRINTF(format,var) \ @@ -47,4 +47,12 @@ # define AACS_PRIVATE #endif -#endif /* LIBBLURAY_ATTRIBUTES_H_ */ +#if !defined(__GNUC__) || __GNUC__ < 3 +# define AACS_LIKELY(x) (x) +# define AACS_UNLIKELY(x) (x) +#else +# define AACS_LIKELY(x) __builtin_expect((x),1) +# define AACS_UNLIKELY(x) __builtin_expect((x),0) +#endif + +#endif /* LIBAACS_ATTRIBUTES_H_ */
View file
libaacs-0.6.0.tar.bz2/src/util/logging.c -> libaacs-0.7.0.tar.bz2/src/util/logging.c
Changed
@@ -24,7 +24,7 @@ #include <stdarg.h> #include <string.h> -static debug_mask_t debug_mask = DBG_CRIT; +uint32_t debug_mask = (uint32_t)-1; /* set all bits to make sure aacs_debug() is called for initialization */ char *print_hex(char *out, const uint8_t *buf, int count) { @@ -45,6 +45,7 @@ if (!debug_init) { debug_init = 1; logfile = stderr; + debug_mask = DBG_CRIT; char *env = NULL; if ((env = getenv("AACS_DEBUG_MASK")))
View file
libaacs-0.6.0.tar.bz2/src/util/logging.h -> libaacs-0.7.0.tar.bz2/src/util/logging.h
Changed
@@ -24,7 +24,14 @@ #include <stdint.h> -#define DEBUG(MASK,...) aacs_debug(__FILE__,__LINE__,MASK,##__VA_ARGS__) +AACS_PRIVATE extern uint32_t debug_mask; + +#define DEBUG(MASK,...) \ + do { \ + if (AACS_UNLIKELY((MASK) & debug_mask)) { \ + aacs_debug(__FILE__,__LINE__,MASK,__VA_ARGS__); \ + } \ + } while (0) enum debug_mask_enum { DBG_RESERVED = 0x0001,
View file
libaacs-0.6.0.tar.bz2/src/util/strutl.c -> libaacs-0.7.0.tar.bz2/src/util/strutl.c
Changed
@@ -208,6 +208,12 @@ } } + /* check end */ + if (isxdigit(strii)) { + //DEBUG(DBG_AACS, "Invalid hex string (too long): %s", str); + return 0; + } + return 1; }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.