Module Name:    src
Committed By:   agc
Date:           Tue Oct  6 02:26:05 UTC 2009

Modified Files:
        src/crypto/external/bsd/netpgp/dist/src/lib: create.c crypto.c
            keyring.c

Log Message:
More Flexelint fixes from phk - just low-hanging fruit for just now -
many thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
    src/crypto/external/bsd/netpgp/dist/src/lib/create.c
cvs rdiff -u -r1.16 -r1.17 \
    src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c
cvs rdiff -u -r1.20 -r1.21 \
    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/create.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.19 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.20
--- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.19	Sat Jun 13 05:25:08 2009
+++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c	Tue Oct  6 02:26:05 2009
@@ -57,13 +57,12 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: create.c,v 1.19 2009/06/13 05:25:08 agc Exp $");
+__RCSID("$NetBSD: create.c,v 1.20 2009/10/06 02:26:05 agc Exp $");
 #endif
 
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -104,7 +103,7 @@
 {
 	return __ops_write_length(output, length) &&
 		__ops_write_scalar(output, (unsigned)(type -
-				OPS_PTAG_SIG_SUBPKT_BASE), 1);
+				(unsigned)OPS_PTAG_SIG_SUBPKT_BASE), 1);
 }
 
 /*
@@ -166,7 +165,7 @@
 static unsigned 
 mpi_length(const BIGNUM *bn)
 {
-	return 2 + (BN_num_bits(bn) + 7) / 8;
+	return (unsigned)(2 + (BN_num_bits(bn) + 7) / 8);
 }
 
 static unsigned 
@@ -194,7 +193,7 @@
 		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);
 
-		return len + pubkey_length(&key->pubkey);
+		return (unsigned)(len + pubkey_length(&key->pubkey));
 	default:
 		(void) fprintf(stderr,
 			"seckey_length: unknown key algorithm\n");
@@ -213,7 +212,7 @@
 __ops_fast_create_rsa_pubkey(__ops_pubkey_t *key, time_t t,
 			       BIGNUM *n, BIGNUM *e)
 {
-	key->version = 4;
+	key->version = OPS_V4;
 	key->birthtime = t;
 	key->alg = OPS_PKA_RSA;
 	key->key.rsa.n = n;
@@ -362,10 +361,9 @@
 	case OPS_S2KS_SALTED:
 		/* RFC4880: section 3.7.1.1 and 3.7.1.2 */
 
-		done = 0;
-		for (i = 0; done < CAST_KEY_LENGTH; i++) {
-			unsigned int    j = 0;
+		for (done = 0, i = 0; done < CAST_KEY_LENGTH; i++) {
 			unsigned char   zero = 0;
+			unsigned 	j;
 			int             needed;
 			int             size;
 
@@ -397,9 +395,9 @@
 			 * if more in hash than is needed by session key, use
 			 * the leftmost octets
 			 */
-			(void) memcpy(sesskey + (i * OPS_SHA1_HASH_SIZE),
+			(void) memcpy(&sesskey[i * OPS_SHA1_HASH_SIZE],
 					hashed, (unsigned)size);
-			done += size;
+			done += (unsigned)size;
 			if (done > CAST_KEY_LENGTH) {
 				(void) fprintf(stderr,
 					"write_seckey_body: short add\n");
@@ -429,7 +427,7 @@
 	__ops_encrypt_init(&crypted);
 
 	if (__ops_get_debug_level(__FILE__)) {
-		unsigned int    i2 = 0;
+		unsigned	i2;
 
 		(void) fprintf(stderr, "\nWRITING:\niv=");
 		for (i2 = 0; i2 < __ops_block_size(key->alg); i2++) {
@@ -520,7 +518,7 @@
 			const __ops_key_t *keydata,
 			const unsigned armoured)
 {
-	unsigned int    i = 0, j = 0;
+	unsigned int    i, j;
 
 	if (armoured) {
 		__ops_writer_push_armoured(output, OPS_PGP_PUBLIC_KEY_BLOCK);
@@ -588,7 +586,7 @@
 				const size_t pplen,
 				unsigned armoured)
 {
-	unsigned	i = 0, j = 0;
+	unsigned	i, j;
 
 	if (armoured) {
 		__ops_writer_push_armoured(output, OPS_PGP_PRIVATE_KEY_BLOCK);
@@ -794,12 +792,12 @@
 	}
 	/* checksum or hash */
 	switch (key->s2k_usage) {
-	case 0:
-	case 255:
+	case OPS_S2KU_NONE:
+	case OPS_S2KU_ENCRYPTED:
 		length += 2;
 		break;
 
-	case 254:
+	case OPS_S2KU_ENCRYPTED_AND_HASHED:
 		length += OPS_CHECKHASH_SIZE;
 		break;
 
@@ -810,7 +808,7 @@
 	}
 
 	/* secret key and public key MPIs */
-	length += seckey_length(key);
+	length += (unsigned)seckey_length(key);
 
 	return __ops_write_ptag(output, OPS_PTAG_CT_SECRET_KEY) &&
 		/* __ops_write_length(output,1+4+1+1+seckey_length(key)+2) && */
@@ -846,7 +844,7 @@
 __ops_output_delete(__ops_output_t *output)
 {
 	writer_info_delete(&output->writer);
-	(void) free(output);
+	free(output);
 }
 
 /**
@@ -859,8 +857,8 @@
 unsigned 
 __ops_calc_sesskey_checksum(__ops_pk_sesskey_t *sesskey, unsigned char cs[2])
 {
-	unsigned int    i = 0;
 	unsigned long   checksum = 0;
+	unsigned int    i;
 
 	if (!__ops_is_sa_supported(sesskey->symm_alg)) {
 		return 0;
@@ -885,7 +883,7 @@
 static unsigned 
 create_unencoded_m_buf(__ops_pk_sesskey_t *sesskey, unsigned char *m_buf)
 {
-	int             i = 0;
+	int             i;
 
 	/* m_buf is the buffer which will be encoded in PKCS#1 block */
 	/* encoding to form the "m" value used in the  */
@@ -902,6 +900,7 @@
 		return 0;
 	}
 	for (i = 0; i < CAST_KEY_LENGTH; i++) {
+		/* XXX - Flexelint - Warning 679: Suspicious Truncation in arithmetic expression combining with pointer */
 		m_buf[1 + i] = sesskey->key[i];
 	}
 
@@ -933,7 +932,7 @@
 		return 0;
 	}
 
-	k = BN_num_bytes(pubkey->key.rsa.n);
+	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;
@@ -943,7 +942,7 @@
 	EM[1] = 0x02;
 
 	/* add non-zero random bytes of length k - mLen -3 */
-	for (i = 2; i < k - mLen - 1; ++i) {
+	for (i = 2; i < (k - mLen) - 1; ++i) {
 		do {
 			__ops_random(EM + i, 1);
 		} while (EM[i] == 0);
@@ -959,7 +958,7 @@
 	(void) memcpy(EM + i, M, mLen);
 
 	if (__ops_get_debug_level(__FILE__)) {
-		unsigned int    i2 = 0;
+		unsigned int    i2;
 
 		(void) fprintf(stderr, "Encoded Message: \n");
 		for (i2 = 0; i2 < mLen; i2++) {
@@ -992,13 +991,26 @@
          * can be any, we're hardcoding RSA for now
          */
 
-	const __ops_pubkey_t *pubkey = __ops_get_pubkey(key);
-#define SZ_UNENCODED_M_BUF CAST_KEY_LENGTH+1+2
-	unsigned char   unencoded_m_buf[SZ_UNENCODED_M_BUF];
-	const size_t    sz_encoded_m_buf = BN_num_bytes(pubkey->key.rsa.n);
-	unsigned char  *encoded_m_buf = calloc(1, sz_encoded_m_buf);
+#define SZ_UNENCODED_M_BUF (CAST_KEY_LENGTH + 1 + 2)
 
-	__ops_pk_sesskey_t *sesskey = calloc(1, sizeof(*sesskey));
+	const __ops_pubkey_t	*pubkey;
+	__ops_pk_sesskey_t	*sesskey;
+	unsigned char		 unencoded_m_buf[SZ_UNENCODED_M_BUF];
+	unsigned char		*encoded_m_buf;
+	size_t			 sz_encoded_m_buf;
+
+	pubkey = __ops_get_pubkey(key);
+	sz_encoded_m_buf = BN_num_bytes(pubkey->key.rsa.n);
+	if ((encoded_m_buf = calloc(1, sz_encoded_m_buf)) == NULL) {
+		(void) fprintf(stderr,
+			"__ops_create_pk_sesskey: can't allocate\n");
+		return NULL;
+	}
+	if ((sesskey = calloc(1, sizeof(*sesskey))) == NULL) {
+		(void) fprintf(stderr,
+			"__ops_create_pk_sesskey: can't allocate\n");
+		return NULL;
+	}
 	if (key->type != OPS_PTAG_CT_PUBLIC_KEY) {
 		(void) fprintf(stderr,
 			"__ops_create_pk_sesskey: bad type\n");
@@ -1009,7 +1021,7 @@
 			sizeof(sesskey->key_id));
 
 	if (__ops_get_debug_level(__FILE__)) {
-		unsigned int    i = 0;
+		unsigned int    i;
 
 		(void) fprintf(stderr, "Encrypting for RSA key id : ");
 		for (i = 0; i < sizeof(sesskey->key_id); i++) {
@@ -1029,7 +1041,7 @@
 	__ops_random(sesskey->key, CAST_KEY_LENGTH);
 
 	if (__ops_get_debug_level(__FILE__)) {
-		unsigned int    i = 0;
+		unsigned int    i;
 
 		(void) fprintf(stderr,
 			"CAST5 session key created (len=%d):\n ",
@@ -1040,11 +1052,11 @@
 		(void) fprintf(stderr, "\n");
 	}
 	if (create_unencoded_m_buf(sesskey, &unencoded_m_buf[0]) == 0) {
-		(void) free(encoded_m_buf);
+		free(encoded_m_buf);
 		return NULL;
 	}
 	if (__ops_get_debug_level(__FILE__)) {
-		unsigned int    i = 0;
+		unsigned int    i;
 
 		printf("unencoded m buf:\n");
 		for (i = 0; i < SZ_UNENCODED_M_BUF; i++) {
@@ -1058,10 +1070,10 @@
 	/* and encrypt it */
 	if (!__ops_rsa_encrypt_mpi(encoded_m_buf, sz_encoded_m_buf, pubkey,
 			&sesskey->params)) {
-		(void) free(encoded_m_buf);
+		free(encoded_m_buf);
 		return NULL;
 	}
-	(void) free(encoded_m_buf);
+	free(encoded_m_buf);
 	return sesskey;
 }
 
@@ -1075,6 +1087,7 @@
 unsigned 
 __ops_write_pk_sesskey(__ops_output_t *output, __ops_pk_sesskey_t *pksk)
 {
+	/* XXX - Flexelint - Pointer parameter 'pksk' (line 1076) could be declared as pointing to const */
 	if (pksk == NULL) {
 		(void) fprintf(stderr,
 			"__ops_write_pk_sesskey: NULL pksk\n");
@@ -1157,7 +1170,7 @@
 				 const __ops_litdata_type_t type,
 				 __ops_output_t *output)
 {
-	__ops_memory_t	*mem = NULL;
+	__ops_memory_t	*mem;
 	unsigned   	 ret;
 	size_t		 len;
 
@@ -1192,8 +1205,8 @@
 __ops_filewrite(const char *filename, const char *buf,
 			const size_t len, const unsigned overwrite)
 {
-	int		flags = 0;
-	int		fd = 0;
+	int		flags;
+	int		fd;
 
 	flags = O_WRONLY | O_CREAT;
 	if (overwrite) {
@@ -1206,7 +1219,7 @@
 #endif
 	fd = open(filename, flags, 0600);
 	if (fd < 0) {
-		perror(NULL);
+		(void) fprintf(stderr, "can't open '%s'\n", filename);
 		return 0;
 	}
 	if (write(fd, buf, len) != (int)len) {
@@ -1233,15 +1246,19 @@
 			/* buffer to write encrypted data to */
 	unsigned char  *encrypted = (unsigned char *) NULL;
 	__ops_crypt_t	crypt_info;
-	size_t		encrypted_sz = 0;	/* size of encrypted data */
+	size_t		encrypted_sz;	/* size of encrypted data */
 	int             done = 0;
 
 	/* \todo assume AES256 for now */
 	__ops_crypt_any(&crypt_info, OPS_SA_AES_256);
 	__ops_encrypt_init(&crypt_info);
 
-	encrypted_sz = len + crypt_info.blocksize + 2;
-	encrypted = calloc(1, encrypted_sz);
+	encrypted_sz = (size_t)(len + crypt_info.blocksize + 2);
+	if ((encrypted = calloc(1, encrypted_sz)) == NULL) {
+		(void) fprintf(stderr, "can't allocate %" PRIsize "d\n",
+			encrypted_sz);
+		return 0;
+	}
 
 	done = __ops_encrypt_se(&crypt_info, encrypted, data, (unsigned)len);
 	if (done != len) {

Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.17
--- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.16	Tue Jun  9 00:51:02 2009
+++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c	Tue Oct  6 02:26:05 2009
@@ -54,16 +54,12 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: crypto.c,v 1.16 2009/06/09 00:51:02 agc Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.17 2009/10/06 02:26:05 agc Exp $");
 #endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -99,7 +95,7 @@
 	int             n;
 	int             i;
 
-	mpisize = BN_num_bytes(encmpi);
+	mpisize = (unsigned)BN_num_bytes(encmpi);
 	/* MPI can't be more than 65,536 */
 	if (mpisize > sizeof(encmpibuf)) {
 		(void) fprintf(stderr, "mpisize too big %u\n", mpisize);
@@ -163,7 +159,7 @@
 
 	/* this is the unencoded m buf */
 	if ((unsigned) (n - i) <= buflen) {
-		(void) memcpy(buf, mpibuf + i, (unsigned)(n - i));
+		(void) memcpy(buf, mpibuf + i, (unsigned)(n - i)); /* XXX - Flexelint */
 	}
 
 	if (__ops_get_debug_level(__FILE__)) {
@@ -189,9 +185,9 @@
 {
 
 	unsigned char   encmpibuf[NETPGP_BUFSIZ];
-	int             n = 0;
+	int             n;
 
-	if (sz_encoded_m_buf != (size_t) BN_num_bytes(pubkey->key.rsa.n)) {
+	if (sz_encoded_m_buf != (size_t)BN_num_bytes(pubkey->key.rsa.n)) {
 		(void) fprintf(stderr, "sz_encoded_m_buf wrong\n");
 		return 0;
 	}
@@ -242,7 +238,7 @@
 {
 	__ops_output_t	*output;
 	__ops_memory_t	*inmem;
-	int		 fd_out = 0;
+	int		 fd_out;
 
 	__OPS_USED(io);
 	inmem = __ops_memory_new();
@@ -297,8 +293,8 @@
 	__ops_stream_t	*parse = NULL;
 	const int		 printerrors = 1;
 	char			*filename = NULL;
-	int			 fd_in = 0;
-	int			 fd_out = 0;
+	int			 fd_in;
+	int			 fd_out;
 
 	/* setup for reading from given input file */
 	fd_in = __ops_setup_file_read(io, &parse, infile,
@@ -326,7 +322,11 @@
 		if (strcmp(suffix, ".gpg") == 0 ||
 		    strcmp(suffix, ".asc") == 0) {
 			filenamelen = strlen(infile) - strlen(suffix);
-			filename = calloc(1, filenamelen + 1);
+			if ((filename = calloc(1, filenamelen + 1)) == NULL) {
+				(void) fprintf(stderr, "can't allocate %" PRIsize "d bytes\n",
+					(size_t)(filenamelen + 1));
+				return 0;
+			}
 			(void) strncpy(filename, infile, filenamelen);
 			filename[filenamelen] = 0x0;
 		}
@@ -335,13 +335,10 @@
 					filename, allow_overwrite);
 		if (fd_out < 0) {
 			perror(filename);
-			(void) free(filename);
+			free(filename);
 			__ops_teardown_file_read(parse, fd_in);
 			return 0;
 		}
-		if (filename) {
-			(void) free(filename);
-		}
 	}
 
 	/* \todo check for suffix matching armour param */
@@ -368,6 +365,7 @@
 
 	if (filename) {
 		__ops_teardown_file_write(parse->cbinfo.output, fd_out);
+		free(filename);
 	}
 	__ops_teardown_file_read(parse, fd_in);
 	/* \todo cleardown crypt */
@@ -379,7 +377,7 @@
 callback_write_parsed(const __ops_packet_t *pkt, __ops_cbdata_t *cbinfo)
 {
 	const __ops_contents_t	*content = &pkt->u;
-	static unsigned		 skipping;
+	static unsigned		 skipping;	/* XXX - put skipping into pkt? */
 
 	if (__ops_get_debug_level(__FILE__)) {
 		printf("callback_write_parsed: ");

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.20 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.21
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.20	Thu Jun 11 04:57:52 2009
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Tue Oct  6 02:26:05 2009
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.20 2009/06/11 04:57:52 agc Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.21 2009/10/06 02:26:05 agc Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -123,14 +123,14 @@
 	for (n = 0; n < keydata->uidc; ++n) {
 		__ops_userid_free(&keydata->uids[n]);
 	}
-	(void) free(keydata->uids);
+	free(keydata->uids);
 	keydata->uids = NULL;
 	keydata->uidc = 0;
 
 	for (n = 0; n < keydata->packetc; ++n) {
 		__ops_subpacket_free(&keydata->packets[n]);
 	}
-	(void) free(keydata->packets);
+	free(keydata->packets);
 	keydata->packets = NULL;
 	keydata->packetc = 0;
 
@@ -140,7 +140,7 @@
 		__ops_seckey_free(&keydata->key.seckey);
 	}
 
-	(void) free(keydata);
+	free(keydata);
 }
 
 /**
@@ -394,7 +394,7 @@
 	size_t          len = strlen((char *) src->userid);
 
 	if (dst->userid) {
-		(void) free(dst->userid);
+		free(dst->userid);
 	}
 	dst->userid = calloc(1, len + 1);
 	(void) memcpy(dst->userid, src->userid, len);
@@ -413,7 +413,7 @@
 __ops_copy_packet(__ops_subpacket_t *dst, const __ops_subpacket_t *src)
 {
 	if (dst->raw) {
-		(void) free(dst->raw);
+		free(dst->raw);
 	}
 	dst->raw = calloc(1, src->length);
 	dst->length = src->length;
@@ -431,7 +431,7 @@
 __ops_userid_t  *
 __ops_add_userid(__ops_key_t *key, const __ops_userid_t *userid)
 {
-	__ops_userid_t  *uidp = NULL;
+	__ops_userid_t  *uidp;
 
 	EXPAND_ARRAY(key, uid);
 	/* initialise new entry in array */
@@ -451,7 +451,7 @@
 __ops_subpacket_t   *
 __ops_add_subpacket(__ops_key_t *keydata, const __ops_subpacket_t *packet)
 {
-	__ops_subpacket_t   *subpktp = NULL;
+	__ops_subpacket_t   *subpktp;
 
 	EXPAND_ARRAY(keydata, packet);
 
@@ -475,8 +475,8 @@
 		const __ops_userid_t *userid,
 		const __ops_subpacket_t *sigpacket)
 {
-	__ops_subpacket_t	*pkt = NULL;
-	__ops_userid_t		*uid = NULL;
+	__ops_subpacket_t	*pkt;
+	__ops_userid_t		*uid;
 
 	uid = __ops_add_userid(keydata, userid);
 	pkt = __ops_add_subpacket(keydata, sigpacket);
@@ -503,7 +503,7 @@
 unsigned 
 __ops_add_selfsigned_userid(__ops_key_t *keydata, __ops_userid_t *userid)
 {
-	__ops_create_sig_t	*sig = NULL;
+	__ops_create_sig_t	*sig;
 	__ops_subpacket_t	 sigpacket;
 	__ops_memory_t		*mem_userid = NULL;
 	__ops_output_t		*useridoutput = NULL;
@@ -704,9 +704,9 @@
 				const unsigned armour,
 				__ops_memory_t *mem)
 {
-	__ops_stream_t	*stream = NULL;
-	const unsigned		 noaccum = 0;
-	unsigned		 res = 1;
+	__ops_stream_t	*stream;
+	const unsigned	 noaccum = 0;
+	unsigned	 res;
 
 	stream = __ops_new(sizeof(*stream));
 	__ops_parse_options(stream, OPS_PTAG_SS_ALL, OPS_PARSE_PARSED);
@@ -715,7 +715,7 @@
 	if (armour) {
 		__ops_reader_push_dearmour(stream);
 	}
-	res = __ops_parse_and_accumulate(keyring, stream);
+	res = (unsigned)__ops_parse_and_accumulate(keyring, stream);
 	__ops_print_errors(__ops_stream_get_errors(stream));
 	if (armour) {
 		__ops_reader_pop_dearmour(stream);
@@ -851,7 +851,7 @@
 	unsigned int    	 i = 0;
 	size_t          	 len;
 	char	                *cp;
-	unsigned             	 n = 0;
+	unsigned             	 n;
 
 	if (!keyring) {
 		return NULL;
@@ -862,7 +862,7 @@
 		for (i = 0, uidp = keyp->uids; i < keyp->uidc; i++, uidp++) {
 			if (__ops_get_debug_level(__FILE__)) {
 				(void) fprintf(io->outs,
-					"[%d][%d] name %s, last '%d'\n",
+					"[%u][%u] name %s, last '%d'\n",
 					n, i, uidp->userid,
 					uidp->userid[len]);
 			}
@@ -950,7 +950,7 @@
 	__ops_key_t		*key;
 	unsigned		 n;
 
-	(void) fprintf(io->res, "%d keys\n", keyring->keyc);
+	(void) fprintf(io->res, "%u keys\n", keyring->keyc);
 	for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) {
 		if (__ops_is_key_secret(key)) {
 			__ops_print_seckeydata(io, key);

Reply via email to