+ add a --help option
+ if setrlimit exists, set the core dump size to be 0 (with thanks to mrg for the reference implementation) + get rid of __ops_start_cleartext_sig/__ops_start_msg_sig abstractions and just "export" the __ops_start_sig function - the function is not actually exported, just usable by other __ops functions + bump internal version number to 0.99.2, autoconf version to 20090506 + prettify usage message output
This commit is contained in:
parent
1130fba7b6
commit
b1b5870651
|
@ -1,5 +1,7 @@
|
|||
To Do
|
||||
=====
|
||||
64bit offsets
|
||||
sha256 sha512 digests
|
||||
detached verification
|
||||
need a netpgp_set_{pub,sec}key()? vs _init()?
|
||||
default compression when signing
|
||||
|
@ -45,3 +47,5 @@ Install man pages
|
|||
WARNS=4 (again)
|
||||
detached sig
|
||||
get rid of assert()s
|
||||
disable core dumps
|
||||
add a --help option
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.63 for netpgp 20090423.
|
||||
# Generated by GNU Autoconf 2.63 for netpgp 20090506.
|
||||
#
|
||||
# Report bugs to <Alistair Crooks <agc@netbsd.org> c0596823>.
|
||||
#
|
||||
|
@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='netpgp'
|
||||
PACKAGE_TARNAME='netpgp'
|
||||
PACKAGE_VERSION='20090423'
|
||||
PACKAGE_STRING='netpgp 20090423'
|
||||
PACKAGE_VERSION='20090506'
|
||||
PACKAGE_STRING='netpgp 20090506'
|
||||
PACKAGE_BUGREPORT='Alistair Crooks <agc@netbsd.org> c0596823'
|
||||
|
||||
ac_unique_file="src/bin/netpgp.c"
|
||||
|
@ -1268,7 +1268,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures netpgp 20090423 to adapt to many kinds of systems.
|
||||
\`configure' configures netpgp 20090506 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1338,7 +1338,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of netpgp 20090423:";;
|
||||
short | recursive ) echo "Configuration of netpgp 20090506:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1418,7 +1418,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
netpgp configure 20090423
|
||||
netpgp configure 20090506
|
||||
generated by GNU Autoconf 2.63
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
|
@ -1432,7 +1432,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by netpgp $as_me 20090423, which was
|
||||
It was created by netpgp $as_me 20090506, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -4287,8 +4287,620 @@ done
|
|||
|
||||
|
||||
|
||||
for ac_header in openssl/aes.h openssl/bn.h openssl/cast.h openssl/des.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
$as_echo_n "checking $ac_header usability... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
for ac_header in openssl/aes.h openssl/bn.h openssl/cast.h openssl/des.h openssl/dsa.h
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
$as_echo_n "checking $ac_header presence... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
( cat <<\_ASBOX
|
||||
## -------------------------------------------------------- ##
|
||||
## Report this to Alistair Crooks <agc@netbsd.org> c0596823 ##
|
||||
## -------------------------------------------------------- ##
|
||||
_ASBOX
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
as_val=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in openssl/dsa.h openssl/err.h openssl/idea.h openssl/md5.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
$as_echo_n "checking $ac_header usability... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
$as_echo_n "checking $ac_header presence... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
( cat <<\_ASBOX
|
||||
## -------------------------------------------------------- ##
|
||||
## Report this to Alistair Crooks <agc@netbsd.org> c0596823 ##
|
||||
## -------------------------------------------------------- ##
|
||||
_ASBOX
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
as_val=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in openssl/rand.h openssl/rsa.h openssl/sha.h openssl/err.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
$as_echo_n "checking $ac_header usability... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
$as_echo_n "checking $ac_header presence... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
( cat <<\_ASBOX
|
||||
## -------------------------------------------------------- ##
|
||||
## Report this to Alistair Crooks <agc@netbsd.org> c0596823 ##
|
||||
## -------------------------------------------------------- ##
|
||||
_ASBOX
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
as_val=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in openssl/idea.h openssl/md5.h openssl/rand.h openssl/rsa.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
$as_echo_n "checking $ac_header usability... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
$as_echo_n "checking $ac_header presence... " >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null && {
|
||||
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
}; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
|
||||
ac_header_preproc=yes
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
|
||||
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
|
||||
( cat <<\_ASBOX
|
||||
## -------------------------------------------------------- ##
|
||||
## Report this to Alistair Crooks <agc@netbsd.org> c0596823 ##
|
||||
## -------------------------------------------------------- ##
|
||||
_ASBOX
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
$as_echo_n "checking for $ac_header... " >&6; }
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$as_ac_Header=\$ac_header_preproc"
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
|
||||
fi
|
||||
as_val=`eval 'as_val=${'$as_ac_Header'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
for ac_header in openssl/sha.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
|
@ -4443,8 +5055,7 @@ done
|
|||
|
||||
|
||||
|
||||
|
||||
for ac_header in openssl/err.h openssl/idea.h openssl/md5.h openssl/rand.h openssl/rsa.h openssl/sha.h
|
||||
for ac_header in sys/cdefs.h sys/file.h sys/mman.h sys/param.h sys/resource.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
|
@ -4595,11 +5206,7 @@ fi
|
|||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in sys/cdefs.h sys/file.h sys/mman.h sys/param.h sys/uio.h
|
||||
for ac_header in sys/uio.h
|
||||
do
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
|
@ -5706,7 +6313,7 @@ exec 6>&1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by netpgp $as_me 20090423, which was
|
||||
This file was extended by netpgp $as_me 20090506, which was
|
||||
generated by GNU Autoconf 2.63. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -5765,7 +6372,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
|||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
netpgp config.status 20090423
|
||||
netpgp config.status 20090506
|
||||
configured by $0, generated by GNU Autoconf 2.63,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
dnl $Id: configure.ac,v 1.3 2009/05/05 15:29:46 agc Exp $
|
||||
dnl $Id: configure.ac,v 1.4 2009/05/08 06:06:38 agc Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([netpgp],[20090423],[Alistair Crooks <agc@netbsd.org> c0596823])
|
||||
AC_INIT([netpgp],[20090506],[Alistair Crooks <agc@netbsd.org> c0596823])
|
||||
AC_CONFIG_SRCDIR([src/bin/netpgp.c])
|
||||
AC_CONFIG_HEADER(src/lib/config.h)
|
||||
AC_ARG_PROGRAM
|
||||
|
@ -28,9 +28,13 @@ AC_CHECK_HEADERS([CommonCrypto/CommonDigest.h])
|
|||
AC_CHECK_HEADERS([bzlib.h dmalloc.h direct.h errno.h fcntl.h])
|
||||
AC_CHECK_HEADERS([inttypes.h libgen.h limits.h malloc.h])
|
||||
AC_CHECK_HEADERS([stdbool.h zlib.h])
|
||||
AC_CHECK_HEADERS([openssl/aes.h openssl/bn.h openssl/cast.h openssl/des.h openssl/dsa.h])
|
||||
AC_CHECK_HEADERS([openssl/err.h openssl/idea.h openssl/md5.h openssl/rand.h openssl/rsa.h openssl/sha.h])
|
||||
AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/mman.h sys/param.h sys/uio.h])
|
||||
AC_CHECK_HEADERS([openssl/aes.h openssl/bn.h openssl/cast.h openssl/des.h ])
|
||||
AC_CHECK_HEADERS([openssl/dsa.h openssl/err.h openssl/idea.h openssl/md5.h ])
|
||||
AC_CHECK_HEADERS([openssl/rand.h openssl/rsa.h openssl/sha.h openssl/err.h ])
|
||||
AC_CHECK_HEADERS([openssl/idea.h openssl/md5.h openssl/rand.h openssl/rsa.h ])
|
||||
AC_CHECK_HEADERS([openssl/sha.h])
|
||||
AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/mman.h sys/param.h sys/resource.h])
|
||||
AC_CHECK_HEADERS([sys/uio.h])
|
||||
|
||||
AC_TYPE_UINT8_T
|
||||
AC_TYPE_UINT16_T
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
/**
|
||||
\file Command line program to perform netpgp operations
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
|
@ -37,15 +39,26 @@
|
|||
|
||||
#define MAXBUF 1024
|
||||
|
||||
static const char *usage = "%s --list-keys | --list-packets | --encrypt | --decrypt | --sign | --clearsign | --verify [--keyring=<keyring>] [--userid=<userid>] [--armour] [--homedir=<homedir>] files...\n";
|
||||
static const char *usage =
|
||||
" --help OR\n"
|
||||
"\t--list-keys [options] OR\n"
|
||||
"\t--list-packets [options] OR\n"
|
||||
"\t--encrypt [options] files... OR\n"
|
||||
"\t--decrypt [options] files... OR\n"
|
||||
"\t--sign [--detach] [options] files... OR\n"
|
||||
"\t--clearsign [options] files... OR\n"
|
||||
"\t--verify [options] files...\n"
|
||||
"where options are:\n"
|
||||
"\t[--keyring=<keyring>] AND/OR\n"
|
||||
"\t[--userid=<userid>] AND/OR\n"
|
||||
"\t[--armour] AND/OR\n"
|
||||
"\t[--homedir=<homedir>]\n";
|
||||
static const char *usage_find_key = "%s --find-key --userid=<userid> [--keyring=<keyring>] \n";
|
||||
static const char *usage_export_key = "%s --export-key --userid=<userid> [--keyring=<keyring>] \n";
|
||||
static const char *usage_encrypt = "%s --encrypt --userid=<userid> [--armour] [--homedir=<homedir>] files...\n";
|
||||
static const char *usage_sign = "%s --sign --userid=<userid> [--armour] [--homedir=<homedir>] files...\n";
|
||||
static const char *usage_clearsign = "%s --clearsign --userid=<userid> [--homedir=<homedir>] files...\n";
|
||||
|
||||
static char *pname;
|
||||
|
||||
enum optdefs {
|
||||
/* commands */
|
||||
LIST_KEYS = 1,
|
||||
|
@ -60,6 +73,7 @@ enum optdefs {
|
|||
VERIFY,
|
||||
LIST_PACKETS,
|
||||
VERSION_CMD,
|
||||
HELP_CMD,
|
||||
|
||||
/* options */
|
||||
KEYRING,
|
||||
|
@ -77,52 +91,56 @@ enum optdefs {
|
|||
|
||||
#define EXIT_ERROR 2
|
||||
|
||||
static struct option long_options[] = {
|
||||
static struct option options[] = {
|
||||
/* 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},
|
||||
{"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},
|
||||
|
||||
{"encrypt", no_argument, NULL, ENCRYPT},
|
||||
{"decrypt", no_argument, NULL, DECRYPT},
|
||||
{"sign", no_argument, NULL, SIGN},
|
||||
{"clearsign", no_argument, NULL, CLEARSIGN},
|
||||
{"verify", no_argument, NULL, VERIFY},
|
||||
{"encrypt", no_argument, NULL, ENCRYPT},
|
||||
{"decrypt", no_argument, NULL, DECRYPT},
|
||||
{"sign", no_argument, NULL, SIGN},
|
||||
{"clearsign", no_argument, NULL, CLEARSIGN},
|
||||
{"verify", no_argument, NULL, VERIFY},
|
||||
|
||||
{"list-packets", no_argument, NULL, LIST_PACKETS},
|
||||
{"list-packets", no_argument, NULL, LIST_PACKETS},
|
||||
|
||||
{"version", no_argument, NULL, VERSION_CMD},
|
||||
{"help", no_argument, NULL, HELP_CMD},
|
||||
{"version", no_argument, NULL, VERSION_CMD},
|
||||
|
||||
/* options */
|
||||
{"keyring", required_argument, NULL, KEYRING},
|
||||
{"userid", required_argument, NULL, USERID},
|
||||
{"homedir", required_argument, NULL, HOMEDIR},
|
||||
{"armor", no_argument, NULL, ARMOUR},
|
||||
{"armour", no_argument, NULL, ARMOUR},
|
||||
{"numbits", required_argument, NULL, NUMBITS},
|
||||
{"detached", no_argument, NULL, DETACHED},
|
||||
{"keyring", required_argument, NULL, KEYRING},
|
||||
{"userid", required_argument, NULL, USERID},
|
||||
{"home", required_argument, NULL, HOMEDIR},
|
||||
{"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},
|
||||
|
||||
/* debug */
|
||||
{"debug", required_argument, NULL, OPS_DEBUG},
|
||||
{"debug", required_argument, NULL, OPS_DEBUG},
|
||||
|
||||
{ NULL, 0, NULL, 0},
|
||||
{ NULL, 0, NULL, 0},
|
||||
};
|
||||
|
||||
/* gather up program variables into one struct */
|
||||
typedef struct prog_t {
|
||||
char keyring[MAXBUF + 1]; /* name of keyring */
|
||||
char *userid; /* user identifier */
|
||||
char myring_name[MAXBUF + 1]; /* myring filename */
|
||||
char pubring_name[MAXBUF + 1]; /* pubring filename */
|
||||
char secring_name[MAXBUF + 1]; /* secret ring file */
|
||||
int overwrite; /* overwrite files? */
|
||||
int numbits; /* # of bits */
|
||||
int armour; /* ASCII armor */
|
||||
int detached; /* use separate file */
|
||||
int cmd; /* netpgp command */
|
||||
int ex; /* exit code */
|
||||
char keyring[MAXBUF + 1]; /* name of keyring */
|
||||
char *userid; /* user identifier */
|
||||
char myring_name[MAXBUF + 1]; /* myring filename */
|
||||
char pubring_name[MAXBUF + 1]; /* pubring filename */
|
||||
char secring_name[MAXBUF + 1]; /* secret ring file */
|
||||
char *progname; /* program name */
|
||||
int overwrite; /* overwrite files? */
|
||||
int numbits; /* # of bits */
|
||||
int armour; /* ASCII armor */
|
||||
int detached; /* use separate file */
|
||||
int cmd; /* netpgp command */
|
||||
int ex; /* exit code */
|
||||
} prog_t;
|
||||
|
||||
|
||||
|
@ -132,8 +150,12 @@ typedef struct prog_t {
|
|||
static void
|
||||
print_usage(const char *usagemsg, char *progname)
|
||||
{
|
||||
(void) fprintf(stderr, "\nUsage: ");
|
||||
(void) fprintf(stderr, usagemsg, basename(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' */
|
||||
|
@ -176,9 +198,10 @@ netpgp_cmd(netpgp_t *netpgp, prog_t *p, char *f)
|
|||
case LIST_PACKETS:
|
||||
netpgp_list_packets(netpgp, f, p->armour, NULL);
|
||||
break;
|
||||
case HELP_CMD:
|
||||
default:
|
||||
print_usage(usage, pname);
|
||||
exit(EXIT_ERROR);
|
||||
print_usage(usage, p->progname);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,35 +210,30 @@ main(int argc, char **argv)
|
|||
{
|
||||
netpgp_t netpgp;
|
||||
prog_t p;
|
||||
char homedir[MAXBUF + 1];
|
||||
int zeroargs;
|
||||
int optindex = 0;
|
||||
int ch = 0;
|
||||
char homedir[MAXPATHLEN];
|
||||
int optindex;
|
||||
int ch;
|
||||
int i;
|
||||
|
||||
pname = argv[0];
|
||||
(void) memset(&p, 0x0, sizeof(p));
|
||||
(void) memset(homedir, 0x0, sizeof(homedir));
|
||||
(void) memset(&netpgp, 0x0, sizeof(netpgp));
|
||||
zeroargs = 0;
|
||||
p.progname = argv[0];
|
||||
p.numbits = DEFAULT_NUMBITS;
|
||||
p.overwrite = 1;
|
||||
if (argc < 2) {
|
||||
print_usage(usage, pname);
|
||||
print_usage(usage, p.progname);
|
||||
exit(EXIT_ERROR);
|
||||
}
|
||||
|
||||
/* set default homedir */
|
||||
(void) snprintf(homedir, sizeof(homedir), "%s/.gnupg", getenv("HOME"));
|
||||
|
||||
while ((ch = getopt_long(argc, argv, "", long_options, &optindex)) != -1) {
|
||||
|
||||
/* read options and commands */
|
||||
|
||||
switch (long_options[optindex].val) {
|
||||
optindex = 0;
|
||||
while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) {
|
||||
switch (options[optindex].val) {
|
||||
case LIST_KEYS:
|
||||
zeroargs = 1;
|
||||
p.cmd = long_options[optindex].val;
|
||||
p.cmd = options[optindex].val;
|
||||
break;
|
||||
|
||||
case FIND_KEY:
|
||||
|
@ -228,11 +246,13 @@ main(int argc, char **argv)
|
|||
case CLEARSIGN:
|
||||
case VERIFY:
|
||||
case LIST_PACKETS:
|
||||
p.cmd = long_options[optindex].val;
|
||||
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",
|
||||
printf(
|
||||
"%s\nAll bug reports, praise and chocolate, please, to:\n%s\n",
|
||||
netpgp_get_info("version"),
|
||||
netpgp_get_info("maintainer"));
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -240,7 +260,8 @@ main(int argc, char **argv)
|
|||
/* options */
|
||||
case KEYRING:
|
||||
if (optarg == NULL) {
|
||||
(void) fprintf(stderr, "No keyring argument provided\n");
|
||||
(void) fprintf(stderr,
|
||||
"No keyring argument provided\n");
|
||||
exit(EXIT_ERROR);
|
||||
}
|
||||
snprintf(p.keyring, sizeof(p.keyring), "%s", optarg);
|
||||
|
@ -248,11 +269,13 @@ main(int argc, char **argv)
|
|||
|
||||
case USERID:
|
||||
if (optarg == NULL) {
|
||||
(void) fprintf(stderr, "No userid argument provided\n");
|
||||
(void) fprintf(stderr,
|
||||
"No userid argument provided\n");
|
||||
exit(EXIT_ERROR);
|
||||
}
|
||||
if (netpgp_get_debug(__FILE__)) {
|
||||
(void) fprintf(stderr, "userid is '%s'\n", optarg);
|
||||
(void) fprintf(stderr,
|
||||
"userid is '%s'\n", optarg);
|
||||
}
|
||||
p.userid = optarg;
|
||||
break;
|
||||
|
@ -267,7 +290,8 @@ main(int argc, char **argv)
|
|||
|
||||
case HOMEDIR:
|
||||
if (optarg == NULL) {
|
||||
(void) fprintf(stderr, "No home directory argument provided\n");
|
||||
(void) fprintf(stderr,
|
||||
"No home directory argument provided\n");
|
||||
exit(EXIT_ERROR);
|
||||
}
|
||||
(void) snprintf(homedir, sizeof(homedir), "%s", optarg);
|
||||
|
@ -275,7 +299,8 @@ main(int argc, char **argv)
|
|||
|
||||
case NUMBITS:
|
||||
if (optarg == NULL) {
|
||||
(void) fprintf(stderr, "No number of bits argument provided\n");
|
||||
(void) fprintf(stderr,
|
||||
"No number of bits argument provided\n");
|
||||
exit(EXIT_ERROR);
|
||||
}
|
||||
p.numbits = atoi(optarg);
|
||||
|
@ -286,7 +311,7 @@ main(int argc, char **argv)
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("shouldn't be here: option=%d\n", long_options[optindex].val);
|
||||
p.cmd = HELP_CMD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -301,15 +326,13 @@ main(int argc, char **argv)
|
|||
* now do the required action for each of the files on the command
|
||||
* line
|
||||
*/
|
||||
if (zeroargs) {
|
||||
if (optind == argc) {
|
||||
netpgp_cmd(&netpgp, &p, NULL);
|
||||
} else {
|
||||
for (p.ex = EXIT_SUCCESS, i = optind; i < argc; i++) {
|
||||
netpgp_cmd(&netpgp, &p, argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
netpgp_end(&netpgp);
|
||||
|
||||
exit(p.ex);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,9 @@
|
|||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
|
@ -125,13 +128,13 @@
|
|||
#define PACKAGE_NAME "netpgp"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "netpgp 20090423"
|
||||
#define PACKAGE_STRING "netpgp 20090506"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "netpgp"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "20090423"
|
||||
#define PACKAGE_VERSION "20090506"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
|
|
@ -102,6 +102,9 @@
|
|||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#undef HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
|
|
|
@ -185,16 +185,16 @@ callback_write_parsed(const __ops_packet_t *, __ops_callback_data_t *);
|
|||
/**
|
||||
\ingroup HighLevel_Crypto
|
||||
Encrypt a file
|
||||
\param input_filename Name of file to be encrypted
|
||||
\param output_filename Name of file to write to. If NULL, name is constructed from input_filename
|
||||
\param infile Name of file to be encrypted
|
||||
\param outfile Name of file to write to. If NULL, name is constructed from infile
|
||||
\param pub_key Public Key to encrypt file for
|
||||
\param use_armour Write armoured text, if set
|
||||
\param allow_overwrite Allow output file to be overwrwritten if it exists
|
||||
\return true if OK; else false
|
||||
*/
|
||||
bool
|
||||
__ops_encrypt_file(const char *input_filename,
|
||||
const char *output_filename,
|
||||
__ops_encrypt_file(const char *infile,
|
||||
const char *outfile,
|
||||
const __ops_keydata_t * pub_key,
|
||||
const bool use_armour,
|
||||
const bool allow_overwrite)
|
||||
|
@ -207,16 +207,15 @@ __ops_encrypt_file(const char *input_filename,
|
|||
int fd_out = 0;
|
||||
|
||||
#ifdef O_BINARY
|
||||
fd_in = open(input_filename, O_RDONLY | O_BINARY);
|
||||
fd_in = open(infile, O_RDONLY | O_BINARY);
|
||||
#else
|
||||
fd_in = open(input_filename, O_RDONLY);
|
||||
fd_in = open(infile, O_RDONLY);
|
||||
#endif
|
||||
if (fd_in < 0) {
|
||||
perror(input_filename);
|
||||
perror(infile);
|
||||
return false;
|
||||
}
|
||||
fd_out = __ops_setup_file_write(&create, output_filename,
|
||||
allow_overwrite);
|
||||
fd_out = __ops_setup_file_write(&create, outfile, allow_overwrite);
|
||||
if (fd_out < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -263,8 +262,8 @@ __ops_encrypt_file(const char *input_filename,
|
|||
/**
|
||||
\ingroup HighLevel_Crypto
|
||||
\brief Decrypt a file.
|
||||
\param input_filename Name of file to be decrypted
|
||||
\param output_filename Name of file to write to. If NULL, the filename is constructed from the input filename, following GPG conventions.
|
||||
\param infile Name of file to be decrypted
|
||||
\param outfile Name of file to write to. If NULL, the filename is constructed from the input filename, following GPG conventions.
|
||||
\param keyring Keyring to use
|
||||
\param use_armour Expect armoured text, if set
|
||||
\param allow_overwrite Allow output file to overwritten, if set.
|
||||
|
@ -272,56 +271,61 @@ __ops_encrypt_file(const char *input_filename,
|
|||
*/
|
||||
|
||||
bool
|
||||
__ops_decrypt_file(const char *input_filename, const char *output_filename, __ops_keyring_t * keyring, const bool use_armour, const bool allow_overwrite, __ops_parse_cb_t * cb_get_passphrase)
|
||||
__ops_decrypt_file(const char *infile,
|
||||
const char *outfile,
|
||||
__ops_keyring_t *keyring,
|
||||
const bool use_armour,
|
||||
const bool allow_overwrite,
|
||||
__ops_parse_cb_t *cb_get_passphrase)
|
||||
{
|
||||
int fd_in = 0;
|
||||
int fd_out = 0;
|
||||
char *myfilename = NULL;
|
||||
__ops_parse_info_t *parse = NULL;
|
||||
__ops_parse_info_t *parse = NULL;
|
||||
char *filename = NULL;
|
||||
int fd_in = 0;
|
||||
int fd_out = 0;
|
||||
|
||||
/* setup for reading from given input file */
|
||||
fd_in = __ops_setup_file_read(&parse, input_filename,
|
||||
fd_in = __ops_setup_file_read(&parse, infile,
|
||||
NULL,
|
||||
callback_write_parsed,
|
||||
false);
|
||||
if (fd_in < 0) {
|
||||
perror(input_filename);
|
||||
perror(infile);
|
||||
return false;
|
||||
}
|
||||
/* setup output filename */
|
||||
|
||||
if (output_filename) {
|
||||
fd_out = __ops_setup_file_write(&parse->cbinfo.cinfo, output_filename, allow_overwrite);
|
||||
|
||||
if (outfile) {
|
||||
fd_out = __ops_setup_file_write(&parse->cbinfo.cinfo, outfile,
|
||||
allow_overwrite);
|
||||
if (fd_out < 0) {
|
||||
perror(output_filename);
|
||||
perror(outfile);
|
||||
__ops_teardown_file_read(parse, fd_in);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
unsigned filenamelen;
|
||||
int suffixlen = 4;
|
||||
const char *defaultsuffix = ".decrypted";
|
||||
const char *suffix = input_filename + strlen(input_filename) - suffixlen;
|
||||
const char *suffix = infile + strlen(infile) - suffixlen;
|
||||
|
||||
if (strcmp(suffix, ".gpg") == 0 ||
|
||||
strcmp(suffix, ".asc") == 0) {
|
||||
myfilename = calloc(1, strlen(input_filename) - suffixlen + 1);
|
||||
strncpy(myfilename, input_filename, strlen(input_filename) - suffixlen);
|
||||
} else {
|
||||
unsigned filenamelen = strlen(input_filename) + strlen(defaultsuffix) + 1;
|
||||
|
||||
myfilename = calloc(1, filenamelen);
|
||||
snprintf(myfilename, filenamelen, "%s%s", input_filename, defaultsuffix);
|
||||
filenamelen = strlen(infile) - strlen(suffix);
|
||||
filename = calloc(1, filenamelen + 1);
|
||||
(void) strncpy(filename, infile, filenamelen);
|
||||
filename[filenamelen] = 0x0;
|
||||
}
|
||||
|
||||
fd_out = __ops_setup_file_write(&parse->cbinfo.cinfo, myfilename, allow_overwrite);
|
||||
|
||||
fd_out = __ops_setup_file_write(&parse->cbinfo.cinfo,
|
||||
filename, allow_overwrite);
|
||||
if (fd_out < 0) {
|
||||
perror(myfilename);
|
||||
free(myfilename);
|
||||
perror(filename);
|
||||
(void) free(filename);
|
||||
__ops_teardown_file_read(parse, fd_in);
|
||||
return false;
|
||||
}
|
||||
free(myfilename);
|
||||
if (filename) {
|
||||
(void) free(filename);
|
||||
}
|
||||
}
|
||||
|
||||
/* \todo check for suffix matching armour param */
|
||||
|
@ -333,20 +337,21 @@ __ops_decrypt_file(const char *input_filename, const char *output_filename, __op
|
|||
parse->cbinfo.cryptinfo.cb_get_passphrase = cb_get_passphrase;
|
||||
|
||||
/* Set up armour/passphrase options */
|
||||
|
||||
if (use_armour)
|
||||
if (use_armour) {
|
||||
__ops_reader_push_dearmour(parse);
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
|
||||
__ops_parse(parse, 1);
|
||||
|
||||
/* Unsetup */
|
||||
|
||||
if (use_armour)
|
||||
if (use_armour) {
|
||||
__ops_reader_pop_dearmour(parse);
|
||||
}
|
||||
|
||||
__ops_teardown_file_write(parse->cbinfo.cinfo, fd_out);
|
||||
if (filename) {
|
||||
__ops_teardown_file_write(parse->cbinfo.cinfo, fd_out);
|
||||
}
|
||||
__ops_teardown_file_read(parse, fd_in);
|
||||
/* \todo cleardown crypt */
|
||||
|
||||
|
@ -354,12 +359,10 @@ __ops_decrypt_file(const char *input_filename, const char *output_filename, __op
|
|||
}
|
||||
|
||||
static __ops_parse_cb_return_t
|
||||
callback_write_parsed(const __ops_packet_t *pkt, __ops_callback_data_t * cbinfo)
|
||||
callback_write_parsed(const __ops_packet_t *pkt, __ops_callback_data_t *cbinfo)
|
||||
{
|
||||
const __ops_parser_content_union_t *content = &pkt->u;
|
||||
static bool skipping;
|
||||
|
||||
OPS_USED(cbinfo);
|
||||
const __ops_parser_content_union_t *content = &pkt->u;
|
||||
static bool skipping;
|
||||
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
printf("callback_write_parsed: ");
|
||||
|
@ -387,10 +390,6 @@ callback_write_parsed(const __ops_packet_t *pkt, __ops_callback_data_t * cbinfo)
|
|||
return get_seckey_cb(pkt, cbinfo);
|
||||
|
||||
case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
|
||||
/*
|
||||
* return
|
||||
* get_seckey_cb(pkt,cbinfo);
|
||||
*/
|
||||
return cbinfo->cryptinfo.cb_get_passphrase(pkt, cbinfo);
|
||||
|
||||
case OPS_PTAG_CT_LITERAL_DATA_BODY:
|
||||
|
@ -405,14 +404,12 @@ callback_write_parsed(const __ops_packet_t *pkt, __ops_callback_data_t * cbinfo)
|
|||
case OPS_PTAG_CT_SE_IP_DATA_HEADER:
|
||||
case OPS_PTAG_CT_SE_DATA_BODY:
|
||||
case OPS_PTAG_CT_SE_DATA_HEADER:
|
||||
|
||||
/* Ignore these packets */
|
||||
/* They're handled in __ops_parse_packet() */
|
||||
/* and nothing else needs to be done */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* return callback_general(pkt,cbinfo); */
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "Unexpected packet tag=%d (0x%x)\n",
|
||||
pkt->tag,
|
||||
|
|
|
@ -608,21 +608,26 @@ __ops_hash_size(__ops_hash_algorithm_t alg)
|
|||
__ops_hash_algorithm_t
|
||||
__ops_hash_algorithm_from_text(const char *hash)
|
||||
{
|
||||
if (!strcmp(hash, "SHA1"))
|
||||
if (strcmp(hash, "SHA1") == 0) {
|
||||
return OPS_HASH_SHA1;
|
||||
else if (!strcmp(hash, "MD5"))
|
||||
}
|
||||
if (strcmp(hash, "MD5") == 0) {
|
||||
return OPS_HASH_MD5;
|
||||
else if (!strcmp(hash, "SHA256"))
|
||||
}
|
||||
if (strcmp(hash, "SHA256") == 0) {
|
||||
return OPS_HASH_SHA256;
|
||||
}
|
||||
/*
|
||||
else if (!strcmp(hash,"SHA224"))
|
||||
return OPS_HASH_SHA224;
|
||||
if (strcmp(hash,"SHA224") == 0) {
|
||||
return OPS_HASH_SHA224;
|
||||
}
|
||||
*/
|
||||
else if (!strcmp(hash, "SHA512"))
|
||||
if (strcmp(hash, "SHA512") == 0) {
|
||||
return OPS_HASH_SHA512;
|
||||
else if (!strcmp(hash, "SHA384"))
|
||||
}
|
||||
if (strcmp(hash, "SHA384") == 0) {
|
||||
return OPS_HASH_SHA384;
|
||||
|
||||
}
|
||||
return OPS_HASH_UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CAST_H
|
||||
#include <openssl/cast.h>
|
||||
#endif
|
||||
|
@ -135,21 +139,21 @@ userid_to_id(const unsigned char *userid, char *id)
|
|||
|
||||
/* print out the successful signature information */
|
||||
static void
|
||||
psuccess(char *f, __ops_validation_t *results, __ops_keyring_t *pubring)
|
||||
psuccess(FILE *fp, char *f, __ops_validation_t *res, __ops_keyring_t *pubring)
|
||||
{
|
||||
const __ops_keydata_t *pubkey;
|
||||
unsigned i;
|
||||
char id[MAX_ID_LENGTH + 1];
|
||||
|
||||
for (i = 0; i < results->validc; i++) {
|
||||
printf("Good signature for %s made %susing %s key %s\n",
|
||||
f,
|
||||
ctime(&results->valid_sigs[i].birthtime),
|
||||
__ops_show_pka(results->valid_sigs[i].key_algorithm),
|
||||
userid_to_id(results->valid_sigs[i].signer_id, id));
|
||||
for (i = 0; i < res->validc; i++) {
|
||||
(void) fprintf(fp,
|
||||
"Good signature for %s made %susing %s key %s\n",
|
||||
f,
|
||||
ctime(&res->valid_sigs[i].birthtime),
|
||||
__ops_show_pka(res->valid_sigs[i].key_algorithm),
|
||||
userid_to_id(res->valid_sigs[i].signer_id, id));
|
||||
pubkey = __ops_keyring_find_key_by_id(pubring,
|
||||
(const unsigned char *)
|
||||
results->valid_sigs[i].signer_id);
|
||||
(const unsigned char *) res->valid_sigs[i].signer_id);
|
||||
__ops_print_pubkeydata(pubkey);
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +182,7 @@ sign_detached(char *f, char *sigfile, __ops_seckey_t *seckey,
|
|||
|
||||
/* create a new signature */
|
||||
sig = __ops_create_sig_new();
|
||||
__ops_start_cleartext_sig(sig, seckey, alg, OPS_SIG_BINARY);
|
||||
__ops_start_sig(sig, seckey, alg, OPS_SIG_BINARY);
|
||||
|
||||
/* read the contents of 'f' */
|
||||
fd = open(f, O_RDONLY);
|
||||
|
@ -258,6 +262,18 @@ netpgp_init(netpgp_t *netpgp, char *userid, char *pubring, char *secring)
|
|||
char ringname[MAXPATHLEN];
|
||||
char id[MAX_ID_LENGTH];
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
struct rlimit limit;
|
||||
|
||||
(void) memset(&limit, 0x0, sizeof(limit));
|
||||
if (setrlimit(RLIMIT_CORE, &limit) != 0) {
|
||||
(void) fprintf(stderr,
|
||||
"netpgp_init: warning - can't turn off core dumps\n");
|
||||
}
|
||||
#else
|
||||
(void) fprintf(stderr,
|
||||
"netpgp_init: warning - no way of switching off core dumps\n");
|
||||
#endif
|
||||
(void) memset(netpgp, 0x0, sizeof(*netpgp));
|
||||
homedir = getenv("HOME");
|
||||
if (userid == NULL) {
|
||||
|
@ -272,7 +288,8 @@ netpgp_init(netpgp_t *netpgp, char *userid, char *pubring, char *secring)
|
|||
return 0;
|
||||
}
|
||||
if (pubring == NULL) {
|
||||
(void) snprintf(ringname, sizeof(ringname), "%s/.gnupg/pubring.gpg", homedir);
|
||||
(void) snprintf(ringname, sizeof(ringname),
|
||||
"%s/.gnupg/pubring.gpg", homedir);
|
||||
pubring = ringname;
|
||||
}
|
||||
keyring = calloc(1, sizeof(*keyring));
|
||||
|
@ -283,7 +300,8 @@ netpgp_init(netpgp_t *netpgp, char *userid, char *pubring, char *secring)
|
|||
netpgp->pubring = keyring;
|
||||
netpgp->pubringfile = strdup(pubring);
|
||||
if (secring == NULL) {
|
||||
(void) snprintf(ringname, sizeof(ringname), "%s/.gnupg/secring.gpg", homedir);
|
||||
(void) snprintf(ringname, sizeof(ringname),
|
||||
"%s/.gnupg/secring.gpg", homedir);
|
||||
secring = ringname;
|
||||
}
|
||||
keyring = calloc(1, sizeof(*keyring));
|
||||
|
@ -491,14 +509,16 @@ netpgp_verify_file(netpgp_t *netpgp, char *f, int armored)
|
|||
|
||||
(void) memset(&result, 0x0, sizeof(result));
|
||||
if (__ops_validate_file(&result, f, armored, netpgp->pubring)) {
|
||||
psuccess(f, &result, netpgp->pubring);
|
||||
psuccess(stderr, f, &result, netpgp->pubring);
|
||||
return 1;
|
||||
}
|
||||
if (result.validc + result.invalidc + result.unknownc == 0) {
|
||||
(void) fprintf(stderr, "\"%s\": No signatures found - is this a signed file?\n", f);
|
||||
(void) fprintf(stderr,
|
||||
"\"%s\": No signatures found - is this a signed file?\n", f);
|
||||
return 0;
|
||||
}
|
||||
(void) fprintf(stderr, "\"%s\": verification failure: %d invalid signatures, %d unknown signatures\n",
|
||||
(void) fprintf(stderr,
|
||||
"\"%s\": verification failure: %d invalid signatures, %d unknown signatures\n",
|
||||
f, result.invalidc, result.unknownc);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -105,8 +105,15 @@ md5_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
return 16;
|
||||
}
|
||||
|
||||
static __ops_hash_t md5 = {OPS_HASH_MD5, MD5_DIGEST_LENGTH, "MD5", md5_init, md5_add,
|
||||
md5_finish, NULL};
|
||||
static __ops_hash_t md5 = {
|
||||
OPS_HASH_MD5,
|
||||
MD5_DIGEST_LENGTH,
|
||||
"MD5",
|
||||
md5_init,
|
||||
md5_add,
|
||||
md5_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
\ingroup Core_Crypto
|
||||
|
@ -133,20 +140,21 @@ sha1_init(__ops_hash_t * hash)
|
|||
}
|
||||
|
||||
static void
|
||||
sha1_add(__ops_hash_t * hash, const unsigned char *data,
|
||||
unsigned length)
|
||||
sha1_add(__ops_hash_t * hash, const unsigned char *data, unsigned length)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
unsigned int i;
|
||||
|
||||
(void) fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
for (i = 0; i < length; i++) {
|
||||
fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16))
|
||||
fprintf(stderr, "\n");
|
||||
else if (!((i + 1) % 8))
|
||||
fprintf(stderr, " ");
|
||||
(void) fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16)) {
|
||||
(void) fprintf(stderr, "\n");
|
||||
} else if (!((i + 1) % 8)) {
|
||||
(void) fprintf(stderr, " ");
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
SHA1_Update(hash->data, data, length);
|
||||
}
|
||||
|
@ -156,19 +164,27 @@ sha1_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
{
|
||||
SHA1_Final(out, hash->data);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i = 0;
|
||||
fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
unsigned i;
|
||||
|
||||
(void) fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
for (i = 0; i < SHA_DIGEST_LENGTH; i++)
|
||||
fprintf(stderr, "0x%02x ", out[i]);
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "0x%02x ", out[i]);
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
free(hash->data);
|
||||
(void) free(hash->data);
|
||||
hash->data = NULL;
|
||||
return SHA_DIGEST_LENGTH;
|
||||
}
|
||||
|
||||
static __ops_hash_t sha1 = {OPS_HASH_SHA1, SHA_DIGEST_LENGTH, "SHA1", sha1_init,
|
||||
sha1_add, sha1_finish, NULL};
|
||||
static __ops_hash_t sha1 = {
|
||||
OPS_HASH_SHA1,
|
||||
SHA_DIGEST_LENGTH,
|
||||
"SHA1",
|
||||
sha1_init,
|
||||
sha1_add,
|
||||
sha1_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
\ingroup Core_Crypto
|
||||
|
@ -195,20 +211,20 @@ sha256_init(__ops_hash_t * hash)
|
|||
}
|
||||
|
||||
static void
|
||||
sha256_add(__ops_hash_t * hash, const unsigned char *data,
|
||||
unsigned length)
|
||||
sha256_add(__ops_hash_t * hash, const unsigned char *data, unsigned length)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
unsigned int i;
|
||||
|
||||
(void) fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
for (i = 0; i < length; i++) {
|
||||
fprintf(stderr, "0x%02x ", data[i]);
|
||||
(void) fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16))
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
else if (!((i + 1) % 8))
|
||||
fprintf(stderr, " ");
|
||||
(void) fprintf(stderr, " ");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
SHA256_Update(hash->data, data, length);
|
||||
}
|
||||
|
@ -218,22 +234,30 @@ sha256_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
{
|
||||
SHA256_Final(out, hash->data);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i = 0;
|
||||
fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
unsigned i;
|
||||
|
||||
(void) fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
|
||||
fprintf(stderr, "0x%02x ", out[i]);
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "0x%02x ", out[i]);
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
free(hash->data);
|
||||
(void) free(hash->data);
|
||||
hash->data = NULL;
|
||||
return SHA256_DIGEST_LENGTH;
|
||||
}
|
||||
|
||||
static __ops_hash_t sha256 = {OPS_HASH_SHA256, SHA256_DIGEST_LENGTH, "SHA256", sha256_init,
|
||||
sha256_add, sha256_finish, NULL};
|
||||
static __ops_hash_t sha256 = {
|
||||
OPS_HASH_SHA256,
|
||||
SHA256_DIGEST_LENGTH,
|
||||
"SHA256",
|
||||
sha256_init,
|
||||
sha256_add,
|
||||
sha256_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
__ops_hash_sha256(__ops_hash_t * hash)
|
||||
__ops_hash_sha256(__ops_hash_t *hash)
|
||||
{
|
||||
*hash = sha256;
|
||||
}
|
||||
|
@ -241,12 +265,11 @@ __ops_hash_sha256(__ops_hash_t * hash)
|
|||
/*
|
||||
* SHA384
|
||||
*/
|
||||
|
||||
static void
|
||||
sha384_init(__ops_hash_t * hash)
|
||||
sha384_init(__ops_hash_t *hash)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "***\n***\nsha384_init\n***\n");
|
||||
(void) fprintf(stderr, "***\n***\nsha384_init\n***\n");
|
||||
}
|
||||
if (hash->data) {
|
||||
(void) fprintf(stderr, "sha384_init: hash data non-null\n");
|
||||
|
@ -256,20 +279,20 @@ sha384_init(__ops_hash_t * hash)
|
|||
}
|
||||
|
||||
static void
|
||||
sha384_add(__ops_hash_t * hash, const unsigned char *data,
|
||||
unsigned length)
|
||||
sha384_add(__ops_hash_t * hash, const unsigned char *data, unsigned length)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
unsigned int i;
|
||||
|
||||
(void) fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
for (i = 0; i < length; i++) {
|
||||
fprintf(stderr, "0x%02x ", data[i]);
|
||||
(void) fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16))
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
else if (!((i + 1) % 8))
|
||||
fprintf(stderr, " ");
|
||||
(void) fprintf(stderr, " ");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
SHA384_Update(hash->data, data, length);
|
||||
}
|
||||
|
@ -279,22 +302,30 @@ sha384_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
{
|
||||
SHA384_Final(out, hash->data);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i = 0;
|
||||
fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
unsigned i;
|
||||
|
||||
(void) fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
for (i = 0; i < SHA384_DIGEST_LENGTH; i++)
|
||||
fprintf(stderr, "0x%02x ", out[i]);
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "0x%02x ", out[i]);
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
free(hash->data);
|
||||
(void) free(hash->data);
|
||||
hash->data = NULL;
|
||||
return SHA384_DIGEST_LENGTH;
|
||||
}
|
||||
|
||||
static __ops_hash_t sha384 = {OPS_HASH_SHA384, SHA384_DIGEST_LENGTH, "SHA384", sha384_init,
|
||||
sha384_add, sha384_finish, NULL};
|
||||
static __ops_hash_t sha384 = {
|
||||
OPS_HASH_SHA384,
|
||||
SHA384_DIGEST_LENGTH,
|
||||
"SHA384",
|
||||
sha384_init,
|
||||
sha384_add,
|
||||
sha384_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
__ops_hash_sha384(__ops_hash_t * hash)
|
||||
__ops_hash_sha384(__ops_hash_t *hash)
|
||||
{
|
||||
*hash = sha384;
|
||||
}
|
||||
|
@ -302,12 +333,11 @@ __ops_hash_sha384(__ops_hash_t * hash)
|
|||
/*
|
||||
* SHA512
|
||||
*/
|
||||
|
||||
static void
|
||||
sha512_init(__ops_hash_t * hash)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "***\n***\nsha512_init\n***\n");
|
||||
(void) fprintf(stderr, "***\n***\nsha512_init\n***\n");
|
||||
}
|
||||
if (hash->data) {
|
||||
(void) fprintf(stderr, "sha512_init: hash data non-null\n");
|
||||
|
@ -317,20 +347,20 @@ sha512_init(__ops_hash_t * hash)
|
|||
}
|
||||
|
||||
static void
|
||||
sha512_add(__ops_hash_t * hash, const unsigned char *data,
|
||||
unsigned length)
|
||||
sha512_add(__ops_hash_t * hash, const unsigned char *data, unsigned length)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
unsigned int i;
|
||||
|
||||
(void) fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
for (i = 0; i < length; i++) {
|
||||
fprintf(stderr, "0x%02x ", data[i]);
|
||||
(void) fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16))
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
else if (!((i + 1) % 8))
|
||||
fprintf(stderr, " ");
|
||||
(void) fprintf(stderr, " ");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
SHA512_Update(hash->data, data, length);
|
||||
}
|
||||
|
@ -340,19 +370,27 @@ sha512_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
{
|
||||
SHA512_Final(out, hash->data);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i = 0;
|
||||
fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
unsigned i;
|
||||
|
||||
(void) fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
for (i = 0; i < SHA512_DIGEST_LENGTH; i++)
|
||||
fprintf(stderr, "0x%02x ", out[i]);
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "0x%02x ", out[i]);
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
free(hash->data);
|
||||
(void) free(hash->data);
|
||||
hash->data = NULL;
|
||||
return SHA512_DIGEST_LENGTH;
|
||||
}
|
||||
|
||||
static __ops_hash_t sha512 = {OPS_HASH_SHA512, SHA512_DIGEST_LENGTH, "SHA512", sha512_init,
|
||||
sha512_add, sha512_finish, NULL};
|
||||
static __ops_hash_t sha512 = {
|
||||
OPS_HASH_SHA512,
|
||||
SHA512_DIGEST_LENGTH,
|
||||
"SHA512",
|
||||
sha512_init,
|
||||
sha512_add,
|
||||
sha512_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
__ops_hash_sha512(__ops_hash_t * hash)
|
||||
|
@ -368,7 +406,7 @@ static void
|
|||
sha224_init(__ops_hash_t * hash)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "***\n***\nsha1_init\n***\n");
|
||||
(void) fprintf(stderr, "***\n***\nsha1_init\n***\n");
|
||||
}
|
||||
if (hash->data) {
|
||||
(void) fprintf(stderr, "sha224_init: hash data non-null\n");
|
||||
|
@ -378,20 +416,20 @@ sha224_init(__ops_hash_t * hash)
|
|||
}
|
||||
|
||||
static void
|
||||
sha224_add(__ops_hash_t * hash, const unsigned char *data,
|
||||
unsigned length)
|
||||
sha224_add(__ops_hash_t * hash, const unsigned char *data, unsigned length)
|
||||
{
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned int i = 0;
|
||||
fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
unsigned int i;
|
||||
|
||||
(void) fprintf(stderr, "adding %d to hash:\n ", length);
|
||||
for (i = 0; i < length; i++) {
|
||||
fprintf(stderr, "0x%02x ", data[i]);
|
||||
(void) fprintf(stderr, "0x%02x ", data[i]);
|
||||
if (!((i + 1) % 16))
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
else if (!((i + 1) % 8))
|
||||
fprintf(stderr, " ");
|
||||
(void) fprintf(stderr, " ");
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
SHA224_Update(hash->data, data, length);
|
||||
}
|
||||
|
@ -401,19 +439,27 @@ sha224_finish(__ops_hash_t * hash, unsigned char *out)
|
|||
{
|
||||
SHA224_Final(out, hash->data);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i = 0;
|
||||
fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
unsigned i;
|
||||
|
||||
(void) fprintf(stderr, "***\n***\nsha1_finish\n***\n");
|
||||
for (i = 0; i < SHA224_DIGEST_LENGTH; i++)
|
||||
fprintf(stderr, "0x%02x ", out[i]);
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "0x%02x ", out[i]);
|
||||
(void) fprintf(stderr, "\n");
|
||||
}
|
||||
free(hash->data);
|
||||
(void) free(hash->data);
|
||||
hash->data = NULL;
|
||||
return SHA224_DIGEST_LENGTH;
|
||||
}
|
||||
|
||||
static __ops_hash_t sha224 = {OPS_HASH_SHA224, SHA224_DIGEST_LENGTH, "SHA224", sha224_init,
|
||||
sha224_add, sha224_finish, NULL};
|
||||
static __ops_hash_t sha224 = {
|
||||
OPS_HASH_SHA224,
|
||||
SHA224_DIGEST_LENGTH,
|
||||
"SHA224",
|
||||
sha224_init,
|
||||
sha224_add,
|
||||
sha224_finish,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
__ops_hash_sha224(__ops_hash_t * hash)
|
||||
|
@ -443,21 +489,21 @@ __ops_dsa_verify(const unsigned char *hash, size_t hash_length,
|
|||
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
unsigned i;
|
||||
fprintf(stderr, "hash passed in:\n");
|
||||
|
||||
(void) fprintf(stderr, "hash passed in:\n");
|
||||
for (i = 0; i < hash_length; i++) {
|
||||
fprintf(stderr, "%02x ", hash[i]);
|
||||
(void) fprintf(stderr, "%02x ", hash[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
(void) fprintf(stderr, "\n");
|
||||
printf("hash_length=%" PRIsize "d\n", hash_length);
|
||||
}
|
||||
/* printf("hash_length=%ld\n", hash_length); */
|
||||
/* printf("Q=%d\n", BN_num_bytes(odsa->q)); */
|
||||
qlen = BN_num_bytes(odsa->q);
|
||||
if (qlen < hash_length)
|
||||
if ((qlen = BN_num_bytes(odsa->q)) < hash_length) {
|
||||
hash_length = qlen;
|
||||
/* ret=DSA_do_verify(hash,hash_length,osig,odsa); */
|
||||
}
|
||||
ret = DSA_do_verify(hash, (int)hash_length, osig, odsa);
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "ret=%d\n", ret);
|
||||
(void) fprintf(stderr, "ret=%d\n", ret);
|
||||
}
|
||||
if (ret < 0) {
|
||||
(void) fprintf(stderr,
|
||||
|
@ -513,8 +559,10 @@ __ops_rsa_public_decrypt(unsigned char *out, const unsigned char *in,
|
|||
\return number of bytes decrypted
|
||||
*/
|
||||
int
|
||||
__ops_rsa_private_encrypt(unsigned char *out, const unsigned char *in,
|
||||
size_t length, const __ops_rsa_seckey_t *srsa,
|
||||
__ops_rsa_private_encrypt(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
size_t length,
|
||||
const __ops_rsa_seckey_t *srsa,
|
||||
const __ops_rsa_pubkey_t *rsa)
|
||||
{
|
||||
RSA *orsa;
|
||||
|
@ -609,8 +657,10 @@ __ops_rsa_private_decrypt(unsigned char *out, const unsigned char *in,
|
|||
\param rsa RSA Public Key
|
||||
*/
|
||||
int
|
||||
__ops_rsa_public_encrypt(unsigned char *out, const unsigned char *in,
|
||||
size_t length, const __ops_rsa_pubkey_t * rsa)
|
||||
__ops_rsa_public_encrypt(unsigned char *out,
|
||||
const unsigned char *in,
|
||||
size_t length,
|
||||
const __ops_rsa_pubkey_t *rsa)
|
||||
{
|
||||
RSA *orsa;
|
||||
int n;
|
||||
|
@ -628,6 +678,7 @@ __ops_rsa_public_encrypt(unsigned char *out, const unsigned char *in,
|
|||
|
||||
if (n == -1) {
|
||||
BIO *fd_out;
|
||||
|
||||
fd_out = BIO_new_fd(fileno(stderr), BIO_NOCLOSE);
|
||||
ERR_print_errors(fd_out);
|
||||
}
|
||||
|
@ -691,7 +742,9 @@ __ops_text_from_hash(__ops_hash_t * hash)
|
|||
\note It is the caller's responsibility to call __ops_keydata_free(keydata)
|
||||
*/
|
||||
bool
|
||||
__ops_rsa_generate_keypair(const int numbits, const unsigned long e, __ops_keydata_t * keydata)
|
||||
__ops_rsa_generate_keypair(const int numbits,
|
||||
const unsigned long e,
|
||||
__ops_keydata_t *keydata)
|
||||
{
|
||||
__ops_seckey_t *seckey = NULL;
|
||||
RSA *rsa = NULL;
|
||||
|
@ -756,11 +809,12 @@ __ops_rsa_generate_keypair(const int numbits, const unsigned long e, __ops_keyda
|
|||
case OPS_PKA_RSA:
|
||||
case OPS_PKA_RSA_ENCRYPT_ONLY:
|
||||
case OPS_PKA_RSA_SIGN_ONLY:
|
||||
if (!__ops_write_mpi(seckey->key.rsa.d, cinfo)
|
||||
|| !__ops_write_mpi(seckey->key.rsa.p, cinfo)
|
||||
|| !__ops_write_mpi(seckey->key.rsa.q, cinfo)
|
||||
|| !__ops_write_mpi(seckey->key.rsa.u, cinfo))
|
||||
if (!__ops_write_mpi(seckey->key.rsa.d, cinfo) ||
|
||||
!__ops_write_mpi(seckey->key.rsa.p, cinfo) ||
|
||||
!__ops_write_mpi(seckey->key.rsa.q, cinfo) ||
|
||||
!__ops_write_mpi(seckey->key.rsa.u, cinfo)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
/* case OPS_PKA_ELGAMAL: */
|
||||
|
@ -778,8 +832,9 @@ __ops_rsa_generate_keypair(const int numbits, const unsigned long e, __ops_keyda
|
|||
/* should now have checksum in seckey struct */
|
||||
|
||||
/* test */
|
||||
if (__ops_get_debug_level(__FILE__))
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
test_seckey(seckey);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -797,46 +852,29 @@ __ops_rsa_generate_keypair(const int numbits, const unsigned long e, __ops_keyda
|
|||
\sa __ops_keydata_free()
|
||||
*/
|
||||
__ops_keydata_t *
|
||||
__ops_rsa_create_selfsigned_keypair(const int numbits, const unsigned long e, __ops_user_id_t * userid)
|
||||
__ops_rsa_create_selfsigned_keypair(const int numbits,
|
||||
const unsigned long e,
|
||||
__ops_user_id_t *userid)
|
||||
{
|
||||
__ops_keydata_t *keydata = NULL;
|
||||
|
||||
keydata = __ops_keydata_new();
|
||||
|
||||
if (__ops_rsa_generate_keypair(numbits, e, keydata) != true
|
||||
|| __ops_add_selfsigned_userid_to_keydata(keydata, userid) != true) {
|
||||
if (__ops_rsa_generate_keypair(numbits, e, keydata) != true ||
|
||||
__ops_add_selfsigned_userid_to_keydata(keydata, userid) != true) {
|
||||
__ops_keydata_free(keydata);
|
||||
return NULL;
|
||||
}
|
||||
return keydata;
|
||||
}
|
||||
|
||||
/*
|
||||
int __ops_dsa_size(const __ops_dsa_pubkey_t *dsa)
|
||||
{
|
||||
int size;
|
||||
DSA *odsa;
|
||||
odsa=DSA_new();
|
||||
odsa->p=dsa->p;
|
||||
odsa->q=dsa->q;
|
||||
odsa->g=dsa->g;
|
||||
odsa->pub_key=dsa->y;
|
||||
|
||||
DSAparams_print_fp(stderr, odsa);
|
||||
size=DSA_size(odsa);
|
||||
|
||||
odsa->p=odsa->q=odsa->g=odsa->pub_key=odsa->priv_key=NULL;
|
||||
DSA_free(odsa);
|
||||
|
||||
return size;
|
||||
}
|
||||
*/
|
||||
|
||||
DSA_SIG *
|
||||
__ops_dsa_sign(unsigned char *hashbuf, unsigned hashsize, const __ops_dsa_seckey_t * sdsa, const __ops_dsa_pubkey_t * dsa)
|
||||
__ops_dsa_sign(unsigned char *hashbuf,
|
||||
unsigned hashsize,
|
||||
const __ops_dsa_seckey_t *sdsa,
|
||||
const __ops_dsa_pubkey_t *dsa)
|
||||
{
|
||||
DSA *odsa;
|
||||
DSA_SIG *dsasig;
|
||||
DSA *odsa;
|
||||
|
||||
odsa = DSA_new();
|
||||
odsa->p = dsa->p;
|
||||
|
|
|
@ -1028,7 +1028,7 @@ armoured_data_reader(void *dest_, size_t length, __ops_error_t ** errors,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(buf, "BEGIN PGP SIGNED MESSAGE")) {
|
||||
if (strcmp(buf, "BEGIN PGP SIGNED MESSAGE") == 0) {
|
||||
__ops_dup_headers(&content.u.signed_cleartext_header.headers, &dearmour->headers);
|
||||
CALLBACK(cbinfo, OPS_PTAG_CT_SIGNED_CLEARTEXT_HEADER, &content);
|
||||
ret = process_dash_escaped(dearmour, errors, rinfo, cbinfo);
|
||||
|
@ -1794,7 +1794,8 @@ __ops_teardown_memory_read(__ops_parse_info_t * pinfo, __ops_memory_t * mem)
|
|||
\sa __ops_teardown_file_write()
|
||||
*/
|
||||
int
|
||||
__ops_setup_file_write(__ops_create_info_t ** cinfo, const char *filename, bool allow_overwrite)
|
||||
__ops_setup_file_write(__ops_create_info_t **cinfo, const char *filename,
|
||||
bool allow_overwrite)
|
||||
{
|
||||
int fd = 0;
|
||||
int flags = 0;
|
||||
|
@ -1802,26 +1803,26 @@ __ops_setup_file_write(__ops_create_info_t ** cinfo, const char *filename, bool
|
|||
/*
|
||||
* initialise needed structures for writing to file
|
||||
*/
|
||||
|
||||
flags = O_WRONLY | O_CREAT;
|
||||
if (allow_overwrite == true)
|
||||
flags |= O_TRUNC;
|
||||
else
|
||||
flags |= O_EXCL;
|
||||
|
||||
if (filename == NULL) {
|
||||
/* write to stdout */
|
||||
fd = STDOUT_FILENO;
|
||||
} else {
|
||||
flags = O_WRONLY | O_CREAT;
|
||||
if (allow_overwrite == true)
|
||||
flags |= O_TRUNC;
|
||||
else
|
||||
flags |= O_EXCL;
|
||||
#ifdef O_BINARY
|
||||
flags |= O_BINARY;
|
||||
flags |= O_BINARY;
|
||||
#endif
|
||||
|
||||
fd = open(filename, flags, 0600);
|
||||
if (fd < 0) {
|
||||
perror(filename);
|
||||
return fd;
|
||||
fd = open(filename, flags, 0600);
|
||||
if (fd < 0) {
|
||||
perror(filename);
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
*cinfo = __ops_create_info_new();
|
||||
|
||||
__ops_writer_set_fd(*cinfo, fd);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@
|
|||
* needed for signature creation
|
||||
*/
|
||||
struct __ops_create_sig {
|
||||
__ops_hash_t hash;
|
||||
__ops_sig_t sig;
|
||||
__ops_memory_t *mem;
|
||||
__ops_create_info_t *info;/* !< how to do the writing */
|
||||
unsigned hashed_count_offset;
|
||||
unsigned hashed_data_length;
|
||||
unsigned unhashed_count_offset;
|
||||
__ops_hash_t hash;
|
||||
__ops_sig_t sig;
|
||||
__ops_memory_t *mem;
|
||||
__ops_create_info_t *info;/* !< how to do the writing */
|
||||
unsigned hashed_count_offset;
|
||||
unsigned hashed_data_length;
|
||||
unsigned unhashed_count_offset;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ struct __ops_create_sig {
|
|||
\sa __ops_create_sig_delete()
|
||||
*/
|
||||
__ops_create_sig_t *
|
||||
__ops_create_sig_new()
|
||||
__ops_create_sig_new(void)
|
||||
{
|
||||
return calloc(1, sizeof(__ops_create_sig_t));
|
||||
}
|
||||
|
@ -81,23 +81,27 @@ __ops_create_sig_new()
|
|||
\sa __ops_create_sig_new()
|
||||
*/
|
||||
void
|
||||
__ops_create_sig_delete(__ops_create_sig_t * sig)
|
||||
__ops_create_sig_delete(__ops_create_sig_t *sig)
|
||||
{
|
||||
__ops_create_info_delete(sig->info);
|
||||
sig->info = NULL;
|
||||
free(sig);
|
||||
}
|
||||
|
||||
static unsigned char prefix_md5[] = {0x30, 0x20, 0x30, 0x0C, 0x06,
|
||||
0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05,
|
||||
0x00, 0x04, 0x10};
|
||||
static unsigned char prefix_md5[] = {
|
||||
0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10
|
||||
};
|
||||
|
||||
static unsigned char prefix_sha1[] = {0x30, 0x21, 0x30, 0x09, 0x06,
|
||||
0x05, 0x2b, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14};
|
||||
static unsigned char prefix_sha1[] = {
|
||||
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0E, 0x03, 0x02,
|
||||
0x1A, 0x05, 0x00, 0x04, 0x14
|
||||
};
|
||||
|
||||
static unsigned char prefix_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06,
|
||||
0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01,
|
||||
0x05, 0x00, 0x04, 0x20};
|
||||
static unsigned char prefix_sha256[] = {
|
||||
0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
|
||||
0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
||||
};
|
||||
|
||||
#if 0
|
||||
/**
|
||||
|
@ -110,22 +114,23 @@ static unsigned char prefix_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06,
|
|||
\return true if OK; else false
|
||||
*/
|
||||
static bool
|
||||
encode_hash_buf(const unsigned char *M, size_t mLen,
|
||||
encode_hash_buf(const unsigned char *M,
|
||||
size_t mLen,
|
||||
const __ops_hash_algorithm_t hash_alg,
|
||||
unsigned char *EM)
|
||||
{
|
||||
/* implementation of EMSA-PKCS1-v1_5, as defined in OpenPGP RFC */
|
||||
|
||||
unsigned char *prefix = NULL;
|
||||
unsigned i;
|
||||
|
||||
int n = 0;
|
||||
__ops_hash_t hash;
|
||||
__ops_hash_t hash;
|
||||
int hash_sz = 0;
|
||||
int encoded_hash_sz = 0;
|
||||
int prefix_sz = 0;
|
||||
unsigned padding_sz = 0;
|
||||
unsigned encoded_msg_sz = 0;
|
||||
unsigned char *prefix = NULL;
|
||||
|
||||
if (hash_alg != OPS_HASH_SHA1) {
|
||||
(void) fprintf(stderr, "encode_hash_buf: bad hash alg\n");
|
||||
|
@ -196,10 +201,11 @@ encode_hash_buf(const unsigned char *M, size_t mLen,
|
|||
|
||||
/* XXX: both this and verify would be clearer if the signature were */
|
||||
/* treated as an MPI. */
|
||||
static void
|
||||
rsa_sign(__ops_hash_t * hash, const __ops_rsa_pubkey_t * rsa,
|
||||
const __ops_rsa_seckey_t * srsa,
|
||||
__ops_create_info_t * opt)
|
||||
static int
|
||||
rsa_sign(__ops_hash_t *hash,
|
||||
const __ops_rsa_pubkey_t *pubrsa,
|
||||
const __ops_rsa_seckey_t *secrsa,
|
||||
__ops_create_info_t *opt)
|
||||
{
|
||||
unsigned char hashbuf[NETPGP_BUFSIZ];
|
||||
unsigned char sigbuf[NETPGP_BUFSIZ];
|
||||
|
@ -212,14 +218,14 @@ rsa_sign(__ops_hash_t * hash, const __ops_rsa_pubkey_t * rsa,
|
|||
/* XXX: we assume hash is sha-1 for now */
|
||||
hashsize = 20 + sizeof(prefix_sha1);
|
||||
|
||||
keysize = (BN_num_bits(rsa->n) + 7) / 8;
|
||||
keysize = (BN_num_bits(pubrsa->n) + 7) / 8;
|
||||
if (keysize > sizeof(hashbuf)) {
|
||||
(void) fprintf(stderr, "rsa_sign: keysize too big\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (10 + hashsize > keysize) {
|
||||
(void) fprintf(stderr, "rsa_sign: hashsize too big\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
hashbuf[0] = 0;
|
||||
|
@ -238,7 +244,7 @@ rsa_sign(__ops_hash_t * hash, const __ops_rsa_pubkey_t * rsa,
|
|||
t = hash->finish(hash, &hashbuf[n]);
|
||||
if (t != 20) {
|
||||
(void) fprintf(stderr, "rsa_sign: hashfinish not 20\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__ops_write(&hashbuf[n], 2, opt);
|
||||
|
@ -246,16 +252,17 @@ rsa_sign(__ops_hash_t * hash, const __ops_rsa_pubkey_t * rsa,
|
|||
n += t;
|
||||
if (n != keysize) {
|
||||
(void) fprintf(stderr, "rsa_sign: n != keysize\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
t = __ops_rsa_private_encrypt(sigbuf, hashbuf, keysize, srsa, rsa);
|
||||
t = __ops_rsa_private_encrypt(sigbuf, hashbuf, keysize, secrsa, pubrsa);
|
||||
bn = BN_bin2bn(sigbuf, (int)t, NULL);
|
||||
__ops_write_mpi(bn, opt);
|
||||
BN_free(bn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
dsa_sign(__ops_hash_t * hash,
|
||||
const __ops_dsa_pubkey_t * dsa,
|
||||
const __ops_dsa_seckey_t * sdsa,
|
||||
|
@ -276,7 +283,7 @@ dsa_sign(__ops_hash_t * hash,
|
|||
t = hash->finish(hash, &hashbuf[0]);
|
||||
if (t != 20) {
|
||||
(void) fprintf(stderr, "dsa_sign: hashfinish not 20\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__ops_write(&hashbuf[0], 2, cinfo);
|
||||
|
@ -288,6 +295,7 @@ dsa_sign(__ops_hash_t * hash,
|
|||
__ops_write_mpi(dsasig->r, cinfo);
|
||||
__ops_write_mpi(dsasig->s, cinfo);
|
||||
DSA_SIG_free(dsasig);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -295,7 +303,7 @@ rsa_verify(__ops_hash_algorithm_t type,
|
|||
const unsigned char *hash,
|
||||
size_t hash_length,
|
||||
const __ops_rsa_sig_t * sig,
|
||||
const __ops_rsa_pubkey_t * rsa)
|
||||
const __ops_rsa_pubkey_t * pubrsa)
|
||||
{
|
||||
const unsigned char *prefix;
|
||||
unsigned char sigbuf[NETPGP_BUFSIZ];
|
||||
|
@ -307,7 +315,7 @@ rsa_verify(__ops_hash_algorithm_t type,
|
|||
|
||||
plen = 0;
|
||||
prefix = (const unsigned char *) "";
|
||||
keysize = BN_num_bytes(rsa->n);
|
||||
keysize = BN_num_bytes(pubrsa->n);
|
||||
/* RSA key can't be bigger than 65535 bits, so... */
|
||||
if (keysize > sizeof(hashbuf_from_sig)) {
|
||||
(void) fprintf(stderr, "rsa_verify: keysize too big\n");
|
||||
|
@ -320,7 +328,7 @@ rsa_verify(__ops_hash_algorithm_t type,
|
|||
BN_bn2bin(sig->sig, sigbuf);
|
||||
|
||||
n = __ops_rsa_public_decrypt(hashbuf_from_sig, sigbuf,
|
||||
(unsigned)(BN_num_bits(sig->sig) + 7) / 8, rsa);
|
||||
(unsigned)(BN_num_bits(sig->sig) + 7) / 8, pubrsa);
|
||||
debug_len_decrypted = n;
|
||||
|
||||
if (n != keysize) /* obviously, this includes error returns */
|
||||
|
@ -526,10 +534,10 @@ finalise_sig(__ops_hash_t * hash,
|
|||
*/
|
||||
bool
|
||||
__ops_check_useridcert_sig(const __ops_pubkey_t * key,
|
||||
const __ops_user_id_t * id,
|
||||
const __ops_sig_t * sig,
|
||||
const __ops_pubkey_t * signer,
|
||||
const unsigned char *raw_packet)
|
||||
const __ops_user_id_t * id,
|
||||
const __ops_sig_t * sig,
|
||||
const __ops_pubkey_t * signer,
|
||||
const unsigned char *raw_packet)
|
||||
{
|
||||
__ops_hash_t hash;
|
||||
size_t user_id_len = strlen((char *) id->user_id);
|
||||
|
@ -717,18 +725,17 @@ __ops_sig_start_key_sig(__ops_create_sig_t * sig,
|
|||
* \todo Expand description. Allow other hashes.
|
||||
*/
|
||||
|
||||
static void
|
||||
__ops_sig_start_sig(__ops_create_sig_t * sig,
|
||||
const __ops_seckey_t * key,
|
||||
const __ops_hash_algorithm_t hash,
|
||||
const __ops_sig_type_t type)
|
||||
void
|
||||
__ops_start_sig(__ops_create_sig_t *sig,
|
||||
const __ops_seckey_t *key,
|
||||
const __ops_hash_algorithm_t hash,
|
||||
const __ops_sig_type_t type)
|
||||
{
|
||||
sig->info = __ops_create_info_new();
|
||||
|
||||
/* XXX: refactor with check (in several ways - check should probably */
|
||||
/*
|
||||
* use the buffered writer to construct packets (done), and
|
||||
* also should share code for hash calculation) */
|
||||
/* XXX: refactor with check (in several ways - check should
|
||||
* probably use the buffered writer to construct packets
|
||||
* (done), and also should share code for hash calculation) */
|
||||
sig->sig.info.version = OPS_V4;
|
||||
sig->sig.info.key_algorithm = key->pubkey.algorithm;
|
||||
sig->sig.info.hash_algorithm = hash;
|
||||
|
@ -743,32 +750,6 @@ __ops_sig_start_sig(__ops_create_sig_t * sig,
|
|||
start_sig_in_mem(sig);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup Core_Signature
|
||||
* \brief Setup to start a cleartext's signature
|
||||
*/
|
||||
void
|
||||
__ops_start_cleartext_sig(__ops_create_sig_t * sig,
|
||||
const __ops_seckey_t * key,
|
||||
const __ops_hash_algorithm_t hash,
|
||||
const __ops_sig_type_t type)
|
||||
{
|
||||
__ops_sig_start_sig(sig, key, hash, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup Core_Signature
|
||||
* \brief Setup to start a message's signature
|
||||
*/
|
||||
void
|
||||
__ops_start_msg_sig(__ops_create_sig_t * sig,
|
||||
const __ops_seckey_t * key,
|
||||
const __ops_hash_algorithm_t hash,
|
||||
const __ops_sig_type_t type)
|
||||
{
|
||||
__ops_sig_start_sig(sig, key, hash, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup Core_Signature
|
||||
*
|
||||
|
@ -881,7 +862,8 @@ __ops_write_sig(__ops_create_sig_t * sig,
|
|||
__ops_hash_add_int(&sig->hash, sig->hashed_data_length + 6, 4);
|
||||
|
||||
if (__ops_get_debug_level(__FILE__)) {
|
||||
fprintf(stderr, "--- Finished adding packet to hash from version number to hashed subpkts\n");
|
||||
(void) fprintf(stderr,
|
||||
"--- Finished adding packet to hash from version number to hashed subpkts\n");
|
||||
}
|
||||
/* XXX: technically, we could figure out how big the signature is */
|
||||
/* and write it directly to the output instead of via memory. */
|
||||
|
@ -889,11 +871,21 @@ __ops_write_sig(__ops_create_sig_t * sig,
|
|||
case OPS_PKA_RSA:
|
||||
case OPS_PKA_RSA_ENCRYPT_ONLY:
|
||||
case OPS_PKA_RSA_SIGN_ONLY:
|
||||
rsa_sign(&sig->hash, &key->key.rsa, &seckey->key.rsa, sig->info);
|
||||
if (!rsa_sign(&sig->hash, &key->key.rsa, &seckey->key.rsa,
|
||||
sig->info)) {
|
||||
(void) fprintf(stderr,
|
||||
"__ops_write_sig: rsa_sign failure\n");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPS_PKA_DSA:
|
||||
dsa_sign(&sig->hash, &key->key.dsa, &seckey->key.dsa, sig->info);
|
||||
if (!dsa_sign(&sig->hash, &key->key.dsa, &seckey->key.dsa,
|
||||
sig->info)) {
|
||||
(void) fprintf(stderr,
|
||||
"__ops_write_sig: dsa_sign failure\n");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -927,8 +919,9 @@ __ops_write_sig(__ops_create_sig_t * sig,
|
|||
bool
|
||||
__ops_sig_add_birthtime(__ops_create_sig_t * sig, time_t when)
|
||||
{
|
||||
return __ops_write_ss_header(5, OPS_PTAG_SS_CREATION_TIME, sig->info)
|
||||
&& __ops_write_scalar((unsigned)when, 4, sig->info);
|
||||
return __ops_write_ss_header(5, OPS_PTAG_SS_CREATION_TIME,
|
||||
sig->info) &&
|
||||
__ops_write_scalar((unsigned)when, 4, sig->info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1067,8 +1060,7 @@ __ops_sign_file_as_cleartext(const char *input_filename,
|
|||
return false;
|
||||
}
|
||||
/* \todo could add more error detection here */
|
||||
__ops_start_cleartext_sig(sig, seckey, OPS_HASH_SHA1,
|
||||
OPS_SIG_BINARY);
|
||||
__ops_start_sig(sig, seckey, OPS_HASH_SHA1, OPS_SIG_BINARY);
|
||||
if (__ops_writer_push_clearsigned(cinfo, sig) != true) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1155,7 +1147,7 @@ __ops_sign_buf_as_cleartext(const char *cleartext,
|
|||
return false;
|
||||
}
|
||||
/* \todo could add more error detection here */
|
||||
__ops_start_cleartext_sig(sig, seckey, OPS_HASH_SHA1, OPS_SIG_BINARY);
|
||||
__ops_start_sig(sig, seckey, OPS_HASH_SHA1, OPS_SIG_BINARY);
|
||||
|
||||
/* set up output file */
|
||||
__ops_setup_memory_write(&cinfo, signed_cleartext, len);
|
||||
|
@ -1229,7 +1221,7 @@ __ops_sign_file(const char *input_filename, const char *output_filename, const _
|
|||
|
||||
/* set up signature */
|
||||
sig = __ops_create_sig_new();
|
||||
__ops_start_msg_sig(sig, seckey, hash_alg, sig_type);
|
||||
__ops_start_sig(sig, seckey, hash_alg, sig_type);
|
||||
|
||||
/* set armoured/not armoured here */
|
||||
if (use_armour) {
|
||||
|
@ -1320,7 +1312,7 @@ __ops_sign_buf(const void *input,
|
|||
|
||||
/* set up signature */
|
||||
sig = __ops_create_sig_new();
|
||||
__ops_start_msg_sig(sig, seckey, hash_alg, sig_type);
|
||||
__ops_start_sig(sig, seckey, hash_alg, sig_type);
|
||||
|
||||
/* setup writer */
|
||||
__ops_setup_memory_write(&cinfo, &mem, input_len);
|
||||
|
|
|
@ -66,15 +66,10 @@ __ops_sig_start_key_sig(__ops_create_sig_t *,
|
|||
const __ops_user_id_t *,
|
||||
__ops_sig_type_t);
|
||||
void
|
||||
__ops_start_cleartext_sig(__ops_create_sig_t *,
|
||||
__ops_start_sig(__ops_create_sig_t *,
|
||||
const __ops_seckey_t *,
|
||||
const __ops_hash_algorithm_t,
|
||||
const __ops_sig_type_t);
|
||||
void
|
||||
__ops_start_msg_sig(__ops_create_sig_t *,
|
||||
const __ops_seckey_t *,
|
||||
const __ops_hash_algorithm_t,
|
||||
const __ops_sig_type_t);
|
||||
|
||||
void
|
||||
__ops_sig_add_data(__ops_create_sig_t *, const void *, size_t);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#endif
|
||||
|
||||
/* development versions have .99 suffix */
|
||||
#define NETPGP_BASE_VERSION "0.99.1"
|
||||
#define NETPGP_BASE_VERSION "0.99.2"
|
||||
|
||||
#define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]"
|
||||
#define NETPGP_VERSION_STRING \
|
||||
|
|
Loading…
Reference in New Issue