CHANGES 1.99.9 -> 1.99.10

+ fix a bug in decryption whereby a bad passphrase would cause a segmentation
  violation
+ fix some regressions in key searching in the underlying find keys routines
+ add C++ declaration protection to the external interface in netpgp.h
+ split out the key management parts of netpgp(1) into netpgpkeys(1)
This commit is contained in:
agc 2009-06-10 00:38:08 +00:00
parent ed545b8d69
commit 7e61309607
28 changed files with 1554 additions and 949 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.2 2009/06/09 00:51:00 agc Exp $
# $NetBSD: Makefile,v 1.3 2009/06/10 00:38:08 agc Exp $
SUBDIR= lib .WAIT
SUBDIR+= netpgp netpgpverify
SUBDIR+= netpgp netpgpkeys netpgpverify
.include <bsd.subdir.mk>

View File

@ -91,7 +91,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -115,7 +114,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -1,8 +1,6 @@
To Do
=====
modify sets lists for netpgpverify
error logging
separate key management program
separate from libcrypto?
64-bit offsets
default compression when signing?
@ -60,3 +58,6 @@ Add --passwd-fd n argument
bring forward netpgpverify mods to netpgp
move directory locations in package and cvs repo
fix up tests for new directory locations
separate key management program
C++ guards in header file
modify sets lists for netpgpverify

View File

@ -21,7 +21,7 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
# serial 52 AC_PROG_LIBTOOL
# serial 51 AC_PROG_LIBTOOL
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@ -109,6 +109,7 @@ AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
AC_REQUIRE([AC_OBJEXT])dnl
AC_REQUIRE([AC_EXEEXT])dnl
dnl
AC_LIBTOOL_SYS_MAX_CMD_LEN
AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
AC_LIBTOOL_OBJDIR
@ -210,8 +211,6 @@ file_magic*)
;;
esac
_LT_REQUIRED_DARWIN_CHECKS
AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
enable_win32_dll=yes, enable_win32_dll=no)
@ -291,80 +290,9 @@ ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
$rm -r conftest*
$rm conftest*
])# _LT_LINKER_BOILERPLATE
# _LT_REQUIRED_DARWIN_CHECKS
# --------------------------
# Check for some things on darwin
AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
case $host_os in
rhapsody* | darwin*)
AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
[lt_cv_apple_cc_single_mod=no
if test -z "${LT_MULTI_MODULE}"; then
# By default we will add the -single_module flag. You can override
# by either setting the environment variable LT_MULTI_MODULE
# non-empty at configure time, or by adding -multi_module to the
# link flags.
echo "int foo(void){return 1;}" > conftest.c
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib ${wl}-single_module conftest.c
if test -f libconftest.dylib; then
lt_cv_apple_cc_single_mod=yes
rm -rf libconftest.dylib*
fi
rm conftest.c
fi])
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[lt_cv_ld_exported_symbols_list=yes],
[lt_cv_ld_exported_symbols_list=no])
LDFLAGS="$save_LDFLAGS"
])
case $host_os in
rhapsody* | darwin1.[[0123]])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
darwin*)
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
if test "$lt_cv_apple_cc_single_mod" = "yes"; then
_lt_dar_single_mod='$single_module'
fi
if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
_lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
else
_lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
fi
if test "$DSYMUTIL" != ":"; then
_lt_dsymutil="~$DSYMUTIL \$lib || :"
else
_lt_dsymutil=
fi
;;
esac
])
# _LT_AC_SYS_LIBPATH_AIX
# ----------------------
@ -689,11 +617,7 @@ sparc*-*solaris*)
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*) LD="${LD-ld} -m elf64_sparc" ;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
fi
;;
*) LD="${LD-ld} -64" ;;
esac
;;
esac
@ -786,7 +710,7 @@ AC_CACHE_CHECK([$1], [$2],
$2=yes
fi
fi
$rm -r conftest*
$rm conftest*
LDFLAGS="$save_LDFLAGS"
])
@ -1057,7 +981,7 @@ else
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
[AC_CHECK_LIB([dld], [shl_load],
[lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
[lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
[AC_CHECK_FUNC([dlopen],
[lt_cv_dlopen="dlopen"],
[AC_CHECK_LIB([dl], [dlopen],
@ -1065,7 +989,7 @@ else
[AC_CHECK_LIB([svld], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
[AC_CHECK_LIB([dld], [dld_link],
[lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
[lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
])
])
])
@ -1382,7 +1306,7 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
aix[[4-9]]*)
aix4* | aix5*)
version_type=linux
need_lib_prefix=no
need_version=no
@ -1903,13 +1827,6 @@ esac
AC_MSG_RESULT([$dynamic_linker])
test "$dynamic_linker" = no && can_build_shared=no
AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@ -2409,7 +2326,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
aix[[4-9]]*)
aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@ -2845,7 +2762,7 @@ aix3*)
fi
;;
aix[[4-9]]*)
aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
@ -2902,7 +2819,6 @@ _LT_AC_TAGVAR(postdep_objects, $1)=
_LT_AC_TAGVAR(predeps, $1)=
_LT_AC_TAGVAR(postdeps, $1)=
_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
# Source file extension for C++ test sources.
ac_ext=cpp
@ -3012,7 +2928,7 @@ case $host_os in
# FIXME: insert proper C++ library support
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
aix[[4-9]]*)
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@ -3025,7 +2941,7 @@ case $host_os in
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
for ld_flag in $LDFLAGS; do
case $ld_flag in
*-brtl*)
@ -3171,23 +3087,51 @@ case $host_os in
fi
;;
darwin* | rhapsody*)
case $host_os in
rhapsody* | darwin1.[[012]])
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
;;
*) # Darwin 1.3 on
if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
else
case ${MACOSX_DEPLOYMENT_TARGET} in
10.[[012]])
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
;;
10.*)
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
;;
esac
fi
;;
esac
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_AC_TAGVAR(hardcode_direct, $1)=no
_LT_AC_TAGVAR(hardcode_automatic, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
_LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
if test "$GXX" = yes ; then
if test "$GXX" = yes ; then
lt_int_apple_cc_single_mod=no
output_verbose_link_cmd='echo'
_LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
_LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
_LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
if test "$lt_cv_apple_cc_single_mod" != "yes"; then
_LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
_LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
lt_int_apple_cc_single_mod=yes
fi
if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
else
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
fi
_LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
# Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
fi
_LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
case $cc_basename in
xlc*)
@ -3438,7 +3382,7 @@ case $host_os in
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
pgCC* | pgcpp*)
pgCC*)
# Portland Group C++ compiler
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@ -3873,8 +3817,7 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
# compiler output when linking a shared library.
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
[AC_REQUIRE([LT_AC_PROG_SED])dnl
AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
dnl we can't use the lt_simple_compile_test_code here,
dnl because it contains code intended for an executable,
dnl not a library. It's possible we should let each
@ -3999,11 +3942,6 @@ fi
$rm -f confest.$objext
_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
fi
# PORTME: override above test on systems where it is broken
ifelse([$1],[CXX],
[case $host_os in
@ -4060,6 +3998,7 @@ solaris*)
;;
esac
])
case " $_LT_AC_TAGVAR(postdeps, $1) " in
*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
esac
@ -4144,7 +4083,7 @@ aix3*)
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
@ -4321,7 +4260,6 @@ if test -f "$ltmain"; then
_LT_AC_TAGVAR(predeps, $1) \
_LT_AC_TAGVAR(postdeps, $1) \
_LT_AC_TAGVAR(compiler_lib_search_path, $1) \
_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
_LT_AC_TAGVAR(archive_cmds, $1) \
_LT_AC_TAGVAR(archive_expsym_cmds, $1) \
_LT_AC_TAGVAR(postinstall_cmds, $1) \
@ -4384,7 +4322,7 @@ ifelse([$1], [],
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Free Software Foundation, Inc.
#
# This file is part of GNU Libtool:
@ -4621,10 +4559,6 @@ predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
# shared library.
postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
# The directories searched by this compiler when creating a shared
# library
compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
@ -4974,7 +4908,7 @@ EOF
echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.$ac_ext >&5
fi
rm -rf conftest* conftst*
rm -f conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
@ -5031,8 +4965,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
# PIC is the default on this platform
@ -5069,7 +5002,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
esac
else
case $host_os in
aix[[4-9]]*)
aix4* | aix5*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
@ -5165,7 +5098,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
pgCC* | pgcpp*)
pgCC*)
# Portland Group C++ compiler.
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@ -5316,8 +5249,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
@ -5387,8 +5319,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
mingw* | cygwin* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
hpux9* | hpux10* | hpux11*)
@ -5525,7 +5456,7 @@ AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
#
if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
_LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
_LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
[$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
[case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
"" | " "*) ;;
@ -5549,7 +5480,7 @@ esac
#
wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
_LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
_LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
$lt_tmp_static_flag,
[],
[_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
@ -5565,7 +5496,7 @@ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
ifelse([$1],[CXX],[
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
case $host_os in
aix[[4-9]]*)
aix4* | aix5*)
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@ -5584,7 +5515,6 @@ ifelse([$1],[CXX],[
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
esac
_LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
],[
runpath_var=
_LT_AC_TAGVAR(allow_undefined_flag, $1)=
@ -5615,14 +5545,12 @@ ifelse([$1],[CXX],[
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
_LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
_LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
# Just being paranoid about ensuring that cc_basename is set.
_LT_CC_BASENAME([$compiler])
@ -5672,7 +5600,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
# See if GNU ld supports shared libraries.
case $host_os in
aix[[3-9]]*)
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@ -5891,7 +5819,7 @@ _LT_EOF
fi
;;
aix[[4-9]]*)
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@ -5911,7 +5839,7 @@ _LT_EOF
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
@ -6071,10 +5999,11 @@ _LT_EOF
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
if test "$GCC" = yes ; then
output_verbose_link_cmd='echo'
_LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
_LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
_LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
_LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
# Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
_LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
case $cc_basename in
xlc*)

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
# $NetBSD: configure.ac,v 1.16 2009/06/09 00:51:01 agc Exp $
# $NetBSD: configure.ac,v 1.17 2009/06/10 00:38:09 agc Exp $
#
# Process this file with autoconf to produce a configure script.
AC_INIT([netpgp], [20090608], [Alistair Crooks <agc@netbsd.org> c0596823])
AC_PREREQ([2.62])
AC_REVISION([$Revision: 1.16 $])
AC_INIT([netpgp],[20090608],[Alistair Crooks <agc@netbsd.org> c0596823])
AC_PREREQ(2.63)
AC_REVISION([$Revision: 1.17 $])
AS_SHELL_SANITIZE
@ -99,6 +99,7 @@ AC_CONFIG_FILES([
src/Makefile
src/lib/Makefile
src/netpgp/Makefile
src/netpgpkeys/Makefile
src/netpgpverify/Makefile
tests/Makefile
tests/atlocal

View File

@ -77,7 +77,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -101,7 +100,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -29,6 +29,18 @@
#ifndef NETPGP_H_
#define NETPGP_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
/* structure used to hold (key,value) pair information */
typedef struct netpgp_t {
unsigned c; /* # of elements used */
@ -68,4 +80,6 @@ int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
__END_DECLS
#endif /* !NETPGP_H_ */

View File

@ -1,3 +1,3 @@
## $NetBSD: Makefile.am,v 1.3 2009/06/09 00:51:01 agc Exp $
## $NetBSD: Makefile.am,v 1.4 2009/06/10 00:38:09 agc Exp $
SUBDIRS = lib netpgp netpgpverify
SUBDIRS = lib netpgp netpgpkeys netpgpverify

View File

@ -76,7 +76,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -100,7 +99,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -168,7 +166,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = lib netpgp netpgpverify
SUBDIRS = lib netpgp netpgpkeys netpgpverify
all: all-recursive
.SUFFIXES:

View File

@ -102,7 +102,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -126,7 +125,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -57,7 +57,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: keyring.c,v 1.16 2009/06/09 00:51:02 agc Exp $");
__RCSID("$NetBSD: keyring.c,v 1.17 2009/06/10 00:38:09 agc Exp $");
#endif
#ifdef HAVE_FCNTL_H
@ -240,13 +240,8 @@ decrypt_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
break;
case OPS_GET_PASSPHRASE:
#if 1
*content->skey_passphrase.passphrase = decrypt->passphrase;
return OPS_KEEP_MEMORY;
#else
cbinfo->cryptinfo.keydata = decrypt->key;
return get_passphrase_cb(pkt, cbinfo);
#endif
case OPS_PARSER_ERRCODE:
switch (content->errcode.errcode) {
@ -298,18 +293,18 @@ decrypt_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
__ops_seckey_t *
__ops_decrypt_seckey(const __ops_key_t *key, const char *passphrase)
{
__ops_stream_t *parse;
const int printerrors = 1;
decrypt_t decrypt;
__ops_stream_t *stream;
const int printerrors = 1;
decrypt_t decrypt;
(void) memset(&decrypt, 0x0, sizeof(decrypt));
decrypt.key = key;
decrypt.passphrase = strdup(passphrase);
parse = __ops_parseinfo_new();
__ops_keydata_reader_set(parse, key);
__ops_set_callback(parse, decrypt_cb, &decrypt);
parse->readinfo.accumulate = 1;
__ops_parse(parse, !printerrors);
stream = __ops_parseinfo_new();
__ops_keydata_reader_set(stream, key);
__ops_set_callback(stream, decrypt_cb, &decrypt);
stream->readinfo.accumulate = 1;
__ops_parse(stream, !printerrors);
__ops_forget(decrypt.passphrase, strlen(decrypt.passphrase));
(void) free(decrypt.passphrase);
return decrypt.seckey;
@ -372,14 +367,14 @@ __ops_get_userid(const __ops_key_t *key, unsigned subscript)
*/
unsigned
__ops_is_key_supported(const __ops_key_t *keydata)
__ops_is_key_supported(const __ops_key_t *key)
{
if (keydata->type == OPS_PTAG_CT_PUBLIC_KEY) {
if (keydata->key.pubkey.alg == OPS_PKA_RSA) {
if (key->type == OPS_PTAG_CT_PUBLIC_KEY) {
if (key->key.pubkey.alg == OPS_PKA_RSA) {
return 1;
}
} else if (keydata->type == OPS_PTAG_CT_PUBLIC_KEY) {
if (keydata->key.pubkey.alg == OPS_PKA_DSA) {
} else if (key->type == OPS_PTAG_CT_PUBLIC_KEY) {
if (key->key.pubkey.alg == OPS_PKA_DSA) {
return 1;
}
}
@ -394,15 +389,17 @@ __ops_is_key_supported(const __ops_key_t *keydata)
\param src Source User ID
\note If dst already has a userid, it will be freed.
*/
void
static __ops_userid_t *
__ops_copy_userid(__ops_userid_t *dst, const __ops_userid_t *src)
{
size_t len = strlen((char *) src->userid);
if (dst->userid)
free(dst->userid);
dst->userid = calloc(1, len + 1);
if (dst->userid) {
(void) free(dst->userid);
}
dst->userid = calloc(1, len + 1);
(void) memcpy(dst->userid, src->userid, len);
return dst;
}
/* \todo check where pkt pointers are copied */
@ -413,7 +410,7 @@ __ops_copy_userid(__ops_userid_t *dst, const __ops_userid_t *src)
\param src Source packet
\note If dst already has a packet, it will be freed.
*/
void
static __ops_subpacket_t *
__ops_copy_packet(__ops_subpacket_t *dst, const __ops_subpacket_t *src)
{
if (dst->raw) {
@ -422,32 +419,27 @@ __ops_copy_packet(__ops_subpacket_t *dst, const __ops_subpacket_t *src)
dst->raw = calloc(1, src->length);
dst->length = src->length;
(void) memcpy(dst->raw, src->raw, src->length);
return dst;
}
/**
\ingroup Core_Keys
\brief Add User ID to keydata
\param keydata Key to which to add User ID
\brief Add User ID to key
\param key Key to which to add User ID
\param userid User ID to add
\return Pointer to new User ID
*/
__ops_userid_t *
__ops_add_userid(__ops_key_t *keydata, const __ops_userid_t *userid)
__ops_add_userid(__ops_key_t *key, const __ops_userid_t *userid)
{
__ops_userid_t *new_uid = NULL;
EXPAND_ARRAY(keydata, uid);
__ops_userid_t *uidp = NULL;
EXPAND_ARRAY(key, uid);
/* initialise new entry in array */
new_uid = &keydata->uids[keydata->uidc];
new_uid->userid = NULL;
uidp = &key->uids[key->uidc++];
uidp->userid = NULL;
/* now copy it */
__ops_copy_userid(new_uid, userid);
keydata->uidc++;
return new_uid;
return __ops_copy_userid(uidp, userid);
}
/**
@ -460,20 +452,16 @@ __ops_add_userid(__ops_key_t *keydata, const __ops_userid_t *userid)
__ops_subpacket_t *
__ops_add_subpacket(__ops_key_t *keydata, const __ops_subpacket_t *packet)
{
__ops_subpacket_t *new_pkt = NULL;
__ops_subpacket_t *subpktp = NULL;
EXPAND_ARRAY(keydata, packet);
/* initialise new entry in array */
new_pkt = &keydata->packets[keydata->packetc];
new_pkt->length = 0;
new_pkt->raw = NULL;
subpktp = &keydata->packets[keydata->packetc++];
subpktp->length = 0;
subpktp->raw = NULL;
/* now copy it */
__ops_copy_packet(new_pkt, packet);
keydata->packetc++;
return new_pkt;
return __ops_copy_packet(subpktp, packet);
}
/**
@ -635,11 +623,11 @@ __ops_keyring_fileread(__ops_keyring_t *keyring,
const unsigned armour,
const char *filename)
{
__ops_stream_t *parse;
__ops_stream_t *stream;
unsigned res = 1;
int fd;
parse = __ops_parseinfo_new();
stream = __ops_parseinfo_new();
/* add this for the moment, */
/*
@ -648,7 +636,7 @@ __ops_keyring_fileread(__ops_keyring_t *keyring,
*/
/* __ops_parse_options(parse,OPS_PTAG_SS_ALL,OPS_PARSE_RAW); */
__ops_parse_options(parse, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
__ops_parse_options(stream, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
#ifdef O_BINARY
fd = open(filename, O_RDONLY | O_BINARY);
@ -656,34 +644,34 @@ __ops_keyring_fileread(__ops_keyring_t *keyring,
fd = open(filename, O_RDONLY);
#endif
if (fd < 0) {
__ops_parseinfo_delete(parse);
__ops_parseinfo_delete(stream);
perror(filename);
return 0;
}
#ifdef USE_MMAP_FOR_FILES
__ops_reader_set_mmap(parse, fd);
__ops_reader_set_mmap(stream, fd);
#else
__ops_reader_set_fd(parse, fd);
__ops_reader_set_fd(stream, fd);
#endif
__ops_set_callback(parse, cb_keyring_read, NULL);
__ops_set_callback(stream, cb_keyring_read, NULL);
if (armour) {
__ops_reader_push_dearmour(parse);
__ops_reader_push_dearmour(stream);
}
if (__ops_parse_and_accumulate(keyring, parse) == 0) {
if (__ops_parse_and_accumulate(keyring, stream) == 0) {
res = 0;
} else {
res = 1;
}
__ops_print_errors(__ops_parseinfo_get_errors(parse));
__ops_print_errors(__ops_parseinfo_get_errors(stream));
if (armour)
__ops_reader_pop_dearmour(parse);
__ops_reader_pop_dearmour(stream);
close(fd);
__ops_parseinfo_delete(parse);
__ops_parseinfo_delete(stream);
return res;
}
@ -717,24 +705,24 @@ __ops_keyring_read_from_mem(__ops_io_t *io,
const unsigned armour,
__ops_memory_t *mem)
{
__ops_stream_t *parse = NULL;
__ops_stream_t *stream = NULL;
const unsigned noaccum = 0;
unsigned res = 1;
parse = __ops_parseinfo_new();
__ops_parse_options(parse, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
__ops_setup_memory_read(io, &parse, mem, NULL, cb_keyring_read,
stream = __ops_parseinfo_new();
__ops_parse_options(stream, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
__ops_setup_memory_read(io, &stream, mem, NULL, cb_keyring_read,
noaccum);
if (armour) {
__ops_reader_push_dearmour(parse);
__ops_reader_push_dearmour(stream);
}
res = __ops_parse_and_accumulate(keyring, parse);
__ops_print_errors(__ops_parseinfo_get_errors(parse));
res = __ops_parse_and_accumulate(keyring, stream);
__ops_print_errors(__ops_parseinfo_get_errors(stream));
if (armour) {
__ops_reader_pop_dearmour(parse);
__ops_reader_pop_dearmour(stream);
}
/* don't call teardown_memory_read because memory was passed in */
__ops_parseinfo_delete(parse);
__ops_parseinfo_delete(stream);
return res;
}
@ -773,9 +761,9 @@ const __ops_key_t *
__ops_getkeybyid(__ops_io_t *io, const __ops_keyring_t *keyring,
const unsigned char keyid[OPS_KEY_ID_SIZE])
{
unsigned n;
unsigned n;
for (n = 0; keyring && n < keyring->keyc; n++) {
for (n = 1; keyring && n < keyring->keyc + 1; n++) {
if (__ops_get_debug_level(__FILE__)) {
int i;
@ -791,7 +779,8 @@ __ops_getkeybyid(__ops_io_t *io, const __ops_keyring_t *keyring,
}
(void) fprintf(io->errs, "\n");
}
if (memcmp(keyring->keys[n].key_id, keyid, OPS_KEY_ID_SIZE) == 0) {
if (memcmp(keyring->keys[n].key_id, keyid,
OPS_KEY_ID_SIZE) == 0) {
return &keyring->keys[n];
}
if (memcmp(&keyring->keys[n].key_id[OPS_KEY_ID_SIZE / 2],
@ -869,12 +858,14 @@ __ops_getkeybyname(__ops_io_t *io,
return NULL;
}
len = strlen(name);
for (n = 0, keyp = keyring->keys; n < keyring->keyc; ++n, keyp++) {
n = 1;
for (keyp = &keyring->keys[n]; n < keyring->keyc + 1; ++n, keyp++) {
for (i = 0, uidp = keyp->uids; i < keyp->uidc; i++, uidp++) {
if (__ops_get_debug_level(__FILE__)) {
(void) fprintf(io->outs,
"[%d][%d] name %s, last '%d'\n",
n, i, uidp->userid, uidp->userid[len]);
n, i, uidp->userid,
uidp->userid[len]);
}
if (strncmp((char *) uidp->userid, name, len) == 0 &&
uidp->userid[len] == ' ') {
@ -898,8 +889,8 @@ __ops_getkeybyname(__ops_io_t *io,
return kp;
}
/* match on full name */
keyp = keyring->keys;
for (n = 0; n < keyring->keyc; ++n, keyp++) {
keyp = &keyring->keys[1];
for (n = 1; n < keyring->keyc + 1; ++n, keyp++) {
uidp = keyp->uids;
for (i = 0 ; i < keyp->uidc; i++, uidp++) {
if (__ops_get_debug_level(__FILE__)) {
@ -917,7 +908,8 @@ __ops_getkeybyname(__ops_io_t *io,
}
}
/* match on <email@address> */
for (n = 0, keyp = keyring->keys; n < keyring->keyc; ++n, keyp++) {
keyp = &keyring->keys[1];
for (n = 1; n < keyring->keyc + 1; ++n, keyp++) {
for (i = 0, uidp = keyp->uids; i < keyp->uidc; i++, uidp++) {
/*
* look for the rightmost '<', in case there is one
@ -960,7 +952,7 @@ __ops_keyring_list(__ops_io_t *io, const __ops_keyring_t *keyring)
unsigned n;
(void) fprintf(io->outs, "%d keys\n", keyring->keyc);
for (n = 0, key = &keyring->keys[n]; n < keyring->keyc; ++n, ++key) {
for (n = 0, key = &keyring->keys[n+1]; n < keyring->keyc; ++n, ++key) {
if (__ops_is_key_secret(key)) {
__ops_print_seckeydata(key);
} else {

View File

@ -105,9 +105,6 @@ unsigned __ops_add_selfsigned_userid(__ops_key_t *, __ops_userid_t *);
__ops_key_t *__ops_keydata_new(void);
void __ops_keydata_init(__ops_key_t *, const __ops_content_tag_t);
void __ops_copy_userid(__ops_userid_t *, const __ops_userid_t *);
void __ops_copy_packet(__ops_subpacket_t *, const __ops_subpacket_t *);
int __ops_parse_and_accumulate(__ops_keyring_t *, __ops_stream_t *);
void __ops_print_pubkeydata(__ops_io_t *, const __ops_key_t *);

View File

@ -57,7 +57,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: misc.c,v 1.17 2009/06/09 00:51:02 agc Exp $");
__RCSID("$NetBSD: misc.c,v 1.18 2009/06/10 00:38:09 agc Exp $");
#endif
#include <sys/types.h>
@ -109,12 +109,12 @@ accumulate_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
const __ops_contents_t *content = &pkt->u;
const __ops_pubkey_t *pubkey;
__ops_keyring_t *keyring;
__ops_key_t *keydata;
__ops_key_t *key;
accumulate_t *accumulate;
accumulate = __ops_callback_arg(cbinfo);
keyring = accumulate->keyring;
keydata = (keyring->keyc > 0) ? &keyring->keys[keyring->keyc] : NULL;
key = (keyring->keyc > 0) ? &keyring->keys[keyring->keyc] : NULL;
switch (pkt->tag) {
case OPS_PTAG_CT_PUBLIC_KEY:
@ -124,21 +124,19 @@ accumulate_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
(void) fprintf(stderr, "New key - tag %d\n", pkt->tag);
}
EXPAND_ARRAY(keyring, key);
pubkey = (pkt->tag == OPS_PTAG_CT_PUBLIC_KEY) ?
&content->pubkey :
&content->seckey.pubkey;
keydata = &keyring->keys[++keyring->keyc];
(void) memset(keydata, 0x0, sizeof(*keydata));
__ops_keyid(keydata->key_id, OPS_KEY_ID_SIZE, OPS_KEY_ID_SIZE,
key = &keyring->keys[++keyring->keyc];
(void) memset(key, 0x0, sizeof(*key));
__ops_keyid(key->key_id, OPS_KEY_ID_SIZE, OPS_KEY_ID_SIZE,
pubkey);
__ops_fingerprint(&keydata->fingerprint, pubkey);
keydata->type = pkt->tag;
__ops_fingerprint(&key->fingerprint, pubkey);
key->type = pkt->tag;
if (pkt->tag == OPS_PTAG_CT_PUBLIC_KEY) {
keydata->key.pubkey = *pubkey;
key->key.pubkey = *pubkey;
} else {
keydata->key.seckey = content->seckey;
key->key.seckey = content->seckey;
}
return OPS_KEEP_MEMORY;
@ -147,16 +145,16 @@ accumulate_cb(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
(void) fprintf(stderr, "User ID: %s\n",
content->userid.userid);
}
if (keydata) {
__ops_add_userid(keydata, &content->userid);
if (key) {
__ops_add_userid(key, &content->userid);
return OPS_KEEP_MEMORY;
}
OPS_ERROR(cbinfo->errors, OPS_E_P_NO_USERID, "No userid found");
return OPS_KEEP_MEMORY;
case OPS_PARSER_PACKET_END:
if (keydata) {
__ops_add_subpacket(keydata, &content->packet);
if (key) {
__ops_add_subpacket(key, &content->packet);
return OPS_KEEP_MEMORY;
}
return OPS_RELEASE_MEMORY;

View File

@ -34,7 +34,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: netpgp.c,v 1.21 2009/06/09 00:51:02 agc Exp $");
__RCSID("$NetBSD: netpgp.c,v 1.22 2009/06/10 00:38:09 agc Exp $");
#endif
#include <sys/types.h>
@ -529,6 +529,7 @@ netpgp_sign_file(netpgp_t *netpgp,
if (seckey == NULL) {
(void) fprintf(io->errs, "Bad passphrase\n");
}
__ops_forget(pass, sizeof(pass));
} while (seckey == NULL);
/* sign file */
hashalg = netpgp_getvar(netpgp, "hash");
@ -541,7 +542,6 @@ netpgp_sign_file(netpgp_t *netpgp,
ret = __ops_sign_file(io, f, out, seckey, hashalg,
(unsigned)armored, overwrite);
}
__ops_forget(pass, strlen(pass));
__ops_forget(seckey, sizeof(*seckey));
return ret;
}

View File

@ -58,7 +58,7 @@
#endif
/* development versions have .99 suffix */
#define NETPGP_BASE_VERSION "1.99.9"
#define NETPGP_BASE_VERSION "1.99.10"
#define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]"
#define NETPGP_VERSION_STRING \

View File

@ -90,7 +90,6 @@ CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
ECHO = /bin/echo
ECHO_C =
ECHO_N = -n
@ -114,7 +113,6 @@ LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /usr/src/crypto/external/bsd/netpgp-hack/dist/buildaux/missing --run makeinfo
MKDIR_P = ../../buildaux/install-sh -c -d
NMEDIT =
OBJEXT = o
PACKAGE = netpgp
PACKAGE_BUGREPORT = Alistair Crooks <agc@netbsd.org> c0596823

View File

@ -90,7 +90,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -114,7 +113,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -1,4 +1,4 @@
.\" $NetBSD: netpgp.1,v 1.1 2009/06/09 00:51:03 agc Exp $
.\" $NetBSD: netpgp.1,v 1.2 2009/06/10 00:38:09 agc Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 8, 2009
.Dd June 9, 2009
.Dt NETPGP 1
.Os
.Sh NAME
@ -70,28 +70,6 @@
.Op Fl Fl pass-fd Ns = Ns Ar fd
.Op options
.Ar file ...
.Pp
.Nm
.Fl Fl export-key
.Op options
.Ar file ...
.Nm
.Fl Fl find-key
.Op options
.Ar file ...
.Nm
.Fl Fl generate-key
.Op options
.Ar file ...
.Nm
.Fl Fl import-key
.Op options
.Ar file ...
.Nm
.Fl Fl list-keys
.Op options
.Ar file ...
.Pp
.Nm
.Fl Fl list-packets
.Op Fl Fl pass-fd Ns = Ns Ar fd
@ -139,23 +117,9 @@ into text such that the contents can only be viewed by someone
with the corresponding private key.
This is called encryption.
.Pp
The
.Nm
utility can also be used to generate a new key-pair for a user.
As mentioned before,
this key is in two parts, the public key (which is known
by other people) and the private key.
To manipulate keys themselves, a separate utility is provided, called
.Xr netpgpkeys 1 .
.Pp
In addition to these primary uses, the third way of using
.Nm
is to maintain keyrings.
Key and keyring management commands available are:
.Fl Fl export-key ,
.Fl Fl find-key ,
.Fl Fl generate-key ,
.Fl Fl import-key ,
and
.Fl Fl list-keys .
Keyrings are collections of public keys belonging to other users.
By using other means of identification, it is possible to establish
the bona fides of other users.
@ -207,29 +171,6 @@ to type it in, using
.Xr getpass 3 .
.It Fl Fl encrypt
Use the user's public key to encrypt the files named on the command line.
.El
.Pp
In addition, key and keyring management can be done with the
following commands:
.Bl -tag -width Ar
.It Fl Fl export-key
Display the current public key in a format suitable for export.
This can be used to place the keyring on one of the
public key servers, for example.
.It Fl Fl find-key
Find the appropriate public key from the current keyring.
If no keyring is provided, the user's public keyring is used.
.It Fl Fl generate-key
This command is used to generate a new public and private key pair.
The user id is taken from the command line, and the user will be
prompted to provide a suitable pass phrase.
.It Fl Fl import-key
Import a public key as retrieved from one of the public key servers.
This is in the form of a file which has previously been
retrieved from elsewhere.
.It Fl Fl list-keys
List all the public keys in the current keyring.
If no keyring is provided, the user's public keyring is used.
.It Fl Fl list-packets
List all the
.Dq packets
@ -275,14 +216,6 @@ find that sub-directory.
.It Fl Fl keyring Ar keyring
This option specifies an alternative keyring to be used.
All keyring operations will be relative to this alternative keyring.
.It Fl Fl numbits Ar numbits
specifies the number of bits to be used when generating a key.
The default number of bits is 2048.
This is considered the absolute
minimum which should be chosen at the time of writing (2009).
Due to advances in computing power every year, this number should
be reviewed, and increased when it becomes easier to factor 2048
bit numbers.
.It Fl Fl output
specifies a filename to which verified output from a signed file
may be redirected.
@ -336,8 +269,8 @@ This option should be used wisely, and any core dumps should
be deleted in a secure manner when no longer needed.
.El
.Sh PASS PHRASES
The pass phrase cannot be changed by
.Nm
At the present time, the pass phrase cannot be changed by
.Xr netpgpkeys 1
once it has been chosen, and will
be used for the life of the key, so a wise choice is advised.
The pass phrase should not be an easily guessable word or phrase,
@ -429,6 +362,7 @@ utility will return 0 for success,
1 if the file's signature does not match what was expected,
or 2 if any other error occurs.
.Sh SEE ALSO
.Xr netpgpkeys 1 ,
.Xr getpass 3 ,
.\" .Xr libbz2 3 ,
.Xr libnetpgp 3 ,

View File

@ -40,12 +40,6 @@
#include <netpgp.h>
/*
* 2048 is the absolute minimum, really - we should really look at
* bumping this to 4096 or even higher - agc, 20090522
*/
#define DEFAULT_NUMBITS 2048
/*
* Similraily, SHA1 is now looking as though it should not be used.
* Let's pre-empt this by specifying SHA256 - gpg interoperates just
@ -61,12 +55,7 @@ static const char *usage =
"\t\t[options] files... OR\n"
"\t--verify [options] files... OR\n"
"\t--cat [--output=file] [options] files... OR\n"
"\t--clearsign [--output=file] [options] files... OR\n\n"
"\t--export-keys [options] OR\n"
"\t--find-key [options] OR\n"
"\t--generate-key [options] OR\n"
"\t--import-key [options] OR\n"
"\t--list-keys [options] OR\n\n"
"\t--clearsign [--output=file] [options] files... OR\n"
"\t--list-packets [options] OR\n"
"\t--version\n"
"where options are:\n"
@ -78,11 +67,6 @@ static const char *usage =
enum optdefs {
/* commands */
LIST_KEYS = 1,
FIND_KEY,
EXPORT_KEY,
IMPORT_KEY,
GENERATE_KEY,
ENCRYPT,
DECRYPT,
SIGN,
@ -98,7 +82,6 @@ enum optdefs {
USERID,
ARMOUR,
HOMEDIR,
NUMBITS,
DETACHED,
HASH_ALG,
OUTPUT,
@ -114,12 +97,6 @@ enum optdefs {
#define EXIT_ERROR 2
static struct option options[] = {
/* key-management commands */
{"list-keys", no_argument, NULL, LIST_KEYS},
{"find-key", no_argument, NULL, FIND_KEY},
{"export-key", no_argument, NULL, EXPORT_KEY},
{"import-key", no_argument, NULL, IMPORT_KEY},
{"generate-key", no_argument, NULL, GENERATE_KEY},
/* file manipulation commands */
{"encrypt", no_argument, NULL, ENCRYPT},
{"decrypt", no_argument, NULL, DECRYPT},
@ -145,7 +122,6 @@ static struct option options[] = {
{"homedir", required_argument, NULL, HOMEDIR},
{"armor", no_argument, NULL, ARMOUR},
{"armour", no_argument, NULL, ARMOUR},
{"numbits", required_argument, NULL, NUMBITS},
{"detach", no_argument, NULL, DETACHED},
{"detached", no_argument, NULL, DETACHED},
{"hash-alg", required_argument, NULL, HASH_ALG},
@ -163,7 +139,6 @@ typedef struct prog_t {
char *progname; /* program name */
char *output; /* output file name */
int overwrite; /* overwrite files? */
int numbits; /* # of bits */
int armour; /* ASCII armor */
int detached; /* use separate file */
int cmd; /* netpgp command */
@ -189,18 +164,6 @@ netpgp_cmd(netpgp_t *netpgp, prog_t *p, char *f)
const int cleartext = 1;
switch (p->cmd) {
case LIST_KEYS:
return netpgp_list_keys(netpgp);
case FIND_KEY:
return netpgp_find_key(netpgp, netpgp_getvar(netpgp, "userid"));
case EXPORT_KEY:
return netpgp_export_key(netpgp,
netpgp_getvar(netpgp, "userid"));
case IMPORT_KEY:
return netpgp_import_key(netpgp, f);
case GENERATE_KEY:
return netpgp_generate_key(netpgp,
netpgp_getvar(netpgp, "userid"), p->numbits);
case ENCRYPT:
return netpgp_encrypt_file(netpgp,
netpgp_getvar(netpgp, "userid"),
@ -287,7 +250,6 @@ main(int argc, char **argv)
(void) memset(&p, 0x0, sizeof(p));
(void) memset(&netpgp, 0x0, sizeof(netpgp));
p.progname = argv[0];
p.numbits = DEFAULT_NUMBITS;
p.overwrite = 1;
p.output = NULL;
if (argc < 2) {
@ -300,20 +262,10 @@ main(int argc, char **argv)
optindex = 0;
while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) {
switch (options[optindex].val) {
case LIST_KEYS:
p.cmd = options[optindex].val;
break;
case COREDUMPS:
netpgp_setvar(&netpgp, "coredumps", "allowed");
p.cmd = options[optindex].val;
break;
case GENERATE_KEY:
netpgp_setvar(&netpgp, "userid checks", "skip");
p.cmd = options[optindex].val;
break;
case FIND_KEY:
case EXPORT_KEY:
case IMPORT_KEY:
case ENCRYPT:
case DECRYPT:
case SIGN:
@ -364,14 +316,6 @@ main(int argc, char **argv)
}
set_homedir(&netpgp, optarg, NULL);
break;
case NUMBITS:
if (optarg == NULL) {
(void) fprintf(stderr,
"No number of bits argument provided\n");
exit(EXIT_ERROR);
}
p.numbits = atoi(optarg);
break;
case HASH_ALG:
if (optarg == NULL) {
(void) fprintf(stderr,

View File

@ -0,0 +1,15 @@
## $NetBSD: Makefile.am,v 1.1 2009/06/10 00:38:10 agc Exp $
AM_CFLAGS = $(WARNCFLAGS)
bin_PROGRAMS = netpgpkeys
netpgpkeys_SOURCES = netpgpkeys.c
netpgpkeys_CPPFLAGS = -I$(top_srcdir)/include
netpgpkeys_LDADD = ../lib/libnetpgp.la
man1_MANS = netpgpkeys.1
dist_man_MANS = netpgpkeys.1

View File

@ -0,0 +1,531 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = netpgpkeys$(EXEEXT)
subdir = src/netpgpkeys
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/lib/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_netpgpkeys_OBJECTS = netpgpkeys-netpgpkeys.$(OBJEXT)
netpgpkeys_OBJECTS = $(am_netpgpkeys_OBJECTS)
netpgpkeys_DEPENDENCIES = ../lib/libnetpgp.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/lib
depcomp = $(SHELL) $(top_srcdir)/buildaux/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(netpgpkeys_SOURCES)
DIST_SOURCES = $(netpgpkeys_SOURCES)
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(dist_man_MANS) $(man1_MANS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CANONICAL_HOST = @CANONICAL_HOST@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARNCFLAGS = @WARNCFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = $(WARNCFLAGS)
netpgpkeys_SOURCES = netpgpkeys.c
netpgpkeys_CPPFLAGS = -I$(top_srcdir)/include
netpgpkeys_LDADD = ../lib/libnetpgp.la
man1_MANS = netpgpkeys.1
dist_man_MANS = netpgpkeys.1
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/netpgpkeys/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign src/netpgpkeys/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
netpgpkeys$(EXEEXT): $(netpgpkeys_OBJECTS) $(netpgpkeys_DEPENDENCIES)
@rm -f netpgpkeys$(EXEEXT)
$(LINK) $(netpgpkeys_OBJECTS) $(netpgpkeys_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netpgpkeys-netpgpkeys.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
netpgpkeys-netpgpkeys.o: netpgpkeys.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(netpgpkeys_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netpgpkeys-netpgpkeys.o -MD -MP -MF $(DEPDIR)/netpgpkeys-netpgpkeys.Tpo -c -o netpgpkeys-netpgpkeys.o `test -f 'netpgpkeys.c' || echo '$(srcdir)/'`netpgpkeys.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/netpgpkeys-netpgpkeys.Tpo $(DEPDIR)/netpgpkeys-netpgpkeys.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netpgpkeys.c' object='netpgpkeys-netpgpkeys.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(netpgpkeys_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netpgpkeys-netpgpkeys.o `test -f 'netpgpkeys.c' || echo '$(srcdir)/'`netpgpkeys.c
netpgpkeys-netpgpkeys.obj: netpgpkeys.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(netpgpkeys_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netpgpkeys-netpgpkeys.obj -MD -MP -MF $(DEPDIR)/netpgpkeys-netpgpkeys.Tpo -c -o netpgpkeys-netpgpkeys.obj `if test -f 'netpgpkeys.c'; then $(CYGPATH_W) 'netpgpkeys.c'; else $(CYGPATH_W) '$(srcdir)/netpgpkeys.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/netpgpkeys-netpgpkeys.Tpo $(DEPDIR)/netpgpkeys-netpgpkeys.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='netpgpkeys.c' object='netpgpkeys-netpgpkeys.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(netpgpkeys_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netpgpkeys-netpgpkeys.obj `if test -f 'netpgpkeys.c'; then $(CYGPATH_W) 'netpgpkeys.c'; else $(CYGPATH_W) '$(srcdir)/netpgpkeys.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
done
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man: install-man1
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-man \
uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,292 @@
.\" $NetBSD: netpgpkeys.1,v 1.1 2009/06/10 00:38:10 agc Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This manual page is derived from software contributed to
.\" The NetBSD Foundation by Alistair Crooks (agc@NetBSD.org).
.\"
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd June 9, 2009
.Dt NETPGPKEYS 1
.Os
.Sh NAME
.Nm netpgpkeys
.Nd PGP key management utility
.Sh SYNOPSIS
.Nm
.Fl Fl export-key
.Op options
.Ar file ...
.Nm
.Fl Fl find-key
.Op options
.Ar file ...
.Nm
.Fl Fl generate-key
.Op options
.Ar file ...
.Nm
.Fl Fl import-key
.Op options
.Ar file ...
.Nm
.Fl Fl list-keys
.Op options
.Ar file ...
.Nm
.Fl Fl version
.Pp
where the options for all commands are:
.Pp
.Op Fl Fl coredumps
.br
.Op Fl Fl homedir Ns = Ns Ar home-directory
.br
.Op Fl Fl keyring Ns = Ns Ar keyring
.br
.Op Fl Fl userid Ns = Ns Ar userid
.br
.Op Fl Fl verbose
.Sh DESCRIPTION
At the present time, the
.Nm
utility is still under development.
Whilst the signing and verification, encryption and
decryption parts of
.Xr netpgp 1
are considered mature,
.Nm
needs more work.
Other key management utilities should be used in preference
to this one.
.Pp
The
.Nm
command is used for all forms of PGP key management,
from generation of new keys to propagation of public
keys to key servers, and importation of new public
keys from other identities.
.Pp
The
.Xr netpgp 1
utility should be used for file management and transformation - encryption,
decryption,
signing and verification of files.
.Pp
.Pp
For signing and encryption, a unique identity is needed.
This identity is made up of a private and public key.
The public key part is made available and known to everyone.
The private key is kept secret, and known only to the user
who created the identity.
The secret key is protected with a passphrase.
.Pp
In rough terms, a digital signature
is a digest of a file's contents,
encrypted with the user's private key.
Since together, the private and public keys identify the user
uniquely, the signature can be used to identify the exact version
of the file, and any changes made to the file will mean that the
signature no longer matches.
.Pp
As a corollary, the file can be transformed using a user's public key,
into text such that the contents can only be viewed by someone
with the corresponding private key.
This is called encryption.
.Pp
The
.Nm
utility can be used to generate a new key-pair for a user.
As mentioned before,
this key is in two parts, the public key (which is known
by other people) and the private key.
.Pp
The other use of
.Nm
is to maintain keyrings.
Key and keyring management commands available are:
.Fl Fl export-key ,
.Fl Fl find-key ,
.Fl Fl generate-key ,
.Fl Fl import-key ,
and
.Fl Fl list-keys .
Keyrings are collections of public keys belonging to other users.
By using other means of identification, it is possible to establish
the bona fides of other users.
Once trust has been established, the public key of the other
user will be signed.
The other user's public key can be added to our keyring.
The other user will add our public key to their keyring.
.Pp
Keys can be listed, exported (i.e. made available to others),
and imported (i.e. users who have signed our public key).
.Pp
Key and keyring management can be done with the
following commands:
.Bl -tag -width Ar
.It Fl Fl export-key
Display the current public key in a format suitable for export.
This can be used to place the keyring on one of the
public key servers, for example.
.It Fl Fl find-key
Find the appropriate public key from the current keyring.
If no keyring is provided, the user's public keyring is used.
.It Fl Fl generate-key
This command is used to generate a new public and private key pair.
The user id is taken from the command line, and the user will be
prompted to provide a suitable pass phrase.
.It Fl Fl import-key
Import a public key as retrieved from one of the public key servers.
This is in the form of a file which has previously been
retrieved from elsewhere.
.It Fl Fl list-keys
List all the public keys in the current keyring.
If no keyring is provided, the user's public keyring is used.
.It Fl Fl version
Print the version information from the
.Xr libnetpgp 3
library.
.El
.Pp
In addition to one of the preceding commands, a number of qualifiers
or options may be given.
.Bl -tag -width Ar
.It Fl Fl homedir Ar home-directory
Keyrings are normally located, for historical reasons, within
the user's home directory in a subdirectory called
.Dq Pa .gnupg
and this option specifies an alternative location in which to
find that sub-directory.
.It Fl Fl keyring Ar keyring
This option specifies an alternative keyring to be used.
All keyring operations will be relative to this alternative keyring.
.It Fl Fl numbits Ar numbits
specifies the number of bits to be used when generating a key.
The default number of bits is 2048.
This is considered the absolute
minimum which should be chosen at the time of writing (2009).
Due to advances in computing power every year, this number should
be reviewed, and increased when it becomes easier to factor 2048
bit numbers.
.It Fl Fl userid Ar userid
This option specifies the user identity to be used for all operations.
This identity can either be in the form of the full name, or as an
email address.
Care should be exercised with these ways of specifying the user identity,
since the
.Nm
utility has no way of verifying that an email address is valid, or
that a key belongs to a certain individual.
The trust for a signed key is given by the other signers of that key.
The 16 hexadecimal digit user identity should be used when specifying
user identities - email addresses and names are provided as aliases.
.It Fl Fl pass-fd Ns = Ns Ar fd
This option is intended for the use of external programs which may
like to use the
.Xr netpgp 3
library through the
.Nm
interface, but have their own ways of retrieving and caching
the passphrase for the secret key.
In this case, the
.Nm
utility will read a line of text from the file descriptor
passed to it in the command line argument, rather than
using its own methods of retrieving the passphrase from
the user.
.It Fl Fl verbose
This option can be used to view information during
the process of the
.Nm
requests.
.It Fl Fl coredumps
in normal processing,
if an error occurs, the contents of memory are saved to disk, and can
be read using tools to analyse behaviour.
Unfortuinately this can disclose information to people viewing
the core dump, such as secret keys, and passphrases protecting
those keys.
In normal operation,
.Nm
will turn off the ability to save core dumps on persistent storage,
but selecting this option will allow core dumps to be written to disk.
This option should be used wisely, and any core dumps should
be deleted in a secure manner when no longer needed.
.El
.Sh PASS PHRASES
The pass phrase cannot be changed by
.Nm
once it has been chosen, and will
be used for the life of the key, so a wise choice is advised.
The pass phrase should not be an easily guessable word or phrase,
or related to information that can be gained through
.Dq social engineering
using search engines, or other public information retrieval methods.
.Pp
.Xr getpass 3
will be used to obtain the pass phrase from the user if it is
needed,
such as during signing or encryption, or key generation,
so that any secret information cannot be viewed by other users
using the
.Xr ps 1
or
.Xr top 1
commands, or by looking over the shoulder at the screen.
.Pp
Since the public and private key pair can be used to verify
a person's identity, and since identity theft can have
far-reaching consequences, users are strongly encouraged to
enter their pass phrases only when prompted by the application.
.Sh RETURN VALUES
The
.Nm
utility will return 0 for success,
1 if the file's signature does not match what was expected,
or 2 if any other error occurs.
.Sh SEE ALSO
.Xr netpgp 1 ,
.Xr getpass 3 ,
.\" .Xr libbz2 3 ,
.Xr libnetpgp 3 ,
.Xr ssl 3 ,
.Xr zlib 3
.Sh STANDARDS
The
.Nm
utility is designed to conform to IETF RFC 4880.
.Sh HISTORY
The
.Nm
command first appeared in
.Nx 6.0 .
.Sh AUTHORS
.An -nosplit
.An Ben Laurie ,
.An Rachel Willmer ,
and overhauled and rewritten by
.An Alistair Crooks Aq agc@NetBSD.org .
This manual page was also written by
.An Alistair Crooks .

View File

@ -0,0 +1,323 @@
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@NetBSD.org)
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/* Command line program to perform netpgp operations */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netpgp.h>
/*
* 2048 is the absolute minimum, really - we should really look at
* bumping this to 4096 or even higher - agc, 20090522
*/
#define DEFAULT_NUMBITS 2048
static const char *usage =
" --help OR\n"
"\t--export-keys [options] OR\n"
"\t--find-key [options] OR\n"
"\t--generate-key [options] OR\n"
"\t--import-key [options] OR\n"
"\t--list-keys [options] OR\n"
"\t--version\n"
"where options are:\n"
"\t[--coredumps] AND/OR\n"
"\t[--homedir=<homedir>] AND/OR\n"
"\t[--keyring=<keyring>] AND/OR\n"
"\t[--userid=<userid>] AND/OR\n"
"\t[--verbose]\n";
enum optdefs {
/* commands */
LIST_KEYS = 1,
FIND_KEY,
EXPORT_KEY,
IMPORT_KEY,
GENERATE_KEY,
VERSION_CMD,
HELP_CMD,
/* options */
KEYRING,
USERID,
HOMEDIR,
NUMBITS,
VERBOSE,
COREDUMPS,
PASSWDFD,
/* debug */
OPS_DEBUG
};
#define EXIT_ERROR 2
static struct option options[] = {
/* key-management commands */
{"list-keys", no_argument, NULL, LIST_KEYS},
{"find-key", no_argument, NULL, FIND_KEY},
{"export-key", no_argument, NULL, EXPORT_KEY},
{"import-key", no_argument, NULL, IMPORT_KEY},
{"generate-key", no_argument, NULL, GENERATE_KEY},
/* debugging commands */
{"help", no_argument, NULL, HELP_CMD},
{"version", no_argument, NULL, VERSION_CMD},
{"debug", required_argument, NULL, OPS_DEBUG},
/* options */
{"coredumps", no_argument, NULL, COREDUMPS},
{"keyring", required_argument, NULL, KEYRING},
{"userid", required_argument, NULL, USERID},
{"home", required_argument, NULL, HOMEDIR},
{"homedir", required_argument, NULL, HOMEDIR},
{"numbits", required_argument, NULL, NUMBITS},
{"verbose", no_argument, NULL, VERBOSE},
{"pass-fd", required_argument, NULL, PASSWDFD},
{ NULL, 0, NULL, 0},
};
/* gather up program variables into one struct */
typedef struct prog_t {
char keyring[MAXPATHLEN + 1]; /* name of keyring */
char *progname; /* program name */
int numbits; /* # of bits */
int cmd; /* netpgpkeys command */
} prog_t;
/* print a usage message */
static void
print_usage(const char *usagemsg, char *progname)
{
(void) fprintf(stderr,
"%s\nAll bug reports, praise and chocolate, please, to:\n%s\n",
netpgp_get_info("version"),
netpgp_get_info("maintainer"));
(void) fprintf(stderr, "Usage: %s COMMAND OPTIONS:\n%s %s",
progname, progname, usagemsg);
}
/* do a command once for a specified file 'f' */
static int
netpgp_cmd(netpgp_t *netpgp, prog_t *p, char *f)
{
switch (p->cmd) {
case LIST_KEYS:
return netpgp_list_keys(netpgp);
case FIND_KEY:
return netpgp_find_key(netpgp, netpgp_getvar(netpgp, "userid"));
case EXPORT_KEY:
return netpgp_export_key(netpgp,
netpgp_getvar(netpgp, "userid"));
case IMPORT_KEY:
return netpgp_import_key(netpgp, f);
case GENERATE_KEY:
return netpgp_generate_key(netpgp,
netpgp_getvar(netpgp, "userid"), p->numbits);
case HELP_CMD:
default:
print_usage(usage, p->progname);
exit(EXIT_SUCCESS);
}
}
/* get even more lippy */
static void
give_it_large(netpgp_t *netpgp)
{
char *cp;
char num[16];
int val;
val = 0;
if ((cp = netpgp_getvar(netpgp, "verbose")) != NULL) {
val = atoi(cp);
}
(void) snprintf(num, sizeof(num), "%d", val + 1);
netpgp_setvar(netpgp, "verbose", num);
}
/* set the home directory value to "home/subdir" */
static int
set_homedir(netpgp_t *netpgp, char *home, const char *subdir, char *progname)
{
struct stat st;
char d[MAXPATHLEN];
if (home == NULL) {
(void) fprintf(stderr, "%s: NULL HOME directory\n",
progname);
return 0;
}
(void) snprintf(d, sizeof(d), "%s%s", home, (subdir) ? subdir : "");
if (stat(d, &st) == 0) {
if ((st.st_mode & S_IFMT) == S_IFDIR) {
netpgp_setvar(netpgp, "homedir", d);
return 1;
}
(void) fprintf(stderr, "%s: homedir \"%s\" is not a dir\n",
progname, d);
return 0;
}
(void) fprintf(stderr, "%s: warning homedir \"%s\" not found\n",
progname, d);
return 1;
}
int
main(int argc, char **argv)
{
netpgp_t netpgp;
prog_t p;
int optindex;
int ret;
int ch;
int i;
(void) memset(&p, 0x0, sizeof(p));
(void) memset(&netpgp, 0x0, sizeof(netpgp));
p.progname = argv[0];
p.numbits = DEFAULT_NUMBITS;
if (argc < 2) {
print_usage(usage, p.progname);
exit(EXIT_ERROR);
}
/* set some defaults */
set_homedir(&netpgp, getenv("HOME"), "/.gnupg", *argv);
optindex = 0;
while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) {
switch (options[optindex].val) {
case LIST_KEYS:
p.cmd = options[optindex].val;
break;
case COREDUMPS:
netpgp_setvar(&netpgp, "coredumps", "allowed");
p.cmd = options[optindex].val;
break;
case GENERATE_KEY:
netpgp_setvar(&netpgp, "userid checks", "skip");
p.cmd = options[optindex].val;
break;
case FIND_KEY:
case EXPORT_KEY:
case IMPORT_KEY:
case HELP_CMD:
p.cmd = options[optindex].val;
break;
case VERSION_CMD:
printf(
"%s\nAll bug reports, praise and chocolate, please, to:\n%s\n",
netpgp_get_info("version"),
netpgp_get_info("maintainer"));
exit(EXIT_SUCCESS);
/* options */
case KEYRING:
if (optarg == NULL) {
(void) fprintf(stderr,
"%s: No keyring argument provided\n",
*argv);
exit(EXIT_ERROR);
}
snprintf(p.keyring, sizeof(p.keyring), "%s", optarg);
break;
case USERID:
if (optarg == NULL) {
(void) fprintf(stderr,
"%s: no userid argument provided\n",
*argv);
exit(EXIT_ERROR);
}
netpgp_setvar(&netpgp, "userid", optarg);
break;
case VERBOSE:
give_it_large(&netpgp);
break;
case HOMEDIR:
if (optarg == NULL) {
(void) fprintf(stderr,
"%s: no home directory argument provided\n",
*argv);
exit(EXIT_ERROR);
}
set_homedir(&netpgp, optarg, NULL, *argv);
break;
case NUMBITS:
if (optarg == NULL) {
(void) fprintf(stderr,
"%s: no number of bits argument provided\n",
*argv);
exit(EXIT_ERROR);
}
p.numbits = atoi(optarg);
break;
case PASSWDFD:
if (optarg == NULL) {
(void) fprintf(stderr,
"%s: no pass-fd argument provided\n", *argv);
exit(EXIT_ERROR);
}
netpgp_setvar(&netpgp, "pass-fd", optarg);
break;
case OPS_DEBUG:
netpgp_set_debug(optarg);
break;
default:
p.cmd = HELP_CMD;
break;
}
}
/* initialise, and read keys from file */
if (!netpgp_init(&netpgp)) {
printf("can't initialise\n");
exit(EXIT_ERROR);
}
/* now do the required action for each of the command line args */
ret = EXIT_SUCCESS;
if (optind == argc) {
if (!netpgp_cmd(&netpgp, &p, NULL)) {
ret = EXIT_FAILURE;
}
} else {
for (i = optind; i < argc; i++) {
if (!netpgp_cmd(&netpgp, &p, argv[i])) {
ret = EXIT_FAILURE;
}
}
}
netpgp_end(&netpgp);
exit(ret);
}

View File

@ -90,7 +90,6 @@ CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
ECHO = /bin/echo
ECHO_C =
ECHO_N = -n
@ -114,7 +113,6 @@ LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /usr/src/crypto/external/bsd/netpgp-hack/dist/buildaux/missing --run makeinfo
MKDIR_P = ../../buildaux/install-sh -c -d
NMEDIT =
OBJEXT = o
PACKAGE = netpgp
PACKAGE_BUGREPORT = Alistair Crooks <agc@netbsd.org> c0596823

View File

@ -90,7 +90,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -114,7 +113,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -65,7 +65,6 @@ CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
@ -89,7 +88,6 @@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

View File

@ -0,0 +1,26 @@
# $NetBSD: Makefile,v 1.1 2009/06/10 00:38:10 agc Exp $
.include <bsd.own.mk>
PROG= netpgpkeys
BINDIR= /usr/bin
CPPFLAGS+= -I${.CURDIR}/../dist/include
LIBNETPGPDIR!= cd ${.CURDIR}/../lib && ${PRINTOBJDIR}
LDADD+= -L${LIBNETPGPDIR} -lnetpgp
DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
LDADD+= -lcrypto -lz -lbz2
DPADD+= ${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
MAN= netpgpkeys.1
# although the code is/was WARNS=4 clean, when linking, there is a warning
# about libidea being a patented algorithm, and WARNS>0 treats warnings as
# errors. For now, just set WARNS off.
WARNS= 0
.PATH: ${.CURDIR}/../dist/src/netpgpkeys
.include <bsd.prog.mk>