CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: jhigh Date: Wed Jul 28 22:31:45 UTC 2021 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet-print.c packet-show.c Log Message: print Issuer Fingerprint subpacket 33 (rfc4880bis-08:5.2.3.28) rather than Unknown To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c cvs rdiff -u -r1.21 -r1.22 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.42 src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.43 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.42 Wed Feb 22 06:29:40 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Wed Jul 28 22:31:45 2021 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-print.c,v 1.42 2012/02/22 06:29:40 agc Exp $"); +__RCSID("$NetBSD: packet-print.c,v 1.43 2021/07/28 22:31:45 jhigh Exp $"); #endif #include @@ -1090,6 +1090,14 @@ pgp_print_packet(pgp_printstate_t *print end_subpacket(&print->indent); break; + case PGP_PTAG_SS_ISSUER_FINGERPRINT: + start_subpacket(&print->indent, pkt->tag); + print_hexdump(print->indent, "Issuer Fingerprint", + content->ss_issuer_fingerprint.fingerprint, + content->ss_issuer_fingerprint.len); + end_subpacket(&print->indent); + break; + case PGP_PTAG_SS_PREFERRED_SKA: start_subpacket(&print->indent, pkt->tag); print_data(print->indent, "Preferred Symmetric Algorithms", Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.21 src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.22 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.21 Sun Aug 14 11:19:51 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c Wed Jul 28 22:31:45 2021 @@ -60,7 +60,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-show.c,v 1.21 2011/08/14 11:19:51 christos Exp $"); +__RCSID("$NetBSD: packet-show.c,v 1.22 2021/07/28 22:31:45 jhigh Exp $"); #endif #include @@ -115,6 +115,7 @@ static pgp_map_t packet_tag_map[] = {PGP_PTAG_SS_PREFERRED_SKA, "SS: Preferred Secret Key Algorithm"}, {PGP_PTAG_SS_REVOCATION_KEY, "SS: Revocation Key"}, {PGP_PTAG_SS_ISSUER_KEY_ID, "SS: Issuer Key Id"}, + {PGP_PTAG_SS_ISSUER_FINGERPRINT, "SS: Issuer Fingerprint"}, {PGP_PTAG_SS_NOTATION_DATA, "SS: Notation Data"}, {PGP_PTAG_SS_PREFERRED_HASH, "SS: Preferred Hash Algorithm"}, {PGP_PTAG_SS_PREF_COMPRESS, "SS: Preferred Compression Algorithm"}, @@ -164,6 +165,7 @@ static pgp_map_t ss_type_map[] = {PGP_PTAG_SS_PREFERRED_SKA, "Preferred Symmetric Algorithms"}, {PGP_PTAG_SS_REVOCATION_KEY, "Revocation Key"}, {PGP_PTAG_SS_ISSUER_KEY_ID, "Issuer key ID"}, + {PGP_PTAG_SS_ISSUER_FINGERPRINT, "Issuer Fingerprint"}, {PGP_PTAG_SS_NOTATION_DATA, "Notation Data"}, {PGP_PTAG_SS_PREFERRED_HASH, "Preferred Hash Algorithms"}, {PGP_PTAG_SS_PREF_COMPRESS, "Preferred Compression Algorithms"},
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: jhigh Date: Wed Oct 14 05:19:41 UTC 2020 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c packet-parse.c packet.h Log Message: allow netpgp to absorb gpg2 subpkt 33 for list/enc/decrypt rsa keys To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.52 -r1.53 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.31 -r1.32 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.56 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.57 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.56 Tue Nov 13 14:52:30 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Wed Oct 14 05:19:41 2020 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.56 2018/11/13 14:52:30 mlelstv Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.57 2020/10/14 05:19:41 jhigh Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -620,8 +620,12 @@ cb_keyring_read(const pgp_packet_t *pkt, key->subsigc += 1; break; case PGP_PTAG_CT_TRUST: - key->subsigs[key->subsigc - 1].trustlevel = pkt->u.ss_trust.level; - key->subsigs[key->subsigc - 1].trustamount = pkt->u.ss_trust.amount; + EXPAND_ARRAY(key, subsig); + key->subsigs[key->subsigc].trustlevel = pkt->u.ss_trust.level; + key->subsigs[key->subsigc].trustamount = pkt->u.ss_trust.amount; + + key->subsigc += 1; + break; case PGP_PTAG_SS_KEY_EXPIRY: EXPAND_ARRAY(keyring, key); @@ -667,7 +671,6 @@ cb_keyring_read(const pgp_packet_t *pkt, default: break; } - return PGP_RELEASE_MEMORY; } Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.52 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.53 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.52 Tue Nov 13 14:52:30 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Wed Oct 14 05:19:41 2020 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.52 2018/11/13 14:52:30 mlelstv Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.53 2020/10/14 05:19:41 jhigh Exp $"); #endif #include @@ -984,6 +984,7 @@ pgp_parser_content_free(pgp_packet_t *c) case PGP_PTAG_SS_PRIMARY_USER_ID: case PGP_PTAG_SS_REVOCABLE: case PGP_PTAG_SS_REVOCATION_KEY: + case PGP_PTAG_SS_ISSUER_FINGERPRINT: case PGP_PTAG_CT_LITDATA_HEADER: case PGP_PTAG_CT_LITDATA_BODY: case PGP_PTAG_CT_SIGNED_CLEARTEXT_BODY: @@ -1554,6 +1555,7 @@ parse_one_sig_subpacket(pgp_sig_t *sig, pgp_packet_t pkt; uint8_t bools = 0x0; uint8_t c = 0x0; + uint8_t temp = 0x0; unsigned doread = 1; unsignedt8; unsignedt7; @@ -1764,6 +1766,26 @@ parse_one_sig_subpacket(pgp_sig_t *sig, } break; + case PGP_PTAG_SS_ISSUER_FINGERPRINT: + /* octet 0: version */ + /* 0x04:20 bytes, 0x05:32 bytes */ + if (!limread(&temp, 1, &subregion, stream)) { + return 0; + } + + switch (temp) { + case 0x04: pkt.u.ss_issuer_fingerprint.len = 20; break; + case 0x05: pkt.u.ss_issuer_fingerprint.len = 32; break; + default: +return 0; + } + + if (!limread(pkt.u.ss_issuer_fingerprint.fingerprint, + pkt.u.ss_issuer_fingerprint.len, &subregion, stream)) { + return 0; + } + break; + case PGP_PTAG_SS_REVOCATION_KEY: /* octet 0 = class. Bit 0x80 must be set */ if (!limread(&pkt.u.ss_revocation_key.class, 1, Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.31 src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.32 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.31 Tue Nov 13 14:52:30 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h Wed Oct 14 05:19:41 2020 @@ -251,7 +251,7 @@ typedef enum { PGP_PTAG_SS_FEATURES = 0x200 + 30, /* features */ PGP_PTAG_SS_SIGNATURE_TARGET = 0x200 + 31, /* signature target */ PGP_PTAG_SS_EMBEDDED_SIGNATURE = 0x200 + 32, /* embedded signature */ - + PGP_PTAG_SS_ISSUER_FINGERPRINT = 0x200 + 33, /* issuer fingerprint */ PGP_PTAG_SS_USERDEFINED00 = 0x200 + 100, /* internal or * user-defined */ PGP_PTAG_SS_USERDEFINED01 = 0x200 + 101, @@ -659,6 +659,11 @@ typedef struct pgp_ss_trust_t { uint8_t amount; /* Amount */ } pgp_ss_trust_t; +typedef struct pgp_ss_issuer_fingerprint { + uint8_t len; /* 20 or 32 */ + uint8_t fingerprint[32]; /* max 32 */ +} pgp_ss_issuer_fingerprint
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: jhigh Date: Sat Mar 21 01:07:21 UTC 2020 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: cleanly fail initialization on empty keyring To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.102 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.103 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.102 Tue Nov 13 14:52:30 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sat Mar 21 01:07:21 2020 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.102 2018/11/13 14:52:30 mlelstv Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.103 2020/03/21 01:07:21 jhigh Exp $"); #endif #include @@ -429,7 +429,7 @@ get_first_ring(pgp_keyring_t *ring, char int i; int n; - if (ring == NULL) { + if (ring == NULL || ring->keyc == 0) { return 0; } (void) memset(id, 0x0, len);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Thu May 10 15:00:36 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Add descriptions for netpgp_match_keys() netpgp_match_keys_json() netpgp_match_pubkeys() netpgp_validate_sigs() netpgp_format_json() To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.26 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.27 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.26 Wed May 9 23:34:25 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Thu May 10 15:00:36 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.26 2018/05/09 23:34:25 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.27 2018/05/10 15:00:36 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -233,6 +233,17 @@ function is used. To list all the keys in a keyring as a JSON encoded string, the .Fn netpgp_list_keys_json function is used. +To find and list keys in a keyring, the +.Fn netpgp_match_keys +function is used. +To find and list keys in a keyring, output as a JSON encoded string, +the +.Fn netpgp_match_keys_json +function is used. +To find and list keys in a better suited machine-readble format, such as for +redirection to other parsing engines, the +.Fn netpgp_match_pubkeys +function is used. The signature subkey fields can also be displayed using this function. .Pp @@ -246,6 +257,14 @@ If the subdirectory argument is provided is appended to the home directory in order to search for the keyrings. .Pp +To print key information from a JSON encoded string, stored in a file, the +.Fn netpgp_format_json +function is used. +.Pp +To validate the signature of keys in a public key keyring, the +.Fn netpgp_validate_sigs +function is used. +.Pp To export a key, the .Fn netpgp_export_key function is used.
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Wed May 9 23:34:25 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Add a description of netpgp_unsetvar and netpgp_list_keys_json. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.25 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.26 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.25 Wed May 9 07:59:38 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Wed May 9 23:34:25 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.25 2018/05/09 07:59:38 wiz Exp $ +.\" $NetBSD: libnetpgp.3,v 1.26 2018/05/09 23:34:25 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 9, 2018 +.Dd May 10, 2018 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -204,6 +204,8 @@ member of the structure. These are set using the .Fn netpgp_setvar +function and unset using the +.Fn netpgp_unsetvar function. If no public key ring file is set, initial values will be taken from those in the @@ -228,6 +230,9 @@ function returns 1 on success, 0 on fail To list all the keys in a keyring, the .Fn netpgp_list_keys function is used. +To list all the keys in a keyring as a JSON encoded string, the +.Fn netpgp_list_keys_json +function is used. The signature subkey fields can also be displayed using this function. .Pp
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: wiz Date: Wed May 9 07:59:38 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Fix typo, add 'and' in list. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.24 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.25 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.24 Wed May 9 00:24:50 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Wed May 9 07:59:38 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.24 2018/05/09 00:24:50 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.25 2018/05/09 07:59:38 wiz Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -342,8 +342,8 @@ At the present time, two types are defin .Dq version and .Dq maintainer . -The mantainer information returned contains the name, email address, PGP short -key id. +The maintainer information returned contains the name, email address, +and PGP short key id. A failure to present a known .Ar type argument to
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Wed May 9 00:24:50 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Add the type of information returned about maintainer. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.23 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.24 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.23 Sun Apr 29 14:21:16 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Wed May 9 00:24:50 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.23 2018/04/29 14:21:16 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.24 2018/05/09 00:24:50 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 29, 2018 +.Dd May 9, 2018 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -342,6 +342,8 @@ At the present time, two types are defin .Dq version and .Dq maintainer . +The mantainer information returned contains the name, email address, PGP short +key id. A failure to present a known .Ar type argument to
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Sun Apr 29 14:21:16 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Add the following functions to the list (TODO - add descriptions) netpgp_unsetvar netpgp_list_keys_json netpgp_match_keys netpgp_match_keys_json netpgp_match_pubkeys netpgp_validate_sigs netpgp_format_json Remove netpgp_match_list_keys() as function does not exist Add missing output file to netpgp_verify_file() argument list Sprinkle const to arguments To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.23 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.22 Mon Apr 16 08:17:18 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Sun Apr 29 14:21:16 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.22 2018/04/16 08:17:18 wiz Exp $ +.\" $NetBSD: libnetpgp.3,v 1.23 2018/04/29 14:21:16 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 15, 2018 +.Dd April 29, 2018 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -79,6 +79,10 @@ The following functions are for variable .Fo netpgp_incvar .Fa "netpgp_t *netpgp" "const char *name" "const int delta" .Fc +.Ft int +.Fo netpgp_unsetvar +.Fa "netpgp_t *netpgp" "const char *name" +.Fc .Pp The following function sets the home directory: .Ft int @@ -92,8 +96,20 @@ The following functions are used for key .Fa "netpgp_t *netpgp" "const int printsigs" .Fc .Ft int -.Fo netpgp_match_list_keys -.Fa "netpgp_t *netpgp" "char *pattern" +.Fo netpgp_list_keys_json +.Fa "netpgp_t *netpgp" "char **json" "const int psigs" +.Fc +.Ft int +.Fo netpgp_match_keys +.Fa "netpgp_t *netpgp" "char *name" "const char *fmt" "void *vp" "const int psigs" +.Fc +.Ft int +.Fo netpgp_match_keys_json +.Fa "netpgp_t *netpgp" "char **json" "char *name" "const char *fmt" "const int psigs" +.Fc +.Ft int +.Fo netpgp_match_pubkeys +.Fa "netpgp_t *netpgp" "char *name" "void *vp" .Fc .Ft int .Fo netpgp_find_key @@ -101,7 +117,7 @@ The following functions are used for key .Fc .Ft char * .Fo netpgp_get_key -.Fa "netpgp_t *netpgp" "const char *id" +.Fa "netpgp_t *netpgp" "const char *name" "const char *fmt" .Fc .Ft int .Fo netpgp_export_key @@ -115,31 +131,39 @@ The following functions are used for key .Fo netpgp_generate_key .Fa "netpgp_t *netpgp" "char *userid" "int numbits" .Fc +.Ft int +.Fo netpgp_validate_sigs +.Fa "netpgp_t *netpgp" +.Fc +.Ft int +.Fo netpgp_format_json +.Fa "void *vp" "const char *json" "const int psigs" +.Fc .Pp The following functions are used for file management: .Ft int .Fo netpgp_encrypt_file -.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out" .Fa "int armored" .Fc .Ft int .Fo netpgp_decrypt_file -.Fa "netpgp_t *netpgp" "char *filename" "char *out" "int armored" +.Fa "netpgp_t *netpgp" "const char *filename" "char *out" "int armored" .Fc .Ft int .Fo netpgp_sign_file -.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out" .Fa "int armored" "int cleartext" "int detached" .Fc .Ft int .Fo netpgp_verify_file -.Fa "netpgp_t *netpgp" "char *f" "int armored" +.Fa "netpgp_t *netpgp" "const char *in" "const char *out" "int armored" .Fc .Pp The following functions are used for memory signing and encryption: .Ft int .Fo netpgp_encrypt_memory -.Fa "netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize" +.Fa "netpgp_t *netpgp" "const char *userid" "void *in" "const size_t insize" .Fa "char *out" "size_t outsize" "int armored" .Fc .Ft int @@ -206,13 +230,6 @@ To list all the keys in a keyring, the function is used. The signature subkey fields can also be displayed using this function. -The -.Fn netpgp_match_list_keys -function is used to match (via regular expression) -a subset of the keys in the keyring. -If the expression to match is NULL, -the search will degenerate into a -listing of all keys in the keyring. .Pp The home directory is specified as an internal variable, and its existence is checked using the
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: wiz Date: Mon Apr 16 08:17:18 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.21 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.22 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.21 Sun Apr 15 23:00:36 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Mon Apr 16 08:17:18 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.21 2018/04/15 23:00:36 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.22 2018/04/16 08:17:18 wiz Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -173,7 +173,7 @@ Normal operation sees the process be initialised using the .Fn netpgp_init function, which will set up the public and private keyrings, as well as set the -user identity in the +user identity in the .Ar userid member of the .Dv netpgp_t
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Sun Apr 15 23:00:36 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Break down explanation of netpgp_init to make it easier to extend. Document how the userid is obtained. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.20 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.21 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.20 Wed Apr 4 21:39:35 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Sun Apr 15 23:00:36 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.20 2018/04/04 21:39:35 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.21 2018/04/15 23:00:36 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 3, 2018 +.Dd April 15, 2018 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -172,12 +172,13 @@ Normal operation sees the .Nm process be initialised using the .Fn netpgp_init -function, which will set up the public and private keyrings, and set the -user identity to the +function, which will set up the public and private keyrings, as well as set the +user identity in the .Ar userid -argument passed stored in the +member of the .Dv netpgp_t -structure, and set using the +structure. +These are set using the .Fn netpgp_setvar function. If no public key ring file is set, initial values will be taken from those @@ -189,6 +190,13 @@ initial values will be taken from those in the .Pa .gnupg/secring.gpg file in the user's home directory. +The user identity is obtained from the +.Ev userid +environment variable, or failing that, the value of the +.Dq default-key +setting from +.Pa .gnupg/gpg.conf +file in the user's home directory is used. The .Fn netpgp_init function returns 1 on success, 0 on failure.
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Mon Apr 2 10:30:07 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: Revert previous change as the typedef should now work as intended. Thanks christos, martin To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.17 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.18 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.17 Sun Apr 1 23:25:27 2018 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Mon Apr 2 10:30:06 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.17 2018/04/01 23:25:27 sevan Exp $ +.\" $NetBSD: libnetpgp.3,v 1.18 2018/04/02 10:30:06 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 02, 2018 +.Dd February 16, 2014 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -41,11 +41,11 @@ The following functions relate to initialisations and finalisations: .Ft int .Fo netpgp_init -.Fa "struct netpgp_t *netpgp" +.Fa "netpgp_t *netpgp" .Fc .Ft int .Fo netpgp_end -.Fa "struct netpgp_t *netpgp" +.Fa "netpgp_t *netpgp" .Fc .Pp The following functions are for debugging, reflection and information: @@ -63,99 +63,99 @@ The following functions are for debuggin .Fc .Ft int .Fo netpgp_list_packets -.Fa "struct netpgp_t *netpgp" "char *filename" "int armour" "char *pubringname" +.Fa "netpgp_t *netpgp" "char *filename" "int armour" "char *pubringname" .Fc .Pp The following functions are for variable management: .Ft int .Fo netpgp_setvar -.Fa "struct netpgp_t *netpgp" "const char *name" "const char *value" +.Fa "netpgp_t *netpgp" "const char *name" "const char *value" .Fc .Ft char * .Fo netpgp_getvar -.Fa "struct netpgp_t *netpgp" "const char *name" +.Fa "netpgp_t *netpgp" "const char *name" .Fc .Ft int .Fo netpgp_incvar -.Fa "struct netpgp_t *netpgp" "const char *name" "const int delta" +.Fa "netpgp_t *netpgp" "const char *name" "const int delta" .Fc .Pp The following function sets the home directory: .Ft int .Fo netpgp_set_homedir -.Fa "struct netpgp_t *netpgp" "char *homedir" "char *subdir" "const int quiet" +.Fa "netpgp_t *netpgp" "char *homedir" "char *subdir" "const int quiet" .Fc .Pp The following functions are used for key management: .Ft int .Fo netpgp_list_keys -.Fa "struct netpgp_t *netpgp" "const int printsigs" +.Fa "netpgp_t *netpgp" "const int printsigs" .Fc .Ft int .Fo netpgp_match_list_keys -.Fa "struct netpgp_t *netpgp" "char *pattern" +.Fa "netpgp_t *netpgp" "char *pattern" .Fc .Ft int .Fo netpgp_find_key -.Fa "struct netpgp_t *netpgp" "char *userid" +.Fa "netpgp_t *netpgp" "char *userid" .Fc .Ft char * .Fo netpgp_get_key -.Fa "struct netpgp_t *netpgp" "const char *id" +.Fa "netpgp_t *netpgp" "const char *id" .Fc .Ft int .Fo netpgp_export_key -.Fa "struct netpgp_t *netpgp" "char *userid" +.Fa "netpgp_t *netpgp" "char *userid" .Fc .Ft int .Fo netpgp_import_key -.Fa "struct netpgp_t *netpgp" "char *file" +.Fa "netpgp_t *netpgp" "char *file" .Fc .Ft int .Fo netpgp_generate_key -.Fa "struct netpgp_t *netpgp" "char *userid" "int numbits" +.Fa "netpgp_t *netpgp" "char *userid" "int numbits" .Fc .Pp The following functions are used for file management: .Ft int .Fo netpgp_encrypt_file -.Fa "struct netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" .Fa "int armored" .Fc .Ft int .Fo netpgp_decrypt_file -.Fa "struct netpgp_t *netpgp" "char *filename" "char *out" "int armored" +.Fa "netpgp_t *netpgp" "char *filename" "char *out" "int armored" .Fc .Ft int .Fo netpgp_sign_file -.Fa "struct netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" .Fa "int armored" "int cleartext" "int detached" .Fc .Ft int .Fo netpgp_verify_file -.Fa "struct netpgp_t *netpgp" "char *f" "int armored" +.Fa "netpgp_t *netpgp" "char *f" "int armored" .Fc .Pp The following functions are used for memory signing and encryption: .Ft int .Fo netpgp_encrypt_memory -.Fa "struct netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize" +.Fa "netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize" .Fa "char *out" "size_t outsize" "int armored" .Fc .Ft int .Fo netpgp_decrypt_memory -.Fa "struct netpgp_t *netpgp" "const void *input" "const size_t insize" +.Fa "netpgp_t *netpgp" "const void *input" "const size_t insize" .Fa "char *out" "size_t outsize" "c
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: sevan Date: Sun Apr 1 23:25:28 UTC 2018 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: netpgp_t is a structure To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.17 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.16 Mon Feb 17 07:23:18 2014 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Sun Apr 1 23:25:27 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.16 2014/02/17 07:23:18 agc Exp $ +.\" $NetBSD: libnetpgp.3,v 1.17 2018/04/01 23:25:27 sevan Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 16, 2014 +.Dd April 02, 2018 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -41,11 +41,11 @@ The following functions relate to initialisations and finalisations: .Ft int .Fo netpgp_init -.Fa "netpgp_t *netpgp" +.Fa "struct netpgp_t *netpgp" .Fc .Ft int .Fo netpgp_end -.Fa "netpgp_t *netpgp" +.Fa "struct netpgp_t *netpgp" .Fc .Pp The following functions are for debugging, reflection and information: @@ -63,99 +63,99 @@ The following functions are for debuggin .Fc .Ft int .Fo netpgp_list_packets -.Fa "netpgp_t *netpgp" "char *filename" "int armour" "char *pubringname" +.Fa "struct netpgp_t *netpgp" "char *filename" "int armour" "char *pubringname" .Fc .Pp The following functions are for variable management: .Ft int .Fo netpgp_setvar -.Fa "netpgp_t *netpgp" "const char *name" "const char *value" +.Fa "struct netpgp_t *netpgp" "const char *name" "const char *value" .Fc .Ft char * .Fo netpgp_getvar -.Fa "netpgp_t *netpgp" "const char *name" +.Fa "struct netpgp_t *netpgp" "const char *name" .Fc .Ft int .Fo netpgp_incvar -.Fa "netpgp_t *netpgp" "const char *name" "const int delta" +.Fa "struct netpgp_t *netpgp" "const char *name" "const int delta" .Fc .Pp The following function sets the home directory: .Ft int .Fo netpgp_set_homedir -.Fa "netpgp_t *netpgp" "char *homedir" "char *subdir" "const int quiet" +.Fa "struct netpgp_t *netpgp" "char *homedir" "char *subdir" "const int quiet" .Fc .Pp The following functions are used for key management: .Ft int .Fo netpgp_list_keys -.Fa "netpgp_t *netpgp" "const int printsigs" +.Fa "struct netpgp_t *netpgp" "const int printsigs" .Fc .Ft int .Fo netpgp_match_list_keys -.Fa "netpgp_t *netpgp" "char *pattern" +.Fa "struct netpgp_t *netpgp" "char *pattern" .Fc .Ft int .Fo netpgp_find_key -.Fa "netpgp_t *netpgp" "char *userid" +.Fa "struct netpgp_t *netpgp" "char *userid" .Fc .Ft char * .Fo netpgp_get_key -.Fa "netpgp_t *netpgp" "const char *id" +.Fa "struct netpgp_t *netpgp" "const char *id" .Fc .Ft int .Fo netpgp_export_key -.Fa "netpgp_t *netpgp" "char *userid" +.Fa "struct netpgp_t *netpgp" "char *userid" .Fc .Ft int .Fo netpgp_import_key -.Fa "netpgp_t *netpgp" "char *file" +.Fa "struct netpgp_t *netpgp" "char *file" .Fc .Ft int .Fo netpgp_generate_key -.Fa "netpgp_t *netpgp" "char *userid" "int numbits" +.Fa "struct netpgp_t *netpgp" "char *userid" "int numbits" .Fc .Pp The following functions are used for file management: .Ft int .Fo netpgp_encrypt_file -.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "struct netpgp_t *netpgp" "char *userid" "char *filename" "char *out" .Fa "int armored" .Fc .Ft int .Fo netpgp_decrypt_file -.Fa "netpgp_t *netpgp" "char *filename" "char *out" "int armored" +.Fa "struct netpgp_t *netpgp" "char *filename" "char *out" "int armored" .Fc .Ft int .Fo netpgp_sign_file -.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out" +.Fa "struct netpgp_t *netpgp" "char *userid" "char *filename" "char *out" .Fa "int armored" "int cleartext" "int detached" .Fc .Ft int .Fo netpgp_verify_file -.Fa "netpgp_t *netpgp" "char *f" "int armored" +.Fa "struct netpgp_t *netpgp" "char *f" "int armored" .Fc .Pp The following functions are used for memory signing and encryption: .Ft int .Fo netpgp_encrypt_memory -.Fa "netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize" +.Fa "struct netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize" .Fa "char *out" "size_t outsize" "int armored" .Fc .Ft int .Fo netpgp_decrypt_memory -.Fa "netpgp_t *netpgp" "const void *input" "const size_t insize" +.Fa "struct netpgp_t *netpgp" "const void *input" "const size_t insize" .Fa "char *out" "size_t outsize" "const int armored" .Fc .Ft int .Fo netpgp_sign_memory -.Fa "netpgp_
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Sun Apr 9 23:03:51 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: signature.c Log Message: No longer hard-code the suffix length This will avoid a buffer overflow if the suffix changes; it is currently hard-coded as either "asc" or "sig". Submitted on tech-pkg@ as: [PATCH 10/11] No longer hard-code the suffix length To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.37 --- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36 Sun Apr 9 22:48:39 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Sun Apr 9 23:03:50 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: signature.c,v 1.36 2017/04/09 22:48:39 khorben Exp $"); +__RCSID("$NetBSD: signature.c,v 1.37 2017/04/09 23:03:50 khorben Exp $"); #endif #include @@ -909,7 +909,7 @@ open_output_file(pgp_output_t **output, fd = pgp_setup_file_write(output, outname, overwrite); } } else { - size_t flen = strlen(inname) + 4 + 1; + size_t flen = strlen(inname) + 1 + strlen(suffix) + 1; char *f = NULL; if ((f = calloc(1, flen)) == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Sun Apr 9 22:48:39 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: signature.c Log Message: Output signatures to the standard output for "-" This is to reflect the behaviour documented in netpgp(1). Submitted on tech-pkg@ as: [PATCH 09/11] Output signatures to the standard output for "-" Only modified for consistency with the coding style. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35 Sun Apr 9 22:44:34 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Sun Apr 9 22:48:39 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: signature.c,v 1.35 2017/04/09 22:44:34 khorben Exp $"); +__RCSID("$NetBSD: signature.c,v 1.36 2017/04/09 22:48:39 khorben Exp $"); #endif #include @@ -903,7 +903,11 @@ open_output_file(pgp_output_t **output, /* setup output file */ if (outname) { - fd = pgp_setup_file_write(output, outname, overwrite); + if (strcmp(outname, "-") == 0) { + fd = pgp_setup_file_write(output, NULL, overwrite); + } else { + fd = pgp_setup_file_write(output, outname, overwrite); + } } else { size_t flen = strlen(inname) + 4 + 1; char *f = NULL;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Sun Apr 9 22:44:34 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: signature.c Log Message: Avoid a type cast No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.34 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35 --- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.34 Mon Mar 5 02:20:18 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c Sun Apr 9 22:44:34 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: signature.c,v 1.34 2012/03/05 02:20:18 christos Exp $"); +__RCSID("$NetBSD: signature.c,v 1.35 2017/04/09 22:44:34 khorben Exp $"); #endif #include @@ -905,7 +905,7 @@ open_output_file(pgp_output_t **output, if (outname) { fd = pgp_setup_file_write(output, outname, overwrite); } else { - unsignedflen = (unsigned)(strlen(inname) + 4 + 1); + size_t flen = strlen(inname) + 4 + 1; char *f = NULL; if ((f = calloc(1, flen)) == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Mar 27 21:19:12 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c Log Message: Do not ask for a passphrase when empty Submitted on tech-pkg@ as: [PATCH 06/11] Do not ask for a passphrase when empty Only modified for consistency with the coding style. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.55 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54 Mon Mar 27 21:06:50 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Mar 27 21:19:12 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.54 2017/03/27 21:06:50 khorben Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.55 2017/03/27 21:19:12 khorben Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -226,7 +226,7 @@ typedef struct { pgp_seckey_t *seckey; } decrypt_t; -static pgp_cb_ret_t +static pgp_cb_ret_t decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo) { const pgp_contents_t *content = &pkt->u; @@ -294,6 +294,20 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ return PGP_RELEASE_MEMORY; } +static pgp_cb_ret_t +decrypt_cb_empty(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo) +{ + const pgp_contents_t *content = &pkt->u; + + switch (pkt->tag) { + case PGP_GET_PASSPHRASE: + *content->skey_passphrase.passphrase = netpgp_strdup(""); + return PGP_KEEP_MEMORY; + default: + return decrypt_cb(pkt, cbinfo); + } +} + /** \ingroup Core_Keys \brief Decrypts secret key from given keydata with given passphrase @@ -308,8 +322,18 @@ pgp_decrypt_seckey(const pgp_key_t *key, const int printerrors = 1; decrypt_t decrypt; + /* XXX first try with an empty passphrase */ (void) memset(&decrypt, 0x0, sizeof(decrypt)); decrypt.key = key; + stream = pgp_new(sizeof(*stream)); + pgp_keydata_reader_set(stream, key); + pgp_set_callback(stream, decrypt_cb_empty, &decrypt); + stream->readinfo.accumulate = 1; + pgp_parse(stream, !printerrors); + if (decrypt.seckey != NULL) { + return decrypt.seckey; + } + /* ask for a passphrase */ decrypt.passfp = passfp; stream = pgp_new(sizeof(*stream)); pgp_keydata_reader_set(stream, key);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Mar 27 21:06:50 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c keyring.h Log Message: Expect a FILE * for pgp_decrypt_seckey() Submitted on tech-pkg@ as: [PATCH 05/11] Expect a FILE * for pgp_decrypt_seckey() No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.33 -r1.34 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53 Mon Mar 27 21:00:43 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Mar 27 21:06:50 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.53 2017/03/27 21:00:43 khorben Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.54 2017/03/27 21:06:50 khorben Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -302,7 +302,7 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ \return secret key */ pgp_seckey_t * -pgp_decrypt_seckey(const pgp_key_t *key, void *passfp) +pgp_decrypt_seckey(const pgp_key_t *key, FILE *passfp) { pgp_stream_t *stream; const int printerrors = 1; Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.34 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33 Mon Mar 27 20:55:13 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Mon Mar 27 21:06:50 2017 @@ -53,6 +53,7 @@ #ifndef KEYRING_H_ #define KEYRING_H_ +#include #include "packet.h" #include "packet-parse.h" #include "mj.h" @@ -91,7 +92,7 @@ const pgp_pubkey_t *pgp_get_pubkey(const unsigned pgp_is_key_secret(const pgp_key_t *); const pgp_seckey_t *pgp_get_seckey(const pgp_key_t *); pgp_seckey_t *pgp_get_writable_seckey(pgp_key_t *); -pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, void *); +pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, FILE *); unsigned pgp_keyring_fileread(pgp_keyring_t *, const unsigned, const char *);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Mar 27 21:00:43 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c Log Message: Do not use random data for pass-phrases on EOF Submitted on tech-pkg@ as: [PATCH 04/11] Do not use random data for pass-phrases on EOF Only modified for consistency with the coding style. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52 Mon Mar 27 20:55:13 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Mar 27 21:00:43 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.52 2017/03/27 20:55:13 khorben Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.53 2017/03/27 21:00:43 khorben Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -244,7 +244,9 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ break; case PGP_GET_PASSPHRASE: - (void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)); + if (pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)) == 0) { + pass[0] = '\0'; + } *content->skey_passphrase.passphrase = netpgp_strdup(pass); pgp_forget(pass, sizeof(pass)); return PGP_KEEP_MEMORY;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Mar 27 20:55:13 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c keyring.h netpgp.c Log Message: Avoid some type casts Submitted on tech-pkg@ as: [PATCH 03/11] Avoid some type casts No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.32 -r1.33 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h cvs rdiff -u -r1.100 -r1.101 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51 Mon Feb 20 00:51:08 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Mar 27 20:55:13 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.51 2017/02/20 00:51:08 khorben Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.52 2017/03/27 20:55:13 khorben Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -214,7 +214,7 @@ pgp_get_writable_seckey(pgp_key_t *data) /* utility function to zero out memory */ void -pgp_forget(void *vp, unsigned size) +pgp_forget(void *vp, size_t size) { (void) memset(vp, 0x0, size); } @@ -246,7 +246,7 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_ case PGP_GET_PASSPHRASE: (void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)); *content->skey_passphrase.passphrase = netpgp_strdup(pass); - pgp_forget(pass, (unsigned)sizeof(pass)); + pgp_forget(pass, sizeof(pass)); return PGP_KEEP_MEMORY; case PGP_PARSER_ERRCODE: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.32 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.32 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Mon Mar 27 20:55:13 2017 @@ -100,7 +100,7 @@ int pgp_keyring_list(pgp_io_t *, const p int pgp_keyring_json(pgp_io_t *, const pgp_keyring_t *, mj_t *, const int); void pgp_set_seckey(pgp_contents_t *, const pgp_key_t *); -void pgp_forget(void *, unsigned); +void pgp_forget(void *, size_t); const uint8_t *pgp_get_key_id(const pgp_key_t *); unsigned pgp_get_userid_count(const pgp_key_t *); Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.101 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100 Fri Feb 24 01:26:17 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Mon Mar 27 20:55:13 2017 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.100 2017/02/24 01:26:17 khorben Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.101 2017/03/27 20:55:13 khorben Exp $"); #endif #include @@ -1411,7 +1411,7 @@ netpgp_sign_file(netpgp_t *netpgp, (unsigned)armored, (unsigned)cleartext, overwrite); } - pgp_forget(seckey, (unsigned)sizeof(*seckey)); + pgp_forget(seckey, sizeof(*seckey)); return ret; } @@ -1542,7 +1542,7 @@ netpgp_sign_memory(netpgp_t *netpgp, } else { ret = 0; } - pgp_forget(seckey, (unsigned)sizeof(*seckey)); + pgp_forget(seckey, sizeof(*seckey)); return ret; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Mar 27 20:50:19 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c Log Message: Do not truncate pass-phrases without a newline character This also fixes a crash when the pass-phrase entered is empty. Submitted on tech-pkg@ as: [PATCH 02/11] Do not truncate pass-phrases without a newline character Only modified for consistency with the coding style. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.52 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51 Fri Feb 24 01:27:14 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Mon Mar 27 20:50:19 2017 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $"); +__RCSID("$NetBSD: reader.c,v 1.52 2017/03/27 20:50:19 khorben Exp $"); #endif #include @@ -160,6 +160,7 @@ int pgp_getpassphrase(void *in, char *phrase, size_t size) { char *p; + size_t len; if (in == NULL) { while ((p = getpass("netpgp passphrase: ")) == NULL) { @@ -169,7 +170,10 @@ pgp_getpassphrase(void *in, char *phrase if (fgets(phrase, (int)size, in) == NULL) { return 0; } - phrase[strlen(phrase) - 1] = 0x0; + len = strlen(phrase); + if (len >= 1 && phrase[len - 1] == '\n') { + phrase[len - 1] = '\0'; + } } return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Fri Feb 24 01:27:14 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c Log Message: Revert "Remove a useless loop around getpass()" getpass(3) may return NULL upon failures on Linux, and netpgp should remain portable to other systems. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50 Mon Feb 20 01:33:28 2017 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Fri Feb 24 01:27:14 2017 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $"); +__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $"); #endif #include @@ -162,7 +162,8 @@ pgp_getpassphrase(void *in, char *phrase char *p; if (in == NULL) { - p = getpass("netpgp passphrase: "); + while ((p = getpass("netpgp passphrase: ")) == NULL) { + } (void) snprintf(phrase, size, "%s", p); } else { if (fgets(phrase, (int)size, in) == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Feb 20 01:33:28 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c Log Message: Remove a useless loop around getpass() According to getpass(3), this library function cannot return NULL. Verified with a source code inspection. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.49 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.49 Mon Mar 5 02:20:18 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Mon Feb 20 01:33:28 2017 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.49 2012/03/05 02:20:18 christos Exp $"); +__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $"); #endif #include @@ -162,8 +162,7 @@ pgp_getpassphrase(void *in, char *phrase char *p; if (in == NULL) { - while ((p = getpass("netpgp passphrase: ")) == NULL) { - } + p = getpass("netpgp passphrase: "); (void) snprintf(phrase, size, "%s", p); } else { if (fgets(phrase, (int)size, in) == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: khorben Date: Mon Feb 20 00:51:08 UTC 2017 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c Log Message: Do not crash when listing keys without a keyring To test: (with an empty ~/.gnupg) $ netpgpkeys --import-key /dev/null Submitted on tech-pkg@ as: [PATCH 01/11] Do not crash when listing keys without a keyring Different patch for the same issue. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.50 Sat Jun 25 00:37:44 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Feb 20 00:51:08 2017 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.50 2011/06/25 00:37:44 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.51 2017/02/20 00:51:08 khorben Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -993,9 +993,12 @@ pgp_keyring_list(pgp_io_t *io, const pgp { pgp_key_t *key; unsigned n; + unsigned keyc = (keyring != NULL) ? keyring->keyc : 0; - (void) fprintf(io->res, "%u key%s\n", keyring->keyc, - (keyring->keyc == 1) ? "" : "s"); + (void) fprintf(io->res, "%u key%s\n", keyc, (keyc == 1) ? "" : "s"); + if (keyring == NULL) { + return 1; + } for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) { if (pgp_is_key_secret(key)) { pgp_print_keydata(io, keyring, key, "sec",
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: christos Date: Tue Jun 28 16:34:40 UTC 2016 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: CID 977755: Resource leaks. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.97 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.98 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.97 Sun Feb 7 00:03:36 2016 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Jun 28 12:34:40 2016 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.97 2016/02/07 05:03:36 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.98 2016/06/28 16:34:40 christos Exp $"); #endif #include @@ -1186,6 +1186,7 @@ netpgp_generate_key(netpgp_t *netpgp, ch int passc; int fd; int cc; + int rv = 0; uid = NULL; io = netpgp->io; @@ -1212,13 +1213,13 @@ netpgp_generate_key(netpgp_t *netpgp, ch netpgp_setvar(netpgp, "generated userid", &dir[cc - 16]); if (mkdir(dir, 0700) < 0) { (void) fprintf(io->errs, "can't mkdir '%s'\n", dir); - return 0; + goto out; } (void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir); (void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir); if (!appendkey(io, key, ringfile)) { (void) fprintf(io->errs, "Cannot write pubkey to '%s'\n", ringfile); - return 0; + goto out; } if (netpgp->pubring != NULL) { pgp_keyring_free(netpgp->pubring); @@ -1230,7 +1231,7 @@ netpgp_generate_key(netpgp_t *netpgp, ch } if (fd < 0) { (void) fprintf(io->errs, "can't append secring '%s'\n", ringfile); - return 0; + goto out; } /* get the passphrase */ if ((numtries = netpgp_getvar(netpgp, "numtries")) == NULL || @@ -1242,15 +1243,18 @@ netpgp_generate_key(netpgp_t *netpgp, ch passc = find_passphrase(netpgp->passfp, &cp[ID_OFFSET], passphrase, sizeof(passphrase), attempts); if (!pgp_write_xfer_seckey(create, key, (uint8_t *)passphrase, (const unsigned)passc, noarmor)) { (void) fprintf(io->errs, "Cannot write seckey\n"); - return 0; + goto out1; } + rv = 1; +out1: pgp_teardown_file_write(create, fd); if (netpgp->secring != NULL) { pgp_keyring_free(netpgp->secring); } +out: pgp_keydata_free(key); free(cp); - return 1; + return rv; } /* encrypt a file */
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Feb 7 05:03:36 UTC 2016 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Fix signing of in-memory data with SSH keys To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.96 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.97 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.96 Wed Feb 22 06:58:54 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sun Feb 7 05:03:36 2016 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.96 2012/02/22 06:58:54 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.97 2016/02/07 05:03:36 agc Exp $"); #endif #include @@ -1501,10 +1501,17 @@ netpgp_sign_memory(netpgp_t *netpgp, &pubkey->key.pubkey, 0); } } - /* now decrypt key */ - seckey = pgp_decrypt_seckey(keypair, netpgp->passfp); - if (seckey == NULL) { - (void) fprintf(io->errs, "Bad passphrase\n"); + if (netpgp_getvar(netpgp, "ssh keys") == NULL) { + /* now decrypt key */ + seckey = pgp_decrypt_seckey(keypair, netpgp->passfp); + if (seckey == NULL) { +(void) fprintf(io->errs, "Bad passphrase\n"); + } + } else { + pgp_keyring_t *secring; + + secring = netpgp->secring; + seckey = &secring->keys[0].key.seckey; } } if (seckey == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Feb 17 07:39:20 UTC 2014 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c Log Message: Avoid a warning on Gentoo Linux about fwrite(3) -- their glibc declares fwrite(3) with the warn_unused_result attribute, from Razvan Cojocaru To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.35 Sun Jan 2 18:13:10 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Mon Feb 17 07:39:19 2014 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: crypto.c,v 1.35 2011/01/02 18:13:10 agc Exp $"); +__RCSID("$NetBSD: crypto.c,v 1.36 2014/02/17 07:39:19 agc Exp $"); #endif #include @@ -286,8 +286,11 @@ write_parsed_cb(const pgp_packet_t *pkt, puts("Skipping..."); cbinfo->printstate.skipping = 1; } - fwrite(content->unarmoured_text.data, 1, - content->unarmoured_text.length, stdout); + if (fwrite(content->unarmoured_text.data, 1, + content->unarmoured_text.length, stdout) != content->unarmoured_text.length) { + fprintf(stderr, "unable to write unarmoured text data\n"); + cbinfo->printstate.skipping = 1; + } break; case PGP_PTAG_CT_PK_SESSION_KEY:
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Feb 4 01:46:39 UTC 2014 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: ssh2pgp.c Log Message: When building up a PGP public key from an ssh key, do not use the key file's mtime as the birthtime of the signature - rather, just zero this value (the key birthtime is an inherent part of calculating the key id) This allows public key files to be copied to other file systems, machines or directories, and still produce the same key id. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.23 --- src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.22 Sat Jan 1 19:53:53 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Tue Feb 4 01:46:38 2014 @@ -276,7 +276,7 @@ pgp_ssh2pubkey(pgp_io_t *io, const char (void) memset(key, 0x0, sizeof(*key)); pubkey = &key->key.seckey.pubkey; pubkey->version = PGP_V4; - pubkey->birthtime = st.st_mtime; + pubkey->birthtime = 0; /* get key type */ ok = 1; switch (pubkey->alg = findstr(pkatypes, buf)) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: joerg Date: Mon Jan 6 21:12:19 UTC 2014 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: errors.h netpgpsdk.h Log Message: Add __printflike where necessary. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/errors.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.7 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.8 --- src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.7 Mon Mar 5 02:20:18 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/errors.h Mon Jan 6 21:12:19 2014 @@ -135,7 +135,7 @@ const char *pgp_errcode(const pgp_er void pgp_push_error(pgp_error_t **, pgp_errcode_t, int, - const char *, int, const char *,...); + const char *, int, const char *,...) __printflike(6, 7); void pgp_print_error(pgp_error_t *); void pgp_print_errors(pgp_error_t *); void pgp_free_errors(pgp_error_t *); Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h:1.10 src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h:1.11 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h:1.10 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgpsdk.h Mon Jan 6 21:12:19 2014 @@ -63,9 +63,9 @@ unsigned pgp_check_sig(const uint8_t * const char *pgp_get_info(const char *type); -int pgp_asprintf(char **, const char *, ...); +int pgp_asprintf(char **, const char *, ...) __printflike(2, 3); -void netpgp_log(const char *, ...); +void netpgp_log(const char *, ...) __printflike(1, 2); int netpgp_strcasecmp(const char *, const char *); char *netpgp_strdup(const char *);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: christos Date: Mon Mar 5 02:20:19 UTC 2012 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: compress.c errors.h misc.c packet-parse.c reader.c signature.c validate.c writer.c Log Message: Fix compilation: kill PGP_ERROR() and make everything use a format. XXX: Fixme to use __VA_ARGS__ instead of the silly PGP_ERROR_N() macros. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h cvs rdiff -u -r1.40 -r1.41 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c cvs rdiff -u -r1.50 -r1.51 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.48 -r1.49 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c cvs rdiff -u -r1.33 -r1.34 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c cvs rdiff -u -r1.43 -r1.44 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c cvs rdiff -u -r1.32 -r1.33 \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.23 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.22 Sun Mar 4 14:52:02 2012 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Sun Mar 4 21:20:18 2012 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.22 2012/03/04 19:52:02 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.23 2012/03/05 02:20:18 christos Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -170,13 +170,14 @@ zlib_compressed_data_reader(pgp_stream_t if (ret == Z_STREAM_END) { if (!z->region->indeterminate && z->region->readc != z->region->length) { - PGP_ERROR(cbinfo->errors, + PGP_ERROR_1(cbinfo->errors, PGP_E_P_DECOMPRESSION_ERROR, + "%s", "Compressed stream ended before packet end."); } } else if (ret != Z_OK) { (void) fprintf(stderr, "ret=%d\n", ret); -PGP_ERROR(cbinfo->errors, +PGP_ERROR_1(cbinfo->errors, PGP_E_P_DECOMPRESSION_ERROR, "%s", z->zstream.msg); } @@ -250,8 +251,9 @@ bzip2_compressed_data_reader(pgp_stream_ if (ret == BZ_STREAM_END) { if (!bz->region->indeterminate && bz->region->readc != bz->region->length) - PGP_ERROR(cbinfo->errors, + PGP_ERROR_1(cbinfo->errors, PGP_E_P_DECOMPRESSION_ERROR, + "%s", "Compressed stream ended before packet end."); } else if (ret != BZ_OK) { PGP_ERROR_1(cbinfo->errors, Index: src/crypto/external/bsd/netpgp/dist/src/lib/errors.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.6 src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.7 --- src/crypto/external/bsd/netpgp/dist/src/lib/errors.h:1.6 Sun Nov 7 03:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/errors.h Sun Mar 4 21:20:18 2012 @@ -150,9 +150,6 @@ int pgp_has_error(pgp_error_t *, pgp_er fprintf(stderr, "Memory error\n");\ }/* \todo placeholder for better error * handling */ -#define PGP_ERROR(err,code,fmt) do { \ - pgp_push_error(err,code,0,__FILE__,__LINE__,fmt); \ -} while(/*CONSTCOND*/0) #define PGP_ERROR_1(err,code,fmt,arg) do {\ pgp_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); \ } while(/*CONSTCOND*/0) Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.40 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.41 --- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.40 Mon Nov 29 01:21:40 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Sun Mar 4 21:20:18 2012 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: misc.c,v 1.40 2010/11/29 06:21:40 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.41 2012/03/05 02:20:18 christos Exp $"); #endif #include @@ -132,7 +132,8 @@ accumulate_cb(const pgp_packet_t *pkt, p keyring->keyc - 1); } if (keyring->keyc == 0) { - PGP_ERROR(cbinfo->errors, PGP_E_P_NO_USERID, "No userid found"); + PGP_ERROR_1(cbinfo->errors, PGP_E_P_NO_USERID, "%s", + "No userid found"); } else { pgp_add_userid(&keyring->keys[keyring->keyc - 1], content->userid); } Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.51 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.50 Mon Nov 15 03:56:30 2010 +++ src/c
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Mar 4 19:52:02 UTC 2012 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: compress.c Log Message: Use %s for the format string, as pointed out by joerg in the diff for __printflike attributions (on tech-userlevel, March 1st 2012). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.21 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.22 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.21 Mon Nov 15 08:03:39 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Sun Mar 4 19:52:02 2012 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.21 2010/11/15 08:03:39 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.22 2012/03/04 19:52:02 agc Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -177,7 +177,8 @@ zlib_compressed_data_reader(pgp_stream_t } else if (ret != Z_OK) { (void) fprintf(stderr, "ret=%d\n", ret); PGP_ERROR(cbinfo->errors, -PGP_E_P_DECOMPRESSION_ERROR, z->zstream.msg); + PGP_E_P_DECOMPRESSION_ERROR, "%s", + z->zstream.msg); } z->inflate_ret = ret; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Feb 22 06:29:40 UTC 2012 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c packet-print.c Log Message: re-order the fields that we print out in the pgp_sprint_pubkey() function to be more usual. print out the name from within pgp_sprint_pubkey() rather than tagging it onto the end of the output from the function. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.41 -r1.42 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.94 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.95 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.94 Tue Aug 2 07:16:56 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Feb 22 06:29:40 2012 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.94 2011/08/02 07:16:56 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.95 2012/02/22 06:29:40 agc Exp $"); #endif #include @@ -1091,8 +1091,6 @@ netpgp_match_pubkeys(netpgp_t *netpgp, c ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10, "netpgp_match_pubkeys", return 0); cc = pgp_sprint_pubkey(key, out, sizeof(out)); - (void) snprintf(&out[cc], sizeof(out) - cc, "name=%s\n", -key->uids[0]); pubs.v[pubs.c++] = netpgp_strdup(out); k += 1; } Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.41 src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.42 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.41 Sat Jun 25 00:37:44 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Wed Feb 22 06:29:40 2012 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-print.c,v 1.41 2011/06/25 00:37:44 agc Exp $"); +__RCSID("$NetBSD: packet-print.c,v 1.42 2012/02/22 06:29:40 agc Exp $"); #endif #include @@ -688,16 +688,17 @@ pgp_sprint_pubkey(const pgp_key_t *key, char fp[(PGP_FINGERPRINT_SIZE * 3) + 1]; int cc; - cc = snprintf(out, outsize, "key:%s:%d:%lld:%lld:%d:\n", + cc = snprintf(out, outsize, "key=%s\nname=%s\ncreation=%lld\nexpiry=%lld\nversion=%d\nalg=%d\n", strhexdump(fp, key->sigfingerprint.fingerprint, PGP_FINGERPRINT_SIZE, ""), - key->key.pubkey.version, + key->uids[key->uid0], (long long)key->key.pubkey.birthtime, (long long)key->key.pubkey.days_valid, + key->key.pubkey.version, key->key.pubkey.alg); switch (key->key.pubkey.alg) { case PGP_PKA_DSA: cc += snprintf(&out[cc], outsize - cc, - "pubkey:p=%s:q=%s:g=%s:y=%s\n", + "p=%s\nq=%s\ng=%s\ny=%s\n", BN_bn2hex(key->key.pubkey.key.dsa.p), BN_bn2hex(key->key.pubkey.key.dsa.q), BN_bn2hex(key->key.pubkey.key.dsa.g), @@ -707,14 +708,14 @@ pgp_sprint_pubkey(const pgp_key_t *key, case PGP_PKA_RSA_ENCRYPT_ONLY: case PGP_PKA_RSA_SIGN_ONLY: cc += snprintf(&out[cc], outsize - cc, - "pubkey:n=%s:e=%s\n", + "n=%s\ne=%s\n", BN_bn2hex(key->key.pubkey.key.rsa.n), BN_bn2hex(key->key.pubkey.key.rsa.e)); break; case PGP_PKA_ELGAMAL: case PGP_PKA_ELGAMAL_ENCRYPT_OR_SIGN: cc += snprintf(&out[cc], outsize - cc, - "pubkey:p=%s:g=%s:y=%s\n", + "p=%s\ng=%s\ny=%s\n", BN_bn2hex(key->key.pubkey.key.elgamal.p), BN_bn2hex(key->key.pubkey.key.elgamal.g), BN_bn2hex(key->key.pubkey.key.elgamal.y));
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: christos Date: Sun Aug 14 11:19:51 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet-show.c Log Message: simplify the code; this is what asprintf() is for, don't re-invent it. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.20 src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.21 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.20 Mon Nov 15 03:50:32 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c Sun Aug 14 07:19:51 2011 @@ -60,7 +60,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-show.c,v 1.20 2010/11/15 08:50:32 agc Exp $"); +__RCSID("$NetBSD: packet-show.c,v 1.21 2011/08/14 11:19:51 christos Exp $"); #endif #include @@ -451,7 +451,6 @@ static unsigned add_bitmap_entry(pgp_text_t *map, const char *str, uint8_t bit) { - const char *fmt_unknown = "Unknown bit(0x%x)"; if (str && !add_str(&map->known, str)) { /* @@ -468,14 +467,11 @@ * be replaced in the output by 2 chars of hex, so the length * will be correct */ - unsigned len = (unsigned)(strlen(fmt_unknown) + 1); char *newstr; - - if ((newstr = calloc(1, len)) == NULL) { + if (asprintf(&newstr, "Unknown bit(0x%x)", bit) == -1) { (void) fprintf(stderr, "add_bitmap_entry: bad alloc\n"); return 0; } - (void) snprintf(newstr, len, fmt_unknown, bit); if (!add_str(&map->unknown, newstr)) { return 0; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Aug 2 07:16:56 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: plug some memory leaks in error paths To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.93 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.94 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.93 Tue Aug 2 05:36:45 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Aug 2 07:16:56 2011 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.93 2011/08/02 05:36:45 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.94 2011/08/02 07:16:56 agc Exp $"); #endif #include @@ -314,10 +314,13 @@ filename = f; } if ((secring = calloc(1, sizeof(*secring))) == NULL) { + free(pubring); (void) fprintf(stderr, "readsshkeys: bad alloc\n"); return 0; } if (!pgp_ssh2_readkeys(netpgp->io, pubring, secring, NULL, filename, hashtype)) { + free(pubring); + free(secring); (void) fprintf(stderr, "readsshkeys: can't read sec %s\n", filename); return 0; } @@ -1911,9 +1914,12 @@ size_t cc; char f[MAXPATHLEN]; + keyring = NULL; + io = NULL; + cc = 0; if ((io = calloc(1, sizeof(pgp_io_t))) == NULL) { (void) fprintf(stderr, "netpgp_save_sshpub: bad alloc 1\n"); - return 0; + goto done; } io->outs = stdout; io->errs = stderr; @@ -1923,23 +1929,23 @@ savepubkey(s, f, sizeof(f)); if ((keyring = calloc(1, sizeof(*keyring))) == NULL) { (void) fprintf(stderr, "netpgp_save_sshpub: bad alloc 2\n"); - return 0; + goto done; } if (!pgp_keyring_fileread(netpgp->pubring = keyring, 1, f)) { (void) fprintf(stderr, "can't import key\n"); - return 0; + goto done; } /* get rsa key */ k = 0; key = pgp_getnextkeybyname(netpgp->io, netpgp->pubring, userid, &k); if (key == NULL) { (void) fprintf(stderr, "no key found for '%s'\n", userid); - return 0; + goto done; } if (key->key.pubkey.alg != PGP_PKA_RSA) { /* we're not interested in supporting DSA either :-) */ (void) fprintf(stderr, "key not RSA '%s'\n", userid); - return 0; + goto done; } /* XXX - check trust sigs */ /* XXX - check expiry */ @@ -1950,7 +1956,12 @@ cc = formatstring((char *)out, (const uint8_t *)"ssh-rsa", 7); cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.e); cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.n); - free(io); - free(keyring); +done: + if (io) { + free(io); + } + if (keyring) { + free(keyring); + } return (int)cc; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Aug 2 05:36:45 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: when matching pubkeys, also return the first (pgp) uid for the key in the resultant key listing when using json to format keys returned from libnetpgp, also prepare for machine-readable format ("mr") as well as human ("human"), even though it's not yet used. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.92 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.93 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.92 Tue Jun 28 03:35:28 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Aug 2 05:36:45 2011 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.92 2011/06/28 03:35:28 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.93 2011/08/02 05:36:45 agc Exp $"); #endif #include @@ -1028,9 +1028,10 @@ netpgp_match_keys_json(netpgp_t *netpgp, char **json, char *name, const char *fmt, const int psigs) { const pgp_key_t *key; - unsigned k; - mj_t id_array; - int ret; + unsigned k; + mj_t id_array; + char *newkey; + int ret; if (name[0] == '0' && name[1] == 'x') { name += 2; @@ -1044,11 +1045,13 @@ name, &k); if (key != NULL) { if (strcmp(fmt, "mr") == 0) { -#if 0 pgp_hkp_sprint_keydata(netpgp->io, netpgp->pubring, - key, &pubs.v[pubs.c], - &key->key.pubkey, psigs); -#endif + key, &newkey, + &key->key.pubkey, 0); +if (newkey) { + printf("%s\n", newkey); + free(newkey); +} } else { ALLOC(mj_t, id_array.value.v, id_array.size, id_array.c, 10, 10, "netpgp_match_keys_json", return 0); @@ -1070,9 +1073,10 @@ netpgp_match_pubkeys(netpgp_t *netpgp, char *name, void *vp) { const pgp_key_t *key; - unsigned k; - strings_t pubs; - FILE *fp = (FILE *)vp; + unsigned k; + strings_t pubs; + ssize_t cc; + FILE *fp = (FILE *)vp; (void) memset(&pubs, 0x0, sizeof(pubs)); do { @@ -1083,7 +1087,9 @@ ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10, "netpgp_match_pubkeys", return 0); - (void) pgp_sprint_pubkey(key, out, sizeof(out)); + cc = pgp_sprint_pubkey(key, out, sizeof(out)); + (void) snprintf(&out[cc], sizeof(out) - cc, "name=%s\n", +key->uids[0]); pubs.v[pubs.c++] = netpgp_strdup(out); k += 1; } @@ -1116,7 +1122,7 @@ netpgp_get_key(netpgp_t *netpgp, const char *name, const char *fmt) { const pgp_key_t *key; - char *newkey; + char *newkey; if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) { return NULL;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Jun 27 07:05:32 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: only attempt to load the secret key if we need to (for signing or for decrypting). To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.90 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.91 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.90 Sat Jun 25 00:37:44 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Mon Jun 27 07:05:31 2011 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.90 2011/06/25 00:37:44 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.91 2011/06/27 07:05:31 agc Exp $"); #endif #include @@ -852,10 +852,12 @@ (void) fprintf(io->errs, "Can't read pub keyring\n"); return 0; } - netpgp->secring = readkeyring(netpgp, "secring"); - if (netpgp->secring == NULL) { - (void) fprintf(io->errs, "Can't read sec keyring\n"); - return 0; + if (netpgp_getvar(netpgp, "need seckey")) { + netpgp->secring = readkeyring(netpgp, "secring"); + if (netpgp->secring == NULL) { +(void) fprintf(io->errs, "Can't read sec keyring\n"); +return 0; + } } } else { last = (netpgp->pubring != NULL);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Jan 3 05:34:54 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: avoid a double free - from Anthony Bentley. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.88 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.89 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.88 Sat Jan 1 23:00:24 2011 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Mon Jan 3 05:34:53 2011 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.88 2011/01/01 23:00:24 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.89 2011/01/03 05:34:53 agc Exp $"); #endif #include @@ -1538,7 +1538,7 @@ ret = pgp_validate_mem(io, &result, signedmem, (out) ? &cat : NULL, armored, netpgp->pubring); - pgp_memory_free(signedmem); + /* signedmem is freed from pgp_validate_mem */ if (ret) { resultp(io, "", &result, netpgp->pubring); if (out) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Jan 2 18:13:10 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c Log Message: Fix a double free[*], pointed out by Anthony Bentley. [*] This was actually a triple free. We go all the way to 11. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.34 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.35 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.34 Mon Nov 29 04:20:12 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Sun Jan 2 18:13:10 2011 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: crypto.c,v 1.34 2010/11/29 04:20:12 agc Exp $"); +__RCSID("$NetBSD: crypto.c,v 1.35 2011/01/02 18:13:10 agc Exp $"); #endif #include @@ -598,11 +598,8 @@ pgp_reader_pop_dearmour(parse); } - /* tidy up */ pgp_teardown_memory_read(parse, inmem); - pgp_memory_release(inmem); - free(inmem); pgp_writer_close(parse->cbinfo.output); pgp_output_delete(parse->cbinfo.output);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Jan 1 23:00:24 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: clean up lint (on amd64) To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.87 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.88 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.87 Wed Dec 1 22:14:52 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sat Jan 1 23:00:24 2011 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.87 2010/12/01 22:14:52 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.88 2011/01/01 23:00:24 agc Exp $"); #endif #include @@ -598,9 +598,9 @@ pobj(fp, &obj->value.v[mj_object_find(obj, "pka", 0, 2) + 1], 0); p(fp, " ", NULL); pobj(fp, &obj->value.v[mj_object_find(obj, "key id", 0, 2) + 1], 0); - birthtime = strtoll(obj->value.v[mj_object_find(obj, "birthtime", 0, 2) + 1].value.s, NULL, 10); + birthtime = (int64_t)strtoll(obj->value.v[mj_object_find(obj, "birthtime", 0, 2) + 1].value.s, NULL, 10); p(fp, " ", ptimestr(tbuf, sizeof(tbuf), birthtime), NULL); - duration = strtoll(obj->value.v[mj_object_find(obj, "duration", 0, 2) + 1].value.s, NULL, 10); + duration = (int64_t)strtoll(obj->value.v[mj_object_find(obj, "duration", 0, 2) + 1].value.s, NULL, 10); if (duration > 0) { now = time(NULL); p(fp, " ", (birthtime + duration < now) ? "[EXPIRED " : "[EXPIRES ", @@ -625,13 +625,15 @@ pobj(fp, &sub->value.v[1], 0); /* alg */ p(fp, " ", NULL); pobj(fp, &sub->value.v[2], 0); /* id */ - p(fp, " ", ptimestr(tbuf, sizeof(tbuf), strtoll(sub->value.v[3].value.s, NULL, 10)), + p(fp, " ", ptimestr(tbuf, sizeof(tbuf), + (time_t)strtoll(sub->value.v[3].value.s, NULL, 10)), "\n", NULL); } else if (strcmp(obj->value.v[i].value.s, "sig") == 0) { sub = &obj->value.v[i + 1]; p(fp, "sig", NULL); pobj(fp, &sub->value.v[0], 8); /* size */ - p(fp, " ", ptimestr(tbuf, sizeof(tbuf), strtoll(sub->value.v[1].value.s, NULL, 10)), + p(fp, " ", ptimestr(tbuf, sizeof(tbuf), + (time_t)strtoll(sub->value.v[1].value.s, NULL, 10)), " ", NULL); /* time */ pobj(fp, &sub->value.v[2], 0); /* human name */ p(fp, "\n", NULL); @@ -658,7 +660,7 @@ return 0; } len = strlen(res); - for (cc = 0 ; (wc = write(fd, &res[cc], len - cc)) > 0 ; cc += wc) { + for (cc = 0 ; (wc = (int)write(fd, &res[cc], len - (size_t)cc)) > 0 ; cc += wc) { } (void) close(fd); return 1; @@ -681,9 +683,9 @@ { int cc; - cc = formatu32((uint8_t *)buffer, len); + cc = formatu32((uint8_t *)buffer, (uint32_t)len); (void) memcpy(&buffer[cc], s, len); - return cc + len; + return cc + (int)len; } /* format a bignum, checking for "interesting" high bit values */ @@ -723,7 +725,7 @@ if (fgets(passphrase, (int)size, passfp) == NULL) { return 0; } - return strlen(passphrase); + return (int)strlen(passphrase); } for (i = 0 ; i < attempts ; i++) { (void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id); @@ -1870,11 +1872,11 @@ netpgp_write_sshkey(netpgp_t *netpgp, char *s, const char *userid, char *out, size_t size) { const pgp_key_t *key; - pgp_keyring_t *keyring; - pgp_io_t *io; - unsigned k; - size_t cc; - char f[MAXPATHLEN]; + pgp_keyring_t *keyring; + pgp_io_t *io; + unsigned k; + size_t cc; + char f[MAXPATHLEN]; if ((io = calloc(1, sizeof(pgp_io_t))) == NULL) { (void) fprintf(stderr, "netpgp_save_sshpub: bad alloc 1\n"); @@ -1917,5 +1919,5 @@ cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.n); free(io); free(keyring); - return cc; + return (int)cc; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Jan 1 22:29:01 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c Log Message: get rid of some lint on amd64 platform To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.47 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.48 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.47 Mon Nov 29 04:20:12 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Sat Jan 1 22:29:00 2011 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.47 2010/11/29 04:20:12 agc Exp $"); +__RCSID("$NetBSD: reader.c,v 1.48 2011/01/01 22:29:00 agc Exp $"); #endif #include @@ -144,7 +144,7 @@ (void) fprintf(stderr, "fd_reader: coalesced data, off %d\n", stream->virtualoff); } - n = MIN(stream->virtualc - stream->virtualoff, length); + n = MIN(stream->virtualc - stream->virtualoff, (unsigned)length); (void) memcpy(dest, &stream->virtualpkt[stream->virtualoff], n); stream->virtualoff += n; if (stream->virtualoff == stream->virtualc) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Jan 1 19:53:53 UTC 2011 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: ssh2pgp.c Log Message: Fix a problem with overrunning a base64 decoded number when decoding ssh keys, from Anthony Bentley. % netpgpkeys --ssh -l --hash=md5 1 key found signature 1024/RSA (Encrypt or Sign) 666f47feddcdb77d 2002-07-02 Key fingerprint: e1d6 b328 8126 e8e3 666f 47fe ddcd b77d uid machinename.com (/home/user/.ssh/id_rsa.pub) % ssh-keygen -l -f ~/.ssh/id_rsa.pub 1024 e1:d6:b3:28:81:26:e8:e3:66:6f:47:fe:dd:cd:b7:7d /home/user/.ssh/id_rsa.pub (RSA) % ssh keys and netpgp work as above. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.21 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.22 --- src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.21 Mon Nov 29 06:21:40 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Sat Jan 1 19:53:53 2011 @@ -251,7 +251,7 @@ } /* convert from base64 to binary */ - cc = bufgap_getbin(&bg, buf, (size_t)st.st_size); + cc = bufgap_getbin(&bg, buf, (size_t)bg.bcc); if ((space = strchr(buf, ' ')) != NULL) { cc = (int)(space - buf); }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Dec 1 22:14:52 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: avoid nameclash - call the generated user id variable "generated userid" also keep the time of structure initialisation as an internal variable. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.87 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86 Wed Dec 1 22:01:41 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Dec 1 22:14:52 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.86 2010/12/01 22:01:41 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.87 2010/12/01 22:14:52 agc Exp $"); #endif #include @@ -755,6 +755,7 @@ netpgp_init(netpgp_t *netpgp) { pgp_io_t *io; + time_t t; char id[MAX_ID_LENGTH]; char *homedir; char *userid; @@ -870,6 +871,8 @@ (void) netpgp_setvar(netpgp, "userid", userid); } } + t = time(NULL); + netpgp_setvar(netpgp, "initialised", ctime(&t)); return 1; } @@ -1180,7 +1183,7 @@ (void) fprintf(stdout, "%s", cp); /* write public key */ cc = snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]); - netpgp_setvar(netpgp, "userid", &dir[cc - 16]); + netpgp_setvar(netpgp, "generated userid", &dir[cc - 16]); if (mkdir(dir, 0700) < 0) { (void) fprintf(io->errs, "can't mkdir '%s'\n", dir); return 0;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Dec 1 22:01:41 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: When generating a key, set the new key's userid (last 16 bytes of fingerprint) as an internal netpgp variable. This can then be queried using netpgp_getvar(netpgp, "userid") to find the new key's id. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.85 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.86 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.85 Mon Nov 29 04:20:12 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Dec 1 22:01:41 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.85 2010/11/29 04:20:12 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.86 2010/12/01 22:01:41 agc Exp $"); #endif #include @@ -1156,6 +1156,7 @@ int attempts; int passc; int fd; + int cc; uid = NULL; io = netpgp->io; @@ -1178,7 +1179,8 @@ pgp_sprint_keydata(netpgp->io, NULL, key, &cp, "signature ", &key->key.seckey.pubkey, 0); (void) fprintf(stdout, "%s", cp); /* write public key */ - (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]); + cc = snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]); + netpgp_setvar(netpgp, "userid", &dir[cc - 16]); if (mkdir(dir, 0700) < 0) { (void) fprintf(io->errs, "can't mkdir '%s'\n", dir); return 0;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Nov 29 06:21:40 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: Makefile.am Makefile.in bufgap.c misc.c ssh2pgp.c Removed Files: src/crypto/external/bsd/netpgp/dist/src/lib: fastctype.c fastctype.h Log Message: I forgot that the fastctype.[ch] files were still in this directory, and have no need to be here - remove them, and just use native To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am cvs rdiff -u -r1.14 -r1.15 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in cvs rdiff -u -r1.4 -r1.5 src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c cvs rdiff -u -r1.2 -r0 \ src/crypto/external/bsd/netpgp/dist/src/lib/fastctype.c cvs rdiff -u -r1.3 -r0 \ src/crypto/external/bsd/netpgp/dist/src/lib/fastctype.h cvs rdiff -u -r1.39 -r1.40 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c cvs rdiff -u -r1.20 -r1.21 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.9 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.10 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.9 Sat Nov 6 03:42:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am Mon Nov 29 06:21:40 2010 @@ -1,4 +1,4 @@ -## $NetBSD: Makefile.am,v 1.9 2010/11/06 03:42:59 agc Exp $ +## $NetBSD: Makefile.am,v 1.10 2010/11/29 06:21:40 agc Exp $ AM_CFLAGS = $(WARNCFLAGS) @@ -11,7 +11,6 @@ compress.c \ create.c \ crypto.c \ - fastctype.c \ keyring.c \ misc.c \ netpgp.c \ Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.14 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.15 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.14 Sat Nov 6 03:42:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Mon Nov 29 06:21:40 2010 @@ -55,7 +55,7 @@ libnetpgp_la_DEPENDENCIES = ../libmj/libmj.la am_libnetpgp_la_OBJECTS = libnetpgp_la-bufgap.lo \ libnetpgp_la-compress.lo libnetpgp_la-create.lo \ - libnetpgp_la-crypto.lo libnetpgp_la-fastctype.lo \ + libnetpgp_la-crypto.lo \ libnetpgp_la-keyring.lo libnetpgp_la-misc.lo \ libnetpgp_la-netpgp.lo libnetpgp_la-openssl_crypto.lo \ libnetpgp_la-packet-parse.lo libnetpgp_la-packet-print.lo \ @@ -210,7 +210,6 @@ compress.c \ create.c \ crypto.c \ - fastctype.c \ keyring.c \ misc.c \ netpgp.c \ @@ -318,7 +317,6 @@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-compress@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-create@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-crypto@am__quote@ -...@amdep_true@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-fastctype@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-keyring@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-misc@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-netpgp@am__quote@ @@ -382,13 +380,6 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-crypto.lo `test -f 'crypto.c' || echo '$(srcdir)/'`crypto.c -libnetpgp_la-fastctype.lo: fastctype.c -...@am__fastdepcc_true@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetpgp_la-fastctype.lo -MD -MP -MF $(DEPDIR)/libnetpgp_la-fastctype.Tpo -c -o libnetpgp_la-fastctype.lo `test -f 'fastctype.c' || echo '$(srcdir)/'`fastctype.c -...@am__fastdepcc_true@ mv -f $(DEPDIR)/libnetpgp_la-fastctype.Tpo $(DEPDIR)/libnetpgp_la-fastctype.Plo -...@amdep_true@@am__fastdepCC_FALSE@ source='fastctype.c' object='libnetpgp_la-fastctype.lo' libtool=yes @AMDEPBACKSLASH@ -...@amdep_true@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -...@am__fastdepcc_false@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-fastctype.lo `test -f 'fastctype.c' || echo '$(srcdir)/'`fastctype.c - libnetpgp_la-keyring.lo: keyring.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFL
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Nov 15 08:56:30 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.h packet-parse.c packet.h types.h Log Message: There were still some throwbacks with the prefix '_ops' - rectify that to be the standard "pgp_" - no functional change. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.49 -r1.50 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.29 -r1.30 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/netpgp/dist/src/lib/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.28 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.29 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.28 Thu Nov 11 00:58:04 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Mon Nov 15 08:56:30 2010 @@ -62,8 +62,8 @@ #define PGP_MIN_HASH_SIZE 16 -/** _ops_hash_t */ -struct _ops_hash_t { +/** pgp_hash_t */ +struct pgp_hash_t { pgp_hash_alg_t alg; /* algorithm */ size_t size; /* size */ const char *name; /* what it's known as */ @@ -73,8 +73,8 @@ void *data; /* blob for data */ }; -/** _ops_crypt_t */ -struct _ops_crypt_t { +/** pgp_crypt_t */ +struct pgp_crypt_t { pgp_symm_alg_t alg; size_t blocksize; size_t keysize; Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.49 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.50 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.49 Mon Nov 15 08:50:32 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Mon Nov 15 08:56:30 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.49 2010/11/15 08:50:32 agc Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.50 2010/11/15 08:56:30 agc Exp $"); #endif #include @@ -888,7 +888,7 @@ \brief Free allocated memory */ static void -cleartext_trailer_free(struct _ops_hash_t **trailer) +cleartext_trailer_free(struct pgp_hash_t **trailer) { free(*trailer); *trailer = NULL; Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.29 src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.30 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.29 Thu Nov 11 00:58:04 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h Mon Nov 15 08:56:30 2010 @@ -855,7 +855,7 @@ const char *armour_trailer; pgp_headers_t cleartext_head; pgp_fixed_body_t cleartext_body; - struct _ops_hash_t *cleartext_trailer; + struct pgp_hash_t *cleartext_trailer; pgp_dyn_body_t unarmoured_text; pgp_pk_sesskey_t pk_sesskey; pgp_seckey_passphrase_t skey_passphrase; Index: src/crypto/external/bsd/netpgp/dist/src/lib/types.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/types.h:1.10 src/crypto/external/bsd/netpgp/dist/src/lib/types.h:1.11 --- src/crypto/external/bsd/netpgp/dist/src/lib/types.h:1.10 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/types.h Mon Nov 15 08:56:30 2010 @@ -69,10 +69,10 @@ /** pgp_errcode_name_map_t */ typedef pgp_map_t pgp_errcode_name_map_t; -typedef struct _ops_crypt_t pgp_crypt_t; +typedef struct pgp_crypt_t pgp_crypt_t; /** pgp_hash_t */ -typedef struct _ops_hash_t pgp_hash_t; +typedef struct pgp_hash_t pgp_hash_t; /** Revocation Reason type */ typedef uint8_t pgp_ss_rr_code_t;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Nov 15 08:50:32 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c keyring.c packet-parse.c packet-print.c packet-show.c reader.c writer.c Log Message: Don't prefix function names with "pgp_" if the functions are static. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c cvs rdiff -u -r1.48 -r1.49 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.39 -r1.40 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c cvs rdiff -u -r1.19 -r1.20 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c cvs rdiff -u -r1.45 -r1.46 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c cvs rdiff -u -r1.31 -r1.32 \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.32 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.33 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.32 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Mon Nov 15 08:50:32 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: crypto.c,v 1.32 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: crypto.c,v 1.33 2010/11/15 08:50:32 agc Exp $"); #endif #include @@ -316,7 +316,7 @@ case PGP_PTAG_CT_SE_DATA_BODY: case PGP_PTAG_CT_SE_DATA_HEADER: /* Ignore these packets */ - /* They're handled in pgp_parse_packet() */ + /* They're handled in parse_packet() */ /* and nothing else needs to be done */ break; Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.48 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.49 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.48 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Mon Nov 15 08:50:32 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.48 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.49 2010/11/15 08:50:32 agc Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -398,7 +398,7 @@ \note If dst already has a userid, it will be freed. */ static uint8_t * -pgp_copy_userid(uint8_t **dst, const uint8_t *src) +copy_userid(uint8_t **dst, const uint8_t *src) { size_t len; @@ -407,7 +407,7 @@ free(*dst); } if ((*dst = calloc(1, len + 1)) == NULL) { - (void) fprintf(stderr, "pgp_copy_userid: bad alloc\n"); + (void) fprintf(stderr, "copy_userid: bad alloc\n"); } else { (void) memcpy(*dst, src, len); } @@ -423,13 +423,13 @@ \note If dst already has a packet, it will be freed. */ static pgp_subpacket_t * -pgp_copy_packet(pgp_subpacket_t *dst, const pgp_subpacket_t *src) +copy_packet(pgp_subpacket_t *dst, const pgp_subpacket_t *src) { if (dst->raw) { free(dst->raw); } if ((dst->raw = calloc(1, src->length)) == NULL) { - (void) fprintf(stderr, "pgp_copy_packet: bad alloc\n"); + (void) fprintf(stderr, "copy_packet: bad alloc\n"); } else { dst->length = src->length; (void) memcpy(dst->raw, src->raw, src->length); @@ -454,7 +454,7 @@ uidp = &key->uids[key->uidc++]; *uidp = NULL; /* now copy it */ - return pgp_copy_userid(uidp, userid); + return copy_userid(uidp, userid); } void print_packet_hex(const pgp_subpacket_t *pkt); @@ -477,7 +477,7 @@ subpktp->length = 0; subpktp->raw = NULL; /* now copy it */ - return pgp_copy_packet(subpktp, packet); + return copy_packet(subpktp, packet); } /** Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.48 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.49 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.48 Mon Nov 15 08:03:40 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Mon Nov 15 08:50:32 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.48 2010/11/15 08:03:40 agc Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.49 2010/11/15 08:50:32 agc Exp $"); #endif #include @@ -871,7 +871,7 @@ \brief Free allocated memory */ static void -pgp_headers_free(pgp_headers_t *headers) +headers_free(pgp_headers_t *headers) { unsignedn; @@ -899,7 +899,7 @@ \brief Free allocated memory */ static
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Nov 15 08:27:40 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Use a regular expression to match the various ASCII-armoured headers we may encounter - fixes PR 44074 from Peter Pentchev in a different way. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.83 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.84 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.83 Mon Nov 15 08:03:39 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Mon Nov 15 08:27:40 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.83 2010/11/15 08:03:39 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.84 2010/11/15 08:27:40 agc Exp $"); #endif #include @@ -462,23 +462,32 @@ static unsigned isarmoured(pgp_io_t *io, const char *f, const void *memory, const char *text) { + regmatch_t matches[10]; unsigned armoured; + regex_t r; FILE *fp; char buf[BUFSIZ]; armoured = 0; + (void) regcomp(&r, text, REG_EXTENDED); if (f) { if ((fp = fopen(f, "r")) == NULL) { (void) fprintf(io->errs, "isarmoured: can't open '%s'\n", f); + regfree(&r); return 0; } if (fgets(buf, (int)sizeof(buf), fp) != NULL) { - armoured = (strncmp(buf, text, strlen(text)) == 0); + if (regexec(&r, buf, 10, matches, 0) == 0) { +armoured = 1; + } } (void) fclose(fp); } else { - armoured = (strncmp(memory, text, strlen(text)) == 0); + if (regexec(&r, memory, 10, matches, 0) == 0) { + armoured = 1; + } } + regfree(&r); return armoured; } @@ -1341,7 +1350,7 @@ return ret; } -#define ARMOR_SIG_HEAD "-BEGIN PGP SIGNATURE-\r\n" +#define ARMOR_SIG_HEAD "-BEGIN PGP (SIGNATURE|SIGNED MESSAGE)-" /* verify a file */ int
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Nov 15 08:03:40 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: compress.c create.c netpgp.c packet-parse.c writer.c Log Message: Changes to help with netpgp key generation and interoperability: + use plain SHA1 for session key s2k negotiation + don't warn on some conditions when inflating (reading a compressed file) since the conditions don't hold for partial block lengths + prompt for a passphrase when generating a new key - used in the upcoming secret-sharing functionality for netpgp To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c cvs rdiff -u -r1.37 -r1.38 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.c cvs rdiff -u -r1.82 -r1.83 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.47 -r1.48 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.30 -r1.31 \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.20 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.21 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.20 Thu Nov 11 00:58:04 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Mon Nov 15 08:03:39 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.20 2010/11/11 00:58:04 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.21 2010/11/15 08:03:39 agc Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -133,19 +133,11 @@ z->zstream.next_out == &z->out[z->offset]) { return 0; } - if (pgp_get_debug_level(__FILE__)) { (void) fprintf(stderr, "zlib_compressed_data_reader: length %" PRIsize "d\n", length); } - - if (z->region->readc == z->region->length) { - if (z->inflate_ret != Z_STREAM_END) { - PGP_ERROR(cbinfo->errors, PGP_E_P_DECOMPRESSION_ERROR, - "Compressed data didn't end when region ended."); - } - } for (cc = 0 ; cc < length ; cc += len) { if (&z->out[z->offset] == z->zstream.next_out) { int ret; @@ -221,17 +213,10 @@ (void) fprintf(stderr, "Weird type %d\n", bz->type); return 0; } - if (bz->inflate_ret == BZ_STREAM_END && bz->bzstream.next_out == &bz->out[bz->offset]) { return 0; } - if (bz->region->readc == bz->region->length) { - if (bz->inflate_ret != BZ_STREAM_END) { - PGP_ERROR(cbinfo->errors, PGP_E_P_DECOMPRESSION_ERROR, - "Compressed data didn't end when region ended."); - } - } for (cc = 0 ; cc < length ; cc += len) { if (&bz->out[bz->offset] == bz->bzstream.next_out) { int ret; Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.37 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.38 --- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.37 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c Mon Nov 15 08:03:39 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: create.c,v 1.37 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: create.c,v 1.38 2010/11/15 08:03:39 agc Exp $"); #endif #include @@ -285,7 +285,7 @@ pgp_hash_thash; unsigned done = 0; unsigned i = 0; - uint8_t hashed[PGP_SHA1_HASH_SIZE]; + uint8_t *hashed; uint8_t sesskey[CAST_KEY_LENGTH]; if (!write_pubkey_body(&key->pubkey, output)) { @@ -360,15 +360,21 @@ /* RFC4880: section 3.7.1.1 and 3.7.1.2 */ for (done = 0, i = 0; done < CAST_KEY_LENGTH; i++) { + unsigned hashsize; unsigned j; + unsigned needed; + unsigned size; uint8_t zero = 0; - int needed; - int size; + /* Hard-coded SHA1 for session key */ + pgp_hash_any(&hash, PGP_HASH_SHA1); + hashsize = pgp_hash_size(key->hash_alg); needed = CAST_KEY_LENGTH - done; - size = MIN(needed, PGP_SHA1_HASH_SIZE); - - pgp_hash_any(&hash, key->hash_alg); + size = MIN(needed, hashsize); + if ((hashed = calloc(1, hashsize)) == NULL) { +(void) fprintf(stderr, "write_seckey_body: bad alloc\n"); +return 0; + } if (!hash.init(&hash)) { (void) fprintf(stderr, "write_seckey_body: bad alloc\n"); return 0; @@ -396,7 +402,7 @@ * if more in hash than is needed by session key, use * the leftmost octets */ - (void) memcpy(&sesskey[i * PGP_SHA1_HASH_SIZE], + (void) memcpy(&sesskey[i * hashsize], hashed, (unsigned)size); done += (unsigned)size; if (done > CAST_KEY_LENGTH) { @@ -435,13 +441,9 @@ pg
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 11 00:58:05 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: compress.c crypto.h misc.c packet-parse.c packet-parse.h packet.h reader.c validate.c version.h Log Message: Changes to 3.99.15/20101110 + add support for partial blocks, defined in rfc 4880, and used fairly extensively by gnupg where the input size may not be known in advance (e.g. for encrypted compressed data, as produced by default by gpg -e) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c cvs rdiff -u -r1.27 -r1.28 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.38 -r1.39 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c cvs rdiff -u -r1.45 -r1.46 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.14 -r1.15 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.h cvs rdiff -u -r1.28 -r1.29 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h cvs rdiff -u -r1.44 -r1.45 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c \ src/crypto/external/bsd/netpgp/dist/src/lib/version.h cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.19 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.20 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.19 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Thu Nov 11 00:58:04 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.19 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.20 2010/11/11 00:58:04 agc Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -112,7 +112,7 @@ * bzip2_compressed_data_reader */ static int -zlib_compressed_data_reader(void *dest, size_t length, +zlib_compressed_data_reader(pgp_stream_t *stream, void *dest, size_t length, pgp_error_t **errors, pgp_reader_t *readinfo, pgp_cbdata_t *cbinfo) @@ -164,7 +164,7 @@ } else { n = sizeof(z->in); } -if (!pgp_stacked_limited_read(z->in, n, +if (!pgp_stacked_limited_read(stream, z->in, n, z->region, errors, readinfo, cbinfo)) { return -1; @@ -207,7 +207,7 @@ #ifdef HAVE_BZLIB_H /* \todo remove code duplication between this and zlib_compressed_data_reader */ static int -bzip2_compressed_data_reader(void *dest, size_t length, +bzip2_compressed_data_reader(pgp_stream_t *stream, void *dest, size_t length, pgp_error_t **errors, pgp_reader_t *readinfo, pgp_cbdata_t *cbinfo) @@ -249,7 +249,7 @@ } else n = sizeof(bz->in); -if (!pgp_stacked_limited_read( +if (!pgp_stacked_limited_read(stream, (uint8_t *) bz->in, n, bz->region, errors, readinfo, cbinfo)) Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.27 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.28 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.27 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Thu Nov 11 00:58:04 2010 @@ -300,6 +300,12 @@ unsigned reading_v3_secret:1; unsigned reading_mpi_len:1; unsigned exact_read:1; + unsigned partial_read:1; + unsigned coalescing:1; + /* used for partial length coalescing */ + unsigned virtualc; + unsigned virtualoff; + uint8_t *virtualpkt; }; #endif /* CRYPTO_H_ */ Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.38 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.39 --- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.38 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Thu Nov 11 00:58:04 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: misc.c,v 1.38 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.39 2010/11/11 00:58:04 agc Exp $"); #endif #include @@ -1159,7 +1159,7 @@ } static int -sum16_reader(void *dest_, size_t length, pgp_error_t **errors, +sum16_reader(pgp_stream_t *stream, void *dest_, size_t length, pgp_error_t **errors, pgp_reader_t *readinfo, pgp_cbdata_t *cbinfo) { const uint8_t *dest = dest_; @@ -1167,7 +1167,7 @@ int r; int n; - r = pgp_stacked_read(dest_, length, errors, readinfo, cbinfo); + r = pgp_stacked_read(stream, dest_, length, errors, readinfo, cbi
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 11 01:08:26 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet-parse.c Log Message: make this compile on amd64: clean up a debug statement, pointed out by jak To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.46 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.47 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.46 Thu Nov 11 00:58:04 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Thu Nov 11 01:08:26 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.46 2010/11/11 00:58:04 agc Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.47 2010/11/11 01:08:26 agc Exp $"); #endif #include @@ -2935,7 +2935,7 @@ decrypt = pgp_get_decrypt(stream); if (decrypt) { if (pgp_get_debug_level(__FILE__)) { - (void) fprintf(stderr, "pgp_decrypt_se_ip_data: decrypt: num %d, alg %d, blocksize %d, keysize %d\n", decrypt->num, decrypt->alg, decrypt->blocksize, decrypt->keysize); + (void) fprintf(stderr, "pgp_decrypt_se_ip_data: decrypt\n"); } pgp_reader_push_decrypt(stream, decrypt, region); pgp_reader_push_se_ip_data(stream, decrypt, region);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Nov 7 21:41:39 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c ssh2pgp.c Added Files: src/crypto/external/bsd/netpgp/dist/src/lib: ssh2pgp.h Removed Files: src/crypto/external/bsd/netpgp/dist/src/lib: ops-ssh.h Log Message: Rename internal ops-ssh.h header file to ssh2pgp.h to better reflect its use. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.3 -r0 src/crypto/external/bsd/netpgp/dist/src/lib/ops-ssh.h cvs rdiff -u -r1.19 -r1.20 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c cvs rdiff -u -r0 -r1.1 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.81 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.82 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.81 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sun Nov 7 21:41:38 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.81 2010/11/07 08:39:59 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.82 2010/11/07 21:41:38 agc Exp $"); #endif #include @@ -81,7 +81,7 @@ #include "readerwriter.h" #include "netpgpdefs.h" #include "crypto.h" -#include "ops-ssh.h" +#include "ssh2pgp.h" #include "defs.h" /* read any gpg config file */ Index: src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.19 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.20 --- src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.19 Sun Nov 7 21:16:00 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Sun Nov 7 21:41:39 2010 @@ -68,7 +68,7 @@ #include "netpgpsdk.h" #include "crypto.h" #include "netpgpdigest.h" -#include "ops-ssh.h" +#include "ssh2pgp.h" /* structure for earching for constant strings */ typedef struct str_t { Added files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.h diff -u /dev/null src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.h:1.1 --- /dev/null Sun Nov 7 21:41:39 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.h Sun Nov 7 21:41:39 2010 @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alistair Crooks (a...@netbsd.org) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SSH2PGP_H_ +#define SSH2PGP_H_ + +#include "keyring.h" +#include "types.h" + +int pgp_ssh2pubkey(pgp_io_t *, const char *, pgp_key_t *, pgp_hash_alg_t); +int pgp_ssh2seckey(pgp_io_t *, const char *, pgp_key_t *, pgp_pubkey_t *, pgp_hash_alg_t); + +int pgp_ssh2_readkeys(pgp_io_t *, pgp_keyring_t *, pgp_keyring_t *, + const char *, const char *, unsigned); + +#endif
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Nov 7 21:16:00 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: ssh2pgp.c Log Message: Fix a build problem on OpenBSD (we're not the only one who has trouble with their header files, it seems - insight from the tor project mailing list). And just so that the search engines can find it: > In file included from ssh2pgp.c:39: > /usr/include/arpa/inet.h:74: warning: 'struct in_addr' declared inside > parameter list > /usr/include/arpa/inet.h:74: warning: its scope is only this definition or > declaration, which is probably not what you want > /usr/include/arpa/inet.h:75: warning: 'struct in_addr' declared inside > parameter list > *** Error code 1 is fixed by including before - found after a long-distance debug session with Anthony Bentley - thanks! To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.18 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.19 --- src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.18 Sun Nov 7 08:39:59 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c Sun Nov 7 21:16:00 2010 @@ -36,6 +36,8 @@ #include #include +#include + #include #include
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Nov 7 06:56:53 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c crypto.h openssl_crypto.c packet-parse.c Log Message: Add Elgamal decryption to netpgp. Inspired by (BSD-licensed) the Elgamal decryption code from Postgresql by Marko Kreen. % cp config.h f % netpgp -e f netpgp: default key set to "d4a643c5" % netpgp -d < f.gpg > f.netpgp netpgp: default key set to "d4a643c5" signature 1024/DSA 8222c3ecd4a643c5 2010-05-19 [EXPIRES 2013-05-18] Key fingerprint: 3e4a 5df4 033b 2333 219b 1afd 8222 c3ec d4a6 43c5 uid Alistair Crooks (DSA TEST KEY - DO NOT USE) encryption 2048/Elgamal (Encrypt-Only) a97a7db6d727bc1e 2010-05-19 [EXPIRES 2013-05-18] netpgp passphrase: % ls -al f* -rw-r--r-- 1 agc agc 5730 Nov 6 23:53 f -rw--- 1 agc agc 1727 Nov 6 23:53 f.gpg -rw-r--r-- 1 agc agc 5730 Nov 6 23:54 f.netpgp % diff f f.netpgp % This makes DSA keys into first class citizens, since encryption and decryption using DSA/Elgamal is now supported. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c cvs rdiff -u -r1.25 -r1.26 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.31 -r1.32 \ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c cvs rdiff -u -r1.43 -r1.44 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.30 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.31 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.30 Sun Nov 7 02:29:28 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Sun Nov 7 06:56:52 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: crypto.c,v 1.30 2010/11/07 02:29:28 agc Exp $"); +__RCSID("$NetBSD: crypto.c,v 1.31 2010/11/07 06:56:52 agc Exp $"); #endif #include @@ -86,12 +86,14 @@ int __ops_decrypt_decode_mpi(uint8_t *buf, unsigned buflen, +const BIGNUM *g_to_k, const BIGNUM *encmpi, const __ops_seckey_t *seckey) { unsignedmpisize; uint8_t encmpibuf[NETPGP_BUFSIZ]; uint8_t mpibuf[NETPGP_BUFSIZ]; + uint8_t gkbuf[NETPGP_BUFSIZ]; int i; int n; @@ -101,10 +103,9 @@ (void) fprintf(stderr, "mpisize too big %u\n", mpisize); return -1; } - BN_bn2bin(encmpi, encmpibuf); - switch (seckey->pubkey.alg) { case OPS_PKA_RSA: + BN_bn2bin(encmpi, encmpibuf); if (__ops_get_debug_level(__FILE__)) { hexdump(stderr, "encrypted", encmpibuf, 16); } @@ -143,12 +144,13 @@ return n - i; case OPS_PKA_DSA: case OPS_PKA_ELGAMAL: - (void) fprintf(stderr, "XXX - preliminary support for DSA/Elgamal\n"); + (void) BN_bn2bin(g_to_k, gkbuf); + (void) BN_bn2bin(encmpi, encmpibuf); if (__ops_get_debug_level(__FILE__)) { hexdump(stderr, "encrypted", encmpibuf, 16); } - n = __ops_elgamal_private_decrypt(mpibuf, encmpibuf, - (unsigned)(BN_num_bits(encmpi) + 7) / 8, + n = __ops_elgamal_private_decrypt(mpibuf, gkbuf, encmpibuf, + (unsigned)BN_num_bytes(encmpi), &seckey->key.elgamal, &seckey->pubkey.key.elgamal); if (n == -1) { (void) fprintf(stderr, "ops_elgamal_private_decrypt failure\n"); @@ -161,13 +163,15 @@ return -1; } /* Decode EME-PKCS1_V1_5 (RFC 2437). */ - if (mpibuf[0] != 0 || mpibuf[1] != 2) { + if (mpibuf[0] != 2) { + fprintf(stderr, "mpibuf mismatch\n"); return -1; } /* Skip the random bytes. */ - for (i = 2; i < n && mpibuf[i]; ++i) { + for (i = 1; i < n && mpibuf[i]; ++i) { } if (i == n || i < 10) { + fprintf(stderr, "175 n %d\n", n); return -1; } /* Skip the zero */ Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.25 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.26 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.25 Sun Nov 7 02:29:28 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Sun Nov 7 06:56:52 2010 @@ -131,7 +131,7 @@ int __ops_elgamal_public_encrypt(uint8_t *, uint8_t *, const uint8_t *, size_t, const __ops_elgamal_pubkey_t *); -int __ops_elgamal_private_decrypt(uint8_t *, const uint8_t *, size_t, +int __ops_elgamal_private_decrypt(uint8_t *, const uint8_t *, const uint8_t *, size_t, const __ops_elgamal_seckey_t *, const __ops_elgamal_pubkey_t *); __ops_symm_alg_t __ops_str_to_cipher(const char *); @@ -159,7 +159,8 @@ void __ops_reader_pop_hash(__ops_stream_t *); int __ops_decrypt_decode_mpi(uint8_t *, unsigned, const BIGNUM *, - const __ops_seckey_t *); + cons
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Nov 7 02:29:28 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: config.h.in create.c crypto.c crypto.h openssl_crypto.c Log Message: Add the ability to perform Elgamal encryption to netpgp. Some of this code is inspired by the (BSD-licensed) Elgamal crypto code in Postgresql by Marko Kreen, but netpgp uses BIGNUM numbers instead of MPIs, and its keys have a completely different structure, so much has changed. % cp config.h f % netpgp -e f netpgp: default key set to "d4a643c5" % gpg -d f.gpg > f2 You need a passphrase to unlock the secret key for user: "Alistair Crooks (DSA TEST KEY - DO NOT USE) " 2048-bit ELG-E key, ID D727BC1E, created 2010-05-19 (main key ID D4A643C5) gpg: encrypted with 2048-bit ELG-E key, ID D727BC1E, created 2010-05-19 "Alistair Crooks (DSA TEST KEY - DO NOT USE) " % diff f f2 % ls -al f* -rw-r--r-- 1 agc agc 5730 Nov 6 05:40 f -rw--- 1 agc agc 1727 Nov 6 05:40 f.gpg -rw-r--r-- 1 agc agc 5730 Nov 6 05:41 f2 % To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 \ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in cvs rdiff -u -r1.35 -r1.36 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.c cvs rdiff -u -r1.29 -r1.30 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c cvs rdiff -u -r1.24 -r1.25 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.30 -r1.31 \ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.14 src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.15 --- src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.14 Fri Nov 5 03:37:18 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in Sun Nov 7 02:29:28 2010 @@ -12,9 +12,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -/* Define to 1 if you have the header file. */ -#undef HAVE_DMALLOC_H - /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.35 Thu Nov 4 15:38:45 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c Sun Nov 7 02:29:28 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: create.c,v 1.35 2010/11/04 15:38:45 agc Exp $"); +__RCSID("$NetBSD: create.c,v 1.36 2010/11/07 02:29:28 agc Exp $"); #endif #include @@ -881,41 +881,39 @@ /* implementation of EME-PKCS1-v1_5-ENCODE, as defined in OpenPGP RFC */ switch (pubkey->alg) { case OPS_PKA_RSA: + k = (unsigned)BN_num_bytes(pubkey->key.rsa.n); + if (mLen > k - 11) { + (void) fprintf(stderr, "encode_m_buf: message too long\n"); + return 0; + } break; case OPS_PKA_DSA: case OPS_PKA_ELGAMAL: - (void) fprintf(stderr, "encode_m_buf: DSA/Elgamal encryption not implemented yet\n"); + k = (unsigned)BN_num_bytes(pubkey->key.elgamal.p); + if (mLen > k - 11) { + (void) fprintf(stderr, "encode_m_buf: message too long\n"); + return 0; + } break; default: (void) fprintf(stderr, "encode_m_buf: pubkey algorithm\n"); return 0; } - - k = (unsigned)BN_num_bytes(pubkey->key.rsa.n); - if (mLen > k - 11) { - (void) fprintf(stderr, "encode_m_buf: message too long\n"); - return 0; - } /* these two bytes defined by RFC */ EM[0] = 0x00; EM[1] = 0x02; - /* add non-zero random bytes of length k - mLen -3 */ for (i = 2; i < (k - mLen) - 1; ++i) { do { __ops_random(EM + i, 1); } while (EM[i] == 0); } - if (i < 8 + 2) { (void) fprintf(stderr, "encode_m_buf: bad i len\n"); return 0; } - EM[i++] = 0; - (void) memcpy(EM + i, M, mLen); - if (__ops_get_debug_level(__FILE__)) { hexdump(stderr, "Encoded Message:", EM, mLen); } @@ -967,7 +965,18 @@ "__ops_create_pk_sesskey: can't allocate\n"); return NULL; } - sz_encoded_m_buf = BN_num_bytes(pubkey->key.rsa.n); + switch(pubkey->alg) { + case OPS_PKA_RSA: + sz_encoded_m_buf = BN_num_bytes(pubkey->key.rsa.n); + break; + case OPS_PKA_DSA: + case OPS_PKA_ELGAMAL: + sz_encoded_m_buf = BN_num_bytes(pubkey->key.elgamal.p); + break; + default: + sz_encoded_m_buf = 0; + break; + } if ((encoded_m_buf = calloc(1, sz_encoded_m_buf)) == NULL) { (void) fprintf(stderr, "__ops_create_pk_sesskey: can't allocate\n"); @@ -993,7 +1002,7 @@ (void) memcpy(sesskey->key_id, id, sizeof(sesskey->key_id)); if (__ops_get_debug_level(__FILE__)) { - hexdump(stderr, "Encrypting for RSA keyid
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Nov 5 03:01:57 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: Makefile.am Makefile.in config.h.in Log Message: Find the libmj header file in the correct directory To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in cvs rdiff -u -r1.12 -r1.13 \ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.6 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.7 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.6 Sat Aug 7 04:25:19 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am Fri Nov 5 03:01:57 2010 @@ -1,10 +1,10 @@ -## $NetBSD: Makefile.am,v 1.6 2010/08/07 04:25:19 agc Exp $ +## $NetBSD: Makefile.am,v 1.7 2010/11/05 03:01:57 agc Exp $ AM_CFLAGS = $(WARNCFLAGS) lib_LTLIBRARIES = libnetpgp.la -libnetpgp_la_CPPFLAGS = -I$(top_srcdir)/include +libnetpgp_la_CPPFLAGS = -I$(top_srcdir)/include -I../libmj libnetpgp_la_SOURCES = \ bufgap.c \ @@ -26,6 +26,8 @@ validate.c \ writer.c +LDADD = ../libmj/libmj.a + man3_MANS = libnetpgp.3 dist_man_MANS = libnetpgp.3 Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.10 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.11 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.10 Thu Nov 4 15:38:45 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Fri Nov 5 03:01:57 2010 @@ -98,43 +98,40 @@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -FGREP = @FGREP@ +F77 = @F77@ +FFLAGS = @FFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -155,7 +152,8 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -186,7 +184,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -204,7 +201,7 @@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(WARNCFLAGS) lib_LTLIBRARIES = libnetpgp.la -libnetpgp_la_CPPFLAGS = -I$(top_srcdir)/include +libnetpgp_la_CPPFLAGS = -I$(top_srcdir)/include -I../libmj libnetpgp_la_SOURCES = \ bufgap.c \ compress.c \ @@ -225,6 +222,7 @@ validate.c \ writer.c +LDADD = ../libmj/libmj.a man3_MANS = libnetpgp.3 dist_man_MANS = libnetpgp.3 all: config.h Index: src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.12 src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.13 --- src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in:1.12 Thu Nov 4 15:38:45 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in Fri Nov 5 03:01:57 2010 @@ -117,10 +117,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - /* Name of package */ #undef PACKAGE
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 16:24:22 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: validate.c Log Message: Apply the patch from Peter Pentchev in PR 44041 ``When netpgp thinks (even for a little while, even if it should change its mind almost immediately) that it's processing a detached signature, it sends a message to that effect to io->outs. This kind of interferes with "netpgp --cat" :)'' Use io->errs instead of io->outs for the informational message. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/validate.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.40 src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.41 --- src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.40 Thu Nov 4 16:13:35 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Thu Nov 4 16:24:22 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: validate.c,v 1.40 2010/11/04 16:13:35 agc Exp $"); +__RCSID("$NetBSD: validate.c,v 1.41 2010/11/04 16:24:22 agc Exp $"); #endif #include @@ -508,7 +508,7 @@ data->detachname) { /* check we have seen some data */ /* if not, need to read from detached name */ -(void) fprintf(io->outs, +(void) fprintf(io->errs, "netpgp: assuming signed data in \"%s\"\n", data->detachname); data->mem = __ops_memory_new();
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 16:13:35 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c validate.c Log Message: Apply patch from Peter Pentchev in PR 44040 The patch fixes two problems when verifying a clearsigned message: - a copy/paste error - "litdata" should be "cleartext" - a use of an uninitialized variable, resulting in freeing an uninitialized pointer on the stack... resulting in a segfault To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c cvs rdiff -u -r1.39 -r1.40 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.42 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.43 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.42 Sun Aug 15 16:36:24 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Thu Nov 4 16:13:35 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.42 2010/08/15 16:36:24 agc Exp $"); +__RCSID("$NetBSD: reader.c,v 1.43 2010/11/04 16:13:35 agc Exp $"); #endif #include @@ -681,8 +681,8 @@ "process_dash_escaped: bad body length\n"); return -1; } - /* don't send that one character, because it's part of the trailer */ + (void) memset(&content2, 0x0, sizeof(content2)); CALLBACK(OPS_PTAG_CT_SIGNED_CLEARTEXT_TRAILER, cbinfo, &content2); return total; } Index: src/crypto/external/bsd/netpgp/dist/src/lib/validate.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.39 src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.40 --- src/crypto/external/bsd/netpgp/dist/src/lib/validate.c:1.39 Sun Aug 15 16:36:24 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c Thu Nov 4 16:13:35 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: validate.c,v 1.39 2010/08/15 16:36:24 agc Exp $"); +__RCSID("$NetBSD: validate.c,v 1.40 2010/11/04 16:13:35 agc Exp $"); #endif #include @@ -461,8 +461,8 @@ case OPS_PTAG_CT_SIGNED_CLEARTEXT_BODY: data->data.cleartext_body = content->cleartext_body; data->type = SIGNED_CLEARTEXT; - __ops_memory_add(data->mem, data->data.litdata_body.data, - data->data.litdata_body.length); + __ops_memory_add(data->mem, data->data.cleartext_body.data, + data->data.cleartext_body.length); return OPS_KEEP_MEMORY; case OPS_PTAG_CT_SIGNED_CLEARTEXT_TRAILER:
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 15:38:45 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: Makefile.in config.h.in create.c create.h crypto.c crypto.h netpgp.c packet-parse.c readerwriter.h symmetric.c writer.c writer.h Log Message: allow user-specification of cipher to be used when encrypting packets. preserve the CAST5 default for now. at the user level, this is specified using the --cipher= option. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.h cvs rdiff -u -r1.11 -r1.12 \ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in \ src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h cvs rdiff -u -r1.34 -r1.35 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.c cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.h cvs rdiff -u -r1.28 -r1.29 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c cvs rdiff -u -r1.23 -r1.24 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.79 -r1.80 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.15 -r1.16 \ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.9 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.10 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.9 Sat Aug 7 04:16:40 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Thu Nov 4 15:38:45 2010 @@ -57,12 +57,12 @@ libnetpgp_la-compress.lo libnetpgp_la-create.lo \ libnetpgp_la-crypto.lo libnetpgp_la-fastctype.lo \ libnetpgp_la-keyring.lo libnetpgp_la-misc.lo \ - libnetpgp_la-mj.lo libnetpgp_la-netpgp.lo \ - libnetpgp_la-openssl_crypto.lo libnetpgp_la-packet-parse.lo \ - libnetpgp_la-packet-print.lo libnetpgp_la-packet-show.lo \ - libnetpgp_la-reader.lo libnetpgp_la-signature.lo \ - libnetpgp_la-ssh2pgp.lo libnetpgp_la-symmetric.lo \ - libnetpgp_la-validate.lo libnetpgp_la-writer.lo + libnetpgp_la-netpgp.lo libnetpgp_la-openssl_crypto.lo \ + libnetpgp_la-packet-parse.lo libnetpgp_la-packet-print.lo \ + libnetpgp_la-packet-show.lo libnetpgp_la-reader.lo \ + libnetpgp_la-signature.lo libnetpgp_la-ssh2pgp.lo \ + libnetpgp_la-symmetric.lo libnetpgp_la-validate.lo \ + libnetpgp_la-writer.lo libnetpgp_la_OBJECTS = $(am_libnetpgp_la_OBJECTS) DEFAULT_INCLUDES = -...@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/buildaux/depcomp @@ -213,7 +213,6 @@ fastctype.c \ keyring.c \ misc.c \ - mj.c \ netpgp.c \ openssl_crypto.c \ packet-parse.c \ @@ -322,7 +321,6 @@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-fastctype@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-keyring@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-misc@am__quote@ -...@amdep_true@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-mj@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-netpgp@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-openssl_crypto@am__quote@ @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/libnetpgp_la-packet-parse@am__quote@ @@ -405,13 +403,6 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c -libnetpgp_la-mj.lo: mj.c -...@am__fastdepcc_true@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetpgp_la-mj.lo -MD -MP -MF $(DEPDIR)/libnetpgp_la-mj.Tpo -c -o libnetpgp_la-mj.lo `test -f 'mj.c' || echo '$(srcdir)/'`mj.c -...@am__fastdepcc_true@ mv -f $(DEPDIR)/libnetpgp_la-mj.Tpo $(DEPDIR)/libnetpgp_la-mj.Plo -...@amdep_true@@am__fastdepCC_FALSE@ source='mj.c' object='libnetpgp_la-mj.lo' libtool=yes @AMDEPBACKSLASH@ -...@amdep_true@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -...@am__fastdepcc_false@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-mj.lo `test -f 'mj.c' || echo '$(s
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 07:35:09 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: symmetric.c Log Message: Only include camellia cipher if openssl supports it To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 \ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.14 src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.15 --- src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.14 Thu Nov 4 07:03:41 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Thu Nov 4 07:35:08 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: symmetric.c,v 1.14 2010/11/04 07:03:41 agc Exp $"); +__RCSID("$NetBSD: symmetric.c,v 1.15 2010/11/04 07:35:08 agc Exp $"); #endif #include "crypto.h" @@ -486,6 +486,7 @@ TRAILER }; +#ifndef OPENSSL_NO_CAMELLIA /* Camellia with 128-bit key (CAMELLIA) */ #define KEYBITS_CAMELLIA128 128 @@ -607,6 +608,7 @@ std_finish, TRAILER }; +#endif static const __ops_crypt_t * @@ -623,10 +625,12 @@ return &aes128; case OPS_SA_AES_256: return &aes256; +#ifndef OPENSSL_NO_CAMELLIA case OPS_SA_CAMELLIA_128: return &camellia128; case OPS_SA_CAMELLIA_256: return &camellia256; +#endif case OPS_SA_TRIPLEDES: return &tripledes; default:
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 07:03:41 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: symmetric.c Log Message: autoconf guard for To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.13 src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.14 --- src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.13 Thu Nov 4 06:45:28 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Thu Nov 4 07:03:41 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: symmetric.c,v 1.13 2010/11/04 06:45:28 agc Exp $"); +__RCSID("$NetBSD: symmetric.c,v 1.14 2010/11/04 07:03:41 agc Exp $"); #endif #include "crypto.h" @@ -78,7 +78,9 @@ #include #endif +#ifdef HAVE_OPENSSL_CAMELLIA_H #include +#endif #include "crypto.h" #include "netpgpdefs.h"
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 06:45:28 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.h misc.c netpgp.c openssl_crypto.c packet-show.c packet.h symmetric.c version.h Log Message: Update to version 3.99.13: + add ability in netpgpkeys(1) to specify the cipher (symmetric algorithm) as specified in RFC 5581 + add the camellia cipher implementation from openssl To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.36 -r1.37 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c cvs rdiff -u -r1.78 -r1.79 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.29 -r1.30 \ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c cvs rdiff -u -r1.17 -r1.18 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c cvs rdiff -u -r1.26 -r1.27 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h cvs rdiff -u -r1.12 -r1.13 \ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.23 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.22 Thu Nov 4 01:18:34 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Thu Nov 4 06:45:28 2010 @@ -132,6 +132,7 @@ int __ops_elgamal_private_decrypt(uint8_t *, const uint8_t *, size_t, const __ops_elgamal_seckey_t *, const __ops_elgamal_pubkey_t *); +__ops_symm_alg_t __ops_str_to_cipher(const char *); unsigned __ops_block_size(__ops_symm_alg_t); unsigned __ops_key_size(__ops_symm_alg_t); @@ -199,7 +200,8 @@ /* Keys */ __ops_key_t *__ops_rsa_new_selfsign_key(const int, - const unsigned long, uint8_t *, const char *); + const unsigned long, uint8_t *, const char *, + const char *); int __ops_dsa_size(const __ops_dsa_pubkey_t *); DSA_SIG *__ops_dsa_sign(uint8_t *, unsigned, Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.36 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.37 --- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.36 Sun Aug 15 16:36:24 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Thu Nov 4 06:45:28 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: misc.c,v 1.36 2010/08/15 16:36:24 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.37 2010/11/04 06:45:28 agc Exp $"); #endif #include @@ -793,6 +793,37 @@ } } +/* structure to map string to cipher def */ +typedef struct str2cipher_t { + const char *s; /* cipher name */ + __ops_symm_alg_t i; /* cipher def */ +} str2cipher_t; + +static str2cipher_t str2cipher[] = { + { "cast5", OPS_SA_CAST5 }, + { "idea", OPS_SA_IDEA }, + { "aes128", OPS_SA_AES_128 }, + { "aes256", OPS_SA_AES_256 }, + { "camellia128", OPS_SA_CAMELLIA_128 }, + { "camellia256", OPS_SA_CAMELLIA_256 }, + { "tripledes", OPS_SA_TRIPLEDES }, + { NULL, 0 } +}; + +/* convert from a string to a cipher definition */ +__ops_symm_alg_t +__ops_str_to_cipher(const char *cipher) +{ + str2cipher_t *sp; + + for (sp = str2cipher ; cipher && sp->s ; sp++) { + if (netpgp_strcasecmp(cipher, sp->s) == 0) { + return sp->i; + } + } + return OPS_SA_DEFAULT_CIPHER; +} + void __ops_random(void *dest, size_t length) { Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.78 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.79 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.78 Sun Oct 31 19:45:53 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu Nov 4 06:45:28 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.78 2010/10/31 19:45:53 stacktic Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.79 2010/11/04 06:45:28 agc Exp $"); #endif #include @@ -1108,10 +1108,13 @@ if (id) { (void) snprintf(newid, sizeof(newid), "%s", id); } else { - (void) snprintf(newid, sizeof(newid), "RSA %d-bit key <%...@localhost>", numbits, getenv("LOGNAME")); + (void) snprintf(newid, sizeof(newid), + "RSA %d-bit key <%...@localhost>", numbits, getenv("LOGNAME")); } uid = (uint8_t *)newid; - key = __ops_rsa_new_selfsign_key(numbits, 65537UL, uid, netpgp_getvar(netpgp, "hash")); + key = __ops_rsa_new_selfsign_key(numbits, 65537UL, uid, + netpgp_getvar(netpgp, "hash"), + netpgp_getvar(netpgp, "cipher")); if (k
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Nov 4 01:18:35 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.h symmetric.c Log Message: check return values from memory allocation routines in symmetric key initialisation. return an error if allocation failed. modify symmetric key initialisation function signature to return an indication of success or failure. get rid of one-time typedef for function definitions; their indirection does not add any extra insight, and just obfuscates the declarations. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h cvs rdiff -u -r1.11 -r1.12 \ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.21 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.22 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.21 Wed Sep 8 03:21:22 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Thu Nov 4 01:18:34 2010 @@ -62,58 +62,42 @@ #define OPS_MIN_HASH_SIZE 16 -typedef int __ops_hash_init_t(__ops_hash_t *); -typedef void __ops_hash_add_t(__ops_hash_t *, const uint8_t *, unsigned); -typedef unsigned __ops_hash_finish_t(__ops_hash_t *, uint8_t *); - /** _ops_hash_t */ struct _ops_hash_t { __ops_hash_alg_t alg; /* algorithm */ size_t size; /* size */ const char *name; /* what it's known as */ - __ops_hash_init_t *init; /* initialisation func */ - __ops_hash_add_t *add; /* add text func */ - __ops_hash_finish_t *finish; /* finalise func */ + int (*init)(__ops_hash_t *); + void (*add)(__ops_hash_t *, const uint8_t *, unsigned); + unsigned (*finish)(__ops_hash_t *, uint8_t *); void *data; /* blob for data */ }; -typedef void __ops_setiv_func_t(__ops_crypt_t *, const uint8_t *); -typedef void __ops_setkey_func_t(__ops_crypt_t *, const uint8_t *); -typedef void __ops_crypt_init_t(__ops_crypt_t *); -typedef void __ops_crypt_resync_t(__ops_crypt_t *); -typedef void __ops_blkenc_t(__ops_crypt_t *, void *, const void *); -typedef void __ops_blkdec_t(__ops_crypt_t *, void *, const void *); -typedef void __ops_crypt_cfb_encrypt_t(__ops_crypt_t *, void *, const void *, - size_t); -typedef void __ops_crypt_cfb_decrypt_t(__ops_crypt_t *, void *, const void *, - size_t); -typedef void __ops_crypt_finish_t(__ops_crypt_t *); - /** _ops_crypt_t */ struct _ops_crypt_t { - __ops_symm_alg_t alg; - size_tblocksize; - size_tkeysize; - __ops_setiv_func_t *set_iv; - __ops_setkey_func_t *set_crypt_key; - __ops_crypt_init_t *base_init; - __ops_crypt_resync_t *decrypt_resync; - /* encrypt/decrypt one block */ - __ops_blkenc_t *block_encrypt; - __ops_blkdec_t *block_decrypt; + __ops_symm_alg_t alg; + size_t blocksize; + size_t keysize; + void (*set_iv)(__ops_crypt_t *, const uint8_t *); + void (*set_crypt_key)(__ops_crypt_t *, const uint8_t *); + int (*base_init)(__ops_crypt_t *); + void (*decrypt_resync)(__ops_crypt_t *); + /* encrypt/decrypt one block */ + void (*block_encrypt)(__ops_crypt_t *, void *, const void *); + void (*block_decrypt)(__ops_crypt_t *, void *, const void *); /* Standard CFB encrypt/decrypt (as used by Sym Enc Int Prot packets) */ - __ops_crypt_cfb_encrypt_t *cfb_encrypt; - __ops_crypt_cfb_decrypt_t *cfb_decrypt; - __ops_crypt_finish_t *decrypt_finish; - uint8_tiv[OPS_MAX_BLOCK_SIZE]; - uint8_tciv[OPS_MAX_BLOCK_SIZE]; - uint8_tsiv[OPS_MAX_BLOCK_SIZE]; + void (*cfb_encrypt)(__ops_crypt_t *, void *, const void *, size_t); + void (*cfb_decrypt)(__ops_crypt_t *, void *, const void *, size_t); + void (*decrypt_finish)(__ops_crypt_t *); + uint8_t iv[OPS_MAX_BLOCK_SIZE]; + uint8_t civ[OPS_MAX_BLOCK_SIZE]; + uint8_t siv[OPS_MAX_BLOCK_SIZE]; /* siv is needed for weird v3 resync */ - uint8_tkey[OPS_MAX_KEY_SIZE]; - intnum; + uint8_t key[OPS_MAX_KEY_SIZE]; + int num; /* num is offset - see openssl _encrypt doco */ - void*encrypt_key; - void*decrypt_key; + void *encrypt_key; + void *decrypt_key; }; void __ops_crypto_finish(void); Index: src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.11 src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.12 --- src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.11 Sun Aug 15 07:52:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c Thu Nov 4 01:18:34 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: symmetric.c,v 1.11 2010/08/15 07:52:27 agc Exp $"); +__RCSID("$NetBSD: symmetric.c,v 1.12 2010/11/04 01:18:34 agc Exp $");
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Nov 3 02:27:56 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet-print.c Log Message: Don't call exit(3) from library context - brought in with the initial import, so pink (rather than red) face here. Pointed out by Peter Pentchev in PR 44027. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.37 src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.38 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.37 Sun Aug 15 07:52:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Wed Nov 3 02:27:56 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-print.c,v 1.37 2010/08/15 07:52:27 agc Exp $"); +__RCSID("$NetBSD: packet-print.c,v 1.38 2010/11/03 02:27:56 agc Exp $"); #endif #include @@ -1406,7 +1406,7 @@ print_tagname(print->indent, "UNKNOWN PACKET TYPE"); fprintf(stderr, "__ops_print_packet: unknown tag=%d (0x%x)\n", pkt->tag, pkt->tag); - exit(EXIT_FAILURE); + return 0; } return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: stacktic Date: Sun Oct 31 19:45:53 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c netpgp.c Log Message: PR/42435 : Check pointers against NULL to avoid dereferencing them To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.77 -r1.78 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.46 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.47 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.46 Wed Sep 1 17:25:57 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sun Oct 31 19:45:53 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.46 2010/09/01 17:25:57 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.47 2010/10/31 19:45:53 stacktic Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -902,7 +902,7 @@ uint8_t keyid[OPS_KEY_ID_SIZE + 1]; size_t len; - if (!keyring) { + if (!keyring || !name || !from) { return NULL; } len = strlen(name); Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.77 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.78 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.77 Tue Oct 19 00:00:00 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sun Oct 31 19:45:53 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.77 2010/10/19 00:00:00 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.78 2010/10/31 19:45:53 stacktic Exp $"); #endif #include @@ -423,6 +423,8 @@ if (userid == NULL) { userid = netpgp_getvar(netpgp, "userid"); + if (userid == NULL) + return NULL; } else if (userid[0] == '0' && userid[1] == 'x') { userid += 2; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Oct 31 18:31:03 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: compress.c Log Message: Make bz2 {de,}compression dependent on the header file being available. Fixes an error reported by Anthony Bentley when compiling on OpenBSD, which apparently lacks bzlib.h (and bz2). Tests run to completion successfully both with and without bz2 being available. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.17 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.18 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.17 Sun Aug 15 16:10:56 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Sun Oct 31 18:31:03 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.17 2010/08/15 16:10:56 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.18 2010/10/31 18:31:03 agc Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -89,6 +89,7 @@ int inflate_ret; } z_decompress_t; +#ifdef HAVE_BZLIB_H typedef struct { __ops_compression_type_t type; __ops_region_t *region; @@ -98,6 +99,7 @@ size_t offset; int inflate_ret; } bz_decompress_t; +#endif typedef struct { z_streamstream; @@ -202,6 +204,7 @@ return (int)length; } +#ifdef HAVE_BZLIB_H /* \todo remove code duplication between this and zlib_compressed_data_reader */ static int bzip2_compressed_data_reader(void *dest, size_t length, @@ -285,6 +288,7 @@ return (int)length; } +#endif /** * \ingroup Core_Compress @@ -299,7 +303,9 @@ __ops_compression_type_t type) { z_decompress_t z; +#ifdef HAVE_BZLIB_H bz_decompress_t bz; +#endif const int printerrors = 1; int ret; @@ -321,6 +327,7 @@ break; +#ifdef HAVE_BZLIB_H case OPS_C_BZIP2: (void) memset(&bz, 0x0, sizeof(bz)); @@ -334,6 +341,7 @@ bz.bzstream.bzalloc = NULL; bz.bzstream.bzfree = NULL; bz.bzstream.opaque = NULL; +#endif break; @@ -355,9 +363,11 @@ ret = (int)inflateInit(&z.zstream); break; +#ifdef HAVE_BZLIB_H case OPS_C_BZIP2: ret = BZ2_bzDecompressInit(&bz.bzstream, 1, 0); break; +#endif default: OPS_ERROR_1(&stream->errors, @@ -379,6 +389,7 @@ NULL, &z); break; +#ifdef HAVE_BZLIB_H case OPS_C_BZIP2: if (ret != BZ_OK) { OPS_ERROR_1(&stream->errors, @@ -389,6 +400,7 @@ __ops_reader_push(stream, bzip2_compressed_data_reader, NULL, &bz); break; +#endif default: OPS_ERROR_1(&stream->errors,
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Oct 19 00:00:01 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: 2 minor changes: + when writing out the key as an ssh key, don't include the user id information at the end, in-line with expectations about standard ssh key formats + since the signing key changed its "menu line" entry from "pub" to "signature", the offset of the key id moved 7 chars to the right, so take this into consideration when generating new keys To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.76 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.77 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.76 Fri Sep 10 20:14:19 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Oct 19 00:00:00 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.76 2010/09/10 20:14:19 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.77 2010/10/19 00:00:00 agc Exp $"); #endif #include @@ -1118,7 +1118,7 @@ __ops_sprint_keydata(netpgp->io, NULL, key, &cp, "signature ", &key->key.seckey.pubkey, 0); (void) fprintf(stdout, "%s", cp); /* write public key */ - (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[31]); + (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[38]); if (mkdir(dir, 0700) < 0) { (void) fprintf(io->errs, "can't mkdir '%s'\n", dir); return 0; @@ -1795,7 +1795,6 @@ cc = formatstring((char *)out, (const uint8_t *)"ssh-rsa", 7); cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.e); cc += formatbignum((char *)&out[cc], key->key.pubkey.key.rsa.n); - cc += snprintf(&out[cc], size - cc, " %s", key->uids[0]); free(io); free(keyring); return cc;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Sep 10 20:14:19 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Allow the user specification of the secret key file as the --sshkeyfile or -S argument, and check that the public key file exists before trying to read it. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.75 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.76 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.75 Wed Sep 8 03:21:22 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri Sep 10 20:14:19 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.75 2010/09/08 03:21:22 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.76 2010/09/10 20:14:19 agc Exp $"); #endif #include @@ -256,20 +256,25 @@ { __ops_keyring_t *pubring; __ops_keyring_t *secring; + struct stat st; unsigned hashtype; char *hash; char f[MAXPATHLEN]; char *filename; if ((filename = netpgp_getvar(netpgp, "sshkeyfile")) == NULL) { + /* set reasonable default for RSA key */ (void) snprintf(f, sizeof(f), "%s/id_rsa.pub", homedir); filename = f; - } else { + } else if (strcmp(&filename[strlen(filename) - 4], ".pub") != 0) { /* got ssh keys, check for pub file name */ - if (strcmp(&filename[strlen(filename) - 4], ".pub") != 0) { - (void) fprintf(stderr, "readsshkeys: bad pubkey filename '%s'\n", filename); - return 0; - } + (void) snprintf(f, sizeof(f), "%s.pub", filename); + filename = f; + } + /* check the pub file exists */ + if (stat(filename, &st) != 0) { + (void) fprintf(stderr, "readsshkeys: bad pubkey filename '%s'\n", filename); + return 0; } if ((pubring = calloc(1, sizeof(*pubring))) == NULL) { (void) fprintf(stderr, "readsshkeys: bad alloc\n");
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Sep 7 00:25:37 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: openssl_crypto.c Log Message: clarification comment as to why two of the bignums are reversed To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 \ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c:1.27 src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c:1.28 --- src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c:1.27 Sun Aug 15 07:52:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c Tue Sep 7 00:25:37 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: openssl_crypto.c,v 1.27 2010/08/15 07:52:27 agc Exp $"); +__RCSID("$NetBSD: openssl_crypto.c,v 1.28 2010/09/07 00:25:37 agc Exp $"); #endif #ifdef HAVE_OPENSSL_DSA_H @@ -524,7 +524,7 @@ orsa = RSA_new(); orsa->n = BN_dup(pubkey->n); orsa->d = seckey->d; - orsa->p = seckey->q; + orsa->p = seckey->q; /* p and q are round the other way in openssl */ orsa->q = seckey->p; /* debug */
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Sep 2 07:31:16 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: If we get passed a key which has no subuids, sigs, fingerprint or any other data, and has been revoked, don't even attempt to print it out. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.72 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.73 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.72 Thu Sep 2 06:00:12 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu Sep 2 07:31:16 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.72 2010/09/02 06:00:12 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.73 2010/09/02 07:31:16 agc Exp $"); #endif #include @@ -564,6 +564,11 @@ (void) fprintf(stderr, "formatobj: json is '%s'\n", s); free(s); } + if (obj->c == 2 && obj->value.v[1].type == MJ_STRING && + strcmp(obj->value.v[1].value.s, "[REVOKED]") == 0) { + /* whole key has been rovoked - just return */ + return; + } pobj(fp, &obj->value.v[mj_object_find(obj, "header", 0, 2) + 1], 0); p(fp, " ", NULL); pobj(fp, &obj->value.v[mj_object_find(obj, "key bits", 0, 2) + 1], 0);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Sep 1 19:46:15 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: version.h Log Message: Bump version number for latest changes To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 \ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/version.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.39 src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.40 --- src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.39 Fri Aug 13 18:29:41 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Wed Sep 1 19:46:14 2010 @@ -58,7 +58,7 @@ #endif /* development versions have .99 suffix */ -#define NETPGP_BASE_VERSION "3.99.9" +#define NETPGP_BASE_VERSION "3.99.10" #define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]" #define NETPGP_VERSION_STRING \
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Sep 1 06:20:23 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c netpgp.c Log Message: Denote the signing key with the word "signature" (the encryption key already has the tag "encryption"). This is a bit more meaningful than "pub" and "sub". To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.69 -r1.70 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.44 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.45 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.44 Sat Aug 21 19:00:43 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Wed Sep 1 06:20:23 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.44 2010/08/21 19:00:43 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.45 2010/09/01 06:20:23 agc Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -998,7 +998,7 @@ __ops_print_keydata(io, keyring, key, "sec", &key->key.seckey.pubkey, 0); } else { - __ops_print_keydata(io, keyring, key, "pub", &key->key.pubkey, psigs); + __ops_print_keydata(io, keyring, key, "signature ", &key->key.pubkey, psigs); } (void) fputc('\n', io->res); } Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.69 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.70 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.69 Sun Aug 15 16:10:56 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Sep 1 06:20:23 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.69 2010/08/15 16:10:56 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.70 2010/09/01 06:20:23 agc Exp $"); #endif #include @@ -170,7 +170,7 @@ "WARNING: signature for %s made with encryption key\n", (f) ? f : ""); } - __ops_print_keydata(io, ring, key, "pub", &key->key.pubkey, 0); + __ops_print_keydata(io, ring, key, "signature ", &key->key.pubkey, 0); } } @@ -691,7 +691,7 @@ } else { __ops_sprint_keydata(netpgp->io, netpgp->pubring, key, &pubs.v[pubs.c], - "pub", + "signature ", &key->key.pubkey, psigs); } if (pubs.v[pubs.c] != NULL) { @@ -819,7 +819,7 @@ netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL; } return (__ops_sprint_keydata(netpgp->io, netpgp->pubring, -key, &newkey, "pub", +key, &newkey, "signature", &key->key.pubkey, netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL; } @@ -889,7 +889,7 @@ return 0; } cp = NULL; - __ops_sprint_keydata(netpgp->io, NULL, key, &cp, "pub", &key->key.seckey.pubkey, 0); + __ops_sprint_keydata(netpgp->io, NULL, key, &cp, "signature ", &key->key.seckey.pubkey, 0); (void) fprintf(stdout, "%s", cp); /* write public key */ (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[31]); @@ -1137,10 +1137,11 @@ if (pubkey == NULL) { (void) fprintf(io->errs, "netpgp: warning - using pubkey from secring\n"); -__ops_print_keydata(io, netpgp->pubring, keypair, "pub", +__ops_print_keydata(io, netpgp->pubring, keypair, "signature ", &keypair->key.seckey.pubkey, 0); } else { -__ops_print_keydata(io, netpgp->pubring, pubkey, "pub", &pubkey->key.pubkey, 0); +__ops_print_keydata(io, netpgp->pubring, pubkey, "signature ", + &pubkey->key.pubkey, 0); } } /* now decrypt key */ @@ -1480,58 +1481,3 @@ return (int)__ops_validate_all_sigs(&result, netpgp->pubring, NULL); } - -#if 0 -#include "sshkey.h" - -int -netpgp_pgpkey_to_sshkey(netpgp_t *netpgp, char *name, SSHKey *sshkey) -{ - const __ops_key_t *pgpkey; - unsigned k; - - k = 0; - pgpkey = __ops_getnextkeybyname(netpgp->io, netpgp->pubring, name, &k); - if (pgpkey == NULL) { - pgpkey = __ops_getkeybyname(io, netpgp->pubring, userid); - } - if (pgpkey == NULL) { - (void) fprintf(stderr, "No key matching '%s'\n", name); - return 0; - } - switch(pgpkey->key.pubkey.alg) { - case OPS_PKA_RSA: - sshkey->type = KEY_RSA; - sshkey->rsa = calloc(1, sizeof(*sshkey->rsa); - if (sshkey->rsa == NULL) { - (void) fprintf(stderr, "RSA memory problems\n"); - return 0; - } - sshkey->rsa->n = pgpkey->key.pubkey.key.rsa.n; - sshkey->rsa->e = pgpkey->key.pubkey.key.rsa.e; - sshkey->rsa->d = pgpkey->key.seckey.key.rsa.d; - sshkey->rsa->p = pgpkey->key.seckey.key.rsa.p; - sshkey->rs
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Aug 21 19:00:43 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c Log Message: avoid false positives when matching a (non-existent) encryption subkey use debugging output to point to the matching key To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.43 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.44 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.43 Sun Aug 15 16:10:56 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sat Aug 21 19:00:43 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.43 2010/08/15 16:10:56 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.44 2010/08/21 19:00:43 agc Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -834,6 +834,9 @@ } return &keyring->keys[*from]; } + if (memcmp(&keyring->keys[*from].encid, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", OPS_KEY_ID_SIZE) == 0) { + continue; + } if (memcmp(&keyring->keys[*from].encid, keyid, OPS_KEY_ID_SIZE) == 0 || memcmp(&keyring->keys[*from].encid[OPS_KEY_ID_SIZE / 2], keyid, OPS_KEY_ID_SIZE / 2) == 0) { if (pubkey) { @@ -924,12 +927,12 @@ for (keyp = &keyring->keys[*from]; *from < keyring->keyc; *from += 1, keyp++) { uidp = keyp->uids; for (i = 0 ; i < keyp->uidc; i++, uidp++) { - if (__ops_get_debug_level(__FILE__)) { -(void) fprintf(io->outs, - "keyid \"%s\" len %" PRIsize "u\n", - (char *) *uidp, len); - } if (regexec(&r, (char *)*uidp, 0, NULL, 0) == 0) { +if (__ops_get_debug_level(__FILE__)) { + (void) fprintf(io->outs, + "MATCHED keyid \"%s\" len %" PRIsize "u\n", + (char *) *uidp, len); +} regfree(&r); return keyp; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Aug 15 16:36:24 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: misc.c packet-parse.c packet-show.c reader.c signature.c validate.c writer.c Log Message: get rid of more 64-bit lint To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c cvs rdiff -u -r1.40 -r1.41 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.16 -r1.17 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c cvs rdiff -u -r1.41 -r1.42 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c cvs rdiff -u -r1.31 -r1.32 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c cvs rdiff -u -r1.38 -r1.39 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c cvs rdiff -u -r1.27 -r1.28 \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.35 Sun Aug 15 07:52:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Sun Aug 15 16:36:24 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: misc.c,v 1.35 2010/08/15 07:52:27 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.36 2010/08/15 16:36:24 agc Exp $"); #endif #include @@ -1026,7 +1026,7 @@ } /* read into contents of mem */ for (mem->length = 0 ; - (cc = read(fileno(fp), &mem->buf[mem->length], + (cc = (int)read(fileno(fp), &mem->buf[mem->length], (size_t)(mem->allocated - mem->length))) > 0 ; mem->length += (size_t)cc) { } Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.40 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.41 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.40 Sun Aug 15 16:10:56 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Sun Aug 15 16:36:24 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.40 2010/08/15 16:10:56 agc Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.41 2010/08/15 16:36:24 agc Exp $"); #endif #ifdef HAVE_OPENSSL_CAST_H @@ -2436,7 +2436,7 @@ (const uint8_t *) "", 1); } } - passlen = strlen(passphrase); + passlen = (unsigned)strlen(passphrase); for (n = 0; n * hashsize < keysize; ++n) { unsignedi; @@ -2799,7 +2799,7 @@ decrypt = __ops_get_decrypt(stream); if (decrypt) { __ops_region_t encregion; - unsigned b = decrypt->blocksize; + unsigned b = (unsigned)decrypt->blocksize; uint8_t buf[OPS_MAX_BLOCK_SIZE + 2] = ""; __ops_reader_push_decrypt(stream, decrypt, region); Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.17 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c:1.16 Tue May 25 01:05:11 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-show.c Sun Aug 15 16:36:24 2010 @@ -60,7 +60,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-show.c,v 1.16 2010/05/25 01:05:11 agc Exp $"); +__RCSID("$NetBSD: packet-show.c,v 1.17 2010/08/15 16:36:24 agc Exp $"); #endif #include @@ -465,7 +465,7 @@ * be replaced in the output by 2 chars of hex, so the length * will be correct */ - unsigned len = strlen(fmt_unknown) + 1; + unsigned len = (unsigned)(strlen(fmt_unknown) + 1); char *newstr; if ((newstr = calloc(1, len)) == NULL) { Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.41 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.42 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.41 Sun Aug 15 07:52:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Sun Aug 15 16:36:24 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.41 2010/08/15 07:52:27 agc Exp $"); +__RCSID("$NetBSD: reader.c,v 1.42 2010/08/15 16:36:24 agc Exp $"); #endif #include @@ -1806,7 +1806,7 @@ __OPS_USED(errors); if (reader->offset + length > reader->length) - n = reader->length - reader->offset; + n = (unsigned)(reader->length - reader->of
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Aug 15 16:10:56 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: bufgap.c compress.c keyring.c netpgp.c packet-parse.c signature.c validate.c writer.c Log Message: fix some more amd64 lint To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c cvs rdiff -u -r1.16 -r1.17 \ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c cvs rdiff -u -r1.42 -r1.43 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.68 -r1.69 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.39 -r1.40 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c cvs rdiff -u -r1.30 -r1.31 \ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c cvs rdiff -u -r1.37 -r1.38 \ src/crypto/external/bsd/netpgp/dist/src/lib/validate.c cvs rdiff -u -r1.26 -r1.27 \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.3 src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.4 --- src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c:1.3 Mon Dec 14 23:29:56 2009 +++ src/crypto/external/bsd/netpgp/dist/src/lib/bufgap.c Sun Aug 15 16:10:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bufgap.c,v 1.3 2009/12/14 23:29:56 agc Exp $ */ +/* $NetBSD: bufgap.c,v 1.4 2010/08/15 16:10:56 agc Exp $ */ /*- * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. @@ -117,7 +117,7 @@ char *cp; if (n < 0) { - n = strlen(s); + n = (int)strlen(s); } NEWARRAY(char, cp, n + 1, "strnsave", return NULL); (void) memcpy(cp, s, (size_t)n); @@ -413,7 +413,7 @@ int i; if (n < 0) { - n = strlen(s); + n = (int)strlen(s); } for (i = 0 ; i < n ; i += rlen) { if (bp->bbc + bp->abc == bp->size) { Index: src/crypto/external/bsd/netpgp/dist/src/lib/compress.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.17 --- src/crypto/external/bsd/netpgp/dist/src/lib/compress.c:1.16 Sun Aug 15 07:52:26 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/compress.c Sun Aug 15 16:10:56 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: compress.c,v 1.16 2010/08/15 07:52:26 agc Exp $"); +__RCSID("$NetBSD: compress.c,v 1.17 2010/08/15 16:10:56 agc Exp $"); #endif #ifdef HAVE_ZLIB_H @@ -346,10 +346,12 @@ switch (type) { case OPS_C_ZIP: + /* LINTED */ /* this is a lint problem in zlib.h header */ ret = (int)inflateInit2(&z.zstream, -15); break; case OPS_C_ZLIB: + /* LINTED */ /* this is a lint problem in zlib.h header */ ret = (int)inflateInit(&z.zstream); break; @@ -434,6 +436,7 @@ /* all other fields set to zero by use of calloc */ + /* LINTED */ /* this is a lint problem in zlib.h header */ if ((int)deflateInit(&zip->stream, level) != Z_OK) { (void) fprintf(stderr, "__ops_writez: can't initialise\n"); return 0; Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.42 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.43 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.42 Sun Aug 15 07:52:26 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sun Aug 15 16:10:56 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.42 2010/08/15 07:52:26 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.43 2010/08/15 16:10:56 agc Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -858,22 +858,22 @@ size_t j; int i; - for (i = j = 0 ; j < len && userid[i] && userid[i + 1] ; i += 2, j++) { + for (i = 0, j = 0 ; j < len && userid[i] && userid[i + 1] ; i += 2, j++) { if ((hi = strchr(uppers, userid[i])) == NULL) { if ((hi = strchr(lowers, userid[i])) == NULL) { break; } - hichar = (hi - lowers); + hichar = (uint8_t)(hi - lowers); } else { - hichar = (hi - uppers); + hichar = (uint8_t)(hi - uppers); } if ((lo = strchr(uppers, userid[i + 1])) == NULL) { if ((lo = strchr(lowers, userid[i + 1])) == NULL) { break; } - lochar = (lo - lowers); + lochar = (uint8_t)(lo - lowers); } else { - lochar = (lo - uppers); + lochar = (uint8_t)(lo - uppers); } keyid[j] = (hichar << 4) | (lochar); } Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.68 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.69 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun Aug 15 02:39:46 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: reader.c Log Message: get rid of a debugging statement To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.39 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.40 --- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.39 Fri Aug 13 18:29:41 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c Sun Aug 15 02:39:46 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: reader.c,v 1.39 2010/08/13 18:29:41 agc Exp $"); +__RCSID("$NetBSD: reader.c,v 1.40 2010/08/15 02:39:46 agc Exp $"); #endif #include @@ -2241,7 +2241,6 @@ if (cbinfo->cryptinfo.keydata == NULL) { (void) fprintf(io->errs, "get_passphrase_cb: NULL keydata\n"); } else { -printf("get_passphrase_cb\n"); __ops_print_keydata(io, cbinfo->cryptinfo.pubring, cbinfo->cryptinfo.keydata, "signature ", &cbinfo->cryptinfo.keydata->key.pubkey, 0); }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Aug 7 04:26:03 UTC 2010 Removed Files: src/crypto/external/bsd/netpgp/dist/src/lib: mj.c mj.h Log Message: mj.[ch] source files have moved To generate a diff of this commit: cvs rdiff -u -r1.2 -r0 src/crypto/external/bsd/netpgp/dist/src/lib/mj.c cvs rdiff -u -r1.1 -r0 src/crypto/external/bsd/netpgp/dist/src/lib/mj.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sat Aug 7 04:25:19 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: Makefile.am Log Message: mj.c source file has moved To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.5 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.6 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.5 Mon Jul 26 06:39:43 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am Sat Aug 7 04:25:19 2010 @@ -1,4 +1,4 @@ -## $NetBSD: Makefile.am,v 1.5 2010/07/26 06:39:43 agc Exp $ +## $NetBSD: Makefile.am,v 1.6 2010/08/07 04:25:19 agc Exp $ AM_CFLAGS = $(WARNCFLAGS) @@ -14,7 +14,6 @@ fastctype.c \ keyring.c \ misc.c \ - mj.c \ netpgp.c \ openssl_crypto.c \ packet-parse.c \
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Jul 26 17:24:32 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: mj.c Log Message: fix a build problrm pointed out by moof on source-changes-discuss To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/crypto/external/bsd/netpgp/dist/src/lib/mj.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/mj.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/mj.c:1.1 src/crypto/external/bsd/netpgp/dist/src/lib/mj.c:1.2 --- src/crypto/external/bsd/netpgp/dist/src/lib/mj.c:1.1 Mon Jul 26 06:37:35 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/mj.c Mon Jul 26 17:24:32 2010 @@ -275,7 +275,7 @@ case MJ_NULL: case MJ_FALSE: case MJ_TRUE: - atom->c = (unsigned)to; + atom->c = (unsigned)*to; return gettok(s, from, to, tok); case MJ_OPEN_BRACKET: mj_create(atom, "array");
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Jul 26 06:39:43 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: Makefile.am Makefile.in Log Message: hook minimalist JSON sources into the autoconf build To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am cvs rdiff -u -r1.7 -r1.8 \ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.4 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.5 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am:1.4 Mon Dec 14 23:29:56 2009 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.am Mon Jul 26 06:39:43 2010 @@ -1,4 +1,4 @@ -## $NetBSD: Makefile.am,v 1.4 2009/12/14 23:29:56 agc Exp $ +## $NetBSD: Makefile.am,v 1.5 2010/07/26 06:39:43 agc Exp $ AM_CFLAGS = $(WARNCFLAGS) @@ -14,6 +14,7 @@ fastctype.c \ keyring.c \ misc.c \ + mj.c \ netpgp.c \ openssl_crypto.c \ packet-parse.c \ Index: src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in diff -u src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.7 src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.8 --- src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in:1.7 Tue Dec 22 06:03:24 2009 +++ src/crypto/external/bsd/netpgp/dist/src/lib/Makefile.in Mon Jul 26 06:39:43 2010 @@ -56,6 +56,7 @@ libnetpgp_la-compress.lo libnetpgp_la-create.lo \ libnetpgp_la-crypto.lo libnetpgp_la-fastctype.lo \ libnetpgp_la-keyring.lo libnetpgp_la-misc.lo \ + libnetpgp_la-mj.lo \ libnetpgp_la-netpgp.lo libnetpgp_la-openssl_crypto.lo \ libnetpgp_la-packet-parse.lo libnetpgp_la-packet-print.lo \ libnetpgp_la-packet-show.lo libnetpgp_la-reader.lo \ @@ -205,6 +206,7 @@ fastctype.c \ keyring.c \ misc.c \ + mj.c \ netpgp.c \ openssl_crypto.c \ packet-parse.c \ @@ -395,6 +397,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c +libnetpgp_la-mj.lo: mj.c +...@am__fastdepcc_true@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetpgp_la-mj.lo -MD -MP -MF $(DEPDIR)/libnetpgp_la-mj.Tpo -c -o libnetpgp_la-mj.lo `test -f 'mj.c' || echo '$(srcdir)/'`mj.c +...@am__fastdepcc_true@ mv -f $(DEPDIR)/libnetpgp_la-mj.Tpo $(DEPDIR)/libnetpgp_la-mj.Plo +...@amdep_true@@am__fastdepCC_FALSE@ source='mj.c' object='libnetpgp_la-mj.lo' libtool=yes @AMDEPBACKSLASH@ +...@amdep_true@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +...@am__fastdepcc_false@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetpgp_la-mj.lo `test -f 'mj.c' || echo '$(srcdir)/'`mj.c + libnetpgp_la-netpgp.lo: netpgp.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetpgp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetpgp_la-netpgp.lo -MD -MP -MF $(DEPDIR)/libnetpgp_la-netpgp.Tpo -c -o libnetpgp_la-netpgp.lo `test -f 'netpgp.c' || echo '$(srcdir)/'`netpgp.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libnetpgp_la-netpgp.Tpo $(DEPDIR)/libnetpgp_la-netpgp.Plo
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Mon Jul 26 06:37:35 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.h packet-print.c Added Files: src/crypto/external/bsd/netpgp/dist/src/lib: mj.c mj.h Log Message: add a minimalist JSON implementation, and add a new function to access the data, and serialise it using JSON. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h cvs rdiff -u -r0 -r1.1 src/crypto/external/bsd/netpgp/dist/src/lib/mj.c \ src/crypto/external/bsd/netpgp/dist/src/lib/mj.h cvs rdiff -u -r1.33 -r1.34 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.27 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.28 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.27 Fri Jun 25 03:37:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Mon Jul 26 06:37:35 2010 @@ -55,6 +55,7 @@ #include "packet.h" #include "packet-parse.h" +#include "mj.h" enum { MAX_ID_LENGTH = 128, @@ -118,6 +119,9 @@ int __ops_sprint_keydata(__ops_io_t *, const __ops_keyring_t *, const __ops_key_t *, char **, const char *, const __ops_pubkey_t *, const int); +int __ops_sprint_mj(__ops_io_t *, const __ops_keyring_t *, + const __ops_key_t *, char **, const char *, + const __ops_pubkey_t *, const int); int __ops_hkp_sprint_keydata(__ops_io_t *, const __ops_keyring_t *, const __ops_key_t *, char **, const __ops_pubkey_t *, const int); Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.33 src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.34 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c:1.33 Fri Jul 9 05:35:34 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Mon Jul 26 06:37:35 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-print.c,v 1.33 2010/07/09 05:35:34 agc Exp $"); +__RCSID("$NetBSD: packet-print.c,v 1.34 2010/07/26 06:37:35 agc Exp $"); #endif #include @@ -77,6 +77,7 @@ #include "netpgpsdk.h" #include "packet.h" #include "netpgpdigest.h" +#include "mj.h" /* static functions */ @@ -361,7 +362,7 @@ /* print the sub key binding signature info */ static int -psubkeybinding(char *buf, size_t size, __ops_subsig_t *subsig, const __ops_pubkey_t *pubkey, char *expired) +psubkeybinding(char *buf, size_t size, __ops_subsig_t *subsig, const __ops_pubkey_t *pubkey, const char *expired) { char keyid[512]; char t[32]; @@ -473,6 +474,110 @@ } int +__ops_sprint_mj(__ops_io_t *io, const __ops_keyring_t *keyring, + const __ops_key_t *key, char **buf, const char *header, + const __ops_pubkey_t *pubkey, const int psigs) +{ + const __ops_key_t *trustkey; + unsigned from; + unsigned i; + unsigned j; + time_t now; + mj_t expired_obj; + mj_t uids_array; + mj_t sig_array; + mj_t sig_obj; + mj_t key_obj; + char uidbuf[KB(64)]; + char keyid[OPS_KEY_ID_SIZE * 3]; + char fp[(OPS_FINGERPRINT_SIZE * 3) + 1]; + int r; + + if (key == NULL || key->revoked) { + return -1; + } + (void) memset(uidbuf, 0x0, sizeof(uidbuf)); + (void) memset(&key_obj, 0x0, sizeof(key_obj)); + mj_create(&key_obj, "object"); + mj_append_field(&key_obj, "header", "string", header); + mj_append_field(&key_obj, "key bits", "integer", (int64_t) numkeybits(pubkey)); + mj_append_field(&key_obj, "pka", "string", __ops_show_pka(pubkey->alg)); + mj_append_field(&key_obj, "key id", "string", strhexdump(keyid, key->key_id, OPS_KEY_ID_SIZE, "")); + mj_append(&key_obj, "fingerprint", "string", + strhexdump(fp, key->fingerprint.fingerprint, key->fingerprint.length, " ")); + now = time(NULL); + mj_append_field(&key_obj, "birthtime", "integer", pubkey->birthtime); + mj_append_field(&key_obj, "duration", "integer", pubkey->duration); + if (pubkey->duration > 0) { + (void) memset(&expired_obj, 0x0, sizeof(expired_obj)); + mj_append_field(&expired_obj, "expiry status", "string", + (pubkey->birthtime + pubkey->duration < now) ? "[EXPIRED]" : "[EXPIRES]"); + mj_append_field(&expired_obj, "expiry", "integer", + (int64_t)(pubkey->birthtime + pubkey->duration)); + mj_append_field(&key_obj, "expiration", "object", &expired_obj); + } + (void) memset(&uids_array, 0x0, sizeof(uids_array)); + mj_create(&uids_array, "array"); + for (i = 0; i < key->uidc; i++) { + if ((r = isrevoked(key, i)) >= 0 && + key->revokes[r].code == OPS_REVOCATION_COMPROMISED) { + continue; + } + mj_append(&uids_array, "string", key->uids[i]); + mj_append
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Jul 9 15:12:06 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet.h Log Message: be a bit less typedef-happy when it's not needed - no functional change To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.24 src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.25 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet.h:1.24 Fri Jul 9 05:35:35 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h Fri Jul 9 15:12:06 2010 @@ -398,13 +398,6 @@ * with x being the secret) */ } __ops_elgamal_pubkey_t; -/** Union to hold public key params of any algorithm */ -typedef union { - __ops_dsa_pubkey_t dsa; /* A DSA public key */ - __ops_rsa_pubkey_t rsa; /* An RSA public key */ - __ops_elgamal_pubkey_t elgamal; /* An ElGamal public key */ -} __ops_pubkey_union_t; - /** Version. * OpenPGP has two different protocol versions: version 3 and version 4. * @@ -427,7 +420,11 @@ * v3 keys. */ unsigned days_valid; /* v4 duration */ __ops_pubkey_alg_t alg; /* Public Key Algorithm type */ - __ops_pubkey_union_t key; /* Public Key Parameters */ + union { + __ops_dsa_pubkey_t dsa; /* A DSA public key */ + __ops_rsa_pubkey_t rsa; /* An RSA public key */ + __ops_elgamal_pubkey_t elgamal; /* An ElGamal public key */ + } key; /* Public Key Parameters */ } __ops_pubkey_t; /** Structure to hold data for one RSA secret key @@ -449,13 +446,6 @@ BIGNUM *x; } __ops_elgamal_seckey_t; -/** __ops_seckey_union_t */ -typedef union { - __ops_rsa_seckey_t rsa; - __ops_dsa_seckey_t dsa; - __ops_elgamal_seckey_t elgamal; -} __ops_seckey_union_t; - /** s2k_usage_t */ typedef enum { @@ -544,7 +534,11 @@ uint8_tsalt[OPS_SALT_SIZE]; unsigned octetc; uint8_tiv[OPS_MAX_BLOCK_SIZE]; - __ops_seckey_union_t key; + union { + __ops_rsa_seckey_t rsa; + __ops_dsa_seckey_t dsa; + __ops_elgamal_seckey_t elgamal; + }key; unsigned checksum; uint8_t *checkhash; } __ops_seckey_t; @@ -606,14 +600,6 @@ BIGNUM *s; } __ops_elgamal_sig_t; -/** Union to hold signature params of any algorithm */ -typedef union { - __ops_rsa_sig_t rsa;/* An RSA Signature */ - __ops_dsa_sig_t dsa;/* A DSA Signature */ - __ops_elgamal_sig_t elgamal; /* deprecated */ - __ops_data_t unknown; /* private or experimental */ -} __ops_sig_union_t; - #define OPS_KEY_ID_SIZE 8 #define OPS_FINGERPRINT_SIZE 20 @@ -631,7 +617,12 @@ * of signer */ __ops_pubkey_alg_t key_alg; /* public key algorithm number */ __ops_hash_alg_t hash_alg; /* hashing algorithm number */ - __ops_sig_union_t sig; /* signature params */ + union { + __ops_rsa_sig_t rsa; /* An RSA Signature */ + __ops_dsa_sig_t dsa; /* A DSA Signature */ + __ops_elgamal_sig_t elgamal; /* deprecated */ + __ops_data_t unknown; /* private or experimental */ + } sig; /* signature params */ size_t v4_hashlen; uint8_t *v4_hashed; unsigned birthtime_set:1;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Jul 9 14:45:43 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: minor clean up after ourselves - free a compiled regexp To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.64 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.65 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.64 Fri Jul 9 05:35:34 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri Jul 9 14:45:43 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.64 2010/07/09 05:35:34 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.65 2010/07/09 14:45:43 agc Exp $"); #endif #include @@ -115,6 +115,7 @@ } } (void) fclose(fp); + regfree(&keyre); return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Jul 9 05:35:35 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: create.c crypto.c keyring.c misc.c netpgp.c openssl_crypto.c packet-parse.c packet-print.c packet.h reader.c readerwriter.h ssh2pgp.c version.h writer.c Log Message: Changes to 3.99.7/20100701 + recognise ascii-armoured encrypted messages properly, in memory and in files + print error message and exit for now when trying to encrypt with a DSA key + fix bug reported by dyoung when trying to print out the encryption key fingerprint To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.c cvs rdiff -u -r1.24 -r1.25 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c \ src/crypto/external/bsd/netpgp/dist/src/lib/openssl_crypto.c \ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c cvs rdiff -u -r1.38 -r1.39 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c cvs rdiff -u -r1.32 -r1.33 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c cvs rdiff -u -r1.63 -r1.64 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c cvs rdiff -u -r1.37 -r1.38 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c \ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c cvs rdiff -u -r1.23 -r1.24 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet.h cvs rdiff -u -r1.10 -r1.11 \ src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h cvs rdiff -u -r1.13 -r1.14 \ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c cvs rdiff -u -r1.36 -r1.37 \ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.30 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.31 --- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.30 Wed Jun 30 15:18:10 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c Fri Jul 9 05:35:34 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: create.c,v 1.30 2010/06/30 15:18:10 agc Exp $"); +__RCSID("$NetBSD: create.c,v 1.31 2010/07/09 05:35:34 agc Exp $"); #endif #include @@ -453,10 +453,10 @@ return 0; } break; - - /* case OPS_PKA_ELGAMAL: */ - /* return __ops_write_mpi(output, key->key.elgamal.x); */ - + case OPS_PKA_DSA: + return __ops_write_mpi(output, key->key.dsa.x); + case OPS_PKA_ELGAMAL: + return __ops_write_mpi(output, key->key.elgamal.x); default: return 0; } @@ -892,8 +892,14 @@ unsignedi; /* implementation of EME-PKCS1-v1_5-ENCODE, as defined in OpenPGP RFC */ - - if (pubkey->alg != OPS_PKA_RSA) { + switch (pubkey->alg) { + case OPS_PKA_RSA: + break; + case OPS_PKA_DSA: + case OPS_PKA_ELGAMAL: + (void) fprintf(stderr, "encode_m_buf: DSA/Elgamal encryption not implemented yet\n"); + break; + default: (void) fprintf(stderr, "encode_m_buf: pubkey algorithm\n"); return 0; } @@ -986,7 +992,12 @@ if (__ops_get_debug_level(__FILE__)) { hexdump(stderr, "Encrypting for RSA keyid", key->key_id, sizeof(sesskey->key_id)); } - if (key->key.pubkey.alg != OPS_PKA_RSA) { + switch (key->key.pubkey.alg) { + case OPS_PKA_RSA: + case OPS_PKA_DSA: + case OPS_PKA_ELGAMAL: + break; + default: (void) fprintf(stderr, "__ops_create_pk_sesskey: bad pubkey algorithm\n"); free(encoded_m_buf); @@ -1013,11 +1024,24 @@ encode_m_buf(unencoded_m_buf, SZ_UNENCODED_M_BUF, pubkey, encoded_m_buf); /* and encrypt it */ - if (!__ops_rsa_encrypt_mpi(encoded_m_buf, sz_encoded_m_buf, pubkey, - &sesskey->params)) { + switch (key->key.pubkey.alg) { + case OPS_PKA_RSA: + if (!__ops_rsa_encrypt_mpi(encoded_m_buf, sz_encoded_m_buf, pubkey, +&sesskey->params)) { + free(encoded_m_buf); + free(sesskey); + return NULL; + } + break; + case OPS_PKA_DSA: + case OPS_PKA_ELGAMAL: + (void) fprintf(stderr, "DSA/Elgamal encryption not supported yet\n"); free(encoded_m_buf); free(sesskey); return NULL; + default: + /* will not get here - for lint only */ + break; } free(encoded_m_buf); return sesskey; @@ -1039,20 +1063,26 @@ "__ops_write_pk_sesskey: NULL pksk\n"); return 0; } - if (pksk->alg != OPS_PKA_RSA) { + switch (pksk->alg) { + case OPS_PKA_RSA: + return __ops_write_ptag(output, OPS_PTAG_CT_PK_SESSION_KEY) && + __ops_write_length(output, (unsigned)(1 + 8 + 1 + +BN_num_bytes(pksk->params.rsa.encrypted_m) + 2)) && + __ops_write_scalar(output, (unsigned)pksk->version, 1) && + __ops_write(output, pksk->key_id, 8) && + __ops_write_scalar(output, (unsigned)pksk->alg, 1) && + __ops_write
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Jul 1 03:52:13 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Use the correct default ssh user key file (just a typo). Use the portable strcasecmp() function. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.61 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.62 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.61 Thu Jul 1 00:42:51 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu Jul 1 03:52:13 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.61 2010/07/01 00:42:51 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.62 2010/07/01 03:52:13 agc Exp $"); #endif #include @@ -255,7 +255,7 @@ char *filename; if ((filename = netpgp_getvar(netpgp, "sshkeyfile")) == NULL) { - (void) snprintf(f, sizeof(f), "%s/.ssh/is_rsa.pub", homedir); + (void) snprintf(f, sizeof(f), "%s/.ssh/id_rsa.pub", homedir); filename = f; } if ((pubring = calloc(1, sizeof(*pubring))) == NULL) { @@ -266,11 +266,11 @@ hashtype = OPS_HASH_MD5; if ((hash = netpgp_getvar(netpgp, "hash")) != NULL) { /* openssh 2 hasn't really caught up to anything else yet */ - if (strcasecmp(hash, "md5") == 0) { + if (netpgp_strcasecmp(hash, "md5") == 0) { hashtype = OPS_HASH_MD5; - } else if (strcasecmp(hash, "sha1") == 0) { + } else if (netpgp_strcasecmp(hash, "sha1") == 0) { hashtype = OPS_HASH_SHA1; - } else if (strcasecmp(hash, "sha256") == 0) { + } else if (netpgp_strcasecmp(hash, "sha256") == 0) { hashtype = OPS_HASH_SHA256; } }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu Jul 1 00:42:51 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: factor out the code which recognises ASCII-armour into its own function. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.60 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.61 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.60 Wed Jun 30 15:17:40 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu Jul 1 00:42:51 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.60 2010/06/30 15:17:40 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.61 2010/07/01 00:42:51 agc Exp $"); #endif #include @@ -437,6 +437,26 @@ return 1; } +/* return 1 if the file contains ascii-armoured text */ +static unsigned +isarmoured(__ops_io_t *io, const char *f, const char *text) +{ + unsigned armoured; + FILE *fp; + char buf[BUFSIZ]; + + armoured = 0; + if ((fp = fopen(f, "r")) == NULL) { + (void) fprintf(io->errs, "isarmoured: can't open '%s'\n", f); + return 0; + } + if (fgets(buf, sizeof(buf), fp) != NULL) { + armoured = (strncmp(buf, text, strlen(text)) == 0); + } + (void) fclose(fp); + return armoured; +} + /***/ /* exported functions start here */ /***/ @@ -754,25 +774,13 @@ #endif __ops_io_t *io; unsigned realarmor; - FILE *fp; #if 0 char ringfile[MAXPATHLEN]; #endif - char buf[BUFSIZ]; int done; io = netpgp->io; - realarmor = 0; - if ((fp = fopen(f, "r")) == NULL) { - (void) fprintf(io->errs, "netpgp_import_key: can't open '%s'\n", f); - return 0; - } - if (fgets(buf, sizeof(buf), fp) == NULL) { - realarmor = 0; - } else { - realarmor = (strncmp(buf, IMPORT_ARMOR_HEAD, strlen(IMPORT_ARMOR_HEAD)) == 0); - } - (void) fclose(fp); + realarmor = isarmoured(io, f, IMPORT_ARMOR_HEAD); done = __ops_keyring_fileread(netpgp->pubring, realarmor, f); if (!done) { (void) fprintf(io->errs, "Cannot import key from file %s\n", f); @@ -901,30 +909,18 @@ const unsigned overwrite = 1; __ops_io_t *io; unsigned realarmor; - FILE *fp; - char buf[BUFSIZ]; + __OPS_USED(armored); io = netpgp->io; if (f == NULL) { (void) fprintf(io->errs, "netpgp_decrypt_file: no filename specified\n"); return 0; } - realarmor = (unsigned)armored; - if ((fp = fopen(f, "r")) == NULL) { - (void) fprintf(io->errs, - "netpgp_decrypt_file: can't open '%s'\n", f); - return 0; - } - if (fgets(buf, sizeof(buf), fp) == NULL) { - realarmor = 0; - } else { - realarmor = (strcmp(buf, ARMOR_HEAD) == 0); - } - (void) fclose(fp); + realarmor = isarmoured(io, f, ARMOR_HEAD); return __ops_decrypt_file(netpgp->io, f, out, netpgp->secring, netpgp->pubring, -(unsigned)realarmor, overwrite, +realarmor, overwrite, netpgp->passfp, get_passphrase_cb); } @@ -1014,9 +1010,8 @@ __ops_validation_t result; __ops_io_t *io; unsigned realarmor; - FILE *fp; - char buf[BUFSIZ]; + __OPS_USED(armored); (void) memset(&result, 0x0, sizeof(result)); io = netpgp->io; if (in == NULL) { @@ -1024,18 +1019,7 @@ "netpgp_verify_file: no filename specified\n"); return 0; } - realarmor = (unsigned)armored; - if ((fp = fopen(in, "r")) == NULL) { - (void) fprintf(io->errs, - "netpgp_decrypt_file: can't open '%s'\n", in); - return 0; - } - if (fgets(buf, sizeof(buf), fp) == NULL) { - realarmor = 0; - } else { - realarmor = (strcmp(buf, ARMOR_SIG_HEAD) == 0); - } - (void) fclose(fp); + realarmor = isarmoured(io, in, ARMOR_SIG_HEAD); if (__ops_validate_file(io, &result, in, out, (const int)realarmor, netpgp->pubring)) { resultp(io, in, &result, netpgp->pubring); return 1;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Jun 30 15:18:10 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: create.c Log Message: also calculate the length of DSA keys as well as RSA ones To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 \ src/crypto/external/bsd/netpgp/dist/src/lib/create.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.29 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.30 --- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.29 Fri Jun 25 03:37:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c Wed Jun 30 15:18:10 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: create.c,v 1.29 2010/06/25 03:37:27 agc Exp $"); +__RCSID("$NetBSD: create.c,v 1.30 2010/06/30 15:18:10 agc Exp $"); #endif #include @@ -169,6 +169,10 @@ pubkey_length(const __ops_pubkey_t *key) { switch (key->alg) { + case OPS_PKA_DSA: + return mpi_length(key->key.dsa.p) + mpi_length(key->key.dsa.q) + + mpi_length(key->key.dsa.g) + mpi_length(key->key.dsa.y); + case OPS_PKA_RSA: return mpi_length(key->key.rsa.n) + mpi_length(key->key.rsa.e); @@ -186,6 +190,8 @@ len = 0; switch (key->pubkey.alg) { + case OPS_PKA_DSA: + return (unsigned)(mpi_length(key->key.dsa.x) + pubkey_length(&key->pubkey)); case OPS_PKA_RSA: len = mpi_length(key->key.rsa.d) + mpi_length(key->key.rsa.p) + mpi_length(key->key.rsa.q) + mpi_length(key->key.rsa.u);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Jun 30 15:17:40 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: factor out code to append a key to the pubring file. recognise ascii-armoured headers on keys when importing. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.59 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.60 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.59 Fri Jun 25 03:37:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Jun 30 15:17:40 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.59 2010/06/25 03:37:27 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.60 2010/06/30 15:17:40 agc Exp $"); #endif #include @@ -414,6 +414,29 @@ return key; } +/* append a key to a keyring */ +static int +appendkey(__ops_io_t *io, __ops_key_t *key, char *ringfile) +{ + __ops_output_t *create; + const unsigned noarmor = 0; + int fd; + + if ((fd = __ops_setup_file_append(&create, ringfile)) < 0) { + fd = __ops_setup_file_write(&create, ringfile, 0); + } + if (fd < 0) { + (void) fprintf(io->errs, "can't open pubring '%s'\n", ringfile); + return 0; + } + if (!__ops_write_xfer_pubkey(create, key, noarmor)) { + (void) fprintf(io->errs, "Cannot write pubkey\n"); + return 0; + } + __ops_teardown_file_write(create, fd); + return 1; +} + /***/ /* exported functions start here */ /***/ @@ -720,23 +743,49 @@ return __ops_export_key(io, key, NULL); } +#define IMPORT_ARMOR_HEAD "-BEGIN PGP PUBLIC KEY BLOCK-" + /* import a key into our keyring */ int netpgp_import_key(netpgp_t *netpgp, char *f) { - const unsigned noarmor = 0; - const unsigned armor = 1; +#if 0 + __ops_keyring_t *keyring; +#endif __ops_io_t *io; - int done; + unsigned realarmor; + FILE *fp; +#if 0 + char ringfile[MAXPATHLEN]; +#endif + char buf[BUFSIZ]; + int done; io = netpgp->io; - if ((done = __ops_keyring_fileread(netpgp->pubring, noarmor, f)) == 0) { - done = __ops_keyring_fileread(netpgp->pubring, armor, f); + realarmor = 0; + if ((fp = fopen(f, "r")) == NULL) { + (void) fprintf(io->errs, "netpgp_import_key: can't open '%s'\n", f); + return 0; + } + if (fgets(buf, sizeof(buf), fp) == NULL) { + realarmor = 0; + } else { + realarmor = (strncmp(buf, IMPORT_ARMOR_HEAD, strlen(IMPORT_ARMOR_HEAD)) == 0); } + (void) fclose(fp); + done = __ops_keyring_fileread(netpgp->pubring, realarmor, f); if (!done) { (void) fprintf(io->errs, "Cannot import key from file %s\n", f); return 0; } +#if 0 + keyring = netpgp->pubring; + (void) snprintf(ringfile, sizeof(ringfile), "%s/pubring.gpg", netpgp_getvar(netpgp, "homedir")); + if (!appendkey(io, &keyring->keys[keyring->keyc - 1], ringfile)) { + (void) fprintf(io->errs, "Cannot append imported key to pubring %s\n", ringfile); + return 0; + } +#endif return __ops_keyring_list(io, netpgp->pubring, 0); } @@ -781,18 +830,10 @@ } (void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir); (void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir); - if ((fd = __ops_setup_file_append(&create, ringfile)) < 0) { - fd = __ops_setup_file_write(&create, ringfile, 0); - } - if (fd < 0) { - (void) fprintf(io->errs, "can't open pubring '%s'\n", ringfile); - return 0; - } - if (!__ops_write_xfer_pubkey(create, key, noarmor)) { - (void) fprintf(io->errs, "Cannot write pubkey\n"); + if (!appendkey(io, key, ringfile)) { + (void) fprintf(io->errs, "Cannot write pubkey to '%s'\n", ringfile); return 0; } - __ops_teardown_file_write(create, fd); if (netpgp->pubring != NULL) { __ops_keyring_free(netpgp->pubring); }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Jun 25 18:30:16 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: misc.c Log Message: Fix build problems on LP64 platforms - thanks to Paul Goyette for the nudge. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/misc.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.31 src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.32 --- src/crypto/external/bsd/netpgp/dist/src/lib/misc.c:1.31 Fri Jun 25 03:37:27 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/misc.c Fri Jun 25 18:30:16 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: misc.c,v 1.31 2010/06/25 03:37:27 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.32 2010/06/25 18:30:16 agc Exp $"); #endif #include @@ -1099,10 +1099,10 @@ char line[LINELEN + 1]; (void) fprintf(fp, "%s%s", (header) ? header : "", (header) ? "\n" : ""); - (void) fprintf(fp, "[%d chars]\n", length); + (void) fprintf(fp, "[%" PRIsize "u char%s]\n", length, (length == 1) ? "" : "s"); for (i = 0 ; i < length ; i++) { if (i % LINELEN == 0) { - (void) fprintf(fp, "%.5d | ", i); + (void) fprintf(fp, "%.5" PRIsize "u | ", i); } (void) fprintf(fp, "%.02x ", (uint8_t)src[i]); line[i % LINELEN] = (isprint(src[i])) ? src[i] : '.';
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri Jun 18 00:20:28 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3 Log Message: At the request of Alan Horn, clarify the purpose of netpgp_get_info(). To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.13 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.14 --- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.13 Fri May 7 16:29:09 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 Fri Jun 18 00:20:28 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnetpgp.3,v 1.13 2010/05/07 16:29:09 agc Exp $ +.\" $NetBSD: libnetpgp.3,v 1.14 2010/06/18 00:20:28 agc Exp $ .\" .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 5, 2010 +.Dd June 17, 2010 .Dt LIBNETPGP 3 .Os .Sh NAME @@ -310,9 +310,20 @@ .Pp The .Fn netpgp_get_info -returns the information depending upon the +returns the version or maintainer information depending upon the .Ar type argument. +At the present time, two types are defined: +.Dq version +and +.Dq maintainer . +A failure to present a known +.Ar type +argument to +.Fn netpgp_get_info +will result in the string +.Dq [unknown] +being returned. .Sh SEE ALSO .Xr netpgp 1 , .Xr ssl 3
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Jun 2 03:38:02 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Check for a null keyring before listing keys - with thanks to Jeff Rizzo for the problem report. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.57 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.58 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.57 Tue Jun 1 05:22:38 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed Jun 2 03:38:01 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.57 2010/06/01 05:22:38 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.58 2010/06/02 03:38:01 agc Exp $"); #endif #include @@ -561,6 +561,10 @@ int netpgp_list_keys(netpgp_t *netpgp, const int psigs) { + if (netpgp->pubring == NULL) { + (void) fprintf(stderr, "No keyring\n"); + return 0; + } return __ops_keyring_list(netpgp->io, netpgp->pubring, psigs); }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed Jun 2 03:15:14 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: version.h Log Message: commit version number change To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 \ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/version.h diff -u src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.34 src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.35 --- src/crypto/external/bsd/netpgp/dist/src/lib/version.h:1.34 Tue Jun 1 05:55:56 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/version.h Wed Jun 2 03:15:14 2010 @@ -58,7 +58,7 @@ #endif /* development versions have .99 suffix */ -#define NETPGP_BASE_VERSION "3.99.3" +#define NETPGP_BASE_VERSION "3.99.4" #define NETPGP_VERSION_CAT(a, b) "NetPGP portable " a "/[" b "]" #define NETPGP_VERSION_STRING \
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Jun 1 05:22:38 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: make sure we have created a directory when generating a new key. don't try to re-read the key after writing it - that's done by a separate function. Problem found by Tyler Retzlaff, fixed in a different way. check that keyrings are non-NULL before attempting to free them - from a nudge by Tyler Retzlaff. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.56 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.57 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.56 Tue May 25 01:05:10 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Jun 1 05:22:38 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.56 2010/05/25 01:05:10 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.57 2010/06/01 05:22:38 agc Exp $"); #endif #include @@ -755,9 +755,12 @@ cp = NULL; __ops_sprint_keydata(netpgp->io, NULL, key, &cp, "pub", &key->key.seckey.pubkey, 0); (void) fprintf(stdout, "%s", cp); - /* write public key, and try to re-read it */ + /* write public key */ (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[31]); - (void) mkdir(dir, 0700); + if (mkdir(dir, 0700) < 0) { + (void) fprintf(io->errs, "can't mkdir '%s'\n", dir); + return 0; + } (void) fprintf(io->errs, "netpgp: generated keys in directory %s\n", dir); (void) snprintf(ringfile = filename, sizeof(filename), "%s/pubring.gpg", dir); if ((fd = __ops_setup_file_append(&create, ringfile)) < 0) { @@ -772,12 +775,10 @@ return 0; } __ops_teardown_file_write(create, fd); - __ops_keyring_free(netpgp->pubring); - if (!__ops_keyring_fileread(netpgp->pubring, noarmor, ringfile)) { - (void) fprintf(io->errs, "Cannot read pubring %s\n", ringfile); - return 0; + if (netpgp->pubring != NULL) { + __ops_keyring_free(netpgp->pubring); } - /* write secret key, and try to re-read it */ + /* write secret key */ (void) snprintf(ringfile = filename, sizeof(filename), "%s/secring.gpg", dir); if ((fd = __ops_setup_file_append(&create, ringfile)) < 0) { fd = __ops_setup_file_write(&create, ringfile, 0); @@ -791,10 +792,8 @@ return 0; } __ops_teardown_file_write(create, fd); - __ops_keyring_free(netpgp->secring); - if (!__ops_keyring_fileread(netpgp->secring, noarmor, ringfile)) { - (void) fprintf(io->errs, "Can't read secring %s\n", ringfile); - return 0; + if (netpgp->secring != NULL) { + __ops_keyring_free(netpgp->secring); } __ops_keydata_free(key); free(cp);
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Tue Jun 1 03:19:27 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: packet-parse.c Log Message: when cleaning up, don't try to free the public key which is part of the secret key - shown up by Mac OS X malloc. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 \ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.35 Tue May 25 01:05:10 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c Tue Jun 1 03:19:26 2010 @@ -58,7 +58,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: packet-parse.c,v 1.35 2010/05/25 01:05:10 agc Exp $"); +__RCSID("$NetBSD: packet-parse.c,v 1.36 2010/06/01 03:19:26 agc Exp $"); #endif #ifdef HAVE_OPENSSL_CAST_H @@ -2246,7 +2246,6 @@ __ops_show_pka(key->pubkey.alg)); } free(key->checkhash); - __ops_pubkey_free(&key->pubkey); } static int
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri May 21 14:28:44 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c Log Message: correct indentation - no functional change To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 \ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.36 --- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.35 Sat May 8 00:33:28 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Fri May 21 14:28:44 2010 @@ -57,7 +57,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: keyring.c,v 1.35 2010/05/08 00:33:28 agc Exp $"); +__RCSID("$NetBSD: keyring.c,v 1.36 2010/05/21 14:28:44 agc Exp $"); #endif #ifdef HAVE_FCNTL_H @@ -885,7 +885,7 @@ { const __ops_key_t *kp; __ops_userid_t *uidp; - unsigned i = 0; + unsigned i = 0; __ops_key_t *keyp; unsigned savedstart; regex_t r;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Fri May 21 06:53:51 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Protect against NULL pointers in key output in a different way - only advance its counter if it's non-NULL. Regression test for this is: netpgpkeys --list-key '\.de\>' with my standard keyring (to list all keys which have at least one subuid with a German email address). To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.54 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.55 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.54 Thu May 20 14:43:42 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri May 21 06:53:51 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.54 2010/05/20 14:43:42 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.55 2010/05/21 06:53:51 agc Exp $"); #endif #include @@ -600,7 +600,9 @@ "pub", &key->key.pubkey, psigs); } - pubs.c += 1; + if (pubs.v[pubs.c] != NULL) { +pubs.c += 1; + } k += 1; } } while (key != NULL); @@ -611,10 +613,8 @@ (pubs.c == 1) ? "" : "s"); } for (k = 0 ; k < pubs.c ; k++) { - if (pubs.v[k]) { - (void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : ""); - free(pubs.v[k]); - } + (void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : ""); + free(pubs.v[k]); } free(pubs.v); return pubs.c;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu May 20 14:43:42 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: avoid a duplicated error message To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.53 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.54 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.53 Thu May 20 14:42:21 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu May 20 14:43:42 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.53 2010/05/20 14:42:21 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.54 2010/05/20 14:43:42 agc Exp $"); #endif #include @@ -896,7 +896,6 @@ } /* get key with which to sign */ if ((keypair = resolve_userid(netpgp, netpgp->secring, userid)) == NULL) { - (void) fprintf(io->errs, "netpgp_sign_file: userid '%s' not found\n", userid); return 0; } ret = 1;
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu May 20 14:42:21 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: extend the resolve_userid() function to take a keyring, and use it for functions which require a secret key as well. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.52 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.53 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.52 Thu May 20 00:36:31 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu May 20 14:42:21 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.52 2010/05/20 00:36:31 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.53 2010/05/20 14:42:21 agc Exp $"); #endif #include @@ -294,9 +294,9 @@ return 1; } -/* set ssh uid to first one in ring */ +/* set ssh uid to first one in pubring */ static void -set_ssh_userid(__ops_keyring_t *pubring, char *id, size_t len, int last) +set_first_pubring(__ops_keyring_t *pubring, char *id, size_t len, int last) { uint8_t *src; int i; @@ -383,7 +383,7 @@ /* resolve the userid */ static const __ops_key_t * -resolve_userid(netpgp_t *netpgp, const char *userid) +resolve_userid(netpgp_t *netpgp, const __ops_keyring_t *keyring, const char *userid) { const __ops_key_t *key; __ops_io_t *io; @@ -394,7 +394,7 @@ userid += 2; } io = netpgp->io; - if ((key = __ops_getkeybyname(io, netpgp->pubring, userid)) == NULL) { + if ((key = __ops_getkeybyname(io, keyring, userid)) == NULL) { (void) fprintf(io->errs, "Can't find key '%s'\n", userid); } return key; @@ -511,7 +511,7 @@ return 0; } if ((userid = netpgp_getvar(netpgp, "userid")) == NULL) { - set_ssh_userid(netpgp->pubring, id, sizeof(id), last); + set_first_pubring(netpgp->pubring, id, sizeof(id), last); netpgp_setvar(netpgp, "userid", userid = id); } if (userid == NULL) { @@ -611,8 +611,10 @@ (pubs.c == 1) ? "" : "s"); } for (k = 0 ; k < pubs.c ; k++) { - (void) fprintf(fp, "%s", pubs.v[k]); - free(pubs.v[k]); + if (pubs.v[k]) { + (void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : ""); + free(pubs.v[k]); + } } free(pubs.v); return pubs.c; @@ -669,11 +671,9 @@ netpgp_get_key(netpgp_t *netpgp, const char *name, const char *fmt) { const __ops_key_t *key; - __ops_io_t *io; char *newkey; - io = netpgp->io; - if ((key = resolve_userid(netpgp, name)) == NULL) { + if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) { return NULL; } if (strcmp(fmt, "mr") == 0) { @@ -696,7 +696,7 @@ __ops_io_t *io; io = netpgp->io; - if ((key = resolve_userid(netpgp, name)) == NULL) { + if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) { return NULL; } return __ops_export_key(io, key, NULL); @@ -822,7 +822,8 @@ return 0; } suffix = (armored) ? ".asc" : ".gpg"; - if ((keypair = resolve_userid(netpgp, userid)) == NULL) { + /* get key with which to sign */ + if ((keypair = resolve_userid(netpgp, netpgp->pubring, userid)) == NULL) { return 0; } if (out == NULL) { @@ -893,14 +894,9 @@ "netpgp_sign_file: no filename specified\n"); return 0; } - if (userid == NULL) { - userid = netpgp_getvar(netpgp, "userid"); - } /* get key with which to sign */ - keypair = __ops_getkeybyname(io, netpgp->secring, userid); - if (keypair == NULL) { - (void) fprintf(io->errs, "Userid '%s' not found in secring\n", -userid); + if ((keypair = resolve_userid(netpgp, netpgp->secring, userid)) == NULL) { + (void) fprintf(io->errs, "netpgp_sign_file: userid '%s' not found\n", userid); return 0; } ret = 1; @@ -1027,14 +1023,7 @@ "netpgp_sign_memory: no memory to sign\n"); return 0; } - if (userid == NULL) { - userid = netpgp_getvar(netpgp, "userid"); - } - /* get key with which to sign */ - keypair = __ops_getkeybyname(io, netpgp->secring, userid); - if (keypair == NULL) { - (void) fprintf(io->errs, "Userid '%s' not found in keyring\n", -userid); + if ((keypair = resolve_userid(netpgp, netpgp->secring, userid)) == NULL) { return 0; } ret = 1; @@ -1155,13 +1144,7 @@ "netpgp_encrypt_buf: no memory to encrypt\n"); return 0; } - if (userid == NULL) { - userid = netpgp_getvar(netpgp, "userid"); - } - keypair = __ops_getkeybyname(io, netpgp->pubring, userid); - if (keypair == NULL) { - (void) fprintf(io->errs, "Userid '%s' not found in keyring\n", - userid); + if ((keypair = resolve_userid(netpgp, netpgp->pubring, userid)) == NULL) { return 0; } if (in == out
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Thu May 20 00:36:31 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: add a static function to resolve the userid in one place, and start to use it To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.52 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.51 Wed May 19 02:50:16 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu May 20 00:36:31 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.51 2010/05/19 02:50:16 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.52 2010/05/20 00:36:31 agc Exp $"); #endif #include @@ -381,6 +381,25 @@ return (uint64_t)strtoll(s, NULL, 10); } +/* resolve the userid */ +static const __ops_key_t * +resolve_userid(netpgp_t *netpgp, const char *userid) +{ + const __ops_key_t *key; + __ops_io_t *io; + + if (userid == NULL) { + userid = netpgp_getvar(netpgp, "userid"); + } else if (userid[0] == '0' && userid[1] == 'x') { + userid += 2; + } + io = netpgp->io; + if ((key = __ops_getkeybyname(io, netpgp->pubring, userid)) == NULL) { + (void) fprintf(io->errs, "Can't find key '%s'\n", userid); + } + return key; +} + /***/ /* exported functions start here */ /***/ @@ -654,14 +673,7 @@ char *newkey; io = netpgp->io; - if (name == NULL) { - name = netpgp_getvar(netpgp, "userid"); - } else if (name[0] == '0' && name[1] == 'x') { - name += 2; - } - key = __ops_getkeybyname(netpgp->io, netpgp->pubring, name); - if (key == NULL) { - (void) fprintf(io->errs, "Can't find key '%s'\n", name); + if ((key = resolve_userid(netpgp, name)) == NULL) { return NULL; } if (strcmp(fmt, "mr") == 0) { @@ -684,16 +696,8 @@ __ops_io_t *io; io = netpgp->io; - if (name == NULL) { - name = netpgp_getvar(netpgp, "userid"); - } else if (name[0] == '0' && name[1] == 'x') { - name += 2; - } - key = __ops_getkeybyname(io, netpgp->pubring, name); - if (key == NULL) { - (void) fprintf(io->errs, - "Cannot find own key \"%s\" in keyring\n", name); - return 0; + if ((key = resolve_userid(netpgp, name)) == NULL) { + return NULL; } return __ops_export_key(io, key, NULL); } @@ -817,14 +821,8 @@ "netpgp_encrypt_file: no filename specified\n"); return 0; } - if (userid == NULL) { - userid = netpgp_getvar(netpgp, "userid"); - } suffix = (armored) ? ".asc" : ".gpg"; - keypair = __ops_getkeybyname(io, netpgp->pubring, userid); - if (keypair == NULL) { - (void) fprintf(io->errs, "Userid '%s' not found in keyring\n", - userid); + if ((keypair = resolve_userid(netpgp, userid)) == NULL) { return 0; } if (out == NULL) {
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Wed May 19 02:50:16 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: One more reason not to use DSA keys: The DSA algorithm seems to require a digest value which is 20 bytes long, which kind of implies SHA-1. If we have a DSA signature, use SHA-1 as a hash algorithm, for backwards compatibility. RSA signatures continue to use SHA256 by default, although this can be given as an argument, if desired. This fixes DSA signatures with netpgp: % netpgp --sign --userid d4a643c5 a pub 1024/DSA 8222c3ecd4a643c5 2010-05-19 [EXPIRES 2013-05-18] Key fingerprint: 3e4a 5df4 033b 2333 219b 1afd 8222 c3ec d4a6 43c5 uid Alistair Crooks (DSA TEST KEY - DO NOT USE) sub 1024/DSA 8222c3ecd4a643c5 2010-05-19 [EXPIRES 2013-05-18] netpgp passphrase: % netpgp --verify a.gpg Good signature for a.gpg made Tue May 18 05:41:25 2010 using DSA key 8222c3ecd4a643c5 pub 1024/DSA 8222c3ecd4a643c5 2010-05-19 [EXPIRES 2013-05-18] Key fingerprint: 3e4a 5df4 033b 2333 219b 1afd 8222 c3ec d4a6 43c5 uid Alistair Crooks (DSA TEST KEY - DO NOT USE) sub 1024/DSA 8222c3ecd4a643c5 2010-05-19 [EXPIRES 2013-05-18] % To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.51 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.50 Sun May 16 06:48:52 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Wed May 19 02:50:16 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.50 2010/05/16 06:48:52 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.51 2010/05/19 02:50:16 agc Exp $"); #endif #include @@ -886,7 +886,7 @@ __ops_seckey_t *seckey; const unsigned overwrite = 1; __ops_io_t *io; - char *hashalg; + const char *hashalg; int ret; io = netpgp->io; @@ -934,6 +934,9 @@ } while (seckey == NULL); /* sign file */ hashalg = netpgp_getvar(netpgp, "hash"); + if (seckey->pubkey.alg == OPS_PKA_DSA) { + hashalg = "sha1"; + } if (detached) { ret = __ops_sign_detached(io, f, out, seckey, hashalg, get_birthtime(netpgp_getvar(netpgp, "birthtime")), @@ -1017,7 +1020,7 @@ __ops_seckey_t *seckey; __ops_memory_t *signedmem; __ops_io_t *io; - char *hashalg; + const char *hashalg; int ret; io = netpgp->io; @@ -1059,6 +1062,9 @@ /* sign file */ (void) memset(out, 0x0, outsize); hashalg = netpgp_getvar(netpgp, "hash"); + if (seckey->pubkey.alg == OPS_PKA_DSA) { + hashalg = "sha1"; + } signedmem = __ops_sign_buf(io, mem, size, seckey, get_birthtime(netpgp_getvar(netpgp, "birthtime")), get_duration(netpgp_getvar(netpgp, "duration")),
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun May 16 06:21:14 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c Log Message: Avoid a possible overwrite of a value in the (key, value) array, in the event that a reference to the value is passed to the netpgp_setvar() function as the new value. Problem noted, cause detected, and most of the fix contributed by, Anon Ymous. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 \ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.48 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.49 --- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.48 Sat May 8 04:17:45 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Sun May 16 06:21:14 2010 @@ -34,7 +34,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: netpgp.c,v 1.48 2010/05/08 04:17:45 agc Exp $"); +__RCSID("$NetBSD: netpgp.c,v 1.49 2010/05/16 06:21:14 agc Exp $"); #endif #include @@ -1274,8 +1274,11 @@ int netpgp_setvar(netpgp_t *netpgp, const char *name, const char *value) { - int i; + char *newval; + int i; + /* protect against the case where 'value' is netpgp->value[i] */ + newval = netpgp_strdup(value); if ((i = findvar(netpgp, name)) < 0) { /* add the element to the array */ if (size_arrays(netpgp, netpgp->size + 15)) { @@ -1290,11 +1293,12 @@ } /* sanity checks for range of values */ if (strcmp(name, "hash") == 0 || strcmp(name, "algorithm") == 0) { - if (__ops_str_to_hash_alg(value) == OPS_HASH_UNKNOWN) { + if (__ops_str_to_hash_alg(newval) == OPS_HASH_UNKNOWN) { + free(newval); return 0; } } - netpgp->value[i] = netpgp_strdup(value); + netpgp->value[i] = newval; return 1; }
CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib
Module Name:src Committed By: agc Date: Sun May 16 02:46:25 UTC 2010 Modified Files: src/crypto/external/bsd/netpgp/dist/src/lib: crypto.c Log Message: fix a piece of lint To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 \ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.23 --- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.22 Sat May 8 02:17:15 2010 +++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Sun May 16 02:46:25 2010 @@ -54,7 +54,7 @@ #if defined(__NetBSD__) __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: crypto.c,v 1.22 2010/05/08 02:17:15 agc Exp $"); +__RCSID("$NetBSD: crypto.c,v 1.23 2010/05/16 02:46:25 agc Exp $"); #endif #include @@ -159,7 +159,7 @@ if (__ops_get_debug_level(__FILE__)) { fprintf(stderr, "decoded m buf:\n"); - hexdump(stderr, buf, n - i, " "); + hexdump(stderr, buf, (size_t)(n - i), " "); fprintf(stderr, "\n"); } return n - i;