Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/netpgp/dist Changes to 1.99.19/20100212
details: https://anonhg.NetBSD.org/src/rev/fd1121c13a30
branches: trunk
changeset: 752050:fd1121c13a30
user: agc <agc%NetBSD.org@localhost>
date: Fri Feb 12 03:38:48 2010 +0000
description:
Changes to 1.99.19/20100212
+ plug some memory leaks, from cppcheck via Thomas Klausner (thanks!)
+ make the singular of time units read correctly
+ print decryption key info properly when prompting for passphrase
diffstat:
crypto/external/bsd/netpgp/dist/TODO | 2 +
crypto/external/bsd/netpgp/dist/configure.ac | 6 ++--
crypto/external/bsd/netpgp/dist/src/lib/create.c | 10 ++++++-
crypto/external/bsd/netpgp/dist/src/lib/crypto.c | 14 ++++++---
crypto/external/bsd/netpgp/dist/src/lib/crypto.h | 5 +++-
crypto/external/bsd/netpgp/dist/src/lib/keyring.h | 1 +
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | 9 +++++-
crypto/external/bsd/netpgp/dist/src/lib/packet-print.c | 8 +++--
crypto/external/bsd/netpgp/dist/src/lib/reader.c | 20 +++++++++-----
crypto/external/bsd/netpgp/dist/src/lib/validate.c | 20 +++++++++-----
crypto/external/bsd/netpgp/dist/src/lib/version.h | 2 +-
crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c | 6 ++--
12 files changed, 70 insertions(+), 33 deletions(-)
diffs (truncated from 435 to 300 lines):
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/TODO
--- a/crypto/external/bsd/netpgp/dist/TODO Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/TODO Fri Feb 12 03:38:48 2010 +0000
@@ -87,3 +87,5 @@
display expiry properly
unarmoured static in packet-print.c and skipping in crypto.c
duration -> expiry
+print signing key info properly when prompting for passphrase
+print decryption key info properly when prompting for passphrase
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/configure.ac
--- a/crypto/external/bsd/netpgp/dist/configure.ac Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure.ac Fri Feb 12 03:38:48 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.23 2010/02/11 17:46:09 agc Exp $
+# $NetBSD: configure.ac,v 1.24 2010/02/12 03:38:48 agc Exp $
#
# Process this file with autoconf to produce a configure script.
-AC_INIT([netpgp],[20100211],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
+AC_INIT([netpgp],[20100212],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.23 $])
+AC_REVISION([$Revision: 1.24 $])
AS_SHELL_SANITIZE
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/create.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/create.c Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/create.c Fri Feb 12 03:38:48 2010 +0000
@@ -57,7 +57,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: create.c,v 1.21 2009/10/07 16:19:51 agc Exp $");
+__RCSID("$NetBSD: create.c,v 1.22 2010/02/12 03:38:48 agc Exp $");
#endif
#include <sys/types.h>
@@ -1012,11 +1012,14 @@
if ((sesskey = calloc(1, sizeof(*sesskey))) == NULL) {
(void) fprintf(stderr,
"__ops_create_pk_sesskey: can't allocate\n");
+ free(encoded_m_buf);
return NULL;
}
if (key->type != OPS_PTAG_CT_PUBLIC_KEY) {
(void) fprintf(stderr,
"__ops_create_pk_sesskey: bad type\n");
+ free(encoded_m_buf);
+ free(sesskey);
return NULL;
}
sesskey->version = OPS_PKSK_V3;
@@ -1035,6 +1038,8 @@
if (key->key.pubkey.alg != OPS_PKA_RSA) {
(void) fprintf(stderr,
"__ops_create_pk_sesskey: bad pubkey algorithm\n");
+ free(encoded_m_buf);
+ free(sesskey);
return NULL;
}
sesskey->alg = key->key.pubkey.alg;
@@ -1056,6 +1061,7 @@
}
if (create_unencoded_m_buf(sesskey, &unencoded_m_buf[0]) == 0) {
free(encoded_m_buf);
+ free(sesskey);
return NULL;
}
if (__ops_get_debug_level(__FILE__)) {
@@ -1074,6 +1080,7 @@
if (!__ops_rsa_encrypt_mpi(encoded_m_buf, sz_encoded_m_buf, pubkey,
&sesskey->params)) {
free(encoded_m_buf);
+ free(sesskey);
return NULL;
}
free(encoded_m_buf);
@@ -1226,6 +1233,7 @@
return 0;
}
if (write(fd, buf, len) != (int)len) {
+ (void) close(fd);
return 0;
}
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/crypto.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/crypto.c Fri Feb 12 03:38:48 2010 +0000
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: crypto.c,v 1.19 2010/02/08 17:19:12 agc Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.20 2010/02/12 03:38:48 agc Exp $");
#endif
#include <sys/types.h>
@@ -381,7 +381,8 @@
__ops_decrypt_file(__ops_io_t *io,
const char *infile,
const char *outfile,
- __ops_keyring_t *keyring,
+ __ops_keyring_t *secring,
+ __ops_keyring_t *pubring,
const unsigned use_armour,
const unsigned allow_overwrite,
void *passfp,
@@ -443,9 +444,10 @@
/* setup for writing decrypted contents to given output file */
/* setup keyring and passphrase callback */
- parse->cbinfo.cryptinfo.keyring = keyring;
+ parse->cbinfo.cryptinfo.secring = secring;
parse->cbinfo.passfp = passfp;
parse->cbinfo.cryptinfo.getpassphrase = getpassfunc;
+ parse->cbinfo.cryptinfo.pubring = pubring;
/* Set up armour/passphrase options */
if (use_armour) {
@@ -475,7 +477,8 @@
__ops_decrypt_buf(__ops_io_t *io,
const void *input,
const size_t insize,
- __ops_keyring_t *keyring,
+ __ops_keyring_t *secring,
+ __ops_keyring_t *pubring,
const unsigned use_armour,
void *passfp,
__ops_cbfunc_t *getpassfunc)
@@ -504,7 +507,8 @@
__ops_setup_memory_write(&parse->cbinfo.output, &outmem, insize);
/* setup keyring and passphrase callback */
- parse->cbinfo.cryptinfo.keyring = keyring;
+ parse->cbinfo.cryptinfo.secring = secring;
+ parse->cbinfo.cryptinfo.pubring = pubring;
parse->cbinfo.passfp = passfp;
parse->cbinfo.cryptinfo.getpassphrase = getpassfunc;
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/crypto.h
--- a/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/crypto.h Fri Feb 12 03:38:48 2010 +0000
@@ -187,6 +187,7 @@
const char *,
const char *,
__ops_keyring_t *,
+ __ops_keyring_t *,
const unsigned,
const unsigned,
void *,
@@ -203,6 +204,7 @@
const void *,
const size_t,
__ops_keyring_t *,
+ __ops_keyring_t *,
const unsigned,
void *,
__ops_cbfunc_t *);
@@ -238,9 +240,10 @@
*/
struct __ops_cryptinfo_t {
char *passphrase;
- __ops_keyring_t *keyring;
+ __ops_keyring_t *secring;
const __ops_key_t *keydata;
__ops_cbfunc_t *getpassphrase;
+ __ops_keyring_t *pubring;
};
/** __ops_cbdata_t */
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/keyring.h
--- a/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Fri Feb 12 03:38:48 2010 +0000
@@ -132,6 +132,7 @@
char *,
unsigned,
__ops_keyring_t *,
+ __ops_keyring_t *,
void *,
__ops_cbfunc_t *);
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri Feb 12 03:38:48 2010 +0000
@@ -34,7 +34,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.38 2010/02/11 17:46:09 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.39 2010/02/12 03:38:48 agc Exp $");
#endif
#include <sys/types.h>
@@ -415,6 +415,7 @@
} else if ((io->res = fopen(results, "w")) == NULL) {
(void) fprintf(io->errs, "Can't open results %s for writing\n",
results);
+ free(io);
return 0;
}
netpgp->io = io;
@@ -799,6 +800,7 @@
}
(void) fclose(fp);
return __ops_decrypt_file(netpgp->io, f, out, netpgp->secring,
+ netpgp->pubring,
(unsigned)realarmour, overwrite,
netpgp->passfp, get_passphrase_cb);
}
@@ -1107,6 +1109,7 @@
}
realarmour = (strncmp(input, ARMOR_HEAD, sizeof(ARMOR_HEAD) - 1) == 0);
mem = __ops_decrypt_buf(netpgp->io, input, insize, netpgp->secring,
+ netpgp->pubring,
realarmour, netpgp->passfp,
get_passphrase_cb);
m = MIN(__ops_mem_len(mem), outsize);
@@ -1177,7 +1180,9 @@
}
netpgp->pubring = keyring;
netpgp_setvar(netpgp, "pubring", pubringname);
- ret = __ops_list_packets(io, f, (unsigned)armour, keyring,
+ ret = __ops_list_packets(io, f, (unsigned)armour,
+ netpgp->secring,
+ netpgp->pubring,
netpgp->passfp,
get_passphrase_cb);
free(keyring);
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/packet-print.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c Fri Feb 12 03:38:48 2010 +0000
@@ -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.25 2010/02/08 17:19:12 agc Exp $");
+__RCSID("$NetBSD: packet-print.c,v 1.26 2010/02/12 03:38:48 agc Exp $");
#endif
#include <string.h>
@@ -1256,7 +1256,8 @@
__ops_list_packets(__ops_io_t *io,
char *filename,
unsigned armour,
- __ops_keyring_t *keyring,
+ __ops_keyring_t *secring,
+ __ops_keyring_t *pubring,
void *passfp,
__ops_cbfunc_t *cb_get_passphrase)
{
@@ -1268,7 +1269,8 @@
fd = __ops_setup_file_read(io, &stream, filename, NULL, cb_list_packets,
accumulate);
__ops_parse_options(stream, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
- stream->cryptinfo.keyring = keyring;
+ stream->cryptinfo.secring = secring;
+ stream->cryptinfo.pubring = pubring;
stream->cbinfo.passfp = passfp;
stream->cryptinfo.getpassphrase = cb_get_passphrase;
if (armour) {
diff -r 1b5a868f38d4 -r fd1121c13a30 crypto/external/bsd/netpgp/dist/src/lib/reader.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/reader.c Fri Feb 12 02:16:59 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/reader.c Fri Feb 12 03:38:48 2010 +0000
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.29 2010/02/08 17:19:12 agc Exp $");
+__RCSID("$NetBSD: reader.c,v 1.30 2010/02/12 03:38:48 agc Exp $");
#endif
#include <sys/types.h>
@@ -2173,14 +2173,14 @@
if (__ops_get_debug_level(__FILE__)) {
printf("OPS_PTAG_CT_PK_SESSION_KEY\n");
}
- if (!cbinfo->cryptinfo.keyring) {
+ if (!cbinfo->cryptinfo.secring) {
(void) fprintf(io->errs,
"pk_sesskey_cb: bad keyring\n");
return (__ops_cb_ret_t)0;
}
from = 0;
cbinfo->cryptinfo.keydata =
- __ops_getkeybyid(io, cbinfo->cryptinfo.keyring,
+ __ops_getkeybyid(io, cbinfo->cryptinfo.secring,
content->pk_sesskey.key_id, &from);
if (!cbinfo->cryptinfo.keydata) {
break;
@@ -2213,6 +2213,7 @@
{
const __ops_contents_t *content = &pkt->u;
const __ops_seckey_t *secret;
+ const __ops_key_t *pubkey;
const __ops_key_t *keypair;
unsigned from;
__ops_io_t *io;
@@ -2223,22 +2224,27 @@
}
Home |
Main Index |
Thread Index |
Old Index