Merge a292994205 into 4db99f4012
This commit is contained in:
commit
9907652073
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile,v 1.13 2014/12/05 04:42:36 agc Exp $
|
# $NetBSD: Makefile,v 1.15 2017/04/17 19:50:27 agc Exp $
|
||||||
|
|
||||||
PROG=netpgpverify
|
PROG=netpgpverify
|
||||||
BINDIR= /usr/bin
|
BINDIR= /usr/bin
|
||||||
|
|
@ -9,7 +9,7 @@ SRCS+= pgpsum.c rsa.c
|
||||||
|
|
||||||
SRCS+= bzlib.c zlib.c
|
SRCS+= bzlib.c zlib.c
|
||||||
|
|
||||||
SRCS+= md5c.c rmd160.c sha1.c sha2.c tiger.c
|
SRCS+= md5c.c rmd160.c sha1.c sha2.c
|
||||||
|
|
||||||
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
|
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
|
||||||
COPTS.libverify.c+= -Wno-format-nonliteral
|
COPTS.libverify.c+= -Wno-format-nonliteral
|
||||||
|
|
@ -36,3 +36,5 @@ t tst: ${PROG}
|
||||||
./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub ${EXTDIST}/src/netpgpverify/data.sig
|
./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub ${EXTDIST}/src/netpgpverify/data.sig
|
||||||
@echo "expected failure, to check bad signatures fail to verify"
|
@echo "expected failure, to check bad signatures fail to verify"
|
||||||
-sed -e 's|A|B|' ${EXTDIST}/src/netpgpverify/data.gpg | ./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub
|
-sed -e 's|A|B|' ${EXTDIST}/src/netpgpverify/data.gpg | ./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub
|
||||||
|
@echo "testing signatures with no version"
|
||||||
|
./${PROG} -k ${EXTDIST}/src/netpgpverify/pubring.gpg ${EXTDIST}/src/netpgpverify/noversion.asc
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
367
crypto/external/bsd/netpgp/dist/buildaux/config.sub
vendored
367
crypto/external/bsd/netpgp/dist/buildaux/config.sub
vendored
|
|
@ -1,44 +1,40 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright 1992-2017 Free Software Foundation, Inc.
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
timestamp='2008-09-08'
|
timestamp='2017-01-01'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# under the terms of the GNU General Public License as published by
|
||||||
# can handle that machine. It does not imply ALL GNU software can.
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
#
|
|
||||||
# This file 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.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful, but
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# GNU General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
# configuration script generated by Autoconf, you may include it under
|
# configuration script generated by Autoconf, you may include it under
|
||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that
|
||||||
|
# program. This Exception is an additional permission under section 7
|
||||||
|
# of the GNU General Public License, version 3 ("GPLv3").
|
||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>.
|
||||||
# diff and a properly formatted ChangeLog entry.
|
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
|
# You can get the latest version of this script from:
|
||||||
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
# that are meaningful with *any* GNU software.
|
# that are meaningful with *any* GNU software.
|
||||||
|
|
@ -57,8 +53,7 @@ timestamp='2008-09-08'
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
usage="\
|
usage="\
|
||||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||||
$0 [OPTION] ALIAS
|
|
||||||
|
|
||||||
Canonicalize a configuration name.
|
Canonicalize a configuration name.
|
||||||
|
|
||||||
|
|
@ -72,8 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright 1992-2017 Free Software Foundation, Inc.
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
|
|
@ -120,12 +114,18 @@ esac
|
||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
|
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||||
|
kopensolaris*-gnu* | cloudabi*-eabi* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
;;
|
;;
|
||||||
|
android-linux)
|
||||||
|
os=-linux-android
|
||||||
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||||
if [ $basic_machine != $1 ]
|
if [ $basic_machine != $1 ]
|
||||||
|
|
@ -148,10 +148,13 @@ case $os in
|
||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray)
|
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
|
-bluegene*)
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
|
|
@ -166,10 +169,10 @@ case $os in
|
||||||
os=-chorusos
|
os=-chorusos
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-chorusrdb)
|
-chorusrdb)
|
||||||
os=-chorusrdb
|
os=-chorusrdb
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
-hiux*)
|
-hiux*)
|
||||||
os=-hiuxwe2
|
os=-hiuxwe2
|
||||||
;;
|
;;
|
||||||
|
|
@ -214,6 +217,12 @@ case $os in
|
||||||
-isc*)
|
-isc*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
|
-lynx*178)
|
||||||
|
os=-lynxos178
|
||||||
|
;;
|
||||||
|
-lynx*5)
|
||||||
|
os=-lynxos5
|
||||||
|
;;
|
||||||
-lynx*)
|
-lynx*)
|
||||||
os=-lynxos
|
os=-lynxos
|
||||||
;;
|
;;
|
||||||
|
|
@ -238,19 +247,29 @@ case $basic_machine in
|
||||||
# Some are omitted here because they have special meanings below.
|
# Some are omitted here because they have special meanings below.
|
||||||
1750a | 580 \
|
1750a | 580 \
|
||||||
| a29k \
|
| a29k \
|
||||||
|
| aarch64 | aarch64_be \
|
||||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
| am33_2.0 \
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
| arc | arceb \
|
||||||
|
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||||
|
| avr | avr32 \
|
||||||
|
| ba \
|
||||||
|
| be32 | be64 \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | clipper \
|
| c4x | c8051 | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
| fido | fr30 | frv \
|
| e2k | epiphany \
|
||||||
|
| fido | fr30 | frv | ft32 \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
|
| hexagon \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
|
| k1om \
|
||||||
|
| le32 | le64 \
|
||||||
|
| lm32 \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
| maxq | mb | microblaze | mcore | mep | metag \
|
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||||
| mips16 \
|
| mips16 \
|
||||||
| mips64 | mips64el \
|
| mips64 | mips64el \
|
||||||
|
|
@ -264,35 +283,56 @@ case $basic_machine in
|
||||||
| mips64vr5900 | mips64vr5900el \
|
| mips64vr5900 | mips64vr5900el \
|
||||||
| mipsisa32 | mipsisa32el \
|
| mipsisa32 | mipsisa32el \
|
||||||
| mipsisa32r2 | mipsisa32r2el \
|
| mipsisa32r2 | mipsisa32r2el \
|
||||||
|
| mipsisa32r6 | mipsisa32r6el \
|
||||||
| mipsisa64 | mipsisa64el \
|
| mipsisa64 | mipsisa64el \
|
||||||
| mipsisa64r2 | mipsisa64r2el \
|
| mipsisa64r2 | mipsisa64r2el \
|
||||||
|
| mipsisa64r6 | mipsisa64r6el \
|
||||||
| mipsisa64sb1 | mipsisa64sb1el \
|
| mipsisa64sb1 | mipsisa64sb1el \
|
||||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||||
|
| mipsr5900 | mipsr5900el \
|
||||||
| mipstx39 | mipstx39el \
|
| mipstx39 | mipstx39el \
|
||||||
| mn10200 | mn10300 \
|
| mn10200 | mn10300 \
|
||||||
|
| moxie \
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
| nios | nios2 \
|
| nds32 | nds32le | nds32be \
|
||||||
|
| nios | nios2 | nios2eb | nios2el \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
| or32 \
|
| open8 | or1k | or1knd | or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||||
|
| pru \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
|
| riscv32 | riscv64 \
|
||||||
|
| rl78 | rx \
|
||||||
| score \
|
| score \
|
||||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
| spu | strongarm \
|
| spu \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||||
| v850 | v850e \
|
| ubicom32 \
|
||||||
|
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||||
|
| visium \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xstormy16 | xtensa \
|
||||||
| z8k | z80)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12)
|
c54x)
|
||||||
# Motorola 68HC11/12.
|
basic_machine=tic54x-unknown
|
||||||
|
;;
|
||||||
|
c55x)
|
||||||
|
basic_machine=tic55x-unknown
|
||||||
|
;;
|
||||||
|
c6x)
|
||||||
|
basic_machine=tic6x-unknown
|
||||||
|
;;
|
||||||
|
leon|leon[3-9])
|
||||||
|
basic_machine=sparc-$basic_machine
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
;;
|
;;
|
||||||
|
|
@ -302,6 +342,21 @@ case $basic_machine in
|
||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
strongarm | thumb | xscale)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
;;
|
||||||
|
xgate)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
xscaleeb)
|
||||||
|
basic_machine=armeb-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
|
xscaleel)
|
||||||
|
basic_machine=armel-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
# (2) the word "unknown" tends to confuse beginning users.
|
# (2) the word "unknown" tends to confuse beginning users.
|
||||||
|
|
@ -316,24 +371,32 @@ case $basic_machine in
|
||||||
# Recognize the basic CPU types with company name.
|
# Recognize the basic CPU types with company name.
|
||||||
580-* \
|
580-* \
|
||||||
| a29k-* \
|
| a29k-* \
|
||||||
|
| aarch64-* | aarch64_be-* \
|
||||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* | avr32-* \
|
||||||
|
| ba-* \
|
||||||
|
| be32-* | be64-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| e2k-* | elxsi-* \
|
||||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
|
| hexagon-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
|
| k1om-* \
|
||||||
|
| le32-* | le64-* \
|
||||||
|
| lm32-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||||
|
| microblaze-* | microblazeel-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
|
|
@ -347,32 +410,44 @@ case $basic_machine in
|
||||||
| mips64vr5900-* | mips64vr5900el-* \
|
| mips64vr5900-* | mips64vr5900el-* \
|
||||||
| mipsisa32-* | mipsisa32el-* \
|
| mipsisa32-* | mipsisa32el-* \
|
||||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||||
|
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||||
| mipsisa64-* | mipsisa64el-* \
|
| mipsisa64-* | mipsisa64el-* \
|
||||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||||
|
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||||
|
| mipsr5900-* | mipsr5900el-* \
|
||||||
| mipstx39-* | mipstx39el-* \
|
| mipstx39-* | mipstx39el-* \
|
||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
| nios-* | nios2-* \
|
| nds32-* | nds32le-* | nds32be-* \
|
||||||
|
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
|
| open8-* \
|
||||||
|
| or1k*-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||||
|
| pru-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* \
|
| riscv32-* | riscv64-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||||
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
|
| tile*-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| ubicom32-* \
|
||||||
|
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||||
|
| vax-* \
|
||||||
|
| visium-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||||
| xstormy16-* | xtensa*-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-* | z80-*)
|
| z8k-* | z80-*)
|
||||||
|
|
@ -397,7 +472,7 @@ case $basic_machine in
|
||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-udi
|
os=-udi
|
||||||
;;
|
;;
|
||||||
abacus)
|
abacus)
|
||||||
basic_machine=abacus-unknown
|
basic_machine=abacus-unknown
|
||||||
;;
|
;;
|
||||||
adobe68k)
|
adobe68k)
|
||||||
|
|
@ -443,6 +518,13 @@ case $basic_machine in
|
||||||
basic_machine=m68k-apollo
|
basic_machine=m68k-apollo
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
|
aros)
|
||||||
|
basic_machine=i386-pc
|
||||||
|
os=-aros
|
||||||
|
;;
|
||||||
|
asmjs)
|
||||||
|
basic_machine=asmjs-unknown
|
||||||
|
;;
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
|
|
@ -459,11 +541,24 @@ case $basic_machine in
|
||||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
|
bluegene*)
|
||||||
|
basic_machine=powerpc-ibm
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
|
c54x-*)
|
||||||
|
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c55x-*)
|
||||||
|
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c6x-*)
|
||||||
|
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
cegcc)
|
cegcc)
|
||||||
basic_machine=arm-unknown
|
basic_machine=arm-unknown
|
||||||
os=-cegcc
|
os=-cegcc
|
||||||
;;
|
;;
|
||||||
|
|
@ -495,7 +590,7 @@ case $basic_machine in
|
||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16)
|
cr16 | cr16-*)
|
||||||
basic_machine=cr16-unknown
|
basic_machine=cr16-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
|
|
@ -550,6 +645,14 @@ case $basic_machine in
|
||||||
basic_machine=m68k-bull
|
basic_machine=m68k-bull
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
e500v[12])
|
||||||
|
basic_machine=powerpc-unknown
|
||||||
|
os=$os"spe"
|
||||||
|
;;
|
||||||
|
e500v[12]-*)
|
||||||
|
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
os=$os"spe"
|
||||||
|
;;
|
||||||
ebmon29k)
|
ebmon29k)
|
||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-ebmon
|
os=-ebmon
|
||||||
|
|
@ -653,7 +756,6 @@ case $basic_machine in
|
||||||
i370-ibm* | ibm*)
|
i370-ibm* | ibm*)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
;;
|
;;
|
||||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
|
||||||
i*86v32)
|
i*86v32)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv32
|
os=-sysv32
|
||||||
|
|
@ -692,6 +794,9 @@ case $basic_machine in
|
||||||
basic_machine=m68k-isi
|
basic_machine=m68k-isi
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
leon-*|leon[3-9]-*)
|
||||||
|
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||||
|
;;
|
||||||
m68knommu)
|
m68knommu)
|
||||||
basic_machine=m68k-unknown
|
basic_machine=m68k-unknown
|
||||||
os=-linux
|
os=-linux
|
||||||
|
|
@ -711,8 +816,15 @@ case $basic_machine in
|
||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
microblaze*)
|
||||||
|
basic_machine=microblaze-xilinx
|
||||||
|
;;
|
||||||
|
mingw64)
|
||||||
|
basic_machine=x86_64-pc
|
||||||
|
os=-mingw64
|
||||||
|
;;
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i686-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
;;
|
;;
|
||||||
mingw32ce)
|
mingw32ce)
|
||||||
|
|
@ -740,6 +852,10 @@ case $basic_machine in
|
||||||
basic_machine=powerpc-unknown
|
basic_machine=powerpc-unknown
|
||||||
os=-morphos
|
os=-morphos
|
||||||
;;
|
;;
|
||||||
|
moxiebox)
|
||||||
|
basic_machine=moxie-unknown
|
||||||
|
os=-moxiebox
|
||||||
|
;;
|
||||||
msdos)
|
msdos)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-msdos
|
os=-msdos
|
||||||
|
|
@ -747,10 +863,18 @@ case $basic_machine in
|
||||||
ms1-*)
|
ms1-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||||
;;
|
;;
|
||||||
|
msys)
|
||||||
|
basic_machine=i686-pc
|
||||||
|
os=-msys
|
||||||
|
;;
|
||||||
mvs)
|
mvs)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
os=-mvs
|
os=-mvs
|
||||||
;;
|
;;
|
||||||
|
nacl)
|
||||||
|
basic_machine=le32-unknown
|
||||||
|
os=-nacl
|
||||||
|
;;
|
||||||
ncr3000)
|
ncr3000)
|
||||||
basic_machine=i486-ncr
|
basic_machine=i486-ncr
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
|
|
@ -815,6 +939,12 @@ case $basic_machine in
|
||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
neo-tandem)
|
||||||
|
basic_machine=neo-tandem
|
||||||
|
;;
|
||||||
|
nse-tandem)
|
||||||
|
basic_machine=nse-tandem
|
||||||
|
;;
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
|
|
@ -897,11 +1027,12 @@ case $basic_machine in
|
||||||
;;
|
;;
|
||||||
power) basic_machine=power-ibm
|
power) basic_machine=power-ibm
|
||||||
;;
|
;;
|
||||||
ppc) basic_machine=powerpc-unknown
|
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||||
;;
|
;;
|
||||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc-* | ppcbe-*)
|
||||||
|
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
ppcle | powerpclittle)
|
||||||
basic_machine=powerpcle-unknown
|
basic_machine=powerpcle-unknown
|
||||||
;;
|
;;
|
||||||
ppcle-* | powerpclittle-*)
|
ppcle-* | powerpclittle-*)
|
||||||
|
|
@ -911,7 +1042,7 @@ case $basic_machine in
|
||||||
;;
|
;;
|
||||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
ppc64le | powerpc64little)
|
||||||
basic_machine=powerpc64le-unknown
|
basic_machine=powerpc64le-unknown
|
||||||
;;
|
;;
|
||||||
ppc64le-* | powerpc64little-*)
|
ppc64le-* | powerpc64little-*)
|
||||||
|
|
@ -924,7 +1055,11 @@ case $basic_machine in
|
||||||
basic_machine=i586-unknown
|
basic_machine=i586-unknown
|
||||||
os=-pw32
|
os=-pw32
|
||||||
;;
|
;;
|
||||||
rdos)
|
rdos | rdos64)
|
||||||
|
basic_machine=x86_64-pc
|
||||||
|
os=-rdos
|
||||||
|
;;
|
||||||
|
rdos32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-rdos
|
os=-rdos
|
||||||
;;
|
;;
|
||||||
|
|
@ -993,6 +1128,9 @@ case $basic_machine in
|
||||||
basic_machine=i860-stratus
|
basic_machine=i860-stratus
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
strongarm-* | thumb-*)
|
||||||
|
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
;;
|
;;
|
||||||
|
|
@ -1049,20 +1187,8 @@ case $basic_machine in
|
||||||
basic_machine=t90-cray
|
basic_machine=t90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
tic54x | c54x*)
|
|
||||||
basic_machine=tic54x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic55x | c55x*)
|
|
||||||
basic_machine=tic55x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tile*)
|
tile*)
|
||||||
basic_machine=tile-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-linux-gnu
|
os=-linux-gnu
|
||||||
;;
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
|
|
@ -1132,6 +1258,9 @@ case $basic_machine in
|
||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
|
xscale-* | xscalee[bl]-*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||||
|
;;
|
||||||
ymp)
|
ymp)
|
||||||
basic_machine=ymp-cray
|
basic_machine=ymp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
|
|
@ -1182,7 +1311,7 @@ case $basic_machine in
|
||||||
we32k)
|
we32k)
|
||||||
basic_machine=we32k-att
|
basic_machine=we32k-att
|
||||||
;;
|
;;
|
||||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||||
basic_machine=sh-unknown
|
basic_machine=sh-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||||
|
|
@ -1229,9 +1358,12 @@ esac
|
||||||
if [ x"$os" != x"" ]
|
if [ x"$os" != x"" ]
|
||||||
then
|
then
|
||||||
case $os in
|
case $os in
|
||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
|
-auroraux)
|
||||||
|
os=-auroraux
|
||||||
|
;;
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
;;
|
;;
|
||||||
|
|
@ -1252,29 +1384,32 @@ case $os in
|
||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
|
| -sym* | -kopensolaris* | -plan9* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* \
|
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||||
| -openbsd* | -solidbsd* \
|
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
|
||||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||||
|
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||||
|
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
|
|
@ -1313,7 +1448,7 @@ case $os in
|
||||||
-opened*)
|
-opened*)
|
||||||
os=-openedition
|
os=-openedition
|
||||||
;;
|
;;
|
||||||
-os400*)
|
-os400*)
|
||||||
os=-os400
|
os=-os400
|
||||||
;;
|
;;
|
||||||
-wince*)
|
-wince*)
|
||||||
|
|
@ -1362,7 +1497,7 @@ case $os in
|
||||||
-sinix*)
|
-sinix*)
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
-tpf*)
|
-tpf*)
|
||||||
os=-tpf
|
os=-tpf
|
||||||
;;
|
;;
|
||||||
-triton*)
|
-triton*)
|
||||||
|
|
@ -1398,15 +1533,16 @@ case $os in
|
||||||
-aros*)
|
-aros*)
|
||||||
os=-aros
|
os=-aros
|
||||||
;;
|
;;
|
||||||
-kaos*)
|
|
||||||
os=-kaos
|
|
||||||
;;
|
|
||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
-dicos*)
|
-dicos*)
|
||||||
os=-dicos
|
os=-dicos
|
||||||
;;
|
;;
|
||||||
|
-nacl*)
|
||||||
|
;;
|
||||||
|
-ios)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
@ -1429,10 +1565,10 @@ else
|
||||||
# system, and we'll never get to this point.
|
# system, and we'll never get to this point.
|
||||||
|
|
||||||
case $basic_machine in
|
case $basic_machine in
|
||||||
score-*)
|
score-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
spu-*)
|
spu-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
*-acorn)
|
*-acorn)
|
||||||
|
|
@ -1444,8 +1580,23 @@ case $basic_machine in
|
||||||
arm*-semi)
|
arm*-semi)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
|
;;
|
||||||
|
c8051-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
hexagon-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
tic54x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic55x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic6x-*)
|
||||||
|
os=-coff
|
||||||
;;
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
|
|
@ -1465,14 +1616,11 @@ case $basic_machine in
|
||||||
;;
|
;;
|
||||||
m68000-sun)
|
m68000-sun)
|
||||||
os=-sunos3
|
os=-sunos3
|
||||||
# This also exists in the configure program, but was not the
|
|
||||||
# default.
|
|
||||||
# os=-sunos4
|
|
||||||
;;
|
;;
|
||||||
m68*-cisco)
|
m68*-cisco)
|
||||||
os=-aout
|
os=-aout
|
||||||
;;
|
;;
|
||||||
mep-*)
|
mep-*)
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
mips*-cisco)
|
mips*-cisco)
|
||||||
|
|
@ -1490,6 +1638,9 @@ case $basic_machine in
|
||||||
sparc-* | *-sun)
|
sparc-* | *-sun)
|
||||||
os=-sunos4.1.1
|
os=-sunos4.1.1
|
||||||
;;
|
;;
|
||||||
|
pru-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
*-be)
|
*-be)
|
||||||
os=-beos
|
os=-beos
|
||||||
;;
|
;;
|
||||||
|
|
@ -1499,7 +1650,7 @@ case $basic_machine in
|
||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
*-knuth)
|
*-knuth)
|
||||||
os=-mmixware
|
os=-mmixware
|
||||||
;;
|
;;
|
||||||
*-wec)
|
*-wec)
|
||||||
|
|
@ -1604,7 +1755,7 @@ case $basic_machine in
|
||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-aix*)
|
-cnk*|-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||||
__RCSID("$NetBSD: keyring.c,v 1.50 2011/06/25 00:37:44 agc Exp $");
|
__RCSID("$NetBSD: keyring.c,v 1.55 2017/03/27 21:19:12 khorben Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
|
|
@ -214,7 +214,7 @@ pgp_get_writable_seckey(pgp_key_t *data)
|
||||||
|
|
||||||
/* utility function to zero out memory */
|
/* utility function to zero out memory */
|
||||||
void
|
void
|
||||||
pgp_forget(void *vp, unsigned size)
|
pgp_forget(void *vp, size_t size)
|
||||||
{
|
{
|
||||||
(void) memset(vp, 0x0, size);
|
(void) memset(vp, 0x0, size);
|
||||||
}
|
}
|
||||||
|
|
@ -244,9 +244,11 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PGP_GET_PASSPHRASE:
|
case PGP_GET_PASSPHRASE:
|
||||||
(void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass));
|
if (pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)) == 0) {
|
||||||
|
pass[0] = '\0';
|
||||||
|
}
|
||||||
*content->skey_passphrase.passphrase = netpgp_strdup(pass);
|
*content->skey_passphrase.passphrase = netpgp_strdup(pass);
|
||||||
pgp_forget(pass, (unsigned)sizeof(pass));
|
pgp_forget(pass, sizeof(pass));
|
||||||
return PGP_KEEP_MEMORY;
|
return PGP_KEEP_MEMORY;
|
||||||
|
|
||||||
case PGP_PARSER_ERRCODE:
|
case PGP_PARSER_ERRCODE:
|
||||||
|
|
@ -292,6 +294,20 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
||||||
return PGP_RELEASE_MEMORY;
|
return PGP_RELEASE_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pgp_cb_ret_t
|
||||||
|
decrypt_cb_empty(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
||||||
|
{
|
||||||
|
const pgp_contents_t *content = &pkt->u;
|
||||||
|
|
||||||
|
switch (pkt->tag) {
|
||||||
|
case PGP_GET_PASSPHRASE:
|
||||||
|
*content->skey_passphrase.passphrase = netpgp_strdup("");
|
||||||
|
return PGP_KEEP_MEMORY;
|
||||||
|
default:
|
||||||
|
return decrypt_cb(pkt, cbinfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\ingroup Core_Keys
|
\ingroup Core_Keys
|
||||||
\brief Decrypts secret key from given keydata with given passphrase
|
\brief Decrypts secret key from given keydata with given passphrase
|
||||||
|
|
@ -300,14 +316,24 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
|
||||||
\return secret key
|
\return secret key
|
||||||
*/
|
*/
|
||||||
pgp_seckey_t *
|
pgp_seckey_t *
|
||||||
pgp_decrypt_seckey(const pgp_key_t *key, void *passfp)
|
pgp_decrypt_seckey(const pgp_key_t *key, FILE *passfp)
|
||||||
{
|
{
|
||||||
pgp_stream_t *stream;
|
pgp_stream_t *stream;
|
||||||
const int printerrors = 1;
|
const int printerrors = 1;
|
||||||
decrypt_t decrypt;
|
decrypt_t decrypt;
|
||||||
|
|
||||||
|
/* XXX first try with an empty passphrase */
|
||||||
(void) memset(&decrypt, 0x0, sizeof(decrypt));
|
(void) memset(&decrypt, 0x0, sizeof(decrypt));
|
||||||
decrypt.key = key;
|
decrypt.key = key;
|
||||||
|
stream = pgp_new(sizeof(*stream));
|
||||||
|
pgp_keydata_reader_set(stream, key);
|
||||||
|
pgp_set_callback(stream, decrypt_cb_empty, &decrypt);
|
||||||
|
stream->readinfo.accumulate = 1;
|
||||||
|
pgp_parse(stream, !printerrors);
|
||||||
|
if (decrypt.seckey != NULL) {
|
||||||
|
return decrypt.seckey;
|
||||||
|
}
|
||||||
|
/* ask for a passphrase */
|
||||||
decrypt.passfp = passfp;
|
decrypt.passfp = passfp;
|
||||||
stream = pgp_new(sizeof(*stream));
|
stream = pgp_new(sizeof(*stream));
|
||||||
pgp_keydata_reader_set(stream, key);
|
pgp_keydata_reader_set(stream, key);
|
||||||
|
|
@ -993,9 +1019,12 @@ pgp_keyring_list(pgp_io_t *io, const pgp_keyring_t *keyring, const int psigs)
|
||||||
{
|
{
|
||||||
pgp_key_t *key;
|
pgp_key_t *key;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
unsigned keyc = (keyring != NULL) ? keyring->keyc : 0;
|
||||||
|
|
||||||
(void) fprintf(io->res, "%u key%s\n", keyring->keyc,
|
(void) fprintf(io->res, "%u key%s\n", keyc, (keyc == 1) ? "" : "s");
|
||||||
(keyring->keyc == 1) ? "" : "s");
|
if (keyring == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) {
|
for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) {
|
||||||
if (pgp_is_key_secret(key)) {
|
if (pgp_is_key_secret(key)) {
|
||||||
pgp_print_keydata(io, keyring, key, "sec",
|
pgp_print_keydata(io, keyring, key, "sec",
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#ifndef KEYRING_H_
|
#ifndef KEYRING_H_
|
||||||
#define KEYRING_H_
|
#define KEYRING_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "packet-parse.h"
|
#include "packet-parse.h"
|
||||||
#include "mj.h"
|
#include "mj.h"
|
||||||
|
|
@ -91,7 +92,7 @@ const pgp_pubkey_t *pgp_get_pubkey(const pgp_key_t *);
|
||||||
unsigned pgp_is_key_secret(const pgp_key_t *);
|
unsigned pgp_is_key_secret(const pgp_key_t *);
|
||||||
const pgp_seckey_t *pgp_get_seckey(const pgp_key_t *);
|
const pgp_seckey_t *pgp_get_seckey(const pgp_key_t *);
|
||||||
pgp_seckey_t *pgp_get_writable_seckey(pgp_key_t *);
|
pgp_seckey_t *pgp_get_writable_seckey(pgp_key_t *);
|
||||||
pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, void *);
|
pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, FILE *);
|
||||||
|
|
||||||
unsigned pgp_keyring_fileread(pgp_keyring_t *, const unsigned,
|
unsigned pgp_keyring_fileread(pgp_keyring_t *, const unsigned,
|
||||||
const char *);
|
const char *);
|
||||||
|
|
@ -100,7 +101,7 @@ int pgp_keyring_list(pgp_io_t *, const pgp_keyring_t *, const int);
|
||||||
int pgp_keyring_json(pgp_io_t *, const pgp_keyring_t *, mj_t *, const int);
|
int pgp_keyring_json(pgp_io_t *, const pgp_keyring_t *, mj_t *, const int);
|
||||||
|
|
||||||
void pgp_set_seckey(pgp_contents_t *, const pgp_key_t *);
|
void pgp_set_seckey(pgp_contents_t *, const pgp_key_t *);
|
||||||
void pgp_forget(void *, unsigned);
|
void pgp_forget(void *, size_t);
|
||||||
|
|
||||||
const uint8_t *pgp_get_key_id(const pgp_key_t *);
|
const uint8_t *pgp_get_key_id(const pgp_key_t *);
|
||||||
unsigned pgp_get_userid_count(const pgp_key_t *);
|
unsigned pgp_get_userid_count(const pgp_key_t *);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: libnetpgp.3,v 1.16 2014/02/17 07:23:18 agc Exp $
|
.\" $NetBSD: libnetpgp.3,v 1.16.18.1 2018/05/06 09:47:47 martin Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 16, 2014
|
.Dd April 29, 2018
|
||||||
.Dt LIBNETPGP 3
|
.Dt LIBNETPGP 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
|
@ -79,6 +79,10 @@ The following functions are for variable management:
|
||||||
.Fo netpgp_incvar
|
.Fo netpgp_incvar
|
||||||
.Fa "netpgp_t *netpgp" "const char *name" "const int delta"
|
.Fa "netpgp_t *netpgp" "const char *name" "const int delta"
|
||||||
.Fc
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_unsetvar
|
||||||
|
.Fa "netpgp_t *netpgp" "const char *name"
|
||||||
|
.Fc
|
||||||
.Pp
|
.Pp
|
||||||
The following function sets the home directory:
|
The following function sets the home directory:
|
||||||
.Ft int
|
.Ft int
|
||||||
|
|
@ -92,8 +96,20 @@ The following functions are used for key management:
|
||||||
.Fa "netpgp_t *netpgp" "const int printsigs"
|
.Fa "netpgp_t *netpgp" "const int printsigs"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_match_list_keys
|
.Fo netpgp_list_keys_json
|
||||||
.Fa "netpgp_t *netpgp" "char *pattern"
|
.Fa "netpgp_t *netpgp" "char **json" "const int psigs"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_match_keys
|
||||||
|
.Fa "netpgp_t *netpgp" "char *name" "const char *fmt" "void *vp" "const int psigs"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_match_keys_json
|
||||||
|
.Fa "netpgp_t *netpgp" "char **json" "char *name" "const char *fmt" "const int psigs"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_match_pubkeys
|
||||||
|
.Fa "netpgp_t *netpgp" "char *name" "void *vp"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_find_key
|
.Fo netpgp_find_key
|
||||||
|
|
@ -101,7 +117,7 @@ The following functions are used for key management:
|
||||||
.Fc
|
.Fc
|
||||||
.Ft char *
|
.Ft char *
|
||||||
.Fo netpgp_get_key
|
.Fo netpgp_get_key
|
||||||
.Fa "netpgp_t *netpgp" "const char *id"
|
.Fa "netpgp_t *netpgp" "const char *name" "const char *fmt"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_export_key
|
.Fo netpgp_export_key
|
||||||
|
|
@ -115,31 +131,39 @@ The following functions are used for key management:
|
||||||
.Fo netpgp_generate_key
|
.Fo netpgp_generate_key
|
||||||
.Fa "netpgp_t *netpgp" "char *userid" "int numbits"
|
.Fa "netpgp_t *netpgp" "char *userid" "int numbits"
|
||||||
.Fc
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_validate_sigs
|
||||||
|
.Fa "netpgp_t *netpgp"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo netpgp_format_json
|
||||||
|
.Fa "void *vp" "const char *json" "const int psigs"
|
||||||
|
.Fc
|
||||||
.Pp
|
.Pp
|
||||||
The following functions are used for file management:
|
The following functions are used for file management:
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_encrypt_file
|
.Fo netpgp_encrypt_file
|
||||||
.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out"
|
.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out"
|
||||||
.Fa "int armored"
|
.Fa "int armored"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_decrypt_file
|
.Fo netpgp_decrypt_file
|
||||||
.Fa "netpgp_t *netpgp" "char *filename" "char *out" "int armored"
|
.Fa "netpgp_t *netpgp" "const char *filename" "char *out" "int armored"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_sign_file
|
.Fo netpgp_sign_file
|
||||||
.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out"
|
.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out"
|
||||||
.Fa "int armored" "int cleartext" "int detached"
|
.Fa "int armored" "int cleartext" "int detached"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_verify_file
|
.Fo netpgp_verify_file
|
||||||
.Fa "netpgp_t *netpgp" "char *f" "int armored"
|
.Fa "netpgp_t *netpgp" "const char *in" "const char *out" "int armored"
|
||||||
.Fc
|
.Fc
|
||||||
.Pp
|
.Pp
|
||||||
The following functions are used for memory signing and encryption:
|
The following functions are used for memory signing and encryption:
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo netpgp_encrypt_memory
|
.Fo netpgp_encrypt_memory
|
||||||
.Fa "netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize"
|
.Fa "netpgp_t *netpgp" "const char *userid" "void *in" "const size_t insize"
|
||||||
.Fa "char *out" "size_t outsize" "int armored"
|
.Fa "char *out" "size_t outsize" "int armored"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
|
|
@ -172,12 +196,13 @@ Normal operation sees the
|
||||||
.Nm
|
.Nm
|
||||||
process be initialised using the
|
process be initialised using the
|
||||||
.Fn netpgp_init
|
.Fn netpgp_init
|
||||||
function, which will set up the public and private keyrings, and set the
|
function, which will set up the public and private keyrings, as well as set the
|
||||||
user identity to the
|
user identity in the
|
||||||
.Ar userid
|
.Ar userid
|
||||||
argument passed stored in the
|
member of the
|
||||||
.Dv netpgp_t
|
.Dv netpgp_t
|
||||||
structure, and set using the
|
structure.
|
||||||
|
These are set using the
|
||||||
.Fn netpgp_setvar
|
.Fn netpgp_setvar
|
||||||
function.
|
function.
|
||||||
If no public key ring file is set, initial values will be taken from those
|
If no public key ring file is set, initial values will be taken from those
|
||||||
|
|
@ -189,6 +214,13 @@ initial values will be taken from those
|
||||||
in the
|
in the
|
||||||
.Pa .gnupg/secring.gpg
|
.Pa .gnupg/secring.gpg
|
||||||
file in the user's home directory.
|
file in the user's home directory.
|
||||||
|
The user identity is obtained from the
|
||||||
|
.Ev userid
|
||||||
|
environment variable, or failing that, the value of the
|
||||||
|
.Dq default-key
|
||||||
|
setting from
|
||||||
|
.Pa .gnupg/gpg.conf
|
||||||
|
file in the user's home directory is used.
|
||||||
The
|
The
|
||||||
.Fn netpgp_init
|
.Fn netpgp_init
|
||||||
function returns 1 on success, 0 on failure.
|
function returns 1 on success, 0 on failure.
|
||||||
|
|
@ -198,13 +230,6 @@ To list all the keys in a keyring, the
|
||||||
function is used.
|
function is used.
|
||||||
The signature subkey fields can also be displayed
|
The signature subkey fields can also be displayed
|
||||||
using this function.
|
using this function.
|
||||||
The
|
|
||||||
.Fn netpgp_match_list_keys
|
|
||||||
function is used to match (via regular expression)
|
|
||||||
a subset of the keys in the keyring.
|
|
||||||
If the expression to match is NULL,
|
|
||||||
the search will degenerate into a
|
|
||||||
listing of all keys in the keyring.
|
|
||||||
.Pp
|
.Pp
|
||||||
The home directory is specified as an internal variable,
|
The home directory is specified as an internal variable,
|
||||||
and its existence is checked using the
|
and its existence is checked using the
|
||||||
|
|
@ -223,13 +248,13 @@ Output is sent to the standard output.
|
||||||
.Pp
|
.Pp
|
||||||
To import a key onto the public keyring, the
|
To import a key onto the public keyring, the
|
||||||
.Fn netpgp_import_key
|
.Fn netpgp_import_key
|
||||||
is used.
|
function is used.
|
||||||
The name of the file containing the key to be imported is provided
|
The name of the file containing the key to be imported is provided
|
||||||
as the filename argument.
|
as the filename argument.
|
||||||
.Pp
|
.Pp
|
||||||
To generate a key, the
|
To generate a key, the
|
||||||
.Fn netpgp_generate_key
|
.Fn netpgp_generate_key
|
||||||
is used.
|
function is used.
|
||||||
It takes an argument of the number of bits to use in the key.
|
It takes an argument of the number of bits to use in the key.
|
||||||
At the time that this manual page was created (April 2009),
|
At the time that this manual page was created (April 2009),
|
||||||
the recommendations are that the bare minimum key size
|
the recommendations are that the bare minimum key size
|
||||||
|
|
|
||||||
35
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
vendored
35
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
vendored
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||||
__RCSID("$NetBSD: netpgp.c,v 1.96 2012/02/22 06:58:54 agc Exp $");
|
__RCSID("$NetBSD: netpgp.c,v 1.101 2017/03/27 20:55:13 khorben Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -1186,6 +1186,7 @@ netpgp_generate_key(netpgp_t *netpgp, char *id, int numbits)
|
||||||
int passc;
|
int passc;
|
||||||
int fd;
|
int fd;
|
||||||
int cc;
|
int cc;
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
uid = NULL;
|
uid = NULL;
|
||||||
io = netpgp->io;
|
io = netpgp->io;
|
||||||
|
|
@ -1212,13 +1213,13 @@ netpgp_generate_key(netpgp_t *netpgp, char *id, int numbits)
|
||||||
netpgp_setvar(netpgp, "generated userid", &dir[cc - 16]);
|
netpgp_setvar(netpgp, "generated userid", &dir[cc - 16]);
|
||||||
if (mkdir(dir, 0700) < 0) {
|
if (mkdir(dir, 0700) < 0) {
|
||||||
(void) fprintf(io->errs, "can't mkdir '%s'\n", dir);
|
(void) fprintf(io->errs, "can't mkdir '%s'\n", dir);
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
(void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir);
|
(void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir);
|
||||||
(void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir);
|
(void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir);
|
||||||
if (!appendkey(io, key, ringfile)) {
|
if (!appendkey(io, key, ringfile)) {
|
||||||
(void) fprintf(io->errs, "Cannot write pubkey to '%s'\n", ringfile);
|
(void) fprintf(io->errs, "Cannot write pubkey to '%s'\n", ringfile);
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
if (netpgp->pubring != NULL) {
|
if (netpgp->pubring != NULL) {
|
||||||
pgp_keyring_free(netpgp->pubring);
|
pgp_keyring_free(netpgp->pubring);
|
||||||
|
|
@ -1230,7 +1231,7 @@ netpgp_generate_key(netpgp_t *netpgp, char *id, int numbits)
|
||||||
}
|
}
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
(void) fprintf(io->errs, "can't append secring '%s'\n", ringfile);
|
(void) fprintf(io->errs, "can't append secring '%s'\n", ringfile);
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
/* get the passphrase */
|
/* get the passphrase */
|
||||||
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
|
if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL ||
|
||||||
|
|
@ -1242,15 +1243,18 @@ netpgp_generate_key(netpgp_t *netpgp, char *id, int numbits)
|
||||||
passc = find_passphrase(netpgp->passfp, &cp[ID_OFFSET], passphrase, sizeof(passphrase), attempts);
|
passc = find_passphrase(netpgp->passfp, &cp[ID_OFFSET], passphrase, sizeof(passphrase), attempts);
|
||||||
if (!pgp_write_xfer_seckey(create, key, (uint8_t *)passphrase, (const unsigned)passc, noarmor)) {
|
if (!pgp_write_xfer_seckey(create, key, (uint8_t *)passphrase, (const unsigned)passc, noarmor)) {
|
||||||
(void) fprintf(io->errs, "Cannot write seckey\n");
|
(void) fprintf(io->errs, "Cannot write seckey\n");
|
||||||
return 0;
|
goto out1;
|
||||||
}
|
}
|
||||||
|
rv = 1;
|
||||||
|
out1:
|
||||||
pgp_teardown_file_write(create, fd);
|
pgp_teardown_file_write(create, fd);
|
||||||
if (netpgp->secring != NULL) {
|
if (netpgp->secring != NULL) {
|
||||||
pgp_keyring_free(netpgp->secring);
|
pgp_keyring_free(netpgp->secring);
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
pgp_keydata_free(key);
|
pgp_keydata_free(key);
|
||||||
free(cp);
|
free(cp);
|
||||||
return 1;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* encrypt a file */
|
/* encrypt a file */
|
||||||
|
|
@ -1407,7 +1411,7 @@ netpgp_sign_file(netpgp_t *netpgp,
|
||||||
(unsigned)armored, (unsigned)cleartext,
|
(unsigned)armored, (unsigned)cleartext,
|
||||||
overwrite);
|
overwrite);
|
||||||
}
|
}
|
||||||
pgp_forget(seckey, (unsigned)sizeof(*seckey));
|
pgp_forget(seckey, sizeof(*seckey));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1501,10 +1505,17 @@ netpgp_sign_memory(netpgp_t *netpgp,
|
||||||
&pubkey->key.pubkey, 0);
|
&pubkey->key.pubkey, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* now decrypt key */
|
if (netpgp_getvar(netpgp, "ssh keys") == NULL) {
|
||||||
seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
|
/* now decrypt key */
|
||||||
if (seckey == NULL) {
|
seckey = pgp_decrypt_seckey(keypair, netpgp->passfp);
|
||||||
(void) fprintf(io->errs, "Bad passphrase\n");
|
if (seckey == NULL) {
|
||||||
|
(void) fprintf(io->errs, "Bad passphrase\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgp_keyring_t *secring;
|
||||||
|
|
||||||
|
secring = netpgp->secring;
|
||||||
|
seckey = &secring->keys[0].key.seckey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (seckey == NULL) {
|
if (seckey == NULL) {
|
||||||
|
|
@ -1531,7 +1542,7 @@ netpgp_sign_memory(netpgp_t *netpgp,
|
||||||
} else {
|
} else {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
pgp_forget(seckey, (unsigned)sizeof(*seckey));
|
pgp_forget(seckey, sizeof(*seckey));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||||
__RCSID("$NetBSD: reader.c,v 1.49 2012/03/05 02:20:18 christos Exp $");
|
__RCSID("$NetBSD: reader.c,v 1.52 2017/03/27 20:50:19 khorben Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -160,6 +160,7 @@ int
|
||||||
pgp_getpassphrase(void *in, char *phrase, size_t size)
|
pgp_getpassphrase(void *in, char *phrase, size_t size)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if (in == NULL) {
|
if (in == NULL) {
|
||||||
while ((p = getpass("netpgp passphrase: ")) == NULL) {
|
while ((p = getpass("netpgp passphrase: ")) == NULL) {
|
||||||
|
|
@ -169,7 +170,10 @@ pgp_getpassphrase(void *in, char *phrase, size_t size)
|
||||||
if (fgets(phrase, (int)size, in) == NULL) {
|
if (fgets(phrase, (int)size, in) == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
phrase[strlen(phrase) - 1] = 0x0;
|
len = strlen(phrase);
|
||||||
|
if (len >= 1 && phrase[len - 1] == '\n') {
|
||||||
|
phrase[len - 1] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
|
||||||
__RCSID("$NetBSD: signature.c,v 1.34 2012/03/05 02:20:18 christos Exp $");
|
__RCSID("$NetBSD: signature.c,v 1.37 2017/04/09 23:03:50 khorben Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -903,9 +903,13 @@ open_output_file(pgp_output_t **output,
|
||||||
|
|
||||||
/* setup output file */
|
/* setup output file */
|
||||||
if (outname) {
|
if (outname) {
|
||||||
fd = pgp_setup_file_write(output, outname, overwrite);
|
if (strcmp(outname, "-") == 0) {
|
||||||
|
fd = pgp_setup_file_write(output, NULL, overwrite);
|
||||||
|
} else {
|
||||||
|
fd = pgp_setup_file_write(output, outname, overwrite);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
unsigned flen = (unsigned)(strlen(inname) + 4 + 1);
|
size_t flen = strlen(inname) + 1 + strlen(suffix) + 1;
|
||||||
char *f = NULL;
|
char *f = NULL;
|
||||||
|
|
||||||
if ((f = calloc(1, flen)) == NULL) {
|
if ((f = calloc(1, flen)) == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: libnetpgpbn.3,v 1.4 2014/02/17 07:23:18 agc Exp $
|
.\" $NetBSD: libnetpgpbn.3,v 1.4.18.1 2018/05/06 09:47:47 martin Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2010 Alistair Crooks <agc@NetBSD.org>
|
.\" Copyright (c) 2010 Alistair Crooks <agc@NetBSD.org>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 16, 2014
|
.Dd April 3, 2018
|
||||||
.Dt LIBNETPGPBN 3
|
.Dt LIBNETPGPBN 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
|
@ -257,7 +257,7 @@ in the
|
||||||
buffer called
|
buffer called
|
||||||
.Va buf
|
.Va buf
|
||||||
where
|
where
|
||||||
.Dq USERNAME
|
.Dq USER
|
||||||
is the name of the user taken from the runtime environment.
|
is the name of the user taken from the runtime environment.
|
||||||
The encoded text will be in an allocated buffer called
|
The encoded text will be in an allocated buffer called
|
||||||
.Va s .
|
.Va s .
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: libmj.3,v 1.7 2014/02/17 07:23:18 agc Exp $
|
.\" $NetBSD: libmj.3,v 1.7.18.1 2018/05/06 09:47:47 martin Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2010 Alistair Crooks <agc@NetBSD.org>
|
.\" Copyright (c) 2010 Alistair Crooks <agc@NetBSD.org>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 16, 2014
|
.Dd April 3, 2018
|
||||||
.Dt LIBMJ 3
|
.Dt LIBMJ 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
|
@ -227,10 +227,10 @@ in the
|
||||||
buffer called
|
buffer called
|
||||||
.Va buf
|
.Va buf
|
||||||
where
|
where
|
||||||
.Dq USERNAME
|
.Dq USER
|
||||||
is the name of the user taken from the runtime environment.
|
is the name of the user taken from the runtime environment.
|
||||||
The encoded text will be in an allocated buffer called
|
The encoded text will be in an allocated buffer called
|
||||||
.Va s
|
.Va s .
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
mj_t atom;
|
mj_t atom;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: netpgp.1,v 1.19 2014/02/17 07:23:18 agc Exp $
|
.\" $NetBSD: netpgp.1,v 1.21 2017/03/27 21:34:32 khorben Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
@ -203,7 +203,7 @@ library.
|
||||||
In addition to one of the preceding commands, a number of qualifiers
|
In addition to one of the preceding commands, a number of qualifiers
|
||||||
or options may be given.
|
or options may be given.
|
||||||
.Bl -tag -width Ar
|
.Bl -tag -width Ar
|
||||||
.It Fl Fl armour , Fl armor
|
.It Fl Fl armour , Fl Fl armor
|
||||||
This option, however it is spelled, wraps the signature as an
|
This option, however it is spelled, wraps the signature as an
|
||||||
ASCII-encoded piece of text, for ease of use.
|
ASCII-encoded piece of text, for ease of use.
|
||||||
.It Fl Fl cipher Ar ciphername
|
.It Fl Fl cipher Ar ciphername
|
||||||
|
|
@ -216,7 +216,7 @@ access to the cipher used.
|
||||||
The default cipher algorithm is the
|
The default cipher algorithm is the
|
||||||
.Dq CAST5
|
.Dq CAST5
|
||||||
algorithm.
|
algorithm.
|
||||||
.It Fl Fl detached
|
.It Fl Fl detach , Fl Fl detached
|
||||||
When signing a file, place the resulting signature in a separate
|
When signing a file, place the resulting signature in a separate
|
||||||
file from the one being signed.
|
file from the one being signed.
|
||||||
.It Fl Fl hash-alg Ar hash-algorithm
|
.It Fl Fl hash-alg Ar hash-algorithm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.bsd,v 1.4 2015/02/05 01:26:54 agc Exp $
|
# $NetBSD: Makefile.bsd,v 1.7 2017/04/17 19:50:28 agc Exp $
|
||||||
|
|
||||||
PROG=netpgpverify
|
PROG=netpgpverify
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ SRCS+= pgpsum.c rsa.c
|
||||||
|
|
||||||
SRCS+= bzlib.c zlib.c
|
SRCS+= bzlib.c zlib.c
|
||||||
|
|
||||||
SRCS+= md5c.c rmd160.c sha1.c sha2.c tiger.c
|
SRCS+= md5c.c rmd160.c sha1.c sha2.c
|
||||||
|
|
||||||
CPPFLAGS+=-I.
|
CPPFLAGS+=-I.
|
||||||
|
|
||||||
|
|
@ -43,3 +43,9 @@ tst:
|
||||||
rm -f 1keytest.gpg
|
rm -f 1keytest.gpg
|
||||||
@echo "testing signing with a subkey"
|
@echo "testing signing with a subkey"
|
||||||
./chk.sh -k joyent-pubring.gpg digest-20121220.tgz
|
./chk.sh -k joyent-pubring.gpg digest-20121220.tgz
|
||||||
|
@echo "testing signatures with version"
|
||||||
|
./${PROG} -k pubring.gpg version.asc
|
||||||
|
@echo "testing signatures with no version"
|
||||||
|
./${PROG} -k pubring.gpg noversion.asc
|
||||||
|
@echo "testing dash-escaped text"
|
||||||
|
./${PROG} -k pubring.gpg dash-escaped-text.asc
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.in,v 1.8 2014/03/09 00:15:45 agc Exp $
|
# $NetBSD: Makefile.in,v 1.11 2017/04/17 19:50:28 agc Exp $
|
||||||
|
|
||||||
PROG=netpgpverify
|
PROG=netpgpverify
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ OBJS+= pgpsum.o rsa.o
|
||||||
|
|
||||||
OBJS+= bzlib.o zlib.o
|
OBJS+= bzlib.o zlib.o
|
||||||
|
|
||||||
OBJS+= sha1.o sha2.o md5c.o rmd160.o tiger.o
|
OBJS+= sha1.o sha2.o md5c.o rmd160.o
|
||||||
|
|
||||||
PREFIX=@PREFIX@
|
PREFIX=@PREFIX@
|
||||||
MANDIR=@MANDIR@
|
MANDIR=@MANDIR@
|
||||||
|
|
@ -26,8 +26,29 @@ tst:
|
||||||
./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.asc
|
./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.asc
|
||||||
./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.gpg
|
./${PROG} -k pubring.gpg NetBSD-6.0_RC1_hashes.gpg
|
||||||
./${PROG} -v
|
./${PROG} -v
|
||||||
./${PROG} -S testkey.pub data.gpg
|
./${PROG} -S sshtest-20140202.pub data.gpg
|
||||||
./${PROG} -S testkey.pub data.sig
|
./${PROG} -S sshtest-20140202.pub data.sig
|
||||||
|
@echo "expected failure, to check bad signatures fail to verify"
|
||||||
|
-sed -e 's|A|B|' data.gpg | ./${PROG} -S sshtest-20140202.pub
|
||||||
|
@echo ""
|
||||||
|
@echo "expected failure, no valid key for verification"
|
||||||
|
-./${PROG} -k /dev/null NetBSD-6.0_RC1_hashes.gpg
|
||||||
|
@echo "dumping now"
|
||||||
|
./${PROG} -c dump -k pubring.gpg NetBSD-6.0_RC1_hashes.asc > /dev/null
|
||||||
|
@echo "dumping ssh now"
|
||||||
|
./${PROG} -c dump -S sshtest-20140202.pub data.gpg
|
||||||
|
@echo "testing pubring with one key"
|
||||||
|
uudecode 1keytest.gpg.uu
|
||||||
|
./${PROG} -k 1keypubring.gpg 1keytest.gpg
|
||||||
|
rm -f 1keytest.gpg
|
||||||
|
@echo "testing signing with a subkey"
|
||||||
|
./chk.sh -k joyent-pubring.gpg digest-20121220.tgz
|
||||||
|
@echo "testing signatures with version"
|
||||||
|
./${PROG} -k pubring.gpg version.asc
|
||||||
|
@echo "testing signatures with no version"
|
||||||
|
./${PROG} -k pubring.gpg noversion.asc
|
||||||
|
@echo "testing dash-escaped text"
|
||||||
|
./${PROG} -k pubring.gpg dash-escaped-text.asc
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.core ${OBJS} ${PROG}
|
rm -rf *.core ${OBJS} ${PROG}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.lib.in,v 1.1 2014/03/09 00:15:45 agc Exp $
|
# $NetBSD: Makefile.lib.in,v 1.2 2017/04/17 19:50:28 agc Exp $
|
||||||
|
|
||||||
LIB= libnetpgpverify.a
|
LIB= libnetpgpverify.a
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ OBJS+= pgpsum.o rsa.o
|
||||||
|
|
||||||
OBJS+= bzlib.o zlib.o
|
OBJS+= bzlib.o zlib.o
|
||||||
|
|
||||||
OBJS+= sha1.o sha2.o md5c.o rmd160.o tiger.o
|
OBJS+= sha1.o sha2.o md5c.o rmd160.o
|
||||||
|
|
||||||
PREFIX=@PREFIX@
|
PREFIX=@PREFIX@
|
||||||
MANDIR=@MANDIR@
|
MANDIR=@MANDIR@
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.libtool.in,v 1.1 2014/03/09 00:15:45 agc Exp $
|
# $NetBSD: Makefile.libtool.in,v 1.2 2017/04/17 19:50:28 agc Exp $
|
||||||
|
|
||||||
LIB= libnetpgpverify.a
|
LIB= libnetpgpverify.a
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ OBJS+= pgpsum.o rsa.o
|
||||||
|
|
||||||
OBJS+= bzlib.o zlib.o
|
OBJS+= bzlib.o zlib.o
|
||||||
|
|
||||||
OBJS+= sha1.o sha2.o md5c.o rmd160.o tiger.o
|
OBJS+= sha1.o sha2.o md5c.o rmd160.o
|
||||||
|
|
||||||
PREFIX=@PREFIX@
|
PREFIX=@PREFIX@
|
||||||
MANDIR=@MANDIR@
|
MANDIR=@MANDIR@
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
#ifndef ARRAY_H_
|
#ifndef ARRAY_H_
|
||||||
#define ARRAY_H_ 20120921
|
#define ARRAY_H_ 20120921
|
||||||
|
|
||||||
#ifndef PGPV_ARRAY
|
#ifndef ARRAY
|
||||||
/* creates 2 unsigned vars called "name"c and "name"size in current scope */
|
/* creates 2 unsigned vars called "name"c and "name"size in current scope */
|
||||||
/* also creates an array called "name"s in current scope */
|
/* also creates an array called "name"s in current scope */
|
||||||
#define PGPV_ARRAY(type, name) \
|
#define ARRAY(type, name) \
|
||||||
unsigned name##c; unsigned name##vsize; type *name##s
|
unsigned name##c; unsigned name##vsize; type *name##s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -67,6 +67,8 @@
|
||||||
#define ARRAY_SIZE(name) name##vsize
|
#define ARRAY_SIZE(name) name##vsize
|
||||||
#define ARRAY_ARRAY(name) name##s
|
#define ARRAY_ARRAY(name) name##s
|
||||||
|
|
||||||
|
#define ARRAY_FREE(name) free(name##s)
|
||||||
|
|
||||||
#define ARRAY_APPEND(name, newel) do { \
|
#define ARRAY_APPEND(name, newel) do { \
|
||||||
ARRAY_EXPAND(name); \
|
ARRAY_EXPAND(name); \
|
||||||
ARRAY_COUNT(name) += 1; \
|
ARRAY_COUNT(name) += 1; \
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
# include <sys/kmem.h>
|
# include <sys/kmem.h>
|
||||||
#else
|
#else
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
|
# include <limits.h>
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
@ -88,6 +89,10 @@
|
||||||
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
|
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MP_ISZERO(a) (((a)->used == 0) ? MP_YES : MP_NO)
|
#define MP_ISZERO(a) (((a)->used == 0) ? MP_YES : MP_NO)
|
||||||
|
|
||||||
typedef int mp_err;
|
typedef int mp_err;
|
||||||
|
|
@ -216,7 +221,7 @@ trim_unused_digits(mp_int * a)
|
||||||
|
|
||||||
/* copy, b = a */
|
/* copy, b = a */
|
||||||
static int
|
static int
|
||||||
mp_copy(BIGNUM *a, BIGNUM *b)
|
mp_copy(PGPV_BIGNUM *a, PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
|
@ -1333,13 +1338,13 @@ fast_modular_inverse(mp_int * a, mp_int * b, mp_int * c)
|
||||||
|
|
||||||
top:
|
top:
|
||||||
/* 4. while u is even do */
|
/* 4. while u is even do */
|
||||||
while (BN_is_even(&u) == 1) {
|
while (PGPV_BN_is_even(&u) == 1) {
|
||||||
/* 4.1 u = u/2 */
|
/* 4.1 u = u/2 */
|
||||||
if ((res = half(&u, &u)) != MP_OKAY) {
|
if ((res = half(&u, &u)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
/* 4.2 if B is odd then */
|
/* 4.2 if B is odd then */
|
||||||
if (BN_is_odd(&B) == 1) {
|
if (PGPV_BN_is_odd(&B) == 1) {
|
||||||
if ((res = signed_subtract(&B, &x, &B)) != MP_OKAY) {
|
if ((res = signed_subtract(&B, &x, &B)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
|
|
@ -1351,13 +1356,13 @@ top:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5. while v is even do */
|
/* 5. while v is even do */
|
||||||
while (BN_is_even(&v) == 1) {
|
while (PGPV_BN_is_even(&v) == 1) {
|
||||||
/* 5.1 v = v/2 */
|
/* 5.1 v = v/2 */
|
||||||
if ((res = half(&v, &v)) != MP_OKAY) {
|
if ((res = half(&v, &v)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
/* 5.2 if D is odd then */
|
/* 5.2 if D is odd then */
|
||||||
if (BN_is_odd(&D) == 1) {
|
if (PGPV_BN_is_odd(&D) == 1) {
|
||||||
/* D = (D-x)/2 */
|
/* D = (D-x)/2 */
|
||||||
if ((res = signed_subtract(&D, &x, &D)) != MP_OKAY) {
|
if ((res = signed_subtract(&D, &x, &D)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
|
|
@ -1446,7 +1451,7 @@ slow_modular_inverse(mp_int * a, mp_int * b, mp_int * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2. [modified] if x,y are both even then return an error! */
|
/* 2. [modified] if x,y are both even then return an error! */
|
||||||
if (BN_is_even(&x) == 1 && BN_is_even(&y) == 1) {
|
if (PGPV_BN_is_even(&x) == 1 && PGPV_BN_is_even(&y) == 1) {
|
||||||
res = MP_VAL;
|
res = MP_VAL;
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
|
|
@ -1463,13 +1468,13 @@ slow_modular_inverse(mp_int * a, mp_int * b, mp_int * c)
|
||||||
|
|
||||||
top:
|
top:
|
||||||
/* 4. while u is even do */
|
/* 4. while u is even do */
|
||||||
while (BN_is_even(&u) == 1) {
|
while (PGPV_BN_is_even(&u) == 1) {
|
||||||
/* 4.1 u = u/2 */
|
/* 4.1 u = u/2 */
|
||||||
if ((res = half(&u, &u)) != MP_OKAY) {
|
if ((res = half(&u, &u)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
/* 4.2 if A or B is odd then */
|
/* 4.2 if A or B is odd then */
|
||||||
if (BN_is_odd(&A) == 1 || BN_is_odd(&B) == 1) {
|
if (PGPV_BN_is_odd(&A) == 1 || PGPV_BN_is_odd(&B) == 1) {
|
||||||
/* A = (A+y)/2, B = (B-x)/2 */
|
/* A = (A+y)/2, B = (B-x)/2 */
|
||||||
if ((res = signed_add(&A, &y, &A)) != MP_OKAY) {
|
if ((res = signed_add(&A, &y, &A)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
|
|
@ -1488,13 +1493,13 @@ top:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5. while v is even do */
|
/* 5. while v is even do */
|
||||||
while (BN_is_even(&v) == 1) {
|
while (PGPV_BN_is_even(&v) == 1) {
|
||||||
/* 5.1 v = v/2 */
|
/* 5.1 v = v/2 */
|
||||||
if ((res = half(&v, &v)) != MP_OKAY) {
|
if ((res = half(&v, &v)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
/* 5.2 if C or D is odd then */
|
/* 5.2 if C or D is odd then */
|
||||||
if (BN_is_odd(&C) == 1 || BN_is_odd(&D) == 1) {
|
if (PGPV_BN_is_odd(&C) == 1 || PGPV_BN_is_odd(&D) == 1) {
|
||||||
/* C = (C+y)/2, D = (D-x)/2 */
|
/* C = (C+y)/2, D = (D-x)/2 */
|
||||||
if ((res = signed_add(&C, &y, &C)) != MP_OKAY) {
|
if ((res = signed_add(&C, &y, &C)) != MP_OKAY) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
|
|
@ -1542,7 +1547,7 @@ top:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if not zero goto step 4 */
|
/* if not zero goto step 4 */
|
||||||
if (BN_is_zero(&u) == 0) {
|
if (PGPV_BN_is_zero(&u) == 0) {
|
||||||
goto top;
|
goto top;
|
||||||
}
|
}
|
||||||
/* now a = C, b = D, gcd == g*v */
|
/* now a = C, b = D, gcd == g*v */
|
||||||
|
|
@ -1584,7 +1589,7 @@ modular_inverse(mp_int *c, mp_int *a, mp_int *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the modulus is odd we can use a faster routine instead */
|
/* if the modulus is odd we can use a faster routine instead */
|
||||||
if (BN_is_odd(b) == 1) {
|
if (PGPV_BN_is_odd(b) == 1) {
|
||||||
return fast_modular_inverse(a, b, c);
|
return fast_modular_inverse(a, b, c);
|
||||||
}
|
}
|
||||||
return slow_modular_inverse(a, b, c);
|
return slow_modular_inverse(a, b, c);
|
||||||
|
|
@ -4065,9 +4070,6 @@ fast_exponent_modulo(mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode
|
||||||
*/
|
*/
|
||||||
int (*redux)(mp_int*,mp_int*,mp_digit);
|
int (*redux)(mp_int*,mp_int*,mp_digit);
|
||||||
|
|
||||||
#if defined(__minix)
|
|
||||||
mp = 0; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */
|
|
||||||
#endif /* defined(__minix) */
|
|
||||||
winsize = find_window_size(X);
|
winsize = find_window_size(X);
|
||||||
|
|
||||||
/* init M array */
|
/* init M array */
|
||||||
|
|
@ -4354,7 +4356,7 @@ exponent_modulo(mp_int * G, mp_int * X, mp_int * P, mp_int *Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the modulus is odd or diminished_radix, use the montgomery method */
|
/* if the modulus is odd or diminished_radix, use the montgomery method */
|
||||||
if (BN_is_odd(P) == 1 || diminished_radix) {
|
if (PGPV_BN_is_odd(P) == 1 || diminished_radix) {
|
||||||
return fast_exponent_modulo(G, X, P, Y, diminished_radix);
|
return fast_exponent_modulo(G, X, P, Y, diminished_radix);
|
||||||
}
|
}
|
||||||
/* otherwise use the generic Barrett reduction technique */
|
/* otherwise use the generic Barrett reduction technique */
|
||||||
|
|
@ -5022,7 +5024,7 @@ mp_toradix_n(mp_int * a, char *str, int radix, int maxlen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
formatbn(const BIGNUM *a, const int radix)
|
formatbn(const PGPV_BIGNUM *a, const int radix)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -5084,11 +5086,11 @@ mp_getradix_num(mp_int *a, int radix, char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getbn(BIGNUM **a, const char *str, int radix)
|
getbn(PGPV_BIGNUM **a, const char *str, int radix)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (a == NULL || str == NULL || (*a = BN_new()) == NULL) {
|
if (a == NULL || str == NULL || (*a = PGPV_BN_new()) == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (mp_getradix_num(*a, radix, __UNCONST(str)) != MP_OKAY) {
|
if (mp_getradix_num(*a, radix, __UNCONST(str)) != MP_OKAY) {
|
||||||
|
|
@ -5119,32 +5121,120 @@ subtract_modulo(mp_int *a, mp_int *b, mp_int *c, mp_int *d)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bn_mp_gcd.c */
|
||||||
|
/* Greatest Common Divisor using the binary method */
|
||||||
|
static int
|
||||||
|
mp_gcd(mp_int *a, mp_int *b, mp_int *c)
|
||||||
|
{
|
||||||
|
mp_int u, v;
|
||||||
|
int k, u_lsb, v_lsb, res;
|
||||||
|
|
||||||
|
/* either zero than gcd is the largest */
|
||||||
|
if (PGPV_BN_is_zero(a) == MP_YES) {
|
||||||
|
return absolute(b, c);
|
||||||
|
}
|
||||||
|
if (PGPV_BN_is_zero(b) == MP_YES) {
|
||||||
|
return absolute(a, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get copies of a and b we can modify */
|
||||||
|
if ((res = mp_init_copy(&u, a)) != MP_OKAY) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((res = mp_init_copy(&v, b)) != MP_OKAY) {
|
||||||
|
goto LBL_U;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* must be positive for the remainder of the algorithm */
|
||||||
|
u.sign = v.sign = MP_ZPOS;
|
||||||
|
|
||||||
|
/* B1. Find the common power of two for u and v */
|
||||||
|
u_lsb = mp_cnt_lsb(&u);
|
||||||
|
v_lsb = mp_cnt_lsb(&v);
|
||||||
|
k = MIN(u_lsb, v_lsb);
|
||||||
|
|
||||||
|
if (k > 0) {
|
||||||
|
/* divide the power of two out */
|
||||||
|
if ((res = rshift_bits(&u, k, &u, NULL)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((res = rshift_bits(&v, k, &v, NULL)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* divide any remaining factors of two out */
|
||||||
|
if (u_lsb != k) {
|
||||||
|
if ((res = rshift_bits(&u, u_lsb - k, &u, NULL)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v_lsb != k) {
|
||||||
|
if ((res = rshift_bits(&v, v_lsb - k, &v, NULL)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (PGPV_BN_is_zero(&v) == 0) {
|
||||||
|
/* make sure v is the largest */
|
||||||
|
if (compare_magnitude(&u, &v) == MP_GT) {
|
||||||
|
/* swap u and v to make sure v is >= u */
|
||||||
|
mp_exch(&u, &v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* subtract smallest from largest */
|
||||||
|
if ((res = signed_subtract(&v, &u, &v)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Divide out all factors of two */
|
||||||
|
if ((res = rshift_bits(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* multiply by 2**k which we divided out at the beginning */
|
||||||
|
if ((res = lshift_bits(&u, k, c)) != MP_OKAY) {
|
||||||
|
goto LBL_V;
|
||||||
|
}
|
||||||
|
c->sign = MP_ZPOS;
|
||||||
|
res = MP_OKAY;
|
||||||
|
LBL_V:
|
||||||
|
mp_clear (&u);
|
||||||
|
LBL_U:
|
||||||
|
mp_clear (&v);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
/* BIGNUM emulation layer */
|
/* PGPV_BIGNUM emulation layer */
|
||||||
|
|
||||||
/* essentiually, these are just wrappers around the libtommath functions */
|
/* essentiually, these are just wrappers around the libtommath functions */
|
||||||
/* usually the order of args changes */
|
/* usually the order of args changes */
|
||||||
/* the BIGNUM API tends to have more const poisoning */
|
/* the PGPV_BIGNUM API tends to have more const poisoning */
|
||||||
/* these wrappers also check the arguments passed for sanity */
|
/* these wrappers also check the arguments passed for sanity */
|
||||||
|
|
||||||
BIGNUM *
|
PGPV_BIGNUM *
|
||||||
BN_bin2bn(const uint8_t *data, int len, BIGNUM *ret)
|
PGPV_BN_bin2bn(const uint8_t *data, int len, PGPV_BIGNUM *ret)
|
||||||
{
|
{
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
return BN_new();
|
return PGPV_BN_new();
|
||||||
}
|
}
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
ret = BN_new();
|
ret = PGPV_BN_new();
|
||||||
}
|
}
|
||||||
return (mp_read_unsigned_bin(ret, data, len) == MP_OKAY) ? ret : NULL;
|
return (mp_read_unsigned_bin(ret, data, len) == MP_OKAY) ? ret : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store in unsigned [big endian] format */
|
/* store in unsigned [big endian] format */
|
||||||
int
|
int
|
||||||
BN_bn2bin(const BIGNUM *a, unsigned char *b)
|
PGPV_BN_bn2bin(const PGPV_BIGNUM *a, unsigned char *b)
|
||||||
{
|
{
|
||||||
BIGNUM t;
|
PGPV_BIGNUM t;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
if (a == NULL || b == NULL) {
|
if (a == NULL || b == NULL) {
|
||||||
|
|
@ -5153,7 +5243,7 @@ BN_bn2bin(const BIGNUM *a, unsigned char *b)
|
||||||
if (mp_init_copy (&t, __UNCONST(a)) != MP_OKAY) {
|
if (mp_init_copy (&t, __UNCONST(a)) != MP_OKAY) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (x = 0; !BN_is_zero(&t) ; ) {
|
for (x = 0; !PGPV_BN_is_zero(&t) ; ) {
|
||||||
b[x++] = (unsigned char) (t.dp[0] & 0xff);
|
b[x++] = (unsigned char) (t.dp[0] & 0xff);
|
||||||
if (rshift_bits(&t, 8, &t, NULL) != MP_OKAY) {
|
if (rshift_bits(&t, 8, &t, NULL) != MP_OKAY) {
|
||||||
mp_clear(&t);
|
mp_clear(&t);
|
||||||
|
|
@ -5166,17 +5256,17 @@ BN_bn2bin(const BIGNUM *a, unsigned char *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_init(BIGNUM *a)
|
PGPV_BN_init(PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a != NULL) {
|
if (a != NULL) {
|
||||||
mp_init(a);
|
mp_init(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BIGNUM *
|
PGPV_BIGNUM *
|
||||||
BN_new(void)
|
PGPV_BN_new(void)
|
||||||
{
|
{
|
||||||
BIGNUM *a;
|
PGPV_BIGNUM *a;
|
||||||
|
|
||||||
if ((a = allocate(1, sizeof(*a))) != NULL) {
|
if ((a = allocate(1, sizeof(*a))) != NULL) {
|
||||||
mp_init(a);
|
mp_init(a);
|
||||||
|
|
@ -5186,7 +5276,7 @@ BN_new(void)
|
||||||
|
|
||||||
/* copy, b = a */
|
/* copy, b = a */
|
||||||
int
|
int
|
||||||
BN_copy(BIGNUM *b, const BIGNUM *a)
|
PGPV_BN_copy(PGPV_BIGNUM *b, const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a == NULL || b == NULL) {
|
if (a == NULL || b == NULL) {
|
||||||
return MP_VAL;
|
return MP_VAL;
|
||||||
|
|
@ -5194,22 +5284,22 @@ BN_copy(BIGNUM *b, const BIGNUM *a)
|
||||||
return mp_copy(__UNCONST(a), b);
|
return mp_copy(__UNCONST(a), b);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIGNUM *
|
PGPV_BIGNUM *
|
||||||
BN_dup(const BIGNUM *a)
|
PGPV_BN_dup(const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
BIGNUM *ret;
|
PGPV_BIGNUM *ret;
|
||||||
|
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((ret = BN_new()) != NULL) {
|
if ((ret = PGPV_BN_new()) != NULL) {
|
||||||
BN_copy(ret, a);
|
PGPV_BN_copy(ret, a);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_swap(BIGNUM *a, BIGNUM *b)
|
PGPV_BN_swap(PGPV_BIGNUM *a, PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
if (a && b) {
|
if (a && b) {
|
||||||
mp_exch(a, b);
|
mp_exch(a, b);
|
||||||
|
|
@ -5217,47 +5307,47 @@ BN_swap(BIGNUM *a, BIGNUM *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
|
PGPV_BN_lshift(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, int n)
|
||||||
{
|
{
|
||||||
if (r == NULL || a == NULL || n < 0) {
|
if (r == NULL || a == NULL || n < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BN_copy(r, a);
|
PGPV_BN_copy(r, a);
|
||||||
return lshift_digits(r, n) == MP_OKAY;
|
return lshift_digits(r, n) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_lshift1(BIGNUM *r, BIGNUM *a)
|
PGPV_BN_lshift1(PGPV_BIGNUM *r, PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (r == NULL || a == NULL) {
|
if (r == NULL || a == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BN_copy(r, a);
|
PGPV_BN_copy(r, a);
|
||||||
return lshift_digits(r, 1) == MP_OKAY;
|
return lshift_digits(r, 1) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
|
PGPV_BN_rshift(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, int n)
|
||||||
{
|
{
|
||||||
if (r == NULL || a == NULL || n < 0) {
|
if (r == NULL || a == NULL || n < 0) {
|
||||||
return MP_VAL;
|
return MP_VAL;
|
||||||
}
|
}
|
||||||
BN_copy(r, a);
|
PGPV_BN_copy(r, a);
|
||||||
return rshift_digits(r, n) == MP_OKAY;
|
return rshift_digits(r, n) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_rshift1(BIGNUM *r, BIGNUM *a)
|
PGPV_BN_rshift1(PGPV_BIGNUM *r, PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (r == NULL || a == NULL) {
|
if (r == NULL || a == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BN_copy(r, a);
|
PGPV_BN_copy(r, a);
|
||||||
return rshift_digits(r, 1) == MP_OKAY;
|
return rshift_digits(r, 1) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_set_word(BIGNUM *a, BN_ULONG w)
|
PGPV_BN_set_word(PGPV_BIGNUM *a, PGPV_BN_ULONG w)
|
||||||
{
|
{
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5267,7 +5357,7 @@ BN_set_word(BIGNUM *a, BN_ULONG w)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
PGPV_BN_add(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, const PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
if (a == NULL || b == NULL || r == NULL) {
|
if (a == NULL || b == NULL || r == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5276,7 +5366,7 @@ BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
PGPV_BN_sub(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, const PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
if (a == NULL || b == NULL || r == NULL) {
|
if (a == NULL || b == NULL || r == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5285,7 +5375,7 @@ BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
PGPV_BN_mul(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, const PGPV_BIGNUM *b, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
if (a == NULL || b == NULL || r == NULL) {
|
if (a == NULL || b == NULL || r == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5295,7 +5385,7 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, BN_CTX *ctx)
|
PGPV_BN_div(PGPV_BIGNUM *dv, PGPV_BIGNUM *rem, const PGPV_BIGNUM *a, const PGPV_BIGNUM *d, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
if ((dv == NULL && rem == NULL) || a == NULL || d == NULL) {
|
if ((dv == NULL && rem == NULL) || a == NULL || d == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5306,7 +5396,7 @@ BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, BN_CTX *ctx)
|
||||||
|
|
||||||
/* perform a bit operation on the 2 bignums */
|
/* perform a bit operation on the 2 bignums */
|
||||||
int
|
int
|
||||||
BN_bitop(BIGNUM *r, const BIGNUM *a, char op, const BIGNUM *b)
|
PGPV_BN_bitop(PGPV_BIGNUM *r, const PGPV_BIGNUM *a, char op, const PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
unsigned ndigits;
|
unsigned ndigits;
|
||||||
mp_digit ad;
|
mp_digit ad;
|
||||||
|
|
@ -5316,11 +5406,11 @@ BN_bitop(BIGNUM *r, const BIGNUM *a, char op, const BIGNUM *b)
|
||||||
if (a == NULL || b == NULL || r == NULL) {
|
if (a == NULL || b == NULL || r == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (BN_cmp(__UNCONST(a), __UNCONST(b)) >= 0) {
|
if (PGPV_BN_cmp(__UNCONST(a), __UNCONST(b)) >= 0) {
|
||||||
BN_copy(r, a);
|
PGPV_BN_copy(r, a);
|
||||||
ndigits = a->used;
|
ndigits = a->used;
|
||||||
} else {
|
} else {
|
||||||
BN_copy(r, b);
|
PGPV_BN_copy(r, b);
|
||||||
ndigits = b->used;
|
ndigits = b->used;
|
||||||
}
|
}
|
||||||
for (i = 0 ; i < (int)ndigits ; i++) {
|
for (i = 0 ; i < (int)ndigits ; i++) {
|
||||||
|
|
@ -5344,7 +5434,16 @@ BN_bitop(BIGNUM *r, const BIGNUM *a, char op, const BIGNUM *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_free(BIGNUM *a)
|
PGPV_BN_free(PGPV_BIGNUM *a)
|
||||||
|
{
|
||||||
|
if (a) {
|
||||||
|
mp_clear(a);
|
||||||
|
free(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PGPV_BN_clear(PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a) {
|
if (a) {
|
||||||
mp_clear(a);
|
mp_clear(a);
|
||||||
|
|
@ -5352,23 +5451,14 @@ BN_free(BIGNUM *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_clear(BIGNUM *a)
|
PGPV_BN_clear_free(PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a) {
|
PGPV_BN_clear(a);
|
||||||
mp_clear(a);
|
free(a);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BN_clear_free(BIGNUM *a)
|
|
||||||
{
|
|
||||||
if (a) {
|
|
||||||
mp_clear(a);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_num_bytes(const BIGNUM *a)
|
PGPV_BN_num_bytes(const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
return MP_VAL;
|
return MP_VAL;
|
||||||
|
|
@ -5377,7 +5467,7 @@ BN_num_bytes(const BIGNUM *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_num_bits(const BIGNUM *a)
|
PGPV_BN_num_bits(const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5386,7 +5476,7 @@ BN_num_bits(const BIGNUM *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_set_negative(BIGNUM *a, int n)
|
PGPV_BN_set_negative(PGPV_BIGNUM *a, int n)
|
||||||
{
|
{
|
||||||
if (a) {
|
if (a) {
|
||||||
a->sign = (n) ? MP_NEG : 0;
|
a->sign = (n) ? MP_NEG : 0;
|
||||||
|
|
@ -5394,7 +5484,7 @@ BN_set_negative(BIGNUM *a, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_cmp(BIGNUM *a, BIGNUM *b)
|
PGPV_BN_cmp(PGPV_BIGNUM *a, PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
if (a == NULL || b == NULL) {
|
if (a == NULL || b == NULL) {
|
||||||
return MP_VAL;
|
return MP_VAL;
|
||||||
|
|
@ -5411,7 +5501,7 @@ BN_cmp(BIGNUM *a, BIGNUM *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_mod_exp(BIGNUM *Y, BIGNUM *G, BIGNUM *X, BIGNUM *P, BN_CTX *ctx)
|
PGPV_BN_mod_exp(PGPV_BIGNUM *Y, PGPV_BIGNUM *G, PGPV_BIGNUM *X, PGPV_BIGNUM *P, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
if (Y == NULL || G == NULL || X == NULL || P == NULL) {
|
if (Y == NULL || G == NULL || X == NULL || P == NULL) {
|
||||||
return MP_VAL;
|
return MP_VAL;
|
||||||
|
|
@ -5420,8 +5510,8 @@ BN_mod_exp(BIGNUM *Y, BIGNUM *G, BIGNUM *X, BIGNUM *P, BN_CTX *ctx)
|
||||||
return exponent_modulo(G, X, P, Y) == MP_OKAY;
|
return exponent_modulo(G, X, P, Y) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
BIGNUM *
|
PGPV_BIGNUM *
|
||||||
BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
|
PGPV_BN_mod_inverse(PGPV_BIGNUM *r, PGPV_BIGNUM *a, const PGPV_BIGNUM *n, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
USE_ARG(ctx);
|
USE_ARG(ctx);
|
||||||
if (r == NULL || a == NULL || n == NULL) {
|
if (r == NULL || a == NULL || n == NULL) {
|
||||||
|
|
@ -5431,7 +5521,7 @@ BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
|
PGPV_BN_mod_mul(PGPV_BIGNUM *ret, PGPV_BIGNUM *a, PGPV_BIGNUM *b, const PGPV_BIGNUM *m, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
USE_ARG(ctx);
|
USE_ARG(ctx);
|
||||||
if (ret == NULL || a == NULL || b == NULL || m == NULL) {
|
if (ret == NULL || a == NULL || b == NULL || m == NULL) {
|
||||||
|
|
@ -5440,14 +5530,14 @@ BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
|
||||||
return multiply_modulo(ret, a, b, __UNCONST(m)) == MP_OKAY;
|
return multiply_modulo(ret, a, b, __UNCONST(m)) == MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
BN_CTX *
|
PGPV_BN_CTX *
|
||||||
BN_CTX_new(void)
|
PGPV_BN_CTX_new(void)
|
||||||
{
|
{
|
||||||
return allocate(1, sizeof(BN_CTX));
|
return allocate(1, sizeof(PGPV_BN_CTX));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_CTX_init(BN_CTX *c)
|
PGPV_BN_CTX_init(PGPV_BN_CTX *c)
|
||||||
{
|
{
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
c->arraysize = 15;
|
c->arraysize = 15;
|
||||||
|
|
@ -5457,61 +5547,61 @@ BN_CTX_init(BN_CTX *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BIGNUM *
|
PGPV_BIGNUM *
|
||||||
BN_CTX_get(BN_CTX *ctx)
|
PGPV_BN_CTX_get(PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
if (ctx == NULL || ctx->v == NULL || ctx->arraysize == 0 || ctx->count == ctx->arraysize - 1) {
|
if (ctx == NULL || ctx->v == NULL || ctx->arraysize == 0 || ctx->count == ctx->arraysize - 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return ctx->v[ctx->count++] = BN_new();
|
return ctx->v[ctx->count++] = PGPV_BN_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_CTX_start(BN_CTX *ctx)
|
PGPV_BN_CTX_start(PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
BN_CTX_init(ctx);
|
PGPV_BN_CTX_init(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_CTX_free(BN_CTX *c)
|
PGPV_BN_CTX_free(PGPV_BN_CTX *c)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
if (c != NULL && c->v != NULL) {
|
if (c != NULL && c->v != NULL) {
|
||||||
for (i = 0 ; i < c->count ; i++) {
|
for (i = 0 ; i < c->count ; i++) {
|
||||||
BN_clear_free(c->v[i]);
|
PGPV_BN_clear_free(c->v[i]);
|
||||||
}
|
}
|
||||||
deallocate(c->v, sizeof(*c->v) * c->arraysize);
|
deallocate(c->v, sizeof(*c->v) * c->arraysize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BN_CTX_end(BN_CTX *ctx)
|
PGPV_BN_CTX_end(PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
BN_CTX_free(ctx);
|
PGPV_BN_CTX_free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
BN_bn2hex(const BIGNUM *a)
|
PGPV_BN_bn2hex(const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
return (a == NULL) ? NULL : formatbn(a, 16);
|
return (a == NULL) ? NULL : formatbn(a, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
BN_bn2dec(const BIGNUM *a)
|
PGPV_BN_bn2dec(const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
return (a == NULL) ? NULL : formatbn(a, 10);
|
return (a == NULL) ? NULL : formatbn(a, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
BN_bn2radix(const BIGNUM *a, unsigned radix)
|
PGPV_BN_bn2radix(const PGPV_BIGNUM *a, unsigned radix)
|
||||||
{
|
{
|
||||||
return (a == NULL) ? NULL : formatbn(a, (int)radix);
|
return (a == NULL) ? NULL : formatbn(a, (int)radix);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
int
|
int
|
||||||
BN_print_fp(FILE *fp, const BIGNUM *a)
|
PGPV_BN_print_fp(FILE *fp, const PGPV_BIGNUM *a)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -5519,16 +5609,16 @@ BN_print_fp(FILE *fp, const BIGNUM *a)
|
||||||
if (fp == NULL || a == NULL) {
|
if (fp == NULL || a == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
s = BN_bn2hex(a);
|
s = PGPV_BN_bn2hex(a);
|
||||||
ret = fprintf(fp, "%s", s);
|
ret = fprintf(fp, "%s", s);
|
||||||
deallocate(s, strlen(s) + 1);
|
deallocate(s, strlen(s) + 1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BN_RAND_NEEDED
|
#ifdef PGPV_BN_RAND_NEEDED
|
||||||
int
|
int
|
||||||
BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
|
PGPV_BN_rand(PGPV_BIGNUM *rnd, int bits, int top, int bottom)
|
||||||
{
|
{
|
||||||
uint64_t r;
|
uint64_t r;
|
||||||
int digits;
|
int digits;
|
||||||
|
|
@ -5543,6 +5633,7 @@ BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
|
||||||
r <<= 32;
|
r <<= 32;
|
||||||
r |= arc4random();
|
r |= arc4random();
|
||||||
rnd->dp[i] = (r & MP_MASK);
|
rnd->dp[i] = (r & MP_MASK);
|
||||||
|
rnd->used += 1;
|
||||||
}
|
}
|
||||||
if (top == 0) {
|
if (top == 0) {
|
||||||
rnd->dp[rnd->used - 1] |= (((mp_digit)1)<<((mp_digit)DIGIT_BIT));
|
rnd->dp[rnd->used - 1] |= (((mp_digit)1)<<((mp_digit)DIGIT_BIT));
|
||||||
|
|
@ -5558,18 +5649,18 @@ BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_rand_range(BIGNUM *rnd, BIGNUM *range)
|
PGPV_BN_rand_range(PGPV_BIGNUM *rnd, PGPV_BIGNUM *range)
|
||||||
{
|
{
|
||||||
if (rnd == NULL || range == NULL || BN_is_zero(range)) {
|
if (rnd == NULL || range == NULL || PGPV_BN_is_zero(range)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BN_rand(rnd, BN_num_bits(range), 1, 0);
|
PGPV_BN_rand(rnd, PGPV_BN_num_bits(range), 1, 0);
|
||||||
return modulo(rnd, range, rnd) == MP_OKAY;
|
return modulo(rnd, range, rnd) == MP_OKAY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg)
|
PGPV_BN_is_prime(const PGPV_BIGNUM *a, int checks, void (*callback)(int, int, void *), PGPV_BN_CTX *ctx, void *cb_arg)
|
||||||
{
|
{
|
||||||
int primality;
|
int primality;
|
||||||
|
|
||||||
|
|
@ -5582,35 +5673,35 @@ BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int, int, void *), BN_
|
||||||
return (mp_prime_is_prime(__UNCONST(a), checks, &primality) == MP_OKAY) ? primality : 0;
|
return (mp_prime_is_prime(__UNCONST(a), checks, &primality) == MP_OKAY) ? primality : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BIGNUM *
|
const PGPV_BIGNUM *
|
||||||
BN_value_one(void)
|
PGPV_BN_value_one(void)
|
||||||
{
|
{
|
||||||
static mp_digit digit = 1UL;
|
static mp_digit digit = 1UL;
|
||||||
static const BIGNUM one = { &digit, 1, 1, 0 };
|
static const PGPV_BIGNUM one = { &digit, 1, 1, 0 };
|
||||||
|
|
||||||
return &one;
|
return &one;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_hex2bn(BIGNUM **a, const char *str)
|
PGPV_BN_hex2bn(PGPV_BIGNUM **a, const char *str)
|
||||||
{
|
{
|
||||||
return getbn(a, str, 16);
|
return getbn(a, str, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_dec2bn(BIGNUM **a, const char *str)
|
PGPV_BN_dec2bn(PGPV_BIGNUM **a, const char *str)
|
||||||
{
|
{
|
||||||
return getbn(a, str, 10);
|
return getbn(a, str, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_radix2bn(BIGNUM **a, const char *str, unsigned radix)
|
PGPV_BN_radix2bn(PGPV_BIGNUM **a, const char *str, unsigned radix)
|
||||||
{
|
{
|
||||||
return getbn(a, str, (int)radix);
|
return getbn(a, str, (int)radix);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
|
PGPV_BN_mod_sub(PGPV_BIGNUM *r, PGPV_BIGNUM *a, PGPV_BIGNUM *b, const PGPV_BIGNUM *m, PGPV_BN_CTX *ctx)
|
||||||
{
|
{
|
||||||
USE_ARG(ctx);
|
USE_ARG(ctx);
|
||||||
if (r == NULL || a == NULL || b == NULL || m == NULL) {
|
if (r == NULL || a == NULL || b == NULL || m == NULL) {
|
||||||
|
|
@ -5620,7 +5711,7 @@ BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
BN_is_bit_set(const BIGNUM *a, int n)
|
PGPV_BN_is_bit_set(const PGPV_BIGNUM *a, int n)
|
||||||
{
|
{
|
||||||
if (a == NULL || n < 0 || n >= a->used * DIGIT_BIT) {
|
if (a == NULL || n < 0 || n >= a->used * DIGIT_BIT) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5630,52 +5721,59 @@ BN_is_bit_set(const BIGNUM *a, int n)
|
||||||
|
|
||||||
/* raise 'a' to power of 'b' */
|
/* raise 'a' to power of 'b' */
|
||||||
int
|
int
|
||||||
BN_raise(BIGNUM *res, BIGNUM *a, BIGNUM *b)
|
PGPV_BN_raise(PGPV_BIGNUM *res, PGPV_BIGNUM *a, PGPV_BIGNUM *b)
|
||||||
{
|
{
|
||||||
uint64_t exponent;
|
uint64_t exponent;
|
||||||
BIGNUM *power;
|
PGPV_BIGNUM *power;
|
||||||
BIGNUM *temp;
|
PGPV_BIGNUM *temp;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
t = BN_bn2dec(b);
|
t = PGPV_BN_bn2dec(b);
|
||||||
exponent = (uint64_t)strtoull(t, NULL, 10);
|
exponent = (uint64_t)strtoull(t, NULL, 10);
|
||||||
free(t);
|
free(t);
|
||||||
if (exponent == 0) {
|
if (exponent == 0) {
|
||||||
BN_copy(res, BN_value_one());
|
PGPV_BN_copy(res, PGPV_BN_value_one());
|
||||||
} else {
|
} else {
|
||||||
power = BN_dup(a);
|
power = PGPV_BN_dup(a);
|
||||||
for ( ; (exponent & 1) == 0 ; exponent >>= 1) {
|
for ( ; (exponent & 1) == 0 ; exponent >>= 1) {
|
||||||
BN_mul(power, power, power, NULL);
|
PGPV_BN_mul(power, power, power, NULL);
|
||||||
}
|
}
|
||||||
temp = BN_dup(power);
|
temp = PGPV_BN_dup(power);
|
||||||
for (exponent >>= 1 ; exponent > 0 ; exponent >>= 1) {
|
for (exponent >>= 1 ; exponent > 0 ; exponent >>= 1) {
|
||||||
BN_mul(power, power, power, NULL);
|
PGPV_BN_mul(power, power, power, NULL);
|
||||||
if (exponent & 1) {
|
if (exponent & 1) {
|
||||||
BN_mul(temp, power, temp, NULL);
|
PGPV_BN_mul(temp, power, temp, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BN_copy(res, temp);
|
PGPV_BN_copy(res, temp);
|
||||||
BN_free(power);
|
PGPV_BN_free(power);
|
||||||
BN_free(temp);
|
PGPV_BN_free(temp);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute the factorial */
|
/* compute the factorial */
|
||||||
int
|
int
|
||||||
BN_factorial(BIGNUM *res, BIGNUM *f)
|
PGPV_BN_factorial(PGPV_BIGNUM *res, PGPV_BIGNUM *f)
|
||||||
{
|
{
|
||||||
BIGNUM *one;
|
PGPV_BIGNUM *one;
|
||||||
BIGNUM *i;
|
PGPV_BIGNUM *i;
|
||||||
|
|
||||||
i = BN_dup(f);
|
i = PGPV_BN_dup(f);
|
||||||
one = __UNCONST(BN_value_one());
|
one = __UNCONST(PGPV_BN_value_one());
|
||||||
BN_sub(i, i, one);
|
PGPV_BN_sub(i, i, one);
|
||||||
BN_copy(res, f);
|
PGPV_BN_copy(res, f);
|
||||||
while (BN_cmp(i, one) > 0) {
|
while (PGPV_BN_cmp(i, one) > 0) {
|
||||||
BN_mul(res, res, i, NULL);
|
PGPV_BN_mul(res, res, i, NULL);
|
||||||
BN_sub(i, i, one);
|
PGPV_BN_sub(i, i, one);
|
||||||
}
|
}
|
||||||
BN_free(i);
|
PGPV_BN_free(i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get greatest common divisor */
|
||||||
|
int
|
||||||
|
PGPV_BN_gcd(PGPV_BIGNUM *r, PGPV_BIGNUM *a, PGPV_BIGNUM *b, PGPV_BN_CTX *ctx)
|
||||||
|
{
|
||||||
|
return mp_gcd(a, b, r);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,66 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#ifdef USE_BN_INTERFACE
|
||||||
|
#define BIGNUM PGPV_BIGNUM
|
||||||
|
#define BN_ULONG PGPV_BN_ULONG
|
||||||
|
#define BN_CTX PGPV_BN_CTX
|
||||||
|
#define BN_is_negative PGPV_BN_is_negative
|
||||||
|
#define BN_is_zero PGPV_BN_is_zero
|
||||||
|
#define BN_is_odd PGPV_BN_is_odd
|
||||||
|
#define BN_is_even PGPV_BN_is_even
|
||||||
|
#define BN_new PGPV_BN_new
|
||||||
|
#define BN_dup PGPV_BN_dup
|
||||||
|
#define BN_copy PGPV_BN_copy
|
||||||
|
#define BN_init PGPV_BN_init
|
||||||
|
#define BN_free PGPV_BN_free
|
||||||
|
#define BN_clear PGPV_BN_clear
|
||||||
|
#define BN_clear_free PGPV_BN_clear_free
|
||||||
|
#define BN_cmp PGPV_BN_cmp
|
||||||
|
#define BN_bn2bin PGPV_BN_bn2bin
|
||||||
|
#define BN_bn2hex PGPV_BN_bn2hex
|
||||||
|
#define BN_bn2dec PGPV_BN_bn2dec
|
||||||
|
#define BN_bn2radix PGPV_BN_bn2radix
|
||||||
|
#define BN_hex2bn PGPV_BN_hex2bn
|
||||||
|
#define BN_dec2bn PGPV_BN_dec2bn
|
||||||
|
#define BN_radix2bn PGPV_BN_radix2bn
|
||||||
|
#ifndef _KERNEL
|
||||||
|
#define BN_print_fp PGPV_BN_print_fp
|
||||||
|
#endif
|
||||||
|
#define BN_add PGPV_BN_add
|
||||||
|
#define BN_sub PGPV_BN_sub
|
||||||
|
#define BN_mul PGPV_BN_mul
|
||||||
|
#define BN_div PGPV_BN_div
|
||||||
|
#define BN_swap PGPV_BN_swap
|
||||||
|
#define BN_bitop PGPV_BN_bitop
|
||||||
|
#define BN_lshift PGPV_BN_lshift
|
||||||
|
#define BN_lshift1 PGPV_BN_lshift1
|
||||||
|
#define BN_rshift PGPV_BN_rshift
|
||||||
|
#define BN_rshift1 PGPV_BN_rshift1
|
||||||
|
#define BN_set_word PGPV_BN_set_word
|
||||||
|
#define BN_set_negative PGPV_BN_set_negative
|
||||||
|
#define BN_num_bytes PGPV_BN_num_bytes
|
||||||
|
#define BN_num_bits PGPV_BN_num_bits
|
||||||
|
#define BN_mod_exp PGPV_BN_mod_exp
|
||||||
|
#define BN_mod_inverse PGPV_BN_mod_inverse
|
||||||
|
#define BN_mod_mul PGPV_BN_mod_mul
|
||||||
|
#define BN_mod_sub PGPV_BN_mod_sub
|
||||||
|
#define BN_raise PGPV_BN_raise
|
||||||
|
#define BN_factorial PGPV_BN_factorial
|
||||||
|
#define BN_CTX_new PGPV_BN_CTX_new
|
||||||
|
#define BN_CTX_get PGPV_BN_CTX_get
|
||||||
|
#define BN_CTX_start PGPV_BN_CTX_start
|
||||||
|
#define BN_CTX_end PGPV_BN_CTX_end
|
||||||
|
#define BN_CTX_init PGPV_BN_CTX_init
|
||||||
|
#define BN_CTX_free PGPV_BN_CTX_free
|
||||||
|
#define BN_rand PGPV_BN_rand
|
||||||
|
#define BN_rand_range PGPV_BN_rand_range
|
||||||
|
#define BN_is_prime PGPV_BN_is_prime
|
||||||
|
#define BN_value_one PGPV_BN_value_one
|
||||||
|
#define BN_is_bit_set PGPV_BN_is_bit_set
|
||||||
|
#define BN_gcd PGPV_BN_gcd
|
||||||
|
#endif /* USE_BN_INTERFACE */
|
||||||
|
|
||||||
/* should be 32bit on ILP32, 64bit on LP64 */
|
/* should be 32bit on ILP32, 64bit on LP64 */
|
||||||
typedef unsigned long mp_digit;
|
typedef unsigned long mp_digit;
|
||||||
typedef uint64_t mp_word;
|
typedef uint64_t mp_word;
|
||||||
|
|
@ -56,15 +116,15 @@ typedef struct mp_int {
|
||||||
int sign; /* non-zero if negative */
|
int sign; /* non-zero if negative */
|
||||||
} mp_int;
|
} mp_int;
|
||||||
|
|
||||||
#define BIGNUM mp_int
|
#define PGPV_BIGNUM mp_int
|
||||||
#define BN_ULONG mp_digit
|
#define PGPV_BN_ULONG mp_digit
|
||||||
|
|
||||||
/* a "context" of mp integers - never really used */
|
/* a "context" of mp integers - never really used */
|
||||||
typedef struct bn_ctx_t {
|
typedef struct bn_ctx_t {
|
||||||
size_t count;
|
size_t count;
|
||||||
size_t arraysize;
|
size_t arraysize;
|
||||||
BIGNUM **v;
|
PGPV_BIGNUM **v;
|
||||||
} BN_CTX;
|
} PGPV_BN_CTX;
|
||||||
|
|
||||||
#define MP_LT -1
|
#define MP_LT -1
|
||||||
#define MP_EQ 0
|
#define MP_EQ 0
|
||||||
|
|
@ -80,72 +140,74 @@ typedef struct bn_ctx_t {
|
||||||
|
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
|
||||||
#define BN_is_negative(x) ((x)->sign == MP_NEG)
|
#define PGPV_BN_is_negative(x) ((x)->sign == MP_NEG)
|
||||||
#define BN_is_zero(a) (((a)->used == 0) ? 1 : 0)
|
#define PGPV_BN_is_zero(a) (((a)->used == 0) ? 1 : 0)
|
||||||
#define BN_is_odd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? 1 : 0)
|
#define PGPV_BN_is_odd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? 1 : 0)
|
||||||
#define BN_is_even(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? 1 : 0)
|
#define PGPV_BN_is_even(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? 1 : 0)
|
||||||
|
|
||||||
BIGNUM *BN_new(void);
|
PGPV_BIGNUM *PGPV_BN_new(void);
|
||||||
BIGNUM *BN_dup(const BIGNUM */*a*/);
|
PGPV_BIGNUM *PGPV_BN_dup(const PGPV_BIGNUM */*a*/);
|
||||||
int BN_copy(BIGNUM */*b*/, const BIGNUM */*a*/);
|
int PGPV_BN_copy(PGPV_BIGNUM */*b*/, const PGPV_BIGNUM */*a*/);
|
||||||
|
|
||||||
void BN_init(BIGNUM */*a*/);
|
void PGPV_BN_init(PGPV_BIGNUM */*a*/);
|
||||||
void BN_free(BIGNUM */*a*/);
|
void PGPV_BN_free(PGPV_BIGNUM */*a*/);
|
||||||
void BN_clear(BIGNUM */*a*/);
|
void PGPV_BN_clear(PGPV_BIGNUM */*a*/);
|
||||||
void BN_clear_free(BIGNUM */*a*/);
|
void PGPV_BN_clear_free(PGPV_BIGNUM */*a*/);
|
||||||
|
|
||||||
int BN_cmp(BIGNUM */*a*/, BIGNUM */*b*/);
|
int PGPV_BN_cmp(PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/);
|
||||||
|
|
||||||
BIGNUM *BN_bin2bn(const uint8_t */*buf*/, int /*size*/, BIGNUM */*bn*/);
|
PGPV_BIGNUM *PGPV_BN_bin2bn(const uint8_t */*buf*/, int /*size*/, PGPV_BIGNUM */*bn*/);
|
||||||
int BN_bn2bin(const BIGNUM */*a*/, unsigned char */*b*/);
|
int PGPV_BN_bn2bin(const PGPV_BIGNUM */*a*/, unsigned char */*b*/);
|
||||||
char *BN_bn2hex(const BIGNUM */*a*/);
|
char *PGPV_BN_bn2hex(const PGPV_BIGNUM */*a*/);
|
||||||
char *BN_bn2dec(const BIGNUM */*a*/);
|
char *PGPV_BN_bn2dec(const PGPV_BIGNUM */*a*/);
|
||||||
char *BN_bn2radix(const BIGNUM */*a*/, unsigned /*radix*/);
|
char *PGPV_BN_bn2radix(const PGPV_BIGNUM */*a*/, unsigned /*radix*/);
|
||||||
int BN_hex2bn(BIGNUM **/*a*/, const char */*str*/);
|
int PGPV_BN_hex2bn(PGPV_BIGNUM **/*a*/, const char */*str*/);
|
||||||
int BN_dec2bn(BIGNUM **/*a*/, const char */*str*/);
|
int PGPV_BN_dec2bn(PGPV_BIGNUM **/*a*/, const char */*str*/);
|
||||||
int BN_radix2bn(BIGNUM **/*a*/, const char */*str*/, unsigned /*radix*/);
|
int PGPV_BN_radix2bn(PGPV_BIGNUM **/*a*/, const char */*str*/, unsigned /*radix*/);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
int BN_print_fp(FILE */*fp*/, const BIGNUM */*a*/);
|
int PGPV_BN_print_fp(FILE */*fp*/, const PGPV_BIGNUM */*a*/);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int BN_add(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/);
|
int PGPV_BN_add(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, const PGPV_BIGNUM */*b*/);
|
||||||
int BN_sub(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/);
|
int PGPV_BN_sub(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, const PGPV_BIGNUM */*b*/);
|
||||||
int BN_mul(BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/, BN_CTX */*ctx*/);
|
int PGPV_BN_mul(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, const PGPV_BIGNUM */*b*/, PGPV_BN_CTX */*ctx*/);
|
||||||
int BN_div(BIGNUM */*q*/, BIGNUM */*r*/, const BIGNUM */*a*/, const BIGNUM */*b*/, BN_CTX */*ctx*/);
|
int PGPV_BN_div(PGPV_BIGNUM */*q*/, PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, const PGPV_BIGNUM */*b*/, PGPV_BN_CTX */*ctx*/);
|
||||||
void BN_swap(BIGNUM */*a*/, BIGNUM */*b*/);
|
void PGPV_BN_swap(PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/);
|
||||||
int BN_bitop(BIGNUM */*r*/, const BIGNUM */*a*/, char /*op*/, const BIGNUM */*b*/);
|
int PGPV_BN_bitop(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, char /*op*/, const PGPV_BIGNUM */*b*/);
|
||||||
int BN_lshift(BIGNUM */*r*/, const BIGNUM */*a*/, int /*n*/);
|
int PGPV_BN_lshift(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, int /*n*/);
|
||||||
int BN_lshift1(BIGNUM */*r*/, BIGNUM */*a*/);
|
int PGPV_BN_lshift1(PGPV_BIGNUM */*r*/, PGPV_BIGNUM */*a*/);
|
||||||
int BN_rshift(BIGNUM */*r*/, const BIGNUM */*a*/, int /*n*/);
|
int PGPV_BN_rshift(PGPV_BIGNUM */*r*/, const PGPV_BIGNUM */*a*/, int /*n*/);
|
||||||
int BN_rshift1(BIGNUM */*r*/, BIGNUM */*a*/);
|
int PGPV_BN_rshift1(PGPV_BIGNUM */*r*/, PGPV_BIGNUM */*a*/);
|
||||||
int BN_set_word(BIGNUM */*a*/, BN_ULONG /*w*/);
|
int PGPV_BN_set_word(PGPV_BIGNUM */*a*/, PGPV_BN_ULONG /*w*/);
|
||||||
void BN_set_negative(BIGNUM */*a*/, int /*n*/);
|
void PGPV_BN_set_negative(PGPV_BIGNUM */*a*/, int /*n*/);
|
||||||
|
|
||||||
int BN_num_bytes(const BIGNUM */*a*/);
|
int PGPV_BN_num_bytes(const PGPV_BIGNUM */*a*/);
|
||||||
int BN_num_bits(const BIGNUM */*a*/);
|
int PGPV_BN_num_bits(const PGPV_BIGNUM */*a*/);
|
||||||
|
|
||||||
int BN_mod_exp(BIGNUM */*r*/, BIGNUM */*a*/, BIGNUM */*p*/, BIGNUM */*m*/, BN_CTX */*ctx*/);
|
int PGPV_BN_mod_exp(PGPV_BIGNUM */*r*/, PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*p*/, PGPV_BIGNUM */*m*/, PGPV_BN_CTX */*ctx*/);
|
||||||
BIGNUM *BN_mod_inverse(BIGNUM */*ret*/, BIGNUM */*a*/, const BIGNUM */*n*/, BN_CTX */*ctx*/);
|
PGPV_BIGNUM *PGPV_BN_mod_inverse(PGPV_BIGNUM */*ret*/, PGPV_BIGNUM */*a*/, const PGPV_BIGNUM */*n*/, PGPV_BN_CTX */*ctx*/);
|
||||||
int BN_mod_mul(BIGNUM */*ret*/, BIGNUM */*a*/, BIGNUM */*b*/, const BIGNUM */*m*/, BN_CTX */*ctx*/);
|
int PGPV_BN_mod_mul(PGPV_BIGNUM */*ret*/, PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/, const PGPV_BIGNUM */*m*/, PGPV_BN_CTX */*ctx*/);
|
||||||
int BN_mod_sub(BIGNUM */*r*/, BIGNUM */*a*/, BIGNUM */*b*/, const BIGNUM */*m*/, BN_CTX */*ctx*/);
|
int PGPV_BN_mod_sub(PGPV_BIGNUM */*r*/, PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/, const PGPV_BIGNUM */*m*/, PGPV_BN_CTX */*ctx*/);
|
||||||
|
|
||||||
int BN_raise(BIGNUM */*res*/, BIGNUM */*a*/, BIGNUM */*b*/);
|
int PGPV_BN_raise(PGPV_BIGNUM */*res*/, PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/);
|
||||||
int BN_factorial(BIGNUM */*fact*/, BIGNUM */*f*/);
|
int PGPV_BN_factorial(PGPV_BIGNUM */*fact*/, PGPV_BIGNUM */*f*/);
|
||||||
|
|
||||||
BN_CTX *BN_CTX_new(void);
|
PGPV_BN_CTX *PGPV_BN_CTX_new(void);
|
||||||
BIGNUM *BN_CTX_get(BN_CTX */*ctx*/);
|
PGPV_BIGNUM *PGPV_BN_CTX_get(PGPV_BN_CTX */*ctx*/);
|
||||||
void BN_CTX_start(BN_CTX */*ctx*/);
|
void PGPV_BN_CTX_start(PGPV_BN_CTX */*ctx*/);
|
||||||
void BN_CTX_end(BN_CTX */*ctx*/);
|
void PGPV_BN_CTX_end(PGPV_BN_CTX */*ctx*/);
|
||||||
void BN_CTX_init(BN_CTX */*c*/);
|
void PGPV_BN_CTX_init(PGPV_BN_CTX */*c*/);
|
||||||
void BN_CTX_free(BN_CTX */*c*/);
|
void PGPV_BN_CTX_free(PGPV_BN_CTX */*c*/);
|
||||||
|
|
||||||
int BN_rand(BIGNUM */*rnd*/, int /*bits*/, int /*top*/, int /*bottom*/);
|
int PGPV_BN_rand(PGPV_BIGNUM */*rnd*/, int /*bits*/, int /*top*/, int /*bottom*/);
|
||||||
int BN_rand_range(BIGNUM */*rnd*/, BIGNUM */*range*/);
|
int PGPV_BN_rand_range(PGPV_BIGNUM */*rnd*/, PGPV_BIGNUM */*range*/);
|
||||||
|
|
||||||
int BN_is_prime(const BIGNUM */*a*/, int /*checks*/, void (*callback)(int, int, void *), BN_CTX */*ctx*/, void */*cb_arg*/);
|
int PGPV_BN_is_prime(const PGPV_BIGNUM */*a*/, int /*checks*/, void (*callback)(int, int, void *), PGPV_BN_CTX */*ctx*/, void */*cb_arg*/);
|
||||||
|
|
||||||
const BIGNUM *BN_value_one(void);
|
const PGPV_BIGNUM *PGPV_BN_value_one(void);
|
||||||
int BN_is_bit_set(const BIGNUM */*a*/, int /*n*/);
|
int PGPV_BN_is_bit_set(const PGPV_BIGNUM */*a*/, int /*n*/);
|
||||||
|
|
||||||
|
int PGPV_BN_gcd(PGPV_BIGNUM */*r*/, PGPV_BIGNUM */*a*/, PGPV_BIGNUM */*b*/, PGPV_BN_CTX */*ctx*/);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: bzlib.c,v 1.3 2015/02/05 01:26:54 agc Exp $ */
|
/* $NetBSD: bzlib.c,v 1.4 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
@ -35,7 +35,11 @@
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|
||||||
|
|
||||||
/* $NetBSD: bzlib.c,v 1.3 2015/02/05 01:26:54 agc Exp $ */
|
#ifndef USE_ARG
|
||||||
|
#define USE_ARG(x) /*LINTED*/(void)&(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* $NetBSD: bzlib.c,v 1.4 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
@ -1082,7 +1086,7 @@ const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/*--- end bzlib.c ---*/
|
/*--- end bzlib.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/* $NetBSD: bzlib.c,v 1.3 2015/02/05 01:26:54 agc Exp $ */
|
/* $NetBSD: bzlib.c,v 1.4 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
@ -1728,7 +1732,7 @@ Int32 BZ2_decompress ( DState* s )
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/*--- end decompress.c ---*/
|
/*--- end decompress.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/* $NetBSD: bzlib.c,v 1.3 2015/02/05 01:26:54 agc Exp $ */
|
/* $NetBSD: bzlib.c,v 1.4 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
@ -1832,7 +1836,7 @@ UInt32 BZ2_crc32Table[256] = {
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/*--- end crctable.c ---*/
|
/*--- end crctable.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/* $NetBSD: bzlib.c,v 1.3 2015/02/05 01:26:54 agc Exp $ */
|
/* $NetBSD: bzlib.c,v 1.4 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/syslog.h>
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
@ -46,6 +45,10 @@
|
||||||
|
|
||||||
#include "digest.h"
|
#include "digest.h"
|
||||||
|
|
||||||
|
#ifndef USE_ARG
|
||||||
|
#define USE_ARG(x) /*LINTED*/(void)&(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint8_t prefix_md5[] = {
|
static uint8_t prefix_md5[] = {
|
||||||
0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
|
0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
|
||||||
0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10
|
0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10
|
||||||
|
|
@ -61,12 +64,6 @@ static uint8_t prefix_sha256[] = {
|
||||||
0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint64_t prefix_tiger[] = {
|
|
||||||
0x0123456789ABCDEFLL,
|
|
||||||
0xFEDCBA9876543210LL,
|
|
||||||
0xF096A5B4C3B2E187LL
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint8_t prefix_rmd160[] = {
|
static uint8_t prefix_rmd160[] = {
|
||||||
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24,
|
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24,
|
||||||
0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14
|
0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14
|
||||||
|
|
@ -96,9 +93,6 @@ digest_alg_size(unsigned alg)
|
||||||
return 32;
|
return 32;
|
||||||
case SHA512_HASH_ALG:
|
case SHA512_HASH_ALG:
|
||||||
return 64;
|
return 64;
|
||||||
case TIGER_HASH_ALG:
|
|
||||||
case TIGER2_HASH_ALG:
|
|
||||||
return TIGER_DIGEST_LENGTH;
|
|
||||||
default:
|
default:
|
||||||
printf("hash_any: bad algorithm\n");
|
printf("hash_any: bad algorithm\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -114,54 +108,40 @@ digest_init(digest_t *hash, const uint32_t hashalg)
|
||||||
}
|
}
|
||||||
switch(hash->alg = hashalg) {
|
switch(hash->alg = hashalg) {
|
||||||
case MD5_HASH_ALG:
|
case MD5_HASH_ALG:
|
||||||
MD5Init(&hash->u.md5ctx);
|
netpgpv_MD5Init(&hash->u.md5ctx);
|
||||||
hash->size = 16;
|
hash->size = 16;
|
||||||
hash->prefix = prefix_md5;
|
hash->prefix = prefix_md5;
|
||||||
hash->len = sizeof(prefix_md5);
|
hash->len = sizeof(prefix_md5);
|
||||||
hash->ctx = &hash->u.md5ctx;
|
hash->ctx = &hash->u.md5ctx;
|
||||||
return 1;
|
return 1;
|
||||||
case SHA1_HASH_ALG:
|
case SHA1_HASH_ALG:
|
||||||
SHA1Init(&hash->u.sha1ctx);
|
netpgpv_SHA1Init(&hash->u.sha1ctx);
|
||||||
hash->size = 20;
|
hash->size = 20;
|
||||||
hash->prefix = prefix_sha1;
|
hash->prefix = prefix_sha1;
|
||||||
hash->len = sizeof(prefix_sha1);
|
hash->len = sizeof(prefix_sha1);
|
||||||
hash->ctx = &hash->u.sha1ctx;
|
hash->ctx = &hash->u.sha1ctx;
|
||||||
return 1;
|
return 1;
|
||||||
case RIPEMD_HASH_ALG:
|
case RIPEMD_HASH_ALG:
|
||||||
RMD160Init(&hash->u.rmd160ctx);
|
netpgpv_RMD160Init(&hash->u.rmd160ctx);
|
||||||
hash->size = 20;
|
hash->size = 20;
|
||||||
hash->prefix = prefix_rmd160;
|
hash->prefix = prefix_rmd160;
|
||||||
hash->len = sizeof(prefix_rmd160);
|
hash->len = sizeof(prefix_rmd160);
|
||||||
hash->ctx = &hash->u.rmd160ctx;
|
hash->ctx = &hash->u.rmd160ctx;
|
||||||
return 1;
|
return 1;
|
||||||
case SHA256_HASH_ALG:
|
case SHA256_HASH_ALG:
|
||||||
SHA256_Init(&hash->u.sha256ctx);
|
netpgpv_SHA256_Init(&hash->u.sha256ctx);
|
||||||
hash->size = 32;
|
hash->size = 32;
|
||||||
hash->prefix = prefix_sha256;
|
hash->prefix = prefix_sha256;
|
||||||
hash->len = sizeof(prefix_sha256);
|
hash->len = sizeof(prefix_sha256);
|
||||||
hash->ctx = &hash->u.sha256ctx;
|
hash->ctx = &hash->u.sha256ctx;
|
||||||
return 1;
|
return 1;
|
||||||
case SHA512_HASH_ALG:
|
case SHA512_HASH_ALG:
|
||||||
SHA512_Init(&hash->u.sha512ctx);
|
netpgpv_SHA512_Init(&hash->u.sha512ctx);
|
||||||
hash->size = 64;
|
hash->size = 64;
|
||||||
hash->prefix = prefix_sha512;
|
hash->prefix = prefix_sha512;
|
||||||
hash->len = sizeof(prefix_sha512);
|
hash->len = sizeof(prefix_sha512);
|
||||||
hash->ctx = &hash->u.sha512ctx;
|
hash->ctx = &hash->u.sha512ctx;
|
||||||
return 1;
|
return 1;
|
||||||
case TIGER_HASH_ALG:
|
|
||||||
TIGER_Init(&hash->u.tigerctx);
|
|
||||||
hash->size = TIGER_DIGEST_LENGTH;
|
|
||||||
hash->prefix = prefix_tiger;
|
|
||||||
hash->len = sizeof(prefix_tiger);
|
|
||||||
hash->ctx = &hash->u.tigerctx;
|
|
||||||
return 1;
|
|
||||||
case TIGER2_HASH_ALG:
|
|
||||||
TIGER2_Init(&hash->u.tigerctx);
|
|
||||||
hash->size = TIGER_DIGEST_LENGTH;
|
|
||||||
hash->prefix = prefix_tiger;
|
|
||||||
hash->len = sizeof(prefix_tiger);
|
|
||||||
hash->ctx = &hash->u.tigerctx;
|
|
||||||
return 1;
|
|
||||||
default:
|
default:
|
||||||
printf("hash_any: bad algorithm\n");
|
printf("hash_any: bad algorithm\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -179,8 +159,6 @@ static rec_t hashalgs[] = {
|
||||||
{ "ripemd", RIPEMD_HASH_ALG },
|
{ "ripemd", RIPEMD_HASH_ALG },
|
||||||
{ "sha256", SHA256_HASH_ALG },
|
{ "sha256", SHA256_HASH_ALG },
|
||||||
{ "sha512", SHA512_HASH_ALG },
|
{ "sha512", SHA512_HASH_ALG },
|
||||||
{ "tiger", TIGER_HASH_ALG },
|
|
||||||
{ "tiger2", TIGER2_HASH_ALG },
|
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -206,23 +184,19 @@ digest_update(digest_t *hash, const uint8_t *data, size_t length)
|
||||||
}
|
}
|
||||||
switch(hash->alg) {
|
switch(hash->alg) {
|
||||||
case MD5_HASH_ALG:
|
case MD5_HASH_ALG:
|
||||||
MD5Update(hash->ctx, data, (unsigned)length);
|
netpgpv_MD5Update(hash->ctx, data, (unsigned)length);
|
||||||
return 1;
|
return 1;
|
||||||
case SHA1_HASH_ALG:
|
case SHA1_HASH_ALG:
|
||||||
SHA1Update(hash->ctx, data, (unsigned)length);
|
netpgpv_SHA1Update(hash->ctx, data, (unsigned)length);
|
||||||
return 1;
|
return 1;
|
||||||
case RIPEMD_HASH_ALG:
|
case RIPEMD_HASH_ALG:
|
||||||
RMD160Update(hash->ctx, data, (unsigned)length);
|
netpgpv_RMD160Update(hash->ctx, data, (unsigned)length);
|
||||||
return 1;
|
return 1;
|
||||||
case SHA256_HASH_ALG:
|
case SHA256_HASH_ALG:
|
||||||
SHA256_Update(hash->ctx, data, length);
|
netpgpv_SHA256_Update(hash->ctx, data, length);
|
||||||
return 1;
|
return 1;
|
||||||
case SHA512_HASH_ALG:
|
case SHA512_HASH_ALG:
|
||||||
SHA512_Update(hash->ctx, data, length);
|
netpgpv_SHA512_Update(hash->ctx, data, length);
|
||||||
return 1;
|
|
||||||
case TIGER_HASH_ALG:
|
|
||||||
case TIGER2_HASH_ALG:
|
|
||||||
TIGER_Update(hash->ctx, data, length);
|
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
printf("hash_any: bad algorithm\n");
|
printf("hash_any: bad algorithm\n");
|
||||||
|
|
@ -238,22 +212,19 @@ digest_final(uint8_t *out, digest_t *hash)
|
||||||
}
|
}
|
||||||
switch(hash->alg) {
|
switch(hash->alg) {
|
||||||
case MD5_HASH_ALG:
|
case MD5_HASH_ALG:
|
||||||
MD5Final(out, hash->ctx);
|
netpgpv_MD5Final(out, hash->ctx);
|
||||||
break;
|
break;
|
||||||
case SHA1_HASH_ALG:
|
case SHA1_HASH_ALG:
|
||||||
SHA1Final(out, hash->ctx);
|
netpgpv_SHA1Final(out, hash->ctx);
|
||||||
break;
|
break;
|
||||||
case RIPEMD_HASH_ALG:
|
case RIPEMD_HASH_ALG:
|
||||||
RMD160Final(out, hash->ctx);
|
netpgpv_RMD160Final(out, hash->ctx);
|
||||||
break;
|
break;
|
||||||
case SHA256_HASH_ALG:
|
case SHA256_HASH_ALG:
|
||||||
SHA256_Final(out, hash->ctx);
|
netpgpv_SHA256_Final(out, hash->ctx);
|
||||||
break;
|
break;
|
||||||
case SHA512_HASH_ALG:
|
case SHA512_HASH_ALG:
|
||||||
SHA512_Final(out, hash->ctx);
|
netpgpv_SHA512_Final(out, hash->ctx);
|
||||||
break;
|
|
||||||
case TIGER_HASH_ALG:
|
|
||||||
TIGER_Final(out, hash->ctx);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("hash_any: bad algorithm\n");
|
printf("hash_any: bad algorithm\n");
|
||||||
|
|
@ -298,6 +269,9 @@ digest_get_prefix(unsigned hashalg, uint8_t *prefix, size_t size)
|
||||||
case SHA256_HASH_ALG:
|
case SHA256_HASH_ALG:
|
||||||
memcpy(prefix, prefix_sha256, sizeof(prefix_sha256));
|
memcpy(prefix, prefix_sha256, sizeof(prefix_sha256));
|
||||||
return sizeof(prefix_sha256);
|
return sizeof(prefix_sha256);
|
||||||
|
case SHA512_HASH_ALG:
|
||||||
|
memcpy(prefix, prefix_sha512, sizeof(prefix_sha512));
|
||||||
|
return sizeof(prefix_sha512);
|
||||||
default:
|
default:
|
||||||
printf("digest_get_prefix: unknown hash algorithm: %d\n", hashalg);
|
printf("digest_get_prefix: unknown hash algorithm: %d\n", hashalg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
#include "sha2.h"
|
#include "sha2.h"
|
||||||
#include "rmd160.h"
|
#include "rmd160.h"
|
||||||
#include "tiger.h"
|
|
||||||
|
|
||||||
#ifndef __BEGIN_DECLS
|
#ifndef __BEGIN_DECLS
|
||||||
# if defined(__cplusplus)
|
# if defined(__cplusplus)
|
||||||
|
|
@ -50,24 +49,21 @@ __BEGIN_DECLS
|
||||||
#define MD5_HASH_ALG 1
|
#define MD5_HASH_ALG 1
|
||||||
#define SHA1_HASH_ALG 2
|
#define SHA1_HASH_ALG 2
|
||||||
#define RIPEMD_HASH_ALG 3
|
#define RIPEMD_HASH_ALG 3
|
||||||
#define TIGER_HASH_ALG 6 /* from rfc2440 */
|
|
||||||
#define SHA256_HASH_ALG 8
|
#define SHA256_HASH_ALG 8
|
||||||
#define SHA384_HASH_ALG 9
|
#define SHA384_HASH_ALG 9
|
||||||
#define SHA512_HASH_ALG 10
|
#define SHA512_HASH_ALG 10
|
||||||
#define SHA224_HASH_ALG 11
|
#define SHA224_HASH_ALG 11
|
||||||
#define TIGER2_HASH_ALG 100 /* private/experimental from rfc4880 */
|
|
||||||
|
|
||||||
/* structure to describe digest methods */
|
/* structure to describe digest methods */
|
||||||
typedef struct digest_t {
|
typedef struct digest_t {
|
||||||
uint32_t alg; /* algorithm */
|
uint32_t alg; /* algorithm */
|
||||||
size_t size; /* size */
|
size_t size; /* size */
|
||||||
union {
|
union {
|
||||||
MD5_CTX md5ctx; /* MD5 */
|
NETPGPV_MD5_CTX md5ctx; /* MD5 */
|
||||||
SHA1_CTX sha1ctx; /* SHA1 */
|
NETPGPV_SHA1_CTX sha1ctx; /* SHA1 */
|
||||||
RMD160_CTX rmd160ctx; /* RIPEMD */
|
NETPGPV_RMD160_CTX rmd160ctx; /* RIPEMD */
|
||||||
SHA256_CTX sha256ctx; /* SHA256 */
|
NETPGPV_SHA256_CTX sha256ctx; /* SHA256 */
|
||||||
SHA512_CTX sha512ctx; /* SHA512 */
|
NETPGPV_SHA512_CTX sha512ctx; /* SHA512 */
|
||||||
TIGER_CTX tigerctx; /* TIGER/TIGER2 */
|
|
||||||
} u;
|
} u;
|
||||||
void *prefix; /* points to specific prefix */
|
void *prefix; /* points to specific prefix */
|
||||||
uint32_t len; /* prefix length */
|
uint32_t len; /* prefix length */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.\" $NetBSD: libnetpgpverify.3,v 1.3 2015/02/05 01:26:54 agc Exp $
|
.\" $NetBSD: libnetpgpverify.3,v 1.4 2017/04/17 19:50:28 agc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2014 Alistair Crooks <agc@NetBSD.org>
|
.\" Copyright (c) 2014,2015,2016 Alistair Crooks <agc@NetBSD.org>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd January 15, 2015
|
.Dd June 26, 2016
|
||||||
.Dt LIBNETPGPVERIFY 3
|
.Dt LIBNETPGPVERIFY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
|
@ -34,6 +34,14 @@
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.In netpgp/verify.h
|
.In netpgp/verify.h
|
||||||
.Ft int
|
.Ft int
|
||||||
|
.Fo pgpv_new
|
||||||
|
.Fa "void"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
|
.Fo pgpv_new_cursor
|
||||||
|
.Fa "void"
|
||||||
|
.Fc
|
||||||
|
.Ft int
|
||||||
.Fo pgpv_read_pubring
|
.Fo pgpv_read_pubring
|
||||||
.Fa "pgpv_t *pgp" "const void *keyring" "ssize_t size"
|
.Fa "pgpv_t *pgp" "const void *keyring" "ssize_t size"
|
||||||
.Fc
|
.Fc
|
||||||
|
|
@ -61,6 +69,14 @@
|
||||||
.Fo pgpv_get_entry
|
.Fo pgpv_get_entry
|
||||||
.Fa "pgpv_t *pgp" "unsigned ent" "char **ret" "const char *modifiers"
|
.Fa "pgpv_t *pgp" "unsigned ent" "char **ret" "const char *modifiers"
|
||||||
.Fc
|
.Fc
|
||||||
|
.Ft int64_t
|
||||||
|
.Fo pgpv_get_cursor_num
|
||||||
|
.Fa "pgpv_t *pgp" "const char *field"
|
||||||
|
.Fc
|
||||||
|
.Ft char *
|
||||||
|
.Fo pgpv_get_cursor_str
|
||||||
|
.Fa "pgpv_t *pgp" "const char *field"
|
||||||
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo pgpv_close
|
.Fo pgpv_close
|
||||||
.Fa "pgpv_t *pgp"
|
.Fa "pgpv_t *pgp"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -49,10 +49,11 @@ ptime(int64_t secs)
|
||||||
static void
|
static void
|
||||||
pentry(pgpv_t *pgp, int n, const char *modifiers)
|
pentry(pgpv_t *pgp, int n, const char *modifiers)
|
||||||
{
|
{
|
||||||
|
size_t cc;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
pgpv_get_entry(pgp, (unsigned)n, &s, modifiers);
|
cc = pgpv_get_entry(pgp, (unsigned)n, &s, modifiers);
|
||||||
printf("%s", s);
|
fwrite(s, 1, cc, stdout);
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,41 +89,46 @@ getstdin(ssize_t *cc, size_t *size)
|
||||||
static int
|
static int
|
||||||
verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t cc)
|
verify_data(pgpv_t *pgp, const char *cmd, const char *inname, char *in, ssize_t cc)
|
||||||
{
|
{
|
||||||
pgpv_cursor_t cursor;
|
pgpv_cursor_t *cursor;
|
||||||
const char *modifiers;
|
const char *modifiers;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t cookie;
|
size_t cookie;
|
||||||
char *data;
|
char *data;
|
||||||
int el;
|
int el;
|
||||||
|
int ok;
|
||||||
|
|
||||||
memset(&cursor, 0x0, sizeof(cursor));
|
cursor = pgpv_new_cursor();
|
||||||
|
ok = 0;
|
||||||
if (strcasecmp(cmd, "cat") == 0) {
|
if (strcasecmp(cmd, "cat") == 0) {
|
||||||
if ((cookie = pgpv_verify(&cursor, pgp, in, cc)) != 0) {
|
if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
|
||||||
if ((size = pgpv_get_verified(&cursor, cookie, &data)) > 0) {
|
if ((size = pgpv_get_verified(cursor, cookie, &data)) > 0) {
|
||||||
write(STDOUT_FILENO, data, size);
|
write(STDOUT_FILENO, data, size);
|
||||||
}
|
}
|
||||||
return 1;
|
ok = 1;
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(cmd, "dump") == 0) {
|
} else if (strcasecmp(cmd, "dump") == 0) {
|
||||||
if ((cookie = pgpv_verify(&cursor, pgp, in, cc)) != 0) {
|
if ((cookie = pgpv_verify(cursor, pgp, in, cc)) != 0) {
|
||||||
size = pgpv_dump(pgp, &data);
|
size = pgpv_dump(pgp, &data);
|
||||||
write(STDOUT_FILENO, data, size);
|
write(STDOUT_FILENO, data, size);
|
||||||
return 1;
|
ok = 1;
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(cmd, "verify") == 0 || strcasecmp(cmd, "trust") == 0) {
|
} else if (strcasecmp(cmd, "verify") == 0 || strcasecmp(cmd, "trust") == 0) {
|
||||||
modifiers = (strcasecmp(cmd, "trust") == 0) ? "trust" : NULL;
|
modifiers = (strcasecmp(cmd, "trust") == 0) ? "trust" : NULL;
|
||||||
if (pgpv_verify(&cursor, pgp, in, cc)) {
|
if (pgpv_verify(cursor, pgp, in, cc)) {
|
||||||
printf("Good signature for %s made ", inname);
|
printf("Good signature for %s made ", inname);
|
||||||
ptime(cursor.sigtime);
|
ptime(pgpv_get_cursor_num(cursor, "sigtime"));
|
||||||
el = pgpv_get_cursor_element(&cursor, 0);
|
el = pgpv_get_cursor_element(cursor, 0);
|
||||||
pentry(pgp, el, modifiers);
|
pentry(pgp, el, modifiers);
|
||||||
return 1;
|
ok = 1;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Signature did not match contents -- %s\n",
|
||||||
|
pgpv_get_cursor_str(cursor, "why"));
|
||||||
}
|
}
|
||||||
fprintf(stderr, "Signature did not match contents -- %s\n", cursor.why);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "unrecognised command \"%s\"\n", cmd);
|
fprintf(stderr, "unrecognised command \"%s\"\n", cmd);
|
||||||
}
|
}
|
||||||
return 0;
|
pgpv_cursor_close(cursor);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -132,13 +138,13 @@ main(int argc, char **argv)
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
ssize_t cc;
|
ssize_t cc;
|
||||||
size_t size;
|
size_t size;
|
||||||
pgpv_t pgp;
|
pgpv_t *pgp;
|
||||||
char *in;
|
char *in;
|
||||||
int ssh;
|
int ssh;
|
||||||
int ok;
|
int ok;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(&pgp, 0x0, sizeof(pgp));
|
pgp = pgpv_new();
|
||||||
keyring = NULL;
|
keyring = NULL;
|
||||||
ssh = 0;
|
ssh = 0;
|
||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
@ -163,24 +169,24 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssh) {
|
if (ssh) {
|
||||||
if (!pgpv_read_ssh_pubkeys(&pgp, keyring, -1)) {
|
if (!pgpv_read_ssh_pubkeys(pgp, keyring, -1)) {
|
||||||
fprintf(stderr, "can't read ssh keyring\n");
|
fprintf(stderr, "can't read ssh keyring\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else if (!pgpv_read_pubring(&pgp, keyring, -1)) {
|
} else if (!pgpv_read_pubring(pgp, keyring, -1)) {
|
||||||
fprintf(stderr, "can't read keyring\n");
|
fprintf(stderr, "can't read keyring\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
in = getstdin(&cc, &size);
|
in = getstdin(&cc, &size);
|
||||||
ok = verify_data(&pgp, cmd, "[stdin]", in, cc);
|
ok = verify_data(pgp, cmd, "[stdin]", in, cc);
|
||||||
} else {
|
} else {
|
||||||
for (ok = 1, i = optind ; i < argc ; i++) {
|
for (ok = 1, i = optind ; i < argc ; i++) {
|
||||||
if (!verify_data(&pgp, cmd, argv[i], argv[i], -1)) {
|
if (!verify_data(pgp, cmd, argv[i], argv[i], -1)) {
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pgpv_close(&pgp);
|
pgpv_close(pgp);
|
||||||
exit((ok) ? EXIT_SUCCESS : EXIT_FAILURE);
|
exit((ok) ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: md5.h,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: md5.h,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
|
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
|
||||||
|
|
@ -39,21 +39,31 @@
|
||||||
#define MD5_DIGEST_LENGTH 16
|
#define MD5_DIGEST_LENGTH 16
|
||||||
#define MD5_DIGEST_STRING_LENGTH 33
|
#define MD5_DIGEST_STRING_LENGTH 33
|
||||||
|
|
||||||
|
#ifndef __BEGIN_DECLS
|
||||||
|
# if defined(__cplusplus)
|
||||||
|
# define __BEGIN_DECLS extern "C" {
|
||||||
|
# define __END_DECLS }
|
||||||
|
# else
|
||||||
|
# define __BEGIN_DECLS
|
||||||
|
# define __END_DECLS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* MD5 context. */
|
/* MD5 context. */
|
||||||
typedef struct MD5Context {
|
typedef struct MD5Context {
|
||||||
uint32_t state[4]; /* state (ABCD) */
|
uint32_t state[4]; /* state (ABCD) */
|
||||||
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||||
unsigned char buffer[64]; /* input buffer */
|
unsigned char buffer[64]; /* input buffer */
|
||||||
} MD5_CTX;
|
} NETPGPV_MD5_CTX;
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
void MD5Init(MD5_CTX *);
|
void netpgpv_MD5Init(NETPGPV_MD5_CTX *);
|
||||||
void MD5Update(MD5_CTX *, const unsigned char *, unsigned int);
|
void netpgpv_MD5Update(NETPGPV_MD5_CTX *, const unsigned char *, unsigned int);
|
||||||
void MD5Final(unsigned char[MD5_DIGEST_LENGTH], MD5_CTX *);
|
void netpgpv_MD5Final(unsigned char[MD5_DIGEST_LENGTH], NETPGPV_MD5_CTX *);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *MD5End(MD5_CTX *, char *);
|
char *netpgpv_MD5End(NETPGPV_MD5_CTX *, char *);
|
||||||
char *MD5File(const char *, char *);
|
char *netpgpv_MD5File(const char *, char *);
|
||||||
char *MD5Data(const unsigned char *, unsigned int, char *);
|
char *netpgpv_MD5Data(const unsigned char *, unsigned int, char *);
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: md5c.c,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: md5c.c,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
|
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
* documentation and/or software.
|
* documentation and/or software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -155,7 +154,7 @@ static const unsigned char PADDING[64] = {
|
||||||
* MD5 initialization. Begins an MD5 operation, writing a new context.
|
* MD5 initialization. Begins an MD5 operation, writing a new context.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MD5Init(MD5_CTX *context)
|
netpgpv_MD5Init(NETPGPV_MD5_CTX *context)
|
||||||
{
|
{
|
||||||
|
|
||||||
context->count[0] = context->count[1] = 0;
|
context->count[0] = context->count[1] = 0;
|
||||||
|
|
@ -173,7 +172,7 @@ MD5Init(MD5_CTX *context)
|
||||||
* context.
|
* context.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MD5Update(MD5_CTX *context,
|
netpgpv_MD5Update(NETPGPV_MD5_CTX *context,
|
||||||
const unsigned char *input, /* input block */
|
const unsigned char *input, /* input block */
|
||||||
unsigned int inputLen) /* length of input block */
|
unsigned int inputLen) /* length of input block */
|
||||||
{
|
{
|
||||||
|
|
@ -211,8 +210,8 @@ MD5Update(MD5_CTX *context,
|
||||||
* message digest and zeroing the context.
|
* message digest and zeroing the context.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MD5Final(unsigned char digest[16], /* message digest */
|
netpgpv_MD5Final(unsigned char digest[16], /* message digest */
|
||||||
MD5_CTX *context) /* context */
|
NETPGPV_MD5_CTX *context) /* context */
|
||||||
{
|
{
|
||||||
unsigned char bits[8];
|
unsigned char bits[8];
|
||||||
unsigned int idx, padLen;
|
unsigned int idx, padLen;
|
||||||
|
|
@ -223,10 +222,10 @@ MD5Final(unsigned char digest[16], /* message digest */
|
||||||
/* Pad out to 56 mod 64. */
|
/* Pad out to 56 mod 64. */
|
||||||
idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
|
idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
|
||||||
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
|
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
|
||||||
MD5Update (context, PADDING, padLen);
|
netpgpv_MD5Update (context, PADDING, padLen);
|
||||||
|
|
||||||
/* Append length (before padding) */
|
/* Append length (before padding) */
|
||||||
MD5Update(context, bits, 8);
|
netpgpv_MD5Update(context, bits, 8);
|
||||||
|
|
||||||
/* Store state in digest */
|
/* Store state in digest */
|
||||||
Encode(digest, context->state, 16);
|
Encode(digest, context->state, 16);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/syslog.h>
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
# include <sys/kmem.h>
|
# include <sys/kmem.h>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: netpgpverify.1,v 1.9 2015/01/30 18:58:59 agc Exp $
|
.\" $NetBSD: netpgpverify.1,v 1.11.4.1 2018/05/06 09:47:47 martin Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2013,2014,2015 Alistair Crooks <agc@NetBSD.org>
|
.\" Copyright (c) 2013,2014,2015 Alistair Crooks <agc@NetBSD.org>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd January 15, 2015
|
.Dd April 3, 2018
|
||||||
.Dt NETPGPVERIFY 1
|
.Dt NETPGPVERIFY 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
|
@ -143,9 +143,16 @@ or 2 if any other error occurs.
|
||||||
.\" .Xr libbz2 3 ,
|
.\" .Xr libbz2 3 ,
|
||||||
.Xr zlib 3
|
.Xr zlib 3
|
||||||
.Sh STANDARDS
|
.Sh STANDARDS
|
||||||
The
|
.Rs
|
||||||
.Nm
|
.%A J. Callas
|
||||||
utility is designed to conform to IETF RFC 4880.
|
.%A L. Donnerhacke
|
||||||
|
.%A H. Finney
|
||||||
|
.%A D. Shaw
|
||||||
|
.%A R. Thayer
|
||||||
|
.%D November 2007
|
||||||
|
.%R RFC 4880
|
||||||
|
.%T OpenPGP Message Format
|
||||||
|
.Re
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
|
|
|
||||||
14
crypto/external/bsd/netpgp/dist/src/netpgpverify/noversion.asc
vendored
Normal file
14
crypto/external/bsd/netpgp/dist/src/netpgpverify/noversion.asc
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
-----BEGIN PGP SIGNED MESSAGE-----
|
||||||
|
Hash: SHA1
|
||||||
|
|
||||||
|
bar
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQEcBAEBAgAGBQJXYEJcAAoJEBto3PzAWWgjk5cH/03A4/a+ywsnzZMncQ7H7rtu
|
||||||
|
QiIWwyiJo28Xf5z3fL5WG6VKNJdPpx0TIthcxu0O1YgF6lvqqQbnNpfNbD+1h88+
|
||||||
|
JCcqJfyVk38vsFPxdFTIOWjbEtHs9yyjUVk5tJQrxtTaSJbGtQIMHQXXfWAyKCn4
|
||||||
|
0Zl+E2iWb6tXxxMaAkrCOipjC9knuTJJbG6oVZpujp7jOt+2bOWY+89+FhoGJ5tv
|
||||||
|
XiOvqIUUSW5Iua+wBOmhb/iuNFUVrO8rS/7BpMLQmxbnLxWtwwSWIcyyg6BwiIvm
|
||||||
|
8K5NmD3WKN97tPA1HYjk76SlLj254OVLDmTZua7ljqasl5PR9W+aUFIByDgQrGE=
|
||||||
|
=90+m
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
|
|
@ -41,6 +41,21 @@
|
||||||
#define USE_ARG(x) /*LINTED*/(void)&(x)
|
#define USE_ARG(x) /*LINTED*/(void)&(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef swap16
|
||||||
|
#undef swap32
|
||||||
|
|
||||||
|
/* ignore any dash-escape at the start of a line */
|
||||||
|
static void
|
||||||
|
dash_escaped_update(digest_t *hash, uint8_t *in, size_t insize)
|
||||||
|
{
|
||||||
|
if (insize >= 2 && memcmp(in, "- ", 2) == 0) {
|
||||||
|
in += 2;
|
||||||
|
insize -= 2;
|
||||||
|
}
|
||||||
|
digest_update(hash, in, insize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* add the ascii armor line endings (except for last line) */
|
/* add the ascii armor line endings (except for last line) */
|
||||||
static size_t
|
static size_t
|
||||||
don_armor(digest_t *hash, uint8_t *in, size_t insize, int doarmor)
|
don_armor(digest_t *hash, uint8_t *in, size_t insize, int doarmor)
|
||||||
|
|
@ -58,10 +73,10 @@ don_armor(digest_t *hash, uint8_t *in, size_t insize, int doarmor)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
digest_update(hash, from, (size_t)(newp - from));
|
dash_escaped_update(hash, from, (size_t)(newp - from));
|
||||||
digest_update(hash, dos_line_end, sizeof(dos_line_end));
|
digest_update(hash, dos_line_end, sizeof(dos_line_end));
|
||||||
}
|
}
|
||||||
digest_update(hash, from, insize - (size_t)(from - in));
|
dash_escaped_update(hash, from, insize - (size_t)(from - in));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rmd160.c,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: rmd160.c,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
|
/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
|
||||||
/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */
|
/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */
|
||||||
/*
|
/*
|
||||||
|
|
@ -30,8 +30,6 @@
|
||||||
* ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
|
* ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -97,7 +95,7 @@ static const u_char PADDING[64] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
RMD160Init(RMD160_CTX *ctx)
|
netpgpv_RMD160Init(NETPGPV_RMD160_CTX *ctx)
|
||||||
{
|
{
|
||||||
ctx->count = 0;
|
ctx->count = 0;
|
||||||
ctx->state[0] = H0;
|
ctx->state[0] = H0;
|
||||||
|
|
@ -108,7 +106,7 @@ RMD160Init(RMD160_CTX *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len)
|
netpgpv_RMD160Update(NETPGPV_RMD160_CTX *ctx, const u_char *input, uint32_t len)
|
||||||
{
|
{
|
||||||
uint32_t have, off, need;
|
uint32_t have, off, need;
|
||||||
|
|
||||||
|
|
@ -120,13 +118,13 @@ RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len)
|
||||||
if (len >= need) {
|
if (len >= need) {
|
||||||
if (have) {
|
if (have) {
|
||||||
memcpy(ctx->buffer + have, input, (size_t)need);
|
memcpy(ctx->buffer + have, input, (size_t)need);
|
||||||
RMD160Transform(ctx->state, ctx->buffer);
|
netpgpv_RMD160Transform(ctx->state, ctx->buffer);
|
||||||
off = need;
|
off = need;
|
||||||
have = 0;
|
have = 0;
|
||||||
}
|
}
|
||||||
/* now the buffer is empty */
|
/* now the buffer is empty */
|
||||||
while (off + 64 <= len) {
|
while (off + 64 <= len) {
|
||||||
RMD160Transform(ctx->state, input+off);
|
netpgpv_RMD160Transform(ctx->state, input+off);
|
||||||
off += 64;
|
off += 64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +133,7 @@ RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RMD160Final(u_char digest[20], RMD160_CTX *ctx)
|
netpgpv_RMD160Final(u_char digest[20], NETPGPV_RMD160_CTX *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u_char size[8];
|
u_char size[8];
|
||||||
|
|
@ -150,8 +148,8 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx)
|
||||||
padlen = (uint32_t)(64 - ((ctx->count/8) % 64));
|
padlen = (uint32_t)(64 - ((ctx->count/8) % 64));
|
||||||
if (padlen < 1 + 8)
|
if (padlen < 1 + 8)
|
||||||
padlen += 64;
|
padlen += 64;
|
||||||
RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
|
netpgpv_RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
|
||||||
RMD160Update(ctx, size, 8);
|
netpgpv_RMD160Update(ctx, size, 8);
|
||||||
|
|
||||||
if (digest != NULL)
|
if (digest != NULL)
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
|
|
@ -161,7 +159,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RMD160Transform(uint32_t state[5], const u_char block[64])
|
netpgpv_RMD160Transform(uint32_t state[5], const u_char block[64])
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
|
uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
|
||||||
|
|
||||||
|
|
@ -170,8 +168,13 @@ RMD160Transform(uint32_t state[5], const u_char block[64])
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++) {
|
||||||
x[i] = le32dec(block+i*4);
|
x[i] = (uint32_t)(
|
||||||
|
(uint32_t)(block[i*4 + 0]) |
|
||||||
|
(uint32_t)(block[i*4 + 1]) << 8 |
|
||||||
|
(uint32_t)(block[i*4 + 2]) << 16 |
|
||||||
|
(uint32_t)(block[i*4 + 3]) << 24);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
a = state[0];
|
a = state[0];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rmd160.h,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: rmd160.h,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
/* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
|
/* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
|
||||||
/* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */
|
/* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */
|
||||||
/*
|
/*
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#ifndef _RMD160_H
|
#ifndef _RMD160_H
|
||||||
#define _RMD160_H
|
#define _RMD160_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
@ -35,23 +34,33 @@
|
||||||
#define RMD160_DIGEST_LENGTH 20
|
#define RMD160_DIGEST_LENGTH 20
|
||||||
#define RMD160_DIGEST_STRING_LENGTH 41
|
#define RMD160_DIGEST_STRING_LENGTH 41
|
||||||
|
|
||||||
|
#ifndef __BEGIN_DECLS
|
||||||
|
# if defined(__cplusplus)
|
||||||
|
# define __BEGIN_DECLS extern "C" {
|
||||||
|
# define __END_DECLS }
|
||||||
|
# else
|
||||||
|
# define __BEGIN_DECLS
|
||||||
|
# define __END_DECLS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RMD160 context. */
|
/* RMD160 context. */
|
||||||
typedef struct RMD160Context {
|
typedef struct RMD160Context {
|
||||||
uint32_t state[5]; /* state */
|
uint32_t state[5]; /* state */
|
||||||
uint64_t count; /* number of bits, modulo 2^64 */
|
uint64_t count; /* number of bits, modulo 2^64 */
|
||||||
u_char buffer[64]; /* input buffer */
|
u_char buffer[64]; /* input buffer */
|
||||||
} RMD160_CTX;
|
} NETPGPV_RMD160_CTX;
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
void RMD160Init(RMD160_CTX *);
|
void netpgpv_RMD160Init(NETPGPV_RMD160_CTX *);
|
||||||
void RMD160Transform(uint32_t [5], const u_char [64]);
|
void netpgpv_RMD160Transform(uint32_t [5], const u_char [64]);
|
||||||
void RMD160Update(RMD160_CTX *, const u_char *, uint32_t);
|
void netpgpv_RMD160Update(NETPGPV_RMD160_CTX *, const u_char *, uint32_t);
|
||||||
void RMD160Final(u_char [RMD160_DIGEST_LENGTH], RMD160_CTX *);
|
void netpgpv_RMD160Final(u_char [RMD160_DIGEST_LENGTH], NETPGPV_RMD160_CTX *);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *RMD160End(RMD160_CTX *, char *);
|
char *netpgpv_RMD160End(NETPGPV_RMD160_CTX *, char *);
|
||||||
char *RMD160FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_RMD160FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *RMD160File(const char *, char *);
|
char *netpgpv_RMD160File(const char *, char *);
|
||||||
char *RMD160Data(const u_char *, size_t, char *);
|
char *netpgpv_RMD160Data(const u_char *, size_t, char *);
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/syslog.h>
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
# include <sys/kmem.h>
|
# include <sys/kmem.h>
|
||||||
|
|
@ -64,8 +63,8 @@ rsa_padding_check_none(uint8_t *to, int tlen, const uint8_t *from, int flen, int
|
||||||
static int
|
static int
|
||||||
lowlevel_rsa_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
|
lowlevel_rsa_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
|
||||||
{
|
{
|
||||||
BIGNUM *decbn;
|
PGPV_BIGNUM *decbn;
|
||||||
BIGNUM *signedbn;
|
PGPV_BIGNUM *signedbn;
|
||||||
uint8_t *decbuf;
|
uint8_t *decbuf;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int signc;
|
int signc;
|
||||||
|
|
@ -74,37 +73,37 @@ lowlevel_rsa_private_encrypt(int plainc, const unsigned char *plain, unsigned ch
|
||||||
|
|
||||||
decbuf = NULL;
|
decbuf = NULL;
|
||||||
r = -1;
|
r = -1;
|
||||||
decbn = BN_new();
|
decbn = PGPV_BN_new();
|
||||||
signedbn = BN_new();
|
signedbn = PGPV_BN_new();
|
||||||
nbytes = BN_num_bytes(rsa->n);
|
nbytes = PGPV_BN_num_bytes(rsa->n);
|
||||||
decbuf = netpgp_allocate(1, nbytes);
|
decbuf = netpgp_allocate(1, nbytes);
|
||||||
/* add no padding */
|
/* add no padding */
|
||||||
memcpy(decbuf, plain, plainc);
|
memcpy(decbuf, plain, plainc);
|
||||||
BN_bin2bn(decbuf, nbytes, decbn);
|
PGPV_BN_bin2bn(decbuf, nbytes, decbn);
|
||||||
if (BN_cmp(decbn, rsa->n) >= 0) {
|
if (PGPV_BN_cmp(decbn, rsa->n) >= 0) {
|
||||||
printf("decbn too big\n");
|
printf("decbn too big\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_mod_exp(signedbn, decbn, rsa->d, rsa->n, NULL)) {
|
if (!PGPV_BN_mod_exp(signedbn, decbn, rsa->d, rsa->n, NULL)) {
|
||||||
printf("bad mod_exp\n");
|
printf("bad mod_exp\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
signedbytes = BN_num_bytes(signedbn);
|
signedbytes = PGPV_BN_num_bytes(signedbn);
|
||||||
signc = BN_bn2bin(signedbn, &encbuf[nbytes - signedbytes]);
|
signc = PGPV_BN_bn2bin(signedbn, &encbuf[nbytes - signedbytes]);
|
||||||
memset(encbuf, 0x0, nbytes - signc);
|
memset(encbuf, 0x0, nbytes - signc);
|
||||||
r = nbytes;
|
r = nbytes;
|
||||||
err:
|
err:
|
||||||
netpgp_deallocate(decbuf, nbytes);
|
netpgp_deallocate(decbuf, nbytes);
|
||||||
BN_clear_free(decbn);
|
PGPV_BN_clear_free(decbn);
|
||||||
BN_clear_free(signedbn);
|
PGPV_BN_clear_free(signedbn);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lowlevel_rsa_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
|
lowlevel_rsa_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
|
||||||
{
|
{
|
||||||
BIGNUM *decbn;
|
PGPV_BIGNUM *decbn;
|
||||||
BIGNUM *encbn;
|
PGPV_BIGNUM *encbn;
|
||||||
uint8_t *decbuf;
|
uint8_t *decbuf;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int encc;
|
int encc;
|
||||||
|
|
@ -112,25 +111,25 @@ lowlevel_rsa_public_encrypt(int plainc, const unsigned char *plain, unsigned cha
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
r = -1;
|
r = -1;
|
||||||
decbn = BN_new();
|
decbn = PGPV_BN_new();
|
||||||
encbn = BN_new();
|
encbn = PGPV_BN_new();
|
||||||
nbytes = BN_num_bytes(rsa->n);
|
nbytes = PGPV_BN_num_bytes(rsa->n);
|
||||||
decbuf = netpgp_allocate(1, nbytes);
|
decbuf = netpgp_allocate(1, nbytes);
|
||||||
(void) memcpy(decbuf, plain, plainc);
|
(void) memcpy(decbuf, plain, plainc);
|
||||||
if (BN_bin2bn(decbuf, nbytes, decbn) == NULL) {
|
if (PGPV_BN_bin2bn(decbuf, nbytes, decbn) == NULL) {
|
||||||
printf("bin2bn failed\n");
|
printf("bin2bn failed\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_cmp(decbn, rsa->n) >= 0) {
|
if (PGPV_BN_cmp(decbn, rsa->n) >= 0) {
|
||||||
printf("BN_cmp failed\n");
|
printf("PGPV_BN_cmp failed\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_mod_exp(encbn, decbn, rsa->e, rsa->n, NULL)) {
|
if (!PGPV_BN_mod_exp(encbn, decbn, rsa->e, rsa->n, NULL)) {
|
||||||
printf("BN_mod_exp failed\n");
|
printf("PGPV_BN_mod_exp failed\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
encc = BN_num_bytes(encbn);
|
encc = PGPV_BN_num_bytes(encbn);
|
||||||
i = BN_bn2bin(encbn, &encbuf[nbytes - encc]);
|
i = PGPV_BN_bn2bin(encbn, &encbuf[nbytes - encc]);
|
||||||
(void) memset(encbuf, 0x0, nbytes - i);
|
(void) memset(encbuf, 0x0, nbytes - i);
|
||||||
r = nbytes;
|
r = nbytes;
|
||||||
err:
|
err:
|
||||||
|
|
@ -138,16 +137,16 @@ err:
|
||||||
memset(decbuf, 0x0, nbytes);
|
memset(decbuf, 0x0, nbytes);
|
||||||
netpgp_deallocate(decbuf, nbytes);
|
netpgp_deallocate(decbuf, nbytes);
|
||||||
}
|
}
|
||||||
BN_clear_free(decbn);
|
PGPV_BN_clear_free(decbn);
|
||||||
BN_clear_free(encbn);
|
PGPV_BN_clear_free(encbn);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lowlevel_rsa_private_decrypt(int enclen, const unsigned char *encbuf, unsigned char *to, RSA *rsa)
|
lowlevel_rsa_private_decrypt(int enclen, const unsigned char *encbuf, unsigned char *to, RSA *rsa)
|
||||||
{
|
{
|
||||||
BIGNUM *encbn;
|
PGPV_BIGNUM *encbn;
|
||||||
BIGNUM *decbn;
|
PGPV_BIGNUM *decbn;
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int j;
|
int j;
|
||||||
|
|
@ -156,31 +155,31 @@ lowlevel_rsa_private_decrypt(int enclen, const unsigned char *encbuf, unsigned c
|
||||||
r = -1;
|
r = -1;
|
||||||
decbn = encbn = NULL;
|
decbn = encbn = NULL;
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
if (BN_num_bits(rsa->n) > RSA_MAX_MODULUS_BITS) {
|
if (PGPV_BN_num_bits(rsa->n) > RSA_MAX_MODULUS_BITS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (BN_cmp(rsa->n, rsa->e) <= 0) {
|
if (PGPV_BN_cmp(rsa->n, rsa->e) <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
encbn = BN_new();
|
encbn = PGPV_BN_new();
|
||||||
decbn = BN_new();
|
decbn = PGPV_BN_new();
|
||||||
nbytes = BN_num_bytes(rsa->n);
|
nbytes = PGPV_BN_num_bytes(rsa->n);
|
||||||
buf = netpgp_allocate(1, nbytes);
|
buf = netpgp_allocate(1, nbytes);
|
||||||
if (enclen > nbytes) {
|
if (enclen > nbytes) {
|
||||||
printf("bad enclen\n");
|
printf("bad enclen\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
BN_bin2bn(encbuf, enclen, encbn);
|
PGPV_BN_bin2bn(encbuf, enclen, encbn);
|
||||||
if (BN_cmp(encbn, rsa->n) >= 0) {
|
if (PGPV_BN_cmp(encbn, rsa->n) >= 0) {
|
||||||
printf("bad encbn\n");
|
printf("bad encbn\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
BN_mod_exp(decbn, encbn, rsa->d, rsa->n, NULL);
|
PGPV_BN_mod_exp(decbn, encbn, rsa->d, rsa->n, NULL);
|
||||||
j = BN_bn2bin(decbn, buf);
|
j = PGPV_BN_bn2bin(decbn, buf);
|
||||||
r = rsa_padding_check_none(to, nbytes, buf, j, nbytes);
|
r = rsa_padding_check_none(to, nbytes, buf, j, nbytes);
|
||||||
err:
|
err:
|
||||||
BN_clear_free(encbn);
|
PGPV_BN_clear_free(encbn);
|
||||||
BN_clear_free(decbn);
|
PGPV_BN_clear_free(decbn);
|
||||||
netpgp_deallocate(buf, nbytes);
|
netpgp_deallocate(buf, nbytes);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
@ -189,8 +188,8 @@ static int
|
||||||
lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, const rsa_pubkey_t *rsa)
|
lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, const rsa_pubkey_t *rsa)
|
||||||
{
|
{
|
||||||
uint8_t *decbuf;
|
uint8_t *decbuf;
|
||||||
BIGNUM *decbn;
|
PGPV_BIGNUM *decbn;
|
||||||
BIGNUM *encbn;
|
PGPV_BIGNUM *encbn;
|
||||||
int decbytes;
|
int decbytes;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int r;
|
int r;
|
||||||
|
|
@ -199,22 +198,22 @@ lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, con
|
||||||
r = -1;
|
r = -1;
|
||||||
decbuf = NULL;
|
decbuf = NULL;
|
||||||
decbn = encbn = NULL;
|
decbn = encbn = NULL;
|
||||||
if (BN_num_bits(rsa->n) > RSA_MAX_MODULUS_BITS) {
|
if (PGPV_BN_num_bits(rsa->n) > RSA_MAX_MODULUS_BITS) {
|
||||||
printf("rsa r modulus too large\n");
|
printf("rsa r modulus too large\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_cmp(rsa->n, rsa->e) <= 0) {
|
if (PGPV_BN_cmp(rsa->n, rsa->e) <= 0) {
|
||||||
printf("rsa r bad n value\n");
|
printf("rsa r bad n value\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_num_bits(rsa->n) > RSA_SMALL_MODULUS_BITS &&
|
if (PGPV_BN_num_bits(rsa->n) > RSA_SMALL_MODULUS_BITS &&
|
||||||
BN_num_bits(rsa->e) > RSA_MAX_PUBEXP_BITS) {
|
PGPV_BN_num_bits(rsa->e) > RSA_MAX_PUBEXP_BITS) {
|
||||||
printf("rsa r bad exponent limit\n");
|
printf("rsa r bad exponent limit\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if ((encbn = BN_new()) == NULL ||
|
if ((encbn = PGPV_BN_new()) == NULL ||
|
||||||
(decbn = BN_new()) == NULL ||
|
(decbn = PGPV_BN_new()) == NULL ||
|
||||||
(decbuf = netpgp_allocate(1, nbytes = BN_num_bytes(rsa->n))) == NULL) {
|
(decbuf = netpgp_allocate(1, nbytes = PGPV_BN_num_bytes(rsa->n))) == NULL) {
|
||||||
printf("allocation failure\n");
|
printf("allocation failure\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
@ -222,26 +221,26 @@ lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, con
|
||||||
printf("rsa r > mod len\n");
|
printf("rsa r > mod len\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_bin2bn(encbuf, enclen, encbn) == NULL) {
|
if (PGPV_BN_bin2bn(encbuf, enclen, encbn) == NULL) {
|
||||||
printf("null encrypted BN\n");
|
printf("null encrypted BN\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_cmp(encbn, rsa->n) >= 0) {
|
if (PGPV_BN_cmp(encbn, rsa->n) >= 0) {
|
||||||
printf("rsa r data too large for modulus\n");
|
printf("rsa r data too large for modulus\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_mod_exp(decbn, encbn, rsa->e, rsa->n, NULL) < 0) {
|
if (PGPV_BN_mod_exp(decbn, encbn, rsa->e, rsa->n, NULL) < 0) {
|
||||||
printf("BN_mod_exp < 0\n");
|
printf("PGPV_BN_mod_exp < 0\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
decbytes = BN_num_bytes(decbn);
|
decbytes = PGPV_BN_num_bytes(decbn);
|
||||||
(void) BN_bn2bin(decbn, decbuf);
|
(void) PGPV_BN_bn2bin(decbn, decbuf);
|
||||||
if ((r = rsa_padding_check_none(dec, nbytes, decbuf, decbytes, 0)) < 0) {
|
if ((r = rsa_padding_check_none(dec, nbytes, decbuf, decbytes, 0)) < 0) {
|
||||||
printf("rsa r padding check failed\n");
|
printf("rsa r padding check failed\n");
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
BN_free(encbn);
|
PGPV_BN_free(encbn);
|
||||||
BN_free(decbn);
|
PGPV_BN_free(decbn);
|
||||||
if (decbuf != NULL) {
|
if (decbuf != NULL) {
|
||||||
(void) memset(decbuf, 0x0, nbytes);
|
(void) memset(decbuf, 0x0, nbytes);
|
||||||
netpgp_deallocate(decbuf, nbytes);
|
netpgp_deallocate(decbuf, nbytes);
|
||||||
|
|
@ -407,9 +406,9 @@ cleanup:
|
||||||
static int
|
static int
|
||||||
dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig, mpi_dsa_t *dsa)
|
dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig, mpi_dsa_t *dsa)
|
||||||
{
|
{
|
||||||
BIGNUM *M;
|
PGPV_BIGNUM *M;
|
||||||
BIGNUM *W;
|
PGPV_BIGNUM *W;
|
||||||
BIGNUM *t1;
|
PGPV_BIGNUM *t1;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int qbits;
|
int qbits;
|
||||||
|
|
||||||
|
|
@ -417,7 +416,7 @@ dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
M = W = t1 = NULL;
|
M = W = t1 = NULL;
|
||||||
qbits = BN_num_bits(dsa->q);
|
qbits = PGPV_BN_num_bits(dsa->q);
|
||||||
switch(qbits) {
|
switch(qbits) {
|
||||||
case 160:
|
case 160:
|
||||||
case 224:
|
case 224:
|
||||||
|
|
@ -429,7 +428,7 @@ dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig
|
||||||
printf("dsa: bad # of Q bits\n");
|
printf("dsa: bad # of Q bits\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (BN_num_bits(dsa->p) > DSA_MAX_MODULUS_BITS) {
|
if (PGPV_BN_num_bits(dsa->p) > DSA_MAX_MODULUS_BITS) {
|
||||||
printf("dsa: p too large\n");
|
printf("dsa: p too large\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -439,52 +438,52 @@ dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if ((M = BN_new()) == NULL ||
|
if ((M = PGPV_BN_new()) == NULL ||
|
||||||
(W = BN_new()) == NULL ||
|
(W = PGPV_BN_new()) == NULL ||
|
||||||
(t1 = BN_new()) == NULL) {
|
(t1 = PGPV_BN_new()) == NULL) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_is_zero(sig->r) ||
|
if (PGPV_BN_is_zero(sig->r) ||
|
||||||
BN_is_negative(sig->r) ||
|
PGPV_BN_is_negative(sig->r) ||
|
||||||
BN_cmp(sig->r, dsa->q) >= 0) {
|
PGPV_BN_cmp(sig->r, dsa->q) >= 0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_is_zero(sig->s) ||
|
if (PGPV_BN_is_zero(sig->s) ||
|
||||||
BN_is_negative(sig->s) ||
|
PGPV_BN_is_negative(sig->s) ||
|
||||||
BN_cmp(sig->s, dsa->q) >= 0) {
|
PGPV_BN_cmp(sig->s, dsa->q) >= 0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (BN_mod_inverse(W, sig->s, dsa->q, NULL) != MP_OKAY) {
|
if (PGPV_BN_mod_inverse(W, sig->s, dsa->q, NULL) != MP_OKAY) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (dgst_len > qbits / 8) {
|
if (dgst_len > qbits / 8) {
|
||||||
dgst_len = qbits / 8;
|
dgst_len = qbits / 8;
|
||||||
}
|
}
|
||||||
if (BN_bin2bn(calculated, dgst_len, M) == NULL) {
|
if (PGPV_BN_bin2bn(calculated, dgst_len, M) == NULL) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_mod_mul(M, M, W, dsa->q, NULL)) {
|
if (!PGPV_BN_mod_mul(M, M, W, dsa->q, NULL)) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_mod_mul(W, sig->r, W, dsa->q, NULL)) {
|
if (!PGPV_BN_mod_mul(W, sig->r, W, dsa->q, NULL)) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_mod_exp(dsa->p, t1, dsa->g, M, NULL)) {
|
if (!PGPV_BN_mod_exp(dsa->p, t1, dsa->g, M, NULL)) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!BN_div(NULL, M, t1, dsa->q, NULL)) {
|
if (!PGPV_BN_div(NULL, M, t1, dsa->q, NULL)) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ret = (BN_cmp(M, sig->r) == 0);
|
ret = (PGPV_BN_cmp(M, sig->r) == 0);
|
||||||
err:
|
err:
|
||||||
if (M) {
|
if (M) {
|
||||||
BN_free(M);
|
PGPV_BN_free(M);
|
||||||
}
|
}
|
||||||
if (W) {
|
if (W) {
|
||||||
BN_free(W);
|
PGPV_BN_free(W);
|
||||||
}
|
}
|
||||||
if (t1) {
|
if (t1) {
|
||||||
BN_free(t1);
|
PGPV_BN_free(t1);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -494,13 +493,13 @@ err:
|
||||||
int
|
int
|
||||||
RSA_size(const RSA *rsa)
|
RSA_size(const RSA *rsa)
|
||||||
{
|
{
|
||||||
return (rsa == NULL) ? 0 : BN_num_bits(rsa->n);
|
return (rsa == NULL) ? 0 : PGPV_BN_num_bits(rsa->n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
DSA_size(const DSA *dsa)
|
DSA_size(const DSA *dsa)
|
||||||
{
|
{
|
||||||
return (dsa == NULL) ? 0 : BN_num_bits(dsa->p);
|
return (dsa == NULL) ? 0 : PGPV_BN_num_bits(dsa->p);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
|
@ -516,26 +515,26 @@ dsa_verify(const signature_t *signature, const dsa_pubkey_t *pubdsa, const uint8
|
||||||
}
|
}
|
||||||
(void) memset(&osig, 0x0, sizeof(osig));
|
(void) memset(&osig, 0x0, sizeof(osig));
|
||||||
(void) memset(&odsa, 0x0, sizeof(odsa));
|
(void) memset(&odsa, 0x0, sizeof(odsa));
|
||||||
BN_copy(osig.r, signature->dsa.r);
|
PGPV_BN_copy(osig.r, signature->dsa.r);
|
||||||
BN_copy(osig.s, signature->dsa.s);
|
PGPV_BN_copy(osig.s, signature->dsa.s);
|
||||||
odsa.p = pubdsa->p;
|
odsa.p = pubdsa->p;
|
||||||
odsa.q = pubdsa->q;
|
odsa.q = pubdsa->q;
|
||||||
odsa.g = pubdsa->g;
|
odsa.g = pubdsa->g;
|
||||||
odsa.pub_key = pubdsa->y;
|
odsa.pub_key = pubdsa->y;
|
||||||
if ((qlen = BN_num_bytes(odsa.q)) < hash_length) {
|
if ((qlen = PGPV_BN_num_bytes(odsa.q)) < hash_length) {
|
||||||
hash_length = qlen;
|
hash_length = qlen;
|
||||||
}
|
}
|
||||||
ret = dsa_do_verify(calculated, (int)hash_length, &signature->dsa, &odsa);
|
ret = dsa_do_verify(calculated, (int)hash_length, &signature->dsa, &odsa);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BN_free(odsa.p);
|
PGPV_BN_free(odsa.p);
|
||||||
BN_free(odsa.q);
|
PGPV_BN_free(odsa.q);
|
||||||
BN_free(odsa.g);
|
PGPV_BN_free(odsa.g);
|
||||||
BN_free(odsa.pub_key);
|
PGPV_BN_free(odsa.pub_key);
|
||||||
odsa.p = odsa.q = odsa.g = odsa.pub_key = NULL;
|
odsa.p = odsa.q = odsa.g = odsa.pub_key = NULL;
|
||||||
BN_free(osig.r);
|
PGPV_BN_free(osig.r);
|
||||||
BN_free(osig.s);
|
PGPV_BN_free(osig.s);
|
||||||
osig.r = osig.s = NULL;
|
osig.r = osig.s = NULL;
|
||||||
return (unsigned)ret;
|
return (unsigned)ret;
|
||||||
}
|
}
|
||||||
|
|
@ -557,7 +556,7 @@ RSA_free(RSA *rsa)
|
||||||
int
|
int
|
||||||
RSA_check_key(RSA *rsa)
|
RSA_check_key(RSA *rsa)
|
||||||
{
|
{
|
||||||
BIGNUM *calcn;
|
PGPV_BIGNUM *calcn;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
@ -565,19 +564,19 @@ RSA_check_key(RSA *rsa)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* check that p and q are coprime, and that n = p*q. */
|
/* check that p and q are coprime, and that n = p*q. */
|
||||||
if (!BN_is_prime(rsa->p, 1, NULL, NULL, NULL) ||
|
if (!PGPV_BN_is_prime(rsa->p, 1, NULL, NULL, NULL) ||
|
||||||
!BN_is_prime(rsa->q, 1, NULL, NULL, NULL)) {
|
!PGPV_BN_is_prime(rsa->q, 1, NULL, NULL, NULL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
calcn = BN_new();
|
calcn = PGPV_BN_new();
|
||||||
BN_mul(calcn, rsa->p, rsa->q, NULL);
|
PGPV_BN_mul(calcn, rsa->p, rsa->q, NULL);
|
||||||
if (BN_cmp(calcn, rsa->n) != 0) {
|
if (PGPV_BN_cmp(calcn, rsa->n) != 0) {
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
/* XXX - check that d*e = 1 mod (p-1*q-1) */
|
/* XXX - check that d*e = 1 mod (p-1*q-1) */
|
||||||
ret = 1;
|
ret = 1;
|
||||||
errout:
|
errout:
|
||||||
BN_clear_free(calcn);
|
PGPV_BN_clear_free(calcn);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -638,11 +637,11 @@ RSA_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, RSA
|
||||||
}
|
}
|
||||||
USE_ARG(padding);
|
USE_ARG(padding);
|
||||||
(void) memset(&pub, 0x0, sizeof(pub));
|
(void) memset(&pub, 0x0, sizeof(pub));
|
||||||
pub.n = BN_dup(rsa->n);
|
pub.n = PGPV_BN_dup(rsa->n);
|
||||||
pub.e = BN_dup(rsa->e);
|
pub.e = PGPV_BN_dup(rsa->e);
|
||||||
ret = lowlevel_rsa_public_decrypt(enc, enclen, dec, &pub);
|
ret = lowlevel_rsa_public_decrypt(enc, enclen, dec, &pub);
|
||||||
BN_free(pub.n);
|
PGPV_BN_free(pub.n);
|
||||||
BN_free(pub.e);
|
PGPV_BN_free(pub.e);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct rsa_pubkey_t {
|
typedef struct rsa_pubkey_t {
|
||||||
BIGNUM *n; /* RSA public modulus n */
|
PGPV_BIGNUM *n; /* RSA public modulus n */
|
||||||
BIGNUM *e; /* RSA public encryption exponent e */
|
PGPV_BIGNUM *e; /* RSA public encryption exponent e */
|
||||||
} rsa_pubkey_t;
|
} rsa_pubkey_t;
|
||||||
|
|
||||||
typedef struct mpi_rsa_t {
|
typedef struct mpi_rsa_t {
|
||||||
|
|
@ -49,44 +49,44 @@ typedef struct mpi_rsa_t {
|
||||||
long f2; /* openssl version */
|
long f2; /* openssl version */
|
||||||
const void *f3; /* openssl method */
|
const void *f3; /* openssl method */
|
||||||
void *f4; /* openssl engine */
|
void *f4; /* openssl engine */
|
||||||
BIGNUM *n;
|
PGPV_BIGNUM *n;
|
||||||
BIGNUM *e;
|
PGPV_BIGNUM *e;
|
||||||
BIGNUM *d;
|
PGPV_BIGNUM *d;
|
||||||
BIGNUM *p;
|
PGPV_BIGNUM *p;
|
||||||
BIGNUM *q;
|
PGPV_BIGNUM *q;
|
||||||
BIGNUM *dmp1;
|
PGPV_BIGNUM *dmp1;
|
||||||
BIGNUM *dmq1;
|
PGPV_BIGNUM *dmq1;
|
||||||
BIGNUM *iqmp;
|
PGPV_BIGNUM *iqmp;
|
||||||
} mpi_rsa_t;
|
} mpi_rsa_t;
|
||||||
|
|
||||||
#define RSA mpi_rsa_t
|
#define RSA mpi_rsa_t
|
||||||
|
|
||||||
typedef struct dsa_pubkey_t {
|
typedef struct dsa_pubkey_t {
|
||||||
BIGNUM *p; /* DSA public modulus n */
|
PGPV_BIGNUM *p; /* DSA public modulus n */
|
||||||
BIGNUM *q; /* DSA public encryption exponent e */
|
PGPV_BIGNUM *q; /* DSA public encryption exponent e */
|
||||||
BIGNUM *g;
|
PGPV_BIGNUM *g;
|
||||||
BIGNUM *y;
|
PGPV_BIGNUM *y;
|
||||||
} dsa_pubkey_t;
|
} dsa_pubkey_t;
|
||||||
|
|
||||||
typedef struct mpi_dsa_t {
|
typedef struct mpi_dsa_t {
|
||||||
BIGNUM *p;
|
PGPV_BIGNUM *p;
|
||||||
BIGNUM *q;
|
PGPV_BIGNUM *q;
|
||||||
BIGNUM *g;
|
PGPV_BIGNUM *g;
|
||||||
BIGNUM *y;
|
PGPV_BIGNUM *y;
|
||||||
BIGNUM *x;
|
PGPV_BIGNUM *x;
|
||||||
BIGNUM *pub_key;
|
PGPV_BIGNUM *pub_key;
|
||||||
BIGNUM *priv_key;
|
PGPV_BIGNUM *priv_key;
|
||||||
} mpi_dsa_t;
|
} mpi_dsa_t;
|
||||||
|
|
||||||
#define DSA mpi_dsa_t
|
#define DSA mpi_dsa_t
|
||||||
|
|
||||||
typedef struct rsasig_t {
|
typedef struct rsasig_t {
|
||||||
BIGNUM *sig; /* mpi which is actual signature */
|
PGPV_BIGNUM *sig; /* mpi which is actual signature */
|
||||||
} rsasig_t;
|
} rsasig_t;
|
||||||
|
|
||||||
typedef struct dsasig_t {
|
typedef struct dsasig_t {
|
||||||
BIGNUM *r; /* mpi which is actual signature */
|
PGPV_BIGNUM *r; /* mpi which is actual signature */
|
||||||
BIGNUM *s; /* mpi which is actual signature */
|
PGPV_BIGNUM *s; /* mpi which is actual signature */
|
||||||
} dsasig_t;
|
} dsasig_t;
|
||||||
|
|
||||||
#define DSA_SIG dsasig_t
|
#define DSA_SIG dsasig_t
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sha1.c,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: sha1.c,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
|
/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
#define SHA1HANDSOFF /* Copies data before messing with it. */
|
#define SHA1HANDSOFF /* Copies data before messing with it. */
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -119,7 +117,7 @@ do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LON
|
||||||
/*
|
/*
|
||||||
* Hash a single 512-bit block. This is the core of the algorithm.
|
* Hash a single 512-bit block. This is the core of the algorithm.
|
||||||
*/
|
*/
|
||||||
void SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
|
void netpgpv_SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d, e;
|
uint32_t a, b, c, d, e;
|
||||||
CHAR64LONG16 *block;
|
CHAR64LONG16 *block;
|
||||||
|
|
@ -186,7 +184,7 @@ void SHA1Transform(uint32_t state[5], const uint8_t buffer[64])
|
||||||
/*
|
/*
|
||||||
* SHA1Init - Initialize new context
|
* SHA1Init - Initialize new context
|
||||||
*/
|
*/
|
||||||
void SHA1Init(SHA1_CTX *context)
|
void netpgpv_SHA1Init(NETPGPV_SHA1_CTX *context)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* SHA1 initialization constants */
|
/* SHA1 initialization constants */
|
||||||
|
|
@ -202,7 +200,7 @@ void SHA1Init(SHA1_CTX *context)
|
||||||
/*
|
/*
|
||||||
* Run your data through this.
|
* Run your data through this.
|
||||||
*/
|
*/
|
||||||
void SHA1Update(SHA1_CTX *context, const uint8_t *data, unsigned int len)
|
void netpgpv_SHA1Update(NETPGPV_SHA1_CTX *context, const uint8_t *data, unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
|
@ -212,9 +210,9 @@ void SHA1Update(SHA1_CTX *context, const uint8_t *data, unsigned int len)
|
||||||
j = (j >> 3) & 63;
|
j = (j >> 3) & 63;
|
||||||
if ((j + len) > 63) {
|
if ((j + len) > 63) {
|
||||||
(void)memcpy(&context->buffer[j], data, (i = 64-j));
|
(void)memcpy(&context->buffer[j], data, (i = 64-j));
|
||||||
SHA1Transform(context->state, context->buffer);
|
netpgpv_SHA1Transform(context->state, context->buffer);
|
||||||
for ( ; i + 63 < len; i += 64)
|
for ( ; i + 63 < len; i += 64)
|
||||||
SHA1Transform(context->state, &data[i]);
|
netpgpv_SHA1Transform(context->state, &data[i]);
|
||||||
j = 0;
|
j = 0;
|
||||||
} else {
|
} else {
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -226,7 +224,7 @@ void SHA1Update(SHA1_CTX *context, const uint8_t *data, unsigned int len)
|
||||||
/*
|
/*
|
||||||
* Add padding and return the message digest.
|
* Add padding and return the message digest.
|
||||||
*/
|
*/
|
||||||
void SHA1Final(uint8_t digest[20], SHA1_CTX *context)
|
void netpgpv_SHA1Final(uint8_t digest[20], NETPGPV_SHA1_CTX *context)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t finalcount[8];
|
uint8_t finalcount[8];
|
||||||
|
|
@ -235,10 +233,10 @@ void SHA1Final(uint8_t digest[20], SHA1_CTX *context)
|
||||||
finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)]
|
finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)]
|
||||||
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
>> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
||||||
}
|
}
|
||||||
SHA1Update(context, (const uint8_t *)"\200", 1);
|
netpgpv_SHA1Update(context, (const uint8_t *)"\200", 1);
|
||||||
while ((context->count[0] & 504) != 448)
|
while ((context->count[0] & 504) != 448)
|
||||||
SHA1Update(context, (const uint8_t *)"\0", 1);
|
netpgpv_SHA1Update(context, (const uint8_t *)"\0", 1);
|
||||||
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
netpgpv_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
||||||
|
|
||||||
if (digest) {
|
if (digest) {
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 20; i++)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sha1.h,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: sha1.h,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SHA-1 in C
|
* SHA-1 in C
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#ifndef _SYS_SHA1_H_
|
#ifndef _SYS_SHA1_H_
|
||||||
#define _SYS_SHA1_H_
|
#define _SYS_SHA1_H_
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
@ -17,22 +16,32 @@
|
||||||
#define SHA1_DIGEST_LENGTH 20
|
#define SHA1_DIGEST_LENGTH 20
|
||||||
#define SHA1_DIGEST_STRING_LENGTH 41
|
#define SHA1_DIGEST_STRING_LENGTH 41
|
||||||
|
|
||||||
|
#ifndef __BEGIN_DECLS
|
||||||
|
# if defined(__cplusplus)
|
||||||
|
# define __BEGIN_DECLS extern "C" {
|
||||||
|
# define __END_DECLS }
|
||||||
|
# else
|
||||||
|
# define __BEGIN_DECLS
|
||||||
|
# define __END_DECLS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t state[5];
|
uint32_t state[5];
|
||||||
uint32_t count[2];
|
uint32_t count[2];
|
||||||
uint8_t buffer[64];
|
uint8_t buffer[64];
|
||||||
} SHA1_CTX;
|
} NETPGPV_SHA1_CTX;
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
void SHA1Transform(uint32_t[5], const uint8_t[64]);
|
void netpgpv_SHA1Transform(uint32_t[5], const uint8_t[64]);
|
||||||
void SHA1Init(SHA1_CTX *);
|
void netpgpv_SHA1Init(NETPGPV_SHA1_CTX *);
|
||||||
void SHA1Update(SHA1_CTX *, const uint8_t *, unsigned int);
|
void netpgpv_SHA1Update(NETPGPV_SHA1_CTX *, const uint8_t *, unsigned int);
|
||||||
void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX *);
|
void netpgpv_SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], NETPGPV_SHA1_CTX *);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *SHA1End(SHA1_CTX *, char *);
|
char *netpgpv_SHA1End(NETPGPV_SHA1_CTX *, char *);
|
||||||
char *SHA1FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_SHA1FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *SHA1File(const char *, char *);
|
char *netpgpv_SHA1File(const char *, char *);
|
||||||
char *SHA1Data(const uint8_t *, size_t, char *);
|
char *netpgpv_SHA1Data(const uint8_t *, size_t, char *);
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sha2.c,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: sha2.c,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
/* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */
|
/* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
@ -161,11 +159,11 @@ be64toh(uint64_t x)
|
||||||
* library -- they are intended for private internal visibility/use
|
* library -- they are intended for private internal visibility/use
|
||||||
* only.
|
* only.
|
||||||
*/
|
*/
|
||||||
static void SHA512_Last(SHA512_CTX *);
|
static void netpgpv_SHA512_Last(NETPGPV_SHA512_CTX *);
|
||||||
void SHA224_Transform(SHA224_CTX *, const uint32_t*);
|
void netpgpv_SHA224_Transform(NETPGPV_SHA224_CTX *, const uint32_t*);
|
||||||
void SHA256_Transform(SHA256_CTX *, const uint32_t*);
|
void netpgpv_SHA256_Transform(NETPGPV_SHA256_CTX *, const uint32_t*);
|
||||||
void SHA384_Transform(SHA384_CTX *, const uint64_t*);
|
void netpgpv_SHA384_Transform(NETPGPV_SHA384_CTX *, const uint64_t*);
|
||||||
void SHA512_Transform(SHA512_CTX *, const uint64_t*);
|
void netpgpv_SHA512_Transform(NETPGPV_SHA512_CTX *, const uint64_t*);
|
||||||
|
|
||||||
|
|
||||||
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
|
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
|
||||||
|
|
@ -283,7 +281,7 @@ static const uint64_t sha512_initial_hash_value[8] = {
|
||||||
|
|
||||||
/*** SHA-256: *********************************************************/
|
/*** SHA-256: *********************************************************/
|
||||||
int
|
int
|
||||||
SHA256_Init(SHA256_CTX *context)
|
netpgpv_SHA256_Init(NETPGPV_SHA256_CTX *context)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -321,7 +319,7 @@ SHA256_Init(SHA256_CTX *context)
|
||||||
j++
|
j++
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA256_Transform(SHA256_CTX *context, const uint32_t *data)
|
netpgpv_SHA256_Transform(NETPGPV_SHA256_CTX *context, const uint32_t *data)
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d, e, f, g, h, s0, s1;
|
uint32_t a, b, c, d, e, f, g, h, s0, s1;
|
||||||
uint32_t T1, *W256;
|
uint32_t T1, *W256;
|
||||||
|
|
@ -381,7 +379,7 @@ SHA256_Transform(SHA256_CTX *context, const uint32_t *data)
|
||||||
#else /* SHA2_UNROLL_TRANSFORM */
|
#else /* SHA2_UNROLL_TRANSFORM */
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA256_Transform(SHA256_CTX *context, const uint32_t *data)
|
netpgpv_SHA256_Transform(NETPGPV_SHA256_CTX *context, const uint32_t *data)
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d, e, f, g, h, s0, s1;
|
uint32_t a, b, c, d, e, f, g, h, s0, s1;
|
||||||
uint32_t T1, T2, *W256;
|
uint32_t T1, T2, *W256;
|
||||||
|
|
@ -458,7 +456,7 @@ SHA256_Transform(SHA256_CTX *context, const uint32_t *data)
|
||||||
#endif /* SHA2_UNROLL_TRANSFORM */
|
#endif /* SHA2_UNROLL_TRANSFORM */
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
|
netpgpv_SHA256_Update(NETPGPV_SHA256_CTX *context, const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
unsigned int freespace, usedspace;
|
unsigned int freespace, usedspace;
|
||||||
|
|
||||||
|
|
@ -480,7 +478,7 @@ SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
|
||||||
context->bitcount += freespace << 3;
|
context->bitcount += freespace << 3;
|
||||||
len -= freespace;
|
len -= freespace;
|
||||||
data += freespace;
|
data += freespace;
|
||||||
SHA256_Transform(context,
|
netpgpv_SHA256_Transform(context,
|
||||||
(uint32_t *)(void *)context->buffer);
|
(uint32_t *)(void *)context->buffer);
|
||||||
} else {
|
} else {
|
||||||
/* The buffer is not yet full */
|
/* The buffer is not yet full */
|
||||||
|
|
@ -500,7 +498,7 @@ SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
|
||||||
*/
|
*/
|
||||||
if ((uintptr_t)data % 4 == 0) {
|
if ((uintptr_t)data % 4 == 0) {
|
||||||
while (len >= SHA256_BLOCK_LENGTH) {
|
while (len >= SHA256_BLOCK_LENGTH) {
|
||||||
SHA256_Transform(context,
|
netpgpv_SHA256_Transform(context,
|
||||||
(const uint32_t *)(const void *)data);
|
(const uint32_t *)(const void *)data);
|
||||||
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
||||||
len -= SHA256_BLOCK_LENGTH;
|
len -= SHA256_BLOCK_LENGTH;
|
||||||
|
|
@ -509,7 +507,7 @@ SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
|
||||||
} else {
|
} else {
|
||||||
while (len >= SHA256_BLOCK_LENGTH) {
|
while (len >= SHA256_BLOCK_LENGTH) {
|
||||||
memcpy(context->buffer, data, SHA256_BLOCK_LENGTH);
|
memcpy(context->buffer, data, SHA256_BLOCK_LENGTH);
|
||||||
SHA256_Transform(context,
|
netpgpv_SHA256_Transform(context,
|
||||||
(const uint32_t *)(const void *)context->buffer);
|
(const uint32_t *)(const void *)context->buffer);
|
||||||
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
||||||
len -= SHA256_BLOCK_LENGTH;
|
len -= SHA256_BLOCK_LENGTH;
|
||||||
|
|
@ -528,7 +526,7 @@ SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len)
|
netpgpv_SHA224_256_Final(uint8_t digest[], NETPGPV_SHA256_CTX *context, size_t len)
|
||||||
{
|
{
|
||||||
unsigned int usedspace;
|
unsigned int usedspace;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -554,7 +552,7 @@ SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len)
|
||||||
usedspace));
|
usedspace));
|
||||||
}
|
}
|
||||||
/* Do second-to-last transform: */
|
/* Do second-to-last transform: */
|
||||||
SHA256_Transform(context,
|
netpgpv_SHA256_Transform(context,
|
||||||
(uint32_t *)(void *)context->buffer);
|
(uint32_t *)(void *)context->buffer);
|
||||||
|
|
||||||
/* And set-up for the last transform: */
|
/* And set-up for the last transform: */
|
||||||
|
|
@ -574,7 +572,7 @@ SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len)
|
||||||
&context->bitcount, sizeof(context->bitcount));
|
&context->bitcount, sizeof(context->bitcount));
|
||||||
|
|
||||||
/* Final transform: */
|
/* Final transform: */
|
||||||
SHA256_Transform(context, (uint32_t *)(void *)context->buffer);
|
netpgpv_SHA256_Transform(context, (uint32_t *)(void *)context->buffer);
|
||||||
|
|
||||||
for (i = 0; i < len / 4; i++)
|
for (i = 0; i < len / 4; i++)
|
||||||
be32encode(digest + 4 * i, context->state[i]);
|
be32encode(digest + 4 * i, context->state[i]);
|
||||||
|
|
@ -588,14 +586,14 @@ SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA256_Final(uint8_t digest[], SHA256_CTX *context)
|
netpgpv_SHA256_Final(uint8_t digest[], NETPGPV_SHA256_CTX *context)
|
||||||
{
|
{
|
||||||
return SHA224_256_Final(digest, context, SHA256_DIGEST_LENGTH);
|
return netpgpv_SHA224_256_Final(digest, context, SHA256_DIGEST_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** SHA-224: *********************************************************/
|
/*** SHA-224: *********************************************************/
|
||||||
int
|
int
|
||||||
SHA224_Init(SHA224_CTX *context)
|
netpgpv_SHA224_Init(NETPGPV_SHA224_CTX *context)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -610,27 +608,27 @@ SHA224_Init(SHA224_CTX *context)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA224_Update(SHA224_CTX *context, const uint8_t *data, size_t len)
|
netpgpv_SHA224_Update(NETPGPV_SHA224_CTX *context, const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
return SHA256_Update((SHA256_CTX *)context, data, len);
|
return netpgpv_SHA256_Update((NETPGPV_SHA256_CTX *)context, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA224_Transform(SHA224_CTX *context, const uint32_t *data)
|
netpgpv_SHA224_Transform(NETPGPV_SHA224_CTX *context, const uint32_t *data)
|
||||||
{
|
{
|
||||||
SHA256_Transform((SHA256_CTX *)context, data);
|
netpgpv_SHA256_Transform((NETPGPV_SHA256_CTX *)context, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA224_Final(uint8_t digest[], SHA224_CTX *context)
|
netpgpv_SHA224_Final(uint8_t digest[], NETPGPV_SHA224_CTX *context)
|
||||||
{
|
{
|
||||||
return SHA224_256_Final(digest, (SHA256_CTX *)context,
|
return netpgpv_SHA224_256_Final(digest, (NETPGPV_SHA256_CTX *)context,
|
||||||
SHA224_DIGEST_LENGTH);
|
SHA224_DIGEST_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** SHA-512: *********************************************************/
|
/*** SHA-512: *********************************************************/
|
||||||
int
|
int
|
||||||
SHA512_Init(SHA512_CTX *context)
|
netpgpv_SHA512_Init(NETPGPV_SHA512_CTX *context)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -667,7 +665,7 @@ SHA512_Init(SHA512_CTX *context)
|
||||||
j++
|
j++
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA512_Transform(SHA512_CTX *context, const uint64_t *data)
|
netpgpv_SHA512_Transform(NETPGPV_SHA512_CTX *context, const uint64_t *data)
|
||||||
{
|
{
|
||||||
uint64_t a, b, c, d, e, f, g, h, s0, s1;
|
uint64_t a, b, c, d, e, f, g, h, s0, s1;
|
||||||
uint64_t T1, *W512 = (uint64_t *)context->buffer;
|
uint64_t T1, *W512 = (uint64_t *)context->buffer;
|
||||||
|
|
@ -724,7 +722,7 @@ SHA512_Transform(SHA512_CTX *context, const uint64_t *data)
|
||||||
#else /* SHA2_UNROLL_TRANSFORM */
|
#else /* SHA2_UNROLL_TRANSFORM */
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA512_Transform(SHA512_CTX *context, const uint64_t *data)
|
netpgpv_SHA512_Transform(NETPGPV_SHA512_CTX *context, const uint64_t *data)
|
||||||
{
|
{
|
||||||
uint64_t a, b, c, d, e, f, g, h, s0, s1;
|
uint64_t a, b, c, d, e, f, g, h, s0, s1;
|
||||||
uint64_t T1, T2, *W512 = (void *)context->buffer;
|
uint64_t T1, T2, *W512 = (void *)context->buffer;
|
||||||
|
|
@ -799,7 +797,7 @@ SHA512_Transform(SHA512_CTX *context, const uint64_t *data)
|
||||||
#endif /* SHA2_UNROLL_TRANSFORM */
|
#endif /* SHA2_UNROLL_TRANSFORM */
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len)
|
netpgpv_SHA512_Update(NETPGPV_SHA512_CTX *context, const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
unsigned int freespace, usedspace;
|
unsigned int freespace, usedspace;
|
||||||
|
|
||||||
|
|
@ -821,7 +819,7 @@ SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len)
|
||||||
ADDINC128(context->bitcount, freespace << 3);
|
ADDINC128(context->bitcount, freespace << 3);
|
||||||
len -= freespace;
|
len -= freespace;
|
||||||
data += freespace;
|
data += freespace;
|
||||||
SHA512_Transform(context,
|
netpgpv_SHA512_Transform(context,
|
||||||
(uint64_t *)(void *)context->buffer);
|
(uint64_t *)(void *)context->buffer);
|
||||||
} else {
|
} else {
|
||||||
/* The buffer is not yet full */
|
/* The buffer is not yet full */
|
||||||
|
|
@ -841,7 +839,7 @@ SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len)
|
||||||
*/
|
*/
|
||||||
if ((uintptr_t)data % 8 == 0) {
|
if ((uintptr_t)data % 8 == 0) {
|
||||||
while (len >= SHA512_BLOCK_LENGTH) {
|
while (len >= SHA512_BLOCK_LENGTH) {
|
||||||
SHA512_Transform(context,
|
netpgpv_SHA512_Transform(context,
|
||||||
(const uint64_t*)(const void *)data);
|
(const uint64_t*)(const void *)data);
|
||||||
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
|
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
|
||||||
len -= SHA512_BLOCK_LENGTH;
|
len -= SHA512_BLOCK_LENGTH;
|
||||||
|
|
@ -850,7 +848,7 @@ SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len)
|
||||||
} else {
|
} else {
|
||||||
while (len >= SHA512_BLOCK_LENGTH) {
|
while (len >= SHA512_BLOCK_LENGTH) {
|
||||||
memcpy(context->buffer, data, SHA512_BLOCK_LENGTH);
|
memcpy(context->buffer, data, SHA512_BLOCK_LENGTH);
|
||||||
SHA512_Transform(context,
|
netpgpv_SHA512_Transform(context,
|
||||||
(const void *)context->buffer);
|
(const void *)context->buffer);
|
||||||
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
|
ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
|
||||||
len -= SHA512_BLOCK_LENGTH;
|
len -= SHA512_BLOCK_LENGTH;
|
||||||
|
|
@ -869,7 +867,7 @@ SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SHA512_Last(SHA512_CTX *context)
|
netpgpv_SHA512_Last(NETPGPV_SHA512_CTX *context)
|
||||||
{
|
{
|
||||||
unsigned int usedspace;
|
unsigned int usedspace;
|
||||||
|
|
||||||
|
|
@ -890,7 +888,7 @@ SHA512_Last(SHA512_CTX *context)
|
||||||
(size_t)(SHA512_BLOCK_LENGTH - usedspace));
|
(size_t)(SHA512_BLOCK_LENGTH - usedspace));
|
||||||
}
|
}
|
||||||
/* Do second-to-last transform: */
|
/* Do second-to-last transform: */
|
||||||
SHA512_Transform(context,
|
netpgpv_SHA512_Transform(context,
|
||||||
(uint64_t *)(void *)context->buffer);
|
(uint64_t *)(void *)context->buffer);
|
||||||
|
|
||||||
/* And set-up for the last transform: */
|
/* And set-up for the last transform: */
|
||||||
|
|
@ -911,17 +909,17 @@ SHA512_Last(SHA512_CTX *context)
|
||||||
&context->bitcount[0], sizeof(context->bitcount[0]));
|
&context->bitcount[0], sizeof(context->bitcount[0]));
|
||||||
|
|
||||||
/* Final transform: */
|
/* Final transform: */
|
||||||
SHA512_Transform(context, (uint64_t *)(void *)context->buffer);
|
netpgpv_SHA512_Transform(context, (uint64_t *)(void *)context->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA512_Final(uint8_t digest[], SHA512_CTX *context)
|
netpgpv_SHA512_Final(uint8_t digest[], NETPGPV_SHA512_CTX *context)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/* If no digest buffer is passed, we don't bother doing this: */
|
/* If no digest buffer is passed, we don't bother doing this: */
|
||||||
if (digest != NULL) {
|
if (digest != NULL) {
|
||||||
SHA512_Last(context);
|
netpgpv_SHA512_Last(context);
|
||||||
|
|
||||||
/* Save the hash data for output: */
|
/* Save the hash data for output: */
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
|
|
@ -936,7 +934,7 @@ SHA512_Final(uint8_t digest[], SHA512_CTX *context)
|
||||||
|
|
||||||
/*** SHA-384: *********************************************************/
|
/*** SHA-384: *********************************************************/
|
||||||
int
|
int
|
||||||
SHA384_Init(SHA384_CTX *context)
|
netpgpv_SHA384_Init(NETPGPV_SHA384_CTX *context)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -950,25 +948,25 @@ SHA384_Init(SHA384_CTX *context)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA384_Update(SHA384_CTX *context, const uint8_t *data, size_t len)
|
netpgpv_SHA384_Update(NETPGPV_SHA384_CTX *context, const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
return SHA512_Update((SHA512_CTX *)context, data, len);
|
return netpgpv_SHA512_Update((NETPGPV_SHA512_CTX *)context, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SHA384_Transform(SHA512_CTX *context, const uint64_t *data)
|
netpgpv_SHA384_Transform(NETPGPV_SHA512_CTX *context, const uint64_t *data)
|
||||||
{
|
{
|
||||||
SHA512_Transform((SHA512_CTX *)context, data);
|
netpgpv_SHA512_Transform((NETPGPV_SHA512_CTX *)context, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SHA384_Final(uint8_t digest[], SHA384_CTX *context)
|
netpgpv_SHA384_Final(uint8_t digest[], NETPGPV_SHA384_CTX *context)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/* If no digest buffer is passed, we don't bother doing this: */
|
/* If no digest buffer is passed, we don't bother doing this: */
|
||||||
if (digest != NULL) {
|
if (digest != NULL) {
|
||||||
SHA512_Last((SHA512_CTX *)context);
|
netpgpv_SHA512_Last((NETPGPV_SHA512_CTX *)context);
|
||||||
|
|
||||||
/* Save the hash data for output: */
|
/* Save the hash data for output: */
|
||||||
for (i = 0; i < 6; ++i)
|
for (i = 0; i < 6; ++i)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sha2.h,v 1.1 2014/03/09 00:15:45 agc Exp $ */
|
/* $NetBSD: sha2.h,v 1.2 2016/06/14 20:47:08 agc Exp $ */
|
||||||
/* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */
|
/* $KAME: sha2.h,v 1.4 2003/07/20 00:28:38 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#define __SHA2_H__
|
#define __SHA2_H__
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
/*** SHA-224/256/384/512 Various Length Definitions ***********************/
|
/*** SHA-224/256/384/512 Various Length Definitions ***********************/
|
||||||
#define SHA224_BLOCK_LENGTH 64
|
#define SHA224_BLOCK_LENGTH 64
|
||||||
|
|
@ -56,64 +55,73 @@
|
||||||
#define SHA512_DIGEST_LENGTH 64
|
#define SHA512_DIGEST_LENGTH 64
|
||||||
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
|
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
|
||||||
|
|
||||||
|
#ifndef __BEGIN_DECLS
|
||||||
|
# if defined(__cplusplus)
|
||||||
|
# define __BEGIN_DECLS extern "C" {
|
||||||
|
# define __END_DECLS }
|
||||||
|
# else
|
||||||
|
# define __BEGIN_DECLS
|
||||||
|
# define __END_DECLS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** SHA-256/384/512 Context Structures *******************************/
|
/*** SHA-256/384/512 Context Structures *******************************/
|
||||||
typedef struct _SHA256_CTX {
|
typedef struct _NETPGPV_SHA256_CTX {
|
||||||
uint32_t state[8];
|
uint32_t state[8];
|
||||||
uint64_t bitcount;
|
uint64_t bitcount;
|
||||||
uint8_t buffer[SHA256_BLOCK_LENGTH];
|
uint8_t buffer[SHA256_BLOCK_LENGTH];
|
||||||
} SHA256_CTX;
|
} NETPGPV_SHA256_CTX;
|
||||||
|
|
||||||
typedef struct _SHA512_CTX {
|
typedef struct _NETPGPV_SHA512_CTX {
|
||||||
uint64_t state[8];
|
uint64_t state[8];
|
||||||
uint64_t bitcount[2];
|
uint64_t bitcount[2];
|
||||||
uint8_t buffer[SHA512_BLOCK_LENGTH];
|
uint8_t buffer[SHA512_BLOCK_LENGTH];
|
||||||
} SHA512_CTX;
|
} NETPGPV_SHA512_CTX;
|
||||||
|
|
||||||
typedef SHA256_CTX SHA224_CTX;
|
typedef NETPGPV_SHA256_CTX NETPGPV_SHA224_CTX;
|
||||||
typedef SHA512_CTX SHA384_CTX;
|
typedef NETPGPV_SHA512_CTX NETPGPV_SHA384_CTX;
|
||||||
|
|
||||||
|
|
||||||
/*** SHA-256/384/512 Function Prototypes ******************************/
|
/*** SHA-256/384/512 Function Prototypes ******************************/
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
int SHA224_Init(SHA224_CTX *);
|
int netpgpv_SHA224_Init(NETPGPV_SHA224_CTX *);
|
||||||
int SHA224_Update(SHA224_CTX*, const uint8_t*, size_t);
|
int netpgpv_SHA224_Update(NETPGPV_SHA224_CTX*, const uint8_t*, size_t);
|
||||||
int SHA224_Final(uint8_t[SHA224_DIGEST_LENGTH], SHA224_CTX*);
|
int netpgpv_SHA224_Final(uint8_t[SHA224_DIGEST_LENGTH], NETPGPV_SHA224_CTX*);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *SHA224_End(SHA224_CTX *, char[SHA224_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA224_End(NETPGPV_SHA224_CTX *, char[SHA224_DIGEST_STRING_LENGTH]);
|
||||||
char *SHA224_FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_SHA224_FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *SHA224_File(const char *, char *);
|
char *netpgpv_SHA224_File(const char *, char *);
|
||||||
char *SHA224_Data(const uint8_t *, size_t, char[SHA224_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA224_Data(const uint8_t *, size_t, char[SHA224_DIGEST_STRING_LENGTH]);
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
int SHA256_Init(SHA256_CTX *);
|
int netpgpv_SHA256_Init(NETPGPV_SHA256_CTX *);
|
||||||
int SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
|
int netpgpv_SHA256_Update(NETPGPV_SHA256_CTX*, const uint8_t*, size_t);
|
||||||
int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
|
int netpgpv_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], NETPGPV_SHA256_CTX*);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *SHA256_End(SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA256_End(NETPGPV_SHA256_CTX *, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||||
char *SHA256_FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_SHA256_FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *SHA256_File(const char *, char *);
|
char *netpgpv_SHA256_File(const char *, char *);
|
||||||
char *SHA256_Data(const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA256_Data(const uint8_t *, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
int SHA384_Init(SHA384_CTX*);
|
int netpgpv_SHA384_Init(NETPGPV_SHA384_CTX*);
|
||||||
int SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
|
int netpgpv_SHA384_Update(NETPGPV_SHA384_CTX*, const uint8_t*, size_t);
|
||||||
int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
|
int netpgpv_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], NETPGPV_SHA384_CTX*);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *SHA384_End(SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA384_End(NETPGPV_SHA384_CTX *, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||||
char *SHA384_FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_SHA384_FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *SHA384_File(const char *, char *);
|
char *netpgpv_SHA384_File(const char *, char *);
|
||||||
char *SHA384_Data(const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA384_Data(const uint8_t *, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
|
|
||||||
int SHA512_Init(SHA512_CTX*);
|
int netpgpv_SHA512_Init(NETPGPV_SHA512_CTX*);
|
||||||
int SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
|
int netpgpv_SHA512_Update(NETPGPV_SHA512_CTX*, const uint8_t*, size_t);
|
||||||
int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
|
int netpgpv_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], NETPGPV_SHA512_CTX*);
|
||||||
#ifndef _KERNEL
|
#ifndef _KERNEL
|
||||||
char *SHA512_End(SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA512_End(NETPGPV_SHA512_CTX *, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||||
char *SHA512_FileChunk(const char *, char *, off_t, off_t);
|
char *netpgpv_SHA512_FileChunk(const char *, char *, off_t, off_t);
|
||||||
char *SHA512_File(const char *, char *);
|
char *netpgpv_SHA512_File(const char *, char *);
|
||||||
char *SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
|
char *netpgpv_SHA512_Data(const uint8_t *, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||||
#endif /* !_KERNEL */
|
#endif /* !_KERNEL */
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,906 +0,0 @@
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "tiger.h"
|
|
||||||
|
|
||||||
#ifndef IS_LITTLE_ENDIAN
|
|
||||||
#define IS_LITTLE_ENDIAN(x) (*(char *)(void *)&x)
|
|
||||||
#define IS_BIG_ENDIAN(x) !(*(char *)(void *)&x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BSWAP64(x) ((((x) & 0xffULL) << 56) | \
|
|
||||||
(((x) & 0xff00ULL) << 40) | \
|
|
||||||
(((x) & 0xff0000ULL) << 24) | \
|
|
||||||
(((x) & 0xff000000ULL) << 8) | \
|
|
||||||
(((x) & 0xff00000000ULL) >> 8) | \
|
|
||||||
(((x) & 0xff0000000000ULL) >> 24) | \
|
|
||||||
(((x) & 0xff000000000000ULL) >> 40) | \
|
|
||||||
(((x) & 0xff00000000000000ULL) >> 56))
|
|
||||||
|
|
||||||
/* sboxes.c: Tiger S boxes */
|
|
||||||
static uint64_t table[4*256] = {
|
|
||||||
0x02AAB17CF7E90C5ELL /* 0 */, 0xAC424B03E243A8ECLL /* 1 */,
|
|
||||||
0x72CD5BE30DD5FCD3LL /* 2 */, 0x6D019B93F6F97F3ALL /* 3 */,
|
|
||||||
0xCD9978FFD21F9193LL /* 4 */, 0x7573A1C9708029E2LL /* 5 */,
|
|
||||||
0xB164326B922A83C3LL /* 6 */, 0x46883EEE04915870LL /* 7 */,
|
|
||||||
0xEAACE3057103ECE6LL /* 8 */, 0xC54169B808A3535CLL /* 9 */,
|
|
||||||
0x4CE754918DDEC47CLL /* 10 */, 0x0AA2F4DFDC0DF40CLL /* 11 */,
|
|
||||||
0x10B76F18A74DBEFALL /* 12 */, 0xC6CCB6235AD1AB6ALL /* 13 */,
|
|
||||||
0x13726121572FE2FFLL /* 14 */, 0x1A488C6F199D921ELL /* 15 */,
|
|
||||||
0x4BC9F9F4DA0007CALL /* 16 */, 0x26F5E6F6E85241C7LL /* 17 */,
|
|
||||||
0x859079DBEA5947B6LL /* 18 */, 0x4F1885C5C99E8C92LL /* 19 */,
|
|
||||||
0xD78E761EA96F864BLL /* 20 */, 0x8E36428C52B5C17DLL /* 21 */,
|
|
||||||
0x69CF6827373063C1LL /* 22 */, 0xB607C93D9BB4C56ELL /* 23 */,
|
|
||||||
0x7D820E760E76B5EALL /* 24 */, 0x645C9CC6F07FDC42LL /* 25 */,
|
|
||||||
0xBF38A078243342E0LL /* 26 */, 0x5F6B343C9D2E7D04LL /* 27 */,
|
|
||||||
0xF2C28AEB600B0EC6LL /* 28 */, 0x6C0ED85F7254BCACLL /* 29 */,
|
|
||||||
0x71592281A4DB4FE5LL /* 30 */, 0x1967FA69CE0FED9FLL /* 31 */,
|
|
||||||
0xFD5293F8B96545DBLL /* 32 */, 0xC879E9D7F2A7600BLL /* 33 */,
|
|
||||||
0x860248920193194ELL /* 34 */, 0xA4F9533B2D9CC0B3LL /* 35 */,
|
|
||||||
0x9053836C15957613LL /* 36 */, 0xDB6DCF8AFC357BF1LL /* 37 */,
|
|
||||||
0x18BEEA7A7A370F57LL /* 38 */, 0x037117CA50B99066LL /* 39 */,
|
|
||||||
0x6AB30A9774424A35LL /* 40 */, 0xF4E92F02E325249BLL /* 41 */,
|
|
||||||
0x7739DB07061CCAE1LL /* 42 */, 0xD8F3B49CECA42A05LL /* 43 */,
|
|
||||||
0xBD56BE3F51382F73LL /* 44 */, 0x45FAED5843B0BB28LL /* 45 */,
|
|
||||||
0x1C813D5C11BF1F83LL /* 46 */, 0x8AF0E4B6D75FA169LL /* 47 */,
|
|
||||||
0x33EE18A487AD9999LL /* 48 */, 0x3C26E8EAB1C94410LL /* 49 */,
|
|
||||||
0xB510102BC0A822F9LL /* 50 */, 0x141EEF310CE6123BLL /* 51 */,
|
|
||||||
0xFC65B90059DDB154LL /* 52 */, 0xE0158640C5E0E607LL /* 53 */,
|
|
||||||
0x884E079826C3A3CFLL /* 54 */, 0x930D0D9523C535FDLL /* 55 */,
|
|
||||||
0x35638D754E9A2B00LL /* 56 */, 0x4085FCCF40469DD5LL /* 57 */,
|
|
||||||
0xC4B17AD28BE23A4CLL /* 58 */, 0xCAB2F0FC6A3E6A2ELL /* 59 */,
|
|
||||||
0x2860971A6B943FCDLL /* 60 */, 0x3DDE6EE212E30446LL /* 61 */,
|
|
||||||
0x6222F32AE01765AELL /* 62 */, 0x5D550BB5478308FELL /* 63 */,
|
|
||||||
0xA9EFA98DA0EDA22ALL /* 64 */, 0xC351A71686C40DA7LL /* 65 */,
|
|
||||||
0x1105586D9C867C84LL /* 66 */, 0xDCFFEE85FDA22853LL /* 67 */,
|
|
||||||
0xCCFBD0262C5EEF76LL /* 68 */, 0xBAF294CB8990D201LL /* 69 */,
|
|
||||||
0xE69464F52AFAD975LL /* 70 */, 0x94B013AFDF133E14LL /* 71 */,
|
|
||||||
0x06A7D1A32823C958LL /* 72 */, 0x6F95FE5130F61119LL /* 73 */,
|
|
||||||
0xD92AB34E462C06C0LL /* 74 */, 0xED7BDE33887C71D2LL /* 75 */,
|
|
||||||
0x79746D6E6518393ELL /* 76 */, 0x5BA419385D713329LL /* 77 */,
|
|
||||||
0x7C1BA6B948A97564LL /* 78 */, 0x31987C197BFDAC67LL /* 79 */,
|
|
||||||
0xDE6C23C44B053D02LL /* 80 */, 0x581C49FED002D64DLL /* 81 */,
|
|
||||||
0xDD474D6338261571LL /* 82 */, 0xAA4546C3E473D062LL /* 83 */,
|
|
||||||
0x928FCE349455F860LL /* 84 */, 0x48161BBACAAB94D9LL /* 85 */,
|
|
||||||
0x63912430770E6F68LL /* 86 */, 0x6EC8A5E602C6641CLL /* 87 */,
|
|
||||||
0x87282515337DDD2BLL /* 88 */, 0x2CDA6B42034B701BLL /* 89 */,
|
|
||||||
0xB03D37C181CB096DLL /* 90 */, 0xE108438266C71C6FLL /* 91 */,
|
|
||||||
0x2B3180C7EB51B255LL /* 92 */, 0xDF92B82F96C08BBCLL /* 93 */,
|
|
||||||
0x5C68C8C0A632F3BALL /* 94 */, 0x5504CC861C3D0556LL /* 95 */,
|
|
||||||
0xABBFA4E55FB26B8FLL /* 96 */, 0x41848B0AB3BACEB4LL /* 97 */,
|
|
||||||
0xB334A273AA445D32LL /* 98 */, 0xBCA696F0A85AD881LL /* 99 */,
|
|
||||||
0x24F6EC65B528D56CLL /* 100 */, 0x0CE1512E90F4524ALL /* 101 */,
|
|
||||||
0x4E9DD79D5506D35ALL /* 102 */, 0x258905FAC6CE9779LL /* 103 */,
|
|
||||||
0x2019295B3E109B33LL /* 104 */, 0xF8A9478B73A054CCLL /* 105 */,
|
|
||||||
0x2924F2F934417EB0LL /* 106 */, 0x3993357D536D1BC4LL /* 107 */,
|
|
||||||
0x38A81AC21DB6FF8BLL /* 108 */, 0x47C4FBF17D6016BFLL /* 109 */,
|
|
||||||
0x1E0FAADD7667E3F5LL /* 110 */, 0x7ABCFF62938BEB96LL /* 111 */,
|
|
||||||
0xA78DAD948FC179C9LL /* 112 */, 0x8F1F98B72911E50DLL /* 113 */,
|
|
||||||
0x61E48EAE27121A91LL /* 114 */, 0x4D62F7AD31859808LL /* 115 */,
|
|
||||||
0xECEBA345EF5CEAEBLL /* 116 */, 0xF5CEB25EBC9684CELL /* 117 */,
|
|
||||||
0xF633E20CB7F76221LL /* 118 */, 0xA32CDF06AB8293E4LL /* 119 */,
|
|
||||||
0x985A202CA5EE2CA4LL /* 120 */, 0xCF0B8447CC8A8FB1LL /* 121 */,
|
|
||||||
0x9F765244979859A3LL /* 122 */, 0xA8D516B1A1240017LL /* 123 */,
|
|
||||||
0x0BD7BA3EBB5DC726LL /* 124 */, 0xE54BCA55B86ADB39LL /* 125 */,
|
|
||||||
0x1D7A3AFD6C478063LL /* 126 */, 0x519EC608E7669EDDLL /* 127 */,
|
|
||||||
0x0E5715A2D149AA23LL /* 128 */, 0x177D4571848FF194LL /* 129 */,
|
|
||||||
0xEEB55F3241014C22LL /* 130 */, 0x0F5E5CA13A6E2EC2LL /* 131 */,
|
|
||||||
0x8029927B75F5C361LL /* 132 */, 0xAD139FABC3D6E436LL /* 133 */,
|
|
||||||
0x0D5DF1A94CCF402FLL /* 134 */, 0x3E8BD948BEA5DFC8LL /* 135 */,
|
|
||||||
0xA5A0D357BD3FF77ELL /* 136 */, 0xA2D12E251F74F645LL /* 137 */,
|
|
||||||
0x66FD9E525E81A082LL /* 138 */, 0x2E0C90CE7F687A49LL /* 139 */,
|
|
||||||
0xC2E8BCBEBA973BC5LL /* 140 */, 0x000001BCE509745FLL /* 141 */,
|
|
||||||
0x423777BBE6DAB3D6LL /* 142 */, 0xD1661C7EAEF06EB5LL /* 143 */,
|
|
||||||
0xA1781F354DAACFD8LL /* 144 */, 0x2D11284A2B16AFFCLL /* 145 */,
|
|
||||||
0xF1FC4F67FA891D1FLL /* 146 */, 0x73ECC25DCB920ADALL /* 147 */,
|
|
||||||
0xAE610C22C2A12651LL /* 148 */, 0x96E0A810D356B78ALL /* 149 */,
|
|
||||||
0x5A9A381F2FE7870FLL /* 150 */, 0xD5AD62EDE94E5530LL /* 151 */,
|
|
||||||
0xD225E5E8368D1427LL /* 152 */, 0x65977B70C7AF4631LL /* 153 */,
|
|
||||||
0x99F889B2DE39D74FLL /* 154 */, 0x233F30BF54E1D143LL /* 155 */,
|
|
||||||
0x9A9675D3D9A63C97LL /* 156 */, 0x5470554FF334F9A8LL /* 157 */,
|
|
||||||
0x166ACB744A4F5688LL /* 158 */, 0x70C74CAAB2E4AEADLL /* 159 */,
|
|
||||||
0xF0D091646F294D12LL /* 160 */, 0x57B82A89684031D1LL /* 161 */,
|
|
||||||
0xEFD95A5A61BE0B6BLL /* 162 */, 0x2FBD12E969F2F29ALL /* 163 */,
|
|
||||||
0x9BD37013FEFF9FE8LL /* 164 */, 0x3F9B0404D6085A06LL /* 165 */,
|
|
||||||
0x4940C1F3166CFE15LL /* 166 */, 0x09542C4DCDF3DEFBLL /* 167 */,
|
|
||||||
0xB4C5218385CD5CE3LL /* 168 */, 0xC935B7DC4462A641LL /* 169 */,
|
|
||||||
0x3417F8A68ED3B63FLL /* 170 */, 0xB80959295B215B40LL /* 171 */,
|
|
||||||
0xF99CDAEF3B8C8572LL /* 172 */, 0x018C0614F8FCB95DLL /* 173 */,
|
|
||||||
0x1B14ACCD1A3ACDF3LL /* 174 */, 0x84D471F200BB732DLL /* 175 */,
|
|
||||||
0xC1A3110E95E8DA16LL /* 176 */, 0x430A7220BF1A82B8LL /* 177 */,
|
|
||||||
0xB77E090D39DF210ELL /* 178 */, 0x5EF4BD9F3CD05E9DLL /* 179 */,
|
|
||||||
0x9D4FF6DA7E57A444LL /* 180 */, 0xDA1D60E183D4A5F8LL /* 181 */,
|
|
||||||
0xB287C38417998E47LL /* 182 */, 0xFE3EDC121BB31886LL /* 183 */,
|
|
||||||
0xC7FE3CCC980CCBEFLL /* 184 */, 0xE46FB590189BFD03LL /* 185 */,
|
|
||||||
0x3732FD469A4C57DCLL /* 186 */, 0x7EF700A07CF1AD65LL /* 187 */,
|
|
||||||
0x59C64468A31D8859LL /* 188 */, 0x762FB0B4D45B61F6LL /* 189 */,
|
|
||||||
0x155BAED099047718LL /* 190 */, 0x68755E4C3D50BAA6LL /* 191 */,
|
|
||||||
0xE9214E7F22D8B4DFLL /* 192 */, 0x2ADDBF532EAC95F4LL /* 193 */,
|
|
||||||
0x32AE3909B4BD0109LL /* 194 */, 0x834DF537B08E3450LL /* 195 */,
|
|
||||||
0xFA209DA84220728DLL /* 196 */, 0x9E691D9B9EFE23F7LL /* 197 */,
|
|
||||||
0x0446D288C4AE8D7FLL /* 198 */, 0x7B4CC524E169785BLL /* 199 */,
|
|
||||||
0x21D87F0135CA1385LL /* 200 */, 0xCEBB400F137B8AA5LL /* 201 */,
|
|
||||||
0x272E2B66580796BELL /* 202 */, 0x3612264125C2B0DELL /* 203 */,
|
|
||||||
0x057702BDAD1EFBB2LL /* 204 */, 0xD4BABB8EACF84BE9LL /* 205 */,
|
|
||||||
0x91583139641BC67BLL /* 206 */, 0x8BDC2DE08036E024LL /* 207 */,
|
|
||||||
0x603C8156F49F68EDLL /* 208 */, 0xF7D236F7DBEF5111LL /* 209 */,
|
|
||||||
0x9727C4598AD21E80LL /* 210 */, 0xA08A0896670A5FD7LL /* 211 */,
|
|
||||||
0xCB4A8F4309EBA9CBLL /* 212 */, 0x81AF564B0F7036A1LL /* 213 */,
|
|
||||||
0xC0B99AA778199ABDLL /* 214 */, 0x959F1EC83FC8E952LL /* 215 */,
|
|
||||||
0x8C505077794A81B9LL /* 216 */, 0x3ACAAF8F056338F0LL /* 217 */,
|
|
||||||
0x07B43F50627A6778LL /* 218 */, 0x4A44AB49F5ECCC77LL /* 219 */,
|
|
||||||
0x3BC3D6E4B679EE98LL /* 220 */, 0x9CC0D4D1CF14108CLL /* 221 */,
|
|
||||||
0x4406C00B206BC8A0LL /* 222 */, 0x82A18854C8D72D89LL /* 223 */,
|
|
||||||
0x67E366B35C3C432CLL /* 224 */, 0xB923DD61102B37F2LL /* 225 */,
|
|
||||||
0x56AB2779D884271DLL /* 226 */, 0xBE83E1B0FF1525AFLL /* 227 */,
|
|
||||||
0xFB7C65D4217E49A9LL /* 228 */, 0x6BDBE0E76D48E7D4LL /* 229 */,
|
|
||||||
0x08DF828745D9179ELL /* 230 */, 0x22EA6A9ADD53BD34LL /* 231 */,
|
|
||||||
0xE36E141C5622200ALL /* 232 */, 0x7F805D1B8CB750EELL /* 233 */,
|
|
||||||
0xAFE5C7A59F58E837LL /* 234 */, 0xE27F996A4FB1C23CLL /* 235 */,
|
|
||||||
0xD3867DFB0775F0D0LL /* 236 */, 0xD0E673DE6E88891ALL /* 237 */,
|
|
||||||
0x123AEB9EAFB86C25LL /* 238 */, 0x30F1D5D5C145B895LL /* 239 */,
|
|
||||||
0xBB434A2DEE7269E7LL /* 240 */, 0x78CB67ECF931FA38LL /* 241 */,
|
|
||||||
0xF33B0372323BBF9CLL /* 242 */, 0x52D66336FB279C74LL /* 243 */,
|
|
||||||
0x505F33AC0AFB4EAALL /* 244 */, 0xE8A5CD99A2CCE187LL /* 245 */,
|
|
||||||
0x534974801E2D30BBLL /* 246 */, 0x8D2D5711D5876D90LL /* 247 */,
|
|
||||||
0x1F1A412891BC038ELL /* 248 */, 0xD6E2E71D82E56648LL /* 249 */,
|
|
||||||
0x74036C3A497732B7LL /* 250 */, 0x89B67ED96361F5ABLL /* 251 */,
|
|
||||||
0xFFED95D8F1EA02A2LL /* 252 */, 0xE72B3BD61464D43DLL /* 253 */,
|
|
||||||
0xA6300F170BDC4820LL /* 254 */, 0xEBC18760ED78A77ALL /* 255 */,
|
|
||||||
0xE6A6BE5A05A12138LL /* 256 */, 0xB5A122A5B4F87C98LL /* 257 */,
|
|
||||||
0x563C6089140B6990LL /* 258 */, 0x4C46CB2E391F5DD5LL /* 259 */,
|
|
||||||
0xD932ADDBC9B79434LL /* 260 */, 0x08EA70E42015AFF5LL /* 261 */,
|
|
||||||
0xD765A6673E478CF1LL /* 262 */, 0xC4FB757EAB278D99LL /* 263 */,
|
|
||||||
0xDF11C6862D6E0692LL /* 264 */, 0xDDEB84F10D7F3B16LL /* 265 */,
|
|
||||||
0x6F2EF604A665EA04LL /* 266 */, 0x4A8E0F0FF0E0DFB3LL /* 267 */,
|
|
||||||
0xA5EDEEF83DBCBA51LL /* 268 */, 0xFC4F0A2A0EA4371ELL /* 269 */,
|
|
||||||
0xE83E1DA85CB38429LL /* 270 */, 0xDC8FF882BA1B1CE2LL /* 271 */,
|
|
||||||
0xCD45505E8353E80DLL /* 272 */, 0x18D19A00D4DB0717LL /* 273 */,
|
|
||||||
0x34A0CFEDA5F38101LL /* 274 */, 0x0BE77E518887CAF2LL /* 275 */,
|
|
||||||
0x1E341438B3C45136LL /* 276 */, 0xE05797F49089CCF9LL /* 277 */,
|
|
||||||
0xFFD23F9DF2591D14LL /* 278 */, 0x543DDA228595C5CDLL /* 279 */,
|
|
||||||
0x661F81FD99052A33LL /* 280 */, 0x8736E641DB0F7B76LL /* 281 */,
|
|
||||||
0x15227725418E5307LL /* 282 */, 0xE25F7F46162EB2FALL /* 283 */,
|
|
||||||
0x48A8B2126C13D9FELL /* 284 */, 0xAFDC541792E76EEALL /* 285 */,
|
|
||||||
0x03D912BFC6D1898FLL /* 286 */, 0x31B1AAFA1B83F51BLL /* 287 */,
|
|
||||||
0xF1AC2796E42AB7D9LL /* 288 */, 0x40A3A7D7FCD2EBACLL /* 289 */,
|
|
||||||
0x1056136D0AFBBCC5LL /* 290 */, 0x7889E1DD9A6D0C85LL /* 291 */,
|
|
||||||
0xD33525782A7974AALL /* 292 */, 0xA7E25D09078AC09BLL /* 293 */,
|
|
||||||
0xBD4138B3EAC6EDD0LL /* 294 */, 0x920ABFBE71EB9E70LL /* 295 */,
|
|
||||||
0xA2A5D0F54FC2625CLL /* 296 */, 0xC054E36B0B1290A3LL /* 297 */,
|
|
||||||
0xF6DD59FF62FE932BLL /* 298 */, 0x3537354511A8AC7DLL /* 299 */,
|
|
||||||
0xCA845E9172FADCD4LL /* 300 */, 0x84F82B60329D20DCLL /* 301 */,
|
|
||||||
0x79C62CE1CD672F18LL /* 302 */, 0x8B09A2ADD124642CLL /* 303 */,
|
|
||||||
0xD0C1E96A19D9E726LL /* 304 */, 0x5A786A9B4BA9500CLL /* 305 */,
|
|
||||||
0x0E020336634C43F3LL /* 306 */, 0xC17B474AEB66D822LL /* 307 */,
|
|
||||||
0x6A731AE3EC9BAAC2LL /* 308 */, 0x8226667AE0840258LL /* 309 */,
|
|
||||||
0x67D4567691CAECA5LL /* 310 */, 0x1D94155C4875ADB5LL /* 311 */,
|
|
||||||
0x6D00FD985B813FDFLL /* 312 */, 0x51286EFCB774CD06LL /* 313 */,
|
|
||||||
0x5E8834471FA744AFLL /* 314 */, 0xF72CA0AEE761AE2ELL /* 315 */,
|
|
||||||
0xBE40E4CDAEE8E09ALL /* 316 */, 0xE9970BBB5118F665LL /* 317 */,
|
|
||||||
0x726E4BEB33DF1964LL /* 318 */, 0x703B000729199762LL /* 319 */,
|
|
||||||
0x4631D816F5EF30A7LL /* 320 */, 0xB880B5B51504A6BELL /* 321 */,
|
|
||||||
0x641793C37ED84B6CLL /* 322 */, 0x7B21ED77F6E97D96LL /* 323 */,
|
|
||||||
0x776306312EF96B73LL /* 324 */, 0xAE528948E86FF3F4LL /* 325 */,
|
|
||||||
0x53DBD7F286A3F8F8LL /* 326 */, 0x16CADCE74CFC1063LL /* 327 */,
|
|
||||||
0x005C19BDFA52C6DDLL /* 328 */, 0x68868F5D64D46AD3LL /* 329 */,
|
|
||||||
0x3A9D512CCF1E186ALL /* 330 */, 0x367E62C2385660AELL /* 331 */,
|
|
||||||
0xE359E7EA77DCB1D7LL /* 332 */, 0x526C0773749ABE6ELL /* 333 */,
|
|
||||||
0x735AE5F9D09F734BLL /* 334 */, 0x493FC7CC8A558BA8LL /* 335 */,
|
|
||||||
0xB0B9C1533041AB45LL /* 336 */, 0x321958BA470A59BDLL /* 337 */,
|
|
||||||
0x852DB00B5F46C393LL /* 338 */, 0x91209B2BD336B0E5LL /* 339 */,
|
|
||||||
0x6E604F7D659EF19FLL /* 340 */, 0xB99A8AE2782CCB24LL /* 341 */,
|
|
||||||
0xCCF52AB6C814C4C7LL /* 342 */, 0x4727D9AFBE11727BLL /* 343 */,
|
|
||||||
0x7E950D0C0121B34DLL /* 344 */, 0x756F435670AD471FLL /* 345 */,
|
|
||||||
0xF5ADD442615A6849LL /* 346 */, 0x4E87E09980B9957ALL /* 347 */,
|
|
||||||
0x2ACFA1DF50AEE355LL /* 348 */, 0xD898263AFD2FD556LL /* 349 */,
|
|
||||||
0xC8F4924DD80C8FD6LL /* 350 */, 0xCF99CA3D754A173ALL /* 351 */,
|
|
||||||
0xFE477BACAF91BF3CLL /* 352 */, 0xED5371F6D690C12DLL /* 353 */,
|
|
||||||
0x831A5C285E687094LL /* 354 */, 0xC5D3C90A3708A0A4LL /* 355 */,
|
|
||||||
0x0F7F903717D06580LL /* 356 */, 0x19F9BB13B8FDF27FLL /* 357 */,
|
|
||||||
0xB1BD6F1B4D502843LL /* 358 */, 0x1C761BA38FFF4012LL /* 359 */,
|
|
||||||
0x0D1530C4E2E21F3BLL /* 360 */, 0x8943CE69A7372C8ALL /* 361 */,
|
|
||||||
0xE5184E11FEB5CE66LL /* 362 */, 0x618BDB80BD736621LL /* 363 */,
|
|
||||||
0x7D29BAD68B574D0BLL /* 364 */, 0x81BB613E25E6FE5BLL /* 365 */,
|
|
||||||
0x071C9C10BC07913FLL /* 366 */, 0xC7BEEB7909AC2D97LL /* 367 */,
|
|
||||||
0xC3E58D353BC5D757LL /* 368 */, 0xEB017892F38F61E8LL /* 369 */,
|
|
||||||
0xD4EFFB9C9B1CC21ALL /* 370 */, 0x99727D26F494F7ABLL /* 371 */,
|
|
||||||
0xA3E063A2956B3E03LL /* 372 */, 0x9D4A8B9A4AA09C30LL /* 373 */,
|
|
||||||
0x3F6AB7D500090FB4LL /* 374 */, 0x9CC0F2A057268AC0LL /* 375 */,
|
|
||||||
0x3DEE9D2DEDBF42D1LL /* 376 */, 0x330F49C87960A972LL /* 377 */,
|
|
||||||
0xC6B2720287421B41LL /* 378 */, 0x0AC59EC07C00369CLL /* 379 */,
|
|
||||||
0xEF4EAC49CB353425LL /* 380 */, 0xF450244EEF0129D8LL /* 381 */,
|
|
||||||
0x8ACC46E5CAF4DEB6LL /* 382 */, 0x2FFEAB63989263F7LL /* 383 */,
|
|
||||||
0x8F7CB9FE5D7A4578LL /* 384 */, 0x5BD8F7644E634635LL /* 385 */,
|
|
||||||
0x427A7315BF2DC900LL /* 386 */, 0x17D0C4AA2125261CLL /* 387 */,
|
|
||||||
0x3992486C93518E50LL /* 388 */, 0xB4CBFEE0A2D7D4C3LL /* 389 */,
|
|
||||||
0x7C75D6202C5DDD8DLL /* 390 */, 0xDBC295D8E35B6C61LL /* 391 */,
|
|
||||||
0x60B369D302032B19LL /* 392 */, 0xCE42685FDCE44132LL /* 393 */,
|
|
||||||
0x06F3DDB9DDF65610LL /* 394 */, 0x8EA4D21DB5E148F0LL /* 395 */,
|
|
||||||
0x20B0FCE62FCD496FLL /* 396 */, 0x2C1B912358B0EE31LL /* 397 */,
|
|
||||||
0xB28317B818F5A308LL /* 398 */, 0xA89C1E189CA6D2CFLL /* 399 */,
|
|
||||||
0x0C6B18576AAADBC8LL /* 400 */, 0xB65DEAA91299FAE3LL /* 401 */,
|
|
||||||
0xFB2B794B7F1027E7LL /* 402 */, 0x04E4317F443B5BEBLL /* 403 */,
|
|
||||||
0x4B852D325939D0A6LL /* 404 */, 0xD5AE6BEEFB207FFCLL /* 405 */,
|
|
||||||
0x309682B281C7D374LL /* 406 */, 0xBAE309A194C3B475LL /* 407 */,
|
|
||||||
0x8CC3F97B13B49F05LL /* 408 */, 0x98A9422FF8293967LL /* 409 */,
|
|
||||||
0x244B16B01076FF7CLL /* 410 */, 0xF8BF571C663D67EELL /* 411 */,
|
|
||||||
0x1F0D6758EEE30DA1LL /* 412 */, 0xC9B611D97ADEB9B7LL /* 413 */,
|
|
||||||
0xB7AFD5887B6C57A2LL /* 414 */, 0x6290AE846B984FE1LL /* 415 */,
|
|
||||||
0x94DF4CDEACC1A5FDLL /* 416 */, 0x058A5BD1C5483AFFLL /* 417 */,
|
|
||||||
0x63166CC142BA3C37LL /* 418 */, 0x8DB8526EB2F76F40LL /* 419 */,
|
|
||||||
0xE10880036F0D6D4ELL /* 420 */, 0x9E0523C9971D311DLL /* 421 */,
|
|
||||||
0x45EC2824CC7CD691LL /* 422 */, 0x575B8359E62382C9LL /* 423 */,
|
|
||||||
0xFA9E400DC4889995LL /* 424 */, 0xD1823ECB45721568LL /* 425 */,
|
|
||||||
0xDAFD983B8206082FLL /* 426 */, 0xAA7D29082386A8CBLL /* 427 */,
|
|
||||||
0x269FCD4403B87588LL /* 428 */, 0x1B91F5F728BDD1E0LL /* 429 */,
|
|
||||||
0xE4669F39040201F6LL /* 430 */, 0x7A1D7C218CF04ADELL /* 431 */,
|
|
||||||
0x65623C29D79CE5CELL /* 432 */, 0x2368449096C00BB1LL /* 433 */,
|
|
||||||
0xAB9BF1879DA503BALL /* 434 */, 0xBC23ECB1A458058ELL /* 435 */,
|
|
||||||
0x9A58DF01BB401ECCLL /* 436 */, 0xA070E868A85F143DLL /* 437 */,
|
|
||||||
0x4FF188307DF2239ELL /* 438 */, 0x14D565B41A641183LL /* 439 */,
|
|
||||||
0xEE13337452701602LL /* 440 */, 0x950E3DCF3F285E09LL /* 441 */,
|
|
||||||
0x59930254B9C80953LL /* 442 */, 0x3BF299408930DA6DLL /* 443 */,
|
|
||||||
0xA955943F53691387LL /* 444 */, 0xA15EDECAA9CB8784LL /* 445 */,
|
|
||||||
0x29142127352BE9A0LL /* 446 */, 0x76F0371FFF4E7AFBLL /* 447 */,
|
|
||||||
0x0239F450274F2228LL /* 448 */, 0xBB073AF01D5E868BLL /* 449 */,
|
|
||||||
0xBFC80571C10E96C1LL /* 450 */, 0xD267088568222E23LL /* 451 */,
|
|
||||||
0x9671A3D48E80B5B0LL /* 452 */, 0x55B5D38AE193BB81LL /* 453 */,
|
|
||||||
0x693AE2D0A18B04B8LL /* 454 */, 0x5C48B4ECADD5335FLL /* 455 */,
|
|
||||||
0xFD743B194916A1CALL /* 456 */, 0x2577018134BE98C4LL /* 457 */,
|
|
||||||
0xE77987E83C54A4ADLL /* 458 */, 0x28E11014DA33E1B9LL /* 459 */,
|
|
||||||
0x270CC59E226AA213LL /* 460 */, 0x71495F756D1A5F60LL /* 461 */,
|
|
||||||
0x9BE853FB60AFEF77LL /* 462 */, 0xADC786A7F7443DBFLL /* 463 */,
|
|
||||||
0x0904456173B29A82LL /* 464 */, 0x58BC7A66C232BD5ELL /* 465 */,
|
|
||||||
0xF306558C673AC8B2LL /* 466 */, 0x41F639C6B6C9772ALL /* 467 */,
|
|
||||||
0x216DEFE99FDA35DALL /* 468 */, 0x11640CC71C7BE615LL /* 469 */,
|
|
||||||
0x93C43694565C5527LL /* 470 */, 0xEA038E6246777839LL /* 471 */,
|
|
||||||
0xF9ABF3CE5A3E2469LL /* 472 */, 0x741E768D0FD312D2LL /* 473 */,
|
|
||||||
0x0144B883CED652C6LL /* 474 */, 0xC20B5A5BA33F8552LL /* 475 */,
|
|
||||||
0x1AE69633C3435A9DLL /* 476 */, 0x97A28CA4088CFDECLL /* 477 */,
|
|
||||||
0x8824A43C1E96F420LL /* 478 */, 0x37612FA66EEEA746LL /* 479 */,
|
|
||||||
0x6B4CB165F9CF0E5ALL /* 480 */, 0x43AA1C06A0ABFB4ALL /* 481 */,
|
|
||||||
0x7F4DC26FF162796BLL /* 482 */, 0x6CBACC8E54ED9B0FLL /* 483 */,
|
|
||||||
0xA6B7FFEFD2BB253ELL /* 484 */, 0x2E25BC95B0A29D4FLL /* 485 */,
|
|
||||||
0x86D6A58BDEF1388CLL /* 486 */, 0xDED74AC576B6F054LL /* 487 */,
|
|
||||||
0x8030BDBC2B45805DLL /* 488 */, 0x3C81AF70E94D9289LL /* 489 */,
|
|
||||||
0x3EFF6DDA9E3100DBLL /* 490 */, 0xB38DC39FDFCC8847LL /* 491 */,
|
|
||||||
0x123885528D17B87ELL /* 492 */, 0xF2DA0ED240B1B642LL /* 493 */,
|
|
||||||
0x44CEFADCD54BF9A9LL /* 494 */, 0x1312200E433C7EE6LL /* 495 */,
|
|
||||||
0x9FFCC84F3A78C748LL /* 496 */, 0xF0CD1F72248576BBLL /* 497 */,
|
|
||||||
0xEC6974053638CFE4LL /* 498 */, 0x2BA7B67C0CEC4E4CLL /* 499 */,
|
|
||||||
0xAC2F4DF3E5CE32EDLL /* 500 */, 0xCB33D14326EA4C11LL /* 501 */,
|
|
||||||
0xA4E9044CC77E58BCLL /* 502 */, 0x5F513293D934FCEFLL /* 503 */,
|
|
||||||
0x5DC9645506E55444LL /* 504 */, 0x50DE418F317DE40ALL /* 505 */,
|
|
||||||
0x388CB31A69DDE259LL /* 506 */, 0x2DB4A83455820A86LL /* 507 */,
|
|
||||||
0x9010A91E84711AE9LL /* 508 */, 0x4DF7F0B7B1498371LL /* 509 */,
|
|
||||||
0xD62A2EABC0977179LL /* 510 */, 0x22FAC097AA8D5C0ELL /* 511 */,
|
|
||||||
0xF49FCC2FF1DAF39BLL /* 512 */, 0x487FD5C66FF29281LL /* 513 */,
|
|
||||||
0xE8A30667FCDCA83FLL /* 514 */, 0x2C9B4BE3D2FCCE63LL /* 515 */,
|
|
||||||
0xDA3FF74B93FBBBC2LL /* 516 */, 0x2FA165D2FE70BA66LL /* 517 */,
|
|
||||||
0xA103E279970E93D4LL /* 518 */, 0xBECDEC77B0E45E71LL /* 519 */,
|
|
||||||
0xCFB41E723985E497LL /* 520 */, 0xB70AAA025EF75017LL /* 521 */,
|
|
||||||
0xD42309F03840B8E0LL /* 522 */, 0x8EFC1AD035898579LL /* 523 */,
|
|
||||||
0x96C6920BE2B2ABC5LL /* 524 */, 0x66AF4163375A9172LL /* 525 */,
|
|
||||||
0x2174ABDCCA7127FBLL /* 526 */, 0xB33CCEA64A72FF41LL /* 527 */,
|
|
||||||
0xF04A4933083066A5LL /* 528 */, 0x8D970ACDD7289AF5LL /* 529 */,
|
|
||||||
0x8F96E8E031C8C25ELL /* 530 */, 0xF3FEC02276875D47LL /* 531 */,
|
|
||||||
0xEC7BF310056190DDLL /* 532 */, 0xF5ADB0AEBB0F1491LL /* 533 */,
|
|
||||||
0x9B50F8850FD58892LL /* 534 */, 0x4975488358B74DE8LL /* 535 */,
|
|
||||||
0xA3354FF691531C61LL /* 536 */, 0x0702BBE481D2C6EELL /* 537 */,
|
|
||||||
0x89FB24057DEDED98LL /* 538 */, 0xAC3075138596E902LL /* 539 */,
|
|
||||||
0x1D2D3580172772EDLL /* 540 */, 0xEB738FC28E6BC30DLL /* 541 */,
|
|
||||||
0x5854EF8F63044326LL /* 542 */, 0x9E5C52325ADD3BBELL /* 543 */,
|
|
||||||
0x90AA53CF325C4623LL /* 544 */, 0xC1D24D51349DD067LL /* 545 */,
|
|
||||||
0x2051CFEEA69EA624LL /* 546 */, 0x13220F0A862E7E4FLL /* 547 */,
|
|
||||||
0xCE39399404E04864LL /* 548 */, 0xD9C42CA47086FCB7LL /* 549 */,
|
|
||||||
0x685AD2238A03E7CCLL /* 550 */, 0x066484B2AB2FF1DBLL /* 551 */,
|
|
||||||
0xFE9D5D70EFBF79ECLL /* 552 */, 0x5B13B9DD9C481854LL /* 553 */,
|
|
||||||
0x15F0D475ED1509ADLL /* 554 */, 0x0BEBCD060EC79851LL /* 555 */,
|
|
||||||
0xD58C6791183AB7F8LL /* 556 */, 0xD1187C5052F3EEE4LL /* 557 */,
|
|
||||||
0xC95D1192E54E82FFLL /* 558 */, 0x86EEA14CB9AC6CA2LL /* 559 */,
|
|
||||||
0x3485BEB153677D5DLL /* 560 */, 0xDD191D781F8C492ALL /* 561 */,
|
|
||||||
0xF60866BAA784EBF9LL /* 562 */, 0x518F643BA2D08C74LL /* 563 */,
|
|
||||||
0x8852E956E1087C22LL /* 564 */, 0xA768CB8DC410AE8DLL /* 565 */,
|
|
||||||
0x38047726BFEC8E1ALL /* 566 */, 0xA67738B4CD3B45AALL /* 567 */,
|
|
||||||
0xAD16691CEC0DDE19LL /* 568 */, 0xC6D4319380462E07LL /* 569 */,
|
|
||||||
0xC5A5876D0BA61938LL /* 570 */, 0x16B9FA1FA58FD840LL /* 571 */,
|
|
||||||
0x188AB1173CA74F18LL /* 572 */, 0xABDA2F98C99C021FLL /* 573 */,
|
|
||||||
0x3E0580AB134AE816LL /* 574 */, 0x5F3B05B773645ABBLL /* 575 */,
|
|
||||||
0x2501A2BE5575F2F6LL /* 576 */, 0x1B2F74004E7E8BA9LL /* 577 */,
|
|
||||||
0x1CD7580371E8D953LL /* 578 */, 0x7F6ED89562764E30LL /* 579 */,
|
|
||||||
0xB15926FF596F003DLL /* 580 */, 0x9F65293DA8C5D6B9LL /* 581 */,
|
|
||||||
0x6ECEF04DD690F84CLL /* 582 */, 0x4782275FFF33AF88LL /* 583 */,
|
|
||||||
0xE41433083F820801LL /* 584 */, 0xFD0DFE409A1AF9B5LL /* 585 */,
|
|
||||||
0x4325A3342CDB396BLL /* 586 */, 0x8AE77E62B301B252LL /* 587 */,
|
|
||||||
0xC36F9E9F6655615ALL /* 588 */, 0x85455A2D92D32C09LL /* 589 */,
|
|
||||||
0xF2C7DEA949477485LL /* 590 */, 0x63CFB4C133A39EBALL /* 591 */,
|
|
||||||
0x83B040CC6EBC5462LL /* 592 */, 0x3B9454C8FDB326B0LL /* 593 */,
|
|
||||||
0x56F56A9E87FFD78CLL /* 594 */, 0x2DC2940D99F42BC6LL /* 595 */,
|
|
||||||
0x98F7DF096B096E2DLL /* 596 */, 0x19A6E01E3AD852BFLL /* 597 */,
|
|
||||||
0x42A99CCBDBD4B40BLL /* 598 */, 0xA59998AF45E9C559LL /* 599 */,
|
|
||||||
0x366295E807D93186LL /* 600 */, 0x6B48181BFAA1F773LL /* 601 */,
|
|
||||||
0x1FEC57E2157A0A1DLL /* 602 */, 0x4667446AF6201AD5LL /* 603 */,
|
|
||||||
0xE615EBCACFB0F075LL /* 604 */, 0xB8F31F4F68290778LL /* 605 */,
|
|
||||||
0x22713ED6CE22D11ELL /* 606 */, 0x3057C1A72EC3C93BLL /* 607 */,
|
|
||||||
0xCB46ACC37C3F1F2FLL /* 608 */, 0xDBB893FD02AAF50ELL /* 609 */,
|
|
||||||
0x331FD92E600B9FCFLL /* 610 */, 0xA498F96148EA3AD6LL /* 611 */,
|
|
||||||
0xA8D8426E8B6A83EALL /* 612 */, 0xA089B274B7735CDCLL /* 613 */,
|
|
||||||
0x87F6B3731E524A11LL /* 614 */, 0x118808E5CBC96749LL /* 615 */,
|
|
||||||
0x9906E4C7B19BD394LL /* 616 */, 0xAFED7F7E9B24A20CLL /* 617 */,
|
|
||||||
0x6509EADEEB3644A7LL /* 618 */, 0x6C1EF1D3E8EF0EDELL /* 619 */,
|
|
||||||
0xB9C97D43E9798FB4LL /* 620 */, 0xA2F2D784740C28A3LL /* 621 */,
|
|
||||||
0x7B8496476197566FLL /* 622 */, 0x7A5BE3E6B65F069DLL /* 623 */,
|
|
||||||
0xF96330ED78BE6F10LL /* 624 */, 0xEEE60DE77A076A15LL /* 625 */,
|
|
||||||
0x2B4BEE4AA08B9BD0LL /* 626 */, 0x6A56A63EC7B8894ELL /* 627 */,
|
|
||||||
0x02121359BA34FEF4LL /* 628 */, 0x4CBF99F8283703FCLL /* 629 */,
|
|
||||||
0x398071350CAF30C8LL /* 630 */, 0xD0A77A89F017687ALL /* 631 */,
|
|
||||||
0xF1C1A9EB9E423569LL /* 632 */, 0x8C7976282DEE8199LL /* 633 */,
|
|
||||||
0x5D1737A5DD1F7ABDLL /* 634 */, 0x4F53433C09A9FA80LL /* 635 */,
|
|
||||||
0xFA8B0C53DF7CA1D9LL /* 636 */, 0x3FD9DCBC886CCB77LL /* 637 */,
|
|
||||||
0xC040917CA91B4720LL /* 638 */, 0x7DD00142F9D1DCDFLL /* 639 */,
|
|
||||||
0x8476FC1D4F387B58LL /* 640 */, 0x23F8E7C5F3316503LL /* 641 */,
|
|
||||||
0x032A2244E7E37339LL /* 642 */, 0x5C87A5D750F5A74BLL /* 643 */,
|
|
||||||
0x082B4CC43698992ELL /* 644 */, 0xDF917BECB858F63CLL /* 645 */,
|
|
||||||
0x3270B8FC5BF86DDALL /* 646 */, 0x10AE72BB29B5DD76LL /* 647 */,
|
|
||||||
0x576AC94E7700362BLL /* 648 */, 0x1AD112DAC61EFB8FLL /* 649 */,
|
|
||||||
0x691BC30EC5FAA427LL /* 650 */, 0xFF246311CC327143LL /* 651 */,
|
|
||||||
0x3142368E30E53206LL /* 652 */, 0x71380E31E02CA396LL /* 653 */,
|
|
||||||
0x958D5C960AAD76F1LL /* 654 */, 0xF8D6F430C16DA536LL /* 655 */,
|
|
||||||
0xC8FFD13F1BE7E1D2LL /* 656 */, 0x7578AE66004DDBE1LL /* 657 */,
|
|
||||||
0x05833F01067BE646LL /* 658 */, 0xBB34B5AD3BFE586DLL /* 659 */,
|
|
||||||
0x095F34C9A12B97F0LL /* 660 */, 0x247AB64525D60CA8LL /* 661 */,
|
|
||||||
0xDCDBC6F3017477D1LL /* 662 */, 0x4A2E14D4DECAD24DLL /* 663 */,
|
|
||||||
0xBDB5E6D9BE0A1EEBLL /* 664 */, 0x2A7E70F7794301ABLL /* 665 */,
|
|
||||||
0xDEF42D8A270540FDLL /* 666 */, 0x01078EC0A34C22C1LL /* 667 */,
|
|
||||||
0xE5DE511AF4C16387LL /* 668 */, 0x7EBB3A52BD9A330ALL /* 669 */,
|
|
||||||
0x77697857AA7D6435LL /* 670 */, 0x004E831603AE4C32LL /* 671 */,
|
|
||||||
0xE7A21020AD78E312LL /* 672 */, 0x9D41A70C6AB420F2LL /* 673 */,
|
|
||||||
0x28E06C18EA1141E6LL /* 674 */, 0xD2B28CBD984F6B28LL /* 675 */,
|
|
||||||
0x26B75F6C446E9D83LL /* 676 */, 0xBA47568C4D418D7FLL /* 677 */,
|
|
||||||
0xD80BADBFE6183D8ELL /* 678 */, 0x0E206D7F5F166044LL /* 679 */,
|
|
||||||
0xE258A43911CBCA3ELL /* 680 */, 0x723A1746B21DC0BCLL /* 681 */,
|
|
||||||
0xC7CAA854F5D7CDD3LL /* 682 */, 0x7CAC32883D261D9CLL /* 683 */,
|
|
||||||
0x7690C26423BA942CLL /* 684 */, 0x17E55524478042B8LL /* 685 */,
|
|
||||||
0xE0BE477656A2389FLL /* 686 */, 0x4D289B5E67AB2DA0LL /* 687 */,
|
|
||||||
0x44862B9C8FBBFD31LL /* 688 */, 0xB47CC8049D141365LL /* 689 */,
|
|
||||||
0x822C1B362B91C793LL /* 690 */, 0x4EB14655FB13DFD8LL /* 691 */,
|
|
||||||
0x1ECBBA0714E2A97BLL /* 692 */, 0x6143459D5CDE5F14LL /* 693 */,
|
|
||||||
0x53A8FBF1D5F0AC89LL /* 694 */, 0x97EA04D81C5E5B00LL /* 695 */,
|
|
||||||
0x622181A8D4FDB3F3LL /* 696 */, 0xE9BCD341572A1208LL /* 697 */,
|
|
||||||
0x1411258643CCE58ALL /* 698 */, 0x9144C5FEA4C6E0A4LL /* 699 */,
|
|
||||||
0x0D33D06565CF620FLL /* 700 */, 0x54A48D489F219CA1LL /* 701 */,
|
|
||||||
0xC43E5EAC6D63C821LL /* 702 */, 0xA9728B3A72770DAFLL /* 703 */,
|
|
||||||
0xD7934E7B20DF87EFLL /* 704 */, 0xE35503B61A3E86E5LL /* 705 */,
|
|
||||||
0xCAE321FBC819D504LL /* 706 */, 0x129A50B3AC60BFA6LL /* 707 */,
|
|
||||||
0xCD5E68EA7E9FB6C3LL /* 708 */, 0xB01C90199483B1C7LL /* 709 */,
|
|
||||||
0x3DE93CD5C295376CLL /* 710 */, 0xAED52EDF2AB9AD13LL /* 711 */,
|
|
||||||
0x2E60F512C0A07884LL /* 712 */, 0xBC3D86A3E36210C9LL /* 713 */,
|
|
||||||
0x35269D9B163951CELL /* 714 */, 0x0C7D6E2AD0CDB5FALL /* 715 */,
|
|
||||||
0x59E86297D87F5733LL /* 716 */, 0x298EF221898DB0E7LL /* 717 */,
|
|
||||||
0x55000029D1A5AA7ELL /* 718 */, 0x8BC08AE1B5061B45LL /* 719 */,
|
|
||||||
0xC2C31C2B6C92703ALL /* 720 */, 0x94CC596BAF25EF42LL /* 721 */,
|
|
||||||
0x0A1D73DB22540456LL /* 722 */, 0x04B6A0F9D9C4179ALL /* 723 */,
|
|
||||||
0xEFFDAFA2AE3D3C60LL /* 724 */, 0xF7C8075BB49496C4LL /* 725 */,
|
|
||||||
0x9CC5C7141D1CD4E3LL /* 726 */, 0x78BD1638218E5534LL /* 727 */,
|
|
||||||
0xB2F11568F850246ALL /* 728 */, 0xEDFABCFA9502BC29LL /* 729 */,
|
|
||||||
0x796CE5F2DA23051BLL /* 730 */, 0xAAE128B0DC93537CLL /* 731 */,
|
|
||||||
0x3A493DA0EE4B29AELL /* 732 */, 0xB5DF6B2C416895D7LL /* 733 */,
|
|
||||||
0xFCABBD25122D7F37LL /* 734 */, 0x70810B58105DC4B1LL /* 735 */,
|
|
||||||
0xE10FDD37F7882A90LL /* 736 */, 0x524DCAB5518A3F5CLL /* 737 */,
|
|
||||||
0x3C9E85878451255BLL /* 738 */, 0x4029828119BD34E2LL /* 739 */,
|
|
||||||
0x74A05B6F5D3CECCBLL /* 740 */, 0xB610021542E13ECALL /* 741 */,
|
|
||||||
0x0FF979D12F59E2ACLL /* 742 */, 0x6037DA27E4F9CC50LL /* 743 */,
|
|
||||||
0x5E92975A0DF1847DLL /* 744 */, 0xD66DE190D3E623FELL /* 745 */,
|
|
||||||
0x5032D6B87B568048LL /* 746 */, 0x9A36B7CE8235216ELL /* 747 */,
|
|
||||||
0x80272A7A24F64B4ALL /* 748 */, 0x93EFED8B8C6916F7LL /* 749 */,
|
|
||||||
0x37DDBFF44CCE1555LL /* 750 */, 0x4B95DB5D4B99BD25LL /* 751 */,
|
|
||||||
0x92D3FDA169812FC0LL /* 752 */, 0xFB1A4A9A90660BB6LL /* 753 */,
|
|
||||||
0x730C196946A4B9B2LL /* 754 */, 0x81E289AA7F49DA68LL /* 755 */,
|
|
||||||
0x64669A0F83B1A05FLL /* 756 */, 0x27B3FF7D9644F48BLL /* 757 */,
|
|
||||||
0xCC6B615C8DB675B3LL /* 758 */, 0x674F20B9BCEBBE95LL /* 759 */,
|
|
||||||
0x6F31238275655982LL /* 760 */, 0x5AE488713E45CF05LL /* 761 */,
|
|
||||||
0xBF619F9954C21157LL /* 762 */, 0xEABAC46040A8EAE9LL /* 763 */,
|
|
||||||
0x454C6FE9F2C0C1CDLL /* 764 */, 0x419CF6496412691CLL /* 765 */,
|
|
||||||
0xD3DC3BEF265B0F70LL /* 766 */, 0x6D0E60F5C3578A9ELL /* 767 */,
|
|
||||||
0x5B0E608526323C55LL /* 768 */, 0x1A46C1A9FA1B59F5LL /* 769 */,
|
|
||||||
0xA9E245A17C4C8FFALL /* 770 */, 0x65CA5159DB2955D7LL /* 771 */,
|
|
||||||
0x05DB0A76CE35AFC2LL /* 772 */, 0x81EAC77EA9113D45LL /* 773 */,
|
|
||||||
0x528EF88AB6AC0A0DLL /* 774 */, 0xA09EA253597BE3FFLL /* 775 */,
|
|
||||||
0x430DDFB3AC48CD56LL /* 776 */, 0xC4B3A67AF45CE46FLL /* 777 */,
|
|
||||||
0x4ECECFD8FBE2D05ELL /* 778 */, 0x3EF56F10B39935F0LL /* 779 */,
|
|
||||||
0x0B22D6829CD619C6LL /* 780 */, 0x17FD460A74DF2069LL /* 781 */,
|
|
||||||
0x6CF8CC8E8510ED40LL /* 782 */, 0xD6C824BF3A6ECAA7LL /* 783 */,
|
|
||||||
0x61243D581A817049LL /* 784 */, 0x048BACB6BBC163A2LL /* 785 */,
|
|
||||||
0xD9A38AC27D44CC32LL /* 786 */, 0x7FDDFF5BAAF410ABLL /* 787 */,
|
|
||||||
0xAD6D495AA804824BLL /* 788 */, 0xE1A6A74F2D8C9F94LL /* 789 */,
|
|
||||||
0xD4F7851235DEE8E3LL /* 790 */, 0xFD4B7F886540D893LL /* 791 */,
|
|
||||||
0x247C20042AA4BFDALL /* 792 */, 0x096EA1C517D1327CLL /* 793 */,
|
|
||||||
0xD56966B4361A6685LL /* 794 */, 0x277DA5C31221057DLL /* 795 */,
|
|
||||||
0x94D59893A43ACFF7LL /* 796 */, 0x64F0C51CCDC02281LL /* 797 */,
|
|
||||||
0x3D33BCC4FF6189DBLL /* 798 */, 0xE005CB184CE66AF1LL /* 799 */,
|
|
||||||
0xFF5CCD1D1DB99BEALL /* 800 */, 0xB0B854A7FE42980FLL /* 801 */,
|
|
||||||
0x7BD46A6A718D4B9FLL /* 802 */, 0xD10FA8CC22A5FD8CLL /* 803 */,
|
|
||||||
0xD31484952BE4BD31LL /* 804 */, 0xC7FA975FCB243847LL /* 805 */,
|
|
||||||
0x4886ED1E5846C407LL /* 806 */, 0x28CDDB791EB70B04LL /* 807 */,
|
|
||||||
0xC2B00BE2F573417FLL /* 808 */, 0x5C9590452180F877LL /* 809 */,
|
|
||||||
0x7A6BDDFFF370EB00LL /* 810 */, 0xCE509E38D6D9D6A4LL /* 811 */,
|
|
||||||
0xEBEB0F00647FA702LL /* 812 */, 0x1DCC06CF76606F06LL /* 813 */,
|
|
||||||
0xE4D9F28BA286FF0ALL /* 814 */, 0xD85A305DC918C262LL /* 815 */,
|
|
||||||
0x475B1D8732225F54LL /* 816 */, 0x2D4FB51668CCB5FELL /* 817 */,
|
|
||||||
0xA679B9D9D72BBA20LL /* 818 */, 0x53841C0D912D43A5LL /* 819 */,
|
|
||||||
0x3B7EAA48BF12A4E8LL /* 820 */, 0x781E0E47F22F1DDFLL /* 821 */,
|
|
||||||
0xEFF20CE60AB50973LL /* 822 */, 0x20D261D19DFFB742LL /* 823 */,
|
|
||||||
0x16A12B03062A2E39LL /* 824 */, 0x1960EB2239650495LL /* 825 */,
|
|
||||||
0x251C16FED50EB8B8LL /* 826 */, 0x9AC0C330F826016ELL /* 827 */,
|
|
||||||
0xED152665953E7671LL /* 828 */, 0x02D63194A6369570LL /* 829 */,
|
|
||||||
0x5074F08394B1C987LL /* 830 */, 0x70BA598C90B25CE1LL /* 831 */,
|
|
||||||
0x794A15810B9742F6LL /* 832 */, 0x0D5925E9FCAF8C6CLL /* 833 */,
|
|
||||||
0x3067716CD868744ELL /* 834 */, 0x910AB077E8D7731BLL /* 835 */,
|
|
||||||
0x6A61BBDB5AC42F61LL /* 836 */, 0x93513EFBF0851567LL /* 837 */,
|
|
||||||
0xF494724B9E83E9D5LL /* 838 */, 0xE887E1985C09648DLL /* 839 */,
|
|
||||||
0x34B1D3C675370CFDLL /* 840 */, 0xDC35E433BC0D255DLL /* 841 */,
|
|
||||||
0xD0AAB84234131BE0LL /* 842 */, 0x08042A50B48B7EAFLL /* 843 */,
|
|
||||||
0x9997C4EE44A3AB35LL /* 844 */, 0x829A7B49201799D0LL /* 845 */,
|
|
||||||
0x263B8307B7C54441LL /* 846 */, 0x752F95F4FD6A6CA6LL /* 847 */,
|
|
||||||
0x927217402C08C6E5LL /* 848 */, 0x2A8AB754A795D9EELL /* 849 */,
|
|
||||||
0xA442F7552F72943DLL /* 850 */, 0x2C31334E19781208LL /* 851 */,
|
|
||||||
0x4FA98D7CEAEE6291LL /* 852 */, 0x55C3862F665DB309LL /* 853 */,
|
|
||||||
0xBD0610175D53B1F3LL /* 854 */, 0x46FE6CB840413F27LL /* 855 */,
|
|
||||||
0x3FE03792DF0CFA59LL /* 856 */, 0xCFE700372EB85E8FLL /* 857 */,
|
|
||||||
0xA7BE29E7ADBCE118LL /* 858 */, 0xE544EE5CDE8431DDLL /* 859 */,
|
|
||||||
0x8A781B1B41F1873ELL /* 860 */, 0xA5C94C78A0D2F0E7LL /* 861 */,
|
|
||||||
0x39412E2877B60728LL /* 862 */, 0xA1265EF3AFC9A62CLL /* 863 */,
|
|
||||||
0xBCC2770C6A2506C5LL /* 864 */, 0x3AB66DD5DCE1CE12LL /* 865 */,
|
|
||||||
0xE65499D04A675B37LL /* 866 */, 0x7D8F523481BFD216LL /* 867 */,
|
|
||||||
0x0F6F64FCEC15F389LL /* 868 */, 0x74EFBE618B5B13C8LL /* 869 */,
|
|
||||||
0xACDC82B714273E1DLL /* 870 */, 0xDD40BFE003199D17LL /* 871 */,
|
|
||||||
0x37E99257E7E061F8LL /* 872 */, 0xFA52626904775AAALL /* 873 */,
|
|
||||||
0x8BBBF63A463D56F9LL /* 874 */, 0xF0013F1543A26E64LL /* 875 */,
|
|
||||||
0xA8307E9F879EC898LL /* 876 */, 0xCC4C27A4150177CCLL /* 877 */,
|
|
||||||
0x1B432F2CCA1D3348LL /* 878 */, 0xDE1D1F8F9F6FA013LL /* 879 */,
|
|
||||||
0x606602A047A7DDD6LL /* 880 */, 0xD237AB64CC1CB2C7LL /* 881 */,
|
|
||||||
0x9B938E7225FCD1D3LL /* 882 */, 0xEC4E03708E0FF476LL /* 883 */,
|
|
||||||
0xFEB2FBDA3D03C12DLL /* 884 */, 0xAE0BCED2EE43889ALL /* 885 */,
|
|
||||||
0x22CB8923EBFB4F43LL /* 886 */, 0x69360D013CF7396DLL /* 887 */,
|
|
||||||
0x855E3602D2D4E022LL /* 888 */, 0x073805BAD01F784CLL /* 889 */,
|
|
||||||
0x33E17A133852F546LL /* 890 */, 0xDF4874058AC7B638LL /* 891 */,
|
|
||||||
0xBA92B29C678AA14ALL /* 892 */, 0x0CE89FC76CFAADCDLL /* 893 */,
|
|
||||||
0x5F9D4E0908339E34LL /* 894 */, 0xF1AFE9291F5923B9LL /* 895 */,
|
|
||||||
0x6E3480F60F4A265FLL /* 896 */, 0xEEBF3A2AB29B841CLL /* 897 */,
|
|
||||||
0xE21938A88F91B4ADLL /* 898 */, 0x57DFEFF845C6D3C3LL /* 899 */,
|
|
||||||
0x2F006B0BF62CAAF2LL /* 900 */, 0x62F479EF6F75EE78LL /* 901 */,
|
|
||||||
0x11A55AD41C8916A9LL /* 902 */, 0xF229D29084FED453LL /* 903 */,
|
|
||||||
0x42F1C27B16B000E6LL /* 904 */, 0x2B1F76749823C074LL /* 905 */,
|
|
||||||
0x4B76ECA3C2745360LL /* 906 */, 0x8C98F463B91691BDLL /* 907 */,
|
|
||||||
0x14BCC93CF1ADE66ALL /* 908 */, 0x8885213E6D458397LL /* 909 */,
|
|
||||||
0x8E177DF0274D4711LL /* 910 */, 0xB49B73B5503F2951LL /* 911 */,
|
|
||||||
0x10168168C3F96B6BLL /* 912 */, 0x0E3D963B63CAB0AELL /* 913 */,
|
|
||||||
0x8DFC4B5655A1DB14LL /* 914 */, 0xF789F1356E14DE5CLL /* 915 */,
|
|
||||||
0x683E68AF4E51DAC1LL /* 916 */, 0xC9A84F9D8D4B0FD9LL /* 917 */,
|
|
||||||
0x3691E03F52A0F9D1LL /* 918 */, 0x5ED86E46E1878E80LL /* 919 */,
|
|
||||||
0x3C711A0E99D07150LL /* 920 */, 0x5A0865B20C4E9310LL /* 921 */,
|
|
||||||
0x56FBFC1FE4F0682ELL /* 922 */, 0xEA8D5DE3105EDF9BLL /* 923 */,
|
|
||||||
0x71ABFDB12379187ALL /* 924 */, 0x2EB99DE1BEE77B9CLL /* 925 */,
|
|
||||||
0x21ECC0EA33CF4523LL /* 926 */, 0x59A4D7521805C7A1LL /* 927 */,
|
|
||||||
0x3896F5EB56AE7C72LL /* 928 */, 0xAA638F3DB18F75DCLL /* 929 */,
|
|
||||||
0x9F39358DABE9808ELL /* 930 */, 0xB7DEFA91C00B72ACLL /* 931 */,
|
|
||||||
0x6B5541FD62492D92LL /* 932 */, 0x6DC6DEE8F92E4D5BLL /* 933 */,
|
|
||||||
0x353F57ABC4BEEA7ELL /* 934 */, 0x735769D6DA5690CELL /* 935 */,
|
|
||||||
0x0A234AA642391484LL /* 936 */, 0xF6F9508028F80D9DLL /* 937 */,
|
|
||||||
0xB8E319A27AB3F215LL /* 938 */, 0x31AD9C1151341A4DLL /* 939 */,
|
|
||||||
0x773C22A57BEF5805LL /* 940 */, 0x45C7561A07968633LL /* 941 */,
|
|
||||||
0xF913DA9E249DBE36LL /* 942 */, 0xDA652D9B78A64C68LL /* 943 */,
|
|
||||||
0x4C27A97F3BC334EFLL /* 944 */, 0x76621220E66B17F4LL /* 945 */,
|
|
||||||
0x967743899ACD7D0BLL /* 946 */, 0xF3EE5BCAE0ED6782LL /* 947 */,
|
|
||||||
0x409F753600C879FCLL /* 948 */, 0x06D09A39B5926DB6LL /* 949 */,
|
|
||||||
0x6F83AEB0317AC588LL /* 950 */, 0x01E6CA4A86381F21LL /* 951 */,
|
|
||||||
0x66FF3462D19F3025LL /* 952 */, 0x72207C24DDFD3BFBLL /* 953 */,
|
|
||||||
0x4AF6B6D3E2ECE2EBLL /* 954 */, 0x9C994DBEC7EA08DELL /* 955 */,
|
|
||||||
0x49ACE597B09A8BC4LL /* 956 */, 0xB38C4766CF0797BALL /* 957 */,
|
|
||||||
0x131B9373C57C2A75LL /* 958 */, 0xB1822CCE61931E58LL /* 959 */,
|
|
||||||
0x9D7555B909BA1C0CLL /* 960 */, 0x127FAFDD937D11D2LL /* 961 */,
|
|
||||||
0x29DA3BADC66D92E4LL /* 962 */, 0xA2C1D57154C2ECBCLL /* 963 */,
|
|
||||||
0x58C5134D82F6FE24LL /* 964 */, 0x1C3AE3515B62274FLL /* 965 */,
|
|
||||||
0xE907C82E01CB8126LL /* 966 */, 0xF8ED091913E37FCBLL /* 967 */,
|
|
||||||
0x3249D8F9C80046C9LL /* 968 */, 0x80CF9BEDE388FB63LL /* 969 */,
|
|
||||||
0x1881539A116CF19ELL /* 970 */, 0x5103F3F76BD52457LL /* 971 */,
|
|
||||||
0x15B7E6F5AE47F7A8LL /* 972 */, 0xDBD7C6DED47E9CCFLL /* 973 */,
|
|
||||||
0x44E55C410228BB1ALL /* 974 */, 0xB647D4255EDB4E99LL /* 975 */,
|
|
||||||
0x5D11882BB8AAFC30LL /* 976 */, 0xF5098BBB29D3212ALL /* 977 */,
|
|
||||||
0x8FB5EA14E90296B3LL /* 978 */, 0x677B942157DD025ALL /* 979 */,
|
|
||||||
0xFB58E7C0A390ACB5LL /* 980 */, 0x89D3674C83BD4A01LL /* 981 */,
|
|
||||||
0x9E2DA4DF4BF3B93BLL /* 982 */, 0xFCC41E328CAB4829LL /* 983 */,
|
|
||||||
0x03F38C96BA582C52LL /* 984 */, 0xCAD1BDBD7FD85DB2LL /* 985 */,
|
|
||||||
0xBBB442C16082AE83LL /* 986 */, 0xB95FE86BA5DA9AB0LL /* 987 */,
|
|
||||||
0xB22E04673771A93FLL /* 988 */, 0x845358C9493152D8LL /* 989 */,
|
|
||||||
0xBE2A488697B4541ELL /* 990 */, 0x95A2DC2DD38E6966LL /* 991 */,
|
|
||||||
0xC02C11AC923C852BLL /* 992 */, 0x2388B1990DF2A87BLL /* 993 */,
|
|
||||||
0x7C8008FA1B4F37BELL /* 994 */, 0x1F70D0C84D54E503LL /* 995 */,
|
|
||||||
0x5490ADEC7ECE57D4LL /* 996 */, 0x002B3C27D9063A3ALL /* 997 */,
|
|
||||||
0x7EAEA3848030A2BFLL /* 998 */, 0xC602326DED2003C0LL /* 999 */,
|
|
||||||
0x83A7287D69A94086LL /* 1000 */, 0xC57A5FCB30F57A8ALL /* 1001 */,
|
|
||||||
0xB56844E479EBE779LL /* 1002 */, 0xA373B40F05DCBCE9LL /* 1003 */,
|
|
||||||
0xD71A786E88570EE2LL /* 1004 */, 0x879CBACDBDE8F6A0LL /* 1005 */,
|
|
||||||
0x976AD1BCC164A32FLL /* 1006 */, 0xAB21E25E9666D78BLL /* 1007 */,
|
|
||||||
0x901063AAE5E5C33CLL /* 1008 */, 0x9818B34448698D90LL /* 1009 */,
|
|
||||||
0xE36487AE3E1E8ABBLL /* 1010 */, 0xAFBDF931893BDCB4LL /* 1011 */,
|
|
||||||
0x6345A0DC5FBBD519LL /* 1012 */, 0x8628FE269B9465CALL /* 1013 */,
|
|
||||||
0x1E5D01603F9C51ECLL /* 1014 */, 0x4DE44006A15049B7LL /* 1015 */,
|
|
||||||
0xBF6C70E5F776CBB1LL /* 1016 */, 0x411218F2EF552BEDLL /* 1017 */,
|
|
||||||
0xCB0C0708705A36A3LL /* 1018 */, 0xE74D14754F986044LL /* 1019 */,
|
|
||||||
0xCD56D9430EA8280ELL /* 1020 */, 0xC12591D7535F5065LL /* 1021 */,
|
|
||||||
0xC83223F1720AEF96LL /* 1022 */, 0xC3A0396F7363A51FLL /* 1023 */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The following macro denotes that an optimization */
|
|
||||||
/* for Alpha is required. It is used only for */
|
|
||||||
/* optimization of time. Otherwise it does nothing. */
|
|
||||||
#ifdef _LP64
|
|
||||||
#define OPTIMIZE_FOR_LP64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NOTE that this code is NOT FULLY OPTIMIZED for any */
|
|
||||||
/* machine. Assembly code might be much faster on some */
|
|
||||||
/* machines, especially if the code is compiled with */
|
|
||||||
/* gcc. */
|
|
||||||
|
|
||||||
/* The number of passes of the hash function. */
|
|
||||||
/* Three passes are recommended. */
|
|
||||||
/* Use four passes when you need extra security. */
|
|
||||||
/* Must be at least three. */
|
|
||||||
#define PASSES 3
|
|
||||||
|
|
||||||
#define T1 (table)
|
|
||||||
#define T2 (table+256)
|
|
||||||
#define T3 (table+(256*2))
|
|
||||||
#define T4 (table+(256*3))
|
|
||||||
|
|
||||||
#define SAVE_ABC do { \
|
|
||||||
aa = a; \
|
|
||||||
bb = b; \
|
|
||||||
cc = c; \
|
|
||||||
} while (/*CONSTCOND*/0)
|
|
||||||
|
|
||||||
#ifdef OPTIMIZE_FOR_LP64
|
|
||||||
/* This is the official definition of round */
|
|
||||||
#define ROUND(a,b,c,x,mul) do { \
|
|
||||||
c ^= x; \
|
|
||||||
a -= T1[((c)>>(0*8))&0xFF] ^ T2[((c)>>(2*8))&0xFF] ^ \
|
|
||||||
T3[((c)>>(4*8))&0xFF] ^ T4[((c)>>(6*8))&0xFF] ; \
|
|
||||||
b += T4[((c)>>(1*8))&0xFF] ^ T3[((c)>>(3*8))&0xFF] ^ \
|
|
||||||
T2[((c)>>(5*8))&0xFF] ^ T1[((c)>>(7*8))&0xFF] ; \
|
|
||||||
b *= mul; \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
#else
|
|
||||||
/* This code works faster when compiled on 32-bit machines */
|
|
||||||
/* (but works slower on Alpha) */
|
|
||||||
#define ROUND(a,b,c,x,mul) do { \
|
|
||||||
c ^= x; \
|
|
||||||
a -= T1[(uint8_t)(c)] ^ \
|
|
||||||
T2[(const uint8_t)(((uint32_t)(c))>>(2*8))] ^ \
|
|
||||||
T3[(const uint8_t)((c)>>(4*8))] ^ \
|
|
||||||
T4[(const uint8_t)(((uint32_t)((c)>>(4*8)))>>(2*8))] ; \
|
|
||||||
b += T4[(uint8_t)(((uint32_t)(c))>>(1*8))] ^ \
|
|
||||||
T3[(const uint8_t)(((uint32_t)(c))>>(3*8))] ^ \
|
|
||||||
T2[(const uint8_t)(((uint32_t)((c)>>(4*8)))>>(1*8))] ^ \
|
|
||||||
T1[(const uint8_t)(((uint32_t)((c)>>(4*8)))>>(3*8))]; \
|
|
||||||
b *= mul; \
|
|
||||||
} while (/*CONSTCOND*/0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PASS(a,b,c,mul) do { \
|
|
||||||
ROUND(a,b,c,x0,mul); \
|
|
||||||
ROUND(b,c,a,x1,mul); \
|
|
||||||
ROUND(c,a,b,x2,mul); \
|
|
||||||
ROUND(a,b,c,x3,mul); \
|
|
||||||
ROUND(b,c,a,x4,mul); \
|
|
||||||
ROUND(c,a,b,x5,mul); \
|
|
||||||
ROUND(a,b,c,x6,mul); \
|
|
||||||
ROUND(b,c,a,x7,mul); \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
|
|
||||||
#define KEY_SCHEDULE do { \
|
|
||||||
x0 -= x7 ^ (uint64_t)0xA5A5A5A5A5A5A5A5LL; \
|
|
||||||
x1 ^= x0; \
|
|
||||||
x2 += x1; \
|
|
||||||
x3 -= x2 ^ ((~x1)<<19); \
|
|
||||||
x4 ^= x3; \
|
|
||||||
x5 += x4; \
|
|
||||||
x6 -= x5 ^ ((~x4)>>23); \
|
|
||||||
x7 ^= x6; \
|
|
||||||
x0 += x7; \
|
|
||||||
x1 -= x0 ^ ((~x7)<<19); \
|
|
||||||
x2 ^= x1; \
|
|
||||||
x3 += x2; \
|
|
||||||
x4 -= x3 ^ ((~x2)>>23); \
|
|
||||||
x5 ^= x4; \
|
|
||||||
x6 += x5; \
|
|
||||||
x7 -= x6 ^ (uint64_t)0x0123456789ABCDEFLL; \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
|
|
||||||
#define FEEDFORWARD do { \
|
|
||||||
a ^= aa; \
|
|
||||||
b -= bb; \
|
|
||||||
c += cc; \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
|
|
||||||
#ifdef OPTIMIZE_FOR_LP64
|
|
||||||
/* The loop is unrolled: works better on Alpha */
|
|
||||||
#define COMPRESS do { \
|
|
||||||
SAVE_ABC; \
|
|
||||||
PASS(a,b,c,5); \
|
|
||||||
KEY_SCHEDULE; \
|
|
||||||
PASS(c,a,b,7); \
|
|
||||||
KEY_SCHEDULE; \
|
|
||||||
PASS(b,c,a,9); \
|
|
||||||
for (pass_no = 3; pass_no < PASSES; pass_no++) { \
|
|
||||||
KEY_SCHEDULE; \
|
|
||||||
PASS(a,b,c,9); \
|
|
||||||
tmpa = a; a = c; c = b; b = tmpa; \
|
|
||||||
} \
|
|
||||||
FEEDFORWARD; \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
#else
|
|
||||||
/* loop: works better on PC and Sun (smaller cache?) */
|
|
||||||
#define COMPRESS do { \
|
|
||||||
SAVE_ABC; \
|
|
||||||
for (pass_no = 0; pass_no < PASSES; pass_no++) { \
|
|
||||||
if (pass_no != 0) { \
|
|
||||||
KEY_SCHEDULE; \
|
|
||||||
} \
|
|
||||||
PASS(a,b,c,(pass_no==0?5:pass_no==1?7:9)); \
|
|
||||||
tmpa = a; a = c; c = b; b = tmpa; \
|
|
||||||
} \
|
|
||||||
FEEDFORWARD; \
|
|
||||||
} while (/*CONSTCOND*/0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TIGER_COMPRESS_MACRO(str, state) do { \
|
|
||||||
uint64_t a, b, c, tmpa; \
|
|
||||||
uint64_t aa, bb, cc; \
|
|
||||||
uint64_t x0, x1, x2, x3, x4, x5, x6, x7; \
|
|
||||||
int pass_no; \
|
|
||||||
\
|
|
||||||
a = state[0]; \
|
|
||||||
b = state[1]; \
|
|
||||||
c = state[2]; \
|
|
||||||
\
|
|
||||||
x0 = str[0]; x1 = str[1]; x2 = str[2]; x3 = str[3]; \
|
|
||||||
x4 = str[4]; x5 = str[5]; x6 = str[6]; x7 = str[7]; \
|
|
||||||
\
|
|
||||||
COMPRESS; \
|
|
||||||
\
|
|
||||||
state[0] = a; \
|
|
||||||
state[1] = b; \
|
|
||||||
state[2] = c; \
|
|
||||||
} while (/*CONSTCOND*/ 0)
|
|
||||||
|
|
||||||
#ifdef OPTIMIZE_FOR_LP64
|
|
||||||
/* The compress function is inlined: works better on Alpha. */
|
|
||||||
/* Still leaves the function above in the code, in case some other */
|
|
||||||
/* module calls it directly. */
|
|
||||||
#define tiger_compress(str, state) \
|
|
||||||
TIGER_COMPRESS_MACRO(((const uint64_t*)(const void *)str), ((uint64_t*)(void *)state))
|
|
||||||
#else
|
|
||||||
/* The compress function is a function. Requires smaller cache? */
|
|
||||||
static void
|
|
||||||
tiger_compress(const uint64_t *str, uint64_t state[3])
|
|
||||||
{
|
|
||||||
TIGER_COMPRESS_MACRO(((const uint64_t*)str), ((uint64_t*)state));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* weird function to format 8 raw bytes to 16 formatted hex chars */
|
|
||||||
static void
|
|
||||||
sprint_uint64(char *buf, uint64_t val)
|
|
||||||
{
|
|
||||||
static const char hexdigits[] = "0123456789abcdef";
|
|
||||||
int indian = 1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 8; ++i) {
|
|
||||||
if (IS_LITTLE_ENDIAN(indian)) {
|
|
||||||
buf[2 * (7 - i)] = hexdigits[(val >> (56 - 8 * i + 4)) & 15];
|
|
||||||
buf[(2 * (7 - i)) + 1] = hexdigits[(val >> (56 - 8 * i)) & 15];
|
|
||||||
} else {
|
|
||||||
buf[2 * i] = hexdigits[(val >> (56 - 8 * i + 4)) & 15];
|
|
||||||
buf[(2 * i) + 1] = hexdigits[(val >> (56 - 8 * i)) & 15];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* common function to initialise context */
|
|
||||||
static void
|
|
||||||
initcontext(TIGER_CTX *ctx, uint8_t pad)
|
|
||||||
{
|
|
||||||
(void) memset(ctx, 0x0, sizeof(*ctx));
|
|
||||||
ctx->ctx[0] = 0x0123456789ABCDEFLL;
|
|
||||||
ctx->ctx[1] = 0xFEDCBA9876543210LL;
|
|
||||||
ctx->ctx[2] = 0xF096A5B4C3B2E187LL;
|
|
||||||
ctx->init = 1;
|
|
||||||
ctx->pad = pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the version number (0 is same as 1 for Tiger) */
|
|
||||||
static int
|
|
||||||
setversion(TIGER_CTX *ctx, int version)
|
|
||||||
{
|
|
||||||
switch(version) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
initcontext(ctx, 0x01);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
initcontext(ctx, 0x80);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
(void) fprintf(stderr, "unknown version %d\n", version);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
TIGER_Init(TIGER_CTX *ctx)
|
|
||||||
{
|
|
||||||
if (ctx) {
|
|
||||||
initcontext(ctx, 0x01);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TIGER2_Init(TIGER_CTX *ctx)
|
|
||||||
{
|
|
||||||
if (ctx) {
|
|
||||||
initcontext(ctx, 0x80);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TIGER_Update(TIGER_CTX *ctx, const void *data, size_t length)
|
|
||||||
{
|
|
||||||
const uint64_t *str = (const uint64_t *)data;
|
|
||||||
uint64_t i;
|
|
||||||
uint64_t j;
|
|
||||||
union {
|
|
||||||
uint8_t temp8[64];
|
|
||||||
uint64_t temp64[8];
|
|
||||||
} u;
|
|
||||||
int indian = 1;
|
|
||||||
|
|
||||||
if (ctx == NULL || data == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(i = length; i >= 64; i -= 64) {
|
|
||||||
if (IS_BIG_ENDIAN(indian)) {
|
|
||||||
for (j = 0; j < 64; j++) {
|
|
||||||
u.temp8[j ^ 7] = ((const uint8_t *)(const void *)str)[j];
|
|
||||||
}
|
|
||||||
tiger_compress(u.temp64, ctx->ctx);
|
|
||||||
} else {
|
|
||||||
tiger_compress(str, ctx->ctx);
|
|
||||||
}
|
|
||||||
str += 8;
|
|
||||||
}
|
|
||||||
if (IS_BIG_ENDIAN(indian)) {
|
|
||||||
for (j = 0; j < i; j++) {
|
|
||||||
u.temp8[j ^ 7] = ((const uint8_t*)(const void *)str)[j];
|
|
||||||
}
|
|
||||||
u.temp8[j ^ 7] = ctx->pad;
|
|
||||||
for (j++; j&7; j++) {
|
|
||||||
u.temp8[j ^ 7] = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (j = 0; j < i; j++) {
|
|
||||||
u.temp8[j] = ((const uint8_t*)(const void *)str)[j];
|
|
||||||
}
|
|
||||||
u.temp8[j++] = ctx->pad;
|
|
||||||
for (; j&7; j++) {
|
|
||||||
u.temp8[j] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j > 56) {
|
|
||||||
for (; j < 64; j++) {
|
|
||||||
u.temp8[j] = 0;
|
|
||||||
}
|
|
||||||
tiger_compress(u.temp64, ctx->ctx);
|
|
||||||
j = 0;
|
|
||||||
}
|
|
||||||
for (; j < 56; j++) {
|
|
||||||
u.temp8[j] = 0;
|
|
||||||
}
|
|
||||||
u.temp64[7] = ((uint64_t)length) << 3;
|
|
||||||
tiger_compress(u.temp64, ctx->ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TIGER_Final(uint8_t *digest, TIGER_CTX *ctx)
|
|
||||||
{
|
|
||||||
uint64_t le[3];
|
|
||||||
int indian = 1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (digest == NULL || ctx == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ctx->init) {
|
|
||||||
TIGER_Init(ctx);
|
|
||||||
TIGER_Update(ctx, NULL, 0);
|
|
||||||
}
|
|
||||||
if (IS_LITTLE_ENDIAN(indian)) {
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
le[i] = (uint64_t)BSWAP64(ctx->ctx[i]);
|
|
||||||
}
|
|
||||||
(void) memcpy(digest, le, 3 * sizeof(le[0]));
|
|
||||||
} else {
|
|
||||||
(void) memcpy(digest, ctx->ctx, 3 * sizeof(ctx->ctx[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
TIGER_End(TIGER_CTX *ctx, char *buf)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (ctx == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (buf == NULL && (buf = calloc(1, 49)) == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!ctx->init) {
|
|
||||||
TIGER_Init(ctx);
|
|
||||||
TIGER_Update(ctx, NULL, 0);
|
|
||||||
}
|
|
||||||
for (i = 0; i < 3; ++i) {
|
|
||||||
sprint_uint64(buf + i * 16, ctx->ctx[i]);
|
|
||||||
}
|
|
||||||
buf[16 * i] = 0x0;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
TIGER_File(char *filename, char *buf, int version)
|
|
||||||
{
|
|
||||||
TIGER_CTX ctx;
|
|
||||||
uint8_t buffer[BUFSIZ];
|
|
||||||
ssize_t num;
|
|
||||||
int fd;
|
|
||||||
int oerrno;
|
|
||||||
|
|
||||||
if (filename == NULL || buf == NULL || !setversion(&ctx, version)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if ((fd = open(filename, O_RDONLY)) < 0) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
while ((num = read(fd, buffer, sizeof(buffer))) > 0) {
|
|
||||||
TIGER_Update(&ctx, buffer, (size_t)num);
|
|
||||||
}
|
|
||||||
oerrno = errno;
|
|
||||||
close(fd);
|
|
||||||
errno = oerrno;
|
|
||||||
return (num < 0) ? NULL : TIGER_End(&ctx, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
TIGER_Data(const uint8_t *data, size_t len, char *buf, int version)
|
|
||||||
{
|
|
||||||
TIGER_CTX ctx;
|
|
||||||
|
|
||||||
if (data == NULL || buf == NULL || !setversion(&ctx, version)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
TIGER_Update(&ctx, data, len);
|
|
||||||
return TIGER_End(&ctx, buf);
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
/*-
|
|
||||||
* Copyright (c) 2005-2011 Alistair Crooks <agc@NetBSD.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. 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 AUTHOR ``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 AUTHOR 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 TIGER_H_
|
|
||||||
#define TIGER_H_
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#ifndef __BEGIN_DECLS
|
|
||||||
# if defined(__cplusplus)
|
|
||||||
# define __BEGIN_DECLS extern "C" {
|
|
||||||
# define __END_DECLS }
|
|
||||||
# else
|
|
||||||
# define __BEGIN_DECLS
|
|
||||||
# define __END_DECLS
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
#define TIGER_DIGEST_LENGTH 24
|
|
||||||
#define TIGER_DIGEST_STRING_LENGTH ((TIGER_DIGEST_LENGTH * 2) + 1)
|
|
||||||
|
|
||||||
typedef struct TIGER_CTX {
|
|
||||||
uint64_t ctx[3];
|
|
||||||
int init;
|
|
||||||
uint8_t pad;
|
|
||||||
} TIGER_CTX;
|
|
||||||
|
|
||||||
void TIGER_Init(TIGER_CTX *);
|
|
||||||
void TIGER2_Init(TIGER_CTX *);
|
|
||||||
void TIGER_Update(TIGER_CTX *, const void *, size_t);
|
|
||||||
void TIGER_Final(uint8_t *, TIGER_CTX *);
|
|
||||||
|
|
||||||
char *TIGER_End(TIGER_CTX *, char *);
|
|
||||||
|
|
||||||
char *TIGER_File(char *, char *, int);
|
|
||||||
char *TIGER_Data(const uint8_t *, size_t, char *, int);
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2012,2013,2014,2015 Alistair Crooks <agc@NetBSD.org>
|
* Copyright (c) 2012,2013,2014,2015,2016 Alistair Crooks <agc@NetBSD.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|
@ -23,251 +23,19 @@
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#ifndef NETPGP_VERIFY_H_
|
#ifndef NETPGP_VERIFY_H_
|
||||||
#define NETPGP_VERIFY_H_ 20150205
|
#define NETPGP_VERIFY_H_ 20170201
|
||||||
|
|
||||||
#define NETPGPVERIFY_VERSION "netpgpverify portable 20150205"
|
#define NETPGPVERIFY_VERSION "netpgpverify portable 20170201"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifndef PGPV_ARRAY
|
struct pgpv_t;
|
||||||
/* creates 2 unsigned vars called "name"c and "name"size in current scope */
|
typedef struct pgpv_t pgpv_t;
|
||||||
/* also creates an array called "name"s in current scope */
|
|
||||||
#define PGPV_ARRAY(type, name) \
|
|
||||||
unsigned name##c; unsigned name##vsize; type *name##s
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 64bit key ids */
|
struct pgpv_cursor_t;
|
||||||
#define PGPV_KEYID_LEN 8
|
typedef struct pgpv_cursor_t pgpv_cursor_t;
|
||||||
#define PGPV_STR_KEYID_LEN (PGPV_KEYID_LEN + PGPV_KEYID_LEN + 1)
|
|
||||||
|
|
||||||
/* bignum structure */
|
|
||||||
typedef struct pgpv_bignum_t {
|
|
||||||
void *bn; /* hide the implementation details */
|
|
||||||
uint16_t bits; /* cached number of bits */
|
|
||||||
} pgpv_bignum_t;
|
|
||||||
|
|
||||||
/* right now, our max binary digest length is 20 bytes */
|
|
||||||
#define PGPV_MAX_HASH_LEN 64
|
|
||||||
|
|
||||||
/* fingerprint */
|
|
||||||
typedef struct pgpv_fingerprint_t {
|
|
||||||
uint8_t hashalg; /* algorithm for digest */
|
|
||||||
uint8_t v[PGPV_MAX_HASH_LEN]; /* the digest */
|
|
||||||
uint32_t len; /* its length */
|
|
||||||
} pgpv_fingerprint_t;
|
|
||||||
|
|
||||||
/* specify size for array of bignums */
|
|
||||||
#define PGPV_MAX_PUBKEY_BN 4
|
|
||||||
|
|
||||||
/* public key */
|
|
||||||
typedef struct pgpv_pubkey_t {
|
|
||||||
pgpv_fingerprint_t fingerprint; /* key fingerprint i.e. digest */
|
|
||||||
uint8_t keyid[PGPV_KEYID_LEN]; /* last 8 bytes of v4 keys */
|
|
||||||
int64_t birth; /* creation time */
|
|
||||||
int64_t expiry; /* expiry time */
|
|
||||||
pgpv_bignum_t bn[PGPV_MAX_PUBKEY_BN]; /* bignums */
|
|
||||||
uint8_t keyalg; /* key algorithm */
|
|
||||||
uint8_t hashalg; /* hash algorithm */
|
|
||||||
uint8_t version; /* key version */
|
|
||||||
} pgpv_pubkey_t;
|
|
||||||
|
|
||||||
#define PGPV_MAX_SESSKEY_BN 2
|
|
||||||
|
|
||||||
/* a (size, byte array) string */
|
|
||||||
typedef struct pgpv_string_t {
|
|
||||||
size_t size;
|
|
||||||
uint8_t *data;
|
|
||||||
} pgpv_string_t;
|
|
||||||
|
|
||||||
typedef struct pgpv_ref_t {
|
|
||||||
void *vp;
|
|
||||||
size_t offset;
|
|
||||||
unsigned mem;
|
|
||||||
} pgpv_ref_t;
|
|
||||||
|
|
||||||
#define PGPV_MAX_SECKEY_BN 4
|
|
||||||
|
|
||||||
typedef struct pgpv_compress_t {
|
|
||||||
pgpv_string_t s;
|
|
||||||
uint8_t compalg;
|
|
||||||
} pgpv_compress_t;
|
|
||||||
|
|
||||||
/* a packet dealing with trust */
|
|
||||||
typedef struct pgpv_trust_t {
|
|
||||||
uint8_t level;
|
|
||||||
uint8_t amount;
|
|
||||||
} pgpv_trust_t;
|
|
||||||
|
|
||||||
/* a signature sub packet */
|
|
||||||
typedef struct pgpv_sigsubpkt_t {
|
|
||||||
pgpv_string_t s;
|
|
||||||
uint8_t tag;
|
|
||||||
uint8_t critical;
|
|
||||||
} pgpv_sigsubpkt_t;
|
|
||||||
|
|
||||||
#define PGPV_MAX_SIG_BN 2
|
|
||||||
|
|
||||||
typedef struct pgpv_signature_t {
|
|
||||||
uint8_t *signer; /* key id of signer */
|
|
||||||
pgpv_ref_t hashstart;
|
|
||||||
uint8_t *hash2;
|
|
||||||
uint8_t *mpi;
|
|
||||||
int64_t birth;
|
|
||||||
int64_t keyexpiry;
|
|
||||||
int64_t expiry;
|
|
||||||
uint32_t hashlen;
|
|
||||||
uint8_t version;
|
|
||||||
uint8_t type;
|
|
||||||
uint8_t keyalg;
|
|
||||||
uint8_t hashalg;
|
|
||||||
uint8_t trustlevel;
|
|
||||||
uint8_t trustamount;
|
|
||||||
pgpv_bignum_t bn[PGPV_MAX_SIG_BN];
|
|
||||||
char *regexp;
|
|
||||||
char *pref_key_server;
|
|
||||||
char *policy;
|
|
||||||
char *features;
|
|
||||||
char *why_revoked;
|
|
||||||
uint8_t *revoke_fingerprint;
|
|
||||||
uint8_t revoke_alg;
|
|
||||||
uint8_t revoke_sensitive;
|
|
||||||
uint8_t trustsig;
|
|
||||||
uint8_t revocable;
|
|
||||||
uint8_t pref_symm_alg;
|
|
||||||
uint8_t pref_hash_alg;
|
|
||||||
uint8_t pref_compress_alg;
|
|
||||||
uint8_t key_server_modify;
|
|
||||||
uint8_t notation;
|
|
||||||
uint8_t type_key;
|
|
||||||
uint8_t primary_userid;
|
|
||||||
uint8_t revoked; /* subtract 1 to get real reason, 0 == not revoked */
|
|
||||||
} pgpv_signature_t;
|
|
||||||
|
|
||||||
/* a signature packet */
|
|
||||||
typedef struct pgpv_sigpkt_t {
|
|
||||||
pgpv_signature_t sig;
|
|
||||||
uint16_t subslen;
|
|
||||||
uint16_t unhashlen;
|
|
||||||
PGPV_ARRAY(pgpv_sigsubpkt_t, subpkts);
|
|
||||||
} pgpv_sigpkt_t;
|
|
||||||
|
|
||||||
/* a one-pass signature packet */
|
|
||||||
typedef struct pgpv_onepass_t {
|
|
||||||
uint8_t keyid[PGPV_KEYID_LEN];
|
|
||||||
uint8_t version;
|
|
||||||
uint8_t type;
|
|
||||||
uint8_t hashalg;
|
|
||||||
uint8_t keyalg;
|
|
||||||
uint8_t nested;
|
|
||||||
} pgpv_onepass_t;
|
|
||||||
|
|
||||||
/* a literal data packet */
|
|
||||||
typedef struct pgpv_litdata_t {
|
|
||||||
uint8_t *filename;
|
|
||||||
pgpv_string_t s;
|
|
||||||
uint32_t secs;
|
|
||||||
uint8_t namelen;
|
|
||||||
char format;
|
|
||||||
unsigned mem;
|
|
||||||
size_t offset;
|
|
||||||
size_t len;
|
|
||||||
} pgpv_litdata_t;
|
|
||||||
|
|
||||||
/* user attributes - images */
|
|
||||||
typedef struct pgpv_userattr_t {
|
|
||||||
size_t len;
|
|
||||||
PGPV_ARRAY(pgpv_string_t, subattrs);
|
|
||||||
} pgpv_userattr_t;
|
|
||||||
|
|
||||||
/* a general PGP packet */
|
|
||||||
typedef struct pgpv_pkt_t {
|
|
||||||
uint8_t tag;
|
|
||||||
uint8_t newfmt;
|
|
||||||
uint8_t allocated;
|
|
||||||
uint8_t mement;
|
|
||||||
size_t offset;
|
|
||||||
pgpv_string_t s;
|
|
||||||
union {
|
|
||||||
pgpv_sigpkt_t sigpkt;
|
|
||||||
pgpv_onepass_t onepass;
|
|
||||||
pgpv_litdata_t litdata;
|
|
||||||
pgpv_compress_t compressed;
|
|
||||||
pgpv_trust_t trust;
|
|
||||||
pgpv_pubkey_t pubkey;
|
|
||||||
pgpv_string_t userid;
|
|
||||||
pgpv_userattr_t userattr;
|
|
||||||
} u;
|
|
||||||
} pgpv_pkt_t;
|
|
||||||
|
|
||||||
/* a memory structure */
|
|
||||||
typedef struct pgpv_mem_t {
|
|
||||||
size_t size;
|
|
||||||
size_t cc;
|
|
||||||
uint8_t *mem;
|
|
||||||
FILE *fp;
|
|
||||||
uint8_t dealloc;
|
|
||||||
const char *allowed; /* the types of packet that are allowed */
|
|
||||||
} pgpv_mem_t;
|
|
||||||
|
|
||||||
/* packet parser */
|
|
||||||
|
|
||||||
typedef struct pgpv_signed_userid_t {
|
|
||||||
pgpv_string_t userid;
|
|
||||||
PGPV_ARRAY(pgpv_signature_t, sigs);
|
|
||||||
uint8_t primary_userid;
|
|
||||||
uint8_t revoked;
|
|
||||||
} pgpv_signed_userid_t;
|
|
||||||
|
|
||||||
typedef struct pgpv_signed_userattr_t {
|
|
||||||
pgpv_userattr_t userattr;
|
|
||||||
PGPV_ARRAY(pgpv_signature_t, sigs);
|
|
||||||
uint8_t revoked;
|
|
||||||
} pgpv_signed_userattr_t;
|
|
||||||
|
|
||||||
typedef struct pgpv_signed_subkey_t {
|
|
||||||
pgpv_pubkey_t subkey;
|
|
||||||
pgpv_signature_t revoc_self_sig;
|
|
||||||
PGPV_ARRAY(pgpv_signature_t, sigs);
|
|
||||||
} pgpv_signed_subkey_t;
|
|
||||||
|
|
||||||
typedef struct pgpv_primarykey_t {
|
|
||||||
pgpv_pubkey_t primary;
|
|
||||||
pgpv_signature_t revoc_self_sig;
|
|
||||||
PGPV_ARRAY(pgpv_signature_t, direct_sigs);
|
|
||||||
PGPV_ARRAY(pgpv_signed_userid_t, signed_userids);
|
|
||||||
PGPV_ARRAY(pgpv_signed_userattr_t, signed_userattrs);
|
|
||||||
PGPV_ARRAY(pgpv_signed_subkey_t, signed_subkeys);
|
|
||||||
size_t fmtsize;
|
|
||||||
uint8_t primary_userid;
|
|
||||||
} pgpv_primarykey_t;
|
|
||||||
|
|
||||||
/* everything stems from this structure */
|
|
||||||
typedef struct pgpv_t {
|
|
||||||
PGPV_ARRAY(pgpv_pkt_t, pkts); /* packet array */
|
|
||||||
PGPV_ARRAY(pgpv_primarykey_t, primaries); /* array of primary keys */
|
|
||||||
PGPV_ARRAY(pgpv_mem_t, areas); /* areas we read packets from */
|
|
||||||
PGPV_ARRAY(size_t, datastarts); /* starts of data packets */
|
|
||||||
size_t pkt; /* when parsing, current pkt number */
|
|
||||||
const char *op; /* the operation we're doing */
|
|
||||||
unsigned ssh; /* using ssh keys */
|
|
||||||
} pgpv_t;
|
|
||||||
|
|
||||||
#define PGPV_REASON_LEN 128
|
|
||||||
|
|
||||||
/* when searching, we define a cursor, and fill in an array of subscripts */
|
|
||||||
typedef struct pgpv_cursor_t {
|
|
||||||
pgpv_t *pgp; /* pointer to pgp tree */
|
|
||||||
char *field; /* field we're searching on */
|
|
||||||
char *op; /* operation we're doing */
|
|
||||||
char *value; /* value we're searching for */
|
|
||||||
void *ptr; /* for regexps etc */
|
|
||||||
PGPV_ARRAY(uint32_t, found); /* array of matched pimary key subscripts */
|
|
||||||
PGPV_ARRAY(size_t, datacookies); /* cookies to retrieve matched data */
|
|
||||||
int64_t sigtime; /* time of signature */
|
|
||||||
char why[PGPV_REASON_LEN]; /* reason for bad signature */
|
|
||||||
} pgpv_cursor_t;
|
|
||||||
|
|
||||||
#ifndef __BEGIN_DECLS
|
#ifndef __BEGIN_DECLS
|
||||||
# if defined(__cplusplus)
|
# if defined(__cplusplus)
|
||||||
|
|
@ -281,17 +49,24 @@ typedef struct pgpv_cursor_t {
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
pgpv_t *pgpv_new(void);
|
||||||
|
pgpv_cursor_t *pgpv_new_cursor(void);
|
||||||
|
|
||||||
int pgpv_read_pubring(pgpv_t */*pgp*/, const void */*keyringfile/mem*/, ssize_t /*size*/);
|
int pgpv_read_pubring(pgpv_t */*pgp*/, const void */*keyringfile/mem*/, ssize_t /*size*/);
|
||||||
int pgpv_read_ssh_pubkeys(pgpv_t */*pgp*/, const void */*keyring*/, ssize_t /*size*/);
|
int pgpv_read_ssh_pubkeys(pgpv_t */*pgp*/, const void */*keyring*/, ssize_t /*size*/);
|
||||||
|
|
||||||
size_t pgpv_verify(pgpv_cursor_t */*cursor*/, pgpv_t */*pgp*/, const void */*mem/file*/, ssize_t /*size*/);
|
size_t pgpv_verify(pgpv_cursor_t */*cursor*/, pgpv_t */*pgp*/, const void */*mem/file*/, ssize_t /*size*/);
|
||||||
size_t pgpv_get_verified(pgpv_cursor_t */*cursor*/, size_t /*cookie*/, char **/*ret*/);
|
size_t pgpv_get_verified(pgpv_cursor_t */*cursor*/, size_t /*cookie*/, char **/*ret*/);
|
||||||
int pgpv_get_cursor_element(pgpv_cursor_t */*cursor*/, size_t /*element*/);
|
|
||||||
size_t pgpv_dump(pgpv_t */*pgp*/, char **/*data*/);
|
size_t pgpv_dump(pgpv_t */*pgp*/, char **/*data*/);
|
||||||
|
|
||||||
size_t pgpv_get_entry(pgpv_t */*pgp*/, unsigned /*ent*/, char **/*ret*/, const char */*modifiers*/);
|
size_t pgpv_get_entry(pgpv_t */*pgp*/, unsigned /*ent*/, char **/*ret*/, const char */*modifiers*/);
|
||||||
|
|
||||||
|
int64_t pgpv_get_cursor_num(pgpv_cursor_t */*cursor*/, const char */*field*/);
|
||||||
|
char *pgpv_get_cursor_str(pgpv_cursor_t */*cursor*/, const char */*field*/);
|
||||||
|
int pgpv_get_cursor_element(pgpv_cursor_t */*cursor*/, size_t /*element*/);
|
||||||
|
|
||||||
int pgpv_close(pgpv_t */*pgp*/);
|
int pgpv_close(pgpv_t */*pgp*/);
|
||||||
|
int pgpv_cursor_close(pgpv_cursor_t */*cursor*/);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
15
crypto/external/bsd/netpgp/dist/src/netpgpverify/version.asc
vendored
Normal file
15
crypto/external/bsd/netpgp/dist/src/netpgpverify/version.asc
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
-----BEGIN PGP SIGNED MESSAGE-----
|
||||||
|
Hash: SHA1
|
||||||
|
|
||||||
|
bar
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
Version: GnuPG v1
|
||||||
|
|
||||||
|
iQEcBAEBAgAGBQJXYOg1AAoJEBto3PzAWWgjN7wIALbMScFoVnkE47+Hj1aLclRL
|
||||||
|
9Mb9bKWkPi9iq1SybDEeiK6G9hLXSm2ZbygHNoAwFVlMIxkV2lRKqLfquatW9GH/
|
||||||
|
9W2LkKa3wYpHH84Uj2/3Atu7564+IvcvDVkuxp4oHiz4X3i4CvIOf6qPuPHC5fAb
|
||||||
|
xmjRLJRh71pJ8zBdtLQV3hnzjuUk5qZvKt109/WARQL5lL5jGIe504TnzHEBSgNa
|
||||||
|
Ez1vxN2RngVh4QhDApx05EYfmZnBChXalCCh+noo6gpjUN/xhfq/KkLWrLaRWIL6
|
||||||
|
IHBS3MgqDP6ToaJ7R2w1hytCoKlbXGyJGsUn29QBoQBwWGGM3Z5pbFBPcmBx/mg=
|
||||||
|
=KXon
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
11
crypto/external/bsd/netpgp/lib/verify/Makefile
vendored
11
crypto/external/bsd/netpgp/lib/verify/Makefile
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile,v 1.8 2015/04/15 19:13:46 mrg Exp $
|
# $NetBSD: Makefile,v 1.9 2017/04/17 19:50:28 agc Exp $
|
||||||
|
|
||||||
LIB=netpgpverify
|
LIB=netpgpverify
|
||||||
SRCS+=b64.c
|
SRCS+=b64.c
|
||||||
|
|
@ -15,18 +15,9 @@ SRCS+=sha1.c
|
||||||
SRCS+=sha2.c
|
SRCS+=sha2.c
|
||||||
SRCS+=md5c.c
|
SRCS+=md5c.c
|
||||||
SRCS+=rmd160.c
|
SRCS+=rmd160.c
|
||||||
SRCS+=tiger.c
|
|
||||||
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
|
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
|
||||||
MAN=libnetpgpverify.3
|
MAN=libnetpgpverify.3
|
||||||
WARNS=5
|
WARNS=5
|
||||||
#.if defined(__MINIX)
|
|
||||||
#LSC: While Compiling with -O3:
|
|
||||||
#<..>/lib/verify/../../dist/src/netpgpverify/bignum.c:802:5: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]
|
|
||||||
# if (olduse > ix) {
|
|
||||||
# ^
|
|
||||||
# cc1: all warnings being treated as errors
|
|
||||||
CWARNFLAGS+= -Wno-strict-overflow
|
|
||||||
#.endif # defined(__MINIX)
|
|
||||||
|
|
||||||
EXTDIST=${.CURDIR}/../../dist
|
EXTDIST=${.CURDIR}/../../dist
|
||||||
.PATH: ${EXTDIST}/src/netpgpverify
|
.PATH: ${EXTDIST}/src/netpgpverify
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
major=4
|
major=5
|
||||||
minor=0
|
minor=0
|
||||||
|
|
|
||||||
|
|
@ -1572,7 +1572,7 @@
|
||||||
./usr/sbin/bootpef base-bootserver-bin
|
./usr/sbin/bootpef base-bootserver-bin
|
||||||
./usr/sbin/bootpgw base-bootserver-bin
|
./usr/sbin/bootpgw base-bootserver-bin
|
||||||
./usr/sbin/bootptest base-bootserver-bin
|
./usr/sbin/bootptest base-bootserver-bin
|
||||||
./usr/sbin/bpm base-pkgutil-bin crypto
|
./usr/sbin/bpm base-obsolete obsolete
|
||||||
./usr/sbin/btattach base-sysutil-bin
|
./usr/sbin/btattach base-sysutil-bin
|
||||||
./usr/sbin/btconfig base-sysutil-bin
|
./usr/sbin/btconfig base-sysutil-bin
|
||||||
./usr/sbin/btcontrol base-obsolete obsolete
|
./usr/sbin/btcontrol base-obsolete obsolete
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,10 @@
|
||||||
./usr/lib/libamu.so.5 base-amd-shlib compatfile
|
./usr/lib/libamu.so.5 base-amd-shlib compatfile
|
||||||
./usr/lib/libamu.so.5.0 base-amd-shlib compatfile
|
./usr/lib/libamu.so.5.0 base-amd-shlib compatfile
|
||||||
./usr/lib/libarchive.so base-sys-shlib compatfile
|
./usr/lib/libarchive.so base-sys-shlib compatfile
|
||||||
./usr/lib/libarchive.so.3 base-sys-shlib compatfile
|
./usr/lib/libarchive.so.3 base-sys-shlib compatfile,obsolete
|
||||||
./usr/lib/libarchive.so.3.1 base-sys-shlib compatfile
|
./usr/lib/libarchive.so.3.1 base-sys-shlib compatfile,obsolete
|
||||||
|
./usr/lib/libarchive.so.4 base-sys-shlib compatfile
|
||||||
|
./usr/lib/libarchive.so.4.0 base-sys-shlib compatfile
|
||||||
./usr/lib/libasan.so base-sys-shlib compatfile,gcc
|
./usr/lib/libasan.so base-sys-shlib compatfile,gcc
|
||||||
./usr/lib/libasan.so.0 base-sys-shlib compatfile,gcc
|
./usr/lib/libasan.so.0 base-sys-shlib compatfile,gcc
|
||||||
./usr/lib/libasan.so.0.0 base-sys-shlib compatfile,gcc
|
./usr/lib/libasan.so.0.0 base-sys-shlib compatfile,gcc
|
||||||
|
|
@ -393,8 +395,10 @@
|
||||||
./usr/lib/libnetpgp.so.3 base-crypto-shlib compatfile,crypto
|
./usr/lib/libnetpgp.so.3 base-crypto-shlib compatfile,crypto
|
||||||
./usr/lib/libnetpgp.so.3.0 base-crypto-shlib compatfile,crypto
|
./usr/lib/libnetpgp.so.3.0 base-crypto-shlib compatfile,crypto
|
||||||
./usr/lib/libnetpgpverify.so base-crypto-shlib compatfile,crypto
|
./usr/lib/libnetpgpverify.so base-crypto-shlib compatfile,crypto
|
||||||
./usr/lib/libnetpgpverify.so.4 base-crypto-shlib compatfile,crypto
|
./usr/lib/libnetpgpverify.so.4 base-crypto-shlib compatfile,crypto,obsolete
|
||||||
./usr/lib/libnetpgpverify.so.4.0 base-crypto-shlib compatfile,crypto
|
./usr/lib/libnetpgpverify.so.4.0 base-crypto-shlib compatfile,crypto,obsolete
|
||||||
|
./usr/lib/libnetpgpverify.so.5 base-crypto-shlib compatfile,crypto
|
||||||
|
./usr/lib/libnetpgpverify.so.5.0 base-crypto-shlib compatfile,crypto
|
||||||
./usr/lib/libnpf.so base-npf-shlib npf,compatfile
|
./usr/lib/libnpf.so base-npf-shlib npf,compatfile
|
||||||
./usr/lib/libnpf.so.0 base-npf-shlib npf,compatfile
|
./usr/lib/libnpf.so.0 base-npf-shlib npf,compatfile
|
||||||
./usr/lib/libnpf.so.0.0 base-npf-shlib npf,compatfile
|
./usr/lib/libnpf.so.0.0 base-npf-shlib npf,compatfile
|
||||||
|
|
|
||||||
|
|
@ -18706,7 +18706,7 @@
|
||||||
./usr/share/man/man3/archive_entry_acl_next.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_acl_next.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_entry_acl_next_w.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_acl_next_w.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_entry_acl_reset.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_acl_reset.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_entry_acl_text_w.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_acl_text_w.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_entry_atime.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_atime.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_entry_atime_nsec.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_atime_nsec.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_entry_clear.3 comp-c-man .man
|
./usr/share/man/man3/archive_entry_clear.3 comp-c-man .man
|
||||||
|
|
@ -18786,13 +18786,13 @@
|
||||||
./usr/share/man/man3/archive_read_close.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_close.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_data.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_data.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_data_block.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_data_block.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_data_into_buffer.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_data_into_buffer.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_data_into_fd.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_data_into_fd.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_data_skip.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_data_skip.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk_gname.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_gname.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk_new.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_new.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk_set_entry_from_file.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_set_entry_from_file.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_disk_set_gname_lookup.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_set_gname_lookup.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk_set_standard_lookup.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_set_standard_lookup.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_disk_set_symlink_hybrid.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_disk_set_symlink_hybrid.3 comp-c-man .man
|
||||||
|
|
@ -18806,27 +18806,27 @@
|
||||||
./usr/share/man/man3/archive_read_extract_set_skip_file.3 comp-obsolete obsolete
|
./usr/share/man/man3/archive_read_extract_set_skip_file.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_finish.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_finish.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_new.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_new.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_next_header.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_next_header.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_next_header2.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_next_header2.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_open.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_open2.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open2.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_open_FILE.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open_FILE.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_open_fd.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open_fd.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_open_file.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open_file.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_open_filename.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open_filename.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_open_memory.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_open_memory.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_set_filter_options.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_set_filter_options.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_set_format_options.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_set_format_options.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_set_options.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_set_options.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_support_compression_all.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_all.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_bzip2.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_bzip2.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_compress.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_compress.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_gzip.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_gzip.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_lzma.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_lzma.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_none.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_none.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_program.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_program.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_program_signature.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_program_signature.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_compression_xz.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_compression_xz.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_read_support_format_all.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_format_all.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_support_format_ar.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_format_ar.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_read_support_format_cpio.3 comp-c-man .man
|
./usr/share/man/man3/archive_read_support_format_cpio.3 comp-c-man .man
|
||||||
|
|
@ -18860,21 +18860,21 @@
|
||||||
./usr/share/man/man3/archive_write_open_file.3 comp-obsolete obsolete
|
./usr/share/man/man3/archive_write_open_file.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_open_filename.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_open_filename.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_open_memory.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_open_memory.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_options.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_options.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_bytes_in_last_block.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_bytes_in_last_block.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_bytes_per_block.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_bytes_per_block.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_callbacks.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_callbacks.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compression_bzip2.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compression_bzip2.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compression_compress.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compression_compress.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compression_gzip.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compression_gzip.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compression_none.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compression_none.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compression_program.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compression_program.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_compressor_options.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_compressor_options.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_format_cpio.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_cpio.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_format_pax.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_pax.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_format_pax_restricted.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_pax_restricted.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_format_shar.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_shar.3 comp-c-man .man
|
||||||
./usr/share/man/man3/archive_write_set_format_shar_binary.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_shar_binary.3 comp-obsolete obsolete
|
||||||
./usr/share/man/man3/archive_write_set_format_ustar.3 comp-c-man .man
|
./usr/share/man/man3/archive_write_set_format_ustar.3 comp-c-man .man
|
||||||
./usr/share/man/man3/asctime.3 comp-c-man .man
|
./usr/share/man/man3/asctime.3 comp-c-man .man
|
||||||
./usr/share/man/man3/asctime_r.3 comp-c-man .man
|
./usr/share/man/man3/asctime_r.3 comp-c-man .man
|
||||||
|
|
|
||||||
|
|
@ -5988,7 +5988,7 @@
|
||||||
./usr/share/man/man1/bdes.1 man-crypto-man crypto,.man
|
./usr/share/man/man1/bdes.1 man-crypto-man crypto,.man
|
||||||
./usr/share/man/man1/bg.1 man-util-man .man
|
./usr/share/man/man1/bg.1 man-util-man .man
|
||||||
./usr/share/man/man1/biff.1 man-mail-man .man
|
./usr/share/man/man1/biff.1 man-mail-man .man
|
||||||
./usr/share/man/man1/bpm.1 man-pkgutil-man crypto,.man
|
./usr/share/man/man1/bpm.1 man-obsolete .man,obsolete
|
||||||
./usr/share/man/man1/bthset.1 man-util-man .man
|
./usr/share/man/man1/bthset.1 man-util-man .man
|
||||||
./usr/share/man/man1/btkey.1 man-util-man .man
|
./usr/share/man/man1/btkey.1 man-util-man .man
|
||||||
./usr/share/man/man1/btpin.1 man-util-man .man
|
./usr/share/man/man1/btpin.1 man-util-man .man
|
||||||
|
|
|
||||||
|
|
@ -792,8 +792,10 @@
|
||||||
./usr/lib/keymaps/us-std.map minix-base
|
./usr/lib/keymaps/us-std.map minix-base
|
||||||
./usr/lib/keymaps/us-swap.map minix-base
|
./usr/lib/keymaps/us-swap.map minix-base
|
||||||
./usr/lib/libarchive.so minix-base
|
./usr/lib/libarchive.so minix-base
|
||||||
./usr/lib/libarchive.so.3 minix-base
|
./usr/lib/libarchive.so.3 minix-base obsolete
|
||||||
./usr/lib/libarchive.so.3.1 minix-base
|
./usr/lib/libarchive.so.3.1 minix-base obsolete
|
||||||
|
./usr/lib/libarchive.so.4 minix-base
|
||||||
|
./usr/lib/libarchive.so.4.0 minix-base
|
||||||
./usr/lib/libatf-c++.a minix-base atf
|
./usr/lib/libatf-c++.a minix-base atf
|
||||||
./usr/lib/libatf-c++.so.1.0 minix-base atf
|
./usr/lib/libatf-c++.so.1.0 minix-base atf
|
||||||
./usr/lib/libatf-c++.so.1 minix-base atf
|
./usr/lib/libatf-c++.so.1 minix-base atf
|
||||||
|
|
@ -946,8 +948,10 @@
|
||||||
./usr/lib/libnetpgp.so minix-base crypto
|
./usr/lib/libnetpgp.so minix-base crypto
|
||||||
./usr/lib/libnetpgp_pic.a minix-base crypto
|
./usr/lib/libnetpgp_pic.a minix-base crypto
|
||||||
./usr/lib/libnetpgpverify.a minix-base crypto
|
./usr/lib/libnetpgpverify.a minix-base crypto
|
||||||
./usr/lib/libnetpgpverify.so.4.0 minix-base crypto
|
./usr/lib/libnetpgpverify.so.4.0 minix-base crypto,obsolete
|
||||||
./usr/lib/libnetpgpverify.so.4 minix-base crypto
|
./usr/lib/libnetpgpverify.so.4 minix-base crypto,obsolete
|
||||||
|
./usr/lib/libnetpgpverify.so.5.0 minix-base crypto
|
||||||
|
./usr/lib/libnetpgpverify.so.5 minix-base crypto
|
||||||
./usr/lib/libnetpgpverify.so minix-base crypto
|
./usr/lib/libnetpgpverify.so minix-base crypto
|
||||||
./usr/lib/libnetpgpverify_pic.a minix-base crypto
|
./usr/lib/libnetpgpverify_pic.a minix-base crypto
|
||||||
./usr/lib/libobjc.a minix-base gcc=5
|
./usr/lib/libobjc.a minix-base gcc=5
|
||||||
|
|
@ -1086,7 +1090,7 @@
|
||||||
./usr/sbin minix-base
|
./usr/sbin minix-base
|
||||||
./usr/sbin/arp minix-base
|
./usr/sbin/arp minix-base
|
||||||
./usr/sbin/audit-packages minix-base crypto
|
./usr/sbin/audit-packages minix-base crypto
|
||||||
./usr/sbin/bpm minix-base crypto
|
./usr/sbin/bpm minix-base obsolete
|
||||||
./usr/sbin/btrace minix-base
|
./usr/sbin/btrace minix-base
|
||||||
./usr/sbin/chown minix-base
|
./usr/sbin/chown minix-base
|
||||||
./usr/sbin/chroot minix-base
|
./usr/sbin/chroot minix-base
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
./usr/man/man1/basename.1 minix-man
|
./usr/man/man1/basename.1 minix-man
|
||||||
./usr/man/man1/bdes.1 minix-man crypto
|
./usr/man/man1/bdes.1 minix-man crypto
|
||||||
./usr/man/man1/bg.1 minix-man
|
./usr/man/man1/bg.1 minix-man
|
||||||
./usr/man/man1/bpm.1 minix-man crypto
|
./usr/man/man1/bpm.1 minix-man obsolete
|
||||||
./usr/man/man1/break.1 minix-man obsolete
|
./usr/man/man1/break.1 minix-man obsolete
|
||||||
./usr/man/man1/bsdtar.1 minix-man
|
./usr/man/man1/bsdtar.1 minix-man
|
||||||
./usr/man/man1/bsfilt.1 minix-man
|
./usr/man/man1/bsfilt.1 minix-man
|
||||||
|
|
@ -847,16 +847,26 @@
|
||||||
./usr/man/man3/archive_compression_name.3 minix-man
|
./usr/man/man3/archive_compression_name.3 minix-man
|
||||||
./usr/man/man3/archive_copy_error.3 minix-man
|
./usr/man/man3/archive_copy_error.3 minix-man
|
||||||
./usr/man/man3/archive_entry.3 minix-man
|
./usr/man/man3/archive_entry.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_acl.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_add_entry.3 minix-man
|
./usr/man/man3/archive_entry_acl_add_entry.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_add_entry_w.3 minix-man
|
./usr/man/man3/archive_entry_acl_add_entry_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_clear.3 minix-man
|
./usr/man/man3/archive_entry_acl_clear.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_count.3 minix-man
|
./usr/man/man3/archive_entry_acl_count.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_acl_from_text.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_acl_from_text_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_next.3 minix-man
|
./usr/man/man3/archive_entry_acl_next.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_next_w.3 minix-man
|
./usr/man/man3/archive_entry_acl_next_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_reset.3 minix-man
|
./usr/man/man3/archive_entry_acl_reset.3 minix-man
|
||||||
./usr/man/man3/archive_entry_acl_text_w.3 minix-man
|
./usr/man/man3/archive_entry_acl_text_w.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_entry_acl_to_text.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_acl_to_text_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_acl_types.3 minix-man
|
||||||
./usr/man/man3/archive_entry_atime.3 minix-man
|
./usr/man/man3/archive_entry_atime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_atime_is_set.3 minix-man
|
||||||
./usr/man/man3/archive_entry_atime_nsec.3 minix-man
|
./usr/man/man3/archive_entry_atime_nsec.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_birthtime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_birthtime_is_set.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_birthtime_nsec.3 minix-man
|
||||||
./usr/man/man3/archive_entry_clear.3 minix-man
|
./usr/man/man3/archive_entry_clear.3 minix-man
|
||||||
./usr/man/man3/archive_entry_clone.3 minix-man
|
./usr/man/man3/archive_entry_clone.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_fflags_text.3 minix-man
|
./usr/man/man3/archive_entry_copy_fflags_text.3 minix-man
|
||||||
|
|
@ -867,6 +877,7 @@
|
||||||
./usr/man/man3/archive_entry_copy_hardlink_w.3 minix-man
|
./usr/man/man3/archive_entry_copy_hardlink_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_link.3 minix-man
|
./usr/man/man3/archive_entry_copy_link.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_link_w.3 minix-man
|
./usr/man/man3/archive_entry_copy_link_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_copy_pathname.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_pathname_w.3 minix-man
|
./usr/man/man3/archive_entry_copy_pathname_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_sourcepath.3 minix-man
|
./usr/man/man3/archive_entry_copy_sourcepath.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_stat.3 minix-man
|
./usr/man/man3/archive_entry_copy_stat.3 minix-man
|
||||||
|
|
@ -874,7 +885,11 @@
|
||||||
./usr/man/man3/archive_entry_copy_symlink_w.3 minix-man
|
./usr/man/man3/archive_entry_copy_symlink_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_uname.3 minix-man
|
./usr/man/man3/archive_entry_copy_uname.3 minix-man
|
||||||
./usr/man/man3/archive_entry_copy_uname_w.3 minix-man
|
./usr/man/man3/archive_entry_copy_uname_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_ctime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_ctime_is_set.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_ctime_nsec.3 minix-man
|
||||||
./usr/man/man3/archive_entry_dev.3 minix-man
|
./usr/man/man3/archive_entry_dev.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_dev_is_set.3 minix-man
|
||||||
./usr/man/man3/archive_entry_devmajor.3 minix-man
|
./usr/man/man3/archive_entry_devmajor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_devminor.3 minix-man
|
./usr/man/man3/archive_entry_devminor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_fflags.3 minix-man
|
./usr/man/man3/archive_entry_fflags.3 minix-man
|
||||||
|
|
@ -883,19 +898,33 @@
|
||||||
./usr/man/man3/archive_entry_free.3 minix-man
|
./usr/man/man3/archive_entry_free.3 minix-man
|
||||||
./usr/man/man3/archive_entry_gid.3 minix-man
|
./usr/man/man3/archive_entry_gid.3 minix-man
|
||||||
./usr/man/man3/archive_entry_gname.3 minix-man
|
./usr/man/man3/archive_entry_gname.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_gname_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_hardlink.3 minix-man
|
./usr/man/man3/archive_entry_hardlink.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_hardlink_w.3 minix-man
|
||||||
./usr/man/man3/archive_entry_ino.3 minix-man
|
./usr/man/man3/archive_entry_ino.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_ino64.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_ino_is_set.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_linkify.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_linkresolver.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_linkresolver_free.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_linkresolver_new.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_linkresolver_set_strategy.3 minix-man
|
||||||
./usr/man/man3/archive_entry_mode.3 minix-man
|
./usr/man/man3/archive_entry_mode.3 minix-man
|
||||||
./usr/man/man3/archive_entry_mtime.3 minix-man
|
./usr/man/man3/archive_entry_mtime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_mtime_is_set.3 minix-man
|
||||||
./usr/man/man3/archive_entry_mtime_nsec.3 minix-man
|
./usr/man/man3/archive_entry_mtime_nsec.3 minix-man
|
||||||
./usr/man/man3/archive_entry_new.3 minix-man
|
./usr/man/man3/archive_entry_new.3 minix-man
|
||||||
./usr/man/man3/archive_entry_nlink.3 minix-man
|
./usr/man/man3/archive_entry_nlink.3 minix-man
|
||||||
./usr/man/man3/archive_entry_pathname.3 minix-man
|
./usr/man/man3/archive_entry_pathname.3 minix-man
|
||||||
./usr/man/man3/archive_entry_pathname_w.3 minix-man
|
./usr/man/man3/archive_entry_pathname_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_paths.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_perm.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_perms.3 minix-man
|
||||||
./usr/man/man3/archive_entry_rdev.3 minix-man
|
./usr/man/man3/archive_entry_rdev.3 minix-man
|
||||||
./usr/man/man3/archive_entry_rdevmajor.3 minix-man
|
./usr/man/man3/archive_entry_rdevmajor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_rdevminor.3 minix-man
|
./usr/man/man3/archive_entry_rdevminor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_atime.3 minix-man
|
./usr/man/man3/archive_entry_set_atime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_set_birthtime.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_ctime.3 minix-man
|
./usr/man/man3/archive_entry_set_ctime.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_dev.3 minix-man
|
./usr/man/man3/archive_entry_set_dev.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_devmajor.3 minix-man
|
./usr/man/man3/archive_entry_set_devmajor.3 minix-man
|
||||||
|
|
@ -905,10 +934,14 @@
|
||||||
./usr/man/man3/archive_entry_set_gid.3 minix-man
|
./usr/man/man3/archive_entry_set_gid.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_gname.3 minix-man
|
./usr/man/man3/archive_entry_set_gname.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_hardlink.3 minix-man
|
./usr/man/man3/archive_entry_set_hardlink.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_set_ino.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_set_ino64.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_link.3 minix-man
|
./usr/man/man3/archive_entry_set_link.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_mode.3 minix-man
|
./usr/man/man3/archive_entry_set_mode.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_mtime.3 minix-man
|
./usr/man/man3/archive_entry_set_mtime.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_pathname.3 minix-man
|
./usr/man/man3/archive_entry_set_pathname.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_set_perm.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_set_rdev.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_rdevmajor.3 minix-man
|
./usr/man/man3/archive_entry_set_rdevmajor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_rdevminor.3 minix-man
|
./usr/man/man3/archive_entry_set_rdevminor.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_size.3 minix-man
|
./usr/man/man3/archive_entry_set_size.3 minix-man
|
||||||
|
|
@ -916,27 +949,49 @@
|
||||||
./usr/man/man3/archive_entry_set_uid.3 minix-man
|
./usr/man/man3/archive_entry_set_uid.3 minix-man
|
||||||
./usr/man/man3/archive_entry_set_uname.3 minix-man
|
./usr/man/man3/archive_entry_set_uname.3 minix-man
|
||||||
./usr/man/man3/archive_entry_size.3 minix-man
|
./usr/man/man3/archive_entry_size.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_size_is_set.3 minix-man
|
||||||
./usr/man/man3/archive_entry_sourcepath.3 minix-man
|
./usr/man/man3/archive_entry_sourcepath.3 minix-man
|
||||||
./usr/man/man3/archive_entry_stat.3 minix-man
|
./usr/man/man3/archive_entry_stat.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_strmode.3 minix-man
|
||||||
./usr/man/man3/archive_entry_symlink.3 minix-man
|
./usr/man/man3/archive_entry_symlink.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_symlink_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_time.3 minix-man
|
||||||
./usr/man/man3/archive_entry_uid.3 minix-man
|
./usr/man/man3/archive_entry_uid.3 minix-man
|
||||||
./usr/man/man3/archive_entry_uname.3 minix-man
|
./usr/man/man3/archive_entry_uname.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_uname_w.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_unset_atime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_unset_birthtime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_unset_ctime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_unset_mtime.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_unset_size.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_gname_utf8.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_hardlink_utf8.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_link_utf8.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_pathname_utf8.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_symlink_utf8.3 minix-man
|
||||||
|
./usr/man/man3/archive_entry_update_uname_utf8.3 minix-man
|
||||||
./usr/man/man3/archive_errno.3 minix-man
|
./usr/man/man3/archive_errno.3 minix-man
|
||||||
./usr/man/man3/archive_error_string.3 minix-man
|
./usr/man/man3/archive_error_string.3 minix-man
|
||||||
./usr/man/man3/archive_file_count.3 minix-man
|
./usr/man/man3/archive_file_count.3 minix-man
|
||||||
|
./usr/man/man3/archive_filter_code.3 minix-man
|
||||||
|
./usr/man/man3/archive_filter_count.3 minix-man
|
||||||
|
./usr/man/man3/archive_filter_name.3 minix-man
|
||||||
./usr/man/man3/archive_format.3 minix-man
|
./usr/man/man3/archive_format.3 minix-man
|
||||||
./usr/man/man3/archive_format_name.3 minix-man
|
./usr/man/man3/archive_format_name.3 minix-man
|
||||||
|
./usr/man/man3/archive_position.3 minix-man
|
||||||
./usr/man/man3/archive_read.3 minix-man
|
./usr/man/man3/archive_read.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_add_passphrase.3 minix-man
|
||||||
./usr/man/man3/archive_read_close.3 minix-man
|
./usr/man/man3/archive_read_close.3 minix-man
|
||||||
./usr/man/man3/archive_read_data.3 minix-man
|
./usr/man/man3/archive_read_data.3 minix-man
|
||||||
./usr/man/man3/archive_read_data_block.3 minix-man
|
./usr/man/man3/archive_read_data_block.3 minix-man
|
||||||
./usr/man/man3/archive_read_data_into_buffer.3 minix-man
|
./usr/man/man3/archive_read_data_into_buffer.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_data_into_fd.3 minix-man
|
./usr/man/man3/archive_read_data_into_fd.3 minix-man
|
||||||
./usr/man/man3/archive_read_data_skip.3 minix-man
|
./usr/man/man3/archive_read_data_skip.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk.3 minix-man
|
./usr/man/man3/archive_read_disk.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_disk_entry_from_file.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk_gname.3 minix-man
|
./usr/man/man3/archive_read_disk_gname.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk_new.3 minix-man
|
./usr/man/man3/archive_read_disk_new.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk_set_entry_from_file.3 minix-man
|
./usr/man/man3/archive_read_disk_set_entry_from_file.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_disk_set_gname_lookup.3 minix-man
|
./usr/man/man3/archive_read_disk_set_gname_lookup.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk_set_standard_lookup.3 minix-man
|
./usr/man/man3/archive_read_disk_set_standard_lookup.3 minix-man
|
||||||
./usr/man/man3/archive_read_disk_set_symlink_hybrid.3 minix-man
|
./usr/man/man3/archive_read_disk_set_symlink_hybrid.3 minix-man
|
||||||
|
|
@ -947,41 +1002,84 @@
|
||||||
./usr/man/man3/archive_read_extract.3 minix-man
|
./usr/man/man3/archive_read_extract.3 minix-man
|
||||||
./usr/man/man3/archive_read_extract2.3 minix-man
|
./usr/man/man3/archive_read_extract2.3 minix-man
|
||||||
./usr/man/man3/archive_read_extract_set_progress_callback.3 minix-man
|
./usr/man/man3/archive_read_extract_set_progress_callback.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_filter.3 minix-man
|
||||||
./usr/man/man3/archive_read_finish.3 minix-man
|
./usr/man/man3/archive_read_finish.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_format.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_free.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_header.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_header2.3 minix-man
|
||||||
./usr/man/man3/archive_read_new.3 minix-man
|
./usr/man/man3/archive_read_new.3 minix-man
|
||||||
./usr/man/man3/archive_read_next_header.3 minix-man
|
./usr/man/man3/archive_read_next_header.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_next_header2.3 minix-man
|
./usr/man/man3/archive_read_next_header2.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_open.3 minix-man
|
./usr/man/man3/archive_read_open.3 minix-man
|
||||||
./usr/man/man3/archive_read_open2.3 minix-man
|
./usr/man/man3/archive_read_open2.3 minix-man
|
||||||
./usr/man/man3/archive_read_open_FILE.3 minix-man
|
./usr/man/man3/archive_read_open_FILE.3 minix-man
|
||||||
./usr/man/man3/archive_read_open_fd.3 minix-man
|
./usr/man/man3/archive_read_open_fd.3 minix-man
|
||||||
./usr/man/man3/archive_read_open_file.3 minix-man
|
./usr/man/man3/archive_read_open_file.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_open_filename.3 minix-man
|
./usr/man/man3/archive_read_open_filename.3 minix-man
|
||||||
./usr/man/man3/archive_read_open_memory.3 minix-man
|
./usr/man/man3/archive_read_open_memory.3 minix-man
|
||||||
./usr/man/man3/archive_read_set_filter_options.3 minix-man
|
./usr/man/man3/archive_read_set_filter_option.3 minix-man
|
||||||
./usr/man/man3/archive_read_set_format_options.3 minix-man
|
./usr/man/man3/archive_read_set_filter_options.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_read_set_format_option.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_set_format_options.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_read_set_option.3 minix-man
|
||||||
./usr/man/man3/archive_read_set_options.3 minix-man
|
./usr/man/man3/archive_read_set_options.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_compression_all.3 minix-man
|
./usr/man/man3/archive_read_set_passphrase_callback.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_compression_bzip2.3 minix-man
|
./usr/man/man3/archive_read_support_compression_all.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_compress.3 minix-man
|
./usr/man/man3/archive_read_support_compression_bzip2.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_gzip.3 minix-man
|
./usr/man/man3/archive_read_support_compression_compress.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_lzma.3 minix-man
|
./usr/man/man3/archive_read_support_compression_gzip.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_none.3 minix-man
|
./usr/man/man3/archive_read_support_compression_lzma.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_program.3 minix-man
|
./usr/man/man3/archive_read_support_compression_none.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_program_signature.3 minix-man
|
./usr/man/man3/archive_read_support_compression_program.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_read_support_compression_xz.3 minix-man
|
./usr/man/man3/archive_read_support_compression_program_signature.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_read_support_compression_xz.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_read_support_filter_all.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_bzip2.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_compress.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_gzip.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_lz4.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_lzma.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_none.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_program.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_program_signature.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_rpm.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_uu.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_filter_xz.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_7zip.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_all.3 minix-man
|
./usr/man/man3/archive_read_support_format_all.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_ar.3 minix-man
|
./usr/man/man3/archive_read_support_format_ar.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_by_code.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_cab.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_cpio.3 minix-man
|
./usr/man/man3/archive_read_support_format_cpio.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_empty.3 minix-man
|
./usr/man/man3/archive_read_support_format_empty.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_iso9660.3 minix-man
|
./usr/man/man3/archive_read_support_format_iso9660.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_lha.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_mtree.3 minix-man
|
./usr/man/man3/archive_read_support_format_mtree.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_rar.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_raw.3 minix-man
|
./usr/man/man3/archive_read_support_format_raw.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_tar.3 minix-man
|
./usr/man/man3/archive_read_support_format_tar.3 minix-man
|
||||||
|
./usr/man/man3/archive_read_support_format_xar.3 minix-man
|
||||||
./usr/man/man3/archive_read_support_format_zip.3 minix-man
|
./usr/man/man3/archive_read_support_format_zip.3 minix-man
|
||||||
./usr/man/man3/archive_set_error.3 minix-man
|
./usr/man/man3/archive_set_error.3 minix-man
|
||||||
./usr/man/man3/archive_util.3 minix-man
|
./usr/man/man3/archive_util.3 minix-man
|
||||||
./usr/man/man3/archive_write.3 minix-man
|
./usr/man/man3/archive_write.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_b64encode.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_by_name.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_bzip2.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_compress.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_grzip.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_gzip.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_lrzip.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_lz4.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_lzip.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_lzma.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_lzop.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_none.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_program.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_uuencode.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_add_filter_xz.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_blocksize.3 minix-man
|
||||||
./usr/man/man3/archive_write_close.3 minix-man
|
./usr/man/man3/archive_write_close.3 minix-man
|
||||||
./usr/man/man3/archive_write_data.3 minix-man
|
./usr/man/man3/archive_write_data.3 minix-man
|
||||||
./usr/man/man3/archive_write_disk.3 minix-man
|
./usr/man/man3/archive_write_disk.3 minix-man
|
||||||
|
|
@ -991,8 +1089,13 @@
|
||||||
./usr/man/man3/archive_write_disk_set_skip_file.3 minix-man
|
./usr/man/man3/archive_write_disk_set_skip_file.3 minix-man
|
||||||
./usr/man/man3/archive_write_disk_set_standard_lookup.3 minix-man
|
./usr/man/man3/archive_write_disk_set_standard_lookup.3 minix-man
|
||||||
./usr/man/man3/archive_write_disk_set_user_lookup.3 minix-man
|
./usr/man/man3/archive_write_disk_set_user_lookup.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_fail.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_filter.3 minix-man
|
||||||
./usr/man/man3/archive_write_finish.3 minix-man
|
./usr/man/man3/archive_write_finish.3 minix-man
|
||||||
./usr/man/man3/archive_write_finish_entry.3 minix-man
|
./usr/man/man3/archive_write_finish_entry.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_format.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_free.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_get_bytes_in_last_block.3 minix-man
|
||||||
./usr/man/man3/archive_write_get_bytes_per_block.3 minix-man
|
./usr/man/man3/archive_write_get_bytes_per_block.3 minix-man
|
||||||
./usr/man/man3/archive_write_header.3 minix-man
|
./usr/man/man3/archive_write_header.3 minix-man
|
||||||
./usr/man/man3/archive_write_new.3 minix-man
|
./usr/man/man3/archive_write_new.3 minix-man
|
||||||
|
|
@ -1001,22 +1104,47 @@
|
||||||
./usr/man/man3/archive_write_open_fd.3 minix-man
|
./usr/man/man3/archive_write_open_fd.3 minix-man
|
||||||
./usr/man/man3/archive_write_open_filename.3 minix-man
|
./usr/man/man3/archive_write_open_filename.3 minix-man
|
||||||
./usr/man/man3/archive_write_open_memory.3 minix-man
|
./usr/man/man3/archive_write_open_memory.3 minix-man
|
||||||
./usr/man/man3/archive_write_options.3 minix-man
|
./usr/man/man3/archive_write_options.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_bytes_in_last_block.3 minix-man
|
./usr/man/man3/archive_write_set_bytes_in_last_block.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_bytes_per_block.3 minix-man
|
./usr/man/man3/archive_write_set_bytes_per_block.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_callbacks.3 minix-man
|
./usr/man/man3/archive_write_set_callbacks.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compression_bzip2.3 minix-man
|
./usr/man/man3/archive_write_set_compression_bzip2.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compression_compress.3 minix-man
|
./usr/man/man3/archive_write_set_compression_compress.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compression_gzip.3 minix-man
|
./usr/man/man3/archive_write_set_compression_gzip.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compression_none.3 minix-man
|
./usr/man/man3/archive_write_set_compression_none.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compression_program.3 minix-man
|
./usr/man/man3/archive_write_set_compression_program.3 minix-man obsolete
|
||||||
./usr/man/man3/archive_write_set_compressor_options.3 minix-man
|
./usr/man/man3/archive_write_set_compressor_options.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_write_set_filter_option.3
|
||||||
|
./usr/man/man3/archive_write_set_format_7zip.3
|
||||||
|
./usr/man/man3/archive_write_set_format_ar.3
|
||||||
|
./usr/man/man3/archive_write_set_format_ar_bsd.3
|
||||||
|
./usr/man/man3/archive_write_set_format_ar_svr4.3
|
||||||
|
./usr/man/man3/archive_write_set_format_by_name.3
|
||||||
./usr/man/man3/archive_write_set_format_cpio.3 minix-man
|
./usr/man/man3/archive_write_set_format_cpio.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_cpio_newc.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_filter_by_ext.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_filter_by_ext_def.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_gnutar.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_iso9660.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_mtree.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_mtree_classic.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_mtree_default.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_option.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_format_pax.3 minix-man
|
./usr/man/man3/archive_write_set_format_pax.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_format_pax_restricted.3 minix-man
|
./usr/man/man3/archive_write_set_format_pax_restricted.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_raw.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_format_shar.3 minix-man
|
./usr/man/man3/archive_write_set_format_shar.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_format_shar_binary.3 minix-man
|
./usr/man/man3/archive_write_set_format_shar_binary.3 minix-man obsolete
|
||||||
|
./usr/man/man3/archive_write_set_format_shar_dump.3 minix-man
|
||||||
./usr/man/man3/archive_write_set_format_ustar.3 minix-man
|
./usr/man/man3/archive_write_set_format_ustar.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_v7tar.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_warc.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_xar.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_format_zip.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_option.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_options.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_passphrase.3 minix-man
|
||||||
|
./usr/man/man3/archive_write_set_passphrase_callback.3 minix-man
|
||||||
./usr/man/man3/asctime.3 minix-man
|
./usr/man/man3/asctime.3 minix-man
|
||||||
./usr/man/man3/asctime_r.3 minix-man
|
./usr/man/man3/asctime_r.3 minix-man
|
||||||
./usr/man/man3/asin.3 minix-man
|
./usr/man/man3/asin.3 minix-man
|
||||||
|
|
@ -2112,6 +2240,7 @@
|
||||||
./usr/man/man3/lgammaf_r.3 minix-man
|
./usr/man/man3/lgammaf_r.3 minix-man
|
||||||
./usr/man/man3/lh_stats.3 minix-man crypto
|
./usr/man/man3/lh_stats.3 minix-man crypto
|
||||||
./usr/man/man3/libarchive.3 minix-man
|
./usr/man/man3/libarchive.3 minix-man
|
||||||
|
./usr/man/man3/libarchive_changes.3 minix-man
|
||||||
./usr/man/man3/libarchive_internals.3 minix-man
|
./usr/man/man3/libarchive_internals.3 minix-man
|
||||||
./usr/man/man3/libblacklist.3 minix-man
|
./usr/man/man3/libblacklist.3 minix-man
|
||||||
./usr/man/man3/libmagic.3 minix-man
|
./usr/man/man3/libmagic.3 minix-man
|
||||||
|
|
|
||||||
6
external/bsd/libarchive/Makefile.inc
vendored
6
external/bsd/libarchive/Makefile.inc
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.inc,v 1.2 2010/02/20 02:55:53 joerg Exp $
|
# $NetBSD: Makefile.inc,v 1.3 2017/04/20 20:34:24 joerg Exp $
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
|
|
@ -12,4 +12,8 @@ CPPFLAGS+= -DPLATFORM_CONFIG_H=\"config_netbsd.h\"
|
||||||
LIBARCHIVE_FE_DIR!= cd ${.PARSEDIR}/lib/libarchive_fe && ${PRINTOBJDIR}
|
LIBARCHIVE_FE_DIR!= cd ${.PARSEDIR}/lib/libarchive_fe && ${PRINTOBJDIR}
|
||||||
LIBARCHIVE_FE= ${LIBARCHIVE_FE_DIR}/libarchive_fe.a
|
LIBARCHIVE_FE= ${LIBARCHIVE_FE_DIR}/libarchive_fe.a
|
||||||
|
|
||||||
|
# GCC applies the check even for same functions like strftime,
|
||||||
|
# completely defeating the purpose.
|
||||||
|
CWARNFLAGS.gcc+= -Wno-format-nonliteral
|
||||||
|
|
||||||
WARNS?= 4
|
WARNS?= 4
|
||||||
|
|
|
||||||
6
external/bsd/libarchive/bin/Makefile.inc
vendored
6
external/bsd/libarchive/bin/Makefile.inc
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: Makefile.inc,v 1.3 2010/11/02 19:14:53 joerg Exp $
|
# $NetBSD: Makefile.inc,v 1.4 2017/04/20 13:11:04 joerg Exp $
|
||||||
|
|
||||||
.include "../Makefile.inc"
|
.include "../Makefile.inc"
|
||||||
|
|
||||||
|
|
@ -8,6 +8,6 @@ BINDIR= /bin
|
||||||
LDSTATIC?= -static
|
LDSTATIC?= -static
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
DPADD= ${LIBARCHIVE_FE} ${LIBARCHIVE} ${LIBBZ2} ${LIBLZMA} ${LIBZ}
|
DPADD= ${LIBARCHIVE_FE} ${LIBARCHIVE} ${LIBEXPAT} ${LIBBZ2} ${LIBLZMA} ${LIBZ} ${LIBCRYPTO}
|
||||||
LDADD= -L${LIBARCHIVE_FE_DIR} -larchive_fe -larchive -lbz2 -llzma -lz
|
LDADD= -L${LIBARCHIVE_FE_DIR} -larchive_fe -larchive -lexpat -lbz2 -llzma -lz -lcrypto
|
||||||
CPPFLAGS+= -I${LIBARCHIVEDIR}/libarchive_fe
|
CPPFLAGS+= -I${LIBARCHIVEDIR}/libarchive_fe
|
||||||
|
|
|
||||||
4
external/bsd/libarchive/bin/tar/Makefile
vendored
4
external/bsd/libarchive/bin/tar/Makefile
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
# $NetBSD: Makefile,v 1.4 2011/09/09 12:43:14 christos Exp $
|
# $NetBSD: Makefile,v 1.5 2017/04/20 13:11:04 joerg Exp $
|
||||||
|
|
||||||
PROG= tar
|
PROG= tar
|
||||||
SRCS= bsdtar.c cmdline.c getdate.c read.c subst.c tree.c util.c write.c
|
SRCS= bsdtar.c cmdline.c creation_set.c read.c subst.c util.c write.c
|
||||||
|
|
||||||
.include <bsd.init.mk>
|
.include <bsd.init.mk>
|
||||||
|
|
||||||
|
|
|
||||||
98
external/bsd/libarchive/dist/CONTRIBUTING.md
vendored
Normal file
98
external/bsd/libarchive/dist/CONTRIBUTING.md
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
Thank you for helping us improve libarchive.
|
||||||
|
The following guidelines will help ensure your contribution gets prompt attention.
|
||||||
|
|
||||||
|
# Bugs and other Issues
|
||||||
|
|
||||||
|
If you encounter any problems with libarchive,
|
||||||
|
[please file an issue on our issue tracker](https://github.com/libarchive/libarchive/issues).
|
||||||
|
|
||||||
|
All bug reports should include the following information. You can copy the text below directly into the issue tracker to get started:
|
||||||
|
|
||||||
|
```
|
||||||
|
Basic Information
|
||||||
|
Version of libarchive:
|
||||||
|
How you obtained it: (build from source, pre-packaged binary, etc)
|
||||||
|
Operating system and version:
|
||||||
|
What compiler and/or IDE you are using (include version):
|
||||||
|
|
||||||
|
If you are using a pre-packaged binary
|
||||||
|
Exact package name and version:
|
||||||
|
Repository you obtained it from:
|
||||||
|
|
||||||
|
Description of the problem you are seeing:
|
||||||
|
What did you do?
|
||||||
|
What did you expect to happen?
|
||||||
|
What actually happened?
|
||||||
|
What log files or error messages were produced?
|
||||||
|
|
||||||
|
How the libarchive developers can reproduce your problem:
|
||||||
|
What other software was involved?
|
||||||
|
What other files were involved?
|
||||||
|
How can we obtain any of the above?
|
||||||
|
```
|
||||||
|
|
||||||
|
Depending on the specific type of issue, other information will be helpful:
|
||||||
|
|
||||||
|
## Test Failures
|
||||||
|
|
||||||
|
If you see any test failures, please include the information above and also:
|
||||||
|
|
||||||
|
* Names of the tests that failed.
|
||||||
|
|
||||||
|
* Look for the .log files in the /tmp/libarchive_test_*date-and-time* directories. (On Mac OS, look in $TMPDIR which is different than /tmp.)
|
||||||
|
|
||||||
|
Please paste the .log files you will find there directly into your report.
|
||||||
|
|
||||||
|
|
||||||
|
## Problems using libarchive in a program
|
||||||
|
|
||||||
|
If you are trying to write a program using libarchive, please include the information above and also:
|
||||||
|
|
||||||
|
* It will help us if we can actually run the program. This is easiest if you can provide source to a short program that illustrates your problem.
|
||||||
|
|
||||||
|
* If you have a sufficiently short program that shows the problem, you can either paste it into the report or [put it into a gist](https://gist.github.com).
|
||||||
|
|
||||||
|
|
||||||
|
## Libarchive produced incorrect output
|
||||||
|
|
||||||
|
Please tell us what program you ran, any command-line arguments you provided, and details of the input files (`ls -l` output is helpful here). If the problem involved a command-line program, please copy the full terminal text into the report, including the command line and any error messages.
|
||||||
|
|
||||||
|
Please try to make the output file available to us. Unless it is very large, you can upload it into a fresh github repository and provide a link in your issue report.
|
||||||
|
|
||||||
|
|
||||||
|
## Libarchive could not read a particular input file
|
||||||
|
|
||||||
|
Note: If you can provide a **very small** input file that reproduces the problem, we can add that to our test suite. This will ensure that the bug does not reappear in the future.
|
||||||
|
|
||||||
|
A link to the relevant file is usually sufficient.
|
||||||
|
|
||||||
|
If you cannot provide the input file or a link to the file, please let us know if there is some other way to obtain it.
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation improvements
|
||||||
|
|
||||||
|
We are always interested in improving the libarchive documentation. Please tell us about any errors you find, including:
|
||||||
|
|
||||||
|
* Typos or errors in the manpages provided with libarchive source.
|
||||||
|
|
||||||
|
* Mistakes in the [libarchive Wiki](https://github.com/libarchive/libarchive/wiki)
|
||||||
|
|
||||||
|
* Problems with the PDF or Wiki files that are automatically generated from the manpages.
|
||||||
|
|
||||||
|
|
||||||
|
# Code Submissions
|
||||||
|
|
||||||
|
We welcome all code submissions. But of course, some code submissions are easier for us to respond to than others. The best code submissions:
|
||||||
|
|
||||||
|
* Address a single issue. There have been many cases where a simple fix to an obvious problem did not get handled for months because the patch that was provided also included an unrelated change affecting an especially complex area of the code.
|
||||||
|
|
||||||
|
* Follow existing libarchive code style and conventions. Libarchive generally follows [BSD KNF](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9) for formatting code.
|
||||||
|
|
||||||
|
* Do not make unnecessary changes to existing whitespace, capitalization, or spelling.
|
||||||
|
|
||||||
|
* Include detailed instructions for reproducing the problem you're fixing. We do try to verify that a submission actually fixes a real problem. If we can't reproduce the problem, it will take us longer to evaluate the fix. For this reason, we encourage you to file an issue report first with details on reproducing the problem, then refer to that issue in your pull request.
|
||||||
|
|
||||||
|
* Includes a test case. The libarchive Wiki has [detailed documentation for adding new test cases](https://github.com/libarchive/libarchive/wiki/LibarchiveAddingTest).
|
||||||
|
|
||||||
|
* Are provided via Github pull requests. We welcome patches in almost any format, but github's pull request management makes it significantly easier for us to evaluate and test changes.
|
||||||
|
|
||||||
7
external/bsd/libarchive/dist/COPYING
vendored
7
external/bsd/libarchive/dist/COPYING
vendored
|
|
@ -16,13 +16,12 @@ the actual statements in the files are controlling.
|
||||||
a 3-clause UC Regents copyright; please read the individual source
|
a 3-clause UC Regents copyright; please read the individual source
|
||||||
files for details:
|
files for details:
|
||||||
libarchive/archive_entry.c
|
libarchive/archive_entry.c
|
||||||
libarchive/archive_read_support_compression_compress.c
|
libarchive/archive_read_support_filter_compress.c
|
||||||
libarchive/archive_write_set_compression_compress.c
|
libarchive/archive_write_add_filter_compress.c
|
||||||
libarchive/mtree.5
|
libarchive/mtree.5
|
||||||
tar/matching.c
|
|
||||||
|
|
||||||
* The following source files are in the public domain:
|
* The following source files are in the public domain:
|
||||||
tar/getdate.c
|
libarchive/archive_getdate.c
|
||||||
|
|
||||||
* The build files---including Makefiles, configure scripts,
|
* The build files---including Makefiles, configure scripts,
|
||||||
and auxiliary scripts used as part of the compile process---have
|
and auxiliary scripts used as part of the compile process---have
|
||||||
|
|
|
||||||
172
external/bsd/libarchive/dist/NEWS
vendored
172
external/bsd/libarchive/dist/NEWS
vendored
|
|
@ -1,22 +1,162 @@
|
||||||
Jun 30, 2010: libarchive 2.8.4 released
|
Mar 16, 2017: NFSv4 ACL support for Linux (librichacl)
|
||||||
Jun 30, 2010: Improved reliability of hash function detection
|
|
||||||
Jun 30, 2010: Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minux
|
|
||||||
|
|
||||||
Mar 14, 2010: libarchive 2.8.3 released
|
Feb 26, 2017: libarchive 3.3.1 released
|
||||||
Mar 14, 2010: Symlink dereference fix for Linux broke the build there; corrected.
|
Security & Feature release
|
||||||
|
|
||||||
Mar 14, 2010: libarchive 2.8.2 released
|
Feb 19, 2017: libarchive 3.3.0 released
|
||||||
Mar 12, 2010: Fix NULL deference for short self-extracting zip archives.
|
Security & Feature release
|
||||||
|
|
||||||
|
Jan 29, 2017: Limited NFSv4 ACL support for Mac OS (Darwin)
|
||||||
|
|
||||||
|
Jan 10, 2017: POSIX.1e and NFSv4 ACL support for Solaris and derivates
|
||||||
|
|
||||||
|
Dec 27, 2016: NFSv4 ACL read and write support for pax
|
||||||
|
Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w()
|
||||||
|
|
||||||
|
Nov, 2016: libarchive is now being tested by the OSS-Fuzz project
|
||||||
|
|
||||||
|
Oct 26, 2016: Remove liblzmadec support
|
||||||
|
|
||||||
|
Oct 23, 2016: libarchive 3.2.2 released
|
||||||
|
Security release
|
||||||
|
|
||||||
|
Jun 20, 2016: libarchive 3.2.1 released
|
||||||
|
This fixes a handful of security and other critical issues with 3.2.0
|
||||||
|
|
||||||
|
May 01, 2016: libarchive 3.2.0 released
|
||||||
|
|
||||||
|
Apr 09, 2016: libarchive 3.1.901a released
|
||||||
|
Another test release in preparation for 3.2.0
|
||||||
|
|
||||||
|
Feb 13, 2016: libarchive 3.1.900a released
|
||||||
|
This is a test release in preparation for 3.2.0
|
||||||
|
|
||||||
|
Oct 21, 2015: Preliminary port to OSF
|
||||||
|
|
||||||
|
Apr 11, 2015: libarchive's issue tracker is now hosted at GitHub.
|
||||||
|
https://github.com/libarchive/libarchive/issues
|
||||||
|
|
||||||
|
Early 2015: Many fixes to crash and overflow bugs thanks to Hanno Boeck
|
||||||
|
|
||||||
|
Oct 13, 2014: Zip encryption and decryption support
|
||||||
|
|
||||||
|
Aug 13, 2014: Add support for lz4 compression.
|
||||||
|
|
||||||
|
Jun 10, 2014: Add warc format support
|
||||||
|
|
||||||
|
May 3, 2014: Add experimental Zip streaming extension
|
||||||
|
|
||||||
|
Apr 6, 2014: Add bsdcat command-line tool
|
||||||
|
|
||||||
|
Jan 12, 2014: Add Zip64 support
|
||||||
|
|
||||||
|
Dec 1, 2013: Rewrite Zip write logic
|
||||||
|
|
||||||
|
Jul 1, 2013: Add ability to detect encrypted entries for many formats
|
||||||
|
(This does not add the ability to *decrypt* those entries, however)
|
||||||
|
|
||||||
|
Feb 23, 2013: "raw" write support added
|
||||||
|
|
||||||
|
Feb 09, 2013: libarchive 3.1.2 released
|
||||||
|
|
||||||
|
Jan 28, 2013: libarchive's new website moved to http://www.libarchive.org.
|
||||||
|
|
||||||
|
Jan 13, 2013: libarchive 3.1.1 released
|
||||||
|
|
||||||
|
Jan 13, 2013: libarchive 3.1.0 released
|
||||||
|
|
||||||
|
Dec 07, 2012: Implement functions to manually set the format and filters used.
|
||||||
|
|
||||||
|
Nov 11, 2012: Add support for __MACOSX directory in Zip archives, which resource
|
||||||
|
forks are stored in.
|
||||||
|
|
||||||
|
Oct 20, 2012: Add support for writing v7 tar format.
|
||||||
|
|
||||||
|
Oct 09, 2012: Add support for grzip compression.
|
||||||
|
|
||||||
|
Oct 07, 2012: Introduce b64encode filter.
|
||||||
|
Oct 07, 2012: Introduce uuencode filter.
|
||||||
|
|
||||||
|
Oct 06, 2012: Add support for lzop.
|
||||||
|
|
||||||
|
Sep 27, 2012: Implement function used to seek within data blocks.
|
||||||
|
(Currently only supported for uncompressed RAR archives).
|
||||||
|
|
||||||
|
Apr 22, 2012: Add basic archive read and write filter support for lrzip.
|
||||||
|
|
||||||
|
Mar 27, 2012: libarchive 3.0.4 released
|
||||||
|
|
||||||
|
Feb 05, 2012: libarchive development now hosted at GitHub.
|
||||||
|
http://libarchive.github.com/
|
||||||
|
Feb 05, 2012: libarchive's issue tracker remains at Google Code.
|
||||||
|
http://code.google.com/p/libarchive/issues/list
|
||||||
|
Feb 05, 2012: libarchive's mailing lists remain at Google Groups.
|
||||||
|
|
||||||
|
Dec 24, 2011: libarchive 3.0.2 released
|
||||||
|
Dec 23, 2011: Various fixes merged from FreeBSD
|
||||||
|
Dec 23, 2011: Symlink support in Zip reader and writer
|
||||||
|
Dec 23, 2011: Robustness fixes to 7Zip reader
|
||||||
|
|
||||||
|
Nov 27, 2011: libarchive 3.0.1b released
|
||||||
|
|
||||||
|
Nov 26, 2011: 7Zip reader
|
||||||
|
Nov 26, 2011: Small fixes to ISO and Zip to improve robustness with corrupted input
|
||||||
|
Nov 24, 2011: Improve streaming Zip reader's support for uncompressed entries
|
||||||
|
Nov 20, 2011: New seeking Zip reader supports SFX Zip archives
|
||||||
|
Nov 20, 2011: Build fixes on Windows
|
||||||
|
|
||||||
|
Nov 13, 2011: libarchive 3.0.0a released
|
||||||
|
|
||||||
|
Nov 06, 2011: Update shared-library version calculations for libarchive 3.x
|
||||||
|
Sep 04, 2011: Fix tar -s; follow GNU tar for controlling hardlink/symlink substitutions
|
||||||
|
Aug 18, 2011: Fix reading ISO images built by NetBSD's mkisofs
|
||||||
|
Aug 15, 2011: Old archive_read_support_compression_XXX functions are deprecated and
|
||||||
|
will disappear in libarchive 4.0.
|
||||||
|
Jun 26, 2011: RAR reader
|
||||||
|
Jun 16, 2011: Add tar:compat-2x option to emulate broken libarchive 2.x
|
||||||
|
handling of pax UTF-8 headers
|
||||||
|
Apr 25, 2011: Refactor read_open() into a collection of single-item setters;
|
||||||
|
support the old interfaces as wrappers
|
||||||
|
Apr 12, 2011: Split disk writer into separate POSIX and Windows implementations
|
||||||
|
Apr 10, 2011: Improvements to character translations on Windows.
|
||||||
|
Mar 30, 2011: More work to return errors instead of calling abort()
|
||||||
|
Mar 23, 2011: Add charset option to many writers to control MBCS filenames
|
||||||
|
Mar 17, 2011: Overhauled support for per-format extension options
|
||||||
|
Mar 17, 2011: Track character set used for mbcs strings, support
|
||||||
|
translating to/from user-specified locale
|
||||||
|
Mar 09, 2011: Recognize mtree files without requiring a signature
|
||||||
|
Mar 06, 2011: Use iconv to convert to/from Unicode instead of making bad
|
||||||
|
assumptions about the C90 character set translation functions
|
||||||
|
Feb 17, 2011: Fixes for AIX, TRU64, and other platforms
|
||||||
|
Dec 22, 2010: CAB reader
|
||||||
|
Dec 20, 2010: LHA/LZH reader
|
||||||
|
Jul 03, 2010: minitar example demonstrates archive_read_disk directory traversal
|
||||||
|
Jun 29, 2010: Many improvements to ISO reader compatibility
|
||||||
|
Jun 26, 2010: Use larger buffers when copy files into an archive
|
||||||
|
Jun 18, 2010: Reimplement Mac OS extensions in libarchive
|
||||||
|
Jun 09, 2010: archive_read_disk now supports traversals
|
||||||
|
May 28, 2010: XAR writer
|
||||||
|
May 16, 2010: Fix ^T handling; don't exit on interrupted reads and writes
|
||||||
|
May 09, 2010: Improved detection of platform-specific crypto support
|
||||||
|
May 04, 2010: lzip read and write filters
|
||||||
|
May 01, 2010: New options: tar --gid --gname --uid --uname
|
||||||
|
Apr 28, 2010: Use Red-black tree for ISO reader/writer to improve performance
|
||||||
|
Apr 17, 2010: Minimal writer for legacy GNU tar format
|
||||||
Mar 12, 2010: Don't dereference symlinks on Linux when reading ACLs.
|
Mar 12, 2010: Don't dereference symlinks on Linux when reading ACLs.
|
||||||
Mar 07, 2010: Better detection of SHA2 support for old OpenSSL versions.
|
|
||||||
Mar 07, 2010: Fix parsing of input files for bsdtar -T.
|
|
||||||
Mar 07, 2010: Do not leak setup_xattr into the global namespace.
|
|
||||||
|
|
||||||
Mar 06, 2010: libarchive 2.8.1 released
|
|
||||||
Mar 06, 2010: Fix build when an older libarchive is already installed
|
Mar 06, 2010: Fix build when an older libarchive is already installed
|
||||||
Mar 03, 2010: Use O_BINARY opening files in bsdtar
|
Feb 28, 2010: Relax handling of state failures; misuse by clients now generally
|
||||||
Mar 02, 2010: Include missing archive_crc32.h
|
results in a sticky ARCHIVE_FATAL rather than a visit to abort()
|
||||||
Mar 01, 2010: Correctly include iconv.h required by libxml2.
|
Feb 25, 2010: ISO writer
|
||||||
|
Feb 21, 2010: Split many man pages into smaller chunks.
|
||||||
|
Feb 21, 2010: Performance: Cheat on block sizes when reading archives from disk.
|
||||||
|
Feb 21, 2010: Use int64_t instead of off_t, dev_t, ino_t, uid_t, and gid_t
|
||||||
|
Feb 20, 2010: Document new ACL functions.
|
||||||
|
Feb 19, 2010: Support multiple write filters
|
||||||
|
Feb 07, 2010: Remove some legacy libarchive 1.x APIs
|
||||||
|
Feb 04, 2010: Read afio headers
|
||||||
|
Feb 02, 2010: Archive sparse files compatibly with GNU tar
|
||||||
|
Feb 01, 2010: Integrate Apple extensions for Mac OS extended attributes into bsdtar
|
||||||
|
Jan 31, 2010: Support cpio -V
|
||||||
|
|
||||||
Feb 04, 2010: libarchive 2.8.0 released
|
Feb 04, 2010: libarchive 2.8.0 released
|
||||||
Jan 17, 2010: Fix error handling for 'echo nonexistent | cpio -o'
|
Jan 17, 2010: Fix error handling for 'echo nonexistent | cpio -o'
|
||||||
|
|
@ -155,7 +295,7 @@ May 04, 2008: libarchive 2.5.3b released
|
||||||
* libarchive: Mark which entry strings are set; be accurate about
|
* libarchive: Mark which entry strings are set; be accurate about
|
||||||
distinguishing empty strings ("") from unset ones (NULL)
|
distinguishing empty strings ("") from unset ones (NULL)
|
||||||
* tar: Don't crash reading entries with empty filenames
|
* tar: Don't crash reading entries with empty filenames
|
||||||
* libarchive_test, bsdtar_test, bsdcpio_test: Better detaults:
|
* libarchive_test, bsdtar_test, bsdcpio_test: Better defaults:
|
||||||
run all tests, delete temp dirs, summarize repeated failures
|
run all tests, delete temp dirs, summarize repeated failures
|
||||||
* -no-undefined to libtool for Cygwin
|
* -no-undefined to libtool for Cygwin
|
||||||
* libarchive_test: Skip large file tests on systems with 32-bit off_t
|
* libarchive_test: Skip large file tests on systems with 32-bit off_t
|
||||||
|
|
|
||||||
137
external/bsd/libarchive/dist/README
vendored
137
external/bsd/libarchive/dist/README
vendored
|
|
@ -1,137 +0,0 @@
|
||||||
README for libarchive bundle.
|
|
||||||
|
|
||||||
Questions? Issues?
|
|
||||||
* http://libarchive.googlecode.com/ is the home for ongoing
|
|
||||||
libarchive development, including issue tracker, additional
|
|
||||||
documentation, and links to the libarchive mailing lists.
|
|
||||||
|
|
||||||
This distribution bundle includes the following components:
|
|
||||||
* libarchive: a library for reading and writing streaming archives
|
|
||||||
* tar: the 'bsdtar' program is a full-featured 'tar'
|
|
||||||
replacement built on libarchive
|
|
||||||
* cpio: the 'bsdcpio' program is a different interface to
|
|
||||||
essentially the same functionality
|
|
||||||
* examples: Some small example programs that you may find useful.
|
|
||||||
* examples/minitar: a compact sample demonstrating use of libarchive.
|
|
||||||
I use this for testing link pollution; it should produce a very
|
|
||||||
small executable file on most systems.
|
|
||||||
* contrib: Various items sent to me by third parties;
|
|
||||||
please contact the authors with any questions.
|
|
||||||
|
|
||||||
The top-level directory contains the following information files:
|
|
||||||
* NEWS - highlights of recent changes
|
|
||||||
* COPYING - what you can do with this
|
|
||||||
* INSTALL - installation instructions
|
|
||||||
* README - this file
|
|
||||||
* configure - configuration script, see INSTALL for details.
|
|
||||||
* CMakeLists.txt - input for "cmake" build tool, see INSTALL
|
|
||||||
|
|
||||||
The following files in the top-level directory are used by the
|
|
||||||
'configure' script:
|
|
||||||
* Makefile.am, aclocal.m4, configure.ac
|
|
||||||
- used to build this distribution, only needed by maintainers
|
|
||||||
* Makefile.in, config.h.in
|
|
||||||
- templates used by configure script
|
|
||||||
|
|
||||||
Guide to Documentation installed by this system:
|
|
||||||
* bsdtar.1 explains the use of the bsdtar program
|
|
||||||
* bsdcpio.1 explains the use of the bsdcpio program
|
|
||||||
* libarchive.3 gives an overview of the library as a whole
|
|
||||||
* archive_read.3, archive_write.3, archive_write_disk.3, and
|
|
||||||
archive_read_disk.3 provide detailed calling sequences for the read
|
|
||||||
and write APIs
|
|
||||||
* archive_entry.3 details the "struct archive_entry" utility class
|
|
||||||
* archive_internals.3 provides some insight into libarchive's
|
|
||||||
internal structure and operation.
|
|
||||||
* libarchive-formats.5 documents the file formats supported by the library
|
|
||||||
* cpio.5, mtree.5, and tar.5 provide detailed information about these
|
|
||||||
popular archive formats, including hard-to-find details about
|
|
||||||
modern cpio and tar variants.
|
|
||||||
The manual pages above are provided in the 'doc' directory in
|
|
||||||
a number of different formats.
|
|
||||||
|
|
||||||
You should also read the copious comments in "archive.h" and the
|
|
||||||
source code for the sample programs for more details. Please let me
|
|
||||||
know about any errors or omissions you find.
|
|
||||||
|
|
||||||
Currently, the library automatically detects and reads the following:
|
|
||||||
* gzip compression
|
|
||||||
* bzip2 compression
|
|
||||||
* compress/LZW compression
|
|
||||||
* lzma and xz compression
|
|
||||||
* GNU tar format (including GNU long filenames, long link names, and
|
|
||||||
sparse files)
|
|
||||||
* Solaris 9 extended tar format (including ACLs)
|
|
||||||
* Old V7 tar archives
|
|
||||||
* POSIX ustar
|
|
||||||
* POSIX pax interchange format
|
|
||||||
* POSIX octet-oriented cpio
|
|
||||||
* SVR4 ASCII cpio
|
|
||||||
* POSIX octet-oriented cpio
|
|
||||||
* Binary cpio (big-endian or little-endian)
|
|
||||||
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
|
|
||||||
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
|
||||||
* GNU and BSD 'ar' archives
|
|
||||||
* 'mtree' format
|
|
||||||
|
|
||||||
The library can write:
|
|
||||||
* gzip compression
|
|
||||||
* bzip2 compression
|
|
||||||
* compress/LZW compression
|
|
||||||
* lzma and xz compression
|
|
||||||
* POSIX ustar
|
|
||||||
* POSIX pax interchange format
|
|
||||||
* "restricted" pax format, which will create ustar archives except for
|
|
||||||
entries that require pax extensions (for long filenames, ACLs, etc).
|
|
||||||
* POSIX octet-oriented cpio
|
|
||||||
* SVR4 "newc" cpio
|
|
||||||
* shar archives
|
|
||||||
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
|
||||||
* GNU and BSD 'ar' archives
|
|
||||||
* 'mtree' format
|
|
||||||
|
|
||||||
Notes about the library architecture:
|
|
||||||
|
|
||||||
* This is a heavily stream-oriented system. There is no direct
|
|
||||||
support for in-place modification or random access.
|
|
||||||
|
|
||||||
* The library is designed to be extended with new compression and
|
|
||||||
archive formats. The only requirement is that the format be
|
|
||||||
readable or writable as a stream and that each archive entry be
|
|
||||||
independent. There are articles on the libarchive Wiki explaining
|
|
||||||
how to extend libarchive.
|
|
||||||
|
|
||||||
* On read, compression and format are always detected automatically.
|
|
||||||
|
|
||||||
* I've attempted to minimize static link pollution. If you don't
|
|
||||||
explicitly invoke a particular feature (such as support for a
|
|
||||||
particular compression or format), it won't get pulled in.
|
|
||||||
In particular, if you don't explicitly enable a particular
|
|
||||||
compression or decompression support, you won't need to link
|
|
||||||
against the corresponding compression or decompression libraries.
|
|
||||||
This also reduces the size of statically-linked binaries in
|
|
||||||
environments where that matters.
|
|
||||||
|
|
||||||
* On read, the library accepts whatever blocks you hand it.
|
|
||||||
Your read callback is free to pass the library a byte at a time
|
|
||||||
or mmap the entire archive and give it to the library at once.
|
|
||||||
On write, the library always produces correctly-blocked output.
|
|
||||||
|
|
||||||
* The object-style approach allows you to have multiple archive streams
|
|
||||||
open at once. bsdtar uses this in its "@archive" extension.
|
|
||||||
|
|
||||||
* The archive itself is read/written using callback functions.
|
|
||||||
You can read an archive directly from an in-memory buffer or
|
|
||||||
write it to a socket, if you wish. There are some utility
|
|
||||||
functions to provide easy-to-use "open file," etc, capabilities.
|
|
||||||
|
|
||||||
* The read/write APIs are designed to allow individual entries
|
|
||||||
to be read or written to any data source: You can create
|
|
||||||
a block of data in memory and add it to a tar archive without
|
|
||||||
first writing a temporary file. You can also read an entry from
|
|
||||||
an archive and write the data directly to a socket. If you want
|
|
||||||
to read/write entries to disk, there are convenience functions to
|
|
||||||
make this especially easy.
|
|
||||||
|
|
||||||
* Note: "pax interchange format" is really an extended tar format,
|
|
||||||
despite what the name says.
|
|
||||||
222
external/bsd/libarchive/dist/README.md
vendored
Normal file
222
external/bsd/libarchive/dist/README.md
vendored
Normal file
|
|
@ -0,0 +1,222 @@
|
||||||
|
# Welcome to libarchive!
|
||||||
|
|
||||||
|
The libarchive project develops a portable, efficient C library that
|
||||||
|
can read and write streaming archives in a variety of formats. It
|
||||||
|
also includes implementations of the common `tar`, `cpio`, and `zcat`
|
||||||
|
command-line tools that use the libarchive library.
|
||||||
|
|
||||||
|
## Questions? Issues?
|
||||||
|
|
||||||
|
* http://www.libarchive.org is the home for ongoing
|
||||||
|
libarchive development, including documentation,
|
||||||
|
and links to the libarchive mailing lists.
|
||||||
|
* To report an issue, use the issue tracker at
|
||||||
|
https://github.com/libarchive/libarchive/issues
|
||||||
|
* To submit an enhancement to libarchive, please
|
||||||
|
submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls
|
||||||
|
|
||||||
|
## Contents of the Distribution
|
||||||
|
|
||||||
|
This distribution bundle includes the following major components:
|
||||||
|
|
||||||
|
* **libarchive**: a library for reading and writing streaming archives
|
||||||
|
* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive
|
||||||
|
* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality
|
||||||
|
* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such
|
||||||
|
* **examples**: Some small example programs that you may find useful.
|
||||||
|
* **examples/minitar**: a compact sample demonstrating use of libarchive.
|
||||||
|
* **contrib**: Various items sent to me by third parties; please contact the authors with any questions.
|
||||||
|
|
||||||
|
The top-level directory contains the following information files:
|
||||||
|
|
||||||
|
* **NEWS** - highlights of recent changes
|
||||||
|
* **COPYING** - what you can do with this
|
||||||
|
* **INSTALL** - installation instructions
|
||||||
|
* **README** - this file
|
||||||
|
* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
|
||||||
|
* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`).
|
||||||
|
|
||||||
|
The following files in the top-level directory are used by the 'configure' script:
|
||||||
|
* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers
|
||||||
|
* `Makefile.in`, `config.h.in` - templates used by configure script
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
In addition to the informational articles and documentation
|
||||||
|
in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
|
||||||
|
the distribution also includes a number of manual pages:
|
||||||
|
|
||||||
|
* bsdtar.1 explains the use of the bsdtar program
|
||||||
|
* bsdcpio.1 explains the use of the bsdcpio program
|
||||||
|
* bsdcat.1 explains the use of the bsdcat program
|
||||||
|
* libarchive.3 gives an overview of the library as a whole
|
||||||
|
* archive_read.3, archive_write.3, archive_write_disk.3, and
|
||||||
|
archive_read_disk.3 provide detailed calling sequences for the read
|
||||||
|
and write APIs
|
||||||
|
* archive_entry.3 details the "struct archive_entry" utility class
|
||||||
|
* archive_internals.3 provides some insight into libarchive's
|
||||||
|
internal structure and operation.
|
||||||
|
* libarchive-formats.5 documents the file formats supported by the library
|
||||||
|
* cpio.5, mtree.5, and tar.5 provide detailed information about these
|
||||||
|
popular archive formats, including hard-to-find details about
|
||||||
|
modern cpio and tar variants.
|
||||||
|
|
||||||
|
The manual pages above are provided in the 'doc' directory in
|
||||||
|
a number of different formats.
|
||||||
|
|
||||||
|
You should also read the copious comments in `archive.h` and the
|
||||||
|
source code for the sample programs for more details. Please let us
|
||||||
|
know about any errors or omissions you find.
|
||||||
|
|
||||||
|
## Supported Formats
|
||||||
|
|
||||||
|
Currently, the library automatically detects and reads the following fomats:
|
||||||
|
* Old V7 tar archives
|
||||||
|
* POSIX ustar
|
||||||
|
* GNU tar format (including GNU long filenames, long link names, and sparse files)
|
||||||
|
* Solaris 9 extended tar format (including ACLs)
|
||||||
|
* POSIX pax interchange format
|
||||||
|
* POSIX octet-oriented cpio
|
||||||
|
* SVR4 ASCII cpio
|
||||||
|
* POSIX octet-oriented cpio
|
||||||
|
* Binary cpio (big-endian or little-endian)
|
||||||
|
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
|
||||||
|
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
|
||||||
|
* GNU and BSD 'ar' archives
|
||||||
|
* 'mtree' format
|
||||||
|
* 7-Zip archives
|
||||||
|
* Microsoft CAB format
|
||||||
|
* LHA and LZH archives
|
||||||
|
* RAR archives (with some limitations due to RAR's proprietary status)
|
||||||
|
* XAR archives
|
||||||
|
|
||||||
|
The library also detects and handles any of the following before evaluating the archive:
|
||||||
|
* uuencoded files
|
||||||
|
* files with RPM wrapper
|
||||||
|
* gzip compression
|
||||||
|
* bzip2 compression
|
||||||
|
* compress/LZW compression
|
||||||
|
* lzma, lzip, and xz compression
|
||||||
|
* lz4 compression
|
||||||
|
* lzop compression
|
||||||
|
|
||||||
|
The library can create archives in any of the following formats:
|
||||||
|
* POSIX ustar
|
||||||
|
* POSIX pax interchange format
|
||||||
|
* "restricted" pax format, which will create ustar archives except for
|
||||||
|
entries that require pax extensions (for long filenames, ACLs, etc).
|
||||||
|
* Old GNU tar format
|
||||||
|
* Old V7 tar format
|
||||||
|
* POSIX octet-oriented cpio
|
||||||
|
* SVR4 "newc" cpio
|
||||||
|
* shar archives
|
||||||
|
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
||||||
|
* GNU and BSD 'ar' archives
|
||||||
|
* 'mtree' format
|
||||||
|
* ISO9660 format
|
||||||
|
* 7-Zip archives
|
||||||
|
* XAR archives
|
||||||
|
|
||||||
|
When creating archives, the result can be filtered with any of the following:
|
||||||
|
* uuencode
|
||||||
|
* gzip compression
|
||||||
|
* bzip2 compression
|
||||||
|
* compress/LZW compression
|
||||||
|
* lzma, lzip, and xz compression
|
||||||
|
* lz4 compression
|
||||||
|
* lzop compression
|
||||||
|
|
||||||
|
## Notes about the Library Design
|
||||||
|
|
||||||
|
The following notes address many of the most common
|
||||||
|
questions we are asked about libarchive:
|
||||||
|
|
||||||
|
* This is a heavily stream-oriented system. That means that
|
||||||
|
it is optimized to read or write the archive in a single
|
||||||
|
pass from beginning to end. For example, this allows
|
||||||
|
libarchive to process archives too large to store on disk
|
||||||
|
by processing them on-the-fly as they are read from or
|
||||||
|
written to a network or tape drive. This also makes
|
||||||
|
libarchive useful for tools that need to produce
|
||||||
|
archives on-the-fly (such as webservers that provide
|
||||||
|
archived contents of a users account).
|
||||||
|
|
||||||
|
* In-place modification and random access to the contents
|
||||||
|
of an archive are not directly supported. For some formats,
|
||||||
|
this is not an issue: For example, tar.gz archives are not
|
||||||
|
designed for random access. In some other cases, libarchive
|
||||||
|
can re-open an archive and scan it from the beginning quickly
|
||||||
|
enough to provide the needed abilities even without true
|
||||||
|
random access. Of course, some applications do require true
|
||||||
|
random access; those applications should consider alternatives
|
||||||
|
to libarchive.
|
||||||
|
|
||||||
|
* The library is designed to be extended with new compression and
|
||||||
|
archive formats. The only requirement is that the format be
|
||||||
|
readable or writable as a stream and that each archive entry be
|
||||||
|
independent. There are articles on the libarchive Wiki explaining
|
||||||
|
how to extend libarchive.
|
||||||
|
|
||||||
|
* On read, compression and format are always detected automatically.
|
||||||
|
|
||||||
|
* The same API is used for all formats; in particular, it's very
|
||||||
|
easy for software using libarchive to transparently handle
|
||||||
|
any of libarchive's archiving formats.
|
||||||
|
|
||||||
|
* Libarchive's automatic support for decompression can be used
|
||||||
|
without archiving by explicitly selecting the "raw" and "empty"
|
||||||
|
formats.
|
||||||
|
|
||||||
|
* I've attempted to minimize static link pollution. If you don't
|
||||||
|
explicitly invoke a particular feature (such as support for a
|
||||||
|
particular compression or format), it won't get pulled in to
|
||||||
|
statically-linked programs. In particular, if you don't explicitly
|
||||||
|
enable a particular compression or decompression support, you won't
|
||||||
|
need to link against the corresponding compression or decompression
|
||||||
|
libraries. This also reduces the size of statically-linked
|
||||||
|
binaries in environments where that matters.
|
||||||
|
|
||||||
|
* The library is generally _thread safe_ depending on the platform:
|
||||||
|
it does not define any global variables of its own. However, some
|
||||||
|
platforms do not provide fully thread-safe versions of key C library
|
||||||
|
functions. On those platforms, libarchive will use the non-thread-safe
|
||||||
|
functions. Patches to improve this are of great interest to us.
|
||||||
|
|
||||||
|
* In particular, libarchive's modules to read or write a directory
|
||||||
|
tree do use `chdir()` to optimize the directory traversals. This
|
||||||
|
can cause problems for programs that expect to do disk access from
|
||||||
|
multiple threads. Of course, those modules are completely
|
||||||
|
optional and you can use the rest of libarchive without them.
|
||||||
|
|
||||||
|
* The library is _not_ thread aware, however. It does no locking
|
||||||
|
or thread management of any kind. If you create a libarchive
|
||||||
|
object and need to access it from multiple threads, you will
|
||||||
|
need to provide your own locking.
|
||||||
|
|
||||||
|
* On read, the library accepts whatever blocks you hand it.
|
||||||
|
Your read callback is free to pass the library a byte at a time
|
||||||
|
or mmap the entire archive and give it to the library at once.
|
||||||
|
On write, the library always produces correctly-blocked output.
|
||||||
|
|
||||||
|
* The object-style approach allows you to have multiple archive streams
|
||||||
|
open at once. bsdtar uses this in its "@archive" extension.
|
||||||
|
|
||||||
|
* The archive itself is read/written using callback functions.
|
||||||
|
You can read an archive directly from an in-memory buffer or
|
||||||
|
write it to a socket, if you wish. There are some utility
|
||||||
|
functions to provide easy-to-use "open file," etc, capabilities.
|
||||||
|
|
||||||
|
* The read/write APIs are designed to allow individual entries
|
||||||
|
to be read or written to any data source: You can create
|
||||||
|
a block of data in memory and add it to a tar archive without
|
||||||
|
first writing a temporary file. You can also read an entry from
|
||||||
|
an archive and write the data directly to a socket. If you want
|
||||||
|
to read/write entries to disk, there are convenience functions to
|
||||||
|
make this especially easy.
|
||||||
|
|
||||||
|
* Note: The "pax interchange format" is a POSIX standard extended tar
|
||||||
|
format that should be used when the older _ustar_ format is not
|
||||||
|
appropriate. It has many advantages over other tar formats
|
||||||
|
(including the legacy GNU tar format) and is widely supported by
|
||||||
|
current tar implementations.
|
||||||
|
|
||||||
62
external/bsd/libarchive/dist/cat/bsdcat.1
vendored
Normal file
62
external/bsd/libarchive/dist/cat/bsdcat.1
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
.\" Copyright (c) 2011-2014, Mike Kazantsev
|
||||||
|
.\" All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 2. 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 AUTHOR 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 AUTHOR 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.
|
||||||
|
.\"
|
||||||
|
.\" $FreeBSD$
|
||||||
|
.\"
|
||||||
|
.Dd March 1, 2014
|
||||||
|
.Dt BSDCAT 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm bsdcat
|
||||||
|
.Nd expand files to standard output
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op options
|
||||||
|
.Op files
|
||||||
|
.Pp
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
expands files to standard output.
|
||||||
|
.Sh OPTIONS
|
||||||
|
.Nm
|
||||||
|
typically takes a filename as an argument or reads standard input when used in a
|
||||||
|
pipe. In both cases decompressed data it written to standard output.
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Pp
|
||||||
|
To decompress a file:
|
||||||
|
.Pp
|
||||||
|
.Dl bsdcat example.txt.gz > example.txt
|
||||||
|
.Pp
|
||||||
|
To decompress standard input in a pipe:
|
||||||
|
.Pp
|
||||||
|
.Dl cat example.txt.gz | bsdcat > example.txt
|
||||||
|
.Pp
|
||||||
|
Both examples achieve the same results - a decompressed file by redirecting
|
||||||
|
output.
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr uncompress 1 ,
|
||||||
|
.Xr zcat 1 ,
|
||||||
|
.Xr bzcat 1 ,
|
||||||
|
.Xr xzcat 1 ,
|
||||||
|
.Xr libarchive-formats 5 ,
|
||||||
149
external/bsd/libarchive/dist/cat/bsdcat.c
vendored
Normal file
149
external/bsd/libarchive/dist/cat/bsdcat.c
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2011-2014, Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsdcat_platform.h"
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "bsdcat.h"
|
||||||
|
#include "err.h"
|
||||||
|
|
||||||
|
#define BYTES_PER_BLOCK (20*512)
|
||||||
|
|
||||||
|
static struct archive *a;
|
||||||
|
static struct archive_entry *ae;
|
||||||
|
static const char *bsdcat_current_path;
|
||||||
|
static int exit_status = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
usage(FILE *stream, int eval)
|
||||||
|
{
|
||||||
|
const char *p;
|
||||||
|
p = lafe_getprogname();
|
||||||
|
fprintf(stream,
|
||||||
|
"Usage: %s [-h] [--help] [--version] [--] [filenames...]\n", p);
|
||||||
|
exit(eval);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
version(void)
|
||||||
|
{
|
||||||
|
printf("bsdcat %s - %s\n",
|
||||||
|
BSDCAT_VERSION_STRING,
|
||||||
|
archive_version_details());
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bsdcat_next(void)
|
||||||
|
{
|
||||||
|
a = archive_read_new();
|
||||||
|
archive_read_support_filter_all(a);
|
||||||
|
archive_read_support_format_empty(a);
|
||||||
|
archive_read_support_format_raw(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bsdcat_print_error(void)
|
||||||
|
{
|
||||||
|
lafe_warnc(0, "%s: %s",
|
||||||
|
bsdcat_current_path, archive_error_string(a));
|
||||||
|
exit_status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
bsdcat_read_to_stdout(const char* filename)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (archive_read_open_filename(a, filename, BYTES_PER_BLOCK)
|
||||||
|
!= ARCHIVE_OK)
|
||||||
|
bsdcat_print_error();
|
||||||
|
else if (r = archive_read_next_header(a, &ae),
|
||||||
|
r != ARCHIVE_OK && r != ARCHIVE_EOF)
|
||||||
|
bsdcat_print_error();
|
||||||
|
else if (r == ARCHIVE_EOF)
|
||||||
|
/* for empty payloads don't try and read data */
|
||||||
|
;
|
||||||
|
else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK)
|
||||||
|
bsdcat_print_error();
|
||||||
|
if (archive_read_free(a) != ARCHIVE_OK)
|
||||||
|
bsdcat_print_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
struct bsdcat *bsdcat, bsdcat_storage;
|
||||||
|
int c;
|
||||||
|
|
||||||
|
bsdcat = &bsdcat_storage;
|
||||||
|
memset(bsdcat, 0, sizeof(*bsdcat));
|
||||||
|
|
||||||
|
lafe_setprogname(*argv, "bsdcat");
|
||||||
|
|
||||||
|
bsdcat->argv = argv;
|
||||||
|
bsdcat->argc = argc;
|
||||||
|
|
||||||
|
while ((c = bsdcat_getopt(bsdcat)) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'h':
|
||||||
|
usage(stdout, 0);
|
||||||
|
break;
|
||||||
|
case OPTION_VERSION:
|
||||||
|
version();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(stderr, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bsdcat_next();
|
||||||
|
if (*bsdcat->argv == NULL) {
|
||||||
|
bsdcat_current_path = "<stdin>";
|
||||||
|
bsdcat_read_to_stdout(NULL);
|
||||||
|
} else
|
||||||
|
while (*bsdcat->argv) {
|
||||||
|
bsdcat_current_path = *bsdcat->argv++;
|
||||||
|
bsdcat_read_to_stdout(bsdcat_current_path);
|
||||||
|
bsdcat_next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a != NULL)
|
||||||
|
archive_read_free(a);
|
||||||
|
|
||||||
|
exit(exit_status);
|
||||||
|
}
|
||||||
56
external/bsd/libarchive/dist/cat/bsdcat.h
vendored
Normal file
56
external/bsd/libarchive/dist/cat/bsdcat.h
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014, Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(PLATFORM_CONFIG_H)
|
||||||
|
/* Use hand-built config.h in environments that need it. */
|
||||||
|
#include PLATFORM_CONFIG_H
|
||||||
|
#else
|
||||||
|
/* Not having a config.h of some sort is a serious problem. */
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
|
||||||
|
struct bsdcat {
|
||||||
|
/* Option parser state */
|
||||||
|
int getopt_state;
|
||||||
|
char *getopt_word;
|
||||||
|
|
||||||
|
/* Miscellaneous state information */
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
const char *argument;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OPTION_VERSION
|
||||||
|
};
|
||||||
|
|
||||||
|
int bsdcat_getopt(struct bsdcat *);
|
||||||
|
void usage(FILE *stream, int eval);
|
||||||
|
void bsdcat_next(void);
|
||||||
|
void bsdcat_print_error(void);
|
||||||
|
void bsdcat_read_to_stdout(const char* filename);
|
||||||
75
external/bsd/libarchive/dist/cat/bsdcat_platform.h
vendored
Normal file
75
external/bsd/libarchive/dist/cat/bsdcat_platform.h
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2003-2007 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*
|
||||||
|
* $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This header is the first thing included in any of the bsdtar
|
||||||
|
* source files. As far as possible, platform-specific issues should
|
||||||
|
* be dealt with here and not within individual source files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BSDCAT_PLATFORM_H_INCLUDED
|
||||||
|
#define BSDCAT_PLATFORM_H_INCLUDED
|
||||||
|
|
||||||
|
#if defined(PLATFORM_CONFIG_H)
|
||||||
|
/* Use hand-built config.h in environments that need it. */
|
||||||
|
#include PLATFORM_CONFIG_H
|
||||||
|
#else
|
||||||
|
/* Not having a config.h of some sort is a serious problem. */
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Get a real definition for __FBSDID if we can */
|
||||||
|
#if HAVE_SYS_CDEFS_H
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If not, define it so as to avoid dangling semicolons. */
|
||||||
|
#ifndef __FBSDID
|
||||||
|
#define __FBSDID(a) struct _undefined_hack
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBARCHIVE
|
||||||
|
/* If we're using the platform libarchive, include system headers. */
|
||||||
|
#include <archive.h>
|
||||||
|
#include <archive_entry.h>
|
||||||
|
#else
|
||||||
|
/* Otherwise, include user headers. */
|
||||||
|
#include "archive.h"
|
||||||
|
#include "archive_entry.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* How to mark functions that don't return. */
|
||||||
|
/* This facilitates use of some newer static code analysis tools. */
|
||||||
|
#undef __LA_DEAD
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ > 2 || \
|
||||||
|
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
|
||||||
|
#define __LA_DEAD __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define __LA_DEAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !BSDCAT_PLATFORM_H_INCLUDED */
|
||||||
283
external/bsd/libarchive/dist/cat/cmdline.c
vendored
Normal file
283
external/bsd/libarchive/dist/cat/cmdline.c
vendored
Normal file
|
|
@ -0,0 +1,283 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2003-2008 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Command line parser for tar.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsdcat_platform.h"
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "bsdcat.h"
|
||||||
|
#include "err.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Short options for tar. Please keep this sorted.
|
||||||
|
*/
|
||||||
|
static const char *short_options = "h";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Long options for tar. Please keep this list sorted.
|
||||||
|
*
|
||||||
|
* The symbolic names for options that lack a short equivalent are
|
||||||
|
* defined in bsdcat.h. Also note that so far I've found no need
|
||||||
|
* to support optional arguments to long options. That would be
|
||||||
|
* a small change to the code below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const struct bsdcat_option {
|
||||||
|
const char *name;
|
||||||
|
int required; /* 1 if this option requires an argument. */
|
||||||
|
int equivalent; /* Equivalent short option. */
|
||||||
|
} tar_longopts[] = {
|
||||||
|
{ "help", 0, 'h' },
|
||||||
|
{ "version", 0, OPTION_VERSION },
|
||||||
|
{ NULL, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This getopt implementation has two key features that common
|
||||||
|
* getopt_long() implementations lack. Apart from those, it's a
|
||||||
|
* straightforward option parser, considerably simplified by not
|
||||||
|
* needing to support the wealth of exotic getopt_long() features. It
|
||||||
|
* has, of course, been shamelessly tailored for bsdcat. (If you're
|
||||||
|
* looking for a generic getopt_long() implementation for your
|
||||||
|
* project, I recommend Gregory Pietsch's public domain getopt_long()
|
||||||
|
* implementation.) The two additional features are:
|
||||||
|
*
|
||||||
|
* Old-style tar arguments: The original tar implementation treated
|
||||||
|
* the first argument word as a list of single-character option
|
||||||
|
* letters. All arguments follow as separate words. For example,
|
||||||
|
* tar xbf 32 /dev/tape
|
||||||
|
* Here, the "xbf" is three option letters, "32" is the argument for
|
||||||
|
* "b" and "/dev/tape" is the argument for "f". We support this usage
|
||||||
|
* if the first command-line argument does not begin with '-'. We
|
||||||
|
* also allow regular short and long options to follow, e.g.,
|
||||||
|
* tar xbf 32 /dev/tape -P --format=pax
|
||||||
|
*
|
||||||
|
* -W long options: There's an obscure GNU convention (only rarely
|
||||||
|
* supported even there) that allows "-W option=argument" as an
|
||||||
|
* alternative way to support long options. This was supported in
|
||||||
|
* early bsdcat as a way to access long options on platforms that did
|
||||||
|
* not support getopt_long() and is preserved here for backwards
|
||||||
|
* compatibility. (Of course, if I'd started with a custom
|
||||||
|
* command-line parser from the beginning, I would have had normal
|
||||||
|
* long option support on every platform so that hack wouldn't have
|
||||||
|
* been necessary. Oh, well. Some mistakes you just have to live
|
||||||
|
* with.)
|
||||||
|
*
|
||||||
|
* TODO: We should be able to use this to pull files and intermingled
|
||||||
|
* options (such as -C) from the command line in write mode. That
|
||||||
|
* will require a little rethinking of the argument handling in
|
||||||
|
* bsdcat.c.
|
||||||
|
*
|
||||||
|
* TODO: If we want to support arbitrary command-line options from -T
|
||||||
|
* input (as GNU tar does), we may need to extend this to handle option
|
||||||
|
* words from sources other than argv/argc. I'm not really sure if I
|
||||||
|
* like that feature of GNU tar, so it's certainly not a priority.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
bsdcat_getopt(struct bsdcat *bsdcat)
|
||||||
|
{
|
||||||
|
enum { state_start = 0, state_old_tar, state_next_word,
|
||||||
|
state_short, state_long };
|
||||||
|
|
||||||
|
const struct bsdcat_option *popt, *match = NULL, *match2 = NULL;
|
||||||
|
const char *p, *long_prefix = "--";
|
||||||
|
size_t optlength;
|
||||||
|
int opt = '?';
|
||||||
|
int required = 0;
|
||||||
|
|
||||||
|
bsdcat->argument = NULL;
|
||||||
|
|
||||||
|
/* First time through, initialize everything. */
|
||||||
|
if (bsdcat->getopt_state == state_start) {
|
||||||
|
/* Skip program name. */
|
||||||
|
++bsdcat->argv;
|
||||||
|
--bsdcat->argc;
|
||||||
|
if (*bsdcat->argv == NULL)
|
||||||
|
return (-1);
|
||||||
|
/* Decide between "new style" and "old style" arguments. */
|
||||||
|
bsdcat->getopt_state = state_next_word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We're ready to look at the next word in argv.
|
||||||
|
*/
|
||||||
|
if (bsdcat->getopt_state == state_next_word) {
|
||||||
|
/* No more arguments, so no more options. */
|
||||||
|
if (bsdcat->argv[0] == NULL)
|
||||||
|
return (-1);
|
||||||
|
/* Doesn't start with '-', so no more options. */
|
||||||
|
if (bsdcat->argv[0][0] != '-')
|
||||||
|
return (-1);
|
||||||
|
/* "--" marks end of options; consume it and return. */
|
||||||
|
if (strcmp(bsdcat->argv[0], "--") == 0) {
|
||||||
|
++bsdcat->argv;
|
||||||
|
--bsdcat->argc;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* Get next word for parsing. */
|
||||||
|
bsdcat->getopt_word = *bsdcat->argv++;
|
||||||
|
--bsdcat->argc;
|
||||||
|
if (bsdcat->getopt_word[1] == '-') {
|
||||||
|
/* Set up long option parser. */
|
||||||
|
bsdcat->getopt_state = state_long;
|
||||||
|
bsdcat->getopt_word += 2; /* Skip leading '--' */
|
||||||
|
} else {
|
||||||
|
/* Set up short option parser. */
|
||||||
|
bsdcat->getopt_state = state_short;
|
||||||
|
++bsdcat->getopt_word; /* Skip leading '-' */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We're parsing a group of POSIX-style single-character options.
|
||||||
|
*/
|
||||||
|
if (bsdcat->getopt_state == state_short) {
|
||||||
|
/* Peel next option off of a group of short options. */
|
||||||
|
opt = *bsdcat->getopt_word++;
|
||||||
|
if (opt == '\0') {
|
||||||
|
/* End of this group; recurse to get next option. */
|
||||||
|
bsdcat->getopt_state = state_next_word;
|
||||||
|
return bsdcat_getopt(bsdcat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Does this option take an argument? */
|
||||||
|
p = strchr(short_options, opt);
|
||||||
|
if (p == NULL)
|
||||||
|
return ('?');
|
||||||
|
if (p[1] == ':')
|
||||||
|
required = 1;
|
||||||
|
|
||||||
|
/* If it takes an argument, parse that. */
|
||||||
|
if (required) {
|
||||||
|
/* If arg is run-in, bsdcat->getopt_word already points to it. */
|
||||||
|
if (bsdcat->getopt_word[0] == '\0') {
|
||||||
|
/* Otherwise, pick up the next word. */
|
||||||
|
bsdcat->getopt_word = *bsdcat->argv;
|
||||||
|
if (bsdcat->getopt_word == NULL) {
|
||||||
|
lafe_warnc(0,
|
||||||
|
"Option -%c requires an argument",
|
||||||
|
opt);
|
||||||
|
return ('?');
|
||||||
|
}
|
||||||
|
++bsdcat->argv;
|
||||||
|
--bsdcat->argc;
|
||||||
|
}
|
||||||
|
if (opt == 'W') {
|
||||||
|
bsdcat->getopt_state = state_long;
|
||||||
|
long_prefix = "-W "; /* For clearer errors. */
|
||||||
|
} else {
|
||||||
|
bsdcat->getopt_state = state_next_word;
|
||||||
|
bsdcat->argument = bsdcat->getopt_word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We're reading a long option, including -W long=arg convention. */
|
||||||
|
if (bsdcat->getopt_state == state_long) {
|
||||||
|
/* After this long option, we'll be starting a new word. */
|
||||||
|
bsdcat->getopt_state = state_next_word;
|
||||||
|
|
||||||
|
/* Option name ends at '=' if there is one. */
|
||||||
|
p = strchr(bsdcat->getopt_word, '=');
|
||||||
|
if (p != NULL) {
|
||||||
|
optlength = (size_t)(p - bsdcat->getopt_word);
|
||||||
|
bsdcat->argument = (char *)(uintptr_t)(p + 1);
|
||||||
|
} else {
|
||||||
|
optlength = strlen(bsdcat->getopt_word);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search the table for an unambiguous match. */
|
||||||
|
for (popt = tar_longopts; popt->name != NULL; popt++) {
|
||||||
|
/* Short-circuit if first chars don't match. */
|
||||||
|
if (popt->name[0] != bsdcat->getopt_word[0])
|
||||||
|
continue;
|
||||||
|
/* If option is a prefix of name in table, record it.*/
|
||||||
|
if (strncmp(bsdcat->getopt_word, popt->name, optlength) == 0) {
|
||||||
|
match2 = match; /* Record up to two matches. */
|
||||||
|
match = popt;
|
||||||
|
/* If it's an exact match, we're done. */
|
||||||
|
if (strlen(popt->name) == optlength) {
|
||||||
|
match2 = NULL; /* Forget the others. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fail if there wasn't a unique match. */
|
||||||
|
if (match == NULL) {
|
||||||
|
lafe_warnc(0,
|
||||||
|
"Option %s%s is not supported",
|
||||||
|
long_prefix, bsdcat->getopt_word);
|
||||||
|
return ('?');
|
||||||
|
}
|
||||||
|
if (match2 != NULL) {
|
||||||
|
lafe_warnc(0,
|
||||||
|
"Ambiguous option %s%s (matches --%s and --%s)",
|
||||||
|
long_prefix, bsdcat->getopt_word, match->name, match2->name);
|
||||||
|
return ('?');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We've found a unique match; does it need an argument? */
|
||||||
|
if (match->required) {
|
||||||
|
/* Argument required: get next word if necessary. */
|
||||||
|
if (bsdcat->argument == NULL) {
|
||||||
|
bsdcat->argument = *bsdcat->argv;
|
||||||
|
if (bsdcat->argument == NULL) {
|
||||||
|
lafe_warnc(0,
|
||||||
|
"Option %s%s requires an argument",
|
||||||
|
long_prefix, match->name);
|
||||||
|
return ('?');
|
||||||
|
}
|
||||||
|
++bsdcat->argv;
|
||||||
|
--bsdcat->argc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Argument forbidden: fail if there is one. */
|
||||||
|
if (bsdcat->argument != NULL) {
|
||||||
|
lafe_warnc(0,
|
||||||
|
"Option %s%s does not allow an argument",
|
||||||
|
long_prefix, match->name);
|
||||||
|
return ('?');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (match->equivalent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (opt);
|
||||||
|
}
|
||||||
40
external/bsd/libarchive/dist/cat/test/test.h
vendored
Normal file
40
external/bsd/libarchive/dist/cat/test/test.h
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2003-2006 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*
|
||||||
|
* $FreeBSD$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Every test program should #include "test.h" as the first thing. */
|
||||||
|
|
||||||
|
#define KNOWNREF "test_expand.Z.uu"
|
||||||
|
#define ENVBASE "BSDCAT" /* Prefix for environment variables. */
|
||||||
|
#define PROGRAM "bsdcat" /* Name of program being tested. */
|
||||||
|
#define PROGRAM_ALIAS "cat" /* Generic alias for program */
|
||||||
|
#undef LIBRARY /* Not testing a library. */
|
||||||
|
#undef EXTRA_DUMP /* How to dump extra data */
|
||||||
|
#undef EXTRA_ERRNO /* How to dump errno */
|
||||||
|
/* How to generate extra version info. */
|
||||||
|
#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "")
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
67
external/bsd/libarchive/dist/cat/test/test_0.c
vendored
Normal file
67
external/bsd/libarchive/dist/cat/test/test_0.c
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2003-2007 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This first test does basic sanity checks on the environment. For
|
||||||
|
* most of these, we just exit on failure.
|
||||||
|
*/
|
||||||
|
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
#define DEV_NULL "/dev/null"
|
||||||
|
#else
|
||||||
|
#define DEV_NULL "NUL"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DEFINE_TEST(test_0)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
failure("File %s does not exist?!", testprog);
|
||||||
|
if (!assertEqualInt(0, stat(testprogfile, &st))) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\nFile %s does not exist; aborting test.\n\n",
|
||||||
|
testprog);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
failure("%s is not executable?!", testprog);
|
||||||
|
if (!assert((st.st_mode & 0111) != 0)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\nFile %s not executable; aborting test.\n\n",
|
||||||
|
testprog);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to successfully run the program; this requires that
|
||||||
|
* we know some option that will succeed.
|
||||||
|
*/
|
||||||
|
if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
|
||||||
|
failure("Unable to successfully run: %s --version\n", testprog, testprog);
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Ensure that our reference files are available. */
|
||||||
|
}
|
||||||
4
external/bsd/libarchive/dist/cat/test/test_empty.gz.uu
vendored
Normal file
4
external/bsd/libarchive/dist/cat/test/test_empty.gz.uu
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin 644 test_empty.gz
|
||||||
|
?'XL(""\MZE,``W1E<W1?96UP='D``P``````````````
|
||||||
|
`
|
||||||
|
end
|
||||||
4
external/bsd/libarchive/dist/cat/test/test_empty.lz4.uu
vendored
Normal file
4
external/bsd/libarchive/dist/cat/test/test_empty.lz4.uu
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin 644 test_empty.lz4
|
||||||
|
/!")-&&1PN0`````%7<P"
|
||||||
|
`
|
||||||
|
end
|
||||||
4
external/bsd/libarchive/dist/cat/test/test_empty.xz.uu
vendored
Normal file
4
external/bsd/libarchive/dist/cat/test/test_empty.xz.uu
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin 644 test_empty.xz
|
||||||
|
@_3=Z6%H```3FUK1&`````!S?1"$?MO-]`0`````$65H`
|
||||||
|
`
|
||||||
|
end
|
||||||
41
external/bsd/libarchive/dist/cat/test/test_empty_gz.c
vendored
Normal file
41
external/bsd/libarchive/dist/cat/test/test_empty_gz.c
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Sebastian Freundt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_empty_gz)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_empty.gz";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canGzip()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertEmptyFile("test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems gzip is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
41
external/bsd/libarchive/dist/cat/test/test_empty_lz4.c
vendored
Normal file
41
external/bsd/libarchive/dist/cat/test/test_empty_lz4.c
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Sebastian Freundt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_empty_lz4)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_empty.lz4";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canLz4()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertEmptyFile("test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems lz4 is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
41
external/bsd/libarchive/dist/cat/test/test_empty_xz.c
vendored
Normal file
41
external/bsd/libarchive/dist/cat/test/test_empty_xz.c
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Sebastian Freundt
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_empty_xz)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_empty.xz";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canXz()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertEmptyFile("test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems xz is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
36
external/bsd/libarchive/dist/cat/test/test_error.c
vendored
Normal file
36
external/bsd/libarchive/dist/cat/test/test_error.c
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_error)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.error";
|
||||||
|
|
||||||
|
assertFileNotExists(reffile);
|
||||||
|
assert(0 != systemf("%s %s >test.out 2>test.err", testprog, reffile));
|
||||||
|
|
||||||
|
assertEmptyFile("test.out");
|
||||||
|
assertNonEmptyFile("test.err");
|
||||||
|
}
|
||||||
43
external/bsd/libarchive/dist/cat/test/test_error_mixed.c
vendored
Normal file
43
external/bsd/libarchive/dist/cat/test/test_error_mixed.c
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_error_mixed)
|
||||||
|
{
|
||||||
|
const char *reffile1 = "test_expand.plain";
|
||||||
|
const char *reffile2 = "test_expand.error";
|
||||||
|
const char *reffile3 = "test_expand.Z";
|
||||||
|
|
||||||
|
assertFileNotExists(reffile2);
|
||||||
|
extract_reference_file(reffile1);
|
||||||
|
extract_reference_file(reffile3);
|
||||||
|
assert(0 != systemf("%s %s %s %s >test.out 2>test.err",
|
||||||
|
testprog, reffile1, reffile2, reffile3));
|
||||||
|
|
||||||
|
assertTextFileContents(
|
||||||
|
"contents of test_expand.plain.\n"
|
||||||
|
"contents of test_expand.Z.\n", "test.out");
|
||||||
|
assertNonEmptyFile("test.err");
|
||||||
|
}
|
||||||
3
external/bsd/libarchive/dist/cat/test/test_expand.Z.uu
vendored
Normal file
3
external/bsd/libarchive/dist/cat/test/test_expand.Z.uu
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
begin 664 test_expand.Z
|
||||||
|
@'YV08]ZXH5-FX!P0;\R`(#B'SI<R>."$<4/&A187"@`
|
||||||
|
end
|
||||||
5
external/bsd/libarchive/dist/cat/test/test_expand.bz2.uu
vendored
Normal file
5
external/bsd/libarchive/dist/cat/test/test_expand.bz2.uu
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
begin 664 test_expand.bz2
|
||||||
|
M0EIH.3%!62936=[T@^L [__N000(!!(#!@\P+(, !@4 1 @$" (0 80$
|
||||||
|
M(!D0 " 5%)D::#( #0]0 9J%1Z@>H :!B:&33(!"X";"%C@I$+32H/(0MXG
|
||||||
|
J,EA1G51 WG-"6JV7JKA;/&]$X 6MNH 8'N@3[\XCA_%W)%.%"0WO2#ZP
|
||||||
|
end
|
||||||
4
external/bsd/libarchive/dist/cat/test/test_expand.gz.uu
vendored
Normal file
4
external/bsd/libarchive/dist/cat/test/test_expand.gz.uu
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin 664 test_expand.gz
|
||||||
|
M'XL("-UD1%,``V%S9`!+SL\K2<TK*5;(3U,H22TNB4^M*$C,2]%+K]+C`@`Z
|
||||||
|
'PQU''```````
|
||||||
|
end
|
||||||
5
external/bsd/libarchive/dist/cat/test/test_expand.lz4.uu
vendored
Normal file
5
external/bsd/libarchive/dist/cat/test/test_expand.lz4.uu
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
begin 644 test_expand.lz4
|
||||||
|
M!")-&&1PN1T``(!C;VYT96YT<R!O9B!T97-T7V5X<&%N9"YL>C0N"@`````Y
|
||||||
|
#!E9+
|
||||||
|
`
|
||||||
|
end
|
||||||
3
external/bsd/libarchive/dist/cat/test/test_expand.plain.uu
vendored
Normal file
3
external/bsd/libarchive/dist/cat/test/test_expand.plain.uu
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
begin 664 test_expand.plain
|
||||||
|
?8V]N=&5N=',@;V8@=&5S=%]E>'!A;F0N<&QA:6XN"@
|
||||||
|
end
|
||||||
4
external/bsd/libarchive/dist/cat/test/test_expand.xz.uu
vendored
Normal file
4
external/bsd/libarchive/dist/cat/test/test_expand.xz.uu
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin 664 test_expand.xz
|
||||||
|
M_3=Z6%H 3FUK1& @ A 18 !T+^6C 0 ;8V]N=&5N=',@;V8@=&5S=%]E
|
||||||
|
G>'!A;F0N>'HN"@!S;^LVAO^3[ !-!R3&JV/'[;S?0$ !%E:
|
||||||
|
end
|
||||||
36
external/bsd/libarchive/dist/cat/test/test_expand_Z.c
vendored
Normal file
36
external/bsd/libarchive/dist/cat/test/test_expand_Z.c
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_Z)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.Z";
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile));
|
||||||
|
|
||||||
|
assertTextFileContents("contents of test_expand.Z.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
}
|
||||||
42
external/bsd/libarchive/dist/cat/test/test_expand_bz2.c
vendored
Normal file
42
external/bsd/libarchive/dist/cat/test/test_expand_bz2.c
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* Copyright (c) 2012 Michihiro NAKAJIMA
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_bz2)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.bz2";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canBzip2()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertTextFileContents("contents of test_expand.bz2.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems bzip2 is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
42
external/bsd/libarchive/dist/cat/test/test_expand_gz.c
vendored
Normal file
42
external/bsd/libarchive/dist/cat/test/test_expand_gz.c
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* Copyright (c) 2012 Michihiro NAKAJIMA
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_gz)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.gz";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canGzip()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertTextFileContents("contents of test_expand.gz.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems gzip is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
42
external/bsd/libarchive/dist/cat/test/test_expand_lz4.c
vendored
Normal file
42
external/bsd/libarchive/dist/cat/test/test_expand_lz4.c
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* Copyright (c) 2012, 2014 Michihiro NAKAJIMA
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_lz4)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.lz4";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canLz4()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertTextFileContents("contents of test_expand.lz4.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems lz4 is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
41
external/bsd/libarchive/dist/cat/test/test_expand_mixed.c
vendored
Normal file
41
external/bsd/libarchive/dist/cat/test/test_expand_mixed.c
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_mixed)
|
||||||
|
{
|
||||||
|
const char *reffile1 = "test_expand.Z";
|
||||||
|
const char *reffile2 = "test_expand.plain";
|
||||||
|
|
||||||
|
extract_reference_file(reffile1);
|
||||||
|
extract_reference_file(reffile2);
|
||||||
|
assertEqualInt(0, systemf("%s %s %s >test.out 2>test.err",
|
||||||
|
testprog, reffile1, reffile2));
|
||||||
|
|
||||||
|
assertTextFileContents(
|
||||||
|
"contents of test_expand.Z.\n"
|
||||||
|
"contents of test_expand.plain.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
}
|
||||||
36
external/bsd/libarchive/dist/cat/test/test_expand_plain.c
vendored
Normal file
36
external/bsd/libarchive/dist/cat/test/test_expand_plain.c
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_plain)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.plain";
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile));
|
||||||
|
|
||||||
|
assertTextFileContents("contents of test_expand.plain.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
}
|
||||||
42
external/bsd/libarchive/dist/cat/test/test_expand_xz.c
vendored
Normal file
42
external/bsd/libarchive/dist/cat/test/test_expand_xz.c
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2014 Mike Kazantsev
|
||||||
|
* Copyright (c) 2012 Michihiro NAKAJIMA
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
DEFINE_TEST(test_expand_xz)
|
||||||
|
{
|
||||||
|
const char *reffile = "test_expand.xz";
|
||||||
|
int f;
|
||||||
|
|
||||||
|
extract_reference_file(reffile);
|
||||||
|
f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||||
|
if (f == 0 || canXz()) {
|
||||||
|
assertEqualInt(0, f);
|
||||||
|
assertTextFileContents("contents of test_expand.xz.\n", "test.out");
|
||||||
|
assertEmptyFile("test.err");
|
||||||
|
} else {
|
||||||
|
skipping("It seems xz is not supported on this platform");
|
||||||
|
}
|
||||||
|
}
|
||||||
75
external/bsd/libarchive/dist/cat/test/test_help.c
vendored
Normal file
75
external/bsd/libarchive/dist/cat/test/test_help.c
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2003-2007 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test that "--help", "-h", and "-W help" options all work and
|
||||||
|
* generate reasonable output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
in_first_line(const char *p, const char *substring)
|
||||||
|
{
|
||||||
|
size_t l = strlen(substring);
|
||||||
|
|
||||||
|
while (*p != '\0' && *p != '\n') {
|
||||||
|
if (memcmp(p, substring, l) == 0)
|
||||||
|
return (1);
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_TEST(test_help)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char *p;
|
||||||
|
size_t plen;
|
||||||
|
|
||||||
|
/* Exercise --help option. */
|
||||||
|
r = systemf("%s --help >help.stdout 2>help.stderr", testprog);
|
||||||
|
assertEqualInt(r, 0);
|
||||||
|
failure("--help should generate nothing to stderr.");
|
||||||
|
assertEmptyFile("help.stderr");
|
||||||
|
/* Help message should start with name of program. */
|
||||||
|
p = slurpfile(&plen, "help.stdout");
|
||||||
|
failure("Help output should be long enough.");
|
||||||
|
assert(plen >= 6);
|
||||||
|
failure("First line of help output should contain 'bsdcat': %s", p);
|
||||||
|
assert(in_first_line(p, "bsdcat"));
|
||||||
|
/*
|
||||||
|
* TODO: Extend this check to further verify that --help output
|
||||||
|
* looks approximately right.
|
||||||
|
*/
|
||||||
|
free(p);
|
||||||
|
|
||||||
|
/* -h option should generate the same output. */
|
||||||
|
r = systemf("%s -h >h.stdout 2>h.stderr", testprog);
|
||||||
|
assertEqualInt(r, 0);
|
||||||
|
failure("-h should generate nothing to stderr.");
|
||||||
|
assertEmptyFile("h.stderr");
|
||||||
|
failure("stdout should be same for -h and --help");
|
||||||
|
assertEqualFile("h.stdout", "help.stdout");
|
||||||
|
}
|
||||||
34
external/bsd/libarchive/dist/cat/test/test_version.c
vendored
Normal file
34
external/bsd/libarchive/dist/cat/test/test_version.c
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2003-2017 Tim Kientzle
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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.
|
||||||
|
*/
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test that --version option works and generates reasonable output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DEFINE_TEST(test_version)
|
||||||
|
{
|
||||||
|
assertVersion(testprog, "bsdcat");
|
||||||
|
}
|
||||||
102
external/bsd/libarchive/dist/cpio/bsdcpio.1
vendored
102
external/bsd/libarchive/dist/cpio/bsdcpio.1
vendored
|
|
@ -24,25 +24,25 @@
|
||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd December 21, 2007
|
.Dd September 16, 2014
|
||||||
.Dt BSDCPIO 1
|
.Dt CPIO 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm cpio
|
.Nm cpio
|
||||||
.Nd copy files to and from archives
|
.Nd copy files to and from archives
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Brq Fl i
|
.Fl i
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
.Op Ar pattern ...
|
.Op Ar pattern ...
|
||||||
.Op Ar < archive
|
.Op Ar < archive
|
||||||
.Nm
|
.Nm
|
||||||
.Brq Fl o
|
.Fl o
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
.Ar < name-list
|
.Ar < name-list
|
||||||
.Op Ar > archive
|
.Op Ar > archive
|
||||||
.Nm
|
.Nm
|
||||||
.Brq Fl p
|
.Fl p
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
.Ar dest-dir
|
.Ar dest-dir
|
||||||
.Ar < name-list
|
.Ar < name-list
|
||||||
|
|
@ -59,7 +59,7 @@ is a mode indicator from the following list:
|
||||||
.Bl -tag -compact -width indent
|
.Bl -tag -compact -width indent
|
||||||
.It Fl i
|
.It Fl i
|
||||||
Input.
|
Input.
|
||||||
Read an archive from standard input (unless overriden) and extract the
|
Read an archive from standard input (unless overridden) and extract the
|
||||||
contents to disk or (if the
|
contents to disk or (if the
|
||||||
.Fl t
|
.Fl t
|
||||||
option is specified)
|
option is specified)
|
||||||
|
|
@ -69,7 +69,7 @@ one of the patterns will be extracted.
|
||||||
.It Fl o
|
.It Fl o
|
||||||
Output.
|
Output.
|
||||||
Read a list of filenames from standard input and produce a new archive
|
Read a list of filenames from standard input and produce a new archive
|
||||||
on standard output (unless overriden) containing the specified items.
|
on standard output (unless overridden) containing the specified items.
|
||||||
.It Fl p
|
.It Fl p
|
||||||
Pass-through.
|
Pass-through.
|
||||||
Read a list of filenames from standard input and copy the files to the
|
Read a list of filenames from standard input and copy the files to the
|
||||||
|
|
@ -80,7 +80,7 @@ specified directory.
|
||||||
Unless specifically stated otherwise, options are applicable in
|
Unless specifically stated otherwise, options are applicable in
|
||||||
all operating modes.
|
all operating modes.
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl 0
|
.It Fl 0 , Fl Fl null
|
||||||
Read filenames separated by NUL characters instead of newlines.
|
Read filenames separated by NUL characters instead of newlines.
|
||||||
This is necessary if any of the filenames being read might contain newlines.
|
This is necessary if any of the filenames being read might contain newlines.
|
||||||
.It Fl A
|
.It Fl A
|
||||||
|
|
@ -102,8 +102,8 @@ bytes.
|
||||||
(o mode only)
|
(o mode only)
|
||||||
Use the old POSIX portable character format.
|
Use the old POSIX portable character format.
|
||||||
Equivalent to
|
Equivalent to
|
||||||
.Fl -format Ar odc .
|
.Fl Fl format Ar odc .
|
||||||
.It Fl d
|
.It Fl d , Fl Fl make-directories
|
||||||
(i and p modes)
|
(i and p modes)
|
||||||
Create directories as necessary.
|
Create directories as necessary.
|
||||||
.It Fl E Ar file
|
.It Fl E Ar file
|
||||||
|
|
@ -111,14 +111,14 @@ Create directories as necessary.
|
||||||
Read list of file name patterns from
|
Read list of file name patterns from
|
||||||
.Ar file
|
.Ar file
|
||||||
to list and extract.
|
to list and extract.
|
||||||
.It Fl F Ar file
|
.It Fl F Ar file , Fl Fl file Ar file
|
||||||
Read archive from or write archive to
|
Read archive from or write archive to
|
||||||
.Ar file .
|
.Ar file .
|
||||||
.It Fl f Ar pattern
|
.It Fl f Ar pattern
|
||||||
(i mode only)
|
(i mode only)
|
||||||
Ignore files that match
|
Ignore files that match
|
||||||
.Ar pattern .
|
.Ar pattern .
|
||||||
.It Fl -format Ar format
|
.It Fl H Ar format , Fl Fl format Ar format
|
||||||
(o mode only)
|
(o mode only)
|
||||||
Produce the output archive in the specified format.
|
Produce the output archive in the specified format.
|
||||||
Supported formats include:
|
Supported formats include:
|
||||||
|
|
@ -140,29 +140,27 @@ The POSIX.1 tar format.
|
||||||
The default format is
|
The default format is
|
||||||
.Ar odc .
|
.Ar odc .
|
||||||
See
|
See
|
||||||
.Xr libarchive_formats 5
|
.Xr libarchive-formats 5
|
||||||
for more complete information about the
|
for more complete information about the
|
||||||
formats currently supported by the underlying
|
formats currently supported by the underlying
|
||||||
.Xr libarchive 3
|
.Xr libarchive 3
|
||||||
library.
|
library.
|
||||||
.It Fl H Ar format
|
.It Fl h , Fl Fl help
|
||||||
Synonym for
|
|
||||||
.Fl -format .
|
|
||||||
.It Fl h , Fl -help
|
|
||||||
Print usage information.
|
Print usage information.
|
||||||
.It Fl I Ar file
|
.It Fl I Ar file
|
||||||
Read archive from
|
Read archive from
|
||||||
.Ar file .
|
.Ar file .
|
||||||
.It Fl i
|
.It Fl i , Fl Fl extract
|
||||||
Input mode.
|
Input mode.
|
||||||
See above for description.
|
See above for description.
|
||||||
.It Fl -insecure
|
.It Fl Fl insecure
|
||||||
(i and p mode only)
|
(i and p mode only)
|
||||||
Disable security checks during extraction or copying.
|
Disable security checks during extraction or copying.
|
||||||
This allows extraction via symbolic links and path names containing
|
This allows extraction via symbolic links, absolute paths,
|
||||||
|
and path names containing
|
||||||
.Sq ..
|
.Sq ..
|
||||||
in the name.
|
in the name.
|
||||||
.It Fl J
|
.It Fl J , Fl Fl xz
|
||||||
(o mode only)
|
(o mode only)
|
||||||
Compress the file with xz-compatible compression before writing it.
|
Compress the file with xz-compatible compression before writing it.
|
||||||
In input mode, this option is ignored; xz compression is recognized
|
In input mode, this option is ignored; xz compression is recognized
|
||||||
|
|
@ -175,20 +173,44 @@ Synonym for
|
||||||
All symbolic links will be followed.
|
All symbolic links will be followed.
|
||||||
Normally, symbolic links are archived and copied as symbolic links.
|
Normally, symbolic links are archived and copied as symbolic links.
|
||||||
With this option, the target of the link will be archived or copied instead.
|
With this option, the target of the link will be archived or copied instead.
|
||||||
.It Fl l
|
.It Fl l , Fl Fl link
|
||||||
(p mode only)
|
(p mode only)
|
||||||
Create links from the target directory to the original files,
|
Create links from the target directory to the original files,
|
||||||
instead of copying.
|
instead of copying.
|
||||||
.It Fl lzma
|
.It Fl Fl lrzip
|
||||||
|
(o mode only)
|
||||||
|
Compress the resulting archive with
|
||||||
|
.Xr lrzip 1 .
|
||||||
|
In input mode, this option is ignored.
|
||||||
|
.It Fl Fl lz4
|
||||||
|
(o mode only)
|
||||||
|
Compress the archive with lz4-compatible compression before writing it.
|
||||||
|
In input mode, this option is ignored; lz4 compression is recognized
|
||||||
|
automatically on input.
|
||||||
|
.It Fl Fl lzma
|
||||||
(o mode only)
|
(o mode only)
|
||||||
Compress the file with lzma-compatible compression before writing it.
|
Compress the file with lzma-compatible compression before writing it.
|
||||||
In input mode, this option is ignored; lzma compression is recognized
|
In input mode, this option is ignored; lzma compression is recognized
|
||||||
automatically on input.
|
automatically on input.
|
||||||
.It Fl m
|
.It Fl Fl lzop
|
||||||
|
(o mode only)
|
||||||
|
Compress the resulting archive with
|
||||||
|
.Xr lzop 1 .
|
||||||
|
In input mode, this option is ignored.
|
||||||
|
.It Fl Fl passphrase Ar passphrase
|
||||||
|
The
|
||||||
|
.Pa passphrase
|
||||||
|
is used to extract or create an encrypted archive.
|
||||||
|
Currently, zip is only a format that
|
||||||
|
.Nm
|
||||||
|
can handle encrypted archives.
|
||||||
|
You shouldn't use this option unless you realize how insecure
|
||||||
|
use of this option is.
|
||||||
|
.It Fl m , Fl Fl preserve-modification-time
|
||||||
(i and p modes)
|
(i and p modes)
|
||||||
Set file modification time on created files to match
|
Set file modification time on created files to match
|
||||||
those in the source.
|
those in the source.
|
||||||
.It Fl n
|
.It Fl n , Fl Fl numeric-uid-gid
|
||||||
(i mode, only with
|
(i mode, only with
|
||||||
.Fl t )
|
.Fl t )
|
||||||
Display numeric uid and gid.
|
Display numeric uid and gid.
|
||||||
|
|
@ -197,26 +219,26 @@ By default,
|
||||||
displays the user and group names when they are provided in the
|
displays the user and group names when they are provided in the
|
||||||
archive, or looks up the user and group names in the system
|
archive, or looks up the user and group names in the system
|
||||||
password database.
|
password database.
|
||||||
.It Fl no-preserve-owner
|
.It Fl Fl no-preserve-owner
|
||||||
(i mode only)
|
(i mode only)
|
||||||
Do not attempt to restore file ownership.
|
Do not attempt to restore file ownership.
|
||||||
This is the default when run by non-root users.
|
This is the default when run by non-root users.
|
||||||
.It Fl O Ar file
|
.It Fl O Ar file
|
||||||
Write archive to
|
Write archive to
|
||||||
.Ar file .
|
.Ar file .
|
||||||
.It Fl o
|
.It Fl o , Fl Fl create
|
||||||
Output mode.
|
Output mode.
|
||||||
See above for description.
|
See above for description.
|
||||||
.It Fl p
|
.It Fl p , Fl Fl pass-through
|
||||||
Pass-through mode.
|
Pass-through mode.
|
||||||
See above for description.
|
See above for description.
|
||||||
.It Fl preserve-owner
|
.It Fl Fl preserve-owner
|
||||||
(i mode only)
|
(i mode only)
|
||||||
Restore file ownership.
|
Restore file ownership.
|
||||||
This is the default when run by the root user.
|
This is the default when run by the root user.
|
||||||
.It Fl -quiet
|
.It Fl Fl quiet
|
||||||
Suppress unnecessary messages.
|
Suppress unnecessary messages.
|
||||||
.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc
|
.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc , Fl Fl owner Oo user Oc Ns Oo : Oc Ns Oo group Oc
|
||||||
Set the owner and/or group on files in the output.
|
Set the owner and/or group on files in the output.
|
||||||
If group is specified with no user
|
If group is specified with no user
|
||||||
(for example,
|
(for example,
|
||||||
|
|
@ -244,20 +266,24 @@ containing the name of the file and a line is read from
|
||||||
If the line read is blank, the file is skipped.
|
If the line read is blank, the file is skipped.
|
||||||
If the line contains a single period, the file is processed normally.
|
If the line contains a single period, the file is processed normally.
|
||||||
Otherwise, the line is taken to be the new name of the file.
|
Otherwise, the line is taken to be the new name of the file.
|
||||||
.It Fl t
|
.It Fl t , Fl Fl list
|
||||||
(i mode only)
|
(i mode only)
|
||||||
List the contents of the archive to stdout;
|
List the contents of the archive to stdout;
|
||||||
do not restore the contents to disk.
|
do not restore the contents to disk.
|
||||||
.It Fl u
|
.It Fl u , Fl Fl unconditional
|
||||||
(i and p modes)
|
(i and p modes)
|
||||||
Unconditionally overwrite existing files.
|
Unconditionally overwrite existing files.
|
||||||
Ordinarily, an older file will not overwrite a newer file on disk.
|
Ordinarily, an older file will not overwrite a newer file on disk.
|
||||||
.It Fl v
|
.It Fl V , Fl Fl dot
|
||||||
|
Print a dot to stderr for each file as it is processed.
|
||||||
|
Superseded by
|
||||||
|
.Fl v .
|
||||||
|
.It Fl v , Fl Fl verbose
|
||||||
Print the name of each file to stderr as it is processed.
|
Print the name of each file to stderr as it is processed.
|
||||||
With
|
With
|
||||||
.Fl t ,
|
.Fl t ,
|
||||||
provide a detailed listing of each file.
|
provide a detailed listing of each file.
|
||||||
.It Fl -version
|
.It Fl Fl version
|
||||||
Print the program version information and exit.
|
Print the program version information and exit.
|
||||||
.It Fl y
|
.It Fl y
|
||||||
(o mode only)
|
(o mode only)
|
||||||
|
|
@ -275,6 +301,8 @@ Compress the archive with gzip-compatible compression before writing it.
|
||||||
In input mode, this option is ignored;
|
In input mode, this option is ignored;
|
||||||
gzip compression is recognized automatically on input.
|
gzip compression is recognized automatically on input.
|
||||||
.El
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
The following environment variables affect the execution of
|
The following environment variables affect the execution of
|
||||||
.Nm :
|
.Nm :
|
||||||
|
|
@ -290,12 +318,10 @@ See
|
||||||
.Xr environ 7
|
.Xr environ 7
|
||||||
for more information.
|
for more information.
|
||||||
.El
|
.El
|
||||||
.Sh EXIT STATUS
|
|
||||||
.Ex -std
|
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
command is traditionally used to copy file heirarchies in conjunction
|
command is traditionally used to copy file hierarchies in conjunction
|
||||||
with the
|
with the
|
||||||
.Xr find 1
|
.Xr find 1
|
||||||
command.
|
command.
|
||||||
|
|
|
||||||
32
external/bsd/libarchive/dist/cpio/cmdline.c
vendored
32
external/bsd/libarchive/dist/cpio/cmdline.c
vendored
|
|
@ -51,7 +51,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzl
|
||||||
/*
|
/*
|
||||||
* Short options for cpio. Please keep this sorted.
|
* Short options for cpio. Please keep this sorted.
|
||||||
*/
|
*/
|
||||||
static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuvW:yZz";
|
static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Long options for cpio. Please keep this sorted.
|
* Long options for cpio. Please keep this sorted.
|
||||||
|
|
@ -61,25 +61,34 @@ static const struct option {
|
||||||
int required; /* 1 if this option requires an argument */
|
int required; /* 1 if this option requires an argument */
|
||||||
int equivalent; /* Equivalent short option. */
|
int equivalent; /* Equivalent short option. */
|
||||||
} cpio_longopts[] = {
|
} cpio_longopts[] = {
|
||||||
|
{ "b64encode", 0, OPTION_B64ENCODE },
|
||||||
{ "create", 0, 'o' },
|
{ "create", 0, 'o' },
|
||||||
|
{ "dereference", 0, 'L' },
|
||||||
|
{ "dot", 0, 'V' },
|
||||||
{ "extract", 0, 'i' },
|
{ "extract", 0, 'i' },
|
||||||
{ "file", 1, 'F' },
|
{ "file", 1, 'F' },
|
||||||
{ "format", 1, 'H' },
|
{ "format", 1, 'H' },
|
||||||
|
{ "grzip", 0, OPTION_GRZIP },
|
||||||
{ "help", 0, 'h' },
|
{ "help", 0, 'h' },
|
||||||
{ "insecure", 0, OPTION_INSECURE },
|
{ "insecure", 0, OPTION_INSECURE },
|
||||||
{ "link", 0, 'l' },
|
{ "link", 0, 'l' },
|
||||||
{ "list", 0, 't' },
|
{ "list", 0, 't' },
|
||||||
|
{ "lrzip", 0, OPTION_LRZIP },
|
||||||
|
{ "lz4", 0, OPTION_LZ4 },
|
||||||
{ "lzma", 0, OPTION_LZMA },
|
{ "lzma", 0, OPTION_LZMA },
|
||||||
|
{ "lzop", 0, OPTION_LZOP },
|
||||||
{ "make-directories", 0, 'd' },
|
{ "make-directories", 0, 'd' },
|
||||||
{ "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER },
|
{ "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER },
|
||||||
{ "null", 0, '0' },
|
{ "null", 0, '0' },
|
||||||
{ "numeric-uid-gid", 0, 'n' },
|
{ "numeric-uid-gid", 0, 'n' },
|
||||||
{ "owner", 1, 'R' },
|
{ "owner", 1, 'R' },
|
||||||
|
{ "passphrase", 1, OPTION_PASSPHRASE },
|
||||||
{ "pass-through", 0, 'p' },
|
{ "pass-through", 0, 'p' },
|
||||||
{ "preserve-modification-time", 0, 'm' },
|
{ "preserve-modification-time", 0, 'm' },
|
||||||
{ "preserve-owner", 0, OPTION_PRESERVE_OWNER },
|
{ "preserve-owner", 0, OPTION_PRESERVE_OWNER },
|
||||||
{ "quiet", 0, OPTION_QUIET },
|
{ "quiet", 0, OPTION_QUIET },
|
||||||
{ "unconditional", 0, 'u' },
|
{ "unconditional", 0, 'u' },
|
||||||
|
{ "uuencode", 0, OPTION_UUENCODE },
|
||||||
{ "verbose", 0, 'v' },
|
{ "verbose", 0, 'v' },
|
||||||
{ "version", 0, OPTION_VERSION },
|
{ "version", 0, OPTION_VERSION },
|
||||||
{ "xz", 0, 'J' },
|
{ "xz", 0, 'J' },
|
||||||
|
|
@ -109,7 +118,7 @@ cpio_getopt(struct cpio *cpio)
|
||||||
int opt = '?';
|
int opt = '?';
|
||||||
int required = 0;
|
int required = 0;
|
||||||
|
|
||||||
cpio->optarg = NULL;
|
cpio->argument = NULL;
|
||||||
|
|
||||||
/* First time through, initialize everything. */
|
/* First time through, initialize everything. */
|
||||||
if (state == state_start) {
|
if (state == state_start) {
|
||||||
|
|
@ -188,7 +197,7 @@ cpio_getopt(struct cpio *cpio)
|
||||||
long_prefix = "-W "; /* For clearer errors. */
|
long_prefix = "-W "; /* For clearer errors. */
|
||||||
} else {
|
} else {
|
||||||
state = state_next_word;
|
state = state_next_word;
|
||||||
cpio->optarg = opt_word;
|
cpio->argument = opt_word;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +211,7 @@ cpio_getopt(struct cpio *cpio)
|
||||||
p = strchr(opt_word, '=');
|
p = strchr(opt_word, '=');
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
optlength = (size_t)(p - opt_word);
|
optlength = (size_t)(p - opt_word);
|
||||||
cpio->optarg = (char *)(uintptr_t)(p + 1);
|
cpio->argument = (char *)(uintptr_t)(p + 1);
|
||||||
} else {
|
} else {
|
||||||
optlength = strlen(opt_word);
|
optlength = strlen(opt_word);
|
||||||
}
|
}
|
||||||
|
|
@ -241,9 +250,9 @@ cpio_getopt(struct cpio *cpio)
|
||||||
/* We've found a unique match; does it need an argument? */
|
/* We've found a unique match; does it need an argument? */
|
||||||
if (match->required) {
|
if (match->required) {
|
||||||
/* Argument required: get next word if necessary. */
|
/* Argument required: get next word if necessary. */
|
||||||
if (cpio->optarg == NULL) {
|
if (cpio->argument == NULL) {
|
||||||
cpio->optarg = *cpio->argv;
|
cpio->argument = *cpio->argv;
|
||||||
if (cpio->optarg == NULL) {
|
if (cpio->argument == NULL) {
|
||||||
lafe_warnc(0,
|
lafe_warnc(0,
|
||||||
"Option %s%s requires an argument",
|
"Option %s%s requires an argument",
|
||||||
long_prefix, match->name);
|
long_prefix, match->name);
|
||||||
|
|
@ -254,7 +263,7 @@ cpio_getopt(struct cpio *cpio)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Argument forbidden: fail if there is one. */
|
/* Argument forbidden: fail if there is one. */
|
||||||
if (cpio->optarg != NULL) {
|
if (cpio->argument != NULL) {
|
||||||
lafe_warnc(0,
|
lafe_warnc(0,
|
||||||
"Option %s%s does not allow an argument",
|
"Option %s%s does not allow an argument",
|
||||||
long_prefix, match->name);
|
long_prefix, match->name);
|
||||||
|
|
@ -285,6 +294,8 @@ cpio_getopt(struct cpio *cpio)
|
||||||
* A period can be used instead of the colon.
|
* A period can be used instead of the colon.
|
||||||
*
|
*
|
||||||
* Sets uid/gid return as appropriate, -1 indicates uid/gid not specified.
|
* Sets uid/gid return as appropriate, -1 indicates uid/gid not specified.
|
||||||
|
* TODO: If the spec uses uname/gname, then return those to the caller
|
||||||
|
* as well. If the spec provides uid/gid, just return names as NULL.
|
||||||
*
|
*
|
||||||
* Returns NULL if no error, otherwise returns error string for display.
|
* Returns NULL if no error, otherwise returns error string for display.
|
||||||
*
|
*
|
||||||
|
|
@ -338,11 +349,12 @@ owner_parse(const char *spec, int *uid, int *gid)
|
||||||
} else {
|
} else {
|
||||||
char *end;
|
char *end;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*uid = strtoul(user, &end, 10);
|
*uid = (int)strtoul(user, &end, 10);
|
||||||
if (errno || *end != '\0') {
|
if (errno || *end != '\0') {
|
||||||
snprintf(errbuff, sizeof(errbuff),
|
snprintf(errbuff, sizeof(errbuff),
|
||||||
"Couldn't lookup user ``%s''", user);
|
"Couldn't lookup user ``%s''", user);
|
||||||
errbuff[sizeof(errbuff) - 1] = '\0';
|
errbuff[sizeof(errbuff) - 1] = '\0';
|
||||||
|
free(user);
|
||||||
return (errbuff);
|
return (errbuff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +368,7 @@ owner_parse(const char *spec, int *uid, int *gid)
|
||||||
} else {
|
} else {
|
||||||
char *end;
|
char *end;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*gid = strtoul(g, &end, 10);
|
*gid = (int)strtoul(g, &end, 10);
|
||||||
if (errno || *end != '\0') {
|
if (errno || *end != '\0') {
|
||||||
snprintf(errbuff, sizeof(errbuff),
|
snprintf(errbuff, sizeof(errbuff),
|
||||||
"Couldn't lookup group ``%s''", g);
|
"Couldn't lookup group ``%s''", g);
|
||||||
|
|
|
||||||
428
external/bsd/libarchive/dist/cpio/cpio.c
vendored
428
external/bsd/libarchive/dist/cpio/cpio.c
vendored
|
|
@ -50,9 +50,15 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle
|
||||||
#ifdef HAVE_GRP_H
|
#ifdef HAVE_GRP_H
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LOCALE_H
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_STDARG_H
|
#ifdef HAVE_STDARG_H
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -69,9 +75,6 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_TIME_H
|
#ifdef HAVE_TIME_H
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -79,7 +82,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle
|
||||||
#include "cpio.h"
|
#include "cpio.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "line_reader.h"
|
#include "line_reader.h"
|
||||||
#include "matching.h"
|
#include "passphrase.h"
|
||||||
|
|
||||||
/* Fixed size of uname/gname caches. */
|
/* Fixed size of uname/gname caches. */
|
||||||
#define name_cache_size 101
|
#define name_cache_size 101
|
||||||
|
|
@ -105,21 +108,24 @@ static int entry_to_archive(struct cpio *, struct archive_entry *);
|
||||||
static int file_to_archive(struct cpio *, const char *);
|
static int file_to_archive(struct cpio *, const char *);
|
||||||
static void free_cache(struct name_cache *cache);
|
static void free_cache(struct name_cache *cache);
|
||||||
static void list_item_verbose(struct cpio *, struct archive_entry *);
|
static void list_item_verbose(struct cpio *, struct archive_entry *);
|
||||||
static void long_help(void);
|
static void long_help(void) __LA_DEAD;
|
||||||
static const char *lookup_gname(struct cpio *, gid_t gid);
|
static const char *lookup_gname(struct cpio *, gid_t gid);
|
||||||
static int lookup_gname_helper(struct cpio *,
|
static int lookup_gname_helper(struct cpio *,
|
||||||
const char **name, id_t gid);
|
const char **name, id_t gid);
|
||||||
static const char *lookup_uname(struct cpio *, uid_t uid);
|
static const char *lookup_uname(struct cpio *, uid_t uid);
|
||||||
static int lookup_uname_helper(struct cpio *,
|
static int lookup_uname_helper(struct cpio *,
|
||||||
const char **name, id_t uid);
|
const char **name, id_t uid);
|
||||||
static void mode_in(struct cpio *);
|
static void mode_in(struct cpio *) __LA_DEAD;
|
||||||
static void mode_list(struct cpio *);
|
static void mode_list(struct cpio *) __LA_DEAD;
|
||||||
static void mode_out(struct cpio *);
|
static void mode_out(struct cpio *);
|
||||||
static void mode_pass(struct cpio *, const char *);
|
static void mode_pass(struct cpio *, const char *);
|
||||||
|
static const char *remove_leading_slash(const char *);
|
||||||
static int restore_time(struct cpio *, struct archive_entry *,
|
static int restore_time(struct cpio *, struct archive_entry *,
|
||||||
const char *, int fd);
|
const char *, int fd);
|
||||||
static void usage(void);
|
static void usage(void) __LA_DEAD;
|
||||||
static void version(void);
|
static void version(void) __LA_DEAD;
|
||||||
|
static const char * passphrase_callback(struct archive *, void *);
|
||||||
|
static void passphrase_free(char *);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
|
|
@ -136,20 +142,23 @@ main(int argc, char *argv[])
|
||||||
cpio->buff = buff;
|
cpio->buff = buff;
|
||||||
cpio->buff_size = sizeof(buff);
|
cpio->buff_size = sizeof(buff);
|
||||||
|
|
||||||
/* Need lafe_progname before calling lafe_warnc. */
|
#if defined(HAVE_SIGACTION) && defined(SIGPIPE)
|
||||||
if (*argv == NULL)
|
{ /* Ignore SIGPIPE signals. */
|
||||||
lafe_progname = "bsdcpio";
|
struct sigaction sa;
|
||||||
else {
|
sigemptyset(&sa.sa_mask);
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
sa.sa_flags = 0;
|
||||||
lafe_progname = strrchr(*argv, '\\');
|
sa.sa_handler = SIG_IGN;
|
||||||
#else
|
sigaction(SIGPIPE, &sa, NULL);
|
||||||
lafe_progname = strrchr(*argv, '/');
|
|
||||||
#endif
|
|
||||||
if (lafe_progname != NULL)
|
|
||||||
lafe_progname++;
|
|
||||||
else
|
|
||||||
lafe_progname = *argv;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set lafe_progname before calling lafe_warnc. */
|
||||||
|
lafe_setprogname(*argv, "bsdcpio");
|
||||||
|
|
||||||
|
#if HAVE_SETLOCALE
|
||||||
|
if (setlocale(LC_ALL, "") == NULL)
|
||||||
|
lafe_warnc(0, "Failed to set default locale");
|
||||||
|
#endif
|
||||||
|
|
||||||
cpio->uid_override = -1;
|
cpio->uid_override = -1;
|
||||||
cpio->gid_override = -1;
|
cpio->gid_override = -1;
|
||||||
|
|
@ -162,6 +171,7 @@ main(int argc, char *argv[])
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||||
|
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_ACL;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_ACL;
|
||||||
|
|
@ -172,6 +182,10 @@ main(int argc, char *argv[])
|
||||||
cpio->bytes_per_block = 512;
|
cpio->bytes_per_block = 512;
|
||||||
cpio->filename = NULL;
|
cpio->filename = NULL;
|
||||||
|
|
||||||
|
cpio->matching = archive_match_new();
|
||||||
|
if (cpio->matching == NULL)
|
||||||
|
lafe_errc(1, 0, "Out of memory");
|
||||||
|
|
||||||
while ((opt = cpio_getopt(cpio)) != -1) {
|
while ((opt = cpio_getopt(cpio)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case '0': /* GNU convention: --null, -0 */
|
case '0': /* GNU convention: --null, -0 */
|
||||||
|
|
@ -186,10 +200,13 @@ main(int argc, char *argv[])
|
||||||
case 'B': /* POSIX 1997 */
|
case 'B': /* POSIX 1997 */
|
||||||
cpio->bytes_per_block = 5120;
|
cpio->bytes_per_block = 5120;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_B64ENCODE:
|
||||||
|
cpio->add_filter = opt;
|
||||||
|
break;
|
||||||
case 'C': /* NetBSD/OpenBSD */
|
case 'C': /* NetBSD/OpenBSD */
|
||||||
cpio->bytes_per_block = atoi(cpio->optarg);
|
cpio->bytes_per_block = atoi(cpio->argument);
|
||||||
if (cpio->bytes_per_block <= 0)
|
if (cpio->bytes_per_block <= 0)
|
||||||
lafe_errc(1, 0, "Invalid blocksize %s", cpio->optarg);
|
lafe_errc(1, 0, "Invalid blocksize %s", cpio->argument);
|
||||||
break;
|
break;
|
||||||
case 'c': /* POSIX 1997 */
|
case 'c': /* POSIX 1997 */
|
||||||
cpio->format = "odc";
|
cpio->format = "odc";
|
||||||
|
|
@ -198,23 +215,32 @@ main(int argc, char *argv[])
|
||||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR;
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR;
|
||||||
break;
|
break;
|
||||||
case 'E': /* NetBSD/OpenBSD */
|
case 'E': /* NetBSD/OpenBSD */
|
||||||
lafe_include_from_file(&cpio->matching,
|
if (archive_match_include_pattern_from_file(
|
||||||
cpio->optarg, cpio->option_null);
|
cpio->matching, cpio->argument,
|
||||||
|
cpio->option_null) != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "Error : %s",
|
||||||
|
archive_error_string(cpio->matching));
|
||||||
break;
|
break;
|
||||||
case 'F': /* NetBSD/OpenBSD/GNU cpio */
|
case 'F': /* NetBSD/OpenBSD/GNU cpio */
|
||||||
cpio->filename = cpio->optarg;
|
cpio->filename = cpio->argument;
|
||||||
break;
|
break;
|
||||||
case 'f': /* POSIX 1997 */
|
case 'f': /* POSIX 1997 */
|
||||||
lafe_exclude(&cpio->matching, cpio->optarg);
|
if (archive_match_exclude_pattern(cpio->matching,
|
||||||
|
cpio->argument) != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "Error : %s",
|
||||||
|
archive_error_string(cpio->matching));
|
||||||
|
break;
|
||||||
|
case OPTION_GRZIP:
|
||||||
|
cpio->compress = opt;
|
||||||
break;
|
break;
|
||||||
case 'H': /* GNU cpio (also --format) */
|
case 'H': /* GNU cpio (also --format) */
|
||||||
cpio->format = cpio->optarg;
|
cpio->format = cpio->argument;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
long_help();
|
long_help();
|
||||||
break;
|
break;
|
||||||
case 'I': /* NetBSD/OpenBSD */
|
case 'I': /* NetBSD/OpenBSD */
|
||||||
cpio->filename = cpio->optarg;
|
cpio->filename = cpio->argument;
|
||||||
break;
|
break;
|
||||||
case 'i': /* POSIX 1997 */
|
case 'i': /* POSIX 1997 */
|
||||||
if (cpio->mode != '\0')
|
if (cpio->mode != '\0')
|
||||||
|
|
@ -231,6 +257,7 @@ main(int argc, char *argv[])
|
||||||
case OPTION_INSECURE:
|
case OPTION_INSECURE:
|
||||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS;
|
||||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||||
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||||
break;
|
break;
|
||||||
case 'L': /* GNU cpio */
|
case 'L': /* GNU cpio */
|
||||||
cpio->option_follow_links = 1;
|
cpio->option_follow_links = 1;
|
||||||
|
|
@ -238,7 +265,10 @@ main(int argc, char *argv[])
|
||||||
case 'l': /* POSIX 1997 */
|
case 'l': /* POSIX 1997 */
|
||||||
cpio->option_link = 1;
|
cpio->option_link = 1;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_LRZIP:
|
||||||
|
case OPTION_LZ4:
|
||||||
case OPTION_LZMA: /* GNU tar, others */
|
case OPTION_LZMA: /* GNU tar, others */
|
||||||
|
case OPTION_LZOP: /* GNU tar, others */
|
||||||
cpio->compress = opt;
|
cpio->compress = opt;
|
||||||
break;
|
break;
|
||||||
case 'm': /* POSIX 1997 */
|
case 'm': /* POSIX 1997 */
|
||||||
|
|
@ -251,7 +281,7 @@ main(int argc, char *argv[])
|
||||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
|
||||||
break;
|
break;
|
||||||
case 'O': /* GNU cpio */
|
case 'O': /* GNU cpio */
|
||||||
cpio->filename = cpio->optarg;
|
cpio->filename = cpio->argument;
|
||||||
break;
|
break;
|
||||||
case 'o': /* POSIX 1997 */
|
case 'o': /* POSIX 1997 */
|
||||||
if (cpio->mode != '\0')
|
if (cpio->mode != '\0')
|
||||||
|
|
@ -265,6 +295,10 @@ main(int argc, char *argv[])
|
||||||
"Cannot use both -p and -%c", cpio->mode);
|
"Cannot use both -p and -%c", cpio->mode);
|
||||||
cpio->mode = opt;
|
cpio->mode = opt;
|
||||||
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
|
||||||
|
cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
|
||||||
|
break;
|
||||||
|
case OPTION_PASSPHRASE:
|
||||||
|
cpio->passphrase = cpio->argument;
|
||||||
break;
|
break;
|
||||||
case OPTION_PRESERVE_OWNER:
|
case OPTION_PRESERVE_OWNER:
|
||||||
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
|
cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
|
||||||
|
|
@ -273,15 +307,21 @@ main(int argc, char *argv[])
|
||||||
cpio->quiet = 1;
|
cpio->quiet = 1;
|
||||||
break;
|
break;
|
||||||
case 'R': /* GNU cpio, also --owner */
|
case 'R': /* GNU cpio, also --owner */
|
||||||
errmsg = owner_parse(cpio->optarg, &uid, &gid);
|
/* TODO: owner_parse should return uname/gname
|
||||||
|
* also; use that to set [ug]name_override. */
|
||||||
|
errmsg = owner_parse(cpio->argument, &uid, &gid);
|
||||||
if (errmsg) {
|
if (errmsg) {
|
||||||
lafe_warnc(-1, "%s", errmsg);
|
lafe_warnc(-1, "%s", errmsg);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
if (uid != -1)
|
if (uid != -1) {
|
||||||
cpio->uid_override = uid;
|
cpio->uid_override = uid;
|
||||||
if (gid != -1)
|
cpio->uname_override = NULL;
|
||||||
|
}
|
||||||
|
if (gid != -1) {
|
||||||
cpio->gid_override = gid;
|
cpio->gid_override = gid;
|
||||||
|
cpio->gname_override = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'r': /* POSIX 1997 */
|
case 'r': /* POSIX 1997 */
|
||||||
cpio->option_rename = 1;
|
cpio->option_rename = 1;
|
||||||
|
|
@ -293,9 +333,15 @@ main(int argc, char *argv[])
|
||||||
cpio->extract_flags
|
cpio->extract_flags
|
||||||
&= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
&= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_UUENCODE:
|
||||||
|
cpio->add_filter = opt;
|
||||||
|
break;
|
||||||
case 'v': /* POSIX 1997 */
|
case 'v': /* POSIX 1997 */
|
||||||
cpio->verbose++;
|
cpio->verbose++;
|
||||||
break;
|
break;
|
||||||
|
case 'V': /* GNU cpio */
|
||||||
|
cpio->dot++;
|
||||||
|
break;
|
||||||
case OPTION_VERSION: /* GNU convention */
|
case OPTION_VERSION: /* GNU convention */
|
||||||
version();
|
version();
|
||||||
break;
|
break;
|
||||||
|
|
@ -339,6 +385,9 @@ main(int argc, char *argv[])
|
||||||
/* -l requires -p */
|
/* -l requires -p */
|
||||||
if (cpio->option_link && cpio->mode != 'p')
|
if (cpio->option_link && cpio->mode != 'p')
|
||||||
lafe_errc(1, 0, "Option -l requires -p");
|
lafe_errc(1, 0, "Option -l requires -p");
|
||||||
|
/* -v overrides -V */
|
||||||
|
if (cpio->dot && cpio->verbose)
|
||||||
|
cpio->dot = 0;
|
||||||
/* TODO: Flag other nonsensical combinations. */
|
/* TODO: Flag other nonsensical combinations. */
|
||||||
|
|
||||||
switch (cpio->mode) {
|
switch (cpio->mode) {
|
||||||
|
|
@ -352,7 +401,10 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
while (*cpio->argv != NULL) {
|
while (*cpio->argv != NULL) {
|
||||||
lafe_include(&cpio->matching, *cpio->argv);
|
if (archive_match_include_pattern(cpio->matching,
|
||||||
|
*cpio->argv) != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "Error : %s",
|
||||||
|
archive_error_string(cpio->matching));
|
||||||
--cpio->argc;
|
--cpio->argc;
|
||||||
++cpio->argv;
|
++cpio->argv;
|
||||||
}
|
}
|
||||||
|
|
@ -372,8 +424,11 @@ main(int argc, char *argv[])
|
||||||
"Must specify at least one of -i, -o, or -p");
|
"Must specify at least one of -i, -o, or -p");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
archive_match_free(cpio->matching);
|
||||||
free_cache(cpio->gname_cache);
|
free_cache(cpio->gname_cache);
|
||||||
free_cache(cpio->uname_cache);
|
free_cache(cpio->uname_cache);
|
||||||
|
free(cpio->destdir);
|
||||||
|
passphrase_free(cpio->ppbuff);
|
||||||
return (cpio->return_value);
|
return (cpio->return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -382,7 +437,7 @@ usage(void)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
p = lafe_progname;
|
p = lafe_getprogname();
|
||||||
|
|
||||||
fprintf(stderr, "Brief Usage:\n");
|
fprintf(stderr, "Brief Usage:\n");
|
||||||
fprintf(stderr, " List: %s -it < archive\n", p);
|
fprintf(stderr, " List: %s -it < archive\n", p);
|
||||||
|
|
@ -396,7 +451,7 @@ static const char *long_help_msg =
|
||||||
"First option must be a mode specifier:\n"
|
"First option must be a mode specifier:\n"
|
||||||
" -i Input -o Output -p Pass\n"
|
" -i Input -o Output -p Pass\n"
|
||||||
"Common Options:\n"
|
"Common Options:\n"
|
||||||
" -v Verbose\n"
|
" -v Verbose filenames -V one dot per file\n"
|
||||||
"Create: %p -o [options] < [list of files] > [archive]\n"
|
"Create: %p -o [options] < [list of files] > [archive]\n"
|
||||||
" -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n"
|
" -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n"
|
||||||
" --format {odc|newc|ustar} Select archive format\n"
|
" --format {odc|newc|ustar} Select archive format\n"
|
||||||
|
|
@ -420,7 +475,7 @@ long_help(void)
|
||||||
const char *prog;
|
const char *prog;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
prog = lafe_progname;
|
prog = lafe_getprogname();
|
||||||
|
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
|
|
@ -443,9 +498,9 @@ long_help(void)
|
||||||
static void
|
static void
|
||||||
version(void)
|
version(void)
|
||||||
{
|
{
|
||||||
fprintf(stdout,"bsdcpio %s -- %s\n",
|
fprintf(stdout,"bsdcpio %s - %s\n",
|
||||||
BSDCPIO_VERSION_STRING,
|
BSDCPIO_VERSION_STRING,
|
||||||
archive_version());
|
archive_version_details());
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -473,27 +528,52 @@ mode_out(struct cpio *cpio)
|
||||||
if (cpio->archive == NULL)
|
if (cpio->archive == NULL)
|
||||||
lafe_errc(1, 0, "Failed to allocate archive object");
|
lafe_errc(1, 0, "Failed to allocate archive object");
|
||||||
switch (cpio->compress) {
|
switch (cpio->compress) {
|
||||||
|
case OPTION_GRZIP:
|
||||||
|
r = archive_write_add_filter_grzip(cpio->archive);
|
||||||
|
break;
|
||||||
case 'J':
|
case 'J':
|
||||||
r = archive_write_set_compression_xz(cpio->archive);
|
r = archive_write_add_filter_xz(cpio->archive);
|
||||||
|
break;
|
||||||
|
case OPTION_LRZIP:
|
||||||
|
r = archive_write_add_filter_lrzip(cpio->archive);
|
||||||
|
break;
|
||||||
|
case OPTION_LZ4:
|
||||||
|
r = archive_write_add_filter_lz4(cpio->archive);
|
||||||
break;
|
break;
|
||||||
case OPTION_LZMA:
|
case OPTION_LZMA:
|
||||||
r = archive_write_set_compression_lzma(cpio->archive);
|
r = archive_write_add_filter_lzma(cpio->archive);
|
||||||
|
break;
|
||||||
|
case OPTION_LZOP:
|
||||||
|
r = archive_write_add_filter_lzop(cpio->archive);
|
||||||
break;
|
break;
|
||||||
case 'j': case 'y':
|
case 'j': case 'y':
|
||||||
r = archive_write_set_compression_bzip2(cpio->archive);
|
r = archive_write_add_filter_bzip2(cpio->archive);
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
r = archive_write_set_compression_gzip(cpio->archive);
|
r = archive_write_add_filter_gzip(cpio->archive);
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
r = archive_write_set_compression_compress(cpio->archive);
|
r = archive_write_add_filter_compress(cpio->archive);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
r = archive_write_set_compression_none(cpio->archive);
|
r = archive_write_add_filter_none(cpio->archive);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r < ARCHIVE_WARN)
|
if (r < ARCHIVE_WARN)
|
||||||
lafe_errc(1, 0, "Requested compression not available");
|
lafe_errc(1, 0, "Requested compression not available");
|
||||||
|
switch (cpio->add_filter) {
|
||||||
|
case 0:
|
||||||
|
r = ARCHIVE_OK;
|
||||||
|
break;
|
||||||
|
case OPTION_B64ENCODE:
|
||||||
|
r = archive_write_add_filter_b64encode(cpio->archive);
|
||||||
|
break;
|
||||||
|
case OPTION_UUENCODE:
|
||||||
|
r = archive_write_add_filter_uuencode(cpio->archive);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (r < ARCHIVE_WARN)
|
||||||
|
lafe_errc(1, 0, "Requested filter not available");
|
||||||
r = archive_write_set_format_by_name(cpio->archive, cpio->format);
|
r = archive_write_set_format_by_name(cpio->archive, cpio->format);
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
||||||
|
|
@ -501,11 +581,19 @@ mode_out(struct cpio *cpio)
|
||||||
cpio->linkresolver = archive_entry_linkresolver_new();
|
cpio->linkresolver = archive_entry_linkresolver_new();
|
||||||
archive_entry_linkresolver_set_strategy(cpio->linkresolver,
|
archive_entry_linkresolver_set_strategy(cpio->linkresolver,
|
||||||
archive_format(cpio->archive));
|
archive_format(cpio->archive));
|
||||||
|
if (cpio->passphrase != NULL)
|
||||||
|
r = archive_write_set_passphrase(cpio->archive,
|
||||||
|
cpio->passphrase);
|
||||||
|
else
|
||||||
|
r = archive_write_set_passphrase_callback(cpio->archive, cpio,
|
||||||
|
&passphrase_callback);
|
||||||
|
if (r != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The main loop: Copy each file into the output archive.
|
* The main loop: Copy each file into the output archive.
|
||||||
*/
|
*/
|
||||||
r = archive_write_open_file(cpio->archive, cpio->filename);
|
r = archive_write_open_filename(cpio->archive, cpio->filename);
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
||||||
lr = lafe_line_reader("-", cpio->option_null);
|
lr = lafe_line_reader("-", cpio->option_null);
|
||||||
|
|
@ -527,17 +615,62 @@ mode_out(struct cpio *cpio)
|
||||||
}
|
}
|
||||||
|
|
||||||
r = archive_write_close(cpio->archive);
|
r = archive_write_close(cpio->archive);
|
||||||
|
if (cpio->dot)
|
||||||
|
fprintf(stderr, "\n");
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
||||||
|
|
||||||
if (!cpio->quiet) {
|
if (!cpio->quiet) {
|
||||||
int64_t blocks =
|
int64_t blocks =
|
||||||
(archive_position_uncompressed(cpio->archive) + 511)
|
(archive_filter_bytes(cpio->archive, 0) + 511)
|
||||||
/ 512;
|
/ 512;
|
||||||
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
||||||
blocks == 1 ? "block" : "blocks");
|
blocks == 1 ? "block" : "blocks");
|
||||||
}
|
}
|
||||||
archive_write_finish(cpio->archive);
|
archive_write_free(cpio->archive);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
remove_leading_slash(const char *p)
|
||||||
|
{
|
||||||
|
const char *rp;
|
||||||
|
|
||||||
|
/* Remove leading "//./" or "//?/" or "//?/UNC/"
|
||||||
|
* (absolute path prefixes used by Windows API) */
|
||||||
|
if ((p[0] == '/' || p[0] == '\\') &&
|
||||||
|
(p[1] == '/' || p[1] == '\\') &&
|
||||||
|
(p[2] == '.' || p[2] == '?') &&
|
||||||
|
(p[3] == '/' || p[3] == '\\'))
|
||||||
|
{
|
||||||
|
if (p[2] == '?' &&
|
||||||
|
(p[4] == 'U' || p[4] == 'u') &&
|
||||||
|
(p[5] == 'N' || p[5] == 'n') &&
|
||||||
|
(p[6] == 'C' || p[6] == 'c') &&
|
||||||
|
(p[7] == '/' || p[7] == '\\'))
|
||||||
|
p += 8;
|
||||||
|
else
|
||||||
|
p += 4;
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
rp = p;
|
||||||
|
/* Remove leading drive letter from archives created
|
||||||
|
* on Windows. */
|
||||||
|
if (((p[0] >= 'a' && p[0] <= 'z') ||
|
||||||
|
(p[0] >= 'A' && p[0] <= 'Z')) &&
|
||||||
|
p[1] == ':') {
|
||||||
|
p += 2;
|
||||||
|
}
|
||||||
|
/* Remove leading "/../", "//", etc. */
|
||||||
|
while (p[0] == '/' || p[0] == '\\') {
|
||||||
|
if (p[1] == '.' && p[2] == '.' &&
|
||||||
|
(p[3] == '/' || p[3] == '\\')) {
|
||||||
|
p += 3; /* Remove "/..", leave "/"
|
||||||
|
* for next pass. */
|
||||||
|
} else
|
||||||
|
p += 1; /* Remove "/". */
|
||||||
|
}
|
||||||
|
} while (rp != p);
|
||||||
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -551,7 +684,6 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
|
||||||
const char *destpath;
|
const char *destpath;
|
||||||
struct archive_entry *entry, *spare;
|
struct archive_entry *entry, *spare;
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *p;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -571,14 +703,19 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
|
||||||
lafe_warnc(0, "%s",
|
lafe_warnc(0, "%s",
|
||||||
archive_error_string(cpio->archive_read_disk));
|
archive_error_string(cpio->archive_read_disk));
|
||||||
if (r <= ARCHIVE_FAILED) {
|
if (r <= ARCHIVE_FAILED) {
|
||||||
|
archive_entry_free(entry);
|
||||||
cpio->return_value = 1;
|
cpio->return_value = 1;
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpio->uid_override >= 0)
|
if (cpio->uid_override >= 0) {
|
||||||
archive_entry_set_uid(entry, cpio->uid_override);
|
archive_entry_set_uid(entry, cpio->uid_override);
|
||||||
if (cpio->gid_override >= 0)
|
archive_entry_set_uname(entry, cpio->uname_override);
|
||||||
|
}
|
||||||
|
if (cpio->gid_override >= 0) {
|
||||||
archive_entry_set_gid(entry, cpio->gid_override);
|
archive_entry_set_gid(entry, cpio->gid_override);
|
||||||
|
archive_entry_set_gname(entry, cpio->gname_override);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a destination path for this entry.
|
* Generate a destination path for this entry.
|
||||||
|
|
@ -601,10 +738,7 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
|
||||||
"Can't allocate path buffer");
|
"Can't allocate path buffer");
|
||||||
}
|
}
|
||||||
strcpy(cpio->pass_destpath, cpio->destdir);
|
strcpy(cpio->pass_destpath, cpio->destdir);
|
||||||
p = srcpath;
|
strcat(cpio->pass_destpath, remove_leading_slash(srcpath));
|
||||||
while (p[0] == '/')
|
|
||||||
++p;
|
|
||||||
strcat(cpio->pass_destpath, p);
|
|
||||||
destpath = cpio->pass_destpath;
|
destpath = cpio->pass_destpath;
|
||||||
}
|
}
|
||||||
if (cpio->option_rename)
|
if (cpio->option_rename)
|
||||||
|
|
@ -646,6 +780,8 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
|
||||||
/* Print out the destination name to the user. */
|
/* Print out the destination name to the user. */
|
||||||
if (cpio->verbose)
|
if (cpio->verbose)
|
||||||
fprintf(stderr,"%s", destpath);
|
fprintf(stderr,"%s", destpath);
|
||||||
|
if (cpio->dot)
|
||||||
|
fprintf(stderr, ".");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Option_link only makes sense in pass mode and for
|
* Option_link only makes sense in pass mode and for
|
||||||
|
|
@ -715,19 +851,22 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
|
||||||
if (r == ARCHIVE_FATAL)
|
if (r == ARCHIVE_FATAL)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
if (r >= ARCHIVE_WARN && fd >= 0) {
|
if (r >= ARCHIVE_WARN && archive_entry_size(entry) > 0 && fd >= 0) {
|
||||||
bytes_read = read(fd, cpio->buff, cpio->buff_size);
|
bytes_read = read(fd, cpio->buff, (unsigned)cpio->buff_size);
|
||||||
while (bytes_read > 0) {
|
while (bytes_read > 0) {
|
||||||
r = archive_write_data(cpio->archive,
|
ssize_t bytes_write;
|
||||||
|
bytes_write = archive_write_data(cpio->archive,
|
||||||
cpio->buff, bytes_read);
|
cpio->buff, bytes_read);
|
||||||
if (r < 0)
|
if (bytes_write < 0)
|
||||||
lafe_errc(1, archive_errno(cpio->archive),
|
lafe_errc(1, archive_errno(cpio->archive),
|
||||||
"%s", archive_error_string(cpio->archive));
|
"%s", archive_error_string(cpio->archive));
|
||||||
if (r < bytes_read) {
|
if (bytes_write < bytes_read) {
|
||||||
lafe_warnc(0,
|
lafe_warnc(0,
|
||||||
"Truncated write; file may have grown while being archived.");
|
"Truncated write; file may have "
|
||||||
|
"grown while being archived.");
|
||||||
}
|
}
|
||||||
bytes_read = read(fd, cpio->buff, cpio->buff_size);
|
bytes_read = read(fd, cpio->buff,
|
||||||
|
(unsigned)cpio->buff_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -815,10 +954,18 @@ mode_in(struct cpio *cpio)
|
||||||
a = archive_read_new();
|
a = archive_read_new();
|
||||||
if (a == NULL)
|
if (a == NULL)
|
||||||
lafe_errc(1, 0, "Couldn't allocate archive object");
|
lafe_errc(1, 0, "Couldn't allocate archive object");
|
||||||
archive_read_support_compression_all(a);
|
archive_read_support_filter_all(a);
|
||||||
archive_read_support_format_all(a);
|
archive_read_support_format_all(a);
|
||||||
|
if (cpio->passphrase != NULL)
|
||||||
|
r = archive_read_add_passphrase(a, cpio->passphrase);
|
||||||
|
else
|
||||||
|
r = archive_read_set_passphrase_callback(a, cpio,
|
||||||
|
&passphrase_callback);
|
||||||
|
if (r != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "%s", archive_error_string(a));
|
||||||
|
|
||||||
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
|
if (archive_read_open_filename(a, cpio->filename,
|
||||||
|
cpio->bytes_per_block))
|
||||||
lafe_errc(1, archive_errno(a),
|
lafe_errc(1, archive_errno(a),
|
||||||
"%s", archive_error_string(a));
|
"%s", archive_error_string(a));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -829,7 +976,7 @@ mode_in(struct cpio *cpio)
|
||||||
lafe_errc(1, archive_errno(a),
|
lafe_errc(1, archive_errno(a),
|
||||||
"%s", archive_error_string(a));
|
"%s", archive_error_string(a));
|
||||||
}
|
}
|
||||||
if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
|
if (archive_match_path_excluded(cpio->matching, entry))
|
||||||
continue;
|
continue;
|
||||||
if (cpio->option_rename) {
|
if (cpio->option_rename) {
|
||||||
destpath = cpio_rename(archive_entry_pathname(entry));
|
destpath = cpio_rename(archive_entry_pathname(entry));
|
||||||
|
|
@ -839,7 +986,9 @@ mode_in(struct cpio *cpio)
|
||||||
if (destpath == NULL)
|
if (destpath == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (cpio->verbose)
|
if (cpio->verbose)
|
||||||
fprintf(stdout, "%s\n", destpath);
|
fprintf(stderr, "%s\n", destpath);
|
||||||
|
if (cpio->dot)
|
||||||
|
fprintf(stderr, ".");
|
||||||
if (cpio->uid_override >= 0)
|
if (cpio->uid_override >= 0)
|
||||||
archive_entry_set_uid(entry, cpio->uid_override);
|
archive_entry_set_uid(entry, cpio->uid_override);
|
||||||
if (cpio->gid_override >= 0)
|
if (cpio->gid_override >= 0)
|
||||||
|
|
@ -849,26 +998,29 @@ mode_in(struct cpio *cpio)
|
||||||
fprintf(stderr, "%s: %s\n",
|
fprintf(stderr, "%s: %s\n",
|
||||||
archive_entry_pathname(entry),
|
archive_entry_pathname(entry),
|
||||||
archive_error_string(ext));
|
archive_error_string(ext));
|
||||||
} else if (archive_entry_size(entry) > 0) {
|
} else if (!archive_entry_size_is_set(entry)
|
||||||
|
|| archive_entry_size(entry) > 0) {
|
||||||
r = extract_data(a, ext);
|
r = extract_data(a, ext);
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
cpio->return_value = 1;
|
cpio->return_value = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r = archive_read_close(a);
|
r = archive_read_close(a);
|
||||||
|
if (cpio->dot)
|
||||||
|
fprintf(stderr, "\n");
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(a));
|
lafe_errc(1, 0, "%s", archive_error_string(a));
|
||||||
r = archive_write_close(ext);
|
r = archive_write_close(ext);
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(ext));
|
lafe_errc(1, 0, "%s", archive_error_string(ext));
|
||||||
if (!cpio->quiet) {
|
if (!cpio->quiet) {
|
||||||
int64_t blocks = (archive_position_uncompressed(a) + 511)
|
int64_t blocks = (archive_filter_bytes(a, 0) + 511)
|
||||||
/ 512;
|
/ 512;
|
||||||
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
||||||
blocks == 1 ? "block" : "blocks");
|
blocks == 1 ? "block" : "blocks");
|
||||||
}
|
}
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
archive_write_finish(ext);
|
archive_write_free(ext);
|
||||||
exit(cpio->return_value);
|
exit(cpio->return_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -882,7 +1034,7 @@ extract_data(struct archive *ar, struct archive *aw)
|
||||||
int r;
|
int r;
|
||||||
size_t size;
|
size_t size;
|
||||||
const void *block;
|
const void *block;
|
||||||
off_t offset;
|
int64_t offset;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
r = archive_read_data_block(ar, &block, &size, &offset);
|
r = archive_read_data_block(ar, &block, &size, &offset);
|
||||||
|
|
@ -893,7 +1045,7 @@ extract_data(struct archive *ar, struct archive *aw)
|
||||||
"%s", archive_error_string(ar));
|
"%s", archive_error_string(ar));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
r = archive_write_data_block(aw, block, size, offset);
|
r = (int)archive_write_data_block(aw, block, size, offset);
|
||||||
if (r != ARCHIVE_OK) {
|
if (r != ARCHIVE_OK) {
|
||||||
lafe_warnc(archive_errno(aw),
|
lafe_warnc(archive_errno(aw),
|
||||||
"%s", archive_error_string(aw));
|
"%s", archive_error_string(aw));
|
||||||
|
|
@ -912,10 +1064,18 @@ mode_list(struct cpio *cpio)
|
||||||
a = archive_read_new();
|
a = archive_read_new();
|
||||||
if (a == NULL)
|
if (a == NULL)
|
||||||
lafe_errc(1, 0, "Couldn't allocate archive object");
|
lafe_errc(1, 0, "Couldn't allocate archive object");
|
||||||
archive_read_support_compression_all(a);
|
archive_read_support_filter_all(a);
|
||||||
archive_read_support_format_all(a);
|
archive_read_support_format_all(a);
|
||||||
|
if (cpio->passphrase != NULL)
|
||||||
|
r = archive_read_add_passphrase(a, cpio->passphrase);
|
||||||
|
else
|
||||||
|
r = archive_read_set_passphrase_callback(a, cpio,
|
||||||
|
&passphrase_callback);
|
||||||
|
if (r != ARCHIVE_OK)
|
||||||
|
lafe_errc(1, 0, "%s", archive_error_string(a));
|
||||||
|
|
||||||
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
|
if (archive_read_open_filename(a, cpio->filename,
|
||||||
|
cpio->bytes_per_block))
|
||||||
lafe_errc(1, archive_errno(a),
|
lafe_errc(1, archive_errno(a),
|
||||||
"%s", archive_error_string(a));
|
"%s", archive_error_string(a));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -926,7 +1086,7 @@ mode_list(struct cpio *cpio)
|
||||||
lafe_errc(1, archive_errno(a),
|
lafe_errc(1, archive_errno(a),
|
||||||
"%s", archive_error_string(a));
|
"%s", archive_error_string(a));
|
||||||
}
|
}
|
||||||
if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
|
if (archive_match_path_excluded(cpio->matching, entry))
|
||||||
continue;
|
continue;
|
||||||
if (cpio->verbose)
|
if (cpio->verbose)
|
||||||
list_item_verbose(cpio, entry);
|
list_item_verbose(cpio, entry);
|
||||||
|
|
@ -937,12 +1097,12 @@ mode_list(struct cpio *cpio)
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(a));
|
lafe_errc(1, 0, "%s", archive_error_string(a));
|
||||||
if (!cpio->quiet) {
|
if (!cpio->quiet) {
|
||||||
int64_t blocks = (archive_position_uncompressed(a) + 511)
|
int64_t blocks = (archive_filter_bytes(a, 0) + 511)
|
||||||
/ 512;
|
/ 512;
|
||||||
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
||||||
blocks == 1 ? "block" : "blocks");
|
blocks == 1 ? "block" : "blocks");
|
||||||
}
|
}
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -979,11 +1139,11 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
|
||||||
/* Use uname if it's present, else lookup name from uid. */
|
/* Use uname if it's present, else lookup name from uid. */
|
||||||
uname = archive_entry_uname(entry);
|
uname = archive_entry_uname(entry);
|
||||||
if (uname == NULL)
|
if (uname == NULL)
|
||||||
uname = lookup_uname(cpio, archive_entry_uid(entry));
|
uname = lookup_uname(cpio, (uid_t)archive_entry_uid(entry));
|
||||||
/* Use gname if it's present, else lookup name from gid. */
|
/* Use gname if it's present, else lookup name from gid. */
|
||||||
gname = archive_entry_gname(entry);
|
gname = archive_entry_gname(entry);
|
||||||
if (gname == NULL)
|
if (gname == NULL)
|
||||||
gname = lookup_gname(cpio, archive_entry_gid(entry));
|
gname = lookup_gname(cpio, (uid_t)archive_entry_gid(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print device number or file size. */
|
/* Print device number or file size. */
|
||||||
|
|
@ -1006,7 +1166,8 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
|
||||||
else
|
else
|
||||||
fmt = cpio->day_first ? "%d %b %H:%M" : "%b %d %H:%M";
|
fmt = cpio->day_first ? "%d %b %H:%M" : "%b %d %H:%M";
|
||||||
#else
|
#else
|
||||||
if (abs(mtime - now) > (365/2)*86400)
|
if (mtime - now > 365*86400/2
|
||||||
|
|| mtime - now < -365*86400/2)
|
||||||
fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y";
|
fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y";
|
||||||
else
|
else
|
||||||
fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
|
fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
|
||||||
|
|
@ -1065,18 +1226,20 @@ mode_pass(struct cpio *cpio, const char *destdir)
|
||||||
|
|
||||||
archive_entry_linkresolver_free(cpio->linkresolver);
|
archive_entry_linkresolver_free(cpio->linkresolver);
|
||||||
r = archive_write_close(cpio->archive);
|
r = archive_write_close(cpio->archive);
|
||||||
|
if (cpio->dot)
|
||||||
|
fprintf(stderr, "\n");
|
||||||
if (r != ARCHIVE_OK)
|
if (r != ARCHIVE_OK)
|
||||||
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
|
||||||
|
|
||||||
if (!cpio->quiet) {
|
if (!cpio->quiet) {
|
||||||
int64_t blocks =
|
int64_t blocks =
|
||||||
(archive_position_uncompressed(cpio->archive) + 511)
|
(archive_filter_bytes(cpio->archive, 0) + 511)
|
||||||
/ 512;
|
/ 512;
|
||||||
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
|
||||||
blocks == 1 ? "block" : "blocks");
|
blocks == 1 ? "block" : "blocks");
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_write_finish(cpio->archive);
|
archive_write_free(cpio->archive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1092,12 +1255,26 @@ cpio_rename(const char *name)
|
||||||
static char buff[1024];
|
static char buff[1024];
|
||||||
FILE *t;
|
FILE *t;
|
||||||
char *p, *ret;
|
char *p, *ret;
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
FILE *to;
|
||||||
|
|
||||||
|
t = fopen("CONIN$", "r");
|
||||||
|
if (t == NULL)
|
||||||
|
return (name);
|
||||||
|
to = fopen("CONOUT$", "w");
|
||||||
|
if (to == NULL) {
|
||||||
|
fclose(t);
|
||||||
|
return (name);
|
||||||
|
}
|
||||||
|
fprintf(to, "%s (Enter/./(new name))? ", name);
|
||||||
|
fclose(to);
|
||||||
|
#else
|
||||||
t = fopen("/dev/tty", "r+");
|
t = fopen("/dev/tty", "r+");
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
return (name);
|
return (name);
|
||||||
fprintf(t, "%s (Enter/./(new name))? ", name);
|
fprintf(t, "%s (Enter/./(new name))? ", name);
|
||||||
fflush(t);
|
fflush(t);
|
||||||
|
#endif
|
||||||
|
|
||||||
p = fgets(buff, sizeof(buff), t);
|
p = fgets(buff, sizeof(buff), t);
|
||||||
fclose(t);
|
fclose(t);
|
||||||
|
|
@ -1148,10 +1325,9 @@ lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
|
||||||
|
|
||||||
|
|
||||||
if (*name_cache_variable == NULL) {
|
if (*name_cache_variable == NULL) {
|
||||||
*name_cache_variable = malloc(sizeof(struct name_cache));
|
*name_cache_variable = calloc(1, sizeof(struct name_cache));
|
||||||
if (*name_cache_variable == NULL)
|
if (*name_cache_variable == NULL)
|
||||||
lafe_errc(1, ENOMEM, "No more memory");
|
lafe_errc(1, ENOMEM, "No more memory");
|
||||||
memset(*name_cache_variable, 0, sizeof(struct name_cache));
|
|
||||||
(*name_cache_variable)->size = name_cache_size;
|
(*name_cache_variable)->size = name_cache_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1168,23 +1344,23 @@ lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
|
||||||
cache->cache[slot].name = NULL;
|
cache->cache[slot].name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup_fn(cpio, &name, id) == 0) {
|
if (lookup_fn(cpio, &name, id)) {
|
||||||
if (name == NULL || name[0] == '\0') {
|
/* If lookup failed, format it as a number. */
|
||||||
/* If lookup failed, format it as a number. */
|
snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
|
||||||
snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
|
name = asnum;
|
||||||
name = asnum;
|
|
||||||
}
|
|
||||||
cache->cache[slot].name = strdup(name);
|
|
||||||
if (cache->cache[slot].name != NULL) {
|
|
||||||
cache->cache[slot].id = id;
|
|
||||||
return (cache->cache[slot].name);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Conveniently, NULL marks an empty slot, so
|
|
||||||
* if the strdup() fails, we've just failed to
|
|
||||||
* cache it. No recovery necessary.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cache->cache[slot].name = strdup(name);
|
||||||
|
if (cache->cache[slot].name != NULL) {
|
||||||
|
cache->cache[slot].id = id;
|
||||||
|
return (cache->cache[slot].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Conveniently, NULL marks an empty slot, so
|
||||||
|
* if the strdup() fails, we've just failed to
|
||||||
|
* cache it. No recovery necessary.
|
||||||
|
*/
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1205,14 +1381,14 @@ lookup_uname_helper(struct cpio *cpio, const char **name, id_t id)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pwent = getpwuid((uid_t)id);
|
pwent = getpwuid((uid_t)id);
|
||||||
if (pwent == NULL) {
|
if (pwent == NULL) {
|
||||||
*name = NULL;
|
if (errno && errno != ENOENT)
|
||||||
if (errno != 0 && errno != ENOENT)
|
lafe_warnc(errno, "getpwuid(%s) failed",
|
||||||
lafe_warnc(errno, "getpwuid(%d) failed", id);
|
cpio_i64toa((int64_t)id));
|
||||||
return (errno);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*name = pwent->pw_name;
|
*name = pwent->pw_name;
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
|
@ -1232,14 +1408,14 @@ lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
grent = getgrgid((gid_t)id);
|
grent = getgrgid((gid_t)id);
|
||||||
if (grent == NULL) {
|
if (grent == NULL) {
|
||||||
*name = NULL;
|
if (errno && errno != ENOENT)
|
||||||
if (errno != 0)
|
lafe_warnc(errno, "getgrgid(%s) failed",
|
||||||
lafe_warnc(errno, "getgrgid(%d) failed", id);
|
cpio_i64toa((int64_t)id));
|
||||||
return (errno);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*name = grent->gr_name;
|
*name = grent->gr_name;
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1250,8 +1426,9 @@ lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
|
||||||
const char *
|
const char *
|
||||||
cpio_i64toa(int64_t n0)
|
cpio_i64toa(int64_t n0)
|
||||||
{
|
{
|
||||||
// 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
|
/* 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
|
||||||
// We also need 1 byte for '-' and 1 for '\0'.
|
* We also need 1 byte for '-' and 1 for '\0'.
|
||||||
|
*/
|
||||||
static char buff[22];
|
static char buff[22];
|
||||||
int64_t n = n0 < 0 ? -n0 : n0;
|
int64_t n = n0 < 0 ? -n0 : n0;
|
||||||
char *p = buff + sizeof(buff);
|
char *p = buff + sizeof(buff);
|
||||||
|
|
@ -1265,3 +1442,28 @@ cpio_i64toa(int64_t n0)
|
||||||
*--p = '-';
|
*--p = '-';
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PPBUFF_SIZE 1024
|
||||||
|
static const char *
|
||||||
|
passphrase_callback(struct archive *a, void *_client_data)
|
||||||
|
{
|
||||||
|
struct cpio *cpio = (struct cpio *)_client_data;
|
||||||
|
(void)a; /* UNUSED */
|
||||||
|
|
||||||
|
if (cpio->ppbuff == NULL) {
|
||||||
|
cpio->ppbuff = malloc(PPBUFF_SIZE);
|
||||||
|
if (cpio->ppbuff == NULL)
|
||||||
|
lafe_errc(1, errno, "Out of memory");
|
||||||
|
}
|
||||||
|
return lafe_readpassphrase("Enter passphrase:",
|
||||||
|
cpio->ppbuff, PPBUFF_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
passphrase_free(char *ppbuff)
|
||||||
|
{
|
||||||
|
if (ppbuff != NULL) {
|
||||||
|
memset(ppbuff, 0, PPBUFF_SIZE);
|
||||||
|
free(ppbuff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
26
external/bsd/libarchive/dist/cpio/cpio.h
vendored
26
external/bsd/libarchive/dist/cpio/cpio.h
vendored
|
|
@ -31,8 +31,6 @@
|
||||||
#include "cpio_platform.h"
|
#include "cpio_platform.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "matching.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The internal state for the "cpio" program.
|
* The internal state for the "cpio" program.
|
||||||
*
|
*
|
||||||
|
|
@ -43,18 +41,19 @@
|
||||||
*/
|
*/
|
||||||
struct cpio {
|
struct cpio {
|
||||||
/* Option parsing */
|
/* Option parsing */
|
||||||
const char *optarg;
|
const char *argument;
|
||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
|
int add_filter; /* --uuencode */
|
||||||
const char *filename;
|
const char *filename;
|
||||||
char mode; /* -i -o -p */
|
int mode; /* -i -o -p */
|
||||||
char compress; /* -j, -y, or -z */
|
int compress; /* -j, -y, or -z */
|
||||||
const char *format; /* -H format */
|
const char *format; /* -H format */
|
||||||
int bytes_per_block; /* -b block_size */
|
int bytes_per_block; /* -b block_size */
|
||||||
int verbose; /* -v */
|
int verbose; /* -v */
|
||||||
|
int dot; /* -V */
|
||||||
int quiet; /* --quiet */
|
int quiet; /* --quiet */
|
||||||
int extract_flags; /* Flags for extract operation */
|
int extract_flags; /* Flags for extract operation */
|
||||||
char symlink_mode; /* H or L, per BSD conventions */
|
|
||||||
const char *compress_program;
|
const char *compress_program;
|
||||||
int option_append; /* -A, only relevant for -o */
|
int option_append; /* -A, only relevant for -o */
|
||||||
int option_atime_restore; /* -a */
|
int option_atime_restore; /* -a */
|
||||||
|
|
@ -68,8 +67,11 @@ struct cpio {
|
||||||
size_t pass_destpath_alloc;
|
size_t pass_destpath_alloc;
|
||||||
char *pass_destpath;
|
char *pass_destpath;
|
||||||
int uid_override;
|
int uid_override;
|
||||||
|
char *uname_override;
|
||||||
int gid_override;
|
int gid_override;
|
||||||
|
char *gname_override;
|
||||||
int day_first; /* true if locale prefers day/mon */
|
int day_first; /* true if locale prefers day/mon */
|
||||||
|
const char *passphrase;
|
||||||
|
|
||||||
/* If >= 0, then close this when done. */
|
/* If >= 0, then close this when done. */
|
||||||
int fd;
|
int fd;
|
||||||
|
|
@ -86,9 +88,10 @@ struct cpio {
|
||||||
struct name_cache *gname_cache;
|
struct name_cache *gname_cache;
|
||||||
|
|
||||||
/* Work data. */
|
/* Work data. */
|
||||||
struct lafe_matching *matching;
|
struct archive *matching;
|
||||||
char *buff;
|
char *buff;
|
||||||
size_t buff_size;
|
size_t buff_size;
|
||||||
|
char *ppbuff;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *owner_parse(const char *, int *, int *);
|
const char *owner_parse(const char *, int *, int *);
|
||||||
|
|
@ -96,11 +99,18 @@ const char *owner_parse(const char *, int *, int *);
|
||||||
|
|
||||||
/* Fake short equivalents for long options that otherwise lack them. */
|
/* Fake short equivalents for long options that otherwise lack them. */
|
||||||
enum {
|
enum {
|
||||||
OPTION_INSECURE = 1,
|
OPTION_B64ENCODE = 1,
|
||||||
|
OPTION_GRZIP,
|
||||||
|
OPTION_INSECURE,
|
||||||
|
OPTION_LRZIP,
|
||||||
|
OPTION_LZ4,
|
||||||
OPTION_LZMA,
|
OPTION_LZMA,
|
||||||
|
OPTION_LZOP,
|
||||||
|
OPTION_PASSPHRASE,
|
||||||
OPTION_NO_PRESERVE_OWNER,
|
OPTION_NO_PRESERVE_OWNER,
|
||||||
OPTION_PRESERVE_OWNER,
|
OPTION_PRESERVE_OWNER,
|
||||||
OPTION_QUIET,
|
OPTION_QUIET,
|
||||||
|
OPTION_UUENCODE,
|
||||||
OPTION_VERSION
|
OPTION_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
#include "cpio_windows.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get a real definition for __FBSDID if we can */
|
/* Get a real definition for __FBSDID if we can */
|
||||||
#if HAVE_SYS_CDEFS_H
|
#if HAVE_SYS_CDEFS_H
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
@ -70,8 +74,4 @@
|
||||||
#define __LA_DEAD
|
#define __LA_DEAD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
||||||
#include "cpio_windows.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !CPIO_PLATFORM_H_INCLUDED */
|
#endif /* !CPIO_PLATFORM_H_INCLUDED */
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ cpio_dosmaperr(unsigned long e)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < sizeof(doserrors); i++) {
|
for (i = 0; i < (int)sizeof(doserrors); i++) {
|
||||||
if (doserrors[i].winerr == e) {
|
if (doserrors[i].winerr == e) {
|
||||||
errno = doserrors[i].doserr;
|
errno = doserrors[i].doserr;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
#ifndef CPIO_WINDOWS_H
|
#ifndef CPIO_WINDOWS_H
|
||||||
#define CPIO_WINDOWS_H 1
|
#define CPIO_WINDOWS_H 1
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -35,8 +36,10 @@
|
||||||
#define getpwnam(name) NULL
|
#define getpwnam(name) NULL
|
||||||
#define getpwuid(id) NULL
|
#define getpwuid(id) NULL
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER)
|
||||||
#define snprintf sprintf_s
|
#if _MSC_VER < 1900
|
||||||
|
#define snprintf sprintf_s
|
||||||
|
#endif // _MSC_VER < 1900
|
||||||
#define strdup _strdup
|
#define strdup _strdup
|
||||||
#define open _open
|
#define open _open
|
||||||
#define read _read
|
#define read _read
|
||||||
|
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
############################################
|
|
||||||
#
|
|
||||||
# How to build bsdcpio_test
|
|
||||||
#
|
|
||||||
############################################
|
|
||||||
IF(ENABLE_CPIO AND ENABLE_TEST)
|
|
||||||
SET(bsdcpio_test_SOURCES
|
|
||||||
../cmdline.c
|
|
||||||
../../libarchive_fe/err.c
|
|
||||||
../../libarchive_fe/pathmatch.c
|
|
||||||
main.c
|
|
||||||
test.h
|
|
||||||
test_0.c
|
|
||||||
test_basic.c
|
|
||||||
test_cmdline.c
|
|
||||||
test_format_newc.c
|
|
||||||
test_gcpio_compat.c
|
|
||||||
test_option_B_upper.c
|
|
||||||
test_option_C_upper.c
|
|
||||||
test_option_J_upper.c
|
|
||||||
test_option_L_upper.c
|
|
||||||
test_option_Z_upper.c
|
|
||||||
test_option_a.c
|
|
||||||
test_option_c.c
|
|
||||||
test_option_d.c
|
|
||||||
test_option_f.c
|
|
||||||
test_option_help.c
|
|
||||||
test_option_l.c
|
|
||||||
test_option_lzma.c
|
|
||||||
test_option_m.c
|
|
||||||
test_option_t.c
|
|
||||||
test_option_u.c
|
|
||||||
test_option_version.c
|
|
||||||
test_option_y.c
|
|
||||||
test_option_z.c
|
|
||||||
test_owner_parse.c
|
|
||||||
test_passthrough_dotdot.c
|
|
||||||
test_passthrough_reverse.c
|
|
||||||
test_pathmatch.c
|
|
||||||
)
|
|
||||||
IF(WIN32 AND NOT CYGWIN)
|
|
||||||
LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h)
|
|
||||||
ENDIF(WIN32 AND NOT CYGWIN)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Register target
|
|
||||||
#
|
|
||||||
ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES})
|
|
||||||
SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
|
|
||||||
#
|
|
||||||
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
|
|
||||||
${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES})
|
|
||||||
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
# list.h has a line DEFINE_TEST(testname) for every
|
|
||||||
# test. We can use that to define the tests for cmake by
|
|
||||||
# defining a DEFINE_TEST macro and reading list.h in.
|
|
||||||
MACRO (DEFINE_TEST _testname)
|
|
||||||
ADD_TEST_28(
|
|
||||||
NAME bsdcpio_${_testname}
|
|
||||||
COMMAND bsdcpio_test -vv
|
|
||||||
-p $<TARGET_FILE:bsdcpio>
|
|
||||||
-r ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${_testname})
|
|
||||||
ENDMACRO (DEFINE_TEST _testname)
|
|
||||||
|
|
||||||
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
|
|
||||||
|
|
||||||
# Experimental new test handling
|
|
||||||
ADD_CUSTOM_TARGET(run_bsdcpio_test
|
|
||||||
COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio)
|
|
||||||
ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test)
|
|
||||||
ENDIF(ENABLE_CPIO AND ENABLE_TEST)
|
|
||||||
|
|
||||||
27
external/bsd/libarchive/dist/cpio/test/list.h
vendored
27
external/bsd/libarchive/dist/cpio/test/list.h
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
DEFINE_TEST(test_0)
|
|
||||||
DEFINE_TEST(test_basic)
|
|
||||||
DEFINE_TEST(test_cmdline)
|
|
||||||
DEFINE_TEST(test_format_newc)
|
|
||||||
DEFINE_TEST(test_gcpio_compat)
|
|
||||||
DEFINE_TEST(test_option_B_upper)
|
|
||||||
DEFINE_TEST(test_option_C_upper)
|
|
||||||
DEFINE_TEST(test_option_J_upper)
|
|
||||||
DEFINE_TEST(test_option_L_upper)
|
|
||||||
DEFINE_TEST(test_option_Z_upper)
|
|
||||||
DEFINE_TEST(test_option_a)
|
|
||||||
DEFINE_TEST(test_option_c)
|
|
||||||
DEFINE_TEST(test_option_d)
|
|
||||||
DEFINE_TEST(test_option_f)
|
|
||||||
DEFINE_TEST(test_option_help)
|
|
||||||
DEFINE_TEST(test_option_l)
|
|
||||||
DEFINE_TEST(test_option_lzma)
|
|
||||||
DEFINE_TEST(test_option_m)
|
|
||||||
DEFINE_TEST(test_option_t)
|
|
||||||
DEFINE_TEST(test_option_u)
|
|
||||||
DEFINE_TEST(test_option_version)
|
|
||||||
DEFINE_TEST(test_option_y)
|
|
||||||
DEFINE_TEST(test_option_z)
|
|
||||||
DEFINE_TEST(test_owner_parse)
|
|
||||||
DEFINE_TEST(test_passthrough_dotdot)
|
|
||||||
DEFINE_TEST(test_passthrough_reverse)
|
|
||||||
DEFINE_TEST(test_pathmatch)
|
|
||||||
2140
external/bsd/libarchive/dist/cpio/test/main.c
vendored
2140
external/bsd/libarchive/dist/cpio/test/main.c
vendored
File diff suppressed because it is too large
Load Diff
269
external/bsd/libarchive/dist/cpio/test/test.h
vendored
269
external/bsd/libarchive/dist/cpio/test/test.h
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2006 Tim Kientzle
|
* Copyright (c) 2003-2017 Tim Kientzle
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|
@ -22,264 +22,19 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $FreeBSD: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Every test program should #include "test.h" as the first thing. */
|
/* Every test program should #include "test.h" as the first thing. */
|
||||||
|
|
||||||
/*
|
#define KNOWNREF "test_option_f.cpio.uu"
|
||||||
* The goal of this file (and the matching test.c) is to
|
#define ENVBASE "BSDCPIO" /* Prefix for environment variables. */
|
||||||
* simplify the very repetitive test-*.c test programs.
|
#define PROGRAM "bsdcpio" /* Name of program being tested. */
|
||||||
*/
|
#define PROGRAM_ALIAS "cpio" /* Generic alias for program */
|
||||||
#if defined(HAVE_CONFIG_H)
|
#undef LIBRARY /* Not testing a library. */
|
||||||
/* Most POSIX platforms use the 'configure' script to build config.h */
|
#undef EXTRA_DUMP /* How to dump extra data */
|
||||||
#include "config.h"
|
#undef EXTRA_ERRNO /* How to dump errno */
|
||||||
#elif defined(__FreeBSD__)
|
/* How to generate extra version info. */
|
||||||
/* Building as part of FreeBSD system requires a pre-built config.h. */
|
#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "")
|
||||||
#include "config_freebsd.h"
|
|
||||||
#elif defined(_WIN32) && !defined(__CYGWIN__)
|
|
||||||
/* Win32 can't run the 'configure' script. */
|
|
||||||
#include "config_windows.h"
|
|
||||||
#else
|
|
||||||
/* Warn if the library hasn't been (automatically or manually) configured. */
|
|
||||||
#error Oops: No config.h and no pre-built configuration in test.h.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h> /* Windows requires this before sys/stat.h */
|
#include "test_common.h"
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#ifdef USE_DMALLOC
|
|
||||||
#include <dmalloc.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_DIRENT_H
|
|
||||||
#include <dirent.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_DIRECT_H
|
|
||||||
#include <direct.h>
|
|
||||||
#define dirent direct
|
|
||||||
#endif
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#ifdef HAVE_IO_H
|
|
||||||
#include <io.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include <wchar.h>
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* System-specific tweaks. We really want to minimize these
|
|
||||||
* as much as possible, since they make it harder to understand
|
|
||||||
* the mainline code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Windows (including Visual Studio and MinGW but not Cygwin) */
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
||||||
#include "../cpio_windows.h"
|
|
||||||
#if !defined(__BORLANDC__)
|
|
||||||
#define strdup _strdup
|
|
||||||
#endif
|
|
||||||
#define LOCALE_DE "deu"
|
|
||||||
#else
|
|
||||||
#define LOCALE_DE "de_DE.UTF-8"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Visual Studio */
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define snprintf sprintf_s
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Cygwin */
|
|
||||||
#if defined(__CYGWIN__)
|
|
||||||
/* Cygwin-1.7.x is lazy about populating nlinks, so don't
|
|
||||||
* expect it to be accurate. */
|
|
||||||
# define NLINKS_INACCURATE_FOR_DIRS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__HAIKU__) || defined(__QNXNTO__)
|
|
||||||
/* Haiku and QNX have typedefs in stdint.h (needed for int64_t) */
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get a real definition for __FBSDID if we can */
|
|
||||||
#if HAVE_SYS_CDEFS_H
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If not, define it so as to avoid dangling semicolons. */
|
|
||||||
#ifndef __FBSDID
|
|
||||||
#define __FBSDID(a) struct _undefined_hack
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Redefine DEFINE_TEST for use in defining the test functions.
|
|
||||||
*/
|
|
||||||
#undef DEFINE_TEST
|
|
||||||
#define DEFINE_TEST(name) void name(void); void name(void)
|
|
||||||
|
|
||||||
/* An implementation of the standard assert() macro */
|
|
||||||
#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL)
|
|
||||||
/* chdir() and error if it fails */
|
|
||||||
#define assertChdir(path) \
|
|
||||||
assertion_chdir(__FILE__, __LINE__, path)
|
|
||||||
/* Assert two integers are the same. Reports value of each one if not. */
|
|
||||||
#define assertEqualInt(v1,v2) \
|
|
||||||
assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
|
|
||||||
/* Assert two strings are the same. Reports value of each one if not. */
|
|
||||||
#define assertEqualString(v1,v2) \
|
|
||||||
assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
|
|
||||||
/* As above, but v1 and v2 are wchar_t * */
|
|
||||||
#define assertEqualWString(v1,v2) \
|
|
||||||
assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
|
|
||||||
/* As above, but raw blocks of bytes. */
|
|
||||||
#define assertEqualMem(v1, v2, l) \
|
|
||||||
assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
|
|
||||||
/* Assert two files are the same; allow printf-style expansion of second name.
|
|
||||||
* See below for comments about variable arguments here...
|
|
||||||
*/
|
|
||||||
#define assertEqualFile \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_equal_file
|
|
||||||
/* Assert that a file is empty; supports printf-style arguments. */
|
|
||||||
#define assertEmptyFile \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_empty_file
|
|
||||||
/* Assert that a file is not empty; supports printf-style arguments. */
|
|
||||||
#define assertNonEmptyFile \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_non_empty_file
|
|
||||||
#define assertFileAtime(pathname, sec, nsec) \
|
|
||||||
assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec)
|
|
||||||
#define assertFileAtimeRecent(pathname) \
|
|
||||||
assertion_file_atime_recent(__FILE__, __LINE__, pathname)
|
|
||||||
#define assertFileBirthtime(pathname, sec, nsec) \
|
|
||||||
assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec)
|
|
||||||
#define assertFileBirthtimeRecent(pathname) \
|
|
||||||
assertion_file_birthtime_recent(__FILE__, __LINE__, pathname)
|
|
||||||
/* Assert that a file exists; supports printf-style arguments. */
|
|
||||||
#define assertFileExists \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_file_exists
|
|
||||||
/* Assert that a file exists; supports printf-style arguments. */
|
|
||||||
#define assertFileNotExists \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_file_not_exists
|
|
||||||
/* Assert that file contents match a string; supports printf-style arguments. */
|
|
||||||
#define assertFileContents \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_file_contents
|
|
||||||
#define assertFileMtime(pathname, sec, nsec) \
|
|
||||||
assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
|
|
||||||
#define assertFileMtimeRecent(pathname) \
|
|
||||||
assertion_file_mtime_recent(__FILE__, __LINE__, pathname)
|
|
||||||
#define assertFileNLinks(pathname, nlinks) \
|
|
||||||
assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
|
|
||||||
#define assertFileSize(pathname, size) \
|
|
||||||
assertion_file_size(__FILE__, __LINE__, pathname, size)
|
|
||||||
#define assertTextFileContents \
|
|
||||||
assertion_setup(__FILE__, __LINE__);assertion_text_file_contents
|
|
||||||
#define assertIsDir(pathname, mode) \
|
|
||||||
assertion_is_dir(__FILE__, __LINE__, pathname, mode)
|
|
||||||
#define assertIsHardlink(path1, path2) \
|
|
||||||
assertion_is_hardlink(__FILE__, __LINE__, path1, path2)
|
|
||||||
#define assertIsNotHardlink(path1, path2) \
|
|
||||||
assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2)
|
|
||||||
#define assertIsReg(pathname, mode) \
|
|
||||||
assertion_is_reg(__FILE__, __LINE__, pathname, mode)
|
|
||||||
#define assertIsSymlink(pathname, contents) \
|
|
||||||
assertion_is_symlink(__FILE__, __LINE__, pathname, contents)
|
|
||||||
/* Create a directory, report error if it fails. */
|
|
||||||
#define assertMakeDir(dirname, mode) \
|
|
||||||
assertion_make_dir(__FILE__, __LINE__, dirname, mode)
|
|
||||||
#define assertMakeFile(path, mode, contents) \
|
|
||||||
assertion_make_file(__FILE__, __LINE__, path, mode, contents)
|
|
||||||
#define assertMakeHardlink(newfile, oldfile) \
|
|
||||||
assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
|
|
||||||
#define assertMakeSymlink(newfile, linkto) \
|
|
||||||
assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
|
|
||||||
#define assertUmask(mask) \
|
|
||||||
assertion_umask(__FILE__, __LINE__, mask)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This would be simple with C99 variadic macros, but I don't want to
|
|
||||||
* require that. Instead, I insert a function call before each
|
|
||||||
* skipping() call to pass the file and line information down. Crude,
|
|
||||||
* but effective.
|
|
||||||
*/
|
|
||||||
#define skipping \
|
|
||||||
assertion_setup(__FILE__, __LINE__);test_skipping
|
|
||||||
|
|
||||||
/* Function declarations. These are defined in test_utility.c. */
|
|
||||||
void failure(const char *fmt, ...);
|
|
||||||
int assertion_assert(const char *, int, int, const char *, void *);
|
|
||||||
int assertion_chdir(const char *, int, const char *);
|
|
||||||
int assertion_empty_file(const char *, ...);
|
|
||||||
int assertion_equal_file(const char *, const char *, ...);
|
|
||||||
int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *);
|
|
||||||
int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *);
|
|
||||||
int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
|
|
||||||
int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
|
|
||||||
int assertion_file_atime(const char *, int, const char *, long, long);
|
|
||||||
int assertion_file_atime_recent(const char *, int, const char *);
|
|
||||||
int assertion_file_birthtime(const char *, int, const char *, long, long);
|
|
||||||
int assertion_file_birthtime_recent(const char *, int, const char *);
|
|
||||||
int assertion_file_contents(const void *, int, const char *, ...);
|
|
||||||
int assertion_file_exists(const char *, ...);
|
|
||||||
int assertion_file_mtime(const char *, int, const char *, long, long);
|
|
||||||
int assertion_file_mtime_recent(const char *, int, const char *);
|
|
||||||
int assertion_file_nlinks(const char *, int, const char *, int);
|
|
||||||
int assertion_file_not_exists(const char *, ...);
|
|
||||||
int assertion_file_size(const char *, int, const char *, long);
|
|
||||||
int assertion_is_dir(const char *, int, const char *, int);
|
|
||||||
int assertion_is_hardlink(const char *, int, const char *, const char *);
|
|
||||||
int assertion_is_not_hardlink(const char *, int, const char *, const char *);
|
|
||||||
int assertion_is_reg(const char *, int, const char *, int);
|
|
||||||
int assertion_is_symlink(const char *, int, const char *, const char *);
|
|
||||||
int assertion_make_dir(const char *, int, const char *, int);
|
|
||||||
int assertion_make_file(const char *, int, const char *, int, const char *);
|
|
||||||
int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
|
|
||||||
int assertion_make_symlink(const char *, int, const char *newpath, const char *);
|
|
||||||
int assertion_non_empty_file(const char *, ...);
|
|
||||||
int assertion_text_file_contents(const char *buff, const char *f);
|
|
||||||
int assertion_umask(const char *, int, int);
|
|
||||||
void assertion_setup(const char *, int);
|
|
||||||
|
|
||||||
void test_skipping(const char *fmt, ...);
|
|
||||||
|
|
||||||
/* Like sprintf, then system() */
|
|
||||||
int systemf(const char * fmt, ...);
|
|
||||||
|
|
||||||
/* Delay until time() returns a value after this. */
|
|
||||||
void sleepUntilAfter(time_t);
|
|
||||||
|
|
||||||
/* Return true if this platform can create symlinks. */
|
|
||||||
int canSymlink(void);
|
|
||||||
|
|
||||||
/* Return true if this platform can run the "gzip" program. */
|
|
||||||
int canGzip(void);
|
|
||||||
|
|
||||||
/* Return true if this platform can run the "gunzip" program. */
|
|
||||||
int canGunzip(void);
|
|
||||||
|
|
||||||
/* Suck file into string allocated via malloc(). Call free() when done. */
|
|
||||||
/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
|
|
||||||
char *slurpfile(size_t *, const char *fmt, ...);
|
|
||||||
|
|
||||||
/* Extracts named reference file to the current directory. */
|
|
||||||
void extract_reference_file(const char *);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Special interfaces for program test harness.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Pathname of exe to be tested. */
|
|
||||||
const char *testprogfile;
|
|
||||||
/* Name of exe to use in printf-formatted command strings. */
|
|
||||||
/* On Windows, this includes leading/trailing quotes. */
|
|
||||||
const char *testprog;
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user