CHANGES 1.99.1 -> 1.99.2 + various minor cleanups + fix longstanding pasto where the key server preference packets are displayed with the correct ptag information + up until now, there has been an asymmetry in the command line options for netpgp(1) - whilst a file may have signature information added to it with the "--sign" command, there has been no way to retrieve the contents of the file without the signature. The new "--cat" option does this (there are synonyms of "--verify-show" and "--verify-cat") - the signature is verified, and if it matches, the original contents of the file are sent to the output file (which defaults to stdout, and can be set with the --output option on the command line). If the signature does not match, there is no output, and an EXIT_FAILURE code is returned. + revamped netpgp(1) to make it clear what commands are available, how these commands relate to each other, and which commands take custom optionsdiff -r1.8 -r1.9 src/crypto/external/bsd/netpgp/dist/TODO
(agc)
--- src/crypto/external/bsd/netpgp/dist/TODO 2009/05/19 05:13:09 1.8
+++ src/crypto/external/bsd/netpgp/dist/TODO 2009/05/21 00:33:31 1.9
@@ -1,17 +1,18 @@ | @@ -1,17 +1,18 @@ | |||
1 | To Do | 1 | To Do | |
2 | ===== | 2 | ===== | |
3 | 64-bit offsets | 3 | separate verify program | |
4 | separate from libcrypto? | 4 | separate from libcrypto? | |
5 | 64-bit offsets | |||
5 | need a netpgp_set_{pub,sec}key()? vs _init()? | 6 | need a netpgp_set_{pub,sec}key()? vs _init()? | |
6 | default compression when signing? | 7 | default compression when signing? | |
7 | get rid of ops_memory after used literal_data_body | 8 | get rid of ops_memory after used literal_data_body | |
8 | sort out callback - ops_export_key, packet-parse callback etc | 9 | sort out callback - ops_export_key, packet-parse callback etc | |
9 | Simplify IO | 10 | Simplify IO | |
10 | Make into SHA1Init, SHA1End, SHA1File style of calls | 11 | Make into SHA1Init, SHA1End, SHA1File style of calls | |
11 | Multiple recipients for encryption | 12 | Multiple recipients for encryption | |
12 | 13 | |||
13 | Done | 14 | Done | |
14 | ==== | 15 | ==== | |
15 | autoconf | 16 | autoconf | |
16 | libtool | 17 | libtool | |
17 | name change | 18 | name change | |
@@ -44,13 +45,14 @@ Install man pages | @@ -44,13 +45,14 @@ Install man pages | |||
44 | WARNS=4 (again) | 45 | WARNS=4 (again) | |
45 | detached sig | 46 | detached sig | |
46 | get rid of assert()s | 47 | get rid of assert()s | |
47 | disable core dumps | 48 | disable core dumps | |
48 | add a --help option | 49 | add a --help option | |
49 | sha256 digests | 50 | sha256 digests | |
50 | print out size of key in --list-keys | 51 | print out size of key in --list-keys | |
51 | decryption - print encrypted key info | 52 | decryption - print encrypted key info | |
52 | get rid of local files | 53 | get rid of local files | |
53 | hash algorithm selection | 54 | hash algorithm selection | |
54 | detached verification | 55 | detached verification | |
55 | RCS Ids | 56 | RCS Ids | |
56 | Look at inefficiencies - read() etc | 57 | Look at inefficiencies - read() etc | |
58 | cat command to display a verified file without signature |
--- src/crypto/external/bsd/netpgp/dist/configure 2009/05/19 05:13:09 1.8
+++ src/crypto/external/bsd/netpgp/dist/configure 2009/05/21 00:33:31 1.9
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh | |
2 | # Guess values for system-dependent variables and create Makefiles. | 2 | # Guess values for system-dependent variables and create Makefiles. | |
3 | # Generated by GNU Autoconf 2.63 for netpgp 20090518. | 3 | # Generated by GNU Autoconf 2.63 for netpgp 20090520. | |
4 | # | 4 | # | |
5 | # Report bugs to <Alistair Crooks <agc@netbsd.org> c0596823>. | 5 | # Report bugs to <Alistair Crooks <agc@netbsd.org> c0596823>. | |
6 | # | 6 | # | |
7 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 7 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | |
8 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 8 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | |
9 | # This configure script is free software; the Free Software Foundation | 9 | # This configure script is free software; the Free Software Foundation | |
10 | # gives unlimited permission to copy, distribute and modify it. | 10 | # gives unlimited permission to copy, distribute and modify it. | |
11 | ## --------------------- ## | 11 | ## --------------------- ## | |
12 | ## M4sh Initialization. ## | 12 | ## M4sh Initialization. ## | |
13 | ## --------------------- ## | 13 | ## --------------------- ## | |
14 | 14 | |||
15 | # Be more Bourne compatible | 15 | # Be more Bourne compatible | |
16 | DUALCASE=1; export DUALCASE # for MKS sh | 16 | DUALCASE=1; export DUALCASE # for MKS sh | |
@@ -586,28 +586,28 @@ ac_hostname=`(hostname || uname -n) 2>/d | @@ -586,28 +586,28 @@ ac_hostname=`(hostname || uname -n) 2>/d | |||
586 | ac_default_prefix=/usr/local | 586 | ac_default_prefix=/usr/local | |
587 | ac_clean_files= | 587 | ac_clean_files= | |
588 | ac_config_libobj_dir=. | 588 | ac_config_libobj_dir=. | |
589 | LIBOBJS= | 589 | LIBOBJS= | |
590 | cross_compiling=no | 590 | cross_compiling=no | |
591 | subdirs= | 591 | subdirs= | |
592 | MFLAGS= | 592 | MFLAGS= | |
593 | MAKEFLAGS= | 593 | MAKEFLAGS= | |
594 | SHELL=${CONFIG_SHELL-/bin/sh} | 594 | SHELL=${CONFIG_SHELL-/bin/sh} | |
595 | 595 | |||
596 | # Identity of this package. | 596 | # Identity of this package. | |
597 | PACKAGE_NAME='netpgp' | 597 | PACKAGE_NAME='netpgp' | |
598 | PACKAGE_TARNAME='netpgp' | 598 | PACKAGE_TARNAME='netpgp' | |
599 | PACKAGE_VERSION='20090518' | 599 | PACKAGE_VERSION='20090520' | |
600 | PACKAGE_STRING='netpgp 20090518' | 600 | PACKAGE_STRING='netpgp 20090520' | |
601 | PACKAGE_BUGREPORT='Alistair Crooks <agc@netbsd.org> c0596823' | 601 | PACKAGE_BUGREPORT='Alistair Crooks <agc@netbsd.org> c0596823' | |
602 | 602 | |||
603 | ac_unique_file="src/bin/netpgp.c" | 603 | ac_unique_file="src/bin/netpgp.c" | |
604 | # Factoring default headers for most tests. | 604 | # Factoring default headers for most tests. | |
605 | ac_includes_default="\ | 605 | ac_includes_default="\ | |
606 | #include <stdio.h> | 606 | #include <stdio.h> | |
607 | #ifdef HAVE_SYS_TYPES_H | 607 | #ifdef HAVE_SYS_TYPES_H | |
608 | # include <sys/types.h> | 608 | # include <sys/types.h> | |
609 | #endif | 609 | #endif | |
610 | #ifdef HAVE_SYS_STAT_H | 610 | #ifdef HAVE_SYS_STAT_H | |
611 | # include <sys/stat.h> | 611 | # include <sys/stat.h> | |
612 | #endif | 612 | #endif | |
613 | #ifdef STDC_HEADERS | 613 | #ifdef STDC_HEADERS | |
@@ -1258,27 +1258,27 @@ for ac_var in $ac_precious_vars; do | @@ -1258,27 +1258,27 @@ for ac_var in $ac_precious_vars; do | |||
1258 | eval ac_env_${ac_var}_set=\${${ac_var}+set} | 1258 | eval ac_env_${ac_var}_set=\${${ac_var}+set} | |
1259 | eval ac_env_${ac_var}_value=\$${ac_var} | 1259 | eval ac_env_${ac_var}_value=\$${ac_var} | |
1260 | eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} | 1260 | eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} | |
1261 | eval ac_cv_env_${ac_var}_value=\$${ac_var} | 1261 | eval ac_cv_env_${ac_var}_value=\$${ac_var} | |
1262 | done | 1262 | done | |
1263 | 1263 | |||
1264 | # | 1264 | # | |
1265 | # Report the --help message. | 1265 | # Report the --help message. | |
1266 | # | 1266 | # | |
1267 | if test "$ac_init_help" = "long"; then | 1267 | if test "$ac_init_help" = "long"; then | |
1268 | # Omit some internal or obsolete options to make the list less imposing. | 1268 | # Omit some internal or obsolete options to make the list less imposing. | |
1269 | # This message is too long to be a string in the A/UX 3.1 sh. | 1269 | # This message is too long to be a string in the A/UX 3.1 sh. | |
1270 | cat <<_ACEOF | 1270 | cat <<_ACEOF | |
1271 | \`configure' configures netpgp 20090518 to adapt to many kinds of systems. | 1271 | \`configure' configures netpgp 20090520 to adapt to many kinds of systems. | |
1272 | 1272 | |||
1273 | Usage: $0 [OPTION]... [VAR=VALUE]... | 1273 | Usage: $0 [OPTION]... [VAR=VALUE]... | |
1274 | 1274 | |||
1275 | To assign environment variables (e.g., CC, CFLAGS...), specify them as | 1275 | To assign environment variables (e.g., CC, CFLAGS...), specify them as | |
1276 | VAR=VALUE. See below for descriptions of some of the useful variables. | 1276 | VAR=VALUE. See below for descriptions of some of the useful variables. | |
1277 | 1277 | |||
1278 | Defaults for the options are specified in brackets. | 1278 | Defaults for the options are specified in brackets. | |
1279 | 1279 | |||
1280 | Configuration: | 1280 | Configuration: | |
1281 | -h, --help display this help and exit | 1281 | -h, --help display this help and exit | |
1282 | --help=short display options specific to this package | 1282 | --help=short display options specific to this package | |
1283 | --help=recursive display the short help of all the included packages | 1283 | --help=recursive display the short help of all the included packages | |
1284 | -V, --version display version information and exit | 1284 | -V, --version display version information and exit | |
@@ -1328,27 +1328,27 @@ _ACEOF | @@ -1328,27 +1328,27 @@ _ACEOF | |||
1328 | Program names: | 1328 | Program names: | |
1329 | --program-prefix=PREFIX prepend PREFIX to installed program names | 1329 | --program-prefix=PREFIX prepend PREFIX to installed program names | |
1330 | --program-suffix=SUFFIX append SUFFIX to installed program names | 1330 | --program-suffix=SUFFIX append SUFFIX to installed program names | |
1331 | --program-transform-name=PROGRAM run sed PROGRAM on installed program names | 1331 | --program-transform-name=PROGRAM run sed PROGRAM on installed program names | |
1332 | 1332 | |||
1333 | System types: | 1333 | System types: | |
1334 | --build=BUILD configure for building on BUILD [guessed] | 1334 | --build=BUILD configure for building on BUILD [guessed] | |
1335 | --host=HOST cross-compile to build programs to run on HOST [BUILD] | 1335 | --host=HOST cross-compile to build programs to run on HOST [BUILD] | |
1336 | _ACEOF | 1336 | _ACEOF | |
1337 | fi | 1337 | fi | |
1338 | 1338 | |||
1339 | if test -n "$ac_init_help"; then | 1339 | if test -n "$ac_init_help"; then | |
1340 | case $ac_init_help in | 1340 | case $ac_init_help in | |
1341 | short | recursive ) echo "Configuration of netpgp 20090518:";; | 1341 | short | recursive ) echo "Configuration of netpgp 20090520:";; | |
1342 | esac | 1342 | esac | |
1343 | cat <<\_ACEOF | 1343 | cat <<\_ACEOF | |
1344 | 1344 | |||
1345 | Some influential environment variables: | 1345 | Some influential environment variables: | |
1346 | CC C compiler command | 1346 | CC C compiler command | |
1347 | CFLAGS C compiler flags | 1347 | CFLAGS C compiler flags | |
1348 | LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a | 1348 | LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a | |
1349 | nonstandard directory <lib dir> | 1349 | nonstandard directory <lib dir> | |
1350 | LIBS libraries to pass to the linker, e.g. -l<library> | 1350 | LIBS libraries to pass to the linker, e.g. -l<library> | |
1351 | CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if | 1351 | CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if | |
1352 | you have headers in a nonstandard directory <include dir> | 1352 | you have headers in a nonstandard directory <include dir> | |
1353 | CPP C preprocessor | 1353 | CPP C preprocessor | |
1354 | 1354 | |||
@@ -1408,41 +1408,41 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_ | @@ -1408,41 +1408,41 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_ | |||
1408 | elif test -f "$ac_srcdir/configure"; then | 1408 | elif test -f "$ac_srcdir/configure"; then | |
1409 | echo && | 1409 | echo && | |
1410 | $SHELL "$ac_srcdir/configure" --help=recursive | 1410 | $SHELL "$ac_srcdir/configure" --help=recursive | |
1411 | else | 1411 | else | |
1412 | $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 | 1412 | $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 | |
1413 | fi || ac_status=$? | 1413 | fi || ac_status=$? | |
1414 | cd "$ac_pwd" || { ac_status=$?; break; } | 1414 | cd "$ac_pwd" || { ac_status=$?; break; } | |
1415 | done | 1415 | done | |
1416 | fi | 1416 | fi | |
1417 | 1417 | |||
1418 | test -n "$ac_init_help" && exit $ac_status | 1418 | test -n "$ac_init_help" && exit $ac_status | |
1419 | if $ac_init_version; then | 1419 | if $ac_init_version; then | |
1420 | cat <<\_ACEOF | 1420 | cat <<\_ACEOF | |
1421 | netpgp configure 20090518 | 1421 | netpgp configure 20090520 | |
1422 | generated by GNU Autoconf 2.63 | 1422 | generated by GNU Autoconf 2.63 | |
1423 | 1423 | |||
1424 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | 1424 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | |
1425 | 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 1425 | 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | |
1426 | This configure script is free software; the Free Software Foundation | 1426 | This configure script is free software; the Free Software Foundation | |
1427 | gives unlimited permission to copy, distribute and modify it. | 1427 | gives unlimited permission to copy, distribute and modify it. | |
1428 | _ACEOF | 1428 | _ACEOF | |
1429 | exit | 1429 | exit | |
1430 | fi | 1430 | fi | |
1431 | cat >config.log <<_ACEOF | 1431 | cat >config.log <<_ACEOF | |
1432 | This file contains any messages produced by compilers while | 1432 | This file contains any messages produced by compilers while | |
1433 | running configure, to aid debugging if configure makes a mistake. | 1433 | running configure, to aid debugging if configure makes a mistake. | |
1434 | 1434 | |||
1435 | It was created by netpgp $as_me 20090518, which was | 1435 | It was created by netpgp $as_me 20090520, which was | |
1436 | generated by GNU Autoconf 2.63. Invocation command line was | 1436 | generated by GNU Autoconf 2.63. Invocation command line was | |
1437 | 1437 | |||
1438 | $ $0 $@ | 1438 | $ $0 $@ | |
1439 | 1439 | |||
1440 | _ACEOF | 1440 | _ACEOF | |
1441 | exec 5>>config.log | 1441 | exec 5>>config.log | |
1442 | { | 1442 | { | |
1443 | cat <<_ASUNAME | 1443 | cat <<_ASUNAME | |
1444 | ## --------- ## | 1444 | ## --------- ## | |
1445 | ## Platform. ## | 1445 | ## Platform. ## | |
1446 | ## --------- ## | 1446 | ## --------- ## | |
1447 | 1447 | |||
1448 | hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` | 1448 | hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` | |
@@ -6151,27 +6151,27 @@ as_executable_p=$as_test_x | @@ -6151,27 +6151,27 @@ as_executable_p=$as_test_x | |||
6151 | # Sed expression to map a string onto a valid CPP name. | 6151 | # Sed expression to map a string onto a valid CPP name. | |
6152 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" | 6152 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" | |
6153 | 6153 | |||
6154 | # Sed expression to map a string onto a valid variable name. | 6154 | # Sed expression to map a string onto a valid variable name. | |
6155 | as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" | 6155 | as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" | |
6156 | 6156 | |||
6157 | 6157 | |||
6158 | exec 6>&1 | 6158 | exec 6>&1 | |
6159 | 6159 | |||
6160 | # Save the log message, to keep $[0] and so on meaningful, and to | 6160 | # Save the log message, to keep $[0] and so on meaningful, and to | |
6161 | # report actual input values of CONFIG_FILES etc. instead of their | 6161 | # report actual input values of CONFIG_FILES etc. instead of their | |
6162 | # values after options handling. | 6162 | # values after options handling. | |
6163 | ac_log=" | 6163 | ac_log=" | |
6164 | This file was extended by netpgp $as_me 20090518, which was | 6164 | This file was extended by netpgp $as_me 20090520, which was | |
6165 | generated by GNU Autoconf 2.63. Invocation command line was | 6165 | generated by GNU Autoconf 2.63. Invocation command line was | |
6166 | 6166 | |||
6167 | CONFIG_FILES = $CONFIG_FILES | 6167 | CONFIG_FILES = $CONFIG_FILES | |
6168 | CONFIG_HEADERS = $CONFIG_HEADERS | 6168 | CONFIG_HEADERS = $CONFIG_HEADERS | |
6169 | CONFIG_LINKS = $CONFIG_LINKS | 6169 | CONFIG_LINKS = $CONFIG_LINKS | |
6170 | CONFIG_COMMANDS = $CONFIG_COMMANDS | 6170 | CONFIG_COMMANDS = $CONFIG_COMMANDS | |
6171 | $ $0 $@ | 6171 | $ $0 $@ | |
6172 | 6172 | |||
6173 | on `(hostname || uname -n) 2>/dev/null | sed 1q` | 6173 | on `(hostname || uname -n) 2>/dev/null | sed 1q` | |
6174 | " | 6174 | " | |
6175 | 6175 | |||
6176 | _ACEOF | 6176 | _ACEOF | |
6177 | 6177 | |||
@@ -6210,27 +6210,27 @@ Usage: $0 [OPTION]... [FILE]... | @@ -6210,27 +6210,27 @@ Usage: $0 [OPTION]... [FILE]... | |||
6210 | instantiate the configuration header FILE | 6210 | instantiate the configuration header FILE | |
6211 | 6211 | |||
6212 | Configuration files: | 6212 | Configuration files: | |
6213 | $config_files | 6213 | $config_files | |
6214 | 6214 | |||
6215 | Configuration headers: | 6215 | Configuration headers: | |
6216 | $config_headers | 6216 | $config_headers | |
6217 | 6217 | |||
6218 | Report bugs to <bug-autoconf@gnu.org>." | 6218 | Report bugs to <bug-autoconf@gnu.org>." | |
6219 | 6219 | |||
6220 | _ACEOF | 6220 | _ACEOF | |
6221 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | 6221 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
6222 | ac_cs_version="\\ | 6222 | ac_cs_version="\\ | |
6223 | netpgp config.status 20090518 | 6223 | netpgp config.status 20090520 | |
6224 | configured by $0, generated by GNU Autoconf 2.63, | 6224 | configured by $0, generated by GNU Autoconf 2.63, | |
6225 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" | 6225 | with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" | |
6226 | 6226 | |||
6227 | Copyright (C) 2008 Free Software Foundation, Inc. | 6227 | Copyright (C) 2008 Free Software Foundation, Inc. | |
6228 | This config.status script is free software; the Free Software Foundation | 6228 | This config.status script is free software; the Free Software Foundation | |
6229 | gives unlimited permission to copy, distribute and modify it." | 6229 | gives unlimited permission to copy, distribute and modify it." | |
6230 | 6230 | |||
6231 | ac_pwd='$ac_pwd' | 6231 | ac_pwd='$ac_pwd' | |
6232 | srcdir='$srcdir' | 6232 | srcdir='$srcdir' | |
6233 | INSTALL='$INSTALL' | 6233 | INSTALL='$INSTALL' | |
6234 | AWK='$AWK' | 6234 | AWK='$AWK' | |
6235 | test -n "\$AWK" || AWK=awk | 6235 | test -n "\$AWK" || AWK=awk | |
6236 | _ACEOF | 6236 | _ACEOF |
--- src/crypto/external/bsd/netpgp/dist/configure.ac 2009/05/19 05:13:09 1.8
+++ src/crypto/external/bsd/netpgp/dist/configure.ac 2009/05/21 00:33:31 1.9
@@ -1,17 +1,17 @@ | @@ -1,17 +1,17 @@ | |||
1 | dnl $Id: configure.ac,v 1.8 2009/05/19 05:13:09 agc Exp $ | 1 | dnl $Id: configure.ac,v 1.9 2009/05/21 00:33:31 agc Exp $ | |
2 | dnl Process this file with autoconf to produce a configure script. | 2 | dnl Process this file with autoconf to produce a configure script. | |
3 | AC_PREREQ(2.57) | 3 | AC_PREREQ(2.57) | |
4 | AC_INIT([netpgp],[20090518],[Alistair Crooks <agc@netbsd.org> c0596823]) | 4 | AC_INIT([netpgp],[20090520],[Alistair Crooks <agc@netbsd.org> c0596823]) | |
5 | AC_CONFIG_SRCDIR([src/bin/netpgp.c]) | 5 | AC_CONFIG_SRCDIR([src/bin/netpgp.c]) | |
6 | AC_CONFIG_HEADER(src/lib/config.h) | 6 | AC_CONFIG_HEADER(src/lib/config.h) | |
7 | AC_ARG_PROGRAM | 7 | AC_ARG_PROGRAM | |
8 | 8 | |||
9 | AC_CANONICAL_HOST | 9 | AC_CANONICAL_HOST | |
10 | CANONICAL_HOST=$host | 10 | CANONICAL_HOST=$host | |
11 | AC_SUBST(CANONICAL_HOST) | 11 | AC_SUBST(CANONICAL_HOST) | |
12 | 12 | |||
13 | # Checks for programs. | 13 | # Checks for programs. | |
14 | AC_PROG_MAKE_SET | 14 | AC_PROG_MAKE_SET | |
15 | AC_PROG_AWK | 15 | AC_PROG_AWK | |
16 | AC_PROG_CC | 16 | AC_PROG_CC | |
17 | AC_PROG_INSTALL | 17 | AC_PROG_INSTALL |
--- src/crypto/external/bsd/netpgp/dist/tst 2009/05/18 03:55:42 1.3
+++ src/crypto/external/bsd/netpgp/dist/tst 2009/05/21 00:33:31 1.4
@@ -1,41 +1,47 @@ | @@ -1,41 +1,47 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh | |
2 | 2 | |||
3 | env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../lib && \ | 3 | env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../lib && \ | |
4 | make cleandir ; \ | 4 | make cleandir ; \ | |
5 | make ; \ | 5 | make ; \ | |
6 | su root -c "make install"' | 6 | su root -c "make install"' | |
7 | env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../bin && \ | 7 | env USETOOLS=no MAKEOBJDIRPREFIX=/usr/obj/i386 sh -c 'cd ../bin && \ | |
8 | make cleandir ; \ | 8 | make cleandir ; \ | |
9 | make ; \ | 9 | make ; \ | |
10 | su root -c "make install"' | 10 | su root -c "make install"' | |
11 | echo "======> sign/verify 180938 file" | 11 | echo "======> sign/verify 180938 file" | |
12 | cp configure a | 12 | cp configure a | |
13 | /usr/bin/netpgp --sign a | 13 | /usr/bin/netpgp --sign a | |
14 | /usr/bin/netpgp --verify a.gpg | 14 | /usr/bin/netpgp --verify a.gpg && echo "[Verified OK]" | |
15 | echo "======> attempt to verify an unsigned file" | 15 | echo "======> attempt to verify an unsigned file" | |
16 | /usr/bin/netpgp --verify a | 16 | /usr/bin/netpgp --verify a && echo "[Verified OK]" | |
17 | echo "======> encrypt/decrypt 10809 file" | 17 | echo "======> encrypt/decrypt 10809 file" | |
18 | cp src/bin/netpgp.1 b | 18 | cp src/bin/netpgp.1 b | |
19 | /usr/bin/netpgp --encrypt b | 19 | /usr/bin/netpgp --encrypt b | |
20 | /usr/bin/netpgp --decrypt b.gpg | 20 | /usr/bin/netpgp --decrypt b.gpg | |
21 | diff src/bin/netpgp.1 b && echo "No differences found" | 21 | diff src/bin/netpgp.1 b && echo "[No differences found]" | |
22 | echo "======> encrypt/decrypt 180938 file" | 22 | echo "======> encrypt/decrypt 180938 file" | |
23 | cp configure c | 23 | cp configure c | |
24 | /usr/bin/netpgp --encrypt c | 24 | /usr/bin/netpgp --encrypt c | |
25 | /usr/bin/netpgp --decrypt c.gpg | 25 | /usr/bin/netpgp --decrypt c.gpg | |
26 | diff configure c && echo "No differences found" | 26 | diff configure c && echo "[No differences found]" | |
27 | echo "======> encrypt/decrypt bigass file" | 27 | echo "======> encrypt/decrypt bigass file" | |
28 | cat configure configure configure configure configure configure > d | 28 | cat configure configure configure configure configure configure > d | |
29 | ls -l d | 29 | ls -l d | |
30 | cp d e | 30 | cp d e | |
31 | /usr/bin/netpgp --encrypt d | 31 | /usr/bin/netpgp --encrypt d | |
32 | /usr/bin/netpgp --decrypt d.gpg | 32 | /usr/bin/netpgp --decrypt d.gpg | |
33 | diff e d && echo "No differences found" | 33 | diff e d && echo "[No differences found]" | |
34 | echo "======> sign/verify detached signature file" | 34 | echo "======> sign/verify detached signature file" | |
35 | cat configure configure configure configure configure configure > f | 35 | cat configure configure configure configure configure configure > f | |
36 | /usr/bin/netpgp --sign --detached f | 36 | /usr/bin/netpgp --sign --detached f | |
37 | ls -l f f.sig | 37 | ls -l f f.sig | |
38 | /usr/bin/netpgp --verify f.sig | 38 | /usr/bin/netpgp --verify f.sig && echo "[Verified OK]" | |
39 | echo "======> cat signature - verified cat command" | |||
40 | /usr/bin/netpgp --cat a.gpg > a2 | |||
41 | diff a a2 && echo "[No differences found]" | |||
42 | echo "======> another cat signature - verified cat command" | |||
43 | /usr/bin/netpgp --cat --output=a3 a.gpg | |||
44 | diff a a3 && echo "[No differences found]" | |||
39 | echo "======> version information" | 45 | echo "======> version information" | |
40 | /usr/bin/netpgp --version | 46 | /usr/bin/netpgp --version | |
41 | rm -f a a.gpg b b.gpg c c.gpg d d.gpg e f f.sig | 47 | rm -f a a.gpg b b.gpg c c.gpg d d.gpg e f f.sig a2 a3 |
--- src/crypto/external/bsd/netpgp/dist/src/bin/Attic/netpgp.1 2009/05/16 06:30:38 1.9
+++ src/crypto/external/bsd/netpgp/dist/src/bin/Attic/netpgp.1 2009/05/21 00:33:31 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | .\" $NetBSD: netpgp.1,v 1.9 2009/05/16 06:30:38 agc Exp $ | 1 | .\" $NetBSD: netpgp.1,v 1.10 2009/05/21 00:33:31 agc Exp $ | |
2 | .\" | 2 | .\" | |
3 | .\" Copyright (c) 2009 The NetBSD Foundation, Inc. | 3 | .\" Copyright (c) 2009 The NetBSD Foundation, Inc. | |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. | |
5 | .\" | 5 | .\" | |
6 | .\" This manual page is derived from software contributed to | 6 | .\" This manual page is derived from software contributed to | |
7 | .\" The NetBSD Foundation by Alistair Crooks (agc@NetBSD.org). | 7 | .\" The NetBSD Foundation by Alistair Crooks (agc@NetBSD.org). | |
8 | .\" | 8 | .\" | |
9 | .\" Redistribution and use in source and binary forms, with or without | 9 | .\" Redistribution and use in source and binary forms, with or without | |
10 | .\" modification, are permitted provided that the following conditions | 10 | .\" modification, are permitted provided that the following conditions | |
11 | .\" are met: | 11 | .\" are met: | |
12 | .\" 1. Redistributions of source code must retain the above copyright | 12 | .\" 1. Redistributions of source code must retain the above copyright | |
13 | .\" notice, this list of conditions and the following disclaimer. | 13 | .\" notice, this list of conditions and the following disclaimer. | |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
@@ -17,102 +17,198 @@ | @@ -17,102 +17,198 @@ | |||
17 | .\" | 17 | .\" | |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | 28 | .\" POSSIBILITY OF SUCH DAMAGE. | |
29 | .\" | 29 | .\" | |
30 | .Dd May 15, 2009 | 30 | .Dd May 20, 2009 | |
31 | .Dt NETPGP 1 | 31 | .Dt NETPGP 1 | |
32 | .Os | 32 | .Os | |
33 | .Sh NAME | 33 | .Sh NAME | |
34 | .Nm netpgp | 34 | .Nm netpgp | |
35 | .Nd signing, verification, encryption, and decryption utility | 35 | .Nd signing, verification, encryption, and decryption utility | |
36 | .Sh SYNOPSIS | 36 | .Sh SYNOPSIS | |
37 | .Nm netpgp | 37 | .Nm | |
38 | .Op Fl Fl armour | 38 | .Fl Fl encrypt | |
39 | .Op Fl Fl clearsign | 39 | .Op options | |
40 | .Op Fl Fl decrypt | 40 | .Ar file ... | |
41 | .Op Fl Fl detached | 41 | .Nm | |
42 | .Op Fl Fl encrypt | 42 | .Fl Fl decrypt | |
43 | .Op Fl Fl export-key | 43 | .Op options | |
44 | .Op Fl Fl find-key | 44 | .Ar file ... | |
45 | .Op Fl Fl generate-key | 45 | .sp | |
46 | .Op Fl Fl hash-alg Ns = Ns Ar hash-algorithm | 46 | .Nm | |
47 | .Fl Fl sign | |||
48 | .Op Fl Fl armor | |||
49 | .Op Fl Fl detach | |||
50 | .Op Fl Fl hash Ns = Ns Ar algorithm | |||
51 | .Op options | |||
52 | .Ar file ... | |||
53 | .Nm | |||
54 | .Fl Fl verify | |||
55 | .Op options | |||
56 | .Ar file ... | |||
57 | .Nm | |||
58 | .Fl Fl cat | |||
59 | .Op Fl Fl output Ns = Ns Ar filename | |||
60 | .Op options | |||
61 | .Ar file ... | |||
62 | .Nm | |||
63 | .Fl Fl clearsign | |||
64 | .Op options | |||
65 | .Ar file ... | |||
66 | .sp | |||
67 | .Nm | |||
68 | .Fl Fl export-key , | |||
69 | .Op options | |||
70 | .Ar file ... | |||
71 | .Nm | |||
72 | .Fl Fl find-key | |||
73 | .Op options | |||
74 | .Ar file ... | |||
75 | .Nm | |||
76 | .Fl Fl generate-key | |||
77 | .Op options | |||
78 | .Ar file ... | |||
79 | .Nm | |||
80 | .Fl Fl import-key | |||
81 | .Op options | |||
82 | .Ar file ... | |||
83 | .Nm | |||
84 | .Fl Fl list-keys | |||
85 | .Op options | |||
86 | .Ar file ... | |||
87 | .sp | |||
88 | .Nm | |||
89 | .Fl Fl list-packets | |||
90 | .Nm | |||
91 | .Fl Fl version | |||
92 | .sp | |||
93 | where the options for all commands are: | |||
94 | .sp | |||
47 | .Op Fl Fl homedir Ns = Ns Ar home-directory | 95 | .Op Fl Fl homedir Ns = Ns Ar home-directory | |
48 | .Op Fl Fl import-key | 96 | .br | |
49 | .Op Fl Fl keyring Ns = Ns Ar keyring | 97 | .Op Fl Fl keyring Ns = Ns Ar keyring | |
50 | .Op Fl Fl list-keys | 98 | .br | |
51 | .Op Fl Fl list-packets | |||
52 | .Op Fl Fl numbits Ns = Ns Ar numbits | |||
53 | .Op Fl Fl sign | |||
54 | .Op Fl Fl userid Ns = Ns Ar userid | 99 | .Op Fl Fl userid Ns = Ns Ar userid | |
100 | .br | |||
55 | .Op Fl Fl verbose | 101 | .Op Fl Fl verbose | |
56 | .Op Fl Fl verify | |||
57 | .Op Fl Fl version | |||
58 | .Ar file ... | |||
59 | .Sh DESCRIPTION | 102 | .Sh DESCRIPTION | |
60 | The | 103 | The | |
61 | .Nm | 104 | .Nm | |
62 | command can digitally sign files and verify that the signatures | 105 | command can digitally sign files and verify that the signatures | |
63 | attached to files were signed by a given user identifier. | 106 | attached to files were signed by a given user identifier. | |
64 | .Nm | 107 | .Nm | |
65 | can also encrypt files using the public or private keys of | 108 | can also encrypt files using the public or private keys of | |
66 | users and, in the same manner, decrypt files which were encrypted. | 109 | users and, in the same manner, decrypt files which were encrypted. | |
67 | .Pp | 110 | .Pp | |
111 | For signing and encryption, a unique identity is needed. | |||
112 | This identity is made up of a private and public key. | |||
113 | The public key part is made available and known to everyone. | |||
114 | The private key is kept secret, and known only to the user | |||
115 | who created the identity. | |||
116 | The secret key is protected with a passphrase. | |||
117 | .Pp | |||
118 | In rough terms, a digital signature | |||
119 | is a digest of a file's contents, | |||
120 | encrypted with the user's private key. | |||
121 | Since together, the private and public keys identify the user | |||
122 | uniquely, the signature can be used to identify the exact version | |||
123 | of the file, and any changes made to the file will mean that the | |||
124 | signature no longer matches. | |||
125 | .Pp | |||
126 | As a corollary, the file can be transformed using a user's public key, | |||
127 | into text such that the contents can only be viewed by someone | |||
128 | with the corresponding private key. This is called encryption. | |||
129 | .Pp | |||
68 | The | 130 | The | |
69 | .Nm | 131 | .Nm | |
70 | utility can also be used to generate a new key-pair for a user. | 132 | utility can also be used to generate a new key-pair for a user. | |
71 | This key is in two parts, the public key (which can be | 133 | As mentioned before, | |
72 | used by other people) and a private key. | 134 | this key is in two parts, the public key (which is known | |
135 | by other people) and the private key. | |||
73 | .Pp | 136 | .Pp | |
74 | In addition to these primary uses, the third way of using | 137 | In addition to these primary uses, the third way of using | |
75 | .Nm | 138 | .Nm | |
76 | is to maintain keyrings. | 139 | is to maintain keyrings. | |
140 | Key and keyring management commands available are: | |||
141 | .Fl Fl export-key , | |||
142 | .Fl Fl find-key , | |||
143 | .Fl Fl generate-key , | |||
144 | .Fl Fl import-key , and | |||
145 | .Fl Fl list-keys . | |||
77 | Keyrings are collections of public keys belonging to other users. | 146 | Keyrings are collections of public keys belonging to other users. | |
78 | By using other means of identification, it is possible to establish | 147 | By using other means of identification, it is possible to establish | |
79 | the bona fides of other users. | 148 | the bona fides of other users. | |
80 | Once trust has been established, the public key of the other | 149 | Once trust has been established, the public key of the other | |
81 | user will be signed. | 150 | user will be signed. | |
82 | The other user's public key can be added to our keyring. | 151 | The other user's public key can be added to our keyring. | |
83 | The other user will add our public key to their keyring. | 152 | The other user will add our public key to their keyring. | |
84 | .Pp | 153 | .Pp | |
85 | Keys can be listed, exported (i.e. made available to others), | 154 | Keys can be listed, exported (i.e. made available to others), | |
86 | and imported (i.e. users who have signed our public key). | 155 | and imported (i.e. users who have signed our public key). | |
87 | .Pp | 156 | .Pp | |
88 | One of the following commands must be present: | 157 | The | |
158 | .Fl Fl list-packets | |||
159 | command can be used for debugging purposes. | |||
160 | .Pp | |||
161 | The following commands are used to sign and verify signatures: | |||
89 | .Bl -tag -width Ar | 162 | .Bl -tag -width Ar | |
163 | .It Fl Fl cat | |||
164 | The signature of the signed file named on the command line | |||
165 | is verified against the contents of the file itself. | |||
166 | If the two match, then the original contents | |||
167 | are sent to standard out. | |||
168 | If the signature does not match, no output is generated. | |||
90 | .It Fl Fl clearsign | 169 | .It Fl Fl clearsign | |
91 | The signature of the file named on the command line is calculated | 170 | The signature of the file named on the command line is calculated | |
92 | in the same manner as the | 171 | in the same manner as the | |
93 | .Fl Fl sign | 172 | .Fl Fl sign | |
94 | command, but the text is added to the file such that | 173 | command, but the text is added to the file such that | |
95 | the text itself is not in binary format, but can be read by mere mortals. | 174 | the text itself is not in binary format, but can be read by mere mortals. | |
175 | .It Fl Fl sign | |||
176 | The private key is used to digitally sign the files named on the | |||
177 | command line. | |||
178 | The file and its attached signature are created with a | |||
179 | .Dq Pa .gpg | |||
180 | extension to the original file name. | |||
181 | The user will be prompted for their pass phrase using | |||
182 | .Xr getpass 3 . | |||
183 | .It Fl Fl verify | |||
184 | For each of the files named on the command line, the signature of the file | |||
185 | is verified, checking the contents against the user's public signature. | |||
186 | .El | |||
187 | .Pp | |||
188 | The following commands can be used to encrypt and decrypt files: | |||
189 | .Bl -tag -width Ar | |||
96 | .It Fl Fl decrypt | 190 | .It Fl Fl decrypt | |
97 | Decrypt the file using the user's private key. | 191 | Decrypt the file using the user's private key. | |
98 | The pass phrase will be optained by prompting the user | 192 | The pass phrase will be optained by prompting the user | |
99 | to type it in, using | 193 | to type it in, using | |
100 | .Xr getpass 3 . | 194 | .Xr getpass 3 . | |
101 | .It Fl Fl detached | |||
102 | when signing a file, place the resulting signature in a separate | |||
103 | file from the one being signed. | |||
104 | .It Fl Fl encrypt | 195 | .It Fl Fl encrypt | |
105 | Use the user's public key to encrypt the files named on the command line. | 196 | Use the user's public key to encrypt the files named on the command line. | |
197 | .El | |||
198 | .Pp | |||
199 | In addition, key and keyring management can be done with the | |||
200 | following commands: | |||
201 | .Bl -tag -width Ar | |||
106 | .It Fl Fl export-key | 202 | .It Fl Fl export-key | |
107 | Display the current public key in a format suitable for export. | 203 | Display the current public key in a format suitable for export. | |
108 | This can be used to place the keyring on one of the | 204 | This can be used to place the keyring on one of the | |
109 | public key servers, for example. | 205 | public key servers, for example. | |
110 | .It Fl Fl find-key | 206 | .It Fl Fl find-key | |
111 | Find the appropriate public key from the current keyring. | 207 | Find the appropriate public key from the current keyring. | |
112 | If no keyring is provided, the user's public keyring is used. | 208 | If no keyring is provided, the user's public keyring is used. | |
113 | .It Fl Fl generate-key | 209 | .It Fl Fl generate-key | |
114 | This command is used to generate a new public and private key pair. | 210 | This command is used to generate a new public and private key pair. | |
115 | The user id is taken from the command line, and the user will be | 211 | The user id is taken from the command line, and the user will be | |
116 | prompted to provide a suitable pass phrase. | 212 | prompted to provide a suitable pass phrase. | |
117 | .It Fl Fl import-key | 213 | .It Fl Fl import-key | |
118 | Import a public key as retrieved from one of the public key servers. | 214 | Import a public key as retrieved from one of the public key servers. | |
@@ -120,56 +216,41 @@ This is in the form of a file which has | @@ -120,56 +216,41 @@ This is in the form of a file which has | |||
120 | retrieved from elsewhere. | 216 | retrieved from elsewhere. | |
121 | .It Fl Fl list-keys | 217 | .It Fl Fl list-keys | |
122 | List all the public keys in the current keyring. | 218 | List all the public keys in the current keyring. | |
123 | If no keyring is provided, the user's public keyring is used. | 219 | If no keyring is provided, the user's public keyring is used. | |
124 | .It Fl Fl list-packets | 220 | .It Fl Fl list-packets | |
125 | List all the | 221 | List all the | |
126 | .Dq packets | 222 | .Dq packets | |
127 | in an encrypted or signed file. | 223 | in an encrypted or signed file. | |
128 | Internally, | 224 | Internally, | |
129 | .Nm | 225 | .Nm | |
130 | splits an encrypted or signed file into separate packets, and | 226 | splits an encrypted or signed file into separate packets, and | |
131 | this option is used to give a verbose representation | 227 | this option is used to give a verbose representation | |
132 | of these packets on standard output. | 228 | of these packets on standard output. | |
133 | .It Fl Fl sign | |||
134 | The private key is used to digitally sign the files named on the | |||
135 | command line. | |||
136 | Extra text is added to the file. | |||
137 | In rough terms, this text is a digest of the file's contents, | |||
138 | encrypted with the user's private key. | |||
139 | Since together, the private and public keys identify the user | |||
140 | uniquely, the added text can be used to identify the exact version | |||
141 | of the file, and any changes made to the file will mean that the | |||
142 | signature no longer matches. | |||
143 | The file and its attached signature are created with a | |||
144 | .Dq Pa .gpg | |||
145 | extension to the original file name. | |||
146 | The user will be prompted for their pass phrase using | |||
147 | .Xr getpass 3 . | |||
148 | .It Fl Fl verify | |||
149 | For each of the files named on the command line, the signature of the file | |||
150 | is verified, checking the contents against the user's public signature. | |||
151 | .It Fl Fl version | 229 | .It Fl Fl version | |
152 | Print the version information from the | 230 | Print the version information from the | |
153 | .Xr libnetpgp 3 | 231 | .Xr libnetpgp 3 | |
154 | library. | 232 | library. | |
155 | .El | 233 | .El | |
156 | .Pp | 234 | .Pp | |
157 | In addition to one of the preceding commands, a number of qualifiers | 235 | In addition to one of the preceding commands, a number of qualifiers | |
158 | or options may be given. | 236 | or options may be given. | |
159 | .Bl -tag -width Ar | 237 | .Bl -tag -width Ar | |
160 | .It Fl Fl armour , Fl armor | 238 | .It Fl Fl armour , Fl armor | |
161 | This option, however it is spelled, wraps the signature as an | 239 | This option, however it is spelled, wraps the signature as an | |
162 | ASCII-encoded piece of text, for ease of use. | 240 | ASCII-encoded piece of text, for ease of use. | |
241 | .It Fl Fl detached | |||
242 | when signing a file, place the resulting signature in a separate | |||
243 | file from the one being signed. | |||
163 | .It Fl Fl hash-alg Ar hash-algorithm | 244 | .It Fl Fl hash-alg Ar hash-algorithm | |
164 | can be used to specify the hash algorithm (sometimes called | 245 | can be used to specify the hash algorithm (sometimes called | |
165 | a digest algorithm) which is used with RSA keys when signing | 246 | a digest algorithm) which is used with RSA keys when signing | |
166 | text. | 247 | text. | |
167 | The default hash algorithm is the | 248 | The default hash algorithm is the | |
168 | .Dq SHA256 | 249 | .Dq SHA256 | |
169 | algorithm. | 250 | algorithm. | |
170 | At the present time, | 251 | At the present time, | |
171 | .Dq SHA1 | 252 | .Dq SHA1 | |
172 | may also be used, although it is recommended that | 253 | may also be used, although it is recommended that | |
173 | SHA256 be used, due to recent advances in generating | 254 | SHA256 be used, due to recent advances in generating | |
174 | collisions for the SHA1 hashing algorithm. | 255 | collisions for the SHA1 hashing algorithm. | |
175 | .It Fl Fl homedir Ar home-directory | 256 | .It Fl Fl homedir Ar home-directory | |
@@ -179,26 +260,33 @@ the user's home directory in a subdirect | @@ -179,26 +260,33 @@ the user's home directory in a subdirect | |||
179 | and this option specifies an alternative location in which to | 260 | and this option specifies an alternative location in which to | |
180 | find that sub-directory. | 261 | find that sub-directory. | |
181 | .It Fl Fl keyring Ar keyring | 262 | .It Fl Fl keyring Ar keyring | |
182 | This option specifies an alternative keyring to be used. | 263 | This option specifies an alternative keyring to be used. | |
183 | All keyring operations will be relative to this alternative keyring. | 264 | All keyring operations will be relative to this alternative keyring. | |
184 | .It Fl Fl numbits Ar numbits | 265 | .It Fl Fl numbits Ar numbits | |
185 | specifies the number of bits to be used when generating a key. | 266 | specifies the number of bits to be used when generating a key. | |
186 | The default number of bits is 2048. | 267 | The default number of bits is 2048. | |
187 | This is considered the absolute | 268 | This is considered the absolute | |
188 | minimum which should be chosen at the time of writing (2009). | 269 | minimum which should be chosen at the time of writing (2009). | |
189 | Due to advances in computing power every year, this number should | 270 | Due to advances in computing power every year, this number should | |
190 | be reviewed, and increased when it becomes easier to factor 2048 | 271 | be reviewed, and increased when it becomes easier to factor 2048 | |
191 | bit numbers. | 272 | bit numbers. | |
273 | .It Fl Fl output | |||
274 | specifies a filename to which verified otuput from a signed file | |||
275 | may be redirected. | |||
276 | The default is to send the verified output to stdout, | |||
277 | and this may also be specified using the | |||
278 | .Dq - | |||
279 | value. | |||
192 | .It Fl Fl userid Ar userid | 280 | .It Fl Fl userid Ar userid | |
193 | This option specifies the user identity to be used for all operations. | 281 | This option specifies the user identity to be used for all operations. | |
194 | This identity can either be in the form of the full name, or as an | 282 | This identity can either be in the form of the full name, or as an | |
195 | email address. | 283 | email address. | |
196 | Care should be exercised with these ways of specifying the user identity, | 284 | Care should be exercised with these ways of specifying the user identity, | |
197 | since the | 285 | since the | |
198 | .Nm | 286 | .Nm | |
199 | utility has no way of verifying that an email address is valid, or | 287 | utility has no way of verifying that an email address is valid, or | |
200 | that a key belongs to a certain individual. | 288 | that a key belongs to a certain individual. | |
201 | The trust for a signed key is given by the other signers of that key. | 289 | The trust for a signed key is given by the other signers of that key. | |
202 | The 16 hexadecimal digit user identity should be used when specifying | 290 | The 16 hexadecimal digit user identity should be used when specifying | |
203 | user identities - email addresses and names are provided as aliases. | 291 | user identities - email addresses and names are provided as aliases. | |
204 | .It Fl Fl verbose | 292 | .It Fl Fl verbose | |
@@ -223,30 +311,26 @@ needed, | @@ -223,30 +311,26 @@ needed, | |||
223 | such as during signing or encryption, or key generation, | 311 | such as during signing or encryption, or key generation, | |
224 | so that any secret information cannot be viewed by other users | 312 | so that any secret information cannot be viewed by other users | |
225 | using the | 313 | using the | |
226 | .Xr ps 1 | 314 | .Xr ps 1 | |
227 | or | 315 | or | |
228 | .Xr top 1 | 316 | .Xr top 1 | |
229 | commands, or by looking over the shoulder at the screen. | 317 | commands, or by looking over the shoulder at the screen. | |
230 | .Pp | 318 | .Pp | |
231 | Since the public and private key pair can be used to verify | 319 | Since the public and private key pair can be used to verify | |
232 | a person's identity, and since identity theft can have | 320 | a person's identity, and since identity theft can have | |
233 | far-reaching consequences, users are strongly encouraged to | 321 | far-reaching consequences, users are strongly encouraged to | |
234 | enter their pass phrases only when prompted by the application. | 322 | enter their pass phrases only when prompted by the application. | |
235 | .Pp | 323 | .Pp | |
236 | The | |||
237 | .Fl Fl passphrase | |||
238 | option is deprecated, and will be removed in future versions | |||
239 | of the tool. | |||
240 | .Sh SIGNING AND VERIFICATION | 324 | .Sh SIGNING AND VERIFICATION | |
241 | Signing and verification of a file is best viewed using the following example: | 325 | Signing and verification of a file is best viewed using the following example: | |
242 | .Bd -literal | 326 | .Bd -literal | |
243 | % netpgp --sign --userid=agc@netbsd.org a | 327 | % netpgp --sign --userid=agc@netbsd.org a | |
244 | pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12 | 328 | pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12 | |
245 | Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823 | 329 | Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823 | |
246 | uid Alistair Crooks \*[Lt]agc@netbsd.org\*[Gt] | 330 | uid Alistair Crooks \*[Lt]agc@netbsd.org\*[Gt] | |
247 | uid Alistair Crooks \*[Lt]agc@pkgsrc.org\*[Gt] | 331 | uid Alistair Crooks \*[Lt]agc@pkgsrc.org\*[Gt] | |
248 | uid Alistair Crooks \*[Lt]agc@alistaircrooks.com\*[Gt] | 332 | uid Alistair Crooks \*[Lt]agc@alistaircrooks.com\*[Gt] | |
249 | uid Alistair Crooks \*[Lt]alistair@hockley-crooks.com\*[Gt] | 333 | uid Alistair Crooks \*[Lt]alistair@hockley-crooks.com\*[Gt] | |
250 | netpgp passphrase: | 334 | netpgp passphrase: | |
251 | % netpgp --verify a.gpg | 335 | % netpgp --verify a.gpg | |
252 | Good signature for a.gpg made Thu Jan 29 03:06:00 2009 | 336 | Good signature for a.gpg made Thu Jan 29 03:06:00 2009 | |
@@ -264,26 +348,51 @@ In the example above, a signature is mad | @@ -264,26 +348,51 @@ In the example above, a signature is mad | |||
264 | .Dq a | 348 | .Dq a | |
265 | using a user identity corresponding to | 349 | using a user identity corresponding to | |
266 | .Dq agc@netbsd.org | 350 | .Dq agc@netbsd.org | |
267 | The key located for the user identity is displayed, and | 351 | The key located for the user identity is displayed, and | |
268 | the user is prompted to type in their passphrase. | 352 | the user is prompted to type in their passphrase. | |
269 | The resulting file, called | 353 | The resulting file, called | |
270 | .Dq a.gpg | 354 | .Dq a.gpg | |
271 | is placed in the same directory. | 355 | is placed in the same directory. | |
272 | The second part of the example shows a verification of the signed file | 356 | The second part of the example shows a verification of the signed file | |
273 | taking place. | 357 | taking place. | |
274 | The time and user identity of the signatory is displayed, followed | 358 | The time and user identity of the signatory is displayed, followed | |
275 | by a fuller description of the public key of the signatory. | 359 | by a fuller description of the public key of the signatory. | |
276 | In both cases, the exit value from the utility was a successful one. | 360 | In both cases, the exit value from the utility was a successful one. | |
361 | .Pp | |||
362 | If a detached signature of a file called | |||
363 | .Dq a | |||
364 | is requested, the signature would be placed | |||
365 | in a file called | |||
366 | .Dq a.sig . | |||
367 | .Pp | |||
368 | To encrypt a file, the user's public key is used. | |||
369 | Subsequent decryption of the file requires that the secret | |||
370 | key is known. | |||
371 | When decrypting, the key is displayed, | |||
372 | and the passphrase protecting | |||
373 | the secret key must be typed in to access the data in the encrypted file. | |||
374 | .Bd -literal | |||
375 | % netpgp --encrypt --userid=c0596823 a | |||
376 | % netpgp --decrypt a.gpg | |||
377 | pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12 | |||
378 | Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823 | |||
379 | uid Alistair Crooks \*[Lt]agc@netbsd.org\*[Gt] | |||
380 | uid Alistair Crooks \*[Lt]agc@pkgsrc.org\*[Gt] | |||
381 | uid Alistair Crooks \*[Lt]agc@alistaircrooks.com\*[Gt] | |||
382 | uid Alistair Crooks \*[Lt]alistair@hockley-crooks.com\*[Gt] | |||
383 | netpgp passphrase: | |||
384 | % | |||
385 | .Ed | |||
277 | .Sh RETURN VALUES | 386 | .Sh RETURN VALUES | |
278 | The | 387 | The | |
279 | .Nm | 388 | .Nm | |
280 | utility will return 0 for success, | 389 | utility will return 0 for success, | |
281 | 1 if the file's signature does not match what was expected, | 390 | 1 if the file's signature does not match what was expected, | |
282 | or 2 if any other error occurs. | 391 | or 2 if any other error occurs. | |
283 | .Sh SEE ALSO | 392 | .Sh SEE ALSO | |
284 | .Xr getpass 3 , | 393 | .Xr getpass 3 , | |
285 | .\" .Xr libbz2 3 , | 394 | .\" .Xr libbz2 3 , | |
286 | .Xr libnetpgp 3 , | 395 | .Xr libnetpgp 3 , | |
287 | .Xr ssl 3 , | 396 | .Xr ssl 3 , | |
288 | .Xr zlib 3 | 397 | .Xr zlib 3 | |
289 | .Sh STANDARDS | 398 | .Sh STANDARDS |
--- src/crypto/external/bsd/netpgp/dist/src/bin/Attic/netpgp.c 2009/05/16 06:30:38 1.7
+++ src/crypto/external/bsd/netpgp/dist/src/bin/Attic/netpgp.c 2009/05/21 00:33:31 1.8
@@ -93,99 +93,105 @@ static const char *usage_clearsign = | @@ -93,99 +93,105 @@ static const char *usage_clearsign = | |||
93 | 93 | |||
94 | enum optdefs { | 94 | enum optdefs { | |
95 | /* commands */ | 95 | /* commands */ | |
96 | LIST_KEYS = 1, | 96 | LIST_KEYS = 1, | |
97 | FIND_KEY, | 97 | FIND_KEY, | |
98 | EXPORT_KEY, | 98 | EXPORT_KEY, | |
99 | IMPORT_KEY, | 99 | IMPORT_KEY, | |
100 | GENERATE_KEY, | 100 | GENERATE_KEY, | |
101 | ENCRYPT, | 101 | ENCRYPT, | |
102 | DECRYPT, | 102 | DECRYPT, | |
103 | SIGN, | 103 | SIGN, | |
104 | CLEARSIGN, | 104 | CLEARSIGN, | |
105 | VERIFY, | 105 | VERIFY, | |
106 | VERIFY_SHOW, | 106 | VERIFY_CAT, | |
107 | LIST_PACKETS, | 107 | LIST_PACKETS, | |
108 | VERSION_CMD, | 108 | VERSION_CMD, | |
109 | HELP_CMD, | 109 | HELP_CMD, | |
110 | 110 | |||
111 | /* options */ | 111 | /* options */ | |
112 | KEYRING, | 112 | KEYRING, | |
113 | USERID, | 113 | USERID, | |
114 | ARMOUR, | 114 | ARMOUR, | |
115 | HOMEDIR, | 115 | HOMEDIR, | |
116 | NUMBITS, | 116 | NUMBITS, | |
117 | DETACHED, | 117 | DETACHED, | |
118 | HASH_ALG, | 118 | HASH_ALG, | |
119 | OUTPUT, | |||
119 | VERBOSE, | 120 | VERBOSE, | |
120 | 121 | |||
121 | /* debug */ | 122 | /* debug */ | |
122 | OPS_DEBUG | 123 | OPS_DEBUG | |
123 | 124 | |||
124 | }; | 125 | }; | |
125 | 126 | |||
126 | 127 | |||
127 | #define EXIT_ERROR 2 | 128 | #define EXIT_ERROR 2 | |
128 | 129 | |||
129 | static struct option options[] = { | 130 | static struct option options[] = { | |
130 | /* commands */ | 131 | /* commands */ | |
131 | {"list-keys", no_argument, NULL, LIST_KEYS}, | 132 | {"list-keys", no_argument, NULL, LIST_KEYS}, | |
132 | {"find-key", no_argument, NULL, FIND_KEY}, | 133 | {"find-key", no_argument, NULL, FIND_KEY}, | |
133 | {"export-key", no_argument, NULL, EXPORT_KEY}, | 134 | {"export-key", no_argument, NULL, EXPORT_KEY}, | |
134 | {"import-key", no_argument, NULL, IMPORT_KEY}, | 135 | {"import-key", no_argument, NULL, IMPORT_KEY}, | |
135 | {"generate-key", no_argument, NULL, GENERATE_KEY}, | 136 | {"generate-key", no_argument, NULL, GENERATE_KEY}, | |
136 | 137 | |||
137 | {"encrypt", no_argument, NULL, ENCRYPT}, | 138 | {"encrypt", no_argument, NULL, ENCRYPT}, | |
138 | {"decrypt", no_argument, NULL, DECRYPT}, | 139 | {"decrypt", no_argument, NULL, DECRYPT}, | |
139 | {"sign", no_argument, NULL, SIGN}, | 140 | {"sign", no_argument, NULL, SIGN}, | |
140 | {"clearsign", no_argument, NULL, CLEARSIGN}, | 141 | {"clearsign", no_argument, NULL, CLEARSIGN}, | |
141 | {"verify", no_argument, NULL, VERIFY}, | 142 | {"verify", no_argument, NULL, VERIFY}, | |
142 | {"verify-show", no_argument, NULL, VERIFY_SHOW}, | 143 | {"cat", no_argument, NULL, VERIFY_CAT}, | |
143 | {"verifyshow", no_argument, NULL, VERIFY_SHOW}, | 144 | {"vericat", no_argument, NULL, VERIFY_CAT}, | |
145 | {"verify-cat", no_argument, NULL, VERIFY_CAT}, | |||
146 | {"verify-show", no_argument, NULL, VERIFY_CAT}, | |||
147 | {"verifyshow", no_argument, NULL, VERIFY_CAT}, | |||
144 | 148 | |||
145 | {"list-packets", no_argument, NULL, LIST_PACKETS}, | 149 | {"list-packets", no_argument, NULL, LIST_PACKETS}, | |
146 | 150 | |||
147 | {"help", no_argument, NULL, HELP_CMD}, | 151 | {"help", no_argument, NULL, HELP_CMD}, | |
148 | {"version", no_argument, NULL, VERSION_CMD}, | 152 | {"version", no_argument, NULL, VERSION_CMD}, | |
149 | 153 | |||
150 | /* options */ | 154 | /* options */ | |
151 | {"keyring", required_argument, NULL, KEYRING}, | 155 | {"keyring", required_argument, NULL, KEYRING}, | |
152 | {"userid", required_argument, NULL, USERID}, | 156 | {"userid", required_argument, NULL, USERID}, | |
153 | {"home", required_argument, NULL, HOMEDIR}, | 157 | {"home", required_argument, NULL, HOMEDIR}, | |
154 | {"homedir", required_argument, NULL, HOMEDIR}, | 158 | {"homedir", required_argument, NULL, HOMEDIR}, | |
155 | {"armor", no_argument, NULL, ARMOUR}, | 159 | {"armor", no_argument, NULL, ARMOUR}, | |
156 | {"armour", no_argument, NULL, ARMOUR}, | 160 | {"armour", no_argument, NULL, ARMOUR}, | |
157 | {"numbits", required_argument, NULL, NUMBITS}, | 161 | {"numbits", required_argument, NULL, NUMBITS}, | |
158 | {"detach", no_argument, NULL, DETACHED}, | 162 | {"detach", no_argument, NULL, DETACHED}, | |
159 | {"detached", no_argument, NULL, DETACHED}, | 163 | {"detached", no_argument, NULL, DETACHED}, | |
160 | {"hash-alg", required_argument, NULL, HASH_ALG}, | 164 | {"hash-alg", required_argument, NULL, HASH_ALG}, | |
161 | {"hash", required_argument, NULL, HASH_ALG}, | 165 | {"hash", required_argument, NULL, HASH_ALG}, | |
162 | {"algorithm", required_argument, NULL, HASH_ALG}, | 166 | {"algorithm", required_argument, NULL, HASH_ALG}, | |
163 | {"verbose", no_argument, NULL, VERBOSE}, | 167 | {"verbose", no_argument, NULL, VERBOSE}, | |
168 | {"output", required_argument, NULL, OUTPUT}, | |||
164 | 169 | |||
165 | /* debug */ | 170 | /* debug */ | |
166 | {"debug", required_argument, NULL, OPS_DEBUG}, | 171 | {"debug", required_argument, NULL, OPS_DEBUG}, | |
167 | 172 | |||
168 | { NULL, 0, NULL, 0}, | 173 | { NULL, 0, NULL, 0}, | |
169 | }; | 174 | }; | |
170 | 175 | |||
171 | /* gather up program variables into one struct */ | 176 | /* gather up program variables into one struct */ | |
172 | typedef struct prog_t { | 177 | typedef struct prog_t { | |
173 | char keyring[MAXBUF + 1]; /* name of keyring */ | 178 | char keyring[MAXBUF + 1]; /* name of keyring */ | |
174 | char *userid; /* user identifier */ | 179 | char *userid; /* user identifier */ | |
175 | char myring_name[MAXBUF + 1]; /* myring filename */ | 180 | char myring_name[MAXBUF + 1]; /* myring filename */ | |
176 | char pubring_name[MAXBUF + 1]; /* pubring filename */ | 181 | char pubring_name[MAXBUF + 1]; /* pubring filename */ | |
177 | char secring_name[MAXBUF + 1]; /* secret ring file */ | 182 | char secring_name[MAXBUF + 1]; /* secret ring file */ | |
178 | char *progname; /* program name */ | 183 | char *progname; /* program name */ | |
184 | char *output; /* output file name */ | |||
179 | int overwrite; /* overwrite files? */ | 185 | int overwrite; /* overwrite files? */ | |
180 | int numbits; /* # of bits */ | 186 | int numbits; /* # of bits */ | |
181 | int armour; /* ASCII armor */ | 187 | int armour; /* ASCII armor */ | |
182 | int detached; /* use separate file */ | 188 | int detached; /* use separate file */ | |
183 | int cmd; /* netpgp command */ | 189 | int cmd; /* netpgp command */ | |
184 | } prog_t; | 190 | } prog_t; | |
185 | 191 | |||
186 | 192 | |||
187 | /* print a usage message */ | 193 | /* print a usage message */ | |
188 | static void | 194 | static void | |
189 | print_usage(const char *usagemsg, char *progname) | 195 | print_usage(const char *usagemsg, char *progname) | |
190 | { | 196 | { | |
191 | (void) fprintf(stderr, | 197 | (void) fprintf(stderr, | |
@@ -214,28 +220,28 @@ netpgp_cmd(netpgp_t *netpgp, prog_t *p, | @@ -214,28 +220,28 @@ netpgp_cmd(netpgp_t *netpgp, prog_t *p, | |||
214 | case ENCRYPT: | 220 | case ENCRYPT: | |
215 | return netpgp_encrypt_file(netpgp, p->userid, f, NULL, | 221 | return netpgp_encrypt_file(netpgp, p->userid, f, NULL, | |
216 | p->armour); | 222 | p->armour); | |
217 | case DECRYPT: | 223 | case DECRYPT: | |
218 | return netpgp_decrypt_file(netpgp, f, NULL, p->armour); | 224 | return netpgp_decrypt_file(netpgp, f, NULL, p->armour); | |
219 | case SIGN: | 225 | case SIGN: | |
220 | return netpgp_sign_file(netpgp, p->userid, f, NULL, p->armour, | 226 | return netpgp_sign_file(netpgp, p->userid, f, NULL, p->armour, | |
221 | 0, p->detached); | 227 | 0, p->detached); | |
222 | case CLEARSIGN: | 228 | case CLEARSIGN: | |
223 | return netpgp_sign_file(netpgp, p->userid, f, NULL, p->armour, | 229 | return netpgp_sign_file(netpgp, p->userid, f, NULL, p->armour, | |
224 | 1, p->detached); | 230 | 1, p->detached); | |
225 | case VERIFY: | 231 | case VERIFY: | |
226 | return netpgp_verify_file(netpgp, f, NULL, p->armour); | 232 | return netpgp_verify_file(netpgp, f, NULL, p->armour); | |
227 | case VERIFY_SHOW: | 233 | case VERIFY_CAT: | |
228 | return netpgp_verify_file(netpgp, f, "-", p->armour); | 234 | return netpgp_verify_file(netpgp, f, p->output, p->armour); | |
229 | case LIST_PACKETS: | 235 | case LIST_PACKETS: | |
230 | return netpgp_list_packets(netpgp, f, p->armour, NULL); | 236 | return netpgp_list_packets(netpgp, f, p->armour, NULL); | |
231 | case HELP_CMD: | 237 | case HELP_CMD: | |
232 | default: | 238 | default: | |
233 | print_usage(usage, p->progname); | 239 | print_usage(usage, p->progname); | |
234 | exit(EXIT_SUCCESS); | 240 | exit(EXIT_SUCCESS); | |
235 | } | 241 | } | |
236 | } | 242 | } | |
237 | 243 | |||
238 | /* get even more lippy */ | 244 | /* get even more lippy */ | |
239 | static void | 245 | static void | |
240 | give_it_large(netpgp_t *netpgp) | 246 | give_it_large(netpgp_t *netpgp) | |
241 | { | 247 | { | |
@@ -258,52 +264,53 @@ main(int argc, char **argv) | @@ -258,52 +264,53 @@ main(int argc, char **argv) | |||
258 | prog_t p; | 264 | prog_t p; | |
259 | char homedir[MAXPATHLEN]; | 265 | char homedir[MAXPATHLEN]; | |
260 | int optindex; | 266 | int optindex; | |
261 | int ret; | 267 | int ret; | |
262 | int ch; | 268 | int ch; | |
263 | int i; | 269 | int i; | |
264 | 270 | |||
265 | (void) memset(&p, 0x0, sizeof(p)); | 271 | (void) memset(&p, 0x0, sizeof(p)); | |
266 | (void) memset(homedir, 0x0, sizeof(homedir)); | 272 | (void) memset(homedir, 0x0, sizeof(homedir)); | |
267 | (void) memset(&netpgp, 0x0, sizeof(netpgp)); | 273 | (void) memset(&netpgp, 0x0, sizeof(netpgp)); | |
268 | p.progname = argv[0]; | 274 | p.progname = argv[0]; | |
269 | p.numbits = DEFAULT_NUMBITS; | 275 | p.numbits = DEFAULT_NUMBITS; | |
270 | p.overwrite = 1; | 276 | p.overwrite = 1; | |
277 | p.output = strdup("-"); /* default --cat to stdout */ | |||
271 | if (argc < 2) { | 278 | if (argc < 2) { | |
272 | print_usage(usage, p.progname); | 279 | print_usage(usage, p.progname); | |
273 | exit(EXIT_ERROR); | 280 | exit(EXIT_ERROR); | |
274 | } | 281 | } | |
275 | netpgp_setvar(&netpgp, "hash", "SHA256"); | 282 | netpgp_setvar(&netpgp, "hash", "SHA256"); | |
276 | 283 | |||
277 | /* set default homedir */ | 284 | /* set default homedir */ | |
278 | (void) snprintf(homedir, sizeof(homedir), "%s/.gnupg", getenv("HOME")); | 285 | (void) snprintf(homedir, sizeof(homedir), "%s/.gnupg", getenv("HOME")); | |
279 | 286 | |||
280 | optindex = 0; | 287 | optindex = 0; | |
281 | while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) { | 288 | while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) { | |
282 | switch (options[optindex].val) { | 289 | switch (options[optindex].val) { | |
283 | case LIST_KEYS: | 290 | case LIST_KEYS: | |
284 | p.cmd = options[optindex].val; | 291 | p.cmd = options[optindex].val; | |
285 | break; | 292 | break; | |
286 | 293 | |||
287 | case FIND_KEY: | 294 | case FIND_KEY: | |
288 | case EXPORT_KEY: | 295 | case EXPORT_KEY: | |
289 | case IMPORT_KEY: | 296 | case IMPORT_KEY: | |
290 | case GENERATE_KEY: | 297 | case GENERATE_KEY: | |
291 | case ENCRYPT: | 298 | case ENCRYPT: | |
292 | case DECRYPT: | 299 | case DECRYPT: | |
293 | case SIGN: | 300 | case SIGN: | |
294 | case CLEARSIGN: | 301 | case CLEARSIGN: | |
295 | case VERIFY: | 302 | case VERIFY: | |
296 | case VERIFY_SHOW: | 303 | case VERIFY_CAT: | |
297 | case LIST_PACKETS: | 304 | case LIST_PACKETS: | |
298 | case HELP_CMD: | 305 | case HELP_CMD: | |
299 | p.cmd = options[optindex].val; | 306 | p.cmd = options[optindex].val; | |
300 | break; | 307 | break; | |
301 | 308 | |||
302 | case VERSION_CMD: | 309 | case VERSION_CMD: | |
303 | printf( | 310 | printf( | |
304 | "%s\nAll bug reports, praise and chocolate, please, to:\n%s\n", | 311 | "%s\nAll bug reports, praise and chocolate, please, to:\n%s\n", | |
305 | netpgp_get_info("version"), | 312 | netpgp_get_info("version"), | |
306 | netpgp_get_info("maintainer")); | 313 | netpgp_get_info("maintainer")); | |
307 | exit(EXIT_SUCCESS); | 314 | exit(EXIT_SUCCESS); | |
308 | 315 | |||
309 | /* options */ | 316 | /* options */ | |
@@ -358,26 +365,36 @@ main(int argc, char **argv) | @@ -358,26 +365,36 @@ main(int argc, char **argv) | |||
358 | } | 365 | } | |
359 | p.numbits = atoi(optarg); | 366 | p.numbits = atoi(optarg); | |
360 | break; | 367 | break; | |
361 | 368 | |||
362 | case HASH_ALG: | 369 | case HASH_ALG: | |
363 | if (optarg == NULL) { | 370 | if (optarg == NULL) { | |
364 | (void) fprintf(stderr, | 371 | (void) fprintf(stderr, | |
365 | "No hash algorithm argument provided\n"); | 372 | "No hash algorithm argument provided\n"); | |
366 | exit(EXIT_ERROR); | 373 | exit(EXIT_ERROR); | |
367 | } | 374 | } | |
368 | netpgp_setvar(&netpgp, "hash", optarg); | 375 | netpgp_setvar(&netpgp, "hash", optarg); | |
369 | break; | 376 | break; | |
370 | 377 | |||
378 | case OUTPUT: | |||
379 | if (optarg == NULL) { | |||
380 | (void) fprintf(stderr, | |||
381 | "No output filename argument provided\n"); | |||
382 | exit(EXIT_ERROR); | |||
383 | } | |||
384 | (void) free(p.output); | |||
385 | p.output = strdup(optarg); | |||
386 | break; | |||
387 | ||||
371 | case OPS_DEBUG: | 388 | case OPS_DEBUG: | |
372 | netpgp_set_debug(optarg); | 389 | netpgp_set_debug(optarg); | |
373 | break; | 390 | break; | |
374 | 391 | |||
375 | default: | 392 | default: | |
376 | p.cmd = HELP_CMD; | 393 | p.cmd = HELP_CMD; | |
377 | break; | 394 | break; | |
378 | } | 395 | } | |
379 | } | 396 | } | |
380 | 397 | |||
381 | /* initialise, and read keys from file */ | 398 | /* initialise, and read keys from file */ | |
382 | if (!netpgp_init(&netpgp, p.userid, NULL, NULL)) { | 399 | if (!netpgp_init(&netpgp, p.userid, NULL, NULL)) { | |
383 | printf("can't initialise\n"); | 400 | printf("can't initialise\n"); |
--- src/crypto/external/bsd/netpgp/dist/src/lib/Attic/config.h 2009/05/19 05:13:10 1.8
+++ src/crypto/external/bsd/netpgp/dist/src/lib/Attic/config.h 2009/05/21 00:33:31 1.9
@@ -112,33 +112,33 @@ | @@ -112,33 +112,33 @@ | |||
112 | /* Define to 1 if you have the <unistd.h> header file. */ | 112 | /* Define to 1 if you have the <unistd.h> header file. */ | |
113 | #define HAVE_UNISTD_H 1 | 113 | #define HAVE_UNISTD_H 1 | |
114 | 114 | |||
115 | /* Define to 1 if you have the <zlib.h> header file. */ | 115 | /* Define to 1 if you have the <zlib.h> header file. */ | |
116 | #define HAVE_ZLIB_H 1 | 116 | #define HAVE_ZLIB_H 1 | |
117 | 117 | |||
118 | /* Define to the address where bug reports for this package should be sent. */ | 118 | /* Define to the address where bug reports for this package should be sent. */ | |
119 | #define PACKAGE_BUGREPORT "Alistair Crooks <agc@netbsd.org> c0596823" | 119 | #define PACKAGE_BUGREPORT "Alistair Crooks <agc@netbsd.org> c0596823" | |
120 | 120 | |||
121 | /* Define to the full name of this package. */ | 121 | /* Define to the full name of this package. */ | |
122 | #define PACKAGE_NAME "netpgp" | 122 | #define PACKAGE_NAME "netpgp" | |
123 | 123 | |||
124 | /* Define to the full name and version of this package. */ | 124 | /* Define to the full name and version of this package. */ | |
125 | #define PACKAGE_STRING "netpgp 20090518" | 125 | #define PACKAGE_STRING "netpgp 20090520" | |
126 | 126 | |||
127 | /* Define to the one symbol short name of this package. */ | 127 | /* Define to the one symbol short name of this package. */ | |
128 | #define PACKAGE_TARNAME "netpgp" | 128 | #define PACKAGE_TARNAME "netpgp" | |
129 | 129 | |||
130 | /* Define to the version of this package. */ | 130 | /* Define to the version of this package. */ | |
131 | #define PACKAGE_VERSION "20090518" | 131 | #define PACKAGE_VERSION "20090520" | |
132 | 132 | |||
133 | /* Define to 1 if you have the ANSI C header files. */ | 133 | /* Define to 1 if you have the ANSI C header files. */ | |
134 | #define STDC_HEADERS 1 | 134 | #define STDC_HEADERS 1 | |
135 | 135 | |||
136 | /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, | 136 | /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, | |
137 | <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the | 137 | <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the | |
138 | #define below would cause a syntax error. */ | 138 | #define below would cause a syntax error. */ | |
139 | /* #undef _UINT32_T */ | 139 | /* #undef _UINT32_T */ | |
140 | 140 | |||
141 | /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, | 141 | /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, | |
142 | <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the | 142 | <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the | |
143 | #define below would cause a syntax error. */ | 143 | #define below would cause a syntax error. */ | |
144 | /* #undef _UINT64_T */ | 144 | /* #undef _UINT64_T */ |
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h 2009/05/19 05:13:10 1.8
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h 2009/05/21 00:33:31 1.9
@@ -103,23 +103,23 @@ void __ops_add_signed_userid(__ops_keyda | @@ -103,23 +103,23 @@ void __ops_add_signed_userid(__ops_keyda | |||
103 | const __ops_userid_t *, | 103 | const __ops_userid_t *, | |
104 | const __ops_subpacket_t *); | 104 | const __ops_subpacket_t *); | |
105 | 105 | |||
106 | unsigned __ops_add_selfsigned_userid(__ops_keydata_t *, __ops_userid_t *); | 106 | unsigned __ops_add_selfsigned_userid(__ops_keydata_t *, __ops_userid_t *); | |
107 | 107 | |||
108 | __ops_keydata_t *__ops_keydata_new(void); | 108 | __ops_keydata_t *__ops_keydata_new(void); | |
109 | void __ops_keydata_init(__ops_keydata_t *, const __ops_content_tag_t); | 109 | void __ops_keydata_init(__ops_keydata_t *, const __ops_content_tag_t); | |
110 | 110 | |||
111 | void __ops_copy_userid(__ops_userid_t *, const __ops_userid_t *); | 111 | void __ops_copy_userid(__ops_userid_t *, const __ops_userid_t *); | |
112 | void __ops_copy_packet(__ops_subpacket_t *, const __ops_subpacket_t *); | 112 | void __ops_copy_packet(__ops_subpacket_t *, const __ops_subpacket_t *); | |
113 | 113 | |||
114 | int __ops_parse_and_accumulate(__ops_keyring_t *, __ops_parseinfo_t *); | 114 | int __ops_parse_and_accumulate(__ops_keyring_t *, __ops_parseinfo_t *); | |
115 | 115 | |||
116 | void __ops_print_pubkeydata(const __ops_keydata_t *); | 116 | void __ops_print_pubkeydata(FILE *, const __ops_keydata_t *); | |
117 | void __ops_print_pubkey(const __ops_pubkey_t *); | 117 | void __ops_print_pubkey(const __ops_pubkey_t *); | |
118 | 118 | |||
119 | void __ops_print_seckeydata(const __ops_keydata_t *); | 119 | void __ops_print_seckeydata(const __ops_keydata_t *); | |
120 | void __ops_list_packets(char *, unsigned, __ops_keyring_t *, | 120 | void __ops_list_packets(char *, unsigned, __ops_keyring_t *, | |
121 | __ops_cbfunc_t *); | 121 | __ops_cbfunc_t *); | |
122 | 122 | |||
123 | int __ops_export_key(const __ops_keydata_t *, unsigned char *); | 123 | int __ops_export_key(const __ops_keydata_t *, unsigned char *); | |
124 | 124 | |||
125 | #endif /* KEYRING_H_ */ | 125 | #endif /* KEYRING_H_ */ |
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.h 2009/05/19 05:13:10 1.8
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.h 2009/05/21 00:33:32 1.9
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | */ | 51 | */ | |
52 | 52 | |||
53 | #ifndef SIGNATURE_H_ | 53 | #ifndef SIGNATURE_H_ | |
54 | #define SIGNATURE_H_ | 54 | #define SIGNATURE_H_ | |
55 | 55 | |||
56 | #include "packet.h" | 56 | #include "packet.h" | |
57 | #include "create.h" | 57 | #include "create.h" | |
58 | #include "memory.h" | 58 | #include "memory.h" | |
59 | 59 | |||
60 | typedef struct __ops_create_sig __ops_create_sig_t; | 60 | typedef struct __ops_create_sig_t __ops_create_sig_t; | |
61 | 61 | |||
62 | __ops_create_sig_t *__ops_create_sig_new(void); | 62 | __ops_create_sig_t *__ops_create_sig_new(void); | |
63 | void __ops_create_sig_delete(__ops_create_sig_t *); | 63 | void __ops_create_sig_delete(__ops_create_sig_t *); | |
64 | 64 | |||
65 | unsigned __ops_check_useridcert_sig(const __ops_pubkey_t *, | 65 | unsigned __ops_check_useridcert_sig(const __ops_pubkey_t *, | |
66 | const __ops_userid_t *, | 66 | const __ops_userid_t *, | |
67 | const __ops_sig_t *, | 67 | const __ops_sig_t *, | |
68 | const __ops_pubkey_t *, | 68 | const __ops_pubkey_t *, | |
69 | const unsigned char *); | 69 | const unsigned char *); | |
70 | unsigned __ops_check_userattrcert_sig(const __ops_pubkey_t *, | 70 | unsigned __ops_check_userattrcert_sig(const __ops_pubkey_t *, | |
71 | const __ops_userattr_t *, | 71 | const __ops_userattr_t *, | |
72 | const __ops_sig_t *, | 72 | const __ops_sig_t *, | |
73 | const __ops_pubkey_t *, | 73 | const __ops_pubkey_t *, |
--- src/crypto/external/bsd/netpgp/dist/src/lib/version.h 2009/05/19 05:13:10 1.8
+++ src/crypto/external/bsd/netpgp/dist/src/lib/version.h 2009/05/21 00:33:32 1.9
@@ -48,20 +48,20 @@ | @@ -48,20 +48,20 @@ | |||
48 | */ | 48 | */ | |
49 | #ifndef VERSION_H_ | 49 | #ifndef VERSION_H_ | |
50 | #define VERSION_H_ 1 | 50 | #define VERSION_H_ 1 | |
51 | 51 | |||
52 | #ifndef NETPGP_AUTOCONF_VERSION | 52 | #ifndef NETPGP_AUTOCONF_VERSION | |
53 | #define NETPGP_AUTOCONF_VERSION PACKAGE_VERSION | 53 | #define NETPGP_AUTOCONF_VERSION PACKAGE_VERSION | |
54 | #endif | 54 | #endif | |
55 | 55 | |||
56 | #ifndef NETPGP_MAINTAINER | 56 | #ifndef NETPGP_MAINTAINER | |
57 | #define NETPGP_MAINTAINER PACKAGE_BUGREPORT | 57 | #define NETPGP_MAINTAINER PACKAGE_BUGREPORT | |
58 | #endif | 58 | #endif | |
59 | 59 | |||
60 | /* development versions have .99 suffix */ | 60 | /* development versions have .99 suffix */ | |
61 | #define NETPGP_BASE_VERSION "1.99.1" | 61 | #define NETPGP_BASE_VERSION "1.99.2" | |
62 | 62 | |||
63 | #define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]" | 63 | #define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]" | |
64 | #define NETPGP_VERSION_STRING \ | 64 | #define NETPGP_VERSION_STRING \ | |
65 | NETPGP_VERSION_CAT(NETPGP_BASE_VERSION, NETPGP_AUTOCONF_VERSION) | 65 | NETPGP_VERSION_CAT(NETPGP_BASE_VERSION, NETPGP_AUTOCONF_VERSION) | |
66 | 66 | |||
67 | #endif /* !VERSION_H_ */ | 67 | #endif /* !VERSION_H_ */ |
--- src/crypto/external/bsd/netpgp/dist/src/lib/create.c 2009/05/19 05:13:10 1.12
+++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c 2009/05/21 00:33:31 1.13
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | */ | 51 | */ | |
52 | #include "config.h" | 52 | #include "config.h" | |
53 | 53 | |||
54 | #ifdef HAVE_SYS_CDEFS_H | 54 | #ifdef HAVE_SYS_CDEFS_H | |
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if defined(__NetBSD__) | 58 | #if defined(__NetBSD__) | |
59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
60 | __RCSID("$NetBSD: create.c,v 1.12 2009/05/19 05:13:10 agc Exp $"); | 60 | __RCSID("$NetBSD: create.c,v 1.13 2009/05/21 00:33:31 agc Exp $"); | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | #include <sys/types.h> | 63 | #include <sys/types.h> | |
64 | #include <sys/param.h> | 64 | #include <sys/param.h> | |
65 | #include <sys/stat.h> | 65 | #include <sys/stat.h> | |
66 | #include <sys/mman.h> | 66 | #include <sys/mman.h> | |
67 | 67 | |||
68 | #ifdef HAVE_FCNTL_H | 68 | #ifdef HAVE_FCNTL_H | |
69 | #include <fcntl.h> | 69 | #include <fcntl.h> | |
70 | #endif | 70 | #endif | |
71 | 71 | |||
72 | #include <string.h> | 72 | #include <string.h> | |
73 | 73 | |||
@@ -93,27 +93,27 @@ __RCSID("$NetBSD: create.c,v 1.12 2009/0 | @@ -93,27 +93,27 @@ __RCSID("$NetBSD: create.c,v 1.12 2009/0 | |||
93 | * \param length | 93 | * \param length | |
94 | * \param type | 94 | * \param type | |
95 | * \param output | 95 | * \param output | |
96 | * \return 1 if OK, otherwise 0 | 96 | * \return 1 if OK, otherwise 0 | |
97 | */ | 97 | */ | |
98 | 98 | |||
99 | unsigned | 99 | unsigned | |
100 | __ops_write_ss_header(__ops_output_t *output, | 100 | __ops_write_ss_header(__ops_output_t *output, | |
101 | unsigned length, | 101 | unsigned length, | |
102 | __ops_content_tag_t type) | 102 | __ops_content_tag_t type) | |
103 | { | 103 | { | |
104 | return __ops_write_length(output, length) && | 104 | return __ops_write_length(output, length) && | |
105 | __ops_write_scalar(output, (unsigned)(type - | 105 | __ops_write_scalar(output, (unsigned)(type - | |
106 | OPS_PTAG_SIGNATURE_SUBPACKET_BASE), 1); | 106 | OPS_PTAG_SIG_SUBPKT_BASE), 1); | |
107 | } | 107 | } | |
108 | 108 | |||
109 | /* | 109 | /* | |
110 | * XXX: the general idea of _fast_ is that it doesn't copy stuff the safe | 110 | * XXX: the general idea of _fast_ is that it doesn't copy stuff the safe | |
111 | * (i.e. non _fast_) version will, and so will also need to be freed. | 111 | * (i.e. non _fast_) version will, and so will also need to be freed. | |
112 | */ | 112 | */ | |
113 | 113 | |||
114 | /** | 114 | /** | |
115 | * \ingroup Core_Create | 115 | * \ingroup Core_Create | |
116 | * | 116 | * | |
117 | * __ops_fast_create_userid() sets id->userid to the given userid. | 117 | * __ops_fast_create_userid() sets id->userid to the given userid. | |
118 | * This is fast because it is only copying a char*. However, if userid | 118 | * This is fast because it is only copying a char*. However, if userid | |
119 | * is changed or freed in the future, this could have injurious results. | 119 | * is changed or freed in the future, this could have injurious results. | |
@@ -1263,22 +1263,22 @@ __ops_write_symm_enc_data(const unsigned | @@ -1263,22 +1263,22 @@ __ops_write_symm_enc_data(const unsigned | |||
1263 | \param sig_type Signature type | 1263 | \param sig_type Signature type | |
1264 | \param output Write settings | 1264 | \param output Write settings | |
1265 | \return 1 if OK; else 0 | 1265 | \return 1 if OK; else 0 | |
1266 | */ | 1266 | */ | |
1267 | unsigned | 1267 | unsigned | |
1268 | __ops_write_one_pass_sig(__ops_output_t *output, | 1268 | __ops_write_one_pass_sig(__ops_output_t *output, | |
1269 | const __ops_seckey_t *seckey, | 1269 | const __ops_seckey_t *seckey, | |
1270 | const __ops_hash_alg_t hash_alg, | 1270 | const __ops_hash_alg_t hash_alg, | |
1271 | const __ops_sig_type_t sig_type) | 1271 | const __ops_sig_type_t sig_type) | |
1272 | { | 1272 | { | |
1273 | unsigned char keyid[OPS_KEY_ID_SIZE]; | 1273 | unsigned char keyid[OPS_KEY_ID_SIZE]; | |
1274 | 1274 | |||
1275 | __ops_keyid(keyid, OPS_KEY_ID_SIZE, OPS_KEY_ID_SIZE, &seckey->pubkey); | 1275 | __ops_keyid(keyid, OPS_KEY_ID_SIZE, OPS_KEY_ID_SIZE, &seckey->pubkey); | |
1276 | return __ops_write_ptag(output, OPS_PTAG_CT_ONE_PASS_SIGNATURE) && | 1276 | return __ops_write_ptag(output, OPS_PTAG_CT_1_PASS_SIG) && | |
1277 | __ops_write_length(output, 1 + 1 + 1 + 1 + 8 + 1) && | 1277 | __ops_write_length(output, 1 + 1 + 1 + 1 + 8 + 1) && | |
1278 | __ops_write_scalar(output, 3, 1) /* version */ && | 1278 | __ops_write_scalar(output, 3, 1) /* version */ && | |
1279 | __ops_write_scalar(output, (unsigned)sig_type, 1) && | 1279 | __ops_write_scalar(output, (unsigned)sig_type, 1) && | |
1280 | __ops_write_scalar(output, (unsigned)hash_alg, 1) && | 1280 | __ops_write_scalar(output, (unsigned)hash_alg, 1) && | |
1281 | __ops_write_scalar(output, (unsigned)seckey->pubkey.alg, 1) && | 1281 | __ops_write_scalar(output, (unsigned)seckey->pubkey.alg, 1) && | |
1282 | __ops_write(output, keyid, 8) && | 1282 | __ops_write(output, keyid, 8) && | |
1283 | __ops_write_scalar(output, 1, 1); | 1283 | __ops_write_scalar(output, 1, 1); | |
1284 | } | 1284 | } |
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c 2009/05/16 06:30:38 1.12
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c 2009/05/21 00:33:32 1.13
@@ -44,27 +44,27 @@ | @@ -44,27 +44,27 @@ | |||
44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
45 | * | 45 | * | |
46 | * See the License for the specific language governing permissions and | 46 | * See the License for the specific language governing permissions and | |
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | #include "config.h" | 49 | #include "config.h" | |
50 | 50 | |||
51 | #ifdef HAVE_SYS_CDEFS_H | 51 | #ifdef HAVE_SYS_CDEFS_H | |
52 | #include <sys/cdefs.h> | 52 | #include <sys/cdefs.h> | |
53 | #endif | 53 | #endif | |
54 | 54 | |||
55 | #if defined(__NetBSD__) | 55 | #if defined(__NetBSD__) | |
56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
57 | __RCSID("$NetBSD: reader.c,v 1.12 2009/05/16 06:30:38 agc Exp $"); | 57 | __RCSID("$NetBSD: reader.c,v 1.13 2009/05/21 00:33:32 agc Exp $"); | |
58 | #endif | 58 | #endif | |
59 | 59 | |||
60 | #include <sys/types.h> | 60 | #include <sys/types.h> | |
61 | #include <sys/stat.h> | 61 | #include <sys/stat.h> | |
62 | 62 | |||
63 | #ifdef HAVE_SYS_MMAN_H | 63 | #ifdef HAVE_SYS_MMAN_H | |
64 | #include <sys/mman.h> | 64 | #include <sys/mman.h> | |
65 | #endif | 65 | #endif | |
66 | 66 | |||
67 | #ifdef HAVE_SYS_PARAM_H | 67 | #ifdef HAVE_SYS_PARAM_H | |
68 | #include <sys/param.h> | 68 | #include <sys/param.h> | |
69 | #endif | 69 | #endif | |
70 | 70 | |||
@@ -2207,27 +2207,27 @@ __ops_malloc_passphrase(char *pp) | @@ -2207,27 +2207,27 @@ __ops_malloc_passphrase(char *pp) | |||
2207 | \param cbinfo | 2207 | \param cbinfo | |
2208 | */ | 2208 | */ | |
2209 | __ops_parse_cb_return_t | 2209 | __ops_parse_cb_return_t | |
2210 | get_passphrase_cb(const __ops_packet_t *pkt, __ops_callback_data_t *cbinfo) | 2210 | get_passphrase_cb(const __ops_packet_t *pkt, __ops_callback_data_t *cbinfo) | |
2211 | { | 2211 | { | |
2212 | const __ops_parser_content_union_t *content = &pkt->u; | 2212 | const __ops_parser_content_union_t *content = &pkt->u; | |
2213 | 2213 | |||
2214 | if (__ops_get_debug_level(__FILE__)) { | 2214 | if (__ops_get_debug_level(__FILE__)) { | |
2215 | __ops_print_packet(pkt); | 2215 | __ops_print_packet(pkt); | |
2216 | } | 2216 | } | |
2217 | if (cbinfo->cryptinfo.keydata == NULL) { | 2217 | if (cbinfo->cryptinfo.keydata == NULL) { | |
2218 | (void) fprintf(stderr, "get_passphrase_cb: NULL keydata\n"); | 2218 | (void) fprintf(stderr, "get_passphrase_cb: NULL keydata\n"); | |
2219 | } else { | 2219 | } else { | |
2220 | __ops_print_pubkeydata(cbinfo->cryptinfo.keydata); | 2220 | __ops_print_pubkeydata(stderr, cbinfo->cryptinfo.keydata); | |
2221 | } | 2221 | } | |
2222 | switch (pkt->tag) { | 2222 | switch (pkt->tag) { | |
2223 | case OPS_PARSER_CMD_GET_SK_PASSPHRASE: | 2223 | case OPS_PARSER_CMD_GET_SK_PASSPHRASE: | |
2224 | *(content->skey_passphrase.passphrase) = | 2224 | *(content->skey_passphrase.passphrase) = | |
2225 | __ops_malloc_passphrase(getpass("netpgp passphrase: ")); | 2225 | __ops_malloc_passphrase(getpass("netpgp passphrase: ")); | |
2226 | return OPS_KEEP_MEMORY; | 2226 | return OPS_KEEP_MEMORY; | |
2227 | default: | 2227 | default: | |
2228 | break; | 2228 | break; | |
2229 | } | 2229 | } | |
2230 | return OPS_RELEASE_MEMORY; | 2230 | return OPS_RELEASE_MEMORY; | |
2231 | } | 2231 | } | |
2232 | 2232 | |||
2233 | unsigned | 2233 | unsigned |
--- src/crypto/external/bsd/netpgp/dist/src/lib/validate.c 2009/05/19 05:13:10 1.12
+++ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c 2009/05/21 00:33:32 1.13
@@ -44,59 +44,67 @@ | @@ -44,59 +44,67 @@ | |||
44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
45 | * | 45 | * | |
46 | * See the License for the specific language governing permissions and | 46 | * See the License for the specific language governing permissions and | |
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | #include "config.h" | 49 | #include "config.h" | |
50 | 50 | |||
51 | #ifdef HAVE_SYS_CDEFS_H | 51 | #ifdef HAVE_SYS_CDEFS_H | |
52 | #include <sys/cdefs.h> | 52 | #include <sys/cdefs.h> | |
53 | #endif | 53 | #endif | |
54 | 54 | |||
55 | #if defined(__NetBSD__) | 55 | #if defined(__NetBSD__) | |
56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
57 | __RCSID("$NetBSD: validate.c,v 1.12 2009/05/19 05:13:10 agc Exp $"); | 57 | __RCSID("$NetBSD: validate.c,v 1.13 2009/05/21 00:33:32 agc Exp $"); | |
58 | #endif | 58 | #endif | |
59 | 59 | |||
60 | #include <sys/types.h> | 60 | #include <sys/types.h> | |
61 | #include <sys/param.h> | 61 | #include <sys/param.h> | |
62 | #include <sys/stat.h> | 62 | #include <sys/stat.h> | |
63 | 63 | |||
64 | #include <string.h> | 64 | #include <string.h> | |
65 | #include <stdio.h> | 65 | #include <stdio.h> | |
66 | 66 | |||
67 | #ifdef HAVE_UNISTD_H | 67 | #ifdef HAVE_UNISTD_H | |
68 | #include <unistd.h> | 68 | #include <unistd.h> | |
69 | #endif | 69 | #endif | |
70 | 70 | |||
71 | #ifdef HAVE_FCNTL_H | |||
72 | #include <fcntl.h> | |||
73 | #endif | |||
74 | ||||
71 | #include "packet-parse.h" | 75 | #include "packet-parse.h" | |
72 | #include "packet-show.h" | 76 | #include "packet-show.h" | |
73 | #include "keyring.h" | 77 | #include "keyring.h" | |
74 | #include "signature.h" | 78 | #include "signature.h" | |
75 | #include "netpgpsdk.h" | 79 | #include "netpgpsdk.h" | |
76 | #include "readerwriter.h" | 80 | #include "readerwriter.h" | |
77 | #include "netpgpdefs.h" | 81 | #include "netpgpdefs.h" | |
78 | #include "memory.h" | 82 | #include "memory.h" | |
79 | #include "packet.h" | 83 | #include "packet.h" | |
80 | #include "crypto.h" | 84 | #include "crypto.h" | |
81 | #include "validate.h" | 85 | #include "validate.h" | |
82 | 86 | |||
87 | #ifdef HAVE_FCNTL_H | |||
88 | #include <fcntl.h> | |||
89 | #endif | |||
90 | ||||
83 | 91 | |||
84 | /* Does the signed hash match the given hash? */ | 92 | /* Does the signed hash match the given hash? */ | |
85 | static unsigned | 93 | static unsigned | |
86 | check_binary_sig(const unsigned len, | 94 | check_binary_sig(const unsigned len, | |
87 | const unsigned char *data, | 95 | const unsigned char *data, | |
88 | const __ops_sig_t *sig, | 96 | const __ops_sig_t *sig, | |
89 | const __ops_pubkey_t *signer) | 97 | const __ops_pubkey_t *signer) | |
90 | { | 98 | { | |
91 | unsigned char hashout[OPS_MAX_HASH_SIZE]; | 99 | unsigned char hashout[OPS_MAX_HASH_SIZE]; | |
92 | unsigned char trailer[6]; | 100 | unsigned char trailer[6]; | |
93 | unsigned int hashedlen; | 101 | unsigned int hashedlen; | |
94 | __ops_hash_t hash; | 102 | __ops_hash_t hash; | |
95 | unsigned n = 0; | 103 | unsigned n = 0; | |
96 | 104 | |||
97 | __OPS_USED(signer); | 105 | __OPS_USED(signer); | |
98 | __ops_hash_any(&hash, sig->info.hash_alg); | 106 | __ops_hash_any(&hash, sig->info.hash_alg); | |
99 | hash.init(&hash); | 107 | hash.init(&hash); | |
100 | hash.add(&hash, data, len); | 108 | hash.add(&hash, data, len); | |
101 | switch (sig->info.version) { | 109 | switch (sig->info.version) { | |
102 | case OPS_V3: | 110 | case OPS_V3: | |
@@ -108,31 +116,31 @@ check_binary_sig(const unsigned len, | @@ -108,31 +116,31 @@ check_binary_sig(const unsigned len, | |||
108 | hash.add(&hash, &trailer[0], 5); | 116 | hash.add(&hash, &trailer[0], 5); | |
109 | break; | 117 | break; | |
110 | 118 | |||
111 | case OPS_V4: | 119 | case OPS_V4: | |
112 | hash.add(&hash, sig->info.v4_hashed_data, | 120 | hash.add(&hash, sig->info.v4_hashed_data, | |
113 | sig->info.v4_hashed_data_length); | 121 | sig->info.v4_hashed_data_length); | |
114 | trailer[0] = 0x04; /* version */ | 122 | trailer[0] = 0x04; /* version */ | |
115 | trailer[1] = 0xFF; | 123 | trailer[1] = 0xFF; | |
116 | hashedlen = sig->info.v4_hashed_data_length; | 124 | hashedlen = sig->info.v4_hashed_data_length; | |
117 | trailer[2] = hashedlen >> 24; | 125 | trailer[2] = hashedlen >> 24; | |
118 | trailer[3] = hashedlen >> 16; | 126 | trailer[3] = hashedlen >> 16; | |
119 | trailer[4] = hashedlen >> 8; | 127 | trailer[4] = hashedlen >> 8; | |
120 | trailer[5] = hashedlen; | 128 | trailer[5] = hashedlen; | |
121 | hash.add(&hash, &trailer[0], 6); | 129 | hash.add(&hash, trailer, 6); | |
122 | break; | 130 | break; | |
123 | 131 | |||
124 | default: | 132 | default: | |
125 | fprintf(stderr, "Invalid signature version %d\n", | 133 | (void) fprintf(stderr, "Invalid signature version %d\n", | |
126 | sig->info.version); | 134 | sig->info.version); | |
127 | return 0; | 135 | return 0; | |
128 | } | 136 | } | |
129 | 137 | |||
130 | n = hash.finish(&hash, hashout); | 138 | n = hash.finish(&hash, hashout); | |
131 | if (__ops_get_debug_level(__FILE__)) { | 139 | if (__ops_get_debug_level(__FILE__)) { | |
132 | printf("check_binary_sig: hash length %" PRIsize "u\n", | 140 | printf("check_binary_sig: hash length %" PRIsize "u\n", | |
133 | hash.size); | 141 | hash.size); | |
134 | } | 142 | } | |
135 | return __ops_check_sig(hashout, n, sig, signer); | 143 | return __ops_check_sig(hashout, n, sig, signer); | |
136 | } | 144 | } | |
137 | 145 | |||
138 | static int | 146 | static int | |
@@ -235,27 +243,27 @@ __ops_validate_key_cb(const __ops_packet | @@ -235,27 +243,27 @@ __ops_validate_key_cb(const __ops_packet | |||
235 | 243 | |||
236 | case OPS_PTAG_CT_SECRET_KEY: | 244 | case OPS_PTAG_CT_SECRET_KEY: | |
237 | key->seckey = content->seckey; | 245 | key->seckey = content->seckey; | |
238 | key->pubkey = key->seckey.pubkey; | 246 | key->pubkey = key->seckey.pubkey; | |
239 | return OPS_KEEP_MEMORY; | 247 | return OPS_KEEP_MEMORY; | |
240 | 248 | |||
241 | case OPS_PTAG_CT_USER_ID: | 249 | case OPS_PTAG_CT_USER_ID: | |
242 | if (key->userid.userid) | 250 | if (key->userid.userid) | |
243 | __ops_userid_free(&key->userid); | 251 | __ops_userid_free(&key->userid); | |
244 | key->userid = content->userid; | 252 | key->userid = content->userid; | |
245 | key->last_seen = ID; | 253 | key->last_seen = ID; | |
246 | return OPS_KEEP_MEMORY; | 254 | return OPS_KEEP_MEMORY; | |
247 | 255 | |||
248 | case OPS_PTAG_CT_USER_ATTRIBUTE: | 256 | case OPS_PTAG_CT_USER_ATTR: | |
249 | if (content->userattr.data.len == 0) { | 257 | if (content->userattr.data.len == 0) { | |
250 | (void) fprintf(stderr, | 258 | (void) fprintf(stderr, | |
251 | "__ops_validate_key_cb: user attribute length 0"); | 259 | "__ops_validate_key_cb: user attribute length 0"); | |
252 | return OPS_FINISHED; | 260 | return OPS_FINISHED; | |
253 | } | 261 | } | |
254 | printf("user attribute, length=%d\n", | 262 | printf("user attribute, length=%d\n", | |
255 | (int) content->userattr.data.len); | 263 | (int) content->userattr.data.len); | |
256 | if (key->userattr.data.len) | 264 | if (key->userattr.data.len) | |
257 | __ops_userattr_free(&key->userattr); | 265 | __ops_userattr_free(&key->userattr); | |
258 | key->userattr = content->userattr; | 266 | key->userattr = content->userattr; | |
259 | key->last_seen = ATTRIBUTE; | 267 | key->last_seen = ATTRIBUTE; | |
260 | return OPS_KEEP_MEMORY; | 268 | return OPS_KEEP_MEMORY; | |
261 | 269 | |||
@@ -410,27 +418,27 @@ validate_data_cb(const __ops_packet_t *p | @@ -410,27 +418,27 @@ validate_data_cb(const __ops_packet_t *p | |||
410 | if (__ops_get_debug_level(__FILE__)) { | 418 | if (__ops_get_debug_level(__FILE__)) { | |
411 | unsigned i = 0; | 419 | unsigned i = 0; | |
412 | 420 | |||
413 | printf("\n*** hashed data:\n"); | 421 | printf("\n*** hashed data:\n"); | |
414 | for (i = 0; | 422 | for (i = 0; | |
415 | i < content->sig.info.v4_hashed_data_length; | 423 | i < content->sig.info.v4_hashed_data_length; | |
416 | i++) { | 424 | i++) { | |
417 | printf("0x%02x ", | 425 | printf("0x%02x ", | |
418 | content->sig.info.v4_hashed_data[i]); | 426 | content->sig.info.v4_hashed_data[i]); | |
419 | } | 427 | } | |
420 | printf("\n"); | 428 | printf("\n"); | |
421 | printf(" type=%02x signer_id=", | 429 | printf(" type=%02x signer_id=", | |
422 | content->sig.info.type); | 430 | content->sig.info.type); | |
423 | hexdump(content->sig.info.signer_id, | 431 | hexdump(stdout, content->sig.info.signer_id, | |
424 | sizeof(content->sig.info.signer_id), ""); | 432 | sizeof(content->sig.info.signer_id), ""); | |
425 | printf("\n"); | 433 | printf("\n"); | |
426 | } | 434 | } | |
427 | signer = __ops_keyring_find_key_by_id(data->keyring, | 435 | signer = __ops_keyring_find_key_by_id(data->keyring, | |
428 | content->sig.info.signer_id); | 436 | content->sig.info.signer_id); | |
429 | if (!signer) { | 437 | if (!signer) { | |
430 | OPS_ERROR(errors, OPS_E_V_UNKNOWN_SIGNER, | 438 | OPS_ERROR(errors, OPS_E_V_UNKNOWN_SIGNER, | |
431 | "Unknown Signer"); | 439 | "Unknown Signer"); | |
432 | add_sig_to_list(&content->sig.info, | 440 | add_sig_to_list(&content->sig.info, | |
433 | &data->result->unknown_sigs, | 441 | &data->result->unknown_sigs, | |
434 | &data->result->unknownc); | 442 | &data->result->unknownc); | |
435 | break; | 443 | break; | |
436 | } | 444 | } | |
@@ -451,47 +459,45 @@ validate_data_cb(const __ops_packet_t *p | @@ -451,47 +459,45 @@ validate_data_cb(const __ops_packet_t *p | |||
451 | __ops_mem_data(data->mem), | 459 | __ops_mem_data(data->mem), | |
452 | &content->sig, | 460 | &content->sig, | |
453 | __ops_get_pubkey(signer)); | 461 | __ops_get_pubkey(signer)); | |
454 | break; | 462 | break; | |
455 | 463 | |||
456 | default: | 464 | default: | |
457 | OPS_ERROR_1(errors, OPS_E_UNIMPLEMENTED, | 465 | OPS_ERROR_1(errors, OPS_E_UNIMPLEMENTED, | |
458 | "No Sig Verification type 0x%02x yet\n", | 466 | "No Sig Verification type 0x%02x yet\n", | |
459 | content->sig.info.type); | 467 | content->sig.info.type); | |
460 | break; | 468 | break; | |
461 | 469 | |||
462 | } | 470 | } | |
463 | 471 | |||
464 | __ops_memory_free(data->mem); | |||
465 | ||||
466 | if (valid) { | 472 | if (valid) { | |
467 | add_sig_to_list(&content->sig.info, | 473 | add_sig_to_list(&content->sig.info, | |
468 | &data->result->valid_sigs, | 474 | &data->result->valid_sigs, | |
469 | &data->result->validc); | 475 | &data->result->validc); | |
470 | } else { | 476 | } else { | |
471 | OPS_ERROR(errors, OPS_E_V_BAD_SIGNATURE, | 477 | OPS_ERROR(errors, OPS_E_V_BAD_SIGNATURE, | |
472 | "Bad Signature"); | 478 | "Bad Signature"); | |
473 | add_sig_to_list(&content->sig.info, | 479 | add_sig_to_list(&content->sig.info, | |
474 | &data->result->invalid_sigs, | 480 | &data->result->invalid_sigs, | |
475 | &data->result->invalidc); | 481 | &data->result->invalidc); | |
476 | } | 482 | } | |
477 | break; | 483 | break; | |
478 | 484 | |||
479 | /* ignore these */ | 485 | /* ignore these */ | |
480 | case OPS_PARSER_PTAG: | 486 | case OPS_PARSER_PTAG: | |
481 | case OPS_PTAG_CT_SIGNATURE_HEADER: | 487 | case OPS_PTAG_CT_SIGNATURE_HEADER: | |
482 | case OPS_PTAG_CT_ARMOUR_HEADER: | 488 | case OPS_PTAG_CT_ARMOUR_HEADER: | |
483 | case OPS_PTAG_CT_ARMOUR_TRAILER: | 489 | case OPS_PTAG_CT_ARMOUR_TRAILER: | |
484 | case OPS_PTAG_CT_ONE_PASS_SIGNATURE: | 490 | case OPS_PTAG_CT_1_PASS_SIG: | |
485 | break; | 491 | break; | |
486 | 492 | |||
487 | case OPS_PARSER_PACKET_END: | 493 | case OPS_PARSER_PACKET_END: | |
488 | break; | 494 | break; | |
489 | 495 | |||
490 | default: | 496 | default: | |
491 | OPS_ERROR(errors, OPS_E_V_NO_SIGNATURE, "No signature"); | 497 | OPS_ERROR(errors, OPS_E_V_NO_SIGNATURE, "No signature"); | |
492 | break; | 498 | break; | |
493 | } | 499 | } | |
494 | return OPS_RELEASE_MEMORY; | 500 | return OPS_RELEASE_MEMORY; | |
495 | } | 501 | } | |
496 | 502 | |||
497 | static void | 503 | static void | |
@@ -639,28 +645,28 @@ __ops_validate_result_free(__ops_validat | @@ -639,28 +645,28 @@ __ops_validate_result_free(__ops_validat | |||
639 | \note It is the caller's responsiblity to call | 645 | \note It is the caller's responsiblity to call | |
640 | __ops_validate_result_free(result) after use. | 646 | __ops_validate_result_free(result) after use. | |
641 | */ | 647 | */ | |
642 | unsigned | 648 | unsigned | |
643 | __ops_validate_file(__ops_validation_t *result, | 649 | __ops_validate_file(__ops_validation_t *result, | |
644 | const char *infile, | 650 | const char *infile, | |
645 | const char *outfile, | 651 | const char *outfile, | |
646 | const int armoured, | 652 | const int armoured, | |
647 | const __ops_keyring_t *keyring) | 653 | const __ops_keyring_t *keyring) | |
648 | { | 654 | { | |
649 | validate_data_cb_t validation; | 655 | validate_data_cb_t validation; | |
650 | __ops_parseinfo_t *parse = NULL; | 656 | __ops_parseinfo_t *parse = NULL; | |
651 | struct stat st; | 657 | struct stat st; | |
658 | unsigned ret; | |||
652 | int64_t sigsize; | 659 | int64_t sigsize; | |
653 | char *filename; | |||
654 | char origfile[MAXPATHLEN]; | 660 | char origfile[MAXPATHLEN]; | |
655 | char *detachname; | 661 | char *detachname; | |
656 | int outfd = 0; | 662 | int outfd = 0; | |
657 | int infd; | 663 | int infd; | |
658 | int cc; | 664 | int cc; | |
659 | 665 | |||
660 | #define SIG_OVERHEAD 284 /* XXX - depends on sig size? */ | 666 | #define SIG_OVERHEAD 284 /* XXX - depends on sig size? */ | |
661 | 667 | |||
662 | if (stat(infile, &st) < 0) { | 668 | if (stat(infile, &st) < 0) { | |
663 | (void) fprintf(stderr, "can't validate \"%s\"\n", infile); | 669 | (void) fprintf(stderr, "can't validate \"%s\"\n", infile); | |
664 | return 0; | 670 | return 0; | |
665 | } | 671 | } | |
666 | sigsize = st.st_size; | 672 | sigsize = st.st_size; | |
@@ -674,62 +680,86 @@ __ops_validate_file(__ops_validation_t * | @@ -674,62 +680,86 @@ __ops_validate_file(__ops_validation_t * | |||
674 | } | 680 | } | |
675 | } | 681 | } | |
676 | 682 | |||
677 | (void) memset(&validation, 0x0, sizeof(validation)); | 683 | (void) memset(&validation, 0x0, sizeof(validation)); | |
678 | 684 | |||
679 | infd = __ops_setup_file_read(&parse, infile, &validation, | 685 | infd = __ops_setup_file_read(&parse, infile, &validation, | |
680 | validate_data_cb, 1); | 686 | validate_data_cb, 1); | |
681 | if (infd < 0) { | 687 | if (infd < 0) { | |
682 | return 0; | 688 | return 0; | |
683 | } | 689 | } | |
684 | 690 | |||
685 | validation.detachname = detachname; | 691 | validation.detachname = detachname; | |
686 | 692 | |||
687 | /* setup output filename */ | |||
688 | filename = NULL; | |||
689 | if (outfile) { | |||
690 | if (strcmp(outfile, "-") == 0) { | |||
691 | outfile = NULL; | |||
692 | } | |||
693 | outfd = __ops_setup_file_write(&parse->cbinfo.output, NULL, 0); | |||
694 | if (outfd < 0) { | |||
695 | __ops_teardown_file_read(parse, infd); | |||
696 | return 0; | |||
697 | } | |||
698 | } | |||
699 | ||||
700 | /* Set verification reader and handling options */ | 693 | /* Set verification reader and handling options */ | |
701 | validation.result = result; | 694 | validation.result = result; | |
702 | validation.keyring = keyring; | 695 | validation.keyring = keyring; | |
703 | validation.mem = __ops_memory_new(); | 696 | validation.mem = __ops_memory_new(); | |
704 | __ops_memory_init(validation.mem, 128); | 697 | __ops_memory_init(validation.mem, 128); | |
705 | /* Note: Coverity incorrectly reports an error that validation.reader */ | 698 | /* Note: Coverity incorrectly reports an error that validation.reader */ | |
706 | /* is never used. */ | 699 | /* is never used. */ | |
707 | validation.reader = parse->readinfo.arg; | 700 | validation.reader = parse->readinfo.arg; | |
708 | 701 | |||
709 | if (armoured) { | 702 | if (armoured) { | |
710 | __ops_reader_push_dearmour(parse); | 703 | __ops_reader_push_dearmour(parse); | |
711 | } | 704 | } | |
712 | 705 | |||
713 | /* Do the verification */ | 706 | /* Do the verification */ | |
714 | __ops_parse(parse, 0); | 707 | __ops_parse(parse, 0); | |
715 | 708 | |||
716 | /* Tidy up */ | 709 | /* Tidy up */ | |
717 | if (armoured) { | 710 | if (armoured) { | |
718 | __ops_reader_pop_dearmour(parse); | 711 | __ops_reader_pop_dearmour(parse); | |
719 | } | 712 | } | |
720 | __ops_teardown_file_read(parse, infd); | 713 | __ops_teardown_file_read(parse, infd); | |
721 | 714 | |||
722 | return validate_result_status(result); | 715 | ret = validate_result_status(result); | |
716 | ||||
717 | /* this is triggered only for --cat output */ | |||
718 | if (outfile) { | |||
719 | /* need to send validated output somewhere */ | |||
720 | if (strcmp(outfile, "-") == 0) { | |||
721 | outfd = STDOUT_FILENO; | |||
722 | } else { | |||
723 | outfd = open(outfile, O_WRONLY | O_CREAT, 0666); | |||
724 | } | |||
725 | if (outfd < 0) { | |||
726 | /* even if the signature was good, we can't | |||
727 | * write the file, so send back a bad return | |||
728 | * code */ | |||
729 | ret = 0; | |||
730 | } else if (validate_result_status(result)) { | |||
731 | unsigned len; | |||
732 | char *cp; | |||
733 | int i; | |||
734 | ||||
735 | len = __ops_mem_len(validation.mem); | |||
736 | cp = __ops_mem_data(validation.mem); | |||
737 | for (i = 0 ; i < (int)len ; i += cc) { | |||
738 | cc = write(outfd, &cp[i], len - i); | |||
739 | if (cc < 0) { | |||
740 | (void) fprintf(stderr, | |||
741 | "netpgp: short write\n"); | |||
742 | ret = 0; | |||
743 | break; | |||
744 | } | |||
745 | } | |||
746 | if (strcmp(outfile, "-") != 0) { | |||
747 | (void) close(outfd); | |||
748 | } | |||
749 | } | |||
750 | } | |||
751 | __ops_memory_free(validation.mem); | |||
752 | return ret; | |||
723 | } | 753 | } | |
724 | 754 | |||
725 | /** | 755 | /** | |
726 | \ingroup HighLevel_Verify | 756 | \ingroup HighLevel_Verify | |
727 | \brief Verifies the signatures in a __ops_memory_t struct | 757 | \brief Verifies the signatures in a __ops_memory_t struct | |
728 | \param result Where to put the result | 758 | \param result Where to put the result | |
729 | \param mem Memory to be validated | 759 | \param mem Memory to be validated | |
730 | \param armoured Treat data as armoured, if set | 760 | \param armoured Treat data as armoured, if set | |
731 | \param keyring Keyring to use | 761 | \param keyring Keyring to use | |
732 | \return 1 if signature validates successfully; 0 if not | 762 | \return 1 if signature validates successfully; 0 if not | |
733 | \note After verification, result holds the details of all keys which | 763 | \note After verification, result holds the details of all keys which | |
734 | have passed, failed and not been recognised. | 764 | have passed, failed and not been recognised. | |
735 | \note It is the caller's responsiblity to call | 765 | \note It is the caller's responsiblity to call | |
@@ -759,16 +789,17 @@ __ops_validate_mem(__ops_validation_t *r | @@ -759,16 +789,17 @@ __ops_validate_mem(__ops_validation_t *r | |||
759 | 789 | |||
760 | if (armoured) { | 790 | if (armoured) { | |
761 | __ops_reader_push_dearmour(pinfo); | 791 | __ops_reader_push_dearmour(pinfo); | |
762 | } | 792 | } | |
763 | 793 | |||
764 | /* Do the verification */ | 794 | /* Do the verification */ | |
765 | __ops_parse(pinfo, 0); | 795 | __ops_parse(pinfo, 0); | |
766 | 796 | |||
767 | /* Tidy up */ | 797 | /* Tidy up */ | |
768 | if (armoured) { | 798 | if (armoured) { | |
769 | __ops_reader_pop_dearmour(pinfo); | 799 | __ops_reader_pop_dearmour(pinfo); | |
770 | } | 800 | } | |
771 | __ops_teardown_memory_read(pinfo, mem); | 801 | __ops_teardown_memory_read(pinfo, mem); | |
802 | __ops_memory_free(validation.mem); | |||
772 | 803 | |||
773 | return validate_result_status(result); | 804 | return validate_result_status(result); | |
774 | } | 805 | } |
--- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c 2009/05/19 05:13:10 1.11
+++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c 2009/05/21 00:33:31 1.12
@@ -44,27 +44,27 @@ | @@ -44,27 +44,27 @@ | |||
44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 44 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
45 | * | 45 | * | |
46 | * See the License for the specific language governing permissions and | 46 | * See the License for the specific language governing permissions and | |
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | #include "config.h" | 49 | #include "config.h" | |
50 | 50 | |||
51 | #ifdef HAVE_SYS_CDEFS_H | 51 | #ifdef HAVE_SYS_CDEFS_H | |
52 | #include <sys/cdefs.h> | 52 | #include <sys/cdefs.h> | |
53 | #endif | 53 | #endif | |
54 | 54 | |||
55 | #if defined(__NetBSD__) | 55 | #if defined(__NetBSD__) | |
56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 56 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
57 | __RCSID("$NetBSD: crypto.c,v 1.11 2009/05/19 05:13:10 agc Exp $"); | 57 | __RCSID("$NetBSD: crypto.c,v 1.12 2009/05/21 00:33:31 agc Exp $"); | |
58 | #endif | 58 | #endif | |
59 | 59 | |||
60 | #include <sys/types.h> | 60 | #include <sys/types.h> | |
61 | #include <sys/stat.h> | 61 | #include <sys/stat.h> | |
62 | 62 | |||
63 | #ifdef HAVE_FCNTL_H | 63 | #ifdef HAVE_FCNTL_H | |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> | |
65 | #endif | 65 | #endif | |
66 | 66 | |||
67 | #ifdef HAVE_UNISTD_H | 67 | #ifdef HAVE_UNISTD_H | |
68 | #include <unistd.h> | 68 | #include <unistd.h> | |
69 | #endif | 69 | #endif | |
70 | 70 | |||
@@ -130,27 +130,27 @@ __ops_decrypt_decode_mpi(unsigned char * | @@ -130,27 +130,27 @@ __ops_decrypt_decode_mpi(unsigned char * | |||
130 | if (__ops_get_debug_level(__FILE__)) { | 130 | if (__ops_get_debug_level(__FILE__)) { | |
131 | (void) fprintf(stderr, "decrypted encoded m buf : "); | 131 | (void) fprintf(stderr, "decrypted encoded m buf : "); | |
132 | for (i = 0; i < 16; i++) { | 132 | for (i = 0; i < 16; i++) { | |
133 | (void) fprintf(stderr, "%2x ", mpibuf[i]); | 133 | (void) fprintf(stderr, "%2x ", mpibuf[i]); | |
134 | } | 134 | } | |
135 | (void) fprintf(stderr, "\n"); | 135 | (void) fprintf(stderr, "\n"); | |
136 | } | 136 | } | |
137 | if (n <= 0) { | 137 | if (n <= 0) { | |
138 | return -1; | 138 | return -1; | |
139 | } | 139 | } | |
140 | 140 | |||
141 | if (__ops_get_debug_level(__FILE__)) { | 141 | if (__ops_get_debug_level(__FILE__)) { | |
142 | printf(" decrypted=%d ", n); | 142 | printf(" decrypted=%d ", n); | |
143 | hexdump(mpibuf, (unsigned)n, ""); | 143 | hexdump(stdout, mpibuf, (unsigned)n, ""); | |
144 | printf("\n"); | 144 | printf("\n"); | |
145 | } | 145 | } | |
146 | /* Decode EME-PKCS1_V1_5 (RFC 2437). */ | 146 | /* Decode EME-PKCS1_V1_5 (RFC 2437). */ | |
147 | 147 | |||
148 | if (mpibuf[0] != 0 || mpibuf[1] != 2) { | 148 | if (mpibuf[0] != 0 || mpibuf[1] != 2) { | |
149 | return -1; | 149 | return -1; | |
150 | } | 150 | } | |
151 | 151 | |||
152 | /* Skip the random bytes. */ | 152 | /* Skip the random bytes. */ | |
153 | for (i = 2; i < n && mpibuf[i]; ++i) { | 153 | for (i = 2; i < n && mpibuf[i]; ++i) { | |
154 | } | 154 | } | |
155 | 155 | |||
156 | if (i == n || i < 10) { | 156 | if (i == n || i < 10) { |
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c 2009/05/19 05:13:10 1.11
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c 2009/05/21 00:33:31 1.12
@@ -48,27 +48,27 @@ | @@ -48,27 +48,27 @@ | |||
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /* | 50 | /* | |
51 | * ! \file \brief Standard API print functions | 51 | * ! \file \brief Standard API print functions | |
52 | */ | 52 | */ | |
53 | #include "config.h" | 53 | #include "config.h" | |
54 | 54 | |||
55 | #ifdef HAVE_SYS_CDEFS_H | 55 | #ifdef HAVE_SYS_CDEFS_H | |
56 | #include <sys/cdefs.h> | 56 | #include <sys/cdefs.h> | |
57 | #endif | 57 | #endif | |
58 | 58 | |||
59 | #if defined(__NetBSD__) | 59 | #if defined(__NetBSD__) | |
60 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 60 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
61 | __RCSID("$NetBSD: packet-print.c,v 1.11 2009/05/19 05:13:10 agc Exp $"); | 61 | __RCSID("$NetBSD: packet-print.c,v 1.12 2009/05/21 00:33:31 agc Exp $"); | |
62 | #endif | 62 | #endif | |
63 | 63 | |||
64 | #include <string.h> | 64 | #include <string.h> | |
65 | #include <stdio.h> | 65 | #include <stdio.h> | |
66 | 66 | |||
67 | #ifdef HAVE_UNISTD_H | 67 | #ifdef HAVE_UNISTD_H | |
68 | #include <unistd.h> | 68 | #include <unistd.h> | |
69 | #endif | 69 | #endif | |
70 | 70 | |||
71 | #include "crypto.h" | 71 | #include "crypto.h" | |
72 | #include "keyring.h" | 72 | #include "keyring.h" | |
73 | #include "packet-show.h" | 73 | #include "packet-show.h" | |
74 | #include "signature.h" | 74 | #include "signature.h" | |
@@ -141,52 +141,42 @@ showtime(const char *name, time_t t) | @@ -141,52 +141,42 @@ showtime(const char *name, time_t t) | |||
141 | printf("%s=%" PRItime "d (%.24s)", name, (long long) t, ctime(&t)); | 141 | printf("%s=%" PRItime "d (%.24s)", name, (long long) t, ctime(&t)); | |
142 | } | 142 | } | |
143 | 143 | |||
144 | static void | 144 | static void | |
145 | print_time(const char *name, time_t t) | 145 | print_time(const char *name, time_t t) | |
146 | { | 146 | { | |
147 | print_indent(); | 147 | print_indent(); | |
148 | printf("%s: ", name); | 148 | printf("%s: ", name); | |
149 | showtime("time", t); | 149 | showtime("time", t); | |
150 | printf("\n"); | 150 | printf("\n"); | |
151 | } | 151 | } | |
152 | 152 | |||
153 | static void | 153 | static void | |
154 | showtime_short(time_t t) | 154 | print_time_short(FILE *fp, time_t t) | |
155 | { | 155 | { | |
156 | struct tm *tm; | 156 | struct tm *tm; | |
157 | 157 | |||
158 | tm = gmtime(&t); | 158 | tm = gmtime(&t); | |
159 | printf("%04d-%02d-%02d", | 159 | (void) fprintf(fp, "%04d-%02d-%02d", | |
160 | tm->tm_year + 1900, | 160 | tm->tm_year + 1900, | |
161 | tm->tm_mon + 1, | 161 | tm->tm_mon + 1, | |
162 | tm->tm_mday); | 162 | tm->tm_mday); | |
163 | } | 163 | } | |
164 | 164 | |||
165 | static void | 165 | static void | |
166 | print_time_short(time_t t) | 166 | print_string_and_value(const char *name, const char *str, unsigned char value) | |
167 | { | |||
168 | showtime_short(t); | |||
169 | } | |||
170 | ||||
171 | static void | |||
172 | print_string_and_value(const char *name, const char *str, | |||
173 | unsigned char value) | |||
174 | { | 167 | { | |
175 | print_name(name); | 168 | print_name(name); | |
176 | 169 | printf("%s (0x%x)\n", str, value); | ||
177 | printf("%s", str); | |||
178 | printf(" (0x%x)", value); | |||
179 | printf("\n"); | |||
180 | } | 170 | } | |
181 | 171 | |||
182 | static void | 172 | static void | |
183 | print_tagname(const char *str) | 173 | print_tagname(const char *str) | |
184 | { | 174 | { | |
185 | print_indent(); | 175 | print_indent(); | |
186 | printf("%s packet\n", str); | 176 | printf("%s packet\n", str); | |
187 | } | 177 | } | |
188 | 178 | |||
189 | static void | 179 | static void | |
190 | print_data(const char *name, const __ops_data_t * data) | 180 | print_data(const char *name, const __ops_data_t * data) | |
191 | { | 181 | { | |
192 | print_hexdump(name, data->contents, data->len); | 182 | print_hexdump(name, data->contents, data->len); | |
@@ -209,27 +199,27 @@ print_bn(const char *name, const BIGNUM | @@ -209,27 +199,27 @@ print_bn(const char *name, const BIGNUM | |||
209 | static void | 199 | static void | |
210 | print_packet_hex(const __ops_subpacket_t *pkt) | 200 | print_packet_hex(const __ops_subpacket_t *pkt) | |
211 | { | 201 | { | |
212 | unsigned char *cur; | 202 | unsigned char *cur; | |
213 | unsigned rem; | 203 | unsigned rem; | |
214 | unsigned blksz = 4; | 204 | unsigned blksz = 4; | |
215 | int i; | 205 | int i; | |
216 | 206 | |||
217 | printf("\nhexdump of packet contents follows:\n"); | 207 | printf("\nhexdump of packet contents follows:\n"); | |
218 | for (i = 1, cur = pkt->raw; | 208 | for (i = 1, cur = pkt->raw; | |
219 | cur < (pkt->raw + pkt->length); | 209 | cur < (pkt->raw + pkt->length); | |
220 | cur += blksz, i++) { | 210 | cur += blksz, i++) { | |
221 | rem = pkt->raw + pkt->length - cur; | 211 | rem = pkt->raw + pkt->length - cur; | |
222 | hexdump(cur, (rem <= blksz) ? rem : blksz, ""); | 212 | hexdump(stdout, cur, (rem <= blksz) ? rem : blksz, ""); | |
223 | printf(" "); | 213 | printf(" "); | |
224 | if (i % 8 == 0) { | 214 | if (i % 8 == 0) { | |
225 | printf("\n"); | 215 | printf("\n"); | |
226 | } | 216 | } | |
227 | 217 | |||
228 | } | 218 | } | |
229 | printf("\n"); | 219 | printf("\n"); | |
230 | } | 220 | } | |
231 | 221 | |||
232 | static void | 222 | static void | |
233 | print_escaped(const unsigned char *data, size_t length) | 223 | print_escaped(const unsigned char *data, size_t length) | |
234 | { | 224 | { | |
235 | while (length-- > 0) { | 225 | while (length-- > 0) { | |
@@ -384,42 +374,42 @@ numkeybits(const __ops_pubkey_t *pubkey) | @@ -384,42 +374,42 @@ numkeybits(const __ops_pubkey_t *pubkey) | |||
384 | default: | 374 | default: | |
385 | return -1; | 375 | return -1; | |
386 | } | 376 | } | |
387 | } | 377 | } | |
388 | 378 | |||
389 | /** | 379 | /** | |
390 | \ingroup Core_Print | 380 | \ingroup Core_Print | |
391 | 381 | |||
392 | Prints a public key in succinct detail | 382 | Prints a public key in succinct detail | |
393 | 383 | |||
394 | \param key Ptr to public key | 384 | \param key Ptr to public key | |
395 | */ | 385 | */ | |
396 | void | 386 | void | |
397 | __ops_print_pubkeydata(const __ops_keydata_t * key) | 387 | __ops_print_pubkeydata(FILE *fp, const __ops_keydata_t * key) | |
398 | { | 388 | { | |
399 | unsigned int i; | 389 | unsigned int i; | |
400 | 390 | |||
401 | printf("pub %d/%s ", | 391 | (void) fprintf(fp, "pub %d/%s ", | |
402 | numkeybits(&key->key.pubkey), | 392 | numkeybits(&key->key.pubkey), | |
403 | __ops_show_pka(key->key.pubkey.alg)); | 393 | __ops_show_pka(key->key.pubkey.alg)); | |
404 | hexdump(key->key_id, OPS_KEY_ID_SIZE, ""); | 394 | hexdump(fp, key->key_id, OPS_KEY_ID_SIZE, ""); | |
405 | printf(" "); | 395 | (void) fprintf(fp, " "); | |
406 | print_time_short(key->key.pubkey.birthtime); | 396 | print_time_short(fp, key->key.pubkey.birthtime); | |
407 | printf("\nKey fingerprint: "); | 397 | (void) fprintf(fp, "\nKey fingerprint: "); | |
408 | hexdump(key->fingerprint.fingerprint, 20, " "); | 398 | hexdump(fp, key->fingerprint.fingerprint, 20, " "); | |
409 | printf("\n"); | 399 | (void) fprintf(fp, "\n"); | |
410 | ||||
411 | for (i = 0; i < key->nuids; i++) { | 400 | for (i = 0; i < key->nuids; i++) { | |
412 | printf("uid %s\n", key->uids[i].userid); | 401 | (void) fprintf(fp, "uid %s\n", | |
402 | key->uids[i].userid); | |||
413 | } | 403 | } | |
414 | } | 404 | } | |
415 | 405 | |||
416 | /** | 406 | /** | |
417 | \ingroup Core_Print | 407 | \ingroup Core_Print | |
418 | \param pubkey | 408 | \param pubkey | |
419 | */ | 409 | */ | |
420 | void | 410 | void | |
421 | __ops_print_pubkey(const __ops_pubkey_t * pubkey) | 411 | __ops_print_pubkey(const __ops_pubkey_t * pubkey) | |
422 | { | 412 | { | |
423 | printf("------- PUBLIC KEY ------\n"); | 413 | printf("------- PUBLIC KEY ------\n"); | |
424 | print_unsigned_int("Version", (unsigned)pubkey->version); | 414 | print_unsigned_int("Version", (unsigned)pubkey->version); | |
425 | print_time("Creation Time", pubkey->birthtime); | 415 | print_time("Creation Time", pubkey->birthtime); | |
@@ -464,30 +454,30 @@ __ops_print_pubkey(const __ops_pubkey_t | @@ -464,30 +454,30 @@ __ops_print_pubkey(const __ops_pubkey_t | |||
464 | 454 | |||
465 | Prints a secret key | 455 | Prints a secret key | |
466 | 456 | |||
467 | \param key Ptr to public key | 457 | \param key Ptr to public key | |
468 | */ | 458 | */ | |
469 | 459 | |||
470 | void | 460 | void | |
471 | __ops_print_seckeydata(const __ops_keydata_t * key) | 461 | __ops_print_seckeydata(const __ops_keydata_t * key) | |
472 | { | 462 | { | |
473 | printf("sec "); | 463 | printf("sec "); | |
474 | __ops_show_pka(key->key.pubkey.alg); | 464 | __ops_show_pka(key->key.pubkey.alg); | |
475 | printf(" "); | 465 | printf(" "); | |
476 | 466 | |||
477 | hexdump(key->key_id, OPS_KEY_ID_SIZE, ""); | 467 | hexdump(stdout, key->key_id, OPS_KEY_ID_SIZE, ""); | |
478 | printf(" "); | 468 | printf(" "); | |
479 | 469 | |||
480 | print_time_short(key->key.pubkey.birthtime); | 470 | print_time_short(stdout, key->key.pubkey.birthtime); | |
481 | printf(" "); | 471 | printf(" "); | |
482 | 472 | |||
483 | if (key->nuids == 1) { | 473 | if (key->nuids == 1) { | |
484 | /* print on same line as other info */ | 474 | /* print on same line as other info */ | |
485 | printf("%s\n", key->uids[0].userid); | 475 | printf("%s\n", key->uids[0].userid); | |
486 | } else { | 476 | } else { | |
487 | /* print all uids on separate line */ | 477 | /* print all uids on separate line */ | |
488 | unsigned int i; | 478 | unsigned int i; | |
489 | printf("\n"); | 479 | printf("\n"); | |
490 | for (i = 0; i < key->nuids; i++) { | 480 | for (i = 0; i < key->nuids; i++) { | |
491 | printf("uid %s\n", key->uids[i].userid); | 481 | printf("uid %s\n", key->uids[i].userid); | |
492 | } | 482 | } | |
493 | } | 483 | } | |
@@ -588,27 +578,27 @@ __ops_print_pk_sesskey(__ops_content_tag | @@ -588,27 +578,27 @@ __ops_print_pk_sesskey(__ops_content_tag | |||
588 | __ops_show_symm_alg(key->symm_alg)); | 578 | __ops_show_symm_alg(key->symm_alg)); | |
589 | print_hexdump("Key", key->key, __ops_key_size(key->symm_alg)); | 579 | print_hexdump("Key", key->key, __ops_key_size(key->symm_alg)); | |
590 | printf("Checksum: %04x\n", key->checksum); | 580 | printf("Checksum: %04x\n", key->checksum); | |
591 | } | 581 | } | |
592 | } | 582 | } | |
593 | 583 | |||
594 | static void | 584 | static void | |
595 | start_subpacket(int type) | 585 | start_subpacket(int type) | |
596 | { | 586 | { | |
597 | indent++; | 587 | indent++; | |
598 | print_indent(); | 588 | print_indent(); | |
599 | printf("-- %s (type 0x%02x)\n", | 589 | printf("-- %s (type 0x%02x)\n", | |
600 | __ops_show_ss_type(type), | 590 | __ops_show_ss_type(type), | |
601 | type - OPS_PTAG_SIGNATURE_SUBPACKET_BASE); | 591 | type - OPS_PTAG_SIG_SUBPKT_BASE); | |
602 | } | 592 | } | |
603 | 593 | |||
604 | static void | 594 | static void | |
605 | end_subpacket(void) | 595 | end_subpacket(void) | |
606 | { | 596 | { | |
607 | indent--; | 597 | indent--; | |
608 | } | 598 | } | |
609 | 599 | |||
610 | /** | 600 | /** | |
611 | \ingroup Core_Print | 601 | \ingroup Core_Print | |
612 | \param contents | 602 | \param contents | |
613 | */ | 603 | */ | |
614 | int | 604 | int | |
@@ -666,27 +656,27 @@ __ops_print_packet(const __ops_packet_t | @@ -666,27 +656,27 @@ __ops_print_packet(const __ops_packet_t | |||
666 | 656 | |||
667 | case OPS_PTAG_CT_SE_IP_DATA_HEADER: | 657 | case OPS_PTAG_CT_SE_IP_DATA_HEADER: | |
668 | print_tagname( | 658 | print_tagname( | |
669 | "SYMMETRIC ENCRYPTED INTEGRITY PROTECTED DATA HEADER"); | 659 | "SYMMETRIC ENCRYPTED INTEGRITY PROTECTED DATA HEADER"); | |
670 | printf("Version: %d\n", content->se_ip_data_header.version); | 660 | printf("Version: %d\n", content->se_ip_data_header.version); | |
671 | break; | 661 | break; | |
672 | 662 | |||
673 | case OPS_PTAG_CT_SE_IP_DATA_BODY: | 663 | case OPS_PTAG_CT_SE_IP_DATA_BODY: | |
674 | print_tagname( | 664 | print_tagname( | |
675 | "SYMMETRIC ENCRYPTED INTEGRITY PROTECTED DATA BODY"); | 665 | "SYMMETRIC ENCRYPTED INTEGRITY PROTECTED DATA BODY"); | |
676 | printf(" data body length=%d\n", | 666 | printf(" data body length=%d\n", | |
677 | content->se_data_body.length); | 667 | content->se_data_body.length); | |
678 | printf(" data="); | 668 | printf(" data="); | |
679 | hexdump(content->se_data_body.data, | 669 | hexdump(stdout, content->se_data_body.data, | |
680 | content->se_data_body.length, ""); | 670 | content->se_data_body.length, ""); | |
681 | printf("\n"); | 671 | printf("\n"); | |
682 | break; | 672 | break; | |
683 | 673 | |||
684 | case OPS_PTAG_CT_PUBLIC_KEY: | 674 | case OPS_PTAG_CT_PUBLIC_KEY: | |
685 | case OPS_PTAG_CT_PUBLIC_SUBKEY: | 675 | case OPS_PTAG_CT_PUBLIC_SUBKEY: | |
686 | print_tagname((pkt->tag == OPS_PTAG_CT_PUBLIC_KEY) ? | 676 | print_tagname((pkt->tag == OPS_PTAG_CT_PUBLIC_KEY) ? | |
687 | "PUBLIC KEY" : | 677 | "PUBLIC KEY" : | |
688 | "PUBLIC SUBKEY"); | 678 | "PUBLIC SUBKEY"); | |
689 | __ops_print_pubkey(&content->pubkey); | 679 | __ops_print_pubkey(&content->pubkey); | |
690 | break; | 680 | break; | |
691 | 681 | |||
692 | case OPS_PTAG_CT_TRUST: | 682 | case OPS_PTAG_CT_TRUST: | |
@@ -756,83 +746,83 @@ __ops_print_packet(const __ops_packet_t | @@ -756,83 +746,83 @@ __ops_print_packet(const __ops_packet_t | |||
756 | } | 746 | } | |
757 | 747 | |||
758 | if (content->sig.hash) | 748 | if (content->sig.hash) | |
759 | printf("data hash is set\n"); | 749 | printf("data hash is set\n"); | |
760 | 750 | |||
761 | break; | 751 | break; | |
762 | 752 | |||
763 | case OPS_PTAG_CT_COMPRESSED: | 753 | case OPS_PTAG_CT_COMPRESSED: | |
764 | print_tagname("COMPRESSED"); | 754 | print_tagname("COMPRESSED"); | |
765 | print_unsigned_int("Compressed Data Type", | 755 | print_unsigned_int("Compressed Data Type", | |
766 | (unsigned)content->compressed.type); | 756 | (unsigned)content->compressed.type); | |
767 | break; | 757 | break; | |
768 | 758 | |||
769 | case OPS_PTAG_CT_ONE_PASS_SIGNATURE: | 759 | case OPS_PTAG_CT_1_PASS_SIG: | |
770 | print_tagname("ONE PASS SIGNATURE"); | 760 | print_tagname("ONE PASS SIGNATURE"); | |
771 | 761 | |||
772 | print_unsigned_int("Version", | 762 | print_unsigned_int("Version", | |
773 | (unsigned)content->one_pass_sig.version); | 763 | (unsigned)content->one_pass_sig.version); | |
774 | print_string_and_value("Signature Type", | 764 | print_string_and_value("Signature Type", | |
775 | __ops_show_sig_type(content->one_pass_sig.sig_type), | 765 | __ops_show_sig_type(content->one_pass_sig.sig_type), | |
776 | content->one_pass_sig.sig_type); | 766 | content->one_pass_sig.sig_type); | |
777 | print_string_and_value("Hash Algorithm", | 767 | print_string_and_value("Hash Algorithm", | |
778 | __ops_show_hash_alg(content->one_pass_sig.hash_alg), | 768 | __ops_show_hash_alg(content->one_pass_sig.hash_alg), | |
779 | content->one_pass_sig.hash_alg); | 769 | content->one_pass_sig.hash_alg); | |
780 | print_string_and_value("Public Key Algorithm", | 770 | print_string_and_value("Public Key Algorithm", | |
781 | __ops_show_pka(content->one_pass_sig.key_alg), | 771 | __ops_show_pka(content->one_pass_sig.key_alg), | |
782 | content->one_pass_sig.key_alg); | 772 | content->one_pass_sig.key_alg); | |
783 | print_hexdump_data("Signer ID", | 773 | print_hexdump_data("Signer ID", | |
784 | content->one_pass_sig.keyid, | 774 | content->one_pass_sig.keyid, | |
785 | sizeof(content->one_pass_sig.keyid)); | 775 | sizeof(content->one_pass_sig.keyid)); | |
786 | 776 | |||
787 | print_unsigned_int("Nested", | 777 | print_unsigned_int("Nested", | |
788 | content->one_pass_sig.nested); | 778 | content->one_pass_sig.nested); | |
789 | break; | 779 | break; | |
790 | 780 | |||
791 | case OPS_PTAG_CT_USER_ATTRIBUTE: | 781 | case OPS_PTAG_CT_USER_ATTR: | |
792 | print_tagname("USER ATTRIBUTE"); | 782 | print_tagname("USER ATTRIBUTE"); | |
793 | print_hexdump("User Attribute", | 783 | print_hexdump("User Attribute", | |
794 | content->userattr.data.contents, | 784 | content->userattr.data.contents, | |
795 | content->userattr.data.len); | 785 | content->userattr.data.len); | |
796 | break; | 786 | break; | |
797 | 787 | |||
798 | case OPS_PTAG_RAW_SS: | 788 | case OPS_PTAG_RAW_SS: | |
799 | if (pkt->critical) { | 789 | if (pkt->critical) { | |
800 | (void) fprintf(stderr, "contents are critical\n"); | 790 | (void) fprintf(stderr, "contents are critical\n"); | |
801 | return 0; | 791 | return 0; | |
802 | } | 792 | } | |
803 | start_subpacket(pkt->tag); | 793 | start_subpacket(pkt->tag); | |
804 | print_unsigned_int("Raw Signature Subpacket: tag", | 794 | print_unsigned_int("Raw Signature Subpacket: tag", | |
805 | (unsigned)(content->ss_raw.tag - | 795 | (unsigned)(content->ss_raw.tag - | |
806 | OPS_PTAG_SIGNATURE_SUBPACKET_BASE)); | 796 | OPS_PTAG_SIG_SUBPKT_BASE)); | |
807 | print_hexdump("Raw Data", | 797 | print_hexdump("Raw Data", | |
808 | content->ss_raw.raw, | 798 | content->ss_raw.raw, | |
809 | content->ss_raw.length); | 799 | content->ss_raw.length); | |
810 | break; | 800 | break; | |
811 | 801 | |||
812 | case OPS_PTAG_SS_CREATION_TIME: | 802 | case OPS_PTAG_SS_CREATION_TIME: | |
813 | start_subpacket(pkt->tag); | 803 | start_subpacket(pkt->tag); | |
814 | print_time("Signature Creation Time", content->ss_time.time); | 804 | print_time("Signature Creation Time", content->ss_time.time); | |
815 | end_subpacket(); | 805 | end_subpacket(); | |
816 | break; | 806 | break; | |
817 | 807 | |||
818 | case OPS_PTAG_SS_EXPIRATION_TIME: | 808 | case OPS_PTAG_SS_EXPIRATION_TIME: | |
819 | start_subpacket(pkt->tag); | 809 | start_subpacket(pkt->tag); | |
820 | print_duration("Signature Expiration Time", | 810 | print_duration("Signature Expiration Time", | |
821 | content->ss_time.time); | 811 | content->ss_time.time); | |
822 | end_subpacket(); | 812 | end_subpacket(); | |
823 | break; | 813 | break; | |
824 | 814 | |||
825 | case OPS_PTAG_SS_KEY_EXPIRATION_TIME: | 815 | case OPS_PTAG_SS_KEY_EXPIRY: | |
826 | start_subpacket(pkt->tag); | 816 | start_subpacket(pkt->tag); | |
827 | print_duration("Key Expiration Time", content->ss_time.time); | 817 | print_duration("Key Expiration Time", content->ss_time.time); | |
828 | end_subpacket(); | 818 | end_subpacket(); | |
829 | break; | 819 | break; | |
830 | 820 | |||
831 | case OPS_PTAG_SS_TRUST: | 821 | case OPS_PTAG_SS_TRUST: | |
832 | start_subpacket(pkt->tag); | 822 | start_subpacket(pkt->tag); | |
833 | print_string("Trust Signature", ""); | 823 | print_string("Trust Signature", ""); | |
834 | print_unsigned_int("Level", | 824 | print_unsigned_int("Level", | |
835 | (unsigned)content->ss_trust.level); | 825 | (unsigned)content->ss_trust.level); | |
836 | print_unsigned_int("Amount", | 826 | print_unsigned_int("Amount", | |
837 | (unsigned)content->ss_trust.amount); | 827 | (unsigned)content->ss_trust.amount); | |
838 | end_subpacket(); | 828 | end_subpacket(); | |
@@ -844,27 +834,27 @@ __ops_print_packet(const __ops_packet_t | @@ -844,27 +834,27 @@ __ops_print_packet(const __ops_packet_t | |||
844 | end_subpacket(); | 834 | end_subpacket(); | |
845 | break; | 835 | break; | |
846 | 836 | |||
847 | case OPS_PTAG_SS_REVOCATION_KEY: | 837 | case OPS_PTAG_SS_REVOCATION_KEY: | |
848 | start_subpacket(pkt->tag); | 838 | start_subpacket(pkt->tag); | |
849 | /* not yet tested */ | 839 | /* not yet tested */ | |
850 | printf(" revocation key: class=0x%x", | 840 | printf(" revocation key: class=0x%x", | |
851 | content->ss_revocation_key.class); | 841 | content->ss_revocation_key.class); | |
852 | if (content->ss_revocation_key.class & 0x40) | 842 | if (content->ss_revocation_key.class & 0x40) | |
853 | printf(" (sensitive)"); | 843 | printf(" (sensitive)"); | |
854 | printf(", algid=0x%x", | 844 | printf(", algid=0x%x", | |
855 | content->ss_revocation_key.algid); | 845 | content->ss_revocation_key.algid); | |
856 | printf(", fingerprint="); | 846 | printf(", fingerprint="); | |
857 | hexdump(content->ss_revocation_key.fingerprint, 20, ""); | 847 | hexdump(stdout, content->ss_revocation_key.fingerprint, 20, ""); | |
858 | printf("\n"); | 848 | printf("\n"); | |
859 | end_subpacket(); | 849 | end_subpacket(); | |
860 | break; | 850 | break; | |
861 | 851 | |||
862 | case OPS_PTAG_SS_ISSUER_KEY_ID: | 852 | case OPS_PTAG_SS_ISSUER_KEY_ID: | |
863 | start_subpacket(pkt->tag); | 853 | start_subpacket(pkt->tag); | |
864 | print_hexdump("Issuer Key Id", | 854 | print_hexdump("Issuer Key Id", | |
865 | &content->ss_issuer_key_id.key_id[0], | 855 | &content->ss_issuer_key_id.key_id[0], | |
866 | sizeof(content->ss_issuer_key_id.key_id)); | 856 | sizeof(content->ss_issuer_key_id.key_id)); | |
867 | end_subpacket(); | 857 | end_subpacket(); | |
868 | break; | 858 | break; | |
869 | 859 | |||
870 | case OPS_PTAG_SS_PREFERRED_SKA: | 860 | case OPS_PTAG_SS_PREFERRED_SKA: | |
@@ -887,49 +877,49 @@ __ops_print_packet(const __ops_packet_t | @@ -887,49 +877,49 @@ __ops_print_packet(const __ops_packet_t | |||
887 | break; | 877 | break; | |
888 | 878 | |||
889 | case OPS_PTAG_SS_PREFERRED_HASH: | 879 | case OPS_PTAG_SS_PREFERRED_HASH: | |
890 | start_subpacket(pkt->tag); | 880 | start_subpacket(pkt->tag); | |
891 | print_data("Preferred Hash Algorithms", | 881 | print_data("Preferred Hash Algorithms", | |
892 | &content->ss_hashpref.data); | 882 | &content->ss_hashpref.data); | |
893 | 883 | |||
894 | text = __ops_showall_ss_hashpref(content->ss_hashpref); | 884 | text = __ops_showall_ss_hashpref(content->ss_hashpref); | |
895 | print_text_breakdown(text); | 885 | print_text_breakdown(text); | |
896 | __ops_text_free(text); | 886 | __ops_text_free(text); | |
897 | end_subpacket(); | 887 | end_subpacket(); | |
898 | break; | 888 | break; | |
899 | 889 | |||
900 | case OPS_PTAG_SS_PREFERRED_COMPRESSION: | 890 | case OPS_PTAG_SS_PREF_COMPRESS: | |
901 | start_subpacket(pkt->tag); | 891 | start_subpacket(pkt->tag); | |
902 | print_data("Preferred Compression Algorithms", | 892 | print_data("Preferred Compression Algorithms", | |
903 | &content->ss_zpref.data); | 893 | &content->ss_zpref.data); | |
904 | 894 | |||
905 | text = __ops_showall_ss_zpref(content->ss_zpref); | 895 | text = __ops_showall_ss_zpref(content->ss_zpref); | |
906 | print_text_breakdown(text); | 896 | print_text_breakdown(text); | |
907 | __ops_text_free(text); | 897 | __ops_text_free(text); | |
908 | end_subpacket(); | 898 | end_subpacket(); | |
909 | break; | 899 | break; | |
910 | 900 | |||
911 | case OPS_PTAG_SS_KEY_FLAGS: | 901 | case OPS_PTAG_SS_KEY_FLAGS: | |
912 | start_subpacket(pkt->tag); | 902 | start_subpacket(pkt->tag); | |
913 | print_data("Key Flags", &content->ss_key_flags.data); | 903 | print_data("Key Flags", &content->ss_key_flags.data); | |
914 | 904 | |||
915 | text = __ops_showall_ss_key_flags(content->ss_key_flags); | 905 | text = __ops_showall_ss_key_flags(content->ss_key_flags); | |
916 | print_text_breakdown(text); | 906 | print_text_breakdown(text); | |
917 | __ops_text_free(text); | 907 | __ops_text_free(text); | |
918 | 908 | |||
919 | end_subpacket(); | 909 | end_subpacket(); | |
920 | break; | 910 | break; | |
921 | 911 | |||
922 | case OPS_PTAG_SS_KEY_SERVER_PREFS: | 912 | case OPS_PTAG_SS_KEYSERV_PREFS: | |
923 | start_subpacket(pkt->tag); | 913 | start_subpacket(pkt->tag); | |
924 | print_data("Key Server Preferences", | 914 | print_data("Key Server Preferences", | |
925 | &content->ss_key_server_prefs.data); | 915 | &content->ss_key_server_prefs.data); | |
926 | 916 | |||
927 | text = __ops_show_keyserv_prefs(content->ss_key_server_prefs); | 917 | text = __ops_show_keyserv_prefs(content->ss_key_server_prefs); | |
928 | print_text_breakdown(text); | 918 | print_text_breakdown(text); | |
929 | __ops_text_free(text); | 919 | __ops_text_free(text); | |
930 | 920 | |||
931 | end_subpacket(); | 921 | end_subpacket(); | |
932 | break; | 922 | break; | |
933 | 923 | |||
934 | case OPS_PTAG_SS_FEATURES: | 924 | case OPS_PTAG_SS_FEATURES: | |
935 | start_subpacket(pkt->tag); | 925 | start_subpacket(pkt->tag); | |
@@ -976,27 +966,27 @@ __ops_print_packet(const __ops_packet_t | @@ -976,27 +966,27 @@ __ops_print_packet(const __ops_packet_t | |||
976 | case OPS_PTAG_SS_POLICY_URI: | 966 | case OPS_PTAG_SS_POLICY_URI: | |
977 | start_subpacket(pkt->tag); | 967 | start_subpacket(pkt->tag); | |
978 | print_string("Policy URL", content->ss_policy.url); | 968 | print_string("Policy URL", content->ss_policy.url); | |
979 | end_subpacket(); | 969 | end_subpacket(); | |
980 | break; | 970 | break; | |
981 | 971 | |||
982 | case OPS_PTAG_SS_SIGNERS_USER_ID: | 972 | case OPS_PTAG_SS_SIGNERS_USER_ID: | |
983 | start_subpacket(pkt->tag); | 973 | start_subpacket(pkt->tag); | |
984 | print_utf8_string("Signer's User ID", | 974 | print_utf8_string("Signer's User ID", | |
985 | content->ss_signer.userid); | 975 | content->ss_signer.userid); | |
986 | end_subpacket(); | 976 | end_subpacket(); | |
987 | break; | 977 | break; | |
988 | 978 | |||
989 | case OPS_PTAG_SS_PREFERRED_KEY_SERVER: | 979 | case OPS_PTAG_SS_PREF_KEYSERV: | |
990 | start_subpacket(pkt->tag); | 980 | start_subpacket(pkt->tag); | |
991 | print_string("Preferred Key Server", content->ss_keyserv.name); | 981 | print_string("Preferred Key Server", content->ss_keyserv.name); | |
992 | end_subpacket(); | 982 | end_subpacket(); | |
993 | break; | 983 | break; | |
994 | 984 | |||
995 | case OPS_PTAG_SS_EMBEDDED_SIGNATURE: | 985 | case OPS_PTAG_SS_EMBEDDED_SIGNATURE: | |
996 | start_subpacket(pkt->tag); | 986 | start_subpacket(pkt->tag); | |
997 | end_subpacket();/* \todo print out contents? */ | 987 | end_subpacket();/* \todo print out contents? */ | |
998 | break; | 988 | break; | |
999 | 989 | |||
1000 | case OPS_PTAG_SS_USERDEFINED00: | 990 | case OPS_PTAG_SS_USERDEFINED00: | |
1001 | case OPS_PTAG_SS_USERDEFINED01: | 991 | case OPS_PTAG_SS_USERDEFINED01: | |
1002 | case OPS_PTAG_SS_USERDEFINED02: | 992 | case OPS_PTAG_SS_USERDEFINED02: |
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c 2009/05/19 05:13:10 1.10
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c 2009/05/21 00:33:31 1.11
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | */ | 51 | */ | |
52 | #include "config.h" | 52 | #include "config.h" | |
53 | 53 | |||
54 | #ifdef HAVE_SYS_CDEFS_H | 54 | #ifdef HAVE_SYS_CDEFS_H | |
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if defined(__NetBSD__) | 58 | #if defined(__NetBSD__) | |
59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
60 | __RCSID("$NetBSD: keyring.c,v 1.10 2009/05/19 05:13:10 agc Exp $"); | 60 | __RCSID("$NetBSD: keyring.c,v 1.11 2009/05/21 00:33:31 agc Exp $"); | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | #ifdef HAVE_FCNTL_H | 63 | #ifdef HAVE_FCNTL_H | |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> | |
65 | #endif | 65 | #endif | |
66 | 66 | |||
67 | #include <stdlib.h> | 67 | #include <stdlib.h> | |
68 | #include <string.h> | 68 | #include <string.h> | |
69 | 69 | |||
70 | #ifdef HAVE_TERMIOS_H | 70 | #ifdef HAVE_TERMIOS_H | |
71 | #include <termios.h> | 71 | #include <termios.h> | |
72 | #endif | 72 | #endif | |
73 | 73 | |||
@@ -937,27 +937,27 @@ __ops_find_key_by_userid(const __ops_key | @@ -937,27 +937,27 @@ __ops_find_key_by_userid(const __ops_key | |||
937 | \return none | 937 | \return none | |
938 | */ | 938 | */ | |
939 | void | 939 | void | |
940 | __ops_keyring_list(const __ops_keyring_t * keyring) | 940 | __ops_keyring_list(const __ops_keyring_t * keyring) | |
941 | { | 941 | { | |
942 | int n; | 942 | int n; | |
943 | __ops_keydata_t *key; | 943 | __ops_keydata_t *key; | |
944 | 944 | |||
945 | printf("%d keys\n", keyring->nkeys); | 945 | printf("%d keys\n", keyring->nkeys); | |
946 | for (n = 0, key = &keyring->keys[n]; n < keyring->nkeys; ++n, ++key) { | 946 | for (n = 0, key = &keyring->keys[n]; n < keyring->nkeys; ++n, ++key) { | |
947 | if (__ops_is_key_secret(key)) { | 947 | if (__ops_is_key_secret(key)) { | |
948 | __ops_print_seckeydata(key); | 948 | __ops_print_seckeydata(key); | |
949 | } else { | 949 | } else { | |
950 | __ops_print_pubkeydata(key); | 950 | __ops_print_pubkeydata(stdout, key); | |
951 | } | 951 | } | |
952 | (void) fputc('\n', stdout); | 952 | (void) fputc('\n', stdout); | |
953 | } | 953 | } | |
954 | } | 954 | } | |
955 | 955 | |||
956 | static unsigned | 956 | static unsigned | |
957 | get_contents_type(const __ops_keydata_t *keydata) | 957 | get_contents_type(const __ops_keydata_t *keydata) | |
958 | { | 958 | { | |
959 | return keydata->type; | 959 | return keydata->type; | |
960 | } | 960 | } | |
961 | 961 | |||
962 | /* this interface isn't right - hook into callback for getting passphrase */ | 962 | /* this interface isn't right - hook into callback for getting passphrase */ | |
963 | int | 963 | int |
--- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c 2009/05/19 05:13:10 1.10
+++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c 2009/05/21 00:33:31 1.11
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | */ | 51 | */ | |
52 | #include "config.h" | 52 | #include "config.h" | |
53 | 53 | |||
54 | #ifdef HAVE_SYS_CDEFS_H | 54 | #ifdef HAVE_SYS_CDEFS_H | |
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if defined(__NetBSD__) | 58 | #if defined(__NetBSD__) | |
59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
60 | __RCSID("$NetBSD: misc.c,v 1.10 2009/05/19 05:13:10 agc Exp $"); | 60 | __RCSID("$NetBSD: misc.c,v 1.11 2009/05/21 00:33:31 agc Exp $"); | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | #include <sys/types.h> | 63 | #include <sys/types.h> | |
64 | #include <sys/stat.h> | 64 | #include <sys/stat.h> | |
65 | #include <sys/mman.h> | 65 | #include <sys/mman.h> | |
66 | 66 | |||
67 | #include <stdarg.h> | 67 | #include <stdarg.h> | |
68 | #include <stdio.h> | 68 | #include <stdio.h> | |
69 | #include <stdlib.h> | 69 | #include <stdlib.h> | |
70 | #include <string.h> | 70 | #include <string.h> | |
71 | 71 | |||
72 | #ifdef HAVE_UNISTD_H | 72 | #ifdef HAVE_UNISTD_H | |
73 | #include <unistd.h> | 73 | #include <unistd.h> | |
@@ -212,39 +212,39 @@ __ops_parse_and_accumulate(__ops_keyring | @@ -212,39 +212,39 @@ __ops_parse_and_accumulate(__ops_keyring | |||
212 | ret = __ops_parse(parse, 0); | 212 | ret = __ops_parse(parse, 0); | |
213 | 213 | |||
214 | keyring->nkeys += 1; | 214 | keyring->nkeys += 1; | |
215 | 215 | |||
216 | return ret; | 216 | return ret; | |
217 | } | 217 | } | |
218 | 218 | |||
219 | static void | 219 | static void | |
220 | dump_one_keydata(const __ops_keydata_t * key) | 220 | dump_one_keydata(const __ops_keydata_t * key) | |
221 | { | 221 | { | |
222 | unsigned n; | 222 | unsigned n; | |
223 | 223 | |||
224 | printf("Key ID: "); | 224 | printf("Key ID: "); | |
225 | hexdump(key->key_id, OPS_KEY_ID_SIZE, ""); | 225 | hexdump(stdout, key->key_id, OPS_KEY_ID_SIZE, ""); | |
226 | 226 | |||
227 | printf("\nFingerpint: "); | 227 | printf("\nFingerpint: "); | |
228 | hexdump(key->fingerprint.fingerprint, key->fingerprint.length, ""); | 228 | hexdump(stdout, key->fingerprint.fingerprint, key->fingerprint.length, ""); | |
229 | 229 | |||
230 | printf("\n\nUIDs\n====\n\n"); | 230 | printf("\n\nUIDs\n====\n\n"); | |
231 | for (n = 0; n < key->nuids; ++n) | 231 | for (n = 0; n < key->nuids; ++n) | |
232 | printf("%s\n", key->uids[n].userid); | 232 | printf("%s\n", key->uids[n].userid); | |
233 | 233 | |||
234 | printf("\nPackets\n=======\n"); | 234 | printf("\nPackets\n=======\n"); | |
235 | for (n = 0; n < key->npackets; ++n) { | 235 | for (n = 0; n < key->npackets; ++n) { | |
236 | printf("\n%03d: ", n); | 236 | printf("\n%03d: ", n); | |
237 | hexdump(key->packets[n].raw, key->packets[n].length, ""); | 237 | hexdump(stdout, key->packets[n].raw, key->packets[n].length, ""); | |
238 | } | 238 | } | |
239 | printf("\n\n"); | 239 | printf("\n\n"); | |
240 | } | 240 | } | |
241 | 241 | |||
242 | /* XXX: not a maintained part of the API - use __ops_keyring_list() */ | 242 | /* XXX: not a maintained part of the API - use __ops_keyring_list() */ | |
243 | /** __ops_dump_keyring | 243 | /** __ops_dump_keyring | |
244 | */ | 244 | */ | |
245 | void | 245 | void | |
246 | __ops_dump_keyring(const __ops_keyring_t * keyring) | 246 | __ops_dump_keyring(const __ops_keyring_t * keyring) | |
247 | { | 247 | { | |
248 | int n; | 248 | int n; | |
249 | 249 | |||
250 | for (n = 0; n < keyring->nkeys; ++n) { | 250 | for (n = 0; n < keyring->nkeys; ++n) { | |
@@ -1039,33 +1039,33 @@ str_from_map_or_null(int type, __ops_map | @@ -1039,33 +1039,33 @@ str_from_map_or_null(int type, __ops_map | |||
1039 | * Returns a readable string if found, "Unknown" if not. | 1039 | * Returns a readable string if found, "Unknown" if not. | |
1040 | */ | 1040 | */ | |
1041 | 1041 | |||
1042 | const char * | 1042 | const char * | |
1043 | __ops_str_from_map(int type, __ops_map_t *map) | 1043 | __ops_str_from_map(int type, __ops_map_t *map) | |
1044 | { | 1044 | { | |
1045 | const char *str; | 1045 | const char *str; | |
1046 | 1046 | |||
1047 | str = str_from_map_or_null(type, map); | 1047 | str = str_from_map_or_null(type, map); | |
1048 | return (str) ? str : "Unknown"; | 1048 | return (str) ? str : "Unknown"; | |
1049 | } | 1049 | } | |
1050 | 1050 | |||
1051 | void | 1051 | void | |
1052 | hexdump(const unsigned char *src, size_t length, const char *sep) | 1052 | hexdump(FILE *fp, const unsigned char *src, size_t length, const char *sep) | |
1053 | { | 1053 | { | |
1054 | unsigned i; | 1054 | unsigned i; | |
1055 | 1055 | |||
1056 | for (i = 0 ; i < length ; i += 2) { | 1056 | for (i = 0 ; i < length ; i += 2) { | |
1057 | printf("%02x", *src++); | 1057 | (void) fprintf(fp, "%02x", *src++); | |
1058 | printf("%02x%s", *src++, sep); | 1058 | (void) fprintf(fp, "%02x%s", *src++, sep); | |
1059 | } | 1059 | } | |
1060 | } | 1060 | } | |
1061 | 1061 | |||
1062 | /** | 1062 | /** | |
1063 | * \ingroup HighLevel_Functions | 1063 | * \ingroup HighLevel_Functions | |
1064 | * \brief Initialises OpenPGP::SDK. To be called before any other OPS function. | 1064 | * \brief Initialises OpenPGP::SDK. To be called before any other OPS function. | |
1065 | * | 1065 | * | |
1066 | * Initialises OpenPGP::SDK and the underlying openssl library. | 1066 | * Initialises OpenPGP::SDK and the underlying openssl library. | |
1067 | */ | 1067 | */ | |
1068 | 1068 | |||
1069 | void | 1069 | void | |
1070 | __ops_init(void) | 1070 | __ops_init(void) | |
1071 | { | 1071 | { |
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c 2009/05/19 05:13:10 1.14
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c 2009/05/21 00:33:31 1.15
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
27 | * POSSIBILITY OF SUCH DAMAGE. | 27 | * POSSIBILITY OF SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | #include "config.h" | 29 | #include "config.h" | |
30 | 30 | |||
31 | #ifdef HAVE_SYS_CDEFS_H | 31 | #ifdef HAVE_SYS_CDEFS_H | |
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | #endif | 33 | #endif | |
34 | 34 | |||
35 | #if defined(__NetBSD__) | 35 | #if defined(__NetBSD__) | |
36 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 36 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
37 | __RCSID("$NetBSD: netpgp.c,v 1.14 2009/05/19 05:13:10 agc Exp $"); | 37 | __RCSID("$NetBSD: netpgp.c,v 1.15 2009/05/21 00:33:31 agc Exp $"); | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
41 | #include <sys/stat.h> | 41 | #include <sys/stat.h> | |
42 | #include <sys/param.h> | 42 | #include <sys/param.h> | |
43 | #include <sys/mman.h> | 43 | #include <sys/mman.h> | |
44 | 44 | |||
45 | #ifdef HAVE_SYS_RESOURCE_H | 45 | #ifdef HAVE_SYS_RESOURCE_H | |
46 | #include <sys/resource.h> | 46 | #include <sys/resource.h> | |
47 | #endif | 47 | #endif | |
48 | 48 | |||
49 | #ifdef HAVE_OPENSSL_CAST_H | 49 | #ifdef HAVE_OPENSSL_CAST_H | |
50 | #include <openssl/cast.h> | 50 | #include <openssl/cast.h> | |
@@ -102,27 +102,28 @@ conffile(netpgp_t *netpgp, char *homedir | @@ -102,27 +102,28 @@ conffile(netpgp_t *netpgp, char *homedir | |||
102 | __OPS_USED(netpgp); | 102 | __OPS_USED(netpgp); | |
103 | (void) snprintf(buf, sizeof(buf), "%s/.gnupg/gpg.conf", homedir); | 103 | (void) snprintf(buf, sizeof(buf), "%s/.gnupg/gpg.conf", homedir); | |
104 | if ((fp = fopen(buf, "r")) == NULL) { | 104 | if ((fp = fopen(buf, "r")) == NULL) { | |
105 | return 0; | 105 | return 0; | |
106 | } | 106 | } | |
107 | (void) memset(&keyre, 0x0, sizeof(keyre)); | 107 | (void) memset(&keyre, 0x0, sizeof(keyre)); | |
108 | (void) regcomp(&keyre, "^[ \t]*default-key[ \t]+([0-9a-zA-F]+)", | 108 | (void) regcomp(&keyre, "^[ \t]*default-key[ \t]+([0-9a-zA-F]+)", | |
109 | REG_EXTENDED); | 109 | REG_EXTENDED); | |
110 | while (fgets(buf, sizeof(buf), fp) != NULL) { | 110 | while (fgets(buf, sizeof(buf), fp) != NULL) { | |
111 | if (regexec(&keyre, buf, 10, matchv, 0) == 0) { | 111 | if (regexec(&keyre, buf, 10, matchv, 0) == 0) { | |
112 | (void) memcpy(userid, &buf[(int)matchv[1].rm_so], | 112 | (void) memcpy(userid, &buf[(int)matchv[1].rm_so], | |
113 | MIN((unsigned)(matchv[1].rm_eo - | 113 | MIN((unsigned)(matchv[1].rm_eo - | |
114 | matchv[1].rm_so), length)); | 114 | matchv[1].rm_so), length)); | |
115 | printf("netpgp: default key set to \"%.*s\"\n", | 115 | (void) fprintf(stderr, | |
116 | "netpgp: default key set to \"%.*s\"\n", | |||
116 | (int)(matchv[1].rm_eo - matchv[1].rm_so), | 117 | (int)(matchv[1].rm_eo - matchv[1].rm_so), | |
117 | &buf[(int)matchv[1].rm_so]); | 118 | &buf[(int)matchv[1].rm_so]); | |
118 | } | 119 | } | |
119 | } | 120 | } | |
120 | (void) fclose(fp); | 121 | (void) fclose(fp); | |
121 | return 1; | 122 | return 1; | |
122 | } | 123 | } | |
123 | 124 | |||
124 | /* wrapper to get a pass phrase from the user */ | 125 | /* wrapper to get a pass phrase from the user */ | |
125 | static void | 126 | static void | |
126 | get_pass_phrase(char *phrase, size_t size) | 127 | get_pass_phrase(char *phrase, size_t size) | |
127 | { | 128 | { | |
128 | char *p; | 129 | char *p; | |
@@ -154,27 +155,27 @@ psuccess(FILE *fp, char *f, __ops_valida | @@ -154,27 +155,27 @@ psuccess(FILE *fp, char *f, __ops_valida | |||
154 | const __ops_keydata_t *pubkey; | 155 | const __ops_keydata_t *pubkey; | |
155 | unsigned i; | 156 | unsigned i; | |
156 | char id[MAX_ID_LENGTH + 1]; | 157 | char id[MAX_ID_LENGTH + 1]; | |
157 | 158 | |||
158 | for (i = 0; i < res->validc; i++) { | 159 | for (i = 0; i < res->validc; i++) { | |
159 | (void) fprintf(fp, | 160 | (void) fprintf(fp, | |
160 | "Good signature for %s made %susing %s key %s\n", | 161 | "Good signature for %s made %susing %s key %s\n", | |
161 | f, | 162 | f, | |
162 | ctime(&res->valid_sigs[i].birthtime), | 163 | ctime(&res->valid_sigs[i].birthtime), | |
163 | __ops_show_pka(res->valid_sigs[i].key_alg), | 164 | __ops_show_pka(res->valid_sigs[i].key_alg), | |
164 | userid_to_id(res->valid_sigs[i].signer_id, id)); | 165 | userid_to_id(res->valid_sigs[i].signer_id, id)); | |
165 | pubkey = __ops_keyring_find_key_by_id(pubring, | 166 | pubkey = __ops_keyring_find_key_by_id(pubring, | |
166 | (const unsigned char *) res->valid_sigs[i].signer_id); | 167 | (const unsigned char *) res->valid_sigs[i].signer_id); | |
167 | __ops_print_pubkeydata(pubkey); | 168 | __ops_print_pubkeydata(fp, pubkey); | |
168 | } | 169 | } | |
169 | } | 170 | } | |
170 | 171 | |||
171 | /***************************************************************************/ | 172 | /***************************************************************************/ | |
172 | /* exported functions start here */ | 173 | /* exported functions start here */ | |
173 | /***************************************************************************/ | 174 | /***************************************************************************/ | |
174 | 175 | |||
175 | /* initialise a netpgp_t structure */ | 176 | /* initialise a netpgp_t structure */ | |
176 | int | 177 | int | |
177 | netpgp_init(netpgp_t *netpgp, char *userid, char *fpubring, char *fsecring) | 178 | netpgp_init(netpgp_t *netpgp, char *userid, char *fpubring, char *fsecring) | |
178 | { | 179 | { | |
179 | __ops_keyring_t *keyring; | 180 | __ops_keyring_t *keyring; | |
180 | char *homedir; | 181 | char *homedir; | |
@@ -394,27 +395,27 @@ netpgp_sign_file(netpgp_t *netpgp, char | @@ -394,27 +395,27 @@ netpgp_sign_file(netpgp_t *netpgp, char | |||
394 | 395 | |||
395 | if (userid == NULL) { | 396 | if (userid == NULL) { | |
396 | userid = netpgp->userid; | 397 | userid = netpgp->userid; | |
397 | } | 398 | } | |
398 | /* get key with which to sign */ | 399 | /* get key with which to sign */ | |
399 | keypair = __ops_find_key_by_userid(netpgp->secring, userid); | 400 | keypair = __ops_find_key_by_userid(netpgp->secring, userid); | |
400 | if (keypair == NULL) { | 401 | if (keypair == NULL) { | |
401 | (void) fprintf(stderr, "Userid '%s' not found in keyring\n", | 402 | (void) fprintf(stderr, "Userid '%s' not found in keyring\n", | |
402 | userid); | 403 | userid); | |
403 | return 0; | 404 | return 0; | |
404 | } | 405 | } | |
405 | do { | 406 | do { | |
406 | /* print out the user id */ | 407 | /* print out the user id */ | |
407 | __ops_print_pubkeydata(keypair); | 408 | __ops_print_pubkeydata(stderr, keypair); | |
408 | /* get the passphrase */ | 409 | /* get the passphrase */ | |
409 | get_pass_phrase(passphrase, sizeof(passphrase)); | 410 | get_pass_phrase(passphrase, sizeof(passphrase)); | |
410 | /* now decrypt key */ | 411 | /* now decrypt key */ | |
411 | seckey = __ops_decrypt_seckey(keypair, passphrase); | 412 | seckey = __ops_decrypt_seckey(keypair, passphrase); | |
412 | if (seckey == NULL) { | 413 | if (seckey == NULL) { | |
413 | (void) fprintf(stderr, "Bad passphrase\n"); | 414 | (void) fprintf(stderr, "Bad passphrase\n"); | |
414 | } | 415 | } | |
415 | } while (seckey == NULL); | 416 | } while (seckey == NULL); | |
416 | /* sign file */ | 417 | /* sign file */ | |
417 | hashalg = netpgp_getvar(netpgp, "hash"); | 418 | hashalg = netpgp_getvar(netpgp, "hash"); | |
418 | if (cleartext) { | 419 | if (cleartext) { | |
419 | __ops_sign_file_as_cleartext(f, out, seckey, hashalg, 1U); | 420 | __ops_sign_file_as_cleartext(f, out, seckey, hashalg, 1U); | |
420 | } else if (detached) { | 421 | } else if (detached) { |
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgpdefs.h 2009/05/12 00:37:53 1.3
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgpdefs.h 2009/05/21 00:33:31 1.4
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | /* | 47 | /* | |
48 | * These macros code ensures that you are casting what you intend to cast. | 48 | * These macros code ensures that you are casting what you intend to cast. | |
49 | * It works because in "a ? b : c", b and c must have the same type. | 49 | * It works because in "a ? b : c", b and c must have the same type. | |
50 | * This is a copy of the macro defined in openssl/asn1.h. | 50 | * This is a copy of the macro defined in openssl/asn1.h. | |
51 | */ | 51 | */ | |
52 | #ifndef CHECKED_PTR_OF | 52 | #ifndef CHECKED_PTR_OF | |
53 | #define CHECKED_PTR_OF(type, p) ((void*) (/*CONSTCOND*/1 ? p : (type *)0)) | 53 | #define CHECKED_PTR_OF(type, p) ((void*) (/*CONSTCOND*/1 ? p : (type *)0)) | |
54 | #endif | 54 | #endif | |
55 | #define CHECKED_INSTANCE_OF(type, p) (/*CONSTCOND*/1 ? p : (type)0) | 55 | #define CHECKED_INSTANCE_OF(type, p) (/*CONSTCOND*/1 ? p : (type)0) | |
56 | 56 | |||
57 | /* number of elements in an array */ | 57 | /* number of elements in an array */ | |
58 | #define OPS_ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a))) | 58 | #define OPS_ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a))) | |
59 | 59 | |||
60 | void hexdump(const unsigned char *, size_t, const char *); | 60 | void hexdump(FILE *, const unsigned char *, size_t, const char *); | |
61 | 61 | |||
62 | const char *__ops_str_from_map(int, __ops_map_t *); | 62 | const char *__ops_str_from_map(int, __ops_map_t *); | |
63 | 63 | |||
64 | int __ops_set_debug_level(const char *); | 64 | int __ops_set_debug_level(const char *); | |
65 | int __ops_get_debug_level(const char *); | 65 | int __ops_get_debug_level(const char *); | |
66 | 66 | |||
67 | #define NETPGP_BUFSIZ 8192 | 67 | #define NETPGP_BUFSIZ 8192 | |
68 | 68 | |||
69 | #define CALLBACK(cbinfo, t, pc) do { \ | 69 | #define CALLBACK(cbinfo, t, pc) do { \ | |
70 | (pc)->tag = (t); \ | 70 | (pc)->tag = (t); \ | |
71 | if (__ops_parse_cb((pc), (cbinfo)) == OPS_RELEASE_MEMORY) { \ | 71 | if (__ops_parse_cb((pc), (cbinfo)) == OPS_RELEASE_MEMORY) { \ | |
72 | __ops_parser_content_free(pc); \ | 72 | __ops_parser_content_free(pc); \ | |
73 | } \ | 73 | } \ |
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c 2009/05/19 05:13:10 1.13
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c 2009/05/21 00:33:31 1.14
@@ -48,27 +48,27 @@ | @@ -48,27 +48,27 @@ | |||
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | * \brief Parser for OpenPGP packets | 51 | * \brief Parser for OpenPGP packets | |
52 | */ | 52 | */ | |
53 | #include "config.h" | 53 | #include "config.h" | |
54 | 54 | |||
55 | #ifdef HAVE_SYS_CDEFS_H | 55 | #ifdef HAVE_SYS_CDEFS_H | |
56 | #include <sys/cdefs.h> | 56 | #include <sys/cdefs.h> | |
57 | #endif | 57 | #endif | |
58 | 58 | |||
59 | #if defined(__NetBSD__) | 59 | #if defined(__NetBSD__) | |
60 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 60 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
61 | __RCSID("$NetBSD: packet-parse.c,v 1.13 2009/05/19 05:13:10 agc Exp $"); | 61 | __RCSID("$NetBSD: packet-parse.c,v 1.14 2009/05/21 00:33:31 agc Exp $"); | |
62 | #endif | 62 | #endif | |
63 | 63 | |||
64 | #ifdef HAVE_OPENSSL_CAST_H | 64 | #ifdef HAVE_OPENSSL_CAST_H | |
65 | #include <openssl/cast.h> | 65 | #include <openssl/cast.h> | |
66 | #endif | 66 | #endif | |
67 | 67 | |||
68 | #include <stdarg.h> | 68 | #include <stdarg.h> | |
69 | #include <stdlib.h> | 69 | #include <stdlib.h> | |
70 | #include <string.h> | 70 | #include <string.h> | |
71 | 71 | |||
72 | #ifdef HAVE_UNISTD_H | 72 | #ifdef HAVE_UNISTD_H | |
73 | #include <unistd.h> | 73 | #include <unistd.h> | |
74 | #endif | 74 | #endif | |
@@ -1079,30 +1079,30 @@ ss_embedded_sig_free(__ops_ss_embedded_s | @@ -1079,30 +1079,30 @@ ss_embedded_sig_free(__ops_ss_embedded_s | |||
1079 | /** | 1079 | /** | |
1080 | \ingroup Core_Create | 1080 | \ingroup Core_Create | |
1081 | \brief Free allocated memory | 1081 | \brief Free allocated memory | |
1082 | */ | 1082 | */ | |
1083 | /* ! Free any memory allocated when parsing the packet content */ | 1083 | /* ! Free any memory allocated when parsing the packet content */ | |
1084 | void | 1084 | void | |
1085 | __ops_parser_content_free(__ops_packet_t *c) | 1085 | __ops_parser_content_free(__ops_packet_t *c) | |
1086 | { | 1086 | { | |
1087 | switch (c->tag) { | 1087 | switch (c->tag) { | |
1088 | case OPS_PARSER_PTAG: | 1088 | case OPS_PARSER_PTAG: | |
1089 | case OPS_PTAG_CT_COMPRESSED: | 1089 | case OPS_PTAG_CT_COMPRESSED: | |
1090 | case OPS_PTAG_SS_CREATION_TIME: | 1090 | case OPS_PTAG_SS_CREATION_TIME: | |
1091 | case OPS_PTAG_SS_EXPIRATION_TIME: | 1091 | case OPS_PTAG_SS_EXPIRATION_TIME: | |
1092 | case OPS_PTAG_SS_KEY_EXPIRATION_TIME: | 1092 | case OPS_PTAG_SS_KEY_EXPIRY: | |
1093 | case OPS_PTAG_SS_TRUST: | 1093 | case OPS_PTAG_SS_TRUST: | |
1094 | case OPS_PTAG_SS_ISSUER_KEY_ID: | 1094 | case OPS_PTAG_SS_ISSUER_KEY_ID: | |
1095 | case OPS_PTAG_CT_ONE_PASS_SIGNATURE: | 1095 | case OPS_PTAG_CT_1_PASS_SIG: | |
1096 | case OPS_PTAG_SS_PRIMARY_USER_ID: | 1096 | case OPS_PTAG_SS_PRIMARY_USER_ID: | |
1097 | case OPS_PTAG_SS_REVOCABLE: | 1097 | case OPS_PTAG_SS_REVOCABLE: | |
1098 | case OPS_PTAG_SS_REVOCATION_KEY: | 1098 | case OPS_PTAG_SS_REVOCATION_KEY: | |
1099 | case OPS_PTAG_CT_LITERAL_DATA_HEADER: | 1099 | case OPS_PTAG_CT_LITERAL_DATA_HEADER: | |
1100 | case OPS_PTAG_CT_LITERAL_DATA_BODY: | 1100 | case OPS_PTAG_CT_LITERAL_DATA_BODY: | |
1101 | case OPS_PTAG_CT_SIGNED_CLEARTEXT_BODY: | 1101 | case OPS_PTAG_CT_SIGNED_CLEARTEXT_BODY: | |
1102 | case OPS_PTAG_CT_UNARMOURED_TEXT: | 1102 | case OPS_PTAG_CT_UNARMOURED_TEXT: | |
1103 | case OPS_PTAG_CT_ARMOUR_TRAILER: | 1103 | case OPS_PTAG_CT_ARMOUR_TRAILER: | |
1104 | case OPS_PTAG_CT_SIGNATURE_HEADER: | 1104 | case OPS_PTAG_CT_SIGNATURE_HEADER: | |
1105 | case OPS_PTAG_CT_SE_DATA_HEADER: | 1105 | case OPS_PTAG_CT_SE_DATA_HEADER: | |
1106 | case OPS_PTAG_CT_SE_IP_DATA_HEADER: | 1106 | case OPS_PTAG_CT_SE_IP_DATA_HEADER: | |
1107 | case OPS_PTAG_CT_SE_IP_DATA_BODY: | 1107 | case OPS_PTAG_CT_SE_IP_DATA_BODY: | |
1108 | case OPS_PTAG_CT_MDC: | 1108 | case OPS_PTAG_CT_MDC: | |
@@ -1133,67 +1133,67 @@ __ops_parser_content_free(__ops_packet_t | @@ -1133,67 +1133,67 @@ __ops_parser_content_free(__ops_packet_t | |||
1133 | case OPS_PTAG_CT_PUBLIC_KEY: | 1133 | case OPS_PTAG_CT_PUBLIC_KEY: | |
1134 | case OPS_PTAG_CT_PUBLIC_SUBKEY: | 1134 | case OPS_PTAG_CT_PUBLIC_SUBKEY: | |
1135 | __ops_pubkey_free(&c->u.pubkey); | 1135 | __ops_pubkey_free(&c->u.pubkey); | |
1136 | break; | 1136 | break; | |
1137 | 1137 | |||
1138 | case OPS_PTAG_CT_USER_ID: | 1138 | case OPS_PTAG_CT_USER_ID: | |
1139 | __ops_userid_free(&c->u.userid); | 1139 | __ops_userid_free(&c->u.userid); | |
1140 | break; | 1140 | break; | |
1141 | 1141 | |||
1142 | case OPS_PTAG_SS_SIGNERS_USER_ID: | 1142 | case OPS_PTAG_SS_SIGNERS_USER_ID: | |
1143 | __ops_userid_free(&c->u.ss_signer); | 1143 | __ops_userid_free(&c->u.ss_signer); | |
1144 | break; | 1144 | break; | |
1145 | 1145 | |||
1146 | case OPS_PTAG_CT_USER_ATTRIBUTE: | 1146 | case OPS_PTAG_CT_USER_ATTR: | |
1147 | __ops_userattr_free(&c->u.userattr); | 1147 | __ops_userattr_free(&c->u.userattr); | |
1148 | break; | 1148 | break; | |
1149 | 1149 | |||
1150 | case OPS_PTAG_SS_PREFERRED_SKA: | 1150 | case OPS_PTAG_SS_PREFERRED_SKA: | |
1151 | ss_skapref_free(&c->u.ss_skapref); | 1151 | ss_skapref_free(&c->u.ss_skapref); | |
1152 | break; | 1152 | break; | |
1153 | 1153 | |||
1154 | case OPS_PTAG_SS_PREFERRED_HASH: | 1154 | case OPS_PTAG_SS_PREFERRED_HASH: | |
1155 | ss_hashpref_free(&c->u.ss_hashpref); | 1155 | ss_hashpref_free(&c->u.ss_hashpref); | |
1156 | break; | 1156 | break; | |
1157 | 1157 | |||
1158 | case OPS_PTAG_SS_PREFERRED_COMPRESSION: | 1158 | case OPS_PTAG_SS_PREF_COMPRESS: | |
1159 | ss_zpref_free(&c->u.ss_zpref); | 1159 | ss_zpref_free(&c->u.ss_zpref); | |
1160 | break; | 1160 | break; | |
1161 | 1161 | |||
1162 | case OPS_PTAG_SS_KEY_FLAGS: | 1162 | case OPS_PTAG_SS_KEY_FLAGS: | |
1163 | ss_key_flags_free(&c->u.ss_key_flags); | 1163 | ss_key_flags_free(&c->u.ss_key_flags); | |
1164 | break; | 1164 | break; | |
1165 | 1165 | |||
1166 | case OPS_PTAG_SS_KEY_SERVER_PREFS: | 1166 | case OPS_PTAG_SS_KEYSERV_PREFS: | |
1167 | ss_key_server_prefs_free(&c->u.ss_key_server_prefs); | 1167 | ss_key_server_prefs_free(&c->u.ss_key_server_prefs); | |
1168 | break; | 1168 | break; | |
1169 | 1169 | |||
1170 | case OPS_PTAG_SS_FEATURES: | 1170 | case OPS_PTAG_SS_FEATURES: | |
1171 | ss_features_free(&c->u.ss_features); | 1171 | ss_features_free(&c->u.ss_features); | |
1172 | break; | 1172 | break; | |
1173 | 1173 | |||
1174 | case OPS_PTAG_SS_NOTATION_DATA: | 1174 | case OPS_PTAG_SS_NOTATION_DATA: | |
1175 | ss_notation_free(&c->u.ss_notation); | 1175 | ss_notation_free(&c->u.ss_notation); | |
1176 | break; | 1176 | break; | |
1177 | 1177 | |||
1178 | case OPS_PTAG_SS_REGEXP: | 1178 | case OPS_PTAG_SS_REGEXP: | |
1179 | ss_regexp_free(&c->u.ss_regexp); | 1179 | ss_regexp_free(&c->u.ss_regexp); | |
1180 | break; | 1180 | break; | |
1181 | 1181 | |||
1182 | case OPS_PTAG_SS_POLICY_URI: | 1182 | case OPS_PTAG_SS_POLICY_URI: | |
1183 | ss_policy_free(&c->u.ss_policy); | 1183 | ss_policy_free(&c->u.ss_policy); | |
1184 | break; | 1184 | break; | |
1185 | 1185 | |||
1186 | case OPS_PTAG_SS_PREFERRED_KEY_SERVER: | 1186 | case OPS_PTAG_SS_PREF_KEYSERV: | |
1187 | ss_keyserv_free(&c->u.ss_keyserv); | 1187 | ss_keyserv_free(&c->u.ss_keyserv); | |
1188 | break; | 1188 | break; | |
1189 | 1189 | |||
1190 | case OPS_PTAG_SS_USERDEFINED00: | 1190 | case OPS_PTAG_SS_USERDEFINED00: | |
1191 | case OPS_PTAG_SS_USERDEFINED01: | 1191 | case OPS_PTAG_SS_USERDEFINED01: | |
1192 | case OPS_PTAG_SS_USERDEFINED02: | 1192 | case OPS_PTAG_SS_USERDEFINED02: | |
1193 | case OPS_PTAG_SS_USERDEFINED03: | 1193 | case OPS_PTAG_SS_USERDEFINED03: | |
1194 | case OPS_PTAG_SS_USERDEFINED04: | 1194 | case OPS_PTAG_SS_USERDEFINED04: | |
1195 | case OPS_PTAG_SS_USERDEFINED05: | 1195 | case OPS_PTAG_SS_USERDEFINED05: | |
1196 | case OPS_PTAG_SS_USERDEFINED06: | 1196 | case OPS_PTAG_SS_USERDEFINED06: | |
1197 | case OPS_PTAG_SS_USERDEFINED07: | 1197 | case OPS_PTAG_SS_USERDEFINED07: | |
1198 | case OPS_PTAG_SS_USERDEFINED08: | 1198 | case OPS_PTAG_SS_USERDEFINED08: | |
1199 | case OPS_PTAG_SS_USERDEFINED09: | 1199 | case OPS_PTAG_SS_USERDEFINED09: | |
@@ -1446,27 +1446,27 @@ parse_userattr(__ops_region_t *region, _ | @@ -1446,27 +1446,27 @@ parse_userattr(__ops_region_t *region, _ | |||
1446 | * xxx- treat as raw data for now. Could break down further into | 1446 | * xxx- treat as raw data for now. Could break down further into | |
1447 | * attribute sub-packets later - rachel | 1447 | * attribute sub-packets later - rachel | |
1448 | */ | 1448 | */ | |
1449 | 1449 | |||
1450 | if (region->readc != 0) { | 1450 | if (region->readc != 0) { | |
1451 | /* We should not have read anything so far */ | 1451 | /* We should not have read anything so far */ | |
1452 | (void) fprintf(stderr, "parse_userattr: bad length\n"); | 1452 | (void) fprintf(stderr, "parse_userattr: bad length\n"); | |
1453 | return 0; | 1453 | return 0; | |
1454 | } | 1454 | } | |
1455 | 1455 | |||
1456 | if (!read_data(&pkt.u.userattr.data, region, pinfo)) | 1456 | if (!read_data(&pkt.u.userattr.data, region, pinfo)) | |
1457 | return 0; | 1457 | return 0; | |
1458 | 1458 | |||
1459 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_CT_USER_ATTRIBUTE, &pkt); | 1459 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_CT_USER_ATTR, &pkt); | |
1460 | 1460 | |||
1461 | return 1; | 1461 | return 1; | |
1462 | } | 1462 | } | |
1463 | 1463 | |||
1464 | /** | 1464 | /** | |
1465 | \ingroup Core_Create | 1465 | \ingroup Core_Create | |
1466 | \brief Free allocated memory | 1466 | \brief Free allocated memory | |
1467 | */ | 1467 | */ | |
1468 | /* ! Free the memory used when parsing this packet type */ | 1468 | /* ! Free the memory used when parsing this packet type */ | |
1469 | void | 1469 | void | |
1470 | __ops_userid_free(__ops_userid_t *id) | 1470 | __ops_userid_free(__ops_userid_t *id) | |
1471 | { | 1471 | { | |
1472 | (void) free(id->userid); | 1472 | (void) free(id->userid); | |
@@ -1686,44 +1686,44 @@ parse_one_sig_subpacket(__ops_sig_t *sig | @@ -1686,44 +1686,44 @@ parse_one_sig_subpacket(__ops_sig_t *sig | |||
1686 | 1686 | |||
1687 | if (subregion.length > region->length) { | 1687 | if (subregion.length > region->length) { | |
1688 | ERRP(&pinfo->cbinfo, pkt, "Subpacket too long"); | 1688 | ERRP(&pinfo->cbinfo, pkt, "Subpacket too long"); | |
1689 | } | 1689 | } | |
1690 | 1690 | |||
1691 | if (!limited_read(&c, 1, &subregion, pinfo)) { | 1691 | if (!limited_read(&c, 1, &subregion, pinfo)) { | |
1692 | return 0; | 1692 | return 0; | |
1693 | } | 1693 | } | |
1694 | 1694 | |||
1695 | t8 = (c & 0x7f) / 8; | 1695 | t8 = (c & 0x7f) / 8; | |
1696 | t7 = 1 << (c & 7); | 1696 | t7 = 1 << (c & 7); | |
1697 | 1697 | |||
1698 | pkt.critical = (unsigned)c >> 7; | 1698 | pkt.critical = (unsigned)c >> 7; | |
1699 | pkt.tag = OPS_PTAG_SIGNATURE_SUBPACKET_BASE + (c & 0x7f); | 1699 | pkt.tag = OPS_PTAG_SIG_SUBPKT_BASE + (c & 0x7f); | |
1700 | 1700 | |||
1701 | /* Application wants it delivered raw */ | 1701 | /* Application wants it delivered raw */ | |
1702 | if (pinfo->ss_raw[t8] & t7) { | 1702 | if (pinfo->ss_raw[t8] & t7) { | |
1703 | pkt.u.ss_raw.tag = pkt.tag; | 1703 | pkt.u.ss_raw.tag = pkt.tag; | |
1704 | pkt.u.ss_raw.length = subregion.length - 1; | 1704 | pkt.u.ss_raw.length = subregion.length - 1; | |
1705 | pkt.u.ss_raw.raw = calloc(1, pkt.u.ss_raw.length); | 1705 | pkt.u.ss_raw.raw = calloc(1, pkt.u.ss_raw.length); | |
1706 | if (!limited_read(pkt.u.ss_raw.raw, pkt.u.ss_raw.length, | 1706 | if (!limited_read(pkt.u.ss_raw.raw, pkt.u.ss_raw.length, | |
1707 | &subregion, pinfo)) { | 1707 | &subregion, pinfo)) { | |
1708 | return 0; | 1708 | return 0; | |
1709 | } | 1709 | } | |
1710 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_RAW_SS, &pkt); | 1710 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_RAW_SS, &pkt); | |
1711 | return 1; | 1711 | return 1; | |
1712 | } | 1712 | } | |
1713 | switch (pkt.tag) { | 1713 | switch (pkt.tag) { | |
1714 | case OPS_PTAG_SS_CREATION_TIME: | 1714 | case OPS_PTAG_SS_CREATION_TIME: | |
1715 | case OPS_PTAG_SS_EXPIRATION_TIME: | 1715 | case OPS_PTAG_SS_EXPIRATION_TIME: | |
1716 | case OPS_PTAG_SS_KEY_EXPIRATION_TIME: | 1716 | case OPS_PTAG_SS_KEY_EXPIRY: | |
1717 | if (!limited_read_time(&pkt.u.ss_time.time, &subregion, pinfo)) | 1717 | if (!limited_read_time(&pkt.u.ss_time.time, &subregion, pinfo)) | |
1718 | return 0; | 1718 | return 0; | |
1719 | if (pkt.tag == OPS_PTAG_SS_CREATION_TIME) { | 1719 | if (pkt.tag == OPS_PTAG_SS_CREATION_TIME) { | |
1720 | sig->info.birthtime = pkt.u.ss_time.time; | 1720 | sig->info.birthtime = pkt.u.ss_time.time; | |
1721 | sig->info.birthtime_set = 1; | 1721 | sig->info.birthtime_set = 1; | |
1722 | } | 1722 | } | |
1723 | break; | 1723 | break; | |
1724 | 1724 | |||
1725 | case OPS_PTAG_SS_TRUST: | 1725 | case OPS_PTAG_SS_TRUST: | |
1726 | if (!limited_read(&pkt.u.ss_trust.level, 1, &subregion, pinfo) | 1726 | if (!limited_read(&pkt.u.ss_trust.level, 1, &subregion, pinfo) | |
1727 | || !limited_read(&pkt.u.ss_trust.amount, 1, &subregion, pinfo)) | 1727 | || !limited_read(&pkt.u.ss_trust.amount, 1, &subregion, pinfo)) | |
1728 | return 0; | 1728 | return 0; | |
1729 | break; | 1729 | break; | |
@@ -1747,47 +1747,47 @@ parse_one_sig_subpacket(__ops_sig_t *sig | @@ -1747,47 +1747,47 @@ parse_one_sig_subpacket(__ops_sig_t *sig | |||
1747 | 1747 | |||
1748 | case OPS_PTAG_SS_PREFERRED_SKA: | 1748 | case OPS_PTAG_SS_PREFERRED_SKA: | |
1749 | if (!read_data(&pkt.u.ss_skapref.data, &subregion, pinfo)) { | 1749 | if (!read_data(&pkt.u.ss_skapref.data, &subregion, pinfo)) { | |
1750 | return 0; | 1750 | return 0; | |
1751 | } | 1751 | } | |
1752 | break; | 1752 | break; | |
1753 | 1753 | |||
1754 | case OPS_PTAG_SS_PREFERRED_HASH: | 1754 | case OPS_PTAG_SS_PREFERRED_HASH: | |
1755 | if (!read_data(&pkt.u.ss_hashpref.data, &subregion, pinfo)) { | 1755 | if (!read_data(&pkt.u.ss_hashpref.data, &subregion, pinfo)) { | |
1756 | return 0; | 1756 | return 0; | |
1757 | } | 1757 | } | |
1758 | break; | 1758 | break; | |
1759 | 1759 | |||
1760 | case OPS_PTAG_SS_PREFERRED_COMPRESSION: | 1760 | case OPS_PTAG_SS_PREF_COMPRESS: | |
1761 | if (!read_data(&pkt.u.ss_zpref.data, | 1761 | if (!read_data(&pkt.u.ss_zpref.data, | |
1762 | &subregion, pinfo)) { | 1762 | &subregion, pinfo)) { | |
1763 | return 0; | 1763 | return 0; | |
1764 | } | 1764 | } | |
1765 | break; | 1765 | break; | |
1766 | 1766 | |||
1767 | case OPS_PTAG_SS_PRIMARY_USER_ID: | 1767 | case OPS_PTAG_SS_PRIMARY_USER_ID: | |
1768 | if (!limited_read(&bools, 1, &subregion, pinfo)) { | 1768 | if (!limited_read(&bools, 1, &subregion, pinfo)) { | |
1769 | return 0; | 1769 | return 0; | |
1770 | } | 1770 | } | |
1771 | pkt.u.ss_primary_userid.primary_userid = !!bools; | 1771 | pkt.u.ss_primary_userid.primary_userid = !!bools; | |
1772 | break; | 1772 | break; | |
1773 | 1773 | |||
1774 | case OPS_PTAG_SS_KEY_FLAGS: | 1774 | case OPS_PTAG_SS_KEY_FLAGS: | |
1775 | if (!read_data(&pkt.u.ss_key_flags.data, &subregion, pinfo)) { | 1775 | if (!read_data(&pkt.u.ss_key_flags.data, &subregion, pinfo)) { | |
1776 | return 0; | 1776 | return 0; | |
1777 | } | 1777 | } | |
1778 | break; | 1778 | break; | |
1779 | 1779 | |||
1780 | case OPS_PTAG_SS_KEY_SERVER_PREFS: | 1780 | case OPS_PTAG_SS_KEYSERV_PREFS: | |
1781 | if (!read_data(&pkt.u.ss_key_server_prefs.data, &subregion, | 1781 | if (!read_data(&pkt.u.ss_key_server_prefs.data, &subregion, | |
1782 | pinfo)) { | 1782 | pinfo)) { | |
1783 | return 0; | 1783 | return 0; | |
1784 | } | 1784 | } | |
1785 | break; | 1785 | break; | |
1786 | 1786 | |||
1787 | case OPS_PTAG_SS_FEATURES: | 1787 | case OPS_PTAG_SS_FEATURES: | |
1788 | if (!read_data(&pkt.u.ss_features.data, &subregion, pinfo)) { | 1788 | if (!read_data(&pkt.u.ss_features.data, &subregion, pinfo)) { | |
1789 | return 0; | 1789 | return 0; | |
1790 | } | 1790 | } | |
1791 | break; | 1791 | break; | |
1792 | 1792 | |||
1793 | case OPS_PTAG_SS_SIGNERS_USER_ID: | 1793 | case OPS_PTAG_SS_SIGNERS_USER_ID: | |
@@ -1833,27 +1833,27 @@ parse_one_sig_subpacket(__ops_sig_t *sig | @@ -1833,27 +1833,27 @@ parse_one_sig_subpacket(__ops_sig_t *sig | |||
1833 | 1833 | |||
1834 | case OPS_PTAG_SS_POLICY_URI: | 1834 | case OPS_PTAG_SS_POLICY_URI: | |
1835 | if (!read_string(&pkt.u.ss_policy.url, &subregion, pinfo)) { | 1835 | if (!read_string(&pkt.u.ss_policy.url, &subregion, pinfo)) { | |
1836 | return 0; | 1836 | return 0; | |
1837 | } | 1837 | } | |
1838 | break; | 1838 | break; | |
1839 | 1839 | |||
1840 | case OPS_PTAG_SS_REGEXP: | 1840 | case OPS_PTAG_SS_REGEXP: | |
1841 | if (!read_string(&pkt.u.ss_regexp.regexp, &subregion, pinfo)) { | 1841 | if (!read_string(&pkt.u.ss_regexp.regexp, &subregion, pinfo)) { | |
1842 | return 0; | 1842 | return 0; | |
1843 | } | 1843 | } | |
1844 | break; | 1844 | break; | |
1845 | 1845 | |||
1846 | case OPS_PTAG_SS_PREFERRED_KEY_SERVER: | 1846 | case OPS_PTAG_SS_PREF_KEYSERV: | |
1847 | if (!read_string(&pkt.u.ss_keyserv.name, &subregion, | 1847 | if (!read_string(&pkt.u.ss_keyserv.name, &subregion, | |
1848 | pinfo)) { | 1848 | pinfo)) { | |
1849 | return 0; | 1849 | return 0; | |
1850 | } | 1850 | } | |
1851 | break; | 1851 | break; | |
1852 | 1852 | |||
1853 | case OPS_PTAG_SS_USERDEFINED00: | 1853 | case OPS_PTAG_SS_USERDEFINED00: | |
1854 | case OPS_PTAG_SS_USERDEFINED01: | 1854 | case OPS_PTAG_SS_USERDEFINED01: | |
1855 | case OPS_PTAG_SS_USERDEFINED02: | 1855 | case OPS_PTAG_SS_USERDEFINED02: | |
1856 | case OPS_PTAG_SS_USERDEFINED03: | 1856 | case OPS_PTAG_SS_USERDEFINED03: | |
1857 | case OPS_PTAG_SS_USERDEFINED04: | 1857 | case OPS_PTAG_SS_USERDEFINED04: | |
1858 | case OPS_PTAG_SS_USERDEFINED05: | 1858 | case OPS_PTAG_SS_USERDEFINED05: | |
1859 | case OPS_PTAG_SS_USERDEFINED06: | 1859 | case OPS_PTAG_SS_USERDEFINED06: | |
@@ -2284,27 +2284,27 @@ parse_one_pass(__ops_region_t * region, | @@ -2284,27 +2284,27 @@ parse_one_pass(__ops_region_t * region, | |||
2284 | return 0; | 2284 | return 0; | |
2285 | } | 2285 | } | |
2286 | pkt.u.one_pass_sig.key_alg = c; | 2286 | pkt.u.one_pass_sig.key_alg = c; | |
2287 | 2287 | |||
2288 | if (!limited_read(pkt.u.one_pass_sig.keyid, | 2288 | if (!limited_read(pkt.u.one_pass_sig.keyid, | |
2289 | sizeof(pkt.u.one_pass_sig.keyid), region, pinfo)) { | 2289 | sizeof(pkt.u.one_pass_sig.keyid), region, pinfo)) { | |
2290 | return 0; | 2290 | return 0; | |
2291 | } | 2291 | } | |
2292 | 2292 | |||
2293 | if (!limited_read(&c, 1, region, pinfo)) { | 2293 | if (!limited_read(&c, 1, region, pinfo)) { | |
2294 | return 0; | 2294 | return 0; | |
2295 | } | 2295 | } | |
2296 | pkt.u.one_pass_sig.nested = !!c; | 2296 | pkt.u.one_pass_sig.nested = !!c; | |
2297 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_CT_ONE_PASS_SIGNATURE, &pkt); | 2297 | CALLBACK(&pinfo->cbinfo, OPS_PTAG_CT_1_PASS_SIG, &pkt); | |
2298 | /* XXX: we should, perhaps, let the app choose whether to hash or not */ | 2298 | /* XXX: we should, perhaps, let the app choose whether to hash or not */ | |
2299 | parse_hash_init(pinfo, pkt.u.one_pass_sig.hash_alg, | 2299 | parse_hash_init(pinfo, pkt.u.one_pass_sig.hash_alg, | |
2300 | pkt.u.one_pass_sig.keyid); | 2300 | pkt.u.one_pass_sig.keyid); | |
2301 | return 1; | 2301 | return 1; | |
2302 | } | 2302 | } | |
2303 | 2303 | |||
2304 | /** | 2304 | /** | |
2305 | \ingroup Core_ReadPackets | 2305 | \ingroup Core_ReadPackets | |
2306 | \brief Parse a Trust packet | 2306 | \brief Parse a Trust packet | |
2307 | */ | 2307 | */ | |
2308 | static int | 2308 | static int | |
2309 | parse_trust(__ops_region_t *region, __ops_parseinfo_t *pinfo) | 2309 | parse_trust(__ops_region_t *region, __ops_parseinfo_t *pinfo) | |
2310 | { | 2310 | { | |
@@ -3226,35 +3226,35 @@ __ops_parse_packet(__ops_parseinfo_t *pi | @@ -3226,35 +3226,35 @@ __ops_parse_packet(__ops_parseinfo_t *pi | |||
3226 | 3226 | |||
3227 | case OPS_PTAG_CT_TRUST: | 3227 | case OPS_PTAG_CT_TRUST: | |
3228 | ret = parse_trust(®ion, pinfo); | 3228 | ret = parse_trust(®ion, pinfo); | |
3229 | break; | 3229 | break; | |
3230 | 3230 | |||
3231 | case OPS_PTAG_CT_USER_ID: | 3231 | case OPS_PTAG_CT_USER_ID: | |
3232 | ret = parse_userid(®ion, pinfo); | 3232 | ret = parse_userid(®ion, pinfo); | |
3233 | break; | 3233 | break; | |
3234 | 3234 | |||
3235 | case OPS_PTAG_CT_COMPRESSED: | 3235 | case OPS_PTAG_CT_COMPRESSED: | |
3236 | ret = parse_compressed(®ion, pinfo); | 3236 | ret = parse_compressed(®ion, pinfo); | |
3237 | break; | 3237 | break; | |
3238 | 3238 | |||
3239 | case OPS_PTAG_CT_ONE_PASS_SIGNATURE: | 3239 | case OPS_PTAG_CT_1_PASS_SIG: | |
3240 | ret = parse_one_pass(®ion, pinfo); | 3240 | ret = parse_one_pass(®ion, pinfo); | |
3241 | break; | 3241 | break; | |
3242 | 3242 | |||
3243 | case OPS_PTAG_CT_LITERAL_DATA: | 3243 | case OPS_PTAG_CT_LITERAL_DATA: | |
3244 | ret = parse_litdata(®ion, pinfo); | 3244 | ret = parse_litdata(®ion, pinfo); | |
3245 | break; | 3245 | break; | |
3246 | 3246 | |||
3247 | case OPS_PTAG_CT_USER_ATTRIBUTE: | 3247 | case OPS_PTAG_CT_USER_ATTR: | |
3248 | ret = parse_userattr(®ion, pinfo); | 3248 | ret = parse_userattr(®ion, pinfo); | |
3249 | break; | 3249 | break; | |
3250 | 3250 | |||
3251 | case OPS_PTAG_CT_SECRET_KEY: | 3251 | case OPS_PTAG_CT_SECRET_KEY: | |
3252 | ret = parse_seckey(®ion, pinfo); | 3252 | ret = parse_seckey(®ion, pinfo); | |
3253 | break; | 3253 | break; | |
3254 | 3254 | |||
3255 | case OPS_PTAG_CT_SECRET_SUBKEY: | 3255 | case OPS_PTAG_CT_SECRET_SUBKEY: | |
3256 | ret = parse_seckey(®ion, pinfo); | 3256 | ret = parse_seckey(®ion, pinfo); | |
3257 | break; | 3257 | break; | |
3258 | 3258 | |||
3259 | case OPS_PTAG_CT_PK_SESSION_KEY: | 3259 | case OPS_PTAG_CT_PK_SESSION_KEY: | |
3260 | ret = parse_pk_sesskey(®ion, pinfo); | 3260 | ret = parse_pk_sesskey(®ion, pinfo); | |
@@ -3369,38 +3369,38 @@ __ops_parse(__ops_parseinfo_t *pinfo, in | @@ -3369,38 +3369,38 @@ __ops_parse(__ops_parseinfo_t *pinfo, in | |||
3369 | * \todo Make all packet types optional, not just subpackets */ | 3369 | * \todo Make all packet types optional, not just subpackets */ | |
3370 | void | 3370 | void | |
3371 | __ops_parse_options(__ops_parseinfo_t *pinfo, | 3371 | __ops_parse_options(__ops_parseinfo_t *pinfo, | |
3372 | __ops_content_tag_t tag, | 3372 | __ops_content_tag_t tag, | |
3373 | __ops_parse_type_t type) | 3373 | __ops_parse_type_t type) | |
3374 | { | 3374 | { | |
3375 | int t8, t7; | 3375 | int t8, t7; | |
3376 | 3376 | |||
3377 | if (tag == OPS_PTAG_SS_ALL) { | 3377 | if (tag == OPS_PTAG_SS_ALL) { | |
3378 | int n; | 3378 | int n; | |
3379 | 3379 | |||
3380 | for (n = 0; n < 256; ++n) { | 3380 | for (n = 0; n < 256; ++n) { | |
3381 | __ops_parse_options(pinfo, | 3381 | __ops_parse_options(pinfo, | |
3382 | OPS_PTAG_SIGNATURE_SUBPACKET_BASE + n, | 3382 | OPS_PTAG_SIG_SUBPKT_BASE + n, | |
3383 | type); | 3383 | type); | |
3384 | } | 3384 | } | |
3385 | return; | 3385 | return; | |
3386 | } | 3386 | } | |
3387 | if (tag < OPS_PTAG_SIGNATURE_SUBPACKET_BASE || | 3387 | if (tag < OPS_PTAG_SIG_SUBPKT_BASE || | |
3388 | tag > OPS_PTAG_SIGNATURE_SUBPACKET_BASE + NTAGS - 1) { | 3388 | tag > OPS_PTAG_SIG_SUBPKT_BASE + NTAGS - 1) { | |
3389 | (void) fprintf(stderr, "__ops_parse_options: bad tag\n"); | 3389 | (void) fprintf(stderr, "__ops_parse_options: bad tag\n"); | |
3390 | return; | 3390 | return; | |
3391 | } | 3391 | } | |
3392 | t8 = (tag - OPS_PTAG_SIGNATURE_SUBPACKET_BASE) / 8; | 3392 | t8 = (tag - OPS_PTAG_SIG_SUBPKT_BASE) / 8; | |
3393 | t7 = 1 << ((tag - OPS_PTAG_SIGNATURE_SUBPACKET_BASE) & 7); | 3393 | t7 = 1 << ((tag - OPS_PTAG_SIG_SUBPKT_BASE) & 7); | |
3394 | switch (type) { | 3394 | switch (type) { | |
3395 | case OPS_PARSE_RAW: | 3395 | case OPS_PARSE_RAW: | |
3396 | pinfo->ss_raw[t8] |= t7; | 3396 | pinfo->ss_raw[t8] |= t7; | |
3397 | pinfo->ss_parsed[t8] &= ~t7; | 3397 | pinfo->ss_parsed[t8] &= ~t7; | |
3398 | break; | 3398 | break; | |
3399 | 3399 | |||
3400 | case OPS_PARSE_PARSED: | 3400 | case OPS_PARSE_PARSED: | |
3401 | pinfo->ss_raw[t8] &= ~t7; | 3401 | pinfo->ss_raw[t8] &= ~t7; | |
3402 | pinfo->ss_parsed[t8] |= t7; | 3402 | pinfo->ss_parsed[t8] |= t7; | |
3403 | break; | 3403 | break; | |
3404 | 3404 | |||
3405 | case OPS_PARSE_IGNORE: | 3405 | case OPS_PARSE_IGNORE: | |
3406 | pinfo->ss_raw[t8] &= ~t7; | 3406 | pinfo->ss_raw[t8] &= ~t7; |
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c 2009/05/19 05:13:10 1.13
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c 2009/05/21 00:33:32 1.14
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * limitations under the License. | 47 | * limitations under the License. | |
48 | */ | 48 | */ | |
49 | 49 | |||
50 | /** \file | 50 | /** \file | |
51 | */ | 51 | */ | |
52 | #include "config.h" | 52 | #include "config.h" | |
53 | 53 | |||
54 | #ifdef HAVE_SYS_CDEFS_H | 54 | #ifdef HAVE_SYS_CDEFS_H | |
55 | #include <sys/cdefs.h> | 55 | #include <sys/cdefs.h> | |
56 | #endif | 56 | #endif | |
57 | 57 | |||
58 | #if defined(__NetBSD__) | 58 | #if defined(__NetBSD__) | |
59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 59 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
60 | __RCSID("$NetBSD: signature.c,v 1.13 2009/05/19 05:13:10 agc Exp $"); | 60 | __RCSID("$NetBSD: signature.c,v 1.14 2009/05/21 00:33:32 agc Exp $"); | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | #include <sys/types.h> | 63 | #include <sys/types.h> | |
64 | #include <sys/param.h> | 64 | #include <sys/param.h> | |
65 | 65 | |||
66 | #ifdef HAVE_FCNTL_H | 66 | #ifdef HAVE_FCNTL_H | |
67 | #include <fcntl.h> | 67 | #include <fcntl.h> | |
68 | #endif | 68 | #endif | |
69 | 69 | |||
70 | #include <string.h> | 70 | #include <string.h> | |
71 | 71 | |||
72 | #ifdef HAVE_UNISTD_H | 72 | #ifdef HAVE_UNISTD_H | |
73 | #include <unistd.h> | 73 | #include <unistd.h> | |
@@ -75,36 +75,34 @@ __RCSID("$NetBSD: signature.c,v 1.13 200 | @@ -75,36 +75,34 @@ __RCSID("$NetBSD: signature.c,v 1.13 200 | |||
75 | 75 | |||
76 | #ifdef HAVE_OPENSSL_DSA_H | 76 | #ifdef HAVE_OPENSSL_DSA_H | |
77 | #include <openssl/dsa.h> | 77 | #include <openssl/dsa.h> | |
78 | #endif | 78 | #endif | |
79 | 79 | |||
80 | #include "signature.h" | 80 | #include "signature.h" | |
81 | #include "crypto.h" | 81 | #include "crypto.h" | |
82 | #include "create.h" | 82 | #include "create.h" | |
83 | #include "netpgpsdk.h" | 83 | #include "netpgpsdk.h" | |
84 | #include "readerwriter.h" | 84 | #include "readerwriter.h" | |
85 | #include "validate.h" | 85 | #include "validate.h" | |
86 | #include "netpgpdefs.h" | 86 | #include "netpgpdefs.h" | |
87 | 87 | |||
88 | #define MAXBUF 1024 /* <! Standard buffer size to use */ | |||
89 | ||||
90 | /** \ingroup Core_Create | 88 | /** \ingroup Core_Create | |
91 | * needed for signature creation | 89 | * needed for signature creation | |
92 | */ | 90 | */ | |
93 | struct __ops_create_sig { | 91 | struct __ops_create_sig_t { | |
94 | __ops_hash_t hash; | 92 | __ops_hash_t hash; | |
95 | __ops_sig_t sig; | 93 | __ops_sig_t sig; | |
96 | __ops_memory_t *mem; | 94 | __ops_memory_t *mem; | |
97 | __ops_output_t *output;/* !< how to do the writing */ | 95 | __ops_output_t *output; /* how to do the writing */ | |
98 | unsigned hashoff; /* hashed count offset */ | 96 | unsigned hashoff; /* hashed count offset */ | |
99 | unsigned hashlen; | 97 | unsigned hashlen; | |
100 | unsigned unhashoff; | 98 | unsigned unhashoff; | |
101 | }; | 99 | }; | |
102 | 100 | |||
103 | /** | 101 | /** | |
104 | \ingroup Core_Signature | 102 | \ingroup Core_Signature | |
105 | Creates new __ops_create_sig_t | 103 | Creates new __ops_create_sig_t | |
106 | \return new __ops_create_sig_t | 104 | \return new __ops_create_sig_t | |
107 | \note It is the caller's responsibility to call __ops_create_sig_delete() | 105 | \note It is the caller's responsibility to call __ops_create_sig_delete() | |
108 | \sa __ops_create_sig_delete() | 106 | \sa __ops_create_sig_delete() | |
109 | */ | 107 | */ | |
110 | __ops_create_sig_t * | 108 | __ops_create_sig_t * | |
@@ -345,31 +343,28 @@ rsa_verify(__ops_hash_alg_t type, | @@ -345,31 +343,28 @@ rsa_verify(__ops_hash_alg_t type, | |||
345 | 343 | |||
346 | printf("\n"); | 344 | printf("\n"); | |
347 | printf("hash from sig\n"); | 345 | printf("hash from sig\n"); | |
348 | for (uu = 0; uu < hash_length; uu++) { | 346 | for (uu = 0; uu < hash_length; uu++) { | |
349 | printf("%02x ", hashbuf_from_sig[n + plen + uu]); | 347 | printf("%02x ", hashbuf_from_sig[n + plen + uu]); | |
350 | } | 348 | } | |
351 | printf("\n"); | 349 | printf("\n"); | |
352 | printf("hash passed in (should match hash from sig)\n"); | 350 | printf("hash passed in (should match hash from sig)\n"); | |
353 | for (uu = 0; uu < hash_length; uu++) { | 351 | for (uu = 0; uu < hash_length; uu++) { | |
354 | printf("%02x ", hash[uu]); | 352 | printf("%02x ", hash[uu]); | |
355 | } | 353 | } | |
356 | printf("\n"); | 354 | printf("\n"); | |
357 | } | 355 | } | |
358 | if (memcmp(&hashbuf_from_sig[n], prefix, plen) != 0 || | 356 | return (memcmp(&hashbuf_from_sig[n], prefix, plen) == 0 && | |
359 | memcmp(&hashbuf_from_sig[n + plen], hash, hash_length) != 0) { | 357 | memcmp(&hashbuf_from_sig[n + plen], hash, hash_length) == 0); | |
360 | return 0; | |||
361 | } | |||
362 | return 1; | |||
363 | } | 358 | } | |
364 | 359 | |||
365 | static void | 360 | static void | |
366 | hash_add_key(__ops_hash_t *hash, const __ops_pubkey_t *key) | 361 | hash_add_key(__ops_hash_t *hash, const __ops_pubkey_t *key) | |
367 | { | 362 | { | |
368 | __ops_memory_t *mem = __ops_memory_new(); | 363 | __ops_memory_t *mem = __ops_memory_new(); | |
369 | size_t len; | 364 | size_t len; | |
370 | 365 | |||
371 | __ops_build_pubkey(mem, key, 0); | 366 | __ops_build_pubkey(mem, key, 0); | |
372 | len = __ops_mem_len(mem); | 367 | len = __ops_mem_len(mem); | |
373 | __ops_hash_add_int(hash, 0x99, 1); | 368 | __ops_hash_add_int(hash, 0x99, 1); | |
374 | __ops_hash_add_int(hash, len, 2); | 369 | __ops_hash_add_int(hash, len, 2); | |
375 | hash->add(hash, __ops_mem_data(mem), len); | 370 | hash->add(hash, __ops_mem_data(mem), len); | |
@@ -417,27 +412,27 @@ hash_add_trailer(__ops_hash_t *hash, con | @@ -417,27 +412,27 @@ hash_add_trailer(__ops_hash_t *hash, con | |||
417 | \param sig The Signature to be checked | 412 | \param sig The Signature to be checked | |
418 | \param signer The signer's public key | 413 | \param signer The signer's public key | |
419 | \return 1 if good; else 0 | 414 | \return 1 if good; else 0 | |
420 | */ | 415 | */ | |
421 | unsigned | 416 | unsigned | |
422 | __ops_check_sig(const unsigned char *hash, unsigned length, | 417 | __ops_check_sig(const unsigned char *hash, unsigned length, | |
423 | const __ops_sig_t * sig, | 418 | const __ops_sig_t * sig, | |
424 | const __ops_pubkey_t * signer) | 419 | const __ops_pubkey_t * signer) | |
425 | { | 420 | { | |
426 | unsigned ret; | 421 | unsigned ret; | |
427 | 422 | |||
428 | if (__ops_get_debug_level(__FILE__)) { | 423 | if (__ops_get_debug_level(__FILE__)) { | |
429 | printf("__ops_check_sig: (length %d) hash=", length); | 424 | printf("__ops_check_sig: (length %d) hash=", length); | |
430 | hexdump(hash, length, ""); | 425 | hexdump(stdout, hash, length, ""); | |
431 | } | 426 | } | |
432 | ret = 0; | 427 | ret = 0; | |
433 | switch (sig->info.key_alg) { | 428 | switch (sig->info.key_alg) { | |
434 | case OPS_PKA_DSA: | 429 | case OPS_PKA_DSA: | |
435 | ret = __ops_dsa_verify(hash, length, &sig->info.sig.dsa, | 430 | ret = __ops_dsa_verify(hash, length, &sig->info.sig.dsa, | |
436 | &signer->key.dsa); | 431 | &signer->key.dsa); | |
437 | break; | 432 | break; | |
438 | 433 | |||
439 | case OPS_PKA_RSA: | 434 | case OPS_PKA_RSA: | |
440 | ret = rsa_verify(sig->info.hash_alg, hash, length, | 435 | ret = rsa_verify(sig->info.hash_alg, hash, length, | |
441 | &sig->info.sig.rsa, | 436 | &sig->info.sig.rsa, | |
442 | &signer->key.rsa); | 437 | &signer->key.rsa); | |
443 | break; | 438 | break; | |
@@ -475,30 +470,30 @@ finalise_sig(__ops_hash_t * hash, | @@ -475,30 +470,30 @@ finalise_sig(__ops_hash_t * hash, | |||
475 | /** | 470 | /** | |
476 | * \ingroup Core_Signature | 471 | * \ingroup Core_Signature | |
477 | * | 472 | * | |
478 | * \brief Verify a certification signature. | 473 | * \brief Verify a certification signature. | |
479 | * | 474 | * | |
480 | * \param key The public key that was signed. | 475 | * \param key The public key that was signed. | |
481 | * \param id The user ID that was signed | 476 | * \param id The user ID that was signed | |
482 | * \param sig The signature. | 477 | * \param sig The signature. | |
483 | * \param signer The public key of the signer. | 478 | * \param signer The public key of the signer. | |
484 | * \param raw_packet The raw signature packet. | 479 | * \param raw_packet The raw signature packet. | |
485 | * \return 1 if OK; else 0 | 480 | * \return 1 if OK; else 0 | |
486 | */ | 481 | */ | |
487 | unsigned | 482 | unsigned | |
488 | __ops_check_useridcert_sig(const __ops_pubkey_t * key, | 483 | __ops_check_useridcert_sig(const __ops_pubkey_t *key, | |
489 | const __ops_userid_t * id, | 484 | const __ops_userid_t *id, | |
490 | const __ops_sig_t * sig, | 485 | const __ops_sig_t *sig, | |
491 | const __ops_pubkey_t * signer, | 486 | const __ops_pubkey_t *signer, | |
492 | const unsigned char *raw_packet) | 487 | const unsigned char *raw_packet) | |
493 | { | 488 | { | |
494 | __ops_hash_t hash; | 489 | __ops_hash_t hash; | |
495 | size_t userid_len = strlen((char *) id->userid); | 490 | size_t userid_len = strlen((char *) id->userid); | |
496 | 491 | |||
497 | init_key_sig(&hash, sig, key); | 492 | init_key_sig(&hash, sig, key); | |
498 | 493 | |||
499 | if (sig->info.version == OPS_V4) { | 494 | if (sig->info.version == OPS_V4) { | |
500 | __ops_hash_add_int(&hash, 0xb4, 1); | 495 | __ops_hash_add_int(&hash, 0xb4, 1); | |
501 | __ops_hash_add_int(&hash, userid_len, 4); | 496 | __ops_hash_add_int(&hash, userid_len, 4); | |
502 | } | 497 | } | |
503 | hash.add(&hash, id->userid, userid_len); | 498 | hash.add(&hash, id->userid, userid_len); | |
504 | 499 | |||
@@ -540,55 +535,55 @@ __ops_check_userattrcert_sig(const __ops | @@ -540,55 +535,55 @@ __ops_check_userattrcert_sig(const __ops | |||
540 | /** | 535 | /** | |
541 | * \ingroup Core_Signature | 536 | * \ingroup Core_Signature | |
542 | * | 537 | * | |
543 | * Verify a subkey signature. | 538 | * Verify a subkey signature. | |
544 | * | 539 | * | |
545 | * \param key The public key whose subkey was signed. | 540 | * \param key The public key whose subkey was signed. | |
546 | * \param subkey The subkey of the public key that was signed. | 541 | * \param subkey The subkey of the public key that was signed. | |
547 | * \param sig The signature. | 542 | * \param sig The signature. | |
548 | * \param signer The public key of the signer. | 543 | * \param signer The public key of the signer. | |
549 | * \param raw_packet The raw signature packet. | 544 | * \param raw_packet The raw signature packet. | |
550 | * \return 1 if OK; else 0 | 545 | * \return 1 if OK; else 0 | |
551 | */ | 546 | */ | |
552 | unsigned | 547 | unsigned | |
553 | __ops_check_subkey_sig(const __ops_pubkey_t * key, | 548 | __ops_check_subkey_sig(const __ops_pubkey_t *key, | |
554 | const __ops_pubkey_t * subkey, | 549 | const __ops_pubkey_t *subkey, | |
555 | const __ops_sig_t * sig, | 550 | const __ops_sig_t *sig, | |
556 | const __ops_pubkey_t * signer, | 551 | const __ops_pubkey_t *signer, | |
557 | const unsigned char *raw_packet) | 552 | const unsigned char *raw_packet) | |
558 | { | 553 | { | |
559 | __ops_hash_t hash; | 554 | __ops_hash_t hash; | |
560 | 555 | |||
561 | init_key_sig(&hash, sig, key); | 556 | init_key_sig(&hash, sig, key); | |
562 | hash_add_key(&hash, subkey); | 557 | hash_add_key(&hash, subkey); | |
563 | 558 | |||
564 | return finalise_sig(&hash, sig, signer, raw_packet); | 559 | return finalise_sig(&hash, sig, signer, raw_packet); | |
565 | } | 560 | } | |
566 | 561 | |||
567 | /** | 562 | /** | |
568 | * \ingroup Core_Signature | 563 | * \ingroup Core_Signature | |
569 | * | 564 | * | |
570 | * Verify a direct signature. | 565 | * Verify a direct signature. | |
571 | * | 566 | * | |
572 | * \param key The public key which was signed. | 567 | * \param key The public key which was signed. | |
573 | * \param sig The signature. | 568 | * \param sig The signature. | |
574 | * \param signer The public key of the signer. | 569 | * \param signer The public key of the signer. | |
575 | * \param raw_packet The raw signature packet. | 570 | * \param raw_packet The raw signature packet. | |
576 | * \return 1 if OK; else 0 | 571 | * \return 1 if OK; else 0 | |
577 | */ | 572 | */ | |
578 | unsigned | 573 | unsigned | |
579 | __ops_check_direct_sig(const __ops_pubkey_t * key, | 574 | __ops_check_direct_sig(const __ops_pubkey_t *key, | |
580 | const __ops_sig_t * sig, | 575 | const __ops_sig_t *sig, | |
581 | const __ops_pubkey_t * signer, | 576 | const __ops_pubkey_t *signer, | |
582 | const unsigned char *raw_packet) | 577 | const unsigned char *raw_packet) | |
583 | { | 578 | { | |
584 | __ops_hash_t hash; | 579 | __ops_hash_t hash; | |
585 | 580 | |||
586 | init_key_sig(&hash, sig, key); | 581 | init_key_sig(&hash, sig, key); | |
587 | return finalise_sig(&hash, sig, signer, raw_packet); | 582 | return finalise_sig(&hash, sig, signer, raw_packet); | |
588 | } | 583 | } | |
589 | 584 | |||
590 | /** | 585 | /** | |
591 | * \ingroup Core_Signature | 586 | * \ingroup Core_Signature | |
592 | * | 587 | * | |
593 | * Verify a signature on a hash (the hash will have already been fed | 588 | * Verify a signature on a hash (the hash will have already been fed | |
594 | * the material that was being signed, for example signed cleartext). | 589 | * the material that was being signed, for example signed cleartext). | |
@@ -600,27 +595,27 @@ __ops_check_direct_sig(const __ops_pubke | @@ -600,27 +595,27 @@ __ops_check_direct_sig(const __ops_pubke | |||
600 | * \return 1 if OK; else 0 | 595 | * \return 1 if OK; else 0 | |
601 | */ | 596 | */ | |
602 | unsigned | 597 | unsigned | |
603 | __ops_check_hash_sig(__ops_hash_t *hash, | 598 | __ops_check_hash_sig(__ops_hash_t *hash, | |
604 | const __ops_sig_t *sig, | 599 | const __ops_sig_t *sig, | |
605 | const __ops_pubkey_t *signer) | 600 | const __ops_pubkey_t *signer) | |
606 | { | 601 | { | |
607 | return (sig->info.hash_alg == hash->alg) ? | 602 | return (sig->info.hash_alg == hash->alg) ? | |
608 | finalise_sig(hash, sig, signer, NULL) : | 603 | finalise_sig(hash, sig, signer, NULL) : | |
609 | 0; | 604 | 0; | |
610 | } | 605 | } | |
611 | 606 | |||
612 | static void | 607 | static void | |
613 | start_sig_in_mem(__ops_create_sig_t * sig) | 608 | start_sig_in_mem(__ops_create_sig_t *sig) | |
614 | { | 609 | { | |
615 | /* since this has subpackets and stuff, we have to buffer the whole */ | 610 | /* since this has subpackets and stuff, we have to buffer the whole */ | |
616 | /* thing to get counts before writing. */ | 611 | /* thing to get counts before writing. */ | |
617 | sig->mem = __ops_memory_new(); | 612 | sig->mem = __ops_memory_new(); | |
618 | __ops_memory_init(sig->mem, 100); | 613 | __ops_memory_init(sig->mem, 100); | |
619 | __ops_writer_set_memory(sig->output, sig->mem); | 614 | __ops_writer_set_memory(sig->output, sig->mem); | |
620 | 615 | |||
621 | /* write nearly up to the first subpacket */ | 616 | /* write nearly up to the first subpacket */ | |
622 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.version, 1); | 617 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.version, 1); | |
623 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.type, 1); | 618 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.type, 1); | |
624 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.key_alg, 1); | 619 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.key_alg, 1); | |
625 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.hash_alg, 1); | 620 | __ops_write_scalar(sig->output, (unsigned)sig->sig.info.hash_alg, 1); | |
626 | 621 | |||
@@ -716,87 +711,83 @@ __ops_sig_add_data(__ops_create_sig_t *s | @@ -716,87 +711,83 @@ __ops_sig_add_data(__ops_create_sig_t *s | |||
716 | { | 711 | { | |
717 | sig->hash.add(&sig->hash, buf, length); | 712 | sig->hash.add(&sig->hash, buf, length); | |
718 | } | 713 | } | |
719 | 714 | |||
720 | /** | 715 | /** | |
721 | * \ingroup Core_Signature | 716 | * \ingroup Core_Signature | |
722 | * | 717 | * | |
723 | * Mark the end of the hashed subpackets in the signature | 718 | * Mark the end of the hashed subpackets in the signature | |
724 | * | 719 | * | |
725 | * \param sig | 720 | * \param sig | |
726 | */ | 721 | */ | |
727 | 722 | |||
728 | unsigned | 723 | unsigned | |
729 | __ops_end_hashed_subpkts(__ops_create_sig_t * sig) | 724 | __ops_end_hashed_subpkts(__ops_create_sig_t *sig) | |
730 | { | 725 | { | |
731 | sig->hashlen = __ops_mem_len(sig->mem) | 726 | sig->hashlen = __ops_mem_len(sig->mem) - sig->hashoff - 2; | |
732 | - sig->hashoff - 2; | 727 | __ops_memory_place_int(sig->mem, sig->hashoff, sig->hashlen, 2); | |
733 | __ops_memory_place_int(sig->mem, sig->hashoff, | |||
734 | sig->hashlen, 2); | |||
735 | /* dummy unhashed subpacket count */ | 728 | /* dummy unhashed subpacket count */ | |
736 | sig->unhashoff = __ops_mem_len(sig->mem); | 729 | sig->unhashoff = __ops_mem_len(sig->mem); | |
737 | return __ops_write_scalar(sig->output, 0, 2); | 730 | return __ops_write_scalar(sig->output, 0, 2); | |
738 | } | 731 | } | |
739 | 732 | |||
740 | /** | 733 | /** | |
741 | * \ingroup Core_Signature | 734 | * \ingroup Core_Signature | |
742 | * | 735 | * | |
743 | * Write out a signature | 736 | * Write out a signature | |
744 | * | 737 | * | |
745 | * \param sig | 738 | * \param sig | |
746 | * \param key | 739 | * \param key | |
747 | * \param seckey | 740 | * \param seckey | |
748 | * \param info | 741 | * \param info | |
749 | * | 742 | * | |
750 | */ | 743 | */ | |
751 | 744 | |||
752 | unsigned | 745 | unsigned | |
753 | __ops_write_sig(__ops_output_t *output, | 746 | __ops_write_sig(__ops_output_t *output, | |
754 | __ops_create_sig_t * sig, | 747 | __ops_create_sig_t *sig, | |
755 | const __ops_pubkey_t *key, | 748 | const __ops_pubkey_t *key, | |
756 | const __ops_seckey_t *seckey) | 749 | const __ops_seckey_t *seckey) | |
757 | { | 750 | { | |
758 | unsigned ret = 0; | 751 | unsigned ret = 0; | |
759 | size_t len = __ops_mem_len(sig->mem); | 752 | size_t len = __ops_mem_len(sig->mem); | |
760 | 753 | |||
761 | /* check key not decrypted */ | 754 | /* check key not decrypted */ | |
762 | switch (seckey->pubkey.alg) { | 755 | switch (seckey->pubkey.alg) { | |
763 | case OPS_PKA_RSA: | 756 | case OPS_PKA_RSA: | |
764 | case OPS_PKA_RSA_ENCRYPT_ONLY: | 757 | case OPS_PKA_RSA_ENCRYPT_ONLY: | |
765 | case OPS_PKA_RSA_SIGN_ONLY: | 758 | case OPS_PKA_RSA_SIGN_ONLY: | |
766 | if (seckey->key.rsa.d == NULL) { | 759 | if (seckey->key.rsa.d == NULL) { | |
767 | (void) fprintf(stderr, | 760 | (void) fprintf(stderr, "__ops_write_sig: null rsa.d\n"); | |
768 | "__ops_write_sig: null rsa.d\n"); | |||
769 | return 0; | 761 | return 0; | |
770 | } | 762 | } | |
771 | break; | 763 | break; | |
772 | 764 | |||
773 | case OPS_PKA_DSA: | 765 | case OPS_PKA_DSA: | |
774 | if (seckey->key.dsa.x == NULL) { | 766 | if (seckey->key.dsa.x == NULL) { | |
775 | (void) fprintf(stderr, | 767 | (void) fprintf(stderr, "__ops_write_sig: null dsa.x\n"); | |
776 | "__ops_write_sig: null dsa.x\n"); | |||
777 | return 0; | 768 | return 0; | |
778 | } | 769 | } | |
779 | break; | 770 | break; | |
780 | 771 | |||
781 | default: | 772 | default: | |
782 | (void) fprintf(stderr, "Unsupported algorithm %d\n", | 773 | (void) fprintf(stderr, "Unsupported algorithm %d\n", | |
783 | seckey->pubkey.alg); | 774 | seckey->pubkey.alg); | |
784 | return 0; | 775 | return 0; | |
785 | } | 776 | } | |
786 | 777 | |||
787 | if (sig->hashlen == (unsigned) -1) { | 778 | if (sig->hashlen == (unsigned) -1) { | |
788 | (void) fprintf(stderr, | 779 | (void) fprintf(stderr, | |
789 | "ops_write_sig: bad hashed data len\n"); | 780 | "ops_write_sig: bad hashed data len\n"); | |
790 | return 0; | 781 | return 0; | |
791 | } | 782 | } | |
792 | 783 | |||
793 | __ops_memory_place_int(sig->mem, sig->unhashoff, | 784 | __ops_memory_place_int(sig->mem, sig->unhashoff, | |
794 | len - sig->unhashoff - 2, 2); | 785 | len - sig->unhashoff - 2, 2); | |
795 | 786 | |||
796 | /* add the packet from version number to end of hashed subpackets */ | 787 | /* add the packet from version number to end of hashed subpackets */ | |
797 | if (__ops_get_debug_level(__FILE__)) { | 788 | if (__ops_get_debug_level(__FILE__)) { | |
798 | (void) fprintf(stderr, "ops_write_sig: hashed packet info\n"); | 789 | (void) fprintf(stderr, "ops_write_sig: hashed packet info\n"); | |
799 | } | 790 | } | |
800 | sig->hash.add(&sig->hash, __ops_mem_data(sig->mem), sig->unhashoff); | 791 | sig->hash.add(&sig->hash, __ops_mem_data(sig->mem), sig->unhashoff); | |
801 | 792 | |||
802 | /* add final trailer */ | 793 | /* add final trailer */ | |
@@ -852,27 +843,28 @@ __ops_write_sig(__ops_output_t *output, | @@ -852,27 +843,28 @@ __ops_write_sig(__ops_output_t *output, | |||
852 | } | 843 | } | |
853 | 844 | |||
854 | /** | 845 | /** | |
855 | * \ingroup Core_Signature | 846 | * \ingroup Core_Signature | |
856 | * | 847 | * | |
857 | * __ops_add_birthtime() adds a creation time to the signature. | 848 | * __ops_add_birthtime() adds a creation time to the signature. | |
858 | * | 849 | * | |
859 | * \param sig | 850 | * \param sig | |
860 | * \param when | 851 | * \param when | |
861 | */ | 852 | */ | |
862 | unsigned | 853 | unsigned | |
863 | __ops_add_birthtime(__ops_create_sig_t * sig, time_t when) | 854 | __ops_add_birthtime(__ops_create_sig_t * sig, time_t when) | |
864 | { | 855 | { | |
865 | return __ops_write_ss_header(sig->output, 5, OPS_PTAG_SS_CREATION_TIME) && | 856 | return __ops_write_ss_header(sig->output, 5, | |
857 | OPS_PTAG_SS_CREATION_TIME) && | |||
866 | __ops_write_scalar(sig->output, (unsigned)when, 4); | 858 | __ops_write_scalar(sig->output, (unsigned)when, 4); | |
867 | } | 859 | } | |
868 | 860 | |||
869 | /** | 861 | /** | |
870 | * \ingroup Core_Signature | 862 | * \ingroup Core_Signature | |
871 | * | 863 | * | |
872 | * Adds issuer's key ID to the signature | 864 | * Adds issuer's key ID to the signature | |
873 | * | 865 | * | |
874 | * \param sig | 866 | * \param sig | |
875 | * \param keyid | 867 | * \param keyid | |
876 | */ | 868 | */ | |
877 | 869 | |||
878 | unsigned | 870 | unsigned |
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c 2009/05/19 05:13:10 1.7
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c 2009/05/21 00:33:31 1.8
@@ -50,85 +50,85 @@ | @@ -50,85 +50,85 @@ | |||
50 | /** \file | 50 | /** \file | |
51 | * | 51 | * | |
52 | * Creates printable text strings from packet contents | 52 | * Creates printable text strings from packet contents | |
53 | * | 53 | * | |
54 | */ | 54 | */ | |
55 | #include "config.h" | 55 | #include "config.h" | |
56 | 56 | |||
57 | #ifdef HAVE_SYS_CDEFS_H | 57 | #ifdef HAVE_SYS_CDEFS_H | |
58 | #include <sys/cdefs.h> | 58 | #include <sys/cdefs.h> | |
59 | #endif | 59 | #endif | |
60 | 60 | |||
61 | #if defined(__NetBSD__) | 61 | #if defined(__NetBSD__) | |
62 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | 62 | __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); | |
63 | __RCSID("$NetBSD: packet-show.c,v 1.7 2009/05/19 05:13:10 agc Exp $"); | 63 | __RCSID("$NetBSD: packet-show.c,v 1.8 2009/05/21 00:33:31 agc Exp $"); | |
64 | #endif | 64 | #endif | |
65 | 65 | |||
66 | #include <stdlib.h> | 66 | #include <stdlib.h> | |
67 | #include <string.h> | 67 | #include <string.h> | |
68 | 68 | |||
69 | #include "packet-show.h" | 69 | #include "packet-show.h" | |
70 | 70 | |||
71 | #include "netpgpdefs.h" | 71 | #include "netpgpdefs.h" | |
72 | 72 | |||
73 | 73 | |||
74 | /* | 74 | /* | |
75 | * Arrays of value->text maps | 75 | * Arrays of value->text maps | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | static __ops_map_t packet_tag_map[] = | 78 | static __ops_map_t packet_tag_map[] = | |
79 | { | 79 | { | |
80 | {OPS_PTAG_CT_RESERVED, "Reserved"}, | 80 | {OPS_PTAG_CT_RESERVED, "Reserved"}, | |
81 | {OPS_PTAG_CT_PK_SESSION_KEY, "Public-Key Encrypted Session Key"}, | 81 | {OPS_PTAG_CT_PK_SESSION_KEY, "Public-Key Encrypted Session Key"}, | |
82 | {OPS_PTAG_CT_SIGNATURE, "Signature"}, | 82 | {OPS_PTAG_CT_SIGNATURE, "Signature"}, | |
83 | {OPS_PTAG_CT_SK_SESSION_KEY, "Symmetric-Key Encrypted Session Key"}, | 83 | {OPS_PTAG_CT_SK_SESSION_KEY, "Symmetric-Key Encrypted Session Key"}, | |
84 | {OPS_PTAG_CT_ONE_PASS_SIGNATURE, "One-Pass Signature"}, | 84 | {OPS_PTAG_CT_1_PASS_SIG, "One-Pass Signature"}, | |
85 | {OPS_PTAG_CT_SECRET_KEY, "Secret Key"}, | 85 | {OPS_PTAG_CT_SECRET_KEY, "Secret Key"}, | |
86 | {OPS_PTAG_CT_PUBLIC_KEY, "Public Key"}, | 86 | {OPS_PTAG_CT_PUBLIC_KEY, "Public Key"}, | |
87 | {OPS_PTAG_CT_SECRET_SUBKEY, "Secret Subkey"}, | 87 | {OPS_PTAG_CT_SECRET_SUBKEY, "Secret Subkey"}, | |
88 | {OPS_PTAG_CT_COMPRESSED, "Compressed Data"}, | 88 | {OPS_PTAG_CT_COMPRESSED, "Compressed Data"}, | |
89 | {OPS_PTAG_CT_SE_DATA, "Symmetrically Encrypted Data"}, | 89 | {OPS_PTAG_CT_SE_DATA, "Symmetrically Encrypted Data"}, | |
90 | {OPS_PTAG_CT_MARKER, "Marker"}, | 90 | {OPS_PTAG_CT_MARKER, "Marker"}, | |
91 | {OPS_PTAG_CT_LITERAL_DATA, "Literal Data"}, | 91 | {OPS_PTAG_CT_LITERAL_DATA, "Literal Data"}, | |
92 | {OPS_PTAG_CT_TRUST, "Trust"}, | 92 | {OPS_PTAG_CT_TRUST, "Trust"}, | |
93 | {OPS_PTAG_CT_USER_ID, "User ID"}, | 93 | {OPS_PTAG_CT_USER_ID, "User ID"}, | |
94 | {OPS_PTAG_CT_PUBLIC_SUBKEY, "Public Subkey"}, | 94 | {OPS_PTAG_CT_PUBLIC_SUBKEY, "Public Subkey"}, | |
95 | {OPS_PTAG_CT_RESERVED2, "reserved"}, | 95 | {OPS_PTAG_CT_RESERVED2, "reserved2"}, | |
96 | {OPS_PTAG_CT_RESERVED3, "reserved"}, | 96 | {OPS_PTAG_CT_RESERVED3, "reserved3"}, | |
97 | {OPS_PTAG_CT_USER_ATTRIBUTE, "User Attribute"}, | 97 | {OPS_PTAG_CT_USER_ATTR, "User Attribute"}, | |
98 | {OPS_PTAG_CT_SE_IP_DATA, "Sym. Encrypted and Integrity Protected Data"}, | 98 | {OPS_PTAG_CT_SE_IP_DATA, | |
99 | "Symmetric Encrypted and Integrity Protected Data"}, | |||
99 | {OPS_PTAG_CT_MDC, "Modification Detection Code"}, | 100 | {OPS_PTAG_CT_MDC, "Modification Detection Code"}, | |
100 | {OPS_PARSER_PTAG, "OPS_PARSER_PTAG"}, | 101 | {OPS_PARSER_PTAG, "OPS_PARSER_PTAG"}, | |
101 | {OPS_PTAG_RAW_SS, "OPS_PTAG_RAW_SS"}, | 102 | {OPS_PTAG_RAW_SS, "OPS_PTAG_RAW_SS"}, | |
102 | {OPS_PTAG_SS_ALL, "OPS_PTAG_SS_ALL"}, | 103 | {OPS_PTAG_SS_ALL, "OPS_PTAG_SS_ALL"}, | |
103 | {OPS_PARSER_PACKET_END, "OPS_PARSER_PACKET_END"}, | 104 | {OPS_PARSER_PACKET_END, "OPS_PARSER_PACKET_END"}, | |
104 | {OPS_PTAG_SIGNATURE_SUBPACKET_BASE, "OPS_PTAG_SIGNATURE_SUBPACKET_BASE"}, | 105 | {OPS_PTAG_SIG_SUBPKT_BASE, "OPS_PTAG_SIG_SUBPKT_BASE"}, | |
105 | ||||
106 | {OPS_PTAG_SS_CREATION_TIME, "SS: Signature Creation Time"}, | 106 | {OPS_PTAG_SS_CREATION_TIME, "SS: Signature Creation Time"}, | |
107 | {OPS_PTAG_SS_EXPIRATION_TIME, "SS: Signature Expiration Time"}, | 107 | {OPS_PTAG_SS_EXPIRATION_TIME, "SS: Signature Expiration Time"}, | |
108 | {OPS_PTAG_SS_EXPORTABLE_CERTIFICATION, "SS: Exportable Certification"}, | 108 | {OPS_PTAG_SS_EXPORT_CERT, "SS: Exportable Certification"}, | |
109 | {OPS_PTAG_SS_TRUST, "SS: Trust Signature"}, | 109 | {OPS_PTAG_SS_TRUST, "SS: Trust Signature"}, | |
110 | {OPS_PTAG_SS_REGEXP, "SS: Regular Expression"}, | 110 | {OPS_PTAG_SS_REGEXP, "SS: Regular Expression"}, | |
111 | {OPS_PTAG_SS_REVOCABLE, "SS: Revocable"}, | 111 | {OPS_PTAG_SS_REVOCABLE, "SS: Revocable"}, | |
112 | {OPS_PTAG_SS_KEY_EXPIRATION_TIME, "SS: Key Expiration Time"}, | 112 | {OPS_PTAG_SS_KEY_EXPIRY, "SS: Key Expiration Time"}, | |
113 | {OPS_PTAG_SS_RESERVED, "SS: Reserved"}, | 113 | {OPS_PTAG_SS_RESERVED, "SS: Reserved"}, | |
114 | {OPS_PTAG_SS_PREFERRED_SKA, "SS: Preferred Secret Key Algorithm"}, | 114 | {OPS_PTAG_SS_PREFERRED_SKA, "SS: Preferred Secret Key Algorithm"}, | |
115 | {OPS_PTAG_SS_REVOCATION_KEY, "SS: Revocation Key"}, | 115 | {OPS_PTAG_SS_REVOCATION_KEY, "SS: Revocation Key"}, | |
116 | {OPS_PTAG_SS_ISSUER_KEY_ID, "SS: Issuer Key Id"}, | 116 | {OPS_PTAG_SS_ISSUER_KEY_ID, "SS: Issuer Key Id"}, | |
117 | {OPS_PTAG_SS_NOTATION_DATA, "SS: Notation Data"}, | 117 | {OPS_PTAG_SS_NOTATION_DATA, "SS: Notation Data"}, | |
118 | {OPS_PTAG_SS_PREFERRED_HASH, "SS: Preferred Hash Algorithm"}, | 118 | {OPS_PTAG_SS_PREFERRED_HASH, "SS: Preferred Hash Algorithm"}, | |
119 | {OPS_PTAG_SS_PREFERRED_COMPRESSION, "SS: Preferred Compression Algorithm"}, | 119 | {OPS_PTAG_SS_PREF_COMPRESS, "SS: Preferred Compression Algorithm"}, | |
120 | {OPS_PTAG_SS_KEY_SERVER_PREFS, "SS: Key Server Preferences"}, | 120 | {OPS_PTAG_SS_KEYSERV_PREFS, "SS: Key Server Preferences"}, | |
121 | {OPS_PTAG_SS_PREFERRED_COMPRESSION, "SS: Preferred Key Server"}, | 121 | {OPS_PTAG_SS_PREF_KEYSERV, "SS: Preferred Key Server"}, | |
122 | {OPS_PTAG_SS_PRIMARY_USER_ID, "SS: Primary User ID"}, | 122 | {OPS_PTAG_SS_PRIMARY_USER_ID, "SS: Primary User ID"}, | |
123 | {OPS_PTAG_SS_POLICY_URI, "SS: Policy URI"}, | 123 | {OPS_PTAG_SS_POLICY_URI, "SS: Policy URI"}, | |
124 | {OPS_PTAG_SS_KEY_FLAGS, "SS: Key Flags"}, | 124 | {OPS_PTAG_SS_KEY_FLAGS, "SS: Key Flags"}, | |
125 | {OPS_PTAG_SS_SIGNERS_USER_ID, "SS: Signer's User ID"}, | 125 | {OPS_PTAG_SS_SIGNERS_USER_ID, "SS: Signer's User ID"}, | |
126 | {OPS_PTAG_SS_REVOCATION_REASON, "SS: Reason for Revocation"}, | 126 | {OPS_PTAG_SS_REVOCATION_REASON, "SS: Reason for Revocation"}, | |
127 | {OPS_PTAG_SS_FEATURES, "SS: Features"}, | 127 | {OPS_PTAG_SS_FEATURES, "SS: Features"}, | |
128 | {OPS_PTAG_SS_SIGNATURE_TARGET, "SS: Signature Target"}, | 128 | {OPS_PTAG_SS_SIGNATURE_TARGET, "SS: Signature Target"}, | |
129 | {OPS_PTAG_SS_EMBEDDED_SIGNATURE, "SS: Embedded Signature"}, | 129 | {OPS_PTAG_SS_EMBEDDED_SIGNATURE, "SS: Embedded Signature"}, | |
130 | 130 | |||
131 | {OPS_PTAG_CT_LITERAL_DATA_HEADER, "CT: Literal Data Header"}, | 131 | {OPS_PTAG_CT_LITERAL_DATA_HEADER, "CT: Literal Data Header"}, | |
132 | {OPS_PTAG_CT_LITERAL_DATA_BODY, "CT: Literal Data Body"}, | 132 | {OPS_PTAG_CT_LITERAL_DATA_BODY, "CT: Literal Data Body"}, | |
133 | {OPS_PTAG_CT_SIGNATURE_HEADER, "CT: Signature Header"}, | 133 | {OPS_PTAG_CT_SIGNATURE_HEADER, "CT: Signature Header"}, | |
134 | {OPS_PTAG_CT_SIGNATURE_FOOTER, "CT: Signature Footer"}, | 134 | {OPS_PTAG_CT_SIGNATURE_FOOTER, "CT: Signature Footer"}, | |
@@ -150,35 +150,35 @@ static __ops_map_t packet_tag_map[] = | @@ -150,35 +150,35 @@ static __ops_map_t packet_tag_map[] = | |||
150 | {OPS_PARSER_ERRCODE, "OPS_PARSER_ERRCODE"}, | 150 | {OPS_PARSER_ERRCODE, "OPS_PARSER_ERRCODE"}, | |
151 | 151 | |||
152 | {0x00, NULL}, /* this is the end-of-array marker */ | 152 | {0x00, NULL}, /* this is the end-of-array marker */ | |
153 | }; | 153 | }; | |
154 | typedef __ops_map_t packet_tag_map_t; | 154 | typedef __ops_map_t packet_tag_map_t; | |
155 | 155 | |||
156 | static __ops_map_t ss_type_map[] = | 156 | static __ops_map_t ss_type_map[] = | |
157 | { | 157 | { | |
158 | {OPS_PTAG_SS_CREATION_TIME, "Signature Creation Time"}, | 158 | {OPS_PTAG_SS_CREATION_TIME, "Signature Creation Time"}, | |
159 | {OPS_PTAG_SS_EXPIRATION_TIME, "Signature Expiration Time"}, | 159 | {OPS_PTAG_SS_EXPIRATION_TIME, "Signature Expiration Time"}, | |
160 | {OPS_PTAG_SS_TRUST, "Trust Signature"}, | 160 | {OPS_PTAG_SS_TRUST, "Trust Signature"}, | |
161 | {OPS_PTAG_SS_REGEXP, "Regular Expression"}, | 161 | {OPS_PTAG_SS_REGEXP, "Regular Expression"}, | |
162 | {OPS_PTAG_SS_REVOCABLE, "Revocable"}, | 162 | {OPS_PTAG_SS_REVOCABLE, "Revocable"}, | |
163 | {OPS_PTAG_SS_KEY_EXPIRATION_TIME, "Key Expiration Time"}, | 163 | {OPS_PTAG_SS_KEY_EXPIRY, "Key Expiration Time"}, | |
164 | {OPS_PTAG_SS_PREFERRED_SKA, "Preferred Symmetric Algorithms"}, | 164 | {OPS_PTAG_SS_PREFERRED_SKA, "Preferred Symmetric Algorithms"}, | |
165 | {OPS_PTAG_SS_REVOCATION_KEY, "Revocation Key"}, | 165 | {OPS_PTAG_SS_REVOCATION_KEY, "Revocation Key"}, | |
166 | {OPS_PTAG_SS_ISSUER_KEY_ID, "Issuer key ID"}, | 166 | {OPS_PTAG_SS_ISSUER_KEY_ID, "Issuer key ID"}, | |
167 | {OPS_PTAG_SS_NOTATION_DATA, "Notation Data"}, | 167 | {OPS_PTAG_SS_NOTATION_DATA, "Notation Data"}, | |
168 | {OPS_PTAG_SS_PREFERRED_HASH, "Preferred Hash Algorithms"}, | 168 | {OPS_PTAG_SS_PREFERRED_HASH, "Preferred Hash Algorithms"}, | |
169 | {OPS_PTAG_SS_PREFERRED_COMPRESSION, "Preferred Compression Algorithms"}, | 169 | {OPS_PTAG_SS_PREF_COMPRESS, "Preferred Compression Algorithms"}, | |
170 | {OPS_PTAG_SS_KEY_SERVER_PREFS, "Key Server Preferences"}, | 170 | {OPS_PTAG_SS_KEYSERV_PREFS, "Key Server Preferences"}, | |
171 | {OPS_PTAG_SS_PREFERRED_KEY_SERVER, "Preferred Key Server"}, | 171 | {OPS_PTAG_SS_PREF_KEYSERV, "Preferred Key Server"}, | |
172 | {OPS_PTAG_SS_PRIMARY_USER_ID, "Primary User ID"}, | 172 | {OPS_PTAG_SS_PRIMARY_USER_ID, "Primary User ID"}, | |
173 | {OPS_PTAG_SS_POLICY_URI, "Policy URI"}, | 173 | {OPS_PTAG_SS_POLICY_URI, "Policy URI"}, | |
174 | {OPS_PTAG_SS_KEY_FLAGS, "Key Flags"}, | 174 | {OPS_PTAG_SS_KEY_FLAGS, "Key Flags"}, | |
175 | {OPS_PTAG_SS_REVOCATION_REASON, "Reason for Revocation"}, | 175 | {OPS_PTAG_SS_REVOCATION_REASON, "Reason for Revocation"}, | |
176 | {OPS_PTAG_SS_FEATURES, "Features"}, | 176 | {OPS_PTAG_SS_FEATURES, "Features"}, | |
177 | {0x00, NULL}, /* this is the end-of-array marker */ | 177 | {0x00, NULL}, /* this is the end-of-array marker */ | |
178 | }; | 178 | }; | |
179 | typedef __ops_map_t ss_type_map_t; | 179 | typedef __ops_map_t ss_type_map_t; | |
180 | 180 | |||
181 | 181 | |||
182 | static __ops_map_t ss_rr_code_map[] = | 182 | static __ops_map_t ss_rr_code_map[] = | |
183 | { | 183 | { | |
184 | {0x00, "No reason specified"}, | 184 | {0x00, "No reason specified"}, |
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet.h 2009/05/19 05:13:10 1.7
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h 2009/05/21 00:33:31 1.8
@@ -165,84 +165,83 @@ typedef enum { | @@ -165,84 +165,83 @@ typedef enum { | |||
165 | * signature subpacket type values that we understand. | 165 | * signature subpacket type values that we understand. | |
166 | * | 166 | * | |
167 | * \see RFC4880 4.3 | 167 | * \see RFC4880 4.3 | |
168 | * \see RFC4880 5.2.3.1 | 168 | * \see RFC4880 5.2.3.1 | |
169 | */ | 169 | */ | |
170 | typedef enum { | 170 | typedef enum { | |
171 | OPS_PTAG_CT_RESERVED = 0, /* Reserved - a packet tag must | 171 | OPS_PTAG_CT_RESERVED = 0, /* Reserved - a packet tag must | |
172 | * not have this value */ | 172 | * not have this value */ | |
173 | OPS_PTAG_CT_PK_SESSION_KEY = 1, /* Public-Key Encrypted Session | 173 | OPS_PTAG_CT_PK_SESSION_KEY = 1, /* Public-Key Encrypted Session | |
174 | * Key Packet */ | 174 | * Key Packet */ | |
175 | OPS_PTAG_CT_SIGNATURE = 2, /* Signature Packet */ | 175 | OPS_PTAG_CT_SIGNATURE = 2, /* Signature Packet */ | |
176 | OPS_PTAG_CT_SK_SESSION_KEY = 3, /* Symmetric-Key Encrypted Session | 176 | OPS_PTAG_CT_SK_SESSION_KEY = 3, /* Symmetric-Key Encrypted Session | |
177 | * Key Packet */ | 177 | * Key Packet */ | |
178 | OPS_PTAG_CT_ONE_PASS_SIGNATURE = 4, /* One-Pass Signature | 178 | OPS_PTAG_CT_1_PASS_SIG = 4, /* One-Pass Signature | |
179 | * Packet */ | 179 | * Packet */ | |
180 | OPS_PTAG_CT_SECRET_KEY = 5, /* Secret Key Packet */ | 180 | OPS_PTAG_CT_SECRET_KEY = 5, /* Secret Key Packet */ | |
181 | OPS_PTAG_CT_PUBLIC_KEY = 6, /* Public Key Packet */ | 181 | OPS_PTAG_CT_PUBLIC_KEY = 6, /* Public Key Packet */ | |
182 | OPS_PTAG_CT_SECRET_SUBKEY = 7, /* Secret Subkey Packet */ | 182 | OPS_PTAG_CT_SECRET_SUBKEY = 7, /* Secret Subkey Packet */ | |
183 | OPS_PTAG_CT_COMPRESSED = 8, /* Compressed Data Packet */ | 183 | OPS_PTAG_CT_COMPRESSED = 8, /* Compressed Data Packet */ | |
184 | OPS_PTAG_CT_SE_DATA = 9,/* Symmetrically Encrypted Data Packet */ | 184 | OPS_PTAG_CT_SE_DATA = 9,/* Symmetrically Encrypted Data Packet */ | |
185 | OPS_PTAG_CT_MARKER = 10,/* Marker Packet */ | 185 | OPS_PTAG_CT_MARKER = 10,/* Marker Packet */ | |
186 | OPS_PTAG_CT_LITERAL_DATA = 11, /* Literal Data Packet */ | 186 | OPS_PTAG_CT_LITERAL_DATA = 11, /* Literal Data Packet */ | |
187 | OPS_PTAG_CT_TRUST = 12, /* Trust Packet */ | 187 | OPS_PTAG_CT_TRUST = 12, /* Trust Packet */ | |
188 | OPS_PTAG_CT_USER_ID = 13, /* User ID Packet */ | 188 | OPS_PTAG_CT_USER_ID = 13, /* User ID Packet */ | |
189 | OPS_PTAG_CT_PUBLIC_SUBKEY = 14, /* Public Subkey Packet */ | 189 | OPS_PTAG_CT_PUBLIC_SUBKEY = 14, /* Public Subkey Packet */ | |
190 | OPS_PTAG_CT_RESERVED2 = 15, /* reserved */ | 190 | OPS_PTAG_CT_RESERVED2 = 15, /* reserved */ | |
191 | OPS_PTAG_CT_RESERVED3 = 16, /* reserved */ | 191 | OPS_PTAG_CT_RESERVED3 = 16, /* reserved */ | |
192 | OPS_PTAG_CT_USER_ATTRIBUTE = 17, /* User Attribute Packet */ | 192 | OPS_PTAG_CT_USER_ATTR = 17, /* User Attribute Packet */ | |
193 | OPS_PTAG_CT_SE_IP_DATA = 18, /* Sym. Encrypted and Integrity | 193 | OPS_PTAG_CT_SE_IP_DATA = 18, /* Sym. Encrypted and Integrity | |
194 | * Protected Data Packet */ | 194 | * Protected Data Packet */ | |
195 | OPS_PTAG_CT_MDC = 19, /* Modification Detection Code Packet */ | 195 | OPS_PTAG_CT_MDC = 19, /* Modification Detection Code Packet */ | |
196 | 196 | |||
197 | OPS_PARSER_PTAG = 0x100,/* Internal Use: The packet is the "Packet | 197 | OPS_PARSER_PTAG = 0x100,/* Internal Use: The packet is the "Packet | |
198 | * Tag" itself - used when callback sends | 198 | * Tag" itself - used when callback sends | |
199 | * back the PTag. */ | 199 | * back the PTag. */ | |
200 | OPS_PTAG_RAW_SS = 0x101,/* Internal Use: content is raw sig subtag */ | 200 | OPS_PTAG_RAW_SS = 0x101,/* Internal Use: content is raw sig subtag */ | |
201 | OPS_PTAG_SS_ALL = 0x102,/* Internal Use: select all subtags */ | 201 | OPS_PTAG_SS_ALL = 0x102,/* Internal Use: select all subtags */ | |
202 | OPS_PARSER_PACKET_END = 0x103, | 202 | OPS_PARSER_PACKET_END = 0x103, | |
203 | 203 | |||
204 | /* signature subpackets (0x200-2ff) (type+0x200) */ | 204 | /* signature subpackets (0x200-2ff) (type+0x200) */ | |
205 | /* only those we can parse are listed here */ | 205 | /* only those we can parse are listed here */ | |
206 | OPS_PTAG_SIGNATURE_SUBPACKET_BASE = 0x200, /* Base for signature | 206 | OPS_PTAG_SIG_SUBPKT_BASE = 0x200, /* Base for signature | |
207 | * subpacket types - All | 207 | * subpacket types - All | |
208 | * signature type values | 208 | * signature type values | |
209 | * are relative to this | 209 | * are relative to this | |
210 | * value. */ | 210 | * value. */ | |
211 | OPS_PTAG_SS_CREATION_TIME = 0x200 + 2, /* signature creation time */ | 211 | OPS_PTAG_SS_CREATION_TIME = 0x200 + 2, /* signature creation time */ | |
212 | OPS_PTAG_SS_EXPIRATION_TIME = 0x200 + 3, /* signature | 212 | OPS_PTAG_SS_EXPIRATION_TIME = 0x200 + 3, /* signature | |
213 | * expiration time */ | 213 | * expiration time */ | |
214 | 214 | |||
215 | OPS_PTAG_SS_EXPORTABLE_CERTIFICATION = 0x200 + 4, /* exportable | 215 | OPS_PTAG_SS_EXPORT_CERT = 0x200 + 4, /* exportable certification */ | |
216 | * certification */ | |||
217 | OPS_PTAG_SS_TRUST = 0x200 + 5, /* trust signature */ | 216 | OPS_PTAG_SS_TRUST = 0x200 + 5, /* trust signature */ | |
218 | OPS_PTAG_SS_REGEXP = 0x200 + 6, /* regular expression */ | 217 | OPS_PTAG_SS_REGEXP = 0x200 + 6, /* regular expression */ | |
219 | OPS_PTAG_SS_REVOCABLE = 0x200 + 7, /* revocable */ | 218 | OPS_PTAG_SS_REVOCABLE = 0x200 + 7, /* revocable */ | |
220 | OPS_PTAG_SS_KEY_EXPIRATION_TIME = 0x200 + 9, /* key expiration | 219 | OPS_PTAG_SS_KEY_EXPIRY = 0x200 + 9, /* key expiration | |
221 | * time */ | 220 | * time */ | |
222 | OPS_PTAG_SS_RESERVED = 0x200 + 10, /* reserved */ | 221 | OPS_PTAG_SS_RESERVED = 0x200 + 10, /* reserved */ | |
223 | OPS_PTAG_SS_PREFERRED_SKA = 0x200 + 11, /* preferred symmetric | 222 | OPS_PTAG_SS_PREFERRED_SKA = 0x200 + 11, /* preferred symmetric | |
224 | * algs */ | 223 | * algs */ | |
225 | OPS_PTAG_SS_REVOCATION_KEY = 0x200 + 12, /* revocation key */ | 224 | OPS_PTAG_SS_REVOCATION_KEY = 0x200 + 12, /* revocation key */ | |
226 | OPS_PTAG_SS_ISSUER_KEY_ID = 0x200 + 16, /* issuer key ID */ | 225 | OPS_PTAG_SS_ISSUER_KEY_ID = 0x200 + 16, /* issuer key ID */ | |
227 | OPS_PTAG_SS_NOTATION_DATA = 0x200 + 20, /* notation data */ | 226 | OPS_PTAG_SS_NOTATION_DATA = 0x200 + 20, /* notation data */ | |
228 | OPS_PTAG_SS_PREFERRED_HASH = 0x200 + 21, /* preferred hash | 227 | OPS_PTAG_SS_PREFERRED_HASH = 0x200 + 21, /* preferred hash | |
229 | * algs */ | 228 | * algs */ | |
230 | OPS_PTAG_SS_PREFERRED_COMPRESSION = 0x200 + 22, /* preferred | 229 | OPS_PTAG_SS_PREF_COMPRESS = 0x200 + 22, /* preferred | |
231 | * compression | 230 | * compression | |
232 | * algorithms */ | 231 | * algorithms */ | |
233 | OPS_PTAG_SS_KEY_SERVER_PREFS = 0x200 + 23, /* key server | 232 | OPS_PTAG_SS_KEYSERV_PREFS = 0x200 + 23, /* key server | |
234 | * preferences */ | 233 | * preferences */ | |
235 | OPS_PTAG_SS_PREFERRED_KEY_SERVER = 0x200 + 24, /* Preferred Key | 234 | OPS_PTAG_SS_PREF_KEYSERV = 0x200 + 24, /* Preferred Key | |
236 | * Server */ | 235 | * Server */ | |
237 | OPS_PTAG_SS_PRIMARY_USER_ID = 0x200 + 25, /* primary User ID */ | 236 | OPS_PTAG_SS_PRIMARY_USER_ID = 0x200 + 25, /* primary User ID */ | |
238 | OPS_PTAG_SS_POLICY_URI = 0x200 + 26, /* Policy URI */ | 237 | OPS_PTAG_SS_POLICY_URI = 0x200 + 26, /* Policy URI */ | |
239 | OPS_PTAG_SS_KEY_FLAGS = 0x200 + 27, /* key flags */ | 238 | OPS_PTAG_SS_KEY_FLAGS = 0x200 + 27, /* key flags */ | |
240 | OPS_PTAG_SS_SIGNERS_USER_ID = 0x200 + 28, /* Signer's User ID */ | 239 | OPS_PTAG_SS_SIGNERS_USER_ID = 0x200 + 28, /* Signer's User ID */ | |
241 | OPS_PTAG_SS_REVOCATION_REASON = 0x200 + 29, /* reason for | 240 | OPS_PTAG_SS_REVOCATION_REASON = 0x200 + 29, /* reason for | |
242 | * revocation */ | 241 | * revocation */ | |
243 | OPS_PTAG_SS_FEATURES = 0x200 + 30, /* features */ | 242 | OPS_PTAG_SS_FEATURES = 0x200 + 30, /* features */ | |
244 | OPS_PTAG_SS_SIGNATURE_TARGET = 0x200 + 31, /* signature target */ | 243 | OPS_PTAG_SS_SIGNATURE_TARGET = 0x200 + 31, /* signature target */ | |
245 | OPS_PTAG_SS_EMBEDDED_SIGNATURE = 0x200 + 32, /* embedded signature */ | 244 | OPS_PTAG_SS_EMBEDDED_SIGNATURE = 0x200 + 32, /* embedded signature */ | |
246 | 245 | |||
247 | OPS_PTAG_SS_USERDEFINED00 = 0x200 + 100, /* internal or | 246 | OPS_PTAG_SS_USERDEFINED00 = 0x200 + 100, /* internal or | |
248 | * user-defined */ | 247 | * user-defined */ |