X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Famaespipe.sh;h=2320e4ca4a371b1dbf989107038fb2f5c0e7b47a;hb=HEAD;hp=8d3aa1c93ed625f413bfff758692fe17f51c466f;hpb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;p=debian%2Famanda diff --git a/common-src/amaespipe.sh b/common-src/amaespipe.sh index 8d3aa1c..2320e4c 100755 --- a/common-src/amaespipe.sh +++ b/common-src/amaespipe.sh @@ -1,10 +1,11 @@ #! @SHELL@ # -# Copyright (c) 2005 Zmanda Inc. All Rights Reserved. +# Copyright (c) 2007-2012 Zmanda Inc. All Rights Reserved. # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -15,8 +16,8 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120 -# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com +# Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300 +# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com # prefix="@prefix@" @@ -52,24 +53,25 @@ FDNUMBER=3 if test x$1 = x-d ; then # decrypt - n=`head -c 10 - | tr -d -c 0-9a-zA-Z` + n=`/bin/dd bs=10 count=1 2> /dev/null | tr -d -c 0-9a-zA-Z` if test x${n} != xbz2aespipe ; then - echo `_ 'bz2aespipe: wrong magic - aborted'` >/dev/tty + echo "bz2aespipe: wrong magic - aborted" >/dev/tty exit 1 fi - itercountk=`head -c 10 - | tr -d -c 0-9` + itercountk=`/bin/dd bs=10 count=1 2> /dev/null | tr -d -c 0-9` if test x${itercountk} = x ; then itercountk=0; fi - n=`head -c 1 - | tr -d -c 0-9` + n=`/bin/dd bs=1 count=1 2> /dev/null | tr -d -c 0-9` encryption=AES128 if test x${n} = x1 ; then encryption=AES192; fi if test x${n} = x2 ; then encryption=AES256; fi - n=`head -c 1 - | tr -d -c 0-9` + n=`/bin/dd bs=1 count=1 2> /dev/null | tr -d -c 0-9` hashfunc=SHA256 if test x${n} = x1 ; then hashfunc=SHA384; fi if test x${n} = x2 ; then hashfunc=SHA512; fi if test x${n} = x3 ; then hashfunc=RMD160; fi - seedstr=`head -c 24 - | tr -d -c 0-9a-zA-Z+/` - aespipe -K ${GPGKEY} -p ${FDNUMBER} -e ${encryption} -H ${hashfunc} -S ${seedstr} -C ${itercountk} -d + seedstr=`/bin/dd bs=24 count=1 2> /dev/null | tr -d -c 0-9a-zA-Z+/` + aespipe -K ${GPGKEY} -p ${FDNUMBER} -e ${encryption} -H ${hashfunc} \ + -S ${seedstr} -C ${itercountk} -d else # encrypt echo -n bz2aespipe @@ -85,6 +87,7 @@ else if test x${n} = x160 ; then hashstr=3; fi seedstr=`head -c 18 /dev/urandom | uuencode -m - | head -n 2 | tail -n 1` echo -n ${aesstr}${hashstr}${seedstr} - aespipe -K ${GPGKEY} -p ${FDNUMBER} -e ${ENCRYPTION} -H ${HASHFUNC} -S ${seedstr} -C ${ITERCOUNTK} -w ${WAITSECONDS} + aespipe -K ${GPGKEY} -p ${FDNUMBER} -e ${ENCRYPTION} -H ${HASHFUNC} \ + -S ${seedstr} -C ${ITERCOUNTK} -w ${WAITSECONDS} fi exit 0