Projects
Essentials
libaacs
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 12
View file
libaacs.changes
Changed
@@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Sun Apr 10 19:27:31 UTC 2022 - enzokiel@kabelmail.de + +- Update to version 0.11.1 + * Faster start with MacOS when disc does not use bus encryption. + * Improve error logging. + * Improve error resilience. + +------------------------------------------------------------------- Sat Sep 5 08:52:47 UTC 2020 - Luigi Baldoni <aloisio@gmx.com> 2020-07-22: Version 0.11.0
View file
libaacs.spec
Changed
@@ -1,7 +1,7 @@ # # spec file for package libaacs # -# Copyright (c) 2020 Packman Team <packman@links2linux.de> +# Copyright (c) 2022 Packman Team <packman@links2linux.de> # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2011 Dominique Leuenberger, Amsterdam, The Netherlands. # @@ -20,7 +20,7 @@ %define sover 0 Name: libaacs -Version: 0.11.0 +Version: 0.11.1 Release: 0 Summary: Open implentation of AACS specification License: LGPL-2.1-or-later
View file
libaacs-0.11.0.tar.bz2/ChangeLog -> libaacs-0.11.1.tar.bz2/ChangeLog
Changed
@@ -1,3 +1,8 @@ +2022-02-27: Version 0.11.1 +- Faster start with MacOS when disc does not use bus encryption. +- Improve error logging. +- Improve error resilience. + 2020-07-22: Version 0.11.0 - Add more AACS2 support (still not complete). - Add support for partial unit keys in KEYDB.CFG.
View file
libaacs-0.11.0.tar.bz2/KEYDB.cfg -> libaacs-0.11.1.tar.bz2/KEYDB.cfg
Changed
@@ -22,7 +22,7 @@ ; ignored. ; ; Whitespace in this file is referred to as a single space (' ') or -; a tab ('\t'). Whitespace can be present/ommitted except in the case of +; a tab ('\t'). Whitespace can be present/omitted except in the case of ; keywords. Keywords must be delimited by at least one whitespace. ; ; Newlines may be escaped. To escape a newline, prepend a '\' character before
View file
libaacs-0.11.0.tar.bz2/Makefile.in -> libaacs-0.11.1.tar.bz2/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -340,8 +340,8 @@ esac DATA = $(pkgconfig_DATA) HEADERS = $(pkginclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -358,9 +358,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/build-aux/compile \ @@ -372,10 +369,11 @@ $(top_srcdir)/build-aux/missing $(top_srcdir)/build-aux/ylwrap \ $(top_srcdir)/src/libaacs.pc.in \ $(top_srcdir)/src/libaacs/aacs-version.h.in COPYING ChangeLog \ - build-aux/compile build-aux/config.guess build-aux/config.sub \ - build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ - build-aux/missing build-aux/ylwrap src/file/keydbcfg-lexer.c \ - src/file/keydbcfg-parser.c src/file/keydbcfg-parser.h + README.md build-aux/compile build-aux/config.guess \ + build-aux/config.sub build-aux/depcomp build-aux/install-sh \ + build-aux/ltmain.sh build-aux/missing build-aux/ylwrap \ + src/file/keydbcfg-lexer.c src/file/keydbcfg-parser.c \ + src/file/keydbcfg-parser.h DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -389,6 +387,8 @@ GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.bz2 DIST_TARGETS = dist-bzip2 +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -410,6 +410,8 @@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -420,6 +422,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ @@ -1258,7 +1261,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -1319,6 +1321,10 @@ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -1361,6 +1367,8 @@ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -1376,7 +1384,7 @@ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -1440,7 +1448,8 @@ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -1631,14 +1640,14 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \ uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS -.MAKE: all check install install-am install-strip +.MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \ check-am clean clean-binPROGRAMS clean-cscope clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ - dist-zip distcheck distclean distclean-compile \ + dist-zip dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \
View file
libaacs-0.11.0.tar.bz2/README.md -> libaacs-0.11.1.tar.bz2/README.md
Changed
@@ -1,7 +1,16 @@ -# libaacs +# Libaacs **libaacs** is a research project for a cross-platform open-source implementation of the AACS specification. + +## Goals and features + +This research project provides, through an open-source library, a way to understand how the AACS works. + +This research project is mainly developed by an international team of developers from **Doom9**. + +Currently supported platforms are GNU/Linux, Windows, MacOS X. The main dependency is libgcrypt for all cryptographic functions. + # Disclaimer This library is written for the purpose of playing Blu-ray movies. @@ -45,6 +54,10 @@ The VideoLAN Code of Conduct(https://wiki.videolan.org/CoC) applies to this project. +## Mailing list + +You can discuss about libaacs on the libaacs-devel mailing list(https://mailman.videolan.org/listinfo/libaacs-devel) + ## CLA There is no CLA.
View file
libaacs-0.11.0.tar.bz2/aclocal.m4 -> libaacs-0.11.1.tar.bz2/aclocal.m4
Changed
@@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.4 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ 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'.)) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ am__api_version='1.16' 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.16.1, , +m4_if($1, 1.16.4, , AC_FATAL(Do not call $0, use AM_INIT_AUTOMAKE($1).))dnl ) @@ -51,14 +51,14 @@ # 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.16.1)dnl +AM_AUTOMAKE_VERSION(1.16.4)dnl m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl _AM_AUTOCONF_VERSION(m4_defn(AC_AUTOCONF_VERSION))) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ Usually this means the macro was only invoked conditionally.) fi)) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ done if test $am_rc -ne 0; then AC_MSG_FAILURE(Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).) fi @@ -398,7 +400,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -462,7 +464,7 @@ _AM_SET_OPTIONS($1)dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef(AC_PACKAGE_NAME, ok):m4_ifdef(AC_PACKAGE_VERSION, ok), + m4_ifset(AC_PACKAGE_NAME, ok):m4_ifset(AC_PACKAGE_VERSION, ok), ok:ok,, m4_fatal(AC_INIT should be called with package and version arguments))dnl AC_SUBST(PACKAGE, 'AC_PACKAGE_TARNAME')dnl @@ -514,6 +516,20 @@ m4_define(AC_PROG_OBJCXX, m4_defn(AC_PROG_OBJCXX)_AM_DEPENDENCIES(OBJCXX)))dnl ) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST(CTAGS) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST(ETAGS) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST(CSCOPE) + AC_REQUIRE(AM_SILENT_RULES)dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +611,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME("$_am_arg")`/stamp-h$_am_stamp_count) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +632,7 @@ fi AC_SUBST(install_sh)) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -635,7 +651,7 @@ rmdir .tst 2>/dev/null AC_SUBST(am__leading_dot)) -# Copyright (C) 1998-2018 Free Software Foundation, Inc. +# Copyright (C) 1998-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -656,7 +672,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -691,7 +707,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -734,7 +750,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -755,12 +771,7 @@ AC_REQUIRE(AM_AUX_DIR_EXPAND)dnl AC_REQUIRE_AUX_FILE(missing)dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -773,7 +784,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -802,7 +813,7 @@ AC_DEFUN(_AM_IF_OPTION, m4_ifset(_AM_MANGLE_OPTION($1), $2, $3)) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -849,7 +860,7 @@ # For backward compatibility. AC_DEFUN_ONCE(AM_PROG_CC_C_O, AC_REQUIRE(AC_PROG_CC)) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -868,7 +879,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -949,7 +960,7 @@ rm -f conftest.file ) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1009,7 +1020,7 @@ _AM_SUBST_NOTMAKE(AM_BACKSLASH)dnl ) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1037,7 +1048,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST(INSTALL_STRIP_PROGRAM)) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1056,7 +1067,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it,
View file
libaacs-0.11.0.tar.bz2/build-aux/compile -> libaacs-0.11.1.tar.bz2/build-aux/compile
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*)
View file
libaacs-0.11.0.tar.bz2/build-aux/depcomp -> libaacs-0.11.1.tar.bz2/build-aux/depcomp
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 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
View file
libaacs-0.11.0.tar.bz2/build-aux/install-sh -> libaacs-0.11.1.tar.bz2/build-aux/install-sh
Changed
@@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *23672367) mkdir_umask=$umask;; - .*00202 | .0202 | .02) mkdir_umask=22;; - - *0-7) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ fi posix_mkdir=false - case $umask in - *1235670-70-7) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1
View file
libaacs-0.11.0.tar.bz2/build-aux/ltmain.sh -> libaacs-0.11.1.tar.bz2/build-aux/ltmain.sh
Changed
@@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-14" +VERSION="2.4.6 Debian-2.4.6-15" package_revision=2.4.6 @@ -2141,7 +2141,7 @@ compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-14 + version: $progname $scriptversion Debian-2.4.6-15 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
View file
libaacs-0.11.0.tar.bz2/build-aux/missing -> libaacs-0.11.1.tar.bz2/build-aux/missing
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify
View file
libaacs-0.11.0.tar.bz2/build-aux/ylwrap -> libaacs-0.11.1.tar.bz2/build-aux/ylwrap
Changed
@@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # Written by Tom Tromey <tromey@cygnus.com>. #
View file
libaacs-0.11.0.tar.bz2/configure -> libaacs-0.11.1.tar.bz2/configure
Changed
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libaacs 0.11.0. +# Generated by GNU Autoconf 2.69 for libaacs 0.11.1. # # Report bugs to <http://www.videolan.org/developers/libaacs.html>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libaacs' PACKAGE_TARNAME='libaacs' -PACKAGE_VERSION='0.11.0' -PACKAGE_STRING='libaacs 0.11.0' +PACKAGE_VERSION='0.11.1' +PACKAGE_STRING='libaacs 0.11.1' PACKAGE_BUGREPORT='http://www.videolan.org/developers/libaacs.html' PACKAGE_URL='' @@ -704,6 +704,9 @@ AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -1363,7 +1366,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libaacs 0.11.0 to adapt to many kinds of systems. +\`configure' configures libaacs 0.11.1 to adapt to many kinds of systems. Usage: $0 OPTION... VAR=VALUE... @@ -1435,7 +1438,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libaacs 0.11.0:";; + short | recursive ) echo "Configuration of libaacs 0.11.1:";; esac cat <<\_ACEOF @@ -1565,7 +1568,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libaacs configure 0.11.0 +libaacs configure 0.11.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1980,7 +1983,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libaacs $as_me 0.11.0, which was +It was created by libaacs $as_me 0.11.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2645,12 +2648,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -2955,7 +2953,7 @@ # Define the identity of the package. PACKAGE='libaacs' - VERSION='0.11.0' + VERSION='0.11.1' cat >>confdefs.h <<_ACEOF @@ -3121,6 +3119,20 @@ +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -3236,12 +3248,12 @@ "") SYS=unknown ;; - *mingw32* | *cygwin* | *wince* | *mingwce*) + *mingw* | *cygwin* | *wince* | *mingwce*) case "${host_os}" in *wince* | *mingwce* | *mingw32ce*) SYS=mingwce ;; - *mingw32*) + *mingw*) SYS=mingw32 $as_echo "#define _WIN32_WINNT 0x0501" >>confdefs.h @@ -7701,11 +7713,11 @@ # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin91*) + 10.0,*86*-darwin8*|10.0,*-darwin912*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.012,.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; @@ -14213,10 +14225,10 @@ AACS_VERSION_MINOR=11 -AACS_VERSION_MICRO=0 +AACS_VERSION_MICRO=1 -LT_VERSION_INFO="7:1:7" +LT_VERSION_INFO="7:2:7" @@ -14764,7 +14776,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libaacs $as_me 0.11.0, which was +This file was extended by libaacs $as_me 0.11.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14830,7 +14842,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/\\""\`\$/\\\\&/g'`" ac_cs_version="\\ -libaacs config.status 0.11.0 +libaacs config.status 0.11.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -15927,7 +15939,9 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; }
View file
libaacs-0.11.0.tar.bz2/configure.ac -> libaacs-0.11.1.tar.bz2/configure.ac
Changed
@@ -1,7 +1,7 @@ dnl library version number m4_define(aacs_major, 0) m4_define(aacs_minor, 11) -m4_define(aacs_micro, 0) +m4_define(aacs_micro, 1) m4_define(aacs_version,aacs_major.aacs_minor.aacs_micro) dnl shared library version (.so version) @@ -16,9 +16,9 @@ m4_define(lt_current, 7) m4_define(lt_age, 7) -m4_define(lt_revision, 1) +m4_define(lt_revision, 2) -dnl initilization +dnl initialization AC_INIT(libaacs, aacs_version, http://www.videolan.org/developers/libaacs.html) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(m4) @@ -36,12 +36,12 @@ "") SYS=unknown ;; - *mingw32* | *cygwin* | *wince* | *mingwce*) + *mingw* | *cygwin* | *wince* | *mingwce*) case "${host_os}" in *wince* | *mingwce* | *mingw32ce*) SYS=mingwce ;; - *mingw32*) + *mingw*) SYS=mingw32 AC_DEFINE(_WIN32_WINNT, 0x0501, Define to '0x0500' for Windows XP APIs.) AC_DEFINE(_WIN32_IE, 0x0501, Define to '0x0501' for IE 5.01.)
View file
libaacs-0.11.0.tar.bz2/m4/libgcrypt.m4 -> libaacs-0.11.1.tar.bz2/m4/libgcrypt.m4
Changed
@@ -13,7 +13,7 @@ dnl AM_PATH_LIBGCRYPT(MINIMUM-VERSION, dnl ACTION-IF-FOUND , ACTION-IF-NOT-FOUND ) dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. -dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed +dnl MINIMUN-VERSION is a string with the version number optionally prefixed dnl with the API version to also check the API compatibility. Example: dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
View file
libaacs-0.11.0.tar.bz2/m4/libtool.m4 -> libaacs-0.11.1.tar.bz2/m4/libtool.m4
Changed
@@ -1071,11 +1071,11 @@ # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin91*) + 10.0,*86*-darwin8*|10.0,*-darwin912*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.012,.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;;
View file
libaacs-0.11.0.tar.bz2/src/devtools/mkb_dump.c -> libaacs-0.11.1.tar.bz2/src/devtools/mkb_dump.c
Changed
@@ -93,6 +93,11 @@ uint32_t total_entries = MKINT_BE32(rl); rl += 4; rl_size -= 4; + if ((size_t)total_entries > rl_size / 8) { + printf(" revocation list size mismatch: total_entries=%u\n", (unsigned)total_entries); + return; + } + while (total_entries > 0 && rl_size >= 4) { uint32_t entries = MKINT_BE32(rl); rl += 4; rl_size -= 4; @@ -120,7 +125,12 @@ } _dump_signature(rl, 40); rl += 40; rl_size -= 40; - total_entries -= entries; + if (total_entries <= entries) { + total_entries -= entries; + } else { + printf(" revocation list size mismatch\n"); + total_entries = 0; + } } } @@ -143,12 +153,16 @@ for (pos = 0; pos + 4 <= size; pos += len) { uint8_t type = datapos; len = MKINT_BE24(data + pos + 1); + if (len > size - pos) { + printf(" invalid record 0x%02x size: %zu\n", type, len); + break; + } if (type == record) { switch (record) { - case 0x02: _dump_signature(data + pos + 4, len - 4); break; - case 0x10: _dump_type_and_version(data + pos + 4, len - 4); break; + case 0x02: if (len > 4 && len <= 64) _dump_signature(data + pos + 4, len - 4); break; + case 0x10: if (len > 4) _dump_type_and_version(data + pos + 4, len - 4); break; case 0x20: - case 0x21: _dump_aacs1_rl(data + pos + 4, len - 4); break; + case 0x21: if (len > 4) _dump_aacs1_rl(data + pos + 4, len - 4); break; } printf(" Raw data (%zu bytes):\n", len - 4); const uint8_t *p = data + pos + 4; @@ -194,7 +208,7 @@ uint8_t type = datapos; len = MKINT_BE24(data + pos + 1); printf(" record 0x%02x: %10zu bytes %s\n", type, len, rec_name(type)); - seen_maptype = 1; + seen_maptype & 0xff = 1; if (len == 0) { printf(" UNKNOWN: %10zu bytes\n", size - pos); break;
View file
libaacs-0.11.0.tar.bz2/src/devtools/read_file.h -> libaacs-0.11.1.tar.bz2/src/devtools/read_file.h
Changed
@@ -21,11 +21,11 @@ #include <stdlib.h> #include <errno.h> -static size_t _read_file(const char *name, off_t min_size, off_t max_size, uint8_t **pdata) +static size_t _read_file(const char *name, long min_size, long max_size, uint8_t **pdata) { FILE *f; uint8_t *data = NULL; - off_t file_size; + long file_size; size_t size; f = fopen(name, "rb");
View file
libaacs-0.11.0.tar.bz2/src/examples/aacs_info.c -> libaacs-0.11.1.tar.bz2/src/examples/aacs_info.c
Changed
@@ -24,14 +24,12 @@ #include "util/macro.h" /* MKINT_BE48 */ -static const char *_hex2str(const uint8_t *s, unsigned n) +static const char *_hex2str(char *str, const uint8_t *s, unsigned n) { static const char hex = "0123456789ABCDEF"; - static char *str = NULL; unsigned ii; - str = realloc(str, n*2 + 1); for (ii = 0; ii < n; ii++) { str2*ii = hex sii >> 4; str2*ii + 1 = hex sii & 0x0f; @@ -70,7 +68,7 @@ if (argc < 2) { fprintf(stderr, "Usage: aacs_info <path-to-disc-root> <path-to-config-file>\n"); - exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } aacs_get_version(&major, &minor, µ); @@ -78,7 +76,7 @@ aacs = aacs_init(); if (!aacs) { - exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } error_code = aacs_open_device(aacs, argv1, argc > 2 ? argv2 : NULL); @@ -98,18 +96,19 @@ const uint8_t *binding_id = aacs_get_device_binding_id(aacs); const uint8_t *bdj_hash = aacs_get_bdj_root_cert_hash(aacs); const uint8_t *cc_id = aacs_get_content_cert_id(aacs); + char s41; - printf("Disc ID: %s\n", id ? _hex2str(id, 20) : "???"); - printf("VID : %s\n", vid ? _hex2str(vid, 16) : "???"); - printf("MK : %s\n", mk ? _hex2str(mk, 16) : "???"); + printf("Disc ID: %s\n", id ? _hex2str(s, id, 20) : "???"); + printf("VID : %s\n", vid ? _hex2str(s, vid, 16) : "???"); + printf("MK : %s\n", mk ? _hex2str(s, mk, 16) : "???"); printf("MKBv : %d\n", aacs_get_mkb_version(aacs)); - printf("PMSN : %s\n", pmsn ? _hex2str(pmsn, 16) : "???"); + printf("PMSN : %s\n", pmsn ? _hex2str(s, 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("Content Certificate ID: %s\n", cc_id ? _hex2str(cc_id, 6) : "???"); - printf("BD-J Root Cert hash: %s\n", bdj_hash ? _hex2str(bdj_hash, 20) : "???"); - printf("Device binding ID: %s\n", binding_id ? _hex2str(binding_id, 16) : "???"); + printf("Content Certificate ID: %s\n", cc_id ? _hex2str(s, cc_id, 6) : "???"); + printf("BD-J Root Cert hash: %s\n", bdj_hash ? _hex2str(s, bdj_hash, 20) : "???"); + printf("Device binding ID: %s\n", binding_id ? _hex2str(s, binding_id, 16) : "???"); aacs_close(aacs);
View file
libaacs-0.11.0.tar.bz2/src/file/keydb.h -> libaacs-0.11.1.tar.bz2/src/file/keydb.h
Changed
@@ -1,7 +1,7 @@ /* encrypted keys */ -static const uint8_t internal_dk_list21 = { +static const uint8_t internal_dk_list23 = { { }, };
View file
libaacs-0.11.0.tar.bz2/src/file/keydbcfg-lexer.l -> libaacs-0.11.1.tar.bz2/src/file/keydbcfg-lexer.l
Changed
@@ -32,9 +32,6 @@ int isatty(int i) { return 0; } -#if 0 -static char *trim_string(const char *string); -#endif %} /* Options to generate reentrant lexer that's POSIX lex compatible. The * bison-bridge option is also set since bison forces the use of a parameter @@ -91,7 +88,6 @@ {WHITESPACE} {} <TITLE_STATE>{DISC_TITLE} { - //yylval->string = trim_string(yytext); yylval->string = yytext; BEGIN INITIAL; return DISC_TITLE; @@ -143,21 +139,3 @@ {COMMENT} {} {BAD_ENTRY} { return BAD_ENTRY; } %% -#if 0 -/* Function used to trim leading and trailing space from a string */ -static char *trim_string(const char *string) -{ - int start = 0; - int end = strlen(string); - while (stringstart == ' ' || stringstart == '\t') - start++; - while (stringend == '\0' || stringend == ' ' || stringend == '\t') - end--; - int size = end - start + 1; - - char *new_string = (char*)malloc(size + 1); - strncpy(new_string, string + start, size); - new_stringsize = '\0'; - return new_string; -} -#endif \ No newline at end of file
View file
libaacs-0.11.0.tar.bz2/src/file/mmc_device_darwin.c -> libaacs-0.11.1.tar.bz2/src/file/mmc_device_darwin.c
Changed
@@ -548,7 +548,7 @@ * a USB BD drive which sometimes can take really long to * be in a mountable state again. * For internal drives this is probably much faster - * so the long timeout shouldnt do much harm for thse + * so the long timeout shouldn't do much harm for thse * cases. */ dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, 20 * 1E+9);
View file
libaacs-0.11.0.tar.bz2/src/file/mmc_device_linux.c -> libaacs-0.11.1.tar.bz2/src/file/mmc_device_linux.c
Changed
@@ -89,11 +89,13 @@ result = ioctl(dev->fd, CDROM_SEND_PACKET, &cgc); BD_DEBUG(DBG_MMC, "Send LINUX MMC cmd %s:\n", str_print_hex(str, cmd, 16)); + if (buf) { if (tx) { BD_DEBUG(DBG_MMC, " Buffer: %s ->\n", str_print_hex(str, buf, tx>255?255:tx)); } else { BD_DEBUG(DBG_MMC, " Buffer: %s <-\n", str_print_hex(str, buf, rx>255?255:rx)); } + } if (result >= 0) { BD_DEBUG(DBG_MMC, " Send succeeded! %d\n", result); @@ -103,6 +105,7 @@ BD_DEBUG(DBG_MMC, " Send failed! %d %s\n", result, strerror(errno)); #else #warning no MMC drive support + (void)dev; (void)cmd; (void)buf; (void)tx; (void)rx; BD_DEBUG(DBG_MMC | DBG_CRIT, "No MMC drive support\n"); #endif @@ -132,12 +135,13 @@ MMCDEV *device_open(const char *path) { - char resolved_pathAACS_PATH_MAX; + char *resolved_path; size_t path_len; int fd; /* resolve path */ - if (!aacs_resolve_path(path, resolved_path)) { + resolved_path = aacs_resolve_path(path); + if (!resolved_path) { BD_DEBUG(DBG_MMC | DBG_CRIT, "Failed resolving path %s\n", path); return NULL; } @@ -182,10 +186,13 @@ } #else BD_DEBUG(DBG_MMC | DBG_CRIT, "Only block devices supported\n"); + X_FREE(resolved_path); return NULL; #endif } + X_FREE(resolved_path); + if (fd >= 0) { MMCDEV *dev = calloc(1, sizeof(MMCDEV)); if (dev) {
View file
libaacs-0.11.0.tar.bz2/src/file/path.c -> libaacs-0.11.1.tar.bz2/src/file/path.c
Changed
@@ -27,10 +27,17 @@ #include <string.h> #include <errno.h> +#include "util/strutl.h" + #define MAX_LINKS 32 -char *aacs_resolve_path(const char *path, char *resolved_path) +#ifndef AACS_PATH_MAX +#define AACS_PATH_MAX 1024 +#endif + +char *aacs_resolve_path(const char *path) { + char resolved_pathAACS_PATH_MAX; char tmp_pathAACS_PATH_MAX; char linkAACS_PATH_MAX; char *new_path = resolved_path; @@ -133,14 +140,13 @@ } *new_path = 0; - return resolved_path; + return str_dup(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)); + printf("%s -> %s\n", argv0, aacs_resolve_path(argv0)); + printf("%s -> %s\n", argv1, aacs_resolve_path(argv1)); } #endif
View file
libaacs-0.11.0.tar.bz2/src/file/path.h -> libaacs-0.11.1.tar.bz2/src/file/path.h
Changed
@@ -22,10 +22,6 @@ #include "util/attributes.h" -#ifndef AACS_PATH_MAX -#define AACS_PATH_MAX 1024 -#endif - -BD_PRIVATE char *aacs_resolve_path(const char *path, char *resolved_path); +BD_PRIVATE char *aacs_resolve_path(const char *path); #endif /* AACS_PATH_H */
View file
libaacs-0.11.0.tar.bz2/src/libaacs/aacs.c -> libaacs-0.11.1.tar.bz2/src/libaacs/aacs.c
Changed
@@ -42,10 +42,6 @@ #include <inttypes.h> #include <string.h> #include <stdio.h> -#ifdef HAVE_SYS_SELECT_H -#include <sys/select.h> -#endif -#include <gcrypt.h> #define SECTOR_LEN 2048 /* bus encryption block size */ @@ -79,7 +75,7 @@ /* bus encryption */ int bee; /* bus encryption enabled flag in content certificate */ - int bec; /* bus encryption capable flag in drive certificate */ + int bec; /* bus encryption capable flag in drive certificate. -1 = unread. */ uint8_t read_data_key16; uint8_t drive_cert_hash20; @@ -94,8 +90,6 @@ static const uint8_t empty_key20 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uint8_t aacs_iv16 = { 0x0b, 0xa0, 0xf8, 0xdd, 0xfe, 0xa6, 0x1f, 0xb3, - 0xd8, 0xdf, 0x9f, 0x56, 0x6a, 0x05, 0x0f, 0x78 }; /* * Validate processing key using media key verification data @@ -105,8 +99,7 @@ const uint8_t *cvalue, const uint8_t *uv, const uint8_t *vd, uint8_t *mk) { - gcry_cipher_hd_t gcry_h; - int a; + int a, crypto_err; uint8_t dec_vd16; char str40; @@ -116,18 +109,21 @@ BD_DEBUG(DBG_AACS, " cvalue: %s\n", str_print_hex(str, cvalue, 16)); BD_DEBUG(DBG_AACS, " Verification data: %s\n", str_print_hex(str, vd, 16)); - gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); - gcry_cipher_setkey(gcry_h, pk, 16); - gcry_cipher_decrypt(gcry_h, mk, 16, cvalue, 16); + crypto_err = crypto_aes128d(pk, cvalue, mk); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "decrypting media key failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } for (a = 0; a < 4; a++) { mka + 12 ^= uva; } - gcry_cipher_setkey(gcry_h, mk, 16); - gcry_cipher_decrypt (gcry_h, dec_vd, 16, vd, 16); - gcry_cipher_close(gcry_h); - + crypto_err = crypto_aes128d(mk, vd, dec_vd); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "decrypting media key verification data failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } if (!memcmp(dec_vd, "\x01\x23\x45\x67\x89\xAB\xCD\xEF", 8)) { BD_DEBUG(DBG_AACS, "Processing key %s is valid!\n", str_print_hex(str, pk, 16)); return AACS_SUCCESS; @@ -142,6 +138,8 @@ static int _rl_verify_signature(const uint8_t *rl, size_t size) { + int crypto_err; + if (size < 40) { BD_DEBUG(DBG_AACS, "too small revocation list\n"); return 0; @@ -159,7 +157,13 @@ return 0; } - return crypto_aacs_verify_aacsla(rl + len, rl, len); + crypto_err = crypto_aacs_verify_aacsla(rl + len, rl, len); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "revocation list signature verification failed", crypto_err); + return 0; + } + + return 1; } static void _save_rl(const char *name, uint32_t version, const uint8_t *version_rec, @@ -179,9 +183,7 @@ if (data) { memcpy(data, version_rec, 12); memcpy(data + 12, rl_rec, rl_len); - if (!_rl_verify_signature(data, rl_len + 12)) { - BD_DEBUG(DBG_AACS | DBG_CRIT, "invalid %s signature, not using it\n", name); - } else { + if (_rl_verify_signature(data, rl_len + 12)) { cache_save(name, version, data, rl_len + 12); } X_FREE(data); @@ -225,11 +227,16 @@ 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) +static int _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; + int crypto_err; - crypto_aesg3(dk, left_child, right_child, pk); + crypto_err = crypto_aesg3(dk, left_child, right_child, pk); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "PK derivation failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } while (dev_key_v_mask != v_mask) { @@ -247,13 +254,18 @@ memcpy(curr_key, right_child, 16); } - crypto_aesg3(curr_key, left_child, right_child, pk); + crypto_err = crypto_aesg3(curr_key, left_child, right_child, pk); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "PK derivation failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } dev_key_v_mask = ((int) dev_key_v_mask) >> 1; } char str40; BD_DEBUG(DBG_AACS, "Processing key: %s\n", str_print_hex(str, pk, 16)); + return AACS_SUCCESS; } static dk_list *_find_dk(dk_list *dkl, uint32_t *p_dev_key_v_mask, uint32_t uv, uint32_t u_mask) @@ -387,7 +399,10 @@ /* calculate processing key */ uint8_t pk16; - _calc_pk(dk->key, pk, uv, v_mask, dev_key_v_mask); + if (_calc_pk(dk->key, pk, uv, v_mask, dev_key_v_mask) != AACS_SUCCESS) { + /* try next device */ + continue; + } /* calculate and verify media key */ @@ -480,6 +495,7 @@ size_t data_size = 65536; /* initial alloc */ uint32_t chunk_size = 4; /* initial read */ uint8_t *data; + int64_t fsize; *pdata = NULL; @@ -489,6 +505,13 @@ return 0; } + fsize = file_size(fp); + if (fsize < 4) { + BD_DEBUG(DBG_AACS | DBG_CRIT, "Empty file: %s\n", file); + file_close(fp); + return 0; + } + data = malloc(data_size); if (!data) { BD_DEBUG(DBG_AACS | DBG_CRIT, "Out of memory\n"); @@ -505,8 +528,12 @@ } size += read_size; chunk_size = MKINT_BE24(data + size - 4 + 1); + if (fsize - size + 4 < (int64_t)chunk_size) { + BD_DEBUG(DBG_AACS | DBG_CRIT, "Invalid record size %u in %s\n", (unsigned)chunk_size, file); + break; + } if (data_size < size + chunk_size) { - for ( ; data_size < size + chunk_size; data_size *= 2) ; + data_size = 2*size + chunk_size; void *tmp = realloc(data, data_size); if (!tmp) { X_FREE(data); @@ -672,8 +699,11 @@ for (; hcl ; hcl = hcl->next) { char tmp_str2*92+1; + int crypto_error; - if (!crypto_aacs_verify_host_cert(hcl->host_cert)) { + crypto_error = crypto_aacs_verify_host_cert(hcl->host_cert); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_AACS, "host certificate signature verification failed", crypto_error); BD_DEBUG(DBG_AACS, "Not using invalid host certificate %s.\n", str_print_hex(tmp_str, hcl->host_cert, 92)); continue; @@ -776,7 +806,7 @@ static int _calc_vuk(AACS *aacs, uint8_t *mk, uint8_t *vuk, config_file *cf) { - int error_code; + int error_code, crypto_err; /* Skip if retrieved from config file */ if (memcmp(vuk, empty_key, 16)) { @@ -808,7 +838,11 @@ /* calculate VUK */ - crypto_aes128d(mk, aacs->vid, vuk); + crypto_err = crypto_aes128d(mk, aacs->vid, vuk); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "decrypting VUK failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } int a; for (a = 0; a < 16; a++) { @@ -1027,6 +1061,7 @@ /* decrypt unit keys */ for (i = 0; i < aacs->uk->num_uk; i++) { + int crypto_err; /* error out if VUK calculation fails and encrypted CPS unit is found */ if (vuk_error_code != AACS_SUCCESS) { @@ -1037,7 +1072,11 @@ BD_DEBUG(DBG_AACS | DBG_CRIT, "WARNING: VUK calculation failed but disc seems to be unencrypted.\n"); } - crypto_aes128d(vuk, aacs->uk->enc_uki.key, aacs->uk->uki.key); + crypto_err = crypto_aes128d(vuk, aacs->uk->enc_uki.key, aacs->uk->uki.key); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "decrypting unit key failed", crypto_err); + return AACS_ERROR_UNKNOWN; + } char str40; BD_DEBUG(DBG_AACS, "Unit key %d: %s\n", i, @@ -1168,32 +1207,30 @@ { /* inbuf == NULL means in-place decryption */ - gcry_cipher_hd_t gcry_h; - int a; + int a, crypto_err; uint8_t key16; if (BD_UNLIKELY(in_buf != NULL)) { memcpy(out_buf, in_buf, 16); /* first 16 bytes are plain */ } - gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); - gcry_cipher_setkey(gcry_h, aacs->uk->ukcurr_uk.key, 16); - gcry_cipher_encrypt(gcry_h, key, 16, out_buf, 16); /* here out_buf is plain data fron in_buf */ - gcry_cipher_close(gcry_h); + crypto_err = crypto_aes128e(aacs->uk->ukcurr_uk.key, out_buf, key); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "unit key derivation failed", crypto_err); + } for (a = 0; a < 16; a++) { - keya ^= out_bufa; /* here out_buf is plain data fron in_buf */ + keya ^= out_bufa; /* here out_buf is plain data from in_buf */ } - gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC, 0); - gcry_cipher_setkey(gcry_h, key, 16); - gcry_cipher_setiv(gcry_h, aacs_iv, 16); if (BD_UNLIKELY(in_buf != NULL)) { - gcry_cipher_decrypt(gcry_h, out_buf + 16, ALIGNED_UNIT_LEN - 16, in_buf + 16, ALIGNED_UNIT_LEN - 16); + crypto_err = crypto_aacs_decrypt(key, out_buf + 16, ALIGNED_UNIT_LEN - 16, in_buf + 16, ALIGNED_UNIT_LEN - 16); } else { - gcry_cipher_decrypt(gcry_h, out_buf + 16, ALIGNED_UNIT_LEN - 16, NULL, 0); + crypto_err = crypto_aacs_decrypt(key, out_buf + 16, ALIGNED_UNIT_LEN - 16, NULL, 0); + } + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "decrypting unit failed", crypto_err); } - gcry_cipher_close(gcry_h); if (_verify_ts(out_buf)) { return 1; @@ -1202,17 +1239,6 @@ return 0; } -static void _decrypt_bus(AACS *aacs, uint8_t *buf) -{ - gcry_cipher_hd_t gcry_h; - - gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC, 0); - gcry_cipher_setkey(gcry_h, aacs->read_data_key, 16); - gcry_cipher_setiv(gcry_h, aacs_iv, 16); - gcry_cipher_decrypt(gcry_h, buf + 16, SECTOR_LEN - 16, NULL, 0); - gcry_cipher_close(gcry_h); -} - /* * libaacs API */ @@ -1236,6 +1262,7 @@ -AACS_ERROR_MMC_OPEN = "Failed opening MMC device", -AACS_ERROR_MMC_FAILURE = "MMC failure", -AACS_ERROR_NO_DK = "No matching device key", + -AACS_ERROR_UNKNOWN = "Error", }; err = -err; if (err < 0 || (size_t)err >= sizeof(str) / sizeof(str0) || !strerr) { @@ -1244,7 +1271,7 @@ return strerr; } -/* aacs_open2() wrapper for backwards compability */ +/* aacs_open2() wrapper for backwards compatibility */ AACS *aacs_open(const char *path, const char *configfile_path) { int error_code; @@ -1259,7 +1286,7 @@ return NULL; } -/* aacs_open_device() wrapper for backward compability */ +/* aacs_open_device() wrapper for backward compatibility */ AACS *aacs_open2(const char *path, const char *configfile_path, int *error_code) { AACS *aacs = aacs_init(); @@ -1310,6 +1337,8 @@ aacs->path = path ? str_dup(path) : NULL; aacs->cc = _read_cc_any(aacs); + aacs->bee = _get_bus_encryption_enabled(aacs); + aacs->bec = -1; error_code = _calc_title_hash(aacs); if (error_code != AACS_SUCCESS) { @@ -1324,18 +1353,20 @@ BD_DEBUG(DBG_AACS, "Failed to initialize AACS!\n"); } - aacs->bee = _get_bus_encryption_enabled(aacs); - aacs->bec = _get_bus_encryption_capable(aacs, path); - - if (error_code == AACS_SUCCESS && aacs->bee && aacs->bec) { + if (error_code == AACS_SUCCESS && aacs->bee) { if (!cf) { return AACS_ERROR_NO_CONFIG; } + if (aacs->bec < 0) { + aacs->bec = _get_bus_encryption_capable(aacs, path); + } + if (aacs->bec > 0) { error_code = _read_read_data_key(aacs, cf->host_cert_list); if (error_code != AACS_SUCCESS) { BD_DEBUG(DBG_AACS | DBG_CRIT, "Unable to initialize bus encryption required by drive and disc\n"); + } } } @@ -1367,10 +1398,15 @@ static void _decrypt_unit_bus(AACS *aacs, uint8_t *buf) { - if (aacs->bee && aacs->bec) { + if (aacs->bee && aacs->bec > 0) { unsigned int i; + int crypto_err; for (i = 0; i < ALIGNED_UNIT_LEN; i += SECTOR_LEN) { - _decrypt_bus(aacs, buf + i); + //_decrypt_bus(aacs, buf + i); + crypto_err = crypto_aacs_decrypt(aacs->read_data_key, buf + i + 16, SECTOR_LEN - 16, NULL, 0); + if (crypto_err) { + LOG_CRYPTO_ERROR(DBG_AACS, "bus decrypting failed", crypto_err); + } } } } @@ -1624,6 +1660,9 @@ uint32_t aacs_get_bus_encryption(AACS *aacs) { + if (aacs->bec < 0) { + aacs->bec = _get_bus_encryption_capable(aacs, aacs->path); + } return (aacs->bee * AACS_BUS_ENCRYPTION_ENABLED) | (aacs->bec * AACS_BUS_ENCRYPTION_CAPABLE); }
View file
libaacs-0.11.0.tar.bz2/src/libaacs/aacs.h -> libaacs-0.11.1.tar.bz2/src/libaacs/aacs.h
Changed
@@ -39,6 +39,7 @@ #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 */ +#define AACS_ERROR_UNKNOWN -9 /* some other failure, see logs */ AACS_PUBLIC const char *aacs_error_str(int error);
View file
libaacs-0.11.0.tar.bz2/src/libaacs/cci.c -> libaacs-0.11.1.tar.bz2/src/libaacs/cci.c
Changed
@@ -120,17 +120,25 @@ AACS_CCI *cci; const uint8_t *p = data; unsigned int ii; + unsigned num_entry; if (size < 16) { return NULL; } + num_entry = MKINT_BE16(p); + if (num_entry < 1 || num_entry > (2048-16)/6) { + BD_DEBUG(DBG_CCI | DBG_CRIT, "Invalid CCI header: %u entries\n", num_entry); + return NULL; + } + + cci = calloc(1, sizeof(*cci)); if (!cci) { return NULL; } - cci->num_entry = MKINT_BE16(p); + cci->num_entry = num_entry; p += 16; size -= 16;
View file
libaacs-0.11.0.tar.bz2/src/libaacs/content_cert.c -> libaacs-0.11.1.tar.bz2/src/libaacs/content_cert.c
Changed
@@ -72,6 +72,7 @@ size_t num_digest = MKINT_BE16(p + 12); size_t cert_data_len = 26 + length_format_specific + num_digest*8; + int crypto_error; if (len < cert_data_len + signature_size) { BD_DEBUG(DBG_AACS | DBG_CRIT, "Invalid content certificate (length %zu < %zu)\n", @@ -81,8 +82,9 @@ /* check signature */ - if (!crypto_aacs_verify_aacscc(p + cert_data_len, p, cert_data_len)) { - BD_DEBUG(DBG_AACS | DBG_CRIT, "Invalid content certificate signature\n"); + crypto_error = crypto_aacs_verify_aacscc(p + cert_data_len, p, cert_data_len); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_AACS, "content certificate signature verification failed", crypto_error); return NULL; }
View file
libaacs-0.11.0.tar.bz2/src/libaacs/crypto.c -> libaacs-0.11.1.tar.bz2/src/libaacs/crypto.c
Changed
@@ -106,18 +106,22 @@ point_free(&c->G); } -static void _aesg3(const uint8_t *src_key, uint8_t *dst_key, uint8_t inc) +BD_USED static int _aesg3(const uint8_t *src_key, uint8_t *dst_key, uint8_t inc) { - int a; + int a, err; uint8_t seed16 = { 0x7B, 0x10, 0x3C, 0x5D, 0xCB, 0x08, 0xC4, 0xE5, 0x1A, 0x27, 0xB0, 0x17, 0x99, 0x05, 0x3B, 0xD9 }; seed15 += inc; - crypto_aes128d(src_key, seed, dst_key); + err = crypto_aes128d(src_key, seed, dst_key); + if (err) + return err; for (a = 0; a < 16; a++) { dst_keya ^= seeda; } + + return err; } /* Initializes libgcrypt */ @@ -143,29 +147,61 @@ return crypto_init_check; } -void crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst) +int crypto_aes128e(const uint8_t *key, const uint8_t *data, uint8_t *dst) +{ + gcry_cipher_hd_t gcry_h; + gcry_error_t err; + + err = gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); + if (err) + return err; + + err = gcry_cipher_setkey(gcry_h, key, 16); + if (err) + goto error; + err = gcry_cipher_encrypt(gcry_h, dst, 16, data, data ? 16 : 0); + + error: + gcry_cipher_close(gcry_h); + return err; +} + +int crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst) { gcry_cipher_hd_t gcry_h; + gcry_error_t err; + + err = gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB, 0); + if (err) + return err; - 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); + err = gcry_cipher_setkey(gcry_h, key, 16); + if (err) + goto error; + err = gcry_cipher_decrypt(gcry_h, dst, 16, data, 16); + + error: gcry_cipher_close(gcry_h); + return err; } -void crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, uint8_t *pk) +int crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, uint8_t *pk) { + int err1 = 0, err2 = 0, err3 = 0; + if (lsubk) { - _aesg3(D, lsubk, 0); + err1 = _aesg3(D, lsubk, 0); } if (pk) { - _aesg3(D, pk, 1); + err2 = _aesg3(D, pk, 1); } if (rsubk) { - _aesg3(D, rsubk, 2); + err3 = _aesg3(D, rsubk, 2); } + + return err1 ? err1 : err2 ? err2 : err3; } /* @@ -179,19 +215,18 @@ for (i = 15; i >= 0; i--) { dsti = (srci << 1) | overflow; - overflow = srci >> 7; + overflow = srci >> 7; } } -static void _cmac_key(const unsigned char *aes_key, unsigned char *k1, unsigned char *k2) +BD_USED static int _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; + int err; - 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); + err = crypto_aes128e(aes_key, NULL, key); + if (err) + return err; _shl_128(k1, key); if (key0 & 0x80) { @@ -202,32 +237,86 @@ if (k10 & 0x80) { k215 ^= 0x87; } + + return err; } -void crypto_aes_cmac_16(const unsigned char *data, const unsigned char *aes_key, unsigned char *cmac) +int 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; + int err; /* - * Somplified version of AES CMAC. Spports only 16-byte input data. + * Simplified version of AES CMAC. Supports only 16-byte input data. */ /* generate CMAC keys */ - _cmac_key(aes_key, k1, k2); + + err = _cmac_key(aes_key, k1, k2); + if (err) + return err; 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); + + err = crypto_aes128e(aes_key, NULL, cmac); + + return err; +} + +/* + * + */ + +int crypto_aacs_decrypt(const uint8_t *key, uint8_t *out, size_t out_size, const uint8_t *in, size_t in_size) +{ + static const uint8_t aacs_iv16 = { 0x0b, 0xa0, 0xf8, 0xdd, 0xfe, 0xa6, 0x1f, 0xb3, + 0xd8, 0xdf, 0x9f, 0x56, 0x6a, 0x05, 0x0f, 0x78 }; + gcry_cipher_hd_t gcry_h; + gcry_error_t err; + + err = gcry_cipher_open(&gcry_h, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC, 0); + if (err) + return err; + + err = gcry_cipher_setkey(gcry_h, key, 16); + if (err) + goto error; + err = gcry_cipher_setiv(gcry_h, aacs_iv, 16); + if (err) + goto error; + err = gcry_cipher_decrypt(gcry_h, out, out_size, in, in_size); + + error: gcry_cipher_close(gcry_h); + return err; +} + +/* + * + */ + +void crypto_strerror(int err, char *buf, size_t buf_size) +{ +#if defined(HAVE_STRERROR_R) && defined(HAVE_LIBGPG_ERROR) + buf0 = 0; + gpg_strerror_r(err, buf, buf_size); +#else + const char *msg = gcry_strerror(err); + buf0 = 0; + if (msg) { + strncpy(buf, msg, buf_size); + bufbuf_size - 1 = 0; + } +#endif } +/* + * + */ #if defined(HAVE_STRERROR_R) && defined(HAVE_LIBGPG_ERROR) #define LOG_GCRY_ERROR(msg, func, err) \ @@ -340,7 +429,6 @@ ); if (!strfmt) { - BD_DEBUG(DBG_AACS | DBG_CRIT, "out of memory\n"); err = GPG_ERR_ENOMEM; goto error; } @@ -469,8 +557,8 @@ * */ -void crypto_aacs_sign(const uint8_t *cert, const uint8_t *priv_key, uint8_t *signature, - const uint8_t *nonce, const uint8_t *point) +int crypto_aacs_sign(const uint8_t *cert, const uint8_t *priv_key, uint8_t *signature, + const uint8_t *nonce, const uint8_t *point) { gcry_sexp_t sexp_key = NULL, sexp_data = NULL, sexp_sig = NULL, sexp_r = NULL, sexp_s = NULL; gcry_mpi_t mpi_r = NULL, mpi_s = NULL; @@ -480,7 +568,7 @@ GCRY_VERIFY("_aacs_sexp_key", _aacs_sexp_key(&sexp_key, cert + 12, cert + 32, priv_key, _aacs1_curve(), 20)); - /* Calculate the sha1 hash from the nonce and host key point and covert + /* Calculate the sha1 hash from the nonce and host key point and convert * the hash into an MPI. */ memcpy(&block0, nonce, 20); @@ -539,6 +627,8 @@ gcry_sexp_release(sexp_s); gcry_mpi_release(mpi_r); gcry_mpi_release(mpi_s); + + return err; } static int _aacs_verify(const uint8_t *signature, enum gcry_md_algos hash_type, @@ -562,8 +652,8 @@ key_len = 32; break; default: - BD_ASSERT_UNREACHABLE ("invalid signature size"); - return 0; + BD_ASSERT_UNREACHABLE ("invalid signature algorithm"); + return GPG_ERR_UNSUPPORTED_ALGORITHM; } GCRY_VERIFY("_aacs_sexp_key", @@ -588,17 +678,17 @@ int crypto_aacs_verify(const uint8_t *cert, const uint8_t *signature, const uint8_t *data, uint32_t len) { - return !_aacs_verify(signature, GCRY_MD_SHA1, cert + 12, cert + 32, data, len); + return _aacs_verify(signature, GCRY_MD_SHA1, cert + 12, cert + 32, data, len); } -int crypto_aacs_verify_aacsla(const uint8_t *signature, const uint8_t *data, uint32_t len) +int crypto_aacs_verify_aacsla(const uint8_t *signature, const uint8_t *data, uint32_t len) { static const uint8_t aacs_la_pubkey_x = {0x63, 0xC2, 0x1D, 0xFF, 0xB2, 0xB2, 0x79, 0x8A, 0x13, 0xB5, 0x8D, 0x61, 0x16, 0x6C, 0x4E, 0x4A, 0xAC, 0x8A, 0x07, 0x72 }; static const uint8_t aacs_la_pubkey_y = {0x13, 0x7E, 0xC6, 0x38, 0x81, 0x8F, 0xD9, 0x8F, 0xA4, 0xC3, 0x0B, 0x99, 0x67, 0x28, 0xBF, 0x4B, 0x91, 0x7F, 0x6A, 0x27 }; - return !_aacs_verify(signature, GCRY_MD_SHA1, aacs_la_pubkey_x, aacs_la_pubkey_y, data, len); + return _aacs_verify(signature, GCRY_MD_SHA1, aacs_la_pubkey_x, aacs_la_pubkey_y, data, len); } int crypto_aacs_verify_aacscc(const uint8_t *signature, const uint8_t *data, uint32_t len) @@ -613,23 +703,21 @@ 0x54, 0x5E, 0xCC, 0x27, 0x1E, 0xE4, 0x6C, 0x4A, 0xEF, 0x81, 0xD9, 0x16, 0x9B, 0xF8, 0x41, 0x72 }; switch (data0) { case 0x00: /* AACS 1 */ - return !_aacs_verify(signature, GCRY_MD_SHA1, aacs_cc_pubkey_x, aacs_cc_pubkey_y, data, len); + return _aacs_verify(signature, GCRY_MD_SHA1, aacs_cc_pubkey_x, aacs_cc_pubkey_y, data, len); case 0x10: /* AACS 2 */ - return !_aacs_verify(signature, GCRY_MD_SHA256, aacs2_cc_pubkey_x, aacs2_cc_pubkey_y, data, len); + return _aacs_verify(signature, GCRY_MD_SHA256, aacs2_cc_pubkey_x, aacs2_cc_pubkey_y, data, len); default: - BD_DEBUG(DBG_AACS | DBG_CRIT, "Unknown content certificate type 0x%02x\n", data0); break; } - return 0; + return GPG_ERR_UNSUPPORTED_CERT; } -static int crypto_aacs_verify_cert(const uint8_t *cert) +static int _aacs_verify_cert(const uint8_t *cert) { + /* check length byte */ if (MKINT_BE16(cert+2) != 0x5c) { - BD_DEBUG(DBG_AACS, "Certificate length is invalid (0x%04x), expected 0x005c\n", - MKINT_BE16(cert+2)); - return 0; + return GPG_ERR_UNSUPPORTED_CERT; } return crypto_aacs_verify_aacsla(cert + 52, cert, 52); @@ -642,19 +730,13 @@ break; case 0x12: // XXX checking the signature would cause buffer overread (certificate is truncated in config file) - BD_DEBUG(DBG_AACS | DBG_CRIT, "AACS 2.0 host certificate not supported\n"); - return 0; + /* BD_DEBUG(DBG_AACS | DBG_CRIT, "AACS 2.0 host certificate not supported\n"); */ + return GPG_ERR_UNSUPPORTED_CERT; default: - BD_DEBUG(DBG_AACS, "Host certificate type is invalid (0x%02x)\n", cert0); - return 0; + return GPG_ERR_UNSUPPORTED_CERT; } - if (!crypto_aacs_verify_cert(cert)) { - BD_DEBUG(DBG_AACS, "Host certificate signature is invalid\n"); - return 0; - } - - return 1; + return _aacs_verify_cert(cert); } int crypto_aacs_verify_drive_cert(const uint8_t *cert) @@ -663,20 +745,14 @@ case 0x01: break; case 0x11: - BD_DEBUG(DBG_AACS | DBG_CRIT, "WARNING: Drive is using AACS 2.0 certificate\n"); + /* BD_DEBUG(DBG_AACS | DBG_CRIT, "WARNING: Drive is using AACS 2.0 certificate\n"); */ // XXX checking the signature would cause buffer overread (certificate is truncated at MMC layer) - return 0; + return GPG_ERR_UNSUPPORTED_CERT; default: - BD_DEBUG(DBG_AACS, "Drive certificate type is invalid (0x%02x)\n", cert0); - return 0; - } - - if (!crypto_aacs_verify_cert(cert)) { - BD_DEBUG(DBG_AACS, "Drive certificate signature is invalid\n"); - return 0; + return GPG_ERR_UNSUPPORTED_CERT; } - return 1; + return _aacs_verify_cert(cert); } void crypto_aacs_title_hash(const uint8_t *ukf, uint64_t len, uint8_t *hash)
View file
libaacs-0.11.0.tar.bz2/src/libaacs/crypto.h -> libaacs-0.11.1.tar.bz2/src/libaacs/crypto.h
Changed
@@ -25,22 +25,32 @@ #include <stdlib.h> #include <stdint.h> -BD_PRIVATE int crypto_init(void); -BD_PRIVATE void crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst); -BD_PRIVATE void crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, - uint8_t *pk); // returns left, centre, right keys -BD_PRIVATE void crypto_aes_cmac_16(const unsigned char *data, const unsigned char *aes_key, unsigned char *cmac); - -BD_PRIVATE void crypto_aacs_sign(const uint8_t *cert, const uint8_t *priv_key, +BD_PRIVATE void crypto_strerror(int err, char *buf, size_t buf_size); +#define LOG_CRYPTO_ERROR(flags, str, err) do { \ + char s64; \ + crypto_strerror((err), s, sizeof(s)); \ + BD_DEBUG(DBG_CRIT | (flags), "crypto error: %s: %s (%u)\n", (str), s, (unsigned)(err)); \ + } while (0) + +BD_PRIVATE int crypto_init(void) BD_USED; +BD_PRIVATE int crypto_aes128e(const uint8_t *key, const uint8_t *data, uint8_t *dst) BD_USED; +BD_PRIVATE int crypto_aes128d(const uint8_t *key, const uint8_t *data, uint8_t *dst) BD_USED; +BD_PRIVATE int crypto_aesg3(const uint8_t *D, uint8_t *lsubk, uint8_t* rsubk, + uint8_t *pk) BD_USED; // returns left, centre, right keys +BD_PRIVATE int crypto_aes_cmac_16(const unsigned char *data, const unsigned char *aes_key, unsigned char *cmac) BD_USED; + +BD_PRIVATE int crypto_aacs_decrypt(const uint8_t *key, uint8_t *out, size_t out_size, const uint8_t *in, size_t in_size) BD_USED; + +BD_PRIVATE int crypto_aacs_sign(const uint8_t *cert, const uint8_t *priv_key, uint8_t *signature, - const uint8_t *nonce, const uint8_t *point); + const uint8_t *nonce, const uint8_t *point) BD_USED; BD_PRIVATE void crypto_aacs_title_hash(const uint8_t *ukf, uint64_t len, uint8_t *hash); -BD_PRIVATE int crypto_aacs_verify(const uint8_t *cert, const uint8_t *signature, const uint8_t *data, uint32_t len); -BD_PRIVATE int crypto_aacs_verify_aacsla(const uint8_t *signature, const uint8_t *data, uint32_t len); -BD_PRIVATE int crypto_aacs_verify_aacscc(const uint8_t *signature, const uint8_t *data, uint32_t len); -BD_PRIVATE int crypto_aacs_verify_host_cert(const uint8_t *cert); -BD_PRIVATE int crypto_aacs_verify_drive_cert(const uint8_t *cert); +BD_PRIVATE int crypto_aacs_verify(const uint8_t *cert, const uint8_t *signature, const uint8_t *data, uint32_t len) BD_USED; +BD_PRIVATE int crypto_aacs_verify_aacsla(const uint8_t *signature, const uint8_t *data, uint32_t len) BD_USED; +BD_PRIVATE int crypto_aacs_verify_aacscc(const uint8_t *signature, const uint8_t *data, uint32_t len) BD_USED; +BD_PRIVATE int crypto_aacs_verify_host_cert(const uint8_t *cert) BD_USED; +BD_PRIVATE int crypto_aacs_verify_drive_cert(const uint8_t *cert) BD_USED; BD_PRIVATE void crypto_create_host_key_pair(uint8_t *key, uint8_t *key_point); BD_PRIVATE void crypto_create_nonce(uint8_t *buf, size_t len);
View file
libaacs-0.11.0.tar.bz2/src/libaacs/mkb.c -> libaacs-0.11.1.tar.bz2/src/libaacs/mkb.c
Changed
@@ -41,14 +41,20 @@ while (pos + 4 <= mkb->size) { len = MKINT_BE24(mkb->buf + pos + 1); - if (rec_len) { - *rec_len = len; - } - if (mkb->bufpos == type) { BD_DEBUG(DBG_MKB, "Retrieved MKB record 0x%02x (%p)\n", type, (void*)(mkb->buf + pos)); + if (len > mkb->size - pos) { + BD_DEBUG(DBG_MKB | DBG_CRIT, "Ignoring truncated MKB record 0x%02x @ %zu, size %zu (%p)\n", type, pos, len, + (void*)(mkb->buf + pos)); + return NULL; + } + + if (rec_len) { + *rec_len = len; + } + return mkb->buf + pos; } @@ -107,9 +113,30 @@ pos += MKINT_BE24(mkb->buf + pos + 1); } + if (pos > mkb->size) { + BD_DEBUG(DBG_MKB | DBG_CRIT, "mkb_data_size(): invalid or truncated MKB\n"); + return mkb->size; + } + + BD_DEBUG(DBG_MKB, "MKB data size %zu bytes\n", pos); return pos; } +static const uint8_t *_simple_record(MKB *mkb, uint8_t type, size_t *len) +{ + const uint8_t *rec = _record(mkb, type, len); + + if (*len < 4) { + return NULL; + } + if (rec) { + rec += 4; + *len -= 4; + } + + return rec; +} + uint32_t mkb_type(MKB *mkb) { @@ -145,65 +172,24 @@ return rec; } - const uint8_t *mkb_host_revokation_entries(MKB *mkb, size_t *len) { - const uint8_t *rec = _record(mkb, 0x21, len); - - if (*len < 4) { - return NULL; - } - if (rec) { - rec += 4; - *len -= 4; - } - - return rec; + return _simple_record(mkb, 0x21, len); } const uint8_t *mkb_drive_revokation_entries(MKB *mkb, size_t *len) { - const uint8_t *rec = _record(mkb, 0x20, len); - - if (*len < 4) { - return NULL; - } - if (rec) { - rec += 4; - *len -= 4; - } - - return rec; + return _simple_record(mkb, 0x20, len); } const uint8_t *mkb_subdiff_records(MKB *mkb, size_t *len) { - const uint8_t *rec = _record(mkb, 0x04, len); - - if (*len < 4) { - return NULL; - } - if (rec) { - rec += 4; - *len -= 4; - } - - return rec; + return _simple_record(mkb, 0x04, len); } const uint8_t *mkb_cvalues(MKB *mkb, size_t *len) { - const uint8_t *rec = _record(mkb, 0x05, len); - - if (*len < 4) { - return NULL; - } - if (rec) { - rec += 4; - *len -= 4; - } - - return rec; + return _simple_record(mkb, 0x05, len); } const uint8_t *mkb_mk_dv(MKB *mkb) @@ -225,33 +211,18 @@ break; } - rec = _record(mkb, dv_record, &len); + rec = _simple_record(mkb, dv_record, &len); - if (len < 20) { + if (len < 16) { return NULL; } - if (rec) { - rec += 4; - } - return rec; } const uint8_t *mkb_signature(MKB *mkb, size_t *len) { - const uint8_t *rec = _record(mkb, 0x02, len); - - if (*len < 4) { - return NULL; - } - if (rec) { - rec += 4; - *len -= 4; - } - - return rec; - + return _simple_record(mkb, 0x02, len); } static int _cert_is_revoked(const uint8_t *rl, size_t rl_size, const uint8_t *cert_id_bin)
View file
libaacs-0.11.0.tar.bz2/src/libaacs/mkb.h -> libaacs-0.11.1.tar.bz2/src/libaacs/mkb.h
Changed
@@ -77,7 +77,7 @@ * 0 | type = 0x21 * 1-3 | length * 4-7 | total entries - * 8-11 | entires in signature block 1 (N1) + * 8-11 | entries in signature block 1 (N1) * 12-19 | host revokation list entry 0 * . * . @@ -93,7 +93,7 @@ * 0 | type = 0x20 * 1-3 | length * 4-7 | total entries - * 8-11 | entires in signature block 1 (N1) + * 8-11 | entries in signature block 1 (N1) * 12-19 | drive revokation list entry 0 * . * .
View file
libaacs-0.11.0.tar.bz2/src/libaacs/mmc.c -> libaacs-0.11.1.tar.bz2/src/libaacs/mmc.c
Changed
@@ -259,6 +259,11 @@ BD_DEBUG(DBG_MMC, "got mkb: pack 0/%d %d bytes\n", num_packs, len); + if (len <= 0 || len > 32768) { + BD_DEBUG(DBG_MMC | DBG_CRIT, "invalid pack\n"); + return NULL; + } + mkb = malloc(32768 * num_packs); if (!mkb) { BD_DEBUG(DBG_MMC | DBG_CRIT, "out of memory\n"); @@ -272,7 +277,10 @@ if (_mmc_report_disc_structure(mmc, agid, 0x83, layer, pack, buf, sizeof(buf))) { len = MKINT_BE16(buf) - 2; BD_DEBUG(DBG_MMC, "got mkb: pack %d/%d %d bytes\n", pack, num_packs, len); - + if (len <= 0 || len > 32768) { + BD_DEBUG(DBG_MMC | DBG_CRIT, "invalid pack\n"); + break; + } memcpy(mkb + *size, buf + 4, len); *size += len; } else { @@ -427,17 +435,24 @@ const uint8_t *nonce, const uint8_t *point) { uint8_t data60; + int crypto_error; memcpy(data, nonce, 20); memcpy(data + 20, point, 40); - return crypto_aacs_verify(cert, signature, data, 60); + crypto_error = crypto_aacs_verify(cert, signature, data, 60); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_MMC, "signature verification failed", crypto_error); + } + + return (crypto_error == 0); } 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 hks40, dn20, dkp40, dks40; char str512; + int crypto_error; memset(hks, 0, sizeof(hks)); @@ -472,9 +487,15 @@ BD_DEBUG(DBG_MMC, "Drive nonce : %s\n", str_print_hex(str, dn, 20)); } + if (mmc->drive_cert0 == 0x11) { + BD_DEBUG(DBG_AACS | DBG_CRIT, "WARNING: Drive is using AACS 2.0 certificate\n"); + return MMC_ERROR; + } + // verify drive certificate - if (!crypto_aacs_verify_drive_cert(mmc->drive_cert)) { - BD_DEBUG(DBG_MMC | DBG_CRIT, "Drive certificate is invalid\n"); + crypto_error = crypto_aacs_verify_drive_cert(mmc->drive_cert); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_MMC, "drive certificate signature verification failed", crypto_error); return MMC_ERROR; } @@ -496,8 +517,11 @@ } // sign - crypto_aacs_sign(host_cert, host_priv_key, hks, dn, - mmc->host_key_point); + crypto_error = crypto_aacs_sign(host_cert, host_priv_key, hks, dn, mmc->host_key_point); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_MMC, "Signing failed", crypto_error); + return MMC_ERROR; + } // verify own signature if (!_verify_signature(host_cert, hks, dn, mmc->host_key_point)) { @@ -531,6 +555,7 @@ { uint8_t mac16, calc_mac16; char str512; + int err; BD_DEBUG(DBG_MMC, "Reading VID from drive...\n"); @@ -541,9 +566,14 @@ } /* verify MAC */ - crypto_aes_cmac_16(vid, bus_key, calc_mac); + err = crypto_aes_cmac_16(vid, bus_key, calc_mac); + if (err) { + LOG_CRYPTO_ERROR(DBG_MMC, "VID MAC calculation failed", err); + return MMC_ERROR; + } if (memcmp(calc_mac, mac, 16)) { BD_DEBUG(DBG_MMC | DBG_CRIT, "VID MAC is incorrect. This means this Volume ID is not correct.\n"); + return MMC_ERROR; } return MMC_SUCCESS; @@ -558,6 +588,7 @@ { uint8_t mac16, calc_mac16; char str512; + int err; BD_DEBUG(DBG_MMC, "Reading PMSN from drive...\n"); @@ -568,9 +599,14 @@ } /* verify MAC */ - crypto_aes_cmac_16(pmsn, bus_key, calc_mac); + err = crypto_aes_cmac_16(pmsn, bus_key, calc_mac); + if (err) { + LOG_CRYPTO_ERROR(DBG_MMC, "PMSN MAC calculation failed", err); + return MMC_ERROR; + } if (memcmp(calc_mac, mac, 16)) { BD_DEBUG(DBG_MMC | DBG_CRIT, "PMSN MAC is incorrect. This means this Pre-recorded Medial Serial Number is not correct.\n"); + return MMC_ERROR; } return MMC_SUCCESS; @@ -591,13 +627,21 @@ if (_mmc_read_data_keys(mmc, agid, encrypted_read_data_key, encrypted_write_data_key)) { if (read_data_key) { - crypto_aes128d(bus_key, encrypted_read_data_key, read_data_key); + int err = crypto_aes128d(bus_key, encrypted_read_data_key, read_data_key); + if (err) { + LOG_CRYPTO_ERROR(DBG_MMC, "decrypting read data key failed", err); + return MMC_ERROR; + } if (DEBUG_KEYS) { BD_DEBUG(DBG_MMC, "READ DATA KEY : %s\n", str_print_hex(str, read_data_key, 16)); } } if (write_data_key) { - crypto_aes128d(bus_key, encrypted_write_data_key, write_data_key); + int err = crypto_aes128d(bus_key, encrypted_write_data_key, write_data_key); + if (err) { + LOG_CRYPTO_ERROR(DBG_MMC, "decrypting write data key failed", err); + return MMC_ERROR; + } if (DEBUG_KEYS) { BD_DEBUG(DBG_MMC, "WRITE DATA KEY : %s\n", str_print_hex(str, write_data_key, 16)); } @@ -664,6 +708,7 @@ int mmc_read_drive_cert(MMC *mmc, uint8_t *drive_cert) { uint8_t buf116; + int crypto_error; if (mmc->drive_cert0 == 0x01) { memcpy(drive_cert, mmc->drive_cert, 92); @@ -681,8 +726,9 @@ return MMC_ERROR; } - if (!crypto_aacs_verify_drive_cert(buf + 4)) { - BD_DEBUG(DBG_MMC | DBG_CRIT, "Drive certificate is invalid\n"); + crypto_error = crypto_aacs_verify_drive_cert(buf + 4); + if (crypto_error) { + LOG_CRYPTO_ERROR(DBG_MMC, "drive certificate signature verification failed", crypto_error); return MMC_ERROR; }
View file
libaacs-0.11.0.tar.bz2/src/libaacs/unit_key.c -> libaacs-0.11.1.tar.bz2/src/libaacs/unit_key.c
Changed
@@ -66,7 +66,7 @@ uk->num_bdmv_dir = p17; uk->use_skb_mkb = p18 >> 7; - /* check if suported */ + /* check if supported */ if (uk->num_bdmv_dir < 1) { BD_DEBUG(DBG_UK | DBG_CRIT, "No BDMV directories\n"); @@ -106,6 +106,11 @@ top_menu = MKINT_BE16(p + 22); num_titles = MKINT_BE16(p + 24); + if (num_titles > 0xffff - 2) { + BD_DEBUG(DBG_UK | DBG_CRIT, "Invalid title count %u\n", num_titles); + return -1; + } + BD_DEBUG(DBG_UK, "Title FP : CPS unit %d\n", first_play); BD_DEBUG(DBG_UK, "Title TM : CPS unit %d\n", top_menu); @@ -148,6 +153,9 @@ const uint8_t empty_key16 = {0}; uint32_t uk_pos; unsigned int i; + unsigned num_uk; + + uk->num_uk = 0; if (size < 4) { BD_DEBUG(DBG_UK | DBG_CRIT, "Empty unit key file\n"); @@ -158,23 +166,27 @@ uk_pos = MKINT_BE32(p); - if (size < uk_pos + 2) { + if (size - 2 < uk_pos) { BD_DEBUG(DBG_UK | DBG_CRIT, "Unexpected EOF (key data missing)\n"); return -1; } - uk->num_uk = MKINT_BE16(p + uk_pos); - if (uk->num_uk < 1) { + num_uk = MKINT_BE16(p + uk_pos); + if (num_uk < 1) { BD_DEBUG(DBG_UK | DBG_CRIT, "No unit keys\n"); return 0; } - if (size < uk_pos + 48 * uk->num_uk + 16) { + if (size - uk_pos < 16) { + BD_DEBUG(DBG_UK | DBG_CRIT, "Unexpected EOF (key data truncated)\n"); + return -1; + } + if ((size - uk_pos - 16) / 48 < num_uk) { BD_DEBUG(DBG_UK | DBG_CRIT, "Unexpected EOF (key data truncated)\n"); return -1; } - if (aacs2 && uk->num_uk > 1) { + if (aacs2 && num_uk > 1) { /* do some sanity checks ... */ if (!memcmp(empty_key, p + 48 + 48 + 16, 16)) { BD_DEBUG(DBG_UK | DBG_CRIT, "AACS2 unit key not found from expected location ?\n"); @@ -187,17 +199,17 @@ /* alloc storage for keys */ - uk->enc_uk = calloc(uk->num_uk, sizeof(AACS_UK)); + uk->enc_uk = calloc(num_uk, sizeof(AACS_UK)); if (!uk->enc_uk) { BD_DEBUG(DBG_UK | DBG_CRIT, "Out of memory\n"); return -1; } - BD_DEBUG(DBG_UK, "%d CPS unit keys (AACS%d)\n", uk->num_uk, aacs2 ? 2 : 1); + BD_DEBUG(DBG_UK, "%d CPS unit keys (AACS%d)\n", num_uk, aacs2 ? 2 : 1); /* get encrypted keys */ - for (i = 0; i < uk->num_uk; i++) { + for (i = 0; i < num_uk; i++) { uk_pos += 48; memcpy(uk->enc_uki.key, p + uk_pos, 16); @@ -212,6 +224,7 @@ } } + uk->num_uk = num_uk; return 0; }
View file
libaacs-0.11.0.tar.bz2/src/util/strutl.c -> libaacs-0.11.1.tar.bz2/src/util/strutl.c
Changed
@@ -25,7 +25,6 @@ #include "strutl.h" #include "macro.h" -#include "logging.h" #include <stdio.h> #include <stdarg.h> @@ -111,7 +110,6 @@ break; default: - BD_DEBUG(DBG_AACS, "Invalid hex value '%c'", c); return 0; } @@ -214,7 +212,6 @@ /* check end */ if (isxdigit(strii)) { - //BD_DEBUG(DBG_AACS, "Invalid hex string (too long): %s", str); return 0; } @@ -252,7 +249,7 @@ static const char nibble16 = "0123456789abcdef"; int zz; for (zz = 0; zz < count; zz++) { - outzz*2 = nibblebufzz >> 4; + outzz*2 = nibble(bufzz >> 4) & 0xf; outzz*2 + 1 = nibblebufzz & 0x0f; } outzz*2 = 0;
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
.