Hello community, here is the log from the commit of package ykpers for openSUSE:Factory checked in at 2019-02-20 14:11:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ykpers (Old) and /work/SRC/openSUSE:Factory/.ykpers.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ykpers" Wed Feb 20 14:11:55 2019 rev:7 rq:677376 version:1.19.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ykpers/ykpers.changes 2018-10-01 09:08:42.019723930 +0200 +++ /work/SRC/openSUSE:Factory/.ykpers.new.28833/ykpers.changes 2019-02-20 14:12:01.786925480 +0100 @@ -1,0 +2,17 @@ +Tue Feb 19 14:15:03 UTC 2019 - Karol Babioch <[email protected]> + +- Version 1.19.2 (released 2019-02-19) + - Fix test on mac. + - Fix serial read and challenge response. + +------------------------------------------------------------------- +Tue Feb 19 10:20:25 UTC 2019 - Karol Babioch <[email protected]> + +- Version 1.19.1 (released 2019-02-19) + - Error out on json output with randomSeed. + - Validate more length fields. + - Use correct FormatMessage function on windows. + - Overflow, bounds and error condition checks. + - Try to zero sensitive memory better. + +------------------------------------------------------------------- Old: ---- ykpers-1.19.0.tar.gz ykpers-1.19.0.tar.gz.sig New: ---- ykpers-1.19.2.tar.gz ykpers-1.19.2.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ykpers.spec ++++++ --- /var/tmp/diff_new_pack.jNnVX3/_old 2019-02-20 14:12:02.582925215 +0100 +++ /var/tmp/diff_new_pack.jNnVX3/_new 2019-02-20 14:12:02.582925215 +0100 @@ -1,7 +1,7 @@ # # spec file for package ykpers # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: ykpers -Version: 1.19.0 +Version: 1.19.2 Release: 0 Summary: Reference implementation for configuration of YubiKeys License: BSD-2-Clause ++++++ ykpers-1.19.0.tar.gz -> ykpers-1.19.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ChangeLog new/ykpers-1.19.2/ChangeLog --- old/ykpers-1.19.0/ChangeLog 2018-04-24 10:28:49.000000000 +0200 +++ new/ykpers-1.19.2/ChangeLog 2019-02-19 14:14:34.000000000 +0100 @@ -1,3 +1,116 @@ +2019-02-19 Klas Lindfors <[email protected]> + + * NEWS: NEWS for 1.19.2 + +2019-02-19 Klas Lindfors <[email protected]> + + * : Merge pull request #134 from Yubico/expect_fix ykcore: fix broken check for expected length from device + +2019-02-19 Klas Lindfors <[email protected]> + + * : Merge pull request #135 from Yubico/mac_is_bsd tests: osx is a bsd variant as well + +2019-02-19 Klas Lindfors <[email protected]> + + * ykpers4win.mk: bump libjson for windows + +2019-02-19 Klas Lindfors <[email protected]> + + * NEWS, configure.ac: bump version to 1.19.2 + +2019-02-19 Klas Lindfors <[email protected]> + + * NEWS: NEWS for 1.19.1 + +2019-02-19 Klas Lindfors <[email protected]> + + * : commit 4fda553da54123dfaac17856242a016bb3ae3f6d Merge: f8af9d0 + b7a9673 Author: Klas Lindfors <[email protected]> Date: Mon Feb 18 + 14:56:53 2019 +0100 + +2019-02-18 Trevor Bentley <[email protected]> + + * ykcore/Makefile.am: Add ykbzero to Makefile + +2019-01-25 Trevor Bentley <[email protected]> + + * ykpers-json.c: Fix: Exported JSON might not be null terminated + +2019-01-25 Trevor Bentley <[email protected]> + + * tests/test_args_to_config.c, ykpers-args.c, ykpers-args.h, + ykpersonalize.c: Fix: possible buffer overflows in CLI argument + parsing + +2019-01-25 Trevor Bentley <[email protected]> + + * ykpers-args.c, ykpersonalize.c: Fix: possible out-of-bounds access + after fgets() + +2019-01-21 Trevor Bentley <[email protected]> + + * ykpers.c: Fix: handle snprintf errors + +2019-01-18 Trevor Bentley <[email protected]> + + * configure.ac, ykcore/ykbzero.h, ykcore/ykcore.c: Fix: clear + sensitive stack variables after use + +2019-01-18 Trevor Bentley <[email protected]> + + * ykcore/ykcore.c: Fix: validate key responses are expected length + +2019-01-18 Trevor Bentley <[email protected]> + + * ykpbkdf2.c: Fix: bounds check of PBKDF2 salt length + +2019-01-18 Trevor Bentley <[email protected]> + + * ykpers.c: Fix: check for overflows when using snprintf + +2019-02-07 Heiko Becker <[email protected]> + + * tests/test_args_to_config.c: Handle the *BSDs specifically instead + of glibc and win After all they appear to be different in that regard. This also + fixes building with musl (#115). + +2019-01-02 Klas Lindfors <[email protected]> + + * : commit cfbc245bbf9218717623d2a4cb076f05179227d4 Author: Tero + Paloheimo <[email protected]> Date: Tue Jan 1 21:38:46 2019 + +0200 + +2018-11-13 Klas Lindfors <[email protected]> + + * : commit 6db09804f638478bdcb396973f07a871dbcda105 Author: Yonghyun + Kim <[email protected]> Date: Tue Nov 13 08:45:55 2018 +0900 + +2018-11-13 Klas Lindfors <[email protected]> + + * : commit 77e6316651a21cfa2b18b392da8524c0010b8284 Author: Yonghyun + Kim <[email protected]> Date: Tue Nov 13 08:50:42 2018 +0900 + +2018-10-24 Klas Lindfors <[email protected]> + + * : commit a89947138c0e32e3aa3220d91a28520545c9ffa9 Author: Tero + Paloheimo <[email protected]> Date: Wed Oct 24 17:27:49 2018 + +0300 + +2018-10-16 Klas Lindfors <[email protected]> + + * : commit 67db50e3b6b6489b8b75d5a970071b98953a11ea Author: Gabriel + Kihlman <[email protected]> Date: Tue Oct 16 13:53:56 2018 + +0200 + +2018-09-17 Klas Lindfors <[email protected]> + + * ykpers-json.c: json: error out on randomSeed instead of silently + not providing it also don't set ykp_errno when there's no error + +2018-04-24 Klas Lindfors <[email protected]> + + * NEWS, configure.ac: bump versions after release + 2018-04-24 Klas Lindfors <[email protected]> * NEWS: NEWS for 1.19.0 @@ -3331,8 +3444,9 @@ 2012-02-19 Clemens Lang <[email protected]> * ykcore/ykcore_osx.c: Don't set yk_errno if nothing went wrong This fixes a superfluous warning when using challenge-response - authentication with yubico-pam on OS X: debug: pam_yubico.c:649 (do_challenge_response): USB error: USB - error This warning appeared although no error actually occured. + authentication with yubico-pam on OS X: debug: pam_yubico.c:649 (do_challenge_response): USB error: + USB error This warning appeared although no error actually + occured. 2012-02-18 Clemens Lang <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/Makefile.in new/ykpers-1.19.2/Makefile.in --- old/ykpers-1.19.0/Makefile.in 2018-04-20 10:08:42.000000000 +0200 +++ new/ykpers-1.19.2/Makefile.in 2019-02-19 13:30:30.000000000 +0100 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1092,7 +1092,7 @@ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -1118,7 +1118,7 @@ @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -1136,7 +1136,7 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -1146,7 +1146,7 @@ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/NEWS new/ykpers-1.19.2/NEWS --- old/ykpers-1.19.0/NEWS 2018-04-24 10:28:46.000000000 +0200 +++ new/ykpers-1.19.2/NEWS 2019-02-19 14:14:18.000000000 +0100 @@ -1,5 +1,23 @@ Yubikey-personalize NEWS -- History of user-visible changes. -*- outline -*- +* Version 1.19.2 (released 2019-02-19) + +** Fix test on mac. + +** Fix serial read and challenge response. + +* Version 1.19.1 (released 2019-02-19) + +** Error out on json output with randomSeed. + +** Validate more length fields. + +** Use correct FormatMessage function on windows. + +** Overflow, bounds and error condition checks. + +** Try to zero sensitive memory better. + * Version 1.19.0 (released 2018-04-24) ** Add yk_write_device_info(). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/README new/ykpers-1.19.2/README --- old/ykpers-1.19.0/README 2017-12-11 08:47:07.000000000 +0100 +++ new/ykpers-1.19.2/README 2019-01-02 08:58:41.000000000 +0100 @@ -42,7 +42,7 @@ The JSON library is an optional dependency, see: https://github.com/json-c/json-c/wiki - Debian: apt-get install libjson0-dev + Debian: apt-get install libjson-c-dev You need json-c version 0.10 or later to get pretty printing of JSON output. This project will build with version 0.9 too, but will not @@ -75,7 +75,11 @@ ----------- -When building from source Yubikey-personaliztion depends on link:http://asciidoc.org/INSTALL.html[asciidoc] to build its manpage. +When building from source Yubikey-personalization depends on link:http://asciidoc.org/INSTALL.html[asciidoc], xsltproc and DocBook to build its manpage. + +----------- + Debian: apt-get install asciidoc xsltproc docbook-xsl +----------- Autoconf, automake and libtool must be installed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/aclocal.m4 new/ykpers-1.19.2/aclocal.m4 --- old/ykpers-1.19.0/aclocal.m4 2018-04-20 10:08:42.000000000 +0200 +++ new/ykpers-1.19.2/aclocal.m4 2019-02-19 13:30:30.000000000 +0100 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 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-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 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.15' 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.15], [], +m4_if([$1], [1.15.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,12 @@ # 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.15])dnl +[AM_AUTOMAKE_VERSION([1.15.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +201,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,7 +392,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -468,7 +468,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -665,7 +665,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -686,7 +686,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -707,7 +707,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -757,7 +757,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -796,7 +796,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -825,7 +825,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -872,7 +872,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -891,7 +891,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -972,7 +972,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1032,7 +1032,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1060,7 +1060,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1079,7 +1079,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/configure new/ykpers-1.19.2/configure --- old/ykpers-1.19.0/configure 2018-04-20 10:08:43.000000000 +0200 +++ new/ykpers-1.19.2/configure 2019-02-19 13:30:31.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for yubikey-personalization 1.19.0. +# Generated by GNU Autoconf 2.69 for yubikey-personalization 1.19.2. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='yubikey-personalization' PACKAGE_TARNAME='ykpers' -PACKAGE_VERSION='1.19.0' -PACKAGE_STRING='yubikey-personalization 1.19.0' +PACKAGE_VERSION='1.19.2' +PACKAGE_STRING='yubikey-personalization 1.19.2' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='https://developers.yubico.com/yubikey-personalization/' @@ -1386,7 +1386,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 yubikey-personalization 1.19.0 to adapt to many kinds of systems. +\`configure' configures yubikey-personalization 1.19.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,7 +1457,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yubikey-personalization 1.19.0:";; + short | recursive ) echo "Configuration of yubikey-personalization 1.19.2:";; esac cat <<\_ACEOF @@ -1590,7 +1590,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yubikey-personalization configure 1.19.0 +yubikey-personalization configure 1.19.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1868,7 +1868,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yubikey-personalization $as_me 1.19.0, which was +It was created by yubikey-personalization $as_me 1.19.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2253,7 +2253,7 @@ # Interfaces removed: AGE=0 LT_CURRENT=20 -LT_REVISION=0 +LT_REVISION=2 LT_AGE=19 @@ -2744,7 +2744,7 @@ # Define the identity of the package. PACKAGE='ykpers' - VERSION='1.19.0' + VERSION='1.19.2' cat >>confdefs.h <<_ACEOF @@ -14903,6 +14903,49 @@ fi +# Enable more secure memset if available +for ac_func in memset_s explicit_bzero explicit_memset +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use inline asm code" >&5 +$as_echo_n "checking whether we can use inline asm code... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int a = 42; + int *pnt = &a; + __asm__ __volatile__ ("" : : "r"(pnt) : "memory"); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_INLINE_ASM 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # Check whether --enable-ld-version-script was given. if test "${enable_ld_version_script+set}" = set; then : @@ -15982,7 +16025,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yubikey-personalization $as_me 1.19.0, which was +This file was extended by yubikey-personalization $as_me 1.19.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16040,7 +16083,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -yubikey-personalization config.status 1.19.0 +yubikey-personalization config.status 1.19.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/configure.ac new/ykpers-1.19.2/configure.ac --- old/ykpers-1.19.0/configure.ac 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/configure.ac 2019-02-19 13:29:54.000000000 +0100 @@ -26,7 +26,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -AC_INIT([yubikey-personalization], [1.19.0], +AC_INIT([yubikey-personalization], [1.19.2], [[email protected]], [ykpers], [https://developers.yubico.com/yubikey-personalization/]) AC_CONFIG_AUX_DIR([build-aux]) @@ -37,7 +37,7 @@ # Interfaces added: AGE++ # Interfaces removed: AGE=0 AC_SUBST(LT_CURRENT, 20) -AC_SUBST(LT_REVISION,0) +AC_SUBST(LT_REVISION,2) AC_SUBST(LT_AGE, 19) AM_INIT_AUTOMAKE([1.11.3 -Wall -Werror]) @@ -165,6 +165,20 @@ AC_SUBST([udevrulesfile], [$udevrulesfile]) fi +# Enable more secure memset if available +AC_CHECK_FUNCS([memset_s explicit_bzero explicit_memset]) +AC_MSG_CHECKING(whether we can use inline asm code) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[ + int a = 42; + int *pnt = &a; + __asm__ __volatile__ ("" : : "r"(pnt) : "memory"); + ]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_INLINE_ASM], [1], [inline asm code can be used])] + [AC_MSG_RESULT(no)] +) + gl_LD_VERSION_SCRIPT gl_VALGRIND_TESTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/tests/Makefile.in new/ykpers-1.19.2/tests/Makefile.in --- old/ykpers-1.19.0/tests/Makefile.in 2018-04-20 10:08:42.000000000 +0200 +++ new/ykpers-1.19.2/tests/Makefile.in 2019-02-19 13:30:31.000000000 +0100 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/tests/test_args_to_config.c new/ykpers-1.19.2/tests/test_args_to_config.c --- old/ykpers-1.19.0/tests/test_args_to_config.c 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/tests/test_args_to_config.c 2019-02-19 14:13:56.000000000 +0100 @@ -132,22 +132,22 @@ ykp_errno = 0; /* getopt reinit (BSD systems use optreset and a different optind value) */ -#if defined(__GLIBC__) || defined(_WIN32) - optind = 0; -#else +#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __APPLE__ optind = optreset = 1; +#else + optind = 0; #endif /* copy version number from st into cfg */ assert(ykp_configure_for(cfg, 1, st) == 1); /* call args_to_config from ykpers-args.c with a fake set of program arguments */ - rc = args_to_config(argc, argv, cfg, oathid, + rc = args_to_config(argc, argv, cfg, oathid, sizeof(oathid), &infname, &outfname, &data_format, &autocommit, st, &verbose, &dry_run, &access_code, &new_access_code, - &ndef_type, ndef, &usb_mode, &zap, + &ndef_type, ndef, sizeof(ndef), &usb_mode, &zap, scan_map, &cr_timeout, &autoeject_timeout, &num_modes_seen, device_info, &device_info_len, &exit_code); @@ -329,10 +329,10 @@ ykp_errno = 0; /* getopt reinit (BSD systems use optreset and a different optind value) */ -#if defined(__GLIBC__) || defined(_WIN32) - optind = 0; -#else +#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __APPLE__ optind = optreset = 1; +#else + optind = 0; #endif /* copy version number from st into cfg */ @@ -340,12 +340,12 @@ //assert(ykp_configure_for(cfg, 1, st) == 1); /* call args_to_config from ykpers-args.c with a fake set of program arguments */ - rc = args_to_config(argc, argv, cfg, oathid, + rc = args_to_config(argc, argv, cfg, oathid, sizeof(oathid), &infname, &outfname, &data_format, &autocommit, st, &verbose, &dry_run, &access_code, &new_access_code, - &ndef_type, ndef, &usb_mode, &zap, + &ndef_type, ndef, sizeof(ndef), &usb_mode, &zap, scan_map, &cr_timeout, &autoeject_timeout, &num_modes_seen, device_info, &device_info_len, &exit_code); assert(rc == 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykchalresp.1 new/ykpers-1.19.2/ykchalresp.1 --- old/ykpers-1.19.0/ykchalresp.1 2016-09-29 10:14:49.000000000 +0200 +++ new/ykpers-1.19.2/ykchalresp.1 2019-02-19 10:11:07.000000000 +0100 @@ -2,12 +2,12 @@ .\" Title: ykchalresp .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/> -.\" Date: Version 1.18.0 +.\" Date: Version 1.19.1 .\" Manual: YubiKey Personalization Tool Manual .\" Source: ykchalresp .\" Language: English .\" -.TH "YKCHALRESP" "1" "Version 1\&.18\&.0" "ykchalresp" "YubiKey Personalization Tool M" +.TH "YKCHALRESP" "1" "Version 1\&.19\&.1" "ykchalresp" "YubiKey Personalization Tool M" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykchalresp.c new/ykpers-1.19.2/ykchalresp.c --- old/ykpers-1.19.0/ykchalresp.c 2018-01-18 10:59:54.000000000 +0100 +++ new/ykpers-1.19.2/ykchalresp.c 2018-11-27 09:19:44.000000000 +0100 @@ -237,7 +237,7 @@ return 0; } - free(st); + ykds_free(st); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykcore/Makefile.am new/ykpers-1.19.2/ykcore/Makefile.am --- old/ykpers-1.19.0/ykcore/Makefile.am 2016-02-17 08:56:42.000000000 +0100 +++ new/ykpers-1.19.2/ykcore/Makefile.am 2019-02-19 13:29:54.000000000 +0100 @@ -27,7 +27,7 @@ noinst_LTLIBRARIES = libykcore.la libykcore_la_SOURCES = ykdef.h ykcore.h ykcore_lcl.h ykcore_backend.h \ - ykcore.c ykstatus.h ykstatus.c yktsd.h + ykcore.c ykstatus.h ykstatus.c yktsd.h ykbzero.h libykcore_la_LIBADD = $(LTLIBYUBIKEY) $(LTLIBUSB) @LIBUSB_LIBS@ AM_CFLAGS = $(WARN_CFLAGS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykcore/Makefile.in new/ykpers-1.19.2/ykcore/Makefile.in --- old/ykpers-1.19.0/ykcore/Makefile.in 2018-04-20 10:08:42.000000000 +0200 +++ new/ykpers-1.19.2/ykcore/Makefile.in 2019-02-19 13:30:31.000000000 +0100 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -145,7 +145,7 @@ $(am__DEPENDENCIES_1) am__libykcore_la_SOURCES_DIST = ykdef.h ykcore.h ykcore_lcl.h \ ykcore_backend.h ykcore.c ykstatus.h ykstatus.c yktsd.h \ - ykcore_libusb-1.0.c ykcore_libusb.c ykcore_osx.c \ + ykbzero.h ykcore_libusb-1.0.c ykcore_libusb.c ykcore_osx.c \ ykcore_windows.c @BACKEND_LIBUSB_1_0_TRUE@am__objects_1 = ykcore_libusb-1.0.lo @BACKEND_LIBUSB_TRUE@am__objects_2 = ykcore_libusb.lo @@ -370,8 +370,9 @@ udevrulesfile = @udevrulesfile@ noinst_LTLIBRARIES = libykcore.la libykcore_la_SOURCES = ykdef.h ykcore.h ykcore_lcl.h ykcore_backend.h \ - ykcore.c ykstatus.h ykstatus.c yktsd.h $(am__append_2) \ - $(am__append_4) $(am__append_5) $(am__append_6) + ykcore.c ykstatus.h ykstatus.c yktsd.h ykbzero.h \ + $(am__append_2) $(am__append_4) $(am__append_5) \ + $(am__append_6) libykcore_la_LIBADD = $(LTLIBYUBIKEY) $(LTLIBUSB) @LIBUSB_LIBS@ AM_CFLAGS = $(WARN_CFLAGS) $(am__append_1) $(am__append_3) \ $(am__append_7) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykcore/ykbzero.h new/ykpers-1.19.2/ykcore/ykbzero.h --- old/ykpers-1.19.0/ykcore/ykbzero.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ykpers-1.19.2/ykcore/ykbzero.h 2019-02-19 13:29:54.000000000 +0100 @@ -0,0 +1,62 @@ +/* -*- mode:C; c-file-style: "bsd" -*- */ +/* + * Copyright (c) 2008-2019 Yubico AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __YKBZERO_H_INCLUDED__ +#define __YKBZERO_H_INCLUDED__ + +#ifdef _WIN32 +#include <windows.h> +#else +#include <string.h> +#endif + +#ifdef _WIN32 +#define insecure_memzero(buf, len) SecureZeroMemory(buf, len) +#elif HAVE_MEMSET_S +#define insecure_memzero(buf, len) memset_s(buf, len, 0, len) +#elif HAVE_EXPLICIT_BZERO +#define insecure_memzero(buf, len) explicit_bzero(buf, len) +#elif HAVE_EXPLICIT_MEMSET +#define insecure_memzero(buf, len) explicit_memset(buf, 0, len) +#elif HAVE_INLINE_ASM +#define insecure_memzero(buf, len) do { \ + memset(buf, 0, len); \ + __asm__ __volatile__ ("" : : "r"(buf) : "memory"); \ + } while (0) +#else +#define insecure_memzero(buf, len) do { \ + volatile unsigned char *volatile __buf_ = \ + (volatile unsigned char *volatile)buf; \ + size_t __i_ = 0; \ + while (__i_ < len) __buf_[__i_++] = 0; \ + } while (0) +#endif + +#endif /* __YKBZERO_H_INCLUDED__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykcore/ykcore.c new/ykpers-1.19.2/ykcore/ykcore.c --- old/ykpers-1.19.0/ykcore/ykcore.c 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/ykcore/ykcore.c 2019-02-19 14:13:56.000000000 +0100 @@ -31,6 +31,7 @@ #include "ykcore_lcl.h" #include "ykcore_backend.h" #include "yktsd.h" +#include "ykbzero.h" /* To get modhex and crc16 */ #include <yubikey.h> @@ -200,6 +201,12 @@ response_len = capabilities[0]; response_len++; + /* validate the length we got back from the hardware */ + if (response_len > *len) { + yk_errno = YK_EWRONGSIZ; + return 0; + } + *len = response_len; return 1; } @@ -253,6 +260,7 @@ int yk_write_command(YK_KEY *yk, YK_CONFIG *cfg, uint8_t command, unsigned char *acc_code) { + int ret; unsigned char buf[sizeof(YK_CONFIG) + ACC_CODE_SIZE]; /* Update checksum and insert config block in buffer if present */ @@ -271,8 +279,9 @@ if (acc_code) memcpy(buf + sizeof(YK_CONFIG), acc_code, ACC_CODE_SIZE); - return _yk_write(yk, command, buf, sizeof(buf)); - + ret = _yk_write(yk, command, buf, sizeof(buf)); + insecure_memzero(buf, sizeof(buf)); + return ret; } int yk_write_config(YK_KEY *yk, YK_CONFIG *cfg, int confnum, @@ -380,6 +389,7 @@ &bytes_read)) { return 0; } + return 1; } @@ -608,13 +618,24 @@ if ((data[FEATURE_RPT_SIZE - 1] & 31) == 0) { if (expect_bytes > 0) { /* Size of response is known. Verify CRC. */ - int crc = yubikey_crc16(buf, expect_bytes + 2); + expect_bytes += 2; + int crc = yubikey_crc16(buf, expect_bytes); if (crc != YK_CRC_OK_RESIDUAL) { yk_errno = YK_ECHECKSUM; return 0; } } + /* since we get data in chunks of 7 we need to round expect bytes out to the closest higher multiple of 7 */ + if(expect_bytes % 7 != 0) { + expect_bytes += 7 - (expect_bytes % 7); + } + + if (*bytes_read != expect_bytes) { + yk_errno = YK_EWRONGSIZ; + return 0; + } + /* Reset read mode of Yubikey before returning. */ yk_force_key_update(yk); @@ -648,6 +669,7 @@ YK_FRAME frame; unsigned char repbuf[FEATURE_RPT_SIZE]; int i, seq; + int ret = 0; unsigned char *ptr, *end; if (bufcount > sizeof(frame.payload)) { @@ -697,16 +719,20 @@ */ if (! yk_wait_for_key_status(yk, slot, 0, WAIT_FOR_WRITE_FLAG, false, SLOT_WRITE_FLAG, NULL)) - return 0; + goto end; #ifdef YK_DEBUG _yk_hexdump(repbuf, FEATURE_RPT_SIZE); #endif if (!_ykusb_write(yk, REPORT_TYPE_FEATURE, 0, (char *)repbuf, FEATURE_RPT_SIZE)) - return 0; + goto end; } - return 1; + ret = 1; +end: + insecure_memzero(&frame, sizeof(YK_FRAME)); + insecure_memzero(repbuf, sizeof(repbuf)); + return ret; } int yk_force_key_update(YK_KEY *yk) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykcore/ykcore_windows.c new/ykpers-1.19.2/ykcore/ykcore_windows.c --- old/ykpers-1.19.0/ykcore/ykcore_windows.c 2017-01-10 20:11:02.000000000 +0100 +++ new/ykpers-1.19.2/ykcore/ykcore_windows.c 2018-11-27 09:19:44.000000000 +0100 @@ -199,7 +199,7 @@ const char *_ykusb_strerror(void) { static char buf[1024]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, buf, sizeof(buf), NULL); return buf; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykinfo.1 new/ykpers-1.19.2/ykinfo.1 --- old/ykpers-1.19.0/ykinfo.1 2016-09-29 10:19:48.000000000 +0200 +++ new/ykpers-1.19.2/ykinfo.1 2019-02-19 10:11:07.000000000 +0100 @@ -2,12 +2,12 @@ .\" Title: ykinfo .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/> -.\" Date: Version 1.18.0 +.\" Date: Version 1.19.1 .\" Manual: YubiKey Personalization Tool Manual .\" Source: ykinfo .\" Language: English .\" -.TH "YKINFO" "1" "Version 1\&.18\&.0" "ykinfo" "YubiKey Personalization Tool M" +.TH "YKINFO" "1" "Version 1\&.19\&.1" "ykinfo" "YubiKey Personalization Tool M" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpbkdf2.c new/ykpers-1.19.2/ykpbkdf2.c --- old/ykpers-1.19.0/ykpbkdf2.c 1970-01-01 01:00:00.000000000 +0100 +++ new/ykpers-1.19.2/ykpbkdf2.c 2019-02-19 13:27:15.000000000 +0100 @@ -54,6 +54,9 @@ unsigned char *dk, size_t dklen, YK_PRF_METHOD *prf_method) { + if (salt_len > 256) { + return 0; + } size_t l = ((dklen - 1 + prf_method->output_size) / prf_method->output_size); #if 0 /* r for "rest" is unused but may be interesting in the future */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers-args.c new/ykpers-1.19.2/ykpers-args.c --- old/ykpers-1.19.0/ykpers-args.c 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/ykpers-args.c 2019-02-19 13:29:54.000000000 +0100 @@ -222,6 +222,7 @@ } static int prompt_for_data(const char *prompt, char **data) { + size_t datalen; fprintf(stderr, "%s", prompt); fflush(stderr); *data = calloc(257, sizeof(char)); @@ -230,8 +231,9 @@ perror ("fgets"); return 1; } - if((*data)[strlen(*data) - 1] == '\n') { - (*data)[strlen(*data) - 1] = '\0'; + datalen = strlen(*data); + if(datalen > 0 && (*data)[datalen - 1] == '\n') { + (*data)[datalen - 1] = '\0'; } return 0; } @@ -247,11 +249,11 @@ * Done in this way to be testable (see tests/test_args_to_config.c). */ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, char *oathid, - const char **infname, const char **outfname, - int *data_format, bool *autocommit, + size_t oathid_len, const char **infname, + const char **outfname, int *data_format, bool *autocommit, YK_STATUS *st, bool *verbose, bool *dry_run, char **access_code, char **new_access_code, - char *ndef_type, char *ndef, + char *ndef_type, char *ndef, size_t ndef_len, unsigned char *usb_mode, bool *zap, unsigned char *scan_bin, unsigned char *cr_timeout, unsigned short *autoeject_timeout, int *num_modes_seen, @@ -443,7 +445,10 @@ if (!ykp_configure_command(cfg, command)) { return 0; } - memcpy(ndef, optarg, strlen(optarg)); + strncpy(ndef, optarg, ndef_len); + if (ndef_len > 0) { + ndef[ndef_len - 1] = '\0'; + } ndef_seen = true; break; } @@ -668,7 +673,10 @@ } } else if (strncmp(optarg, "oath-id=", 8) == 0 || strcmp(optarg, "oath-id") == 0) { - strcpy(oathid, optarg); + strncpy(oathid, optarg, oathid_len); + if (oathid_len > 0) { + oathid[oathid_len - 1] = '\0'; + } } #define EXTFLAG(o, f) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers-args.h new/ykpers-1.19.2/ykpers-args.h --- old/ykpers-1.19.0/ykpers-args.h 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/ykpers-args.h 2019-02-19 13:29:54.000000000 +0100 @@ -37,14 +37,16 @@ const char *optstring; int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, char *oathid, - const char **infname, const char **outfname, - int *data_format, bool *autocommit, + size_t oathid_len, const char **infname, + const char **outfname, int *data_format, bool *autocommit, YK_STATUS *st, bool *verbose, bool *dry_run, char **access_code, char **new_access_code, - char *ndef_type, char *ndef, unsigned char *usb_mode, - bool *zap, unsigned char *scan_bin, unsigned char *cr_timeout, + char *ndef_type, char *ndef, size_t ndef_len, + unsigned char *usb_mode, bool *zap, + unsigned char *scan_bin, unsigned char *cr_timeout, unsigned short *autoeject_timeout, int *num_modes_seen, - unsigned char *device_info, size_t *device_info_len, int *exit_code); + unsigned char *device_info, size_t *device_info_len, + int *exit_code); int set_oath_id(char *opt, YKP_CONFIG *cfg, YK_KEY *yk, YK_STATUS *st); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers-json.c new/ykpers-1.19.2/ykpers-json.c --- old/ykpers-1.19.0/ykpers-json.c 2014-04-28 11:53:50.000000000 +0200 +++ new/ykpers-1.19.2/ykpers-json.c 2019-02-19 13:29:54.000000000 +0100 @@ -209,6 +209,9 @@ #else strncpy(json, json_object_to_json_string(jobj), len); #endif + if (len > 0) { + json[len - 1] = '\0'; + } /* free the root object, will free all children */ json_object_put(jobj); @@ -282,7 +285,9 @@ int random = json_object_get_boolean(jrandom); int seed = 0; if(random == 1) { - /* XXX: add random seed.. */ + /* NOTE: random seed isn't implemented here for now. */ + ykp_errno = YKP_ENORANDOM; + goto out; } else { json_object *jseed; if(yk_json_object_object_get(options, "fixedSeedvalue", jseed) == TRUE) { @@ -319,7 +324,6 @@ json_object_put(jobj); } } - ykp_errno = YKP_EINVAL; return ret_code; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers-version.h new/ykpers-1.19.2/ykpers-version.h --- old/ykpers-1.19.0/ykpers-version.h 2018-04-20 10:08:45.000000000 +0200 +++ new/ykpers-1.19.2/ykpers-version.h 2019-02-19 13:30:33.000000000 +0100 @@ -42,7 +42,7 @@ * version number. Used together with ykpers_check_version() to verify * header file and run-time library consistency. */ -#define YKPERS_VERSION_STRING "1.19.0" +#define YKPERS_VERSION_STRING "1.19.2" /** * YKPERS_VERSION_NUMBER @@ -52,7 +52,7 @@ * this symbol will have the value 0x01020300. The last two digits * are only used between public releases, and will otherwise be 00. */ -#define YKPERS_VERSION_NUMBER 0x011300 +#define YKPERS_VERSION_NUMBER 0x011302 /** * YKPERS_VERSION_MAJOR @@ -79,7 +79,7 @@ * level of the header file version number. For example, when the * header version is 1.2.3 this symbol will be 3. */ -#define YKPERS_VERSION_PATCH 0 +#define YKPERS_VERSION_PATCH 2 const char *ykpers_check_version (const char *req_version); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers.c new/ykpers-1.19.2/ykpers.c --- old/ykpers-1.19.0/ykpers.c 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/ykpers.c 2019-02-19 13:29:54.000000000 +0100 @@ -938,6 +938,7 @@ int mode = MODE_OTP_YUBICO; int pos = 0; + int written; if((ycfg.tktFlags & TKTFLAG_OATH_HOTP) == TKTFLAG_OATH_HOTP){ if((ycfg.cfgFlags & CFGFLAG_CHAL_HMAC) == CFGFLAG_CHAL_HMAC) { @@ -982,10 +983,18 @@ yubikey_hex_encode(buffer + 4, (const char *)ycfg.fixed + 2, 8); } buffer[12] = 0; - pos += snprintf(buf, len - (size_t)pos, "%s%s%s\n", str_oath_id, str_key_value_separator, buffer); + written = snprintf(buf, len - (size_t)pos, "%s%s%s\n", str_oath_id, str_key_value_separator, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; } else { yubikey_modhex_encode(buffer, (const char *)ycfg.fixed, ycfg.fixedSize); - pos += snprintf(buf, len - (size_t)pos, "%s%s%s%s\n", str_fixed, str_key_value_separator, str_modhex_prefix, buffer); + written = snprintf(buf, len - (size_t)pos, "%s%s%s%s\n", str_fixed, str_key_value_separator, str_modhex_prefix, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; } /* uid: */ @@ -994,23 +1003,39 @@ } else { yubikey_hex_encode(buffer, (const char *)ycfg.uid, UID_SIZE); } - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_uid, str_key_value_separator, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_uid, str_key_value_separator, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; /* key: */ yubikey_hex_encode(buffer, (const char *)ycfg.key, KEY_SIZE); if (key_bits_in_uid) { yubikey_hex_encode(buffer + KEY_SIZE * 2, (const char *)ycfg.uid, 4); } - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s%s\n", str_key, str_key_value_separator, str_hex_prefix, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s%s\n", str_key, str_key_value_separator, str_hex_prefix, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; /* acc_code: */ yubikey_hex_encode(buffer, (const char*)ycfg.accCode, ACC_CODE_SIZE); - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s%s\n", str_acc_code, str_key_value_separator, str_hex_prefix, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s%s\n", str_acc_code, str_key_value_separator, str_hex_prefix, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; /* OATH IMF: */ if ((ycfg.tktFlags & TKTFLAG_OATH_HOTP) == TKTFLAG_OATH_HOTP && capability_has_oath_imf(cfg)) { - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s%lx\n", str_oath_imf, str_key_value_separator, str_hex_prefix, ykp_get_oath_imf(cfg)); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s%lx\n", str_oath_imf, str_key_value_separator, str_hex_prefix, ykp_get_oath_imf(cfg)); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; } /* ticket_flags: */ @@ -1025,7 +1050,11 @@ strncat(buffer, p->flag_text, 256 - strlen(buffer)); } } - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_ticket_flags, str_key_value_separator, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_ticket_flags, str_key_value_separator, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; /* config_flags: */ buffer[0] = '\0'; @@ -1044,7 +1073,11 @@ t_flags -= p->flag; } } - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_config_flags, str_key_value_separator, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_config_flags, str_key_value_separator, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; /* extended_flags: */ buffer[0] = '\0'; @@ -1058,7 +1091,11 @@ strncat(buffer, p->flag_text, 256 - strlen(buffer)); } } - pos += snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_extended_flags, str_key_value_separator, buffer); + written = snprintf(buf + pos, len - (size_t)pos, "%s%s%s\n", str_extended_flags, str_key_value_separator, buffer); + if (written < 0 || pos + written > len) { + return -1; + } + pos += written; return pos; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpers4win.mk new/ykpers-1.19.2/ykpers4win.mk --- old/ykpers-1.19.0/ykpers4win.mk 2016-10-04 10:23:15.000000000 +0200 +++ new/ykpers-1.19.2/ykpers4win.mk 2019-02-19 13:29:54.000000000 +0100 @@ -27,7 +27,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LIBYUBIKEYVERSION=1.13 -LIBJSONVERSION=0.11 +LIBJSONVERSION=0.13.1 PROJECT=yubikey-personalization PACKAGE=ykpers @@ -50,7 +50,7 @@ || wget --no-check-certificate https://s3.amazonaws.com/json-c_releases/releases/json-c-$(LIBJSONVERSION).tar.gz && \ tar xfa json-c-$(LIBJSONVERSION).tar.gz && \ cd json-c-$(LIBJSONVERSION) && \ - ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ./configure --host=$(HOST) --build=x86_64-unknown-linux-gnu --prefix=$(PWD)/tmp/root && \ + CC="$(HOST)-gcc -static-libgcc" ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ./configure --host=$(HOST) --build=x86_64-unknown-linux-gnu --prefix=$(PWD)/tmp/root && \ make install && \ cp COPYING $(PWD)/tmp/root/licenses/json-c.txt && \ cd .. && \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpersonalize.1 new/ykpers-1.19.2/ykpersonalize.1 --- old/ykpers-1.19.0/ykpersonalize.1 2018-04-24 10:28:50.000000000 +0200 +++ new/ykpers-1.19.2/ykpersonalize.1 2019-02-19 10:11:07.000000000 +0100 @@ -2,12 +2,12 @@ .\" Title: ykpersonalize .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/> -.\" Date: Version 1.19.0 +.\" Date: Version 1.19.1 .\" Manual: YubiKey Personalization Tool Manual .\" Source: ykpersonalize .\" Language: English .\" -.TH "YKPERSONALIZE" "1" "Version 1\&.19\&.0" "ykpersonalize" "YubiKey Personalization Tool M" +.TH "YKPERSONALIZE" "1" "Version 1\&.19\&.1" "ykpersonalize" "YubiKey Personalization Tool M" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ykpers-1.19.0/ykpersonalize.c new/ykpers-1.19.2/ykpersonalize.c --- old/ykpers-1.19.0/ykpersonalize.c 2018-04-20 09:34:05.000000000 +0200 +++ new/ykpers-1.19.2/ykpersonalize.c 2019-02-19 13:29:54.000000000 +0100 @@ -149,12 +149,12 @@ } /* Parse all arguments in a testable way */ - if (! args_to_config(argc, argv, cfg, oathid, + if (! args_to_config(argc, argv, cfg, oathid, sizeof(oathid), &infname, &outfname, &data_format, &autocommit, st, &verbose, &dry_run, &acc_code, &new_acc_code, - &ndef_type, ndef_string, + &ndef_type, ndef_string, sizeof(ndef_string), &usb_mode, &zap, scan_codes, &cr_timeout, &autoeject_timeout, &num_modes_seen, device_info, &device_info_len, &exit_code)) { @@ -302,7 +302,7 @@ } } commitlen = strlen(commitbuf); - if (commitbuf[commitlen - 1] == '\n') + if (commitlen > 0 && commitbuf[commitlen - 1] == '\n') commitbuf[commitlen - 1] = '\0'; if (strcmp(commitbuf, "y") == 0 || strcmp(commitbuf, "yes") == 0) { @@ -369,7 +369,7 @@ } } commitlen = strlen(commitbuf); - if (commitbuf[commitlen - 1] == '\n') + if (commitlen > 0 && commitbuf[commitlen - 1] == '\n') commitbuf[commitlen - 1] = '\0'; if (strcmp(commitbuf, "y") != 0 && strcmp(commitbuf, "yes") != 0) {
