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=<ciphername>
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 '$(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
Index: src/crypto/external/bsd/netpgp/dist/src/lib/writer.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/writer.h:1.9 src/crypto/external/bsd/netpgp/dist/src/lib/writer.h:1.10
--- src/crypto/external/bsd/netpgp/dist/src/lib/writer.h:1.9	Tue May 25 01:05:11 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/writer.h	Thu Nov  4 15:38:45 2010
@@ -114,6 +114,6 @@
 void __ops_writer_info_delete(__ops_writer_t *);
 unsigned __ops_writer_info_finalise(__ops_error_t **, __ops_writer_t *);
 
-void __ops_push_stream_enc_se_ip(__ops_output_t *, const __ops_key_t *);
+void __ops_push_stream_enc_se_ip(__ops_output_t *, const __ops_key_t *, const char *);
 
 #endif /* WRITER_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.11 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.11	Thu Nov  4 07:01:53 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/config.h.in	Thu Nov  4 15:38:45 2010
@@ -117,6 +117,10 @@
 /* Define to 1 if you have the <zlib.h> 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
 
Index: src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h:1.11 src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h:1.12
--- src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h:1.11	Fri Jul  9 05:35:35 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/readerwriter.h	Thu Nov  4 15:38:45 2010
@@ -75,7 +75,7 @@
 		       const unsigned,
 		       __ops_crypt_t *);
 void __ops_push_enc_crypt(__ops_output_t *, __ops_crypt_t *);
-int __ops_push_enc_se_ip(__ops_output_t *, const __ops_key_t *);
+int __ops_push_enc_se_ip(__ops_output_t *, const __ops_key_t *, const char *);
 
 /* Secret Key checksum */
 void __ops_push_checksum_writer(__ops_output_t *, __ops_seckey_t *);

Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.34 src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.35
--- src/crypto/external/bsd/netpgp/dist/src/lib/create.c:1.34	Wed Sep  1 17:25:57 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/create.c	Thu Nov  4 15:38:45 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.34 2010/09/01 17:25:57 agc Exp $");
+__RCSID("$NetBSD: create.c,v 1.35 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -843,31 +843,23 @@
 }
 
 static unsigned 
-create_unencoded_m_buf(__ops_pk_sesskey_t *sesskey, uint8_t *m_buf)
+create_unencoded_m_buf(__ops_pk_sesskey_t *sesskey, __ops_crypt_t *cipherinfo, uint8_t *m_buf)
 {
-	int             i;
+	unsigned	i;
 
-	/* m_buf is the buffer which will be encoded in PKCS#1 block */
-	/* encoding to form the "m" value used in the  */
-	/* Public Key Encrypted Session Key Packet */
-	/*
-	 * as defined in RFC Section 5.1 "Public-Key Encrypted Session Key
-	 * Packet"
+	/* m_buf is the buffer which will be encoded in PKCS#1 block
+	* encoding to form the "m" value used in the Public Key
+	* Encrypted Session Key Packet as defined in RFC Section 5.1
+	* "Public-Key Encrypted Session Key Packet"
 	 */
-
 	m_buf[0] = sesskey->symm_alg;
-
-	if (sesskey->symm_alg != OPS_SA_CAST5) {
-		(void) fprintf(stderr, "create_unencoded_m_buf: symm alg\n");
-		return 0;
-	}
-	for (i = 0; i < CAST_KEY_LENGTH; i++) {
+	for (i = 0; i < cipherinfo->keysize ; i++) {
 		/* XXX - Flexelint - Warning 679: Suspicious Truncation in arithmetic expression combining with pointer */
 		m_buf[1 + i] = sesskey->key[i];
 	}
 
-	return (__ops_calc_sesskey_checksum(sesskey,
-				m_buf + 1 + CAST_KEY_LENGTH));
+	return __ops_calc_sesskey_checksum(sesskey,
+				m_buf + 1 + cipherinfo->keysize);
 }
 
 /**
@@ -940,24 +932,21 @@
 \note Currently hard-coded to use RSA
 */
 __ops_pk_sesskey_t *
-__ops_create_pk_sesskey(const __ops_key_t *key)
+__ops_create_pk_sesskey(const __ops_key_t *key, const char *ciphername)
 {
 	/*
          * Creates a random session key and encrypts it for the given key
          *
-         * Session Key is for use with a SK algo,
-         * can be any, we're hardcoding CAST5 for now
-         *
          * Encryption used is PK,
          * can be any, we're hardcoding RSA for now
          */
 
-#define SZ_UNENCODED_M_BUF (CAST_KEY_LENGTH + 1 + 2)
-
 	const __ops_pubkey_t	*pubkey;
 	__ops_pk_sesskey_t	*sesskey;
+	__ops_symm_alg_t	 cipher;
 	const uint8_t		*id;
-	uint8_t			 unencoded_m_buf[SZ_UNENCODED_M_BUF];
+	__ops_crypt_t		 cipherinfo;
+	uint8_t			*unencoded_m_buf;
 	uint8_t			*encoded_m_buf;
 	size_t			 sz_encoded_m_buf;
 
@@ -968,21 +957,34 @@
 		pubkey = &key->enckey;
 		id = key->encid;
 	}
+	/* allocate unencoded_m_buf here */
+	(void) memset(&cipherinfo, 0x0, sizeof(cipherinfo));
+	__ops_crypt_any(&cipherinfo,
+		cipher = __ops_str_to_cipher((ciphername) ? ciphername : "cast5"));
+	unencoded_m_buf = calloc(1, cipherinfo.keysize + 1 + 2);
+	if (unencoded_m_buf == NULL) {
+		(void) fprintf(stderr,
+			"__ops_create_pk_sesskey: can't allocate\n");
+		return NULL;
+	}
 	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");
+		free(unencoded_m_buf);
 		return NULL;
 	}
 	if ((sesskey = calloc(1, sizeof(*sesskey))) == NULL) {
 		(void) fprintf(stderr,
 			"__ops_create_pk_sesskey: can't allocate\n");
+		free(unencoded_m_buf);
 		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(unencoded_m_buf);
 		free(encoded_m_buf);
 		free(sesskey);
 		return NULL;
@@ -1001,34 +1003,37 @@
 	default:
 		(void) fprintf(stderr,
 			"__ops_create_pk_sesskey: bad pubkey algorithm\n");
+		free(unencoded_m_buf);
 		free(encoded_m_buf);
 		free(sesskey);
 		return NULL;
 	}
 	sesskey->alg = pubkey->alg;
 
-	/* \todo allow user to specify other algorithm */
-	sesskey->symm_alg = OPS_SA_CAST5;
-	__ops_random(sesskey->key, CAST_KEY_LENGTH);
+	sesskey->symm_alg = cipher;
+	__ops_random(sesskey->key, cipherinfo.keysize);
 
 	if (__ops_get_debug_level(__FILE__)) {
-		hexdump(stderr, "CAST5 sesskey created", sesskey->key, CAST_KEY_LENGTH);
+		hexdump(stderr, "sesskey created", sesskey->key,
+			cipherinfo.keysize + 1 + 2);
 	}
-	if (create_unencoded_m_buf(sesskey, &unencoded_m_buf[0]) == 0) {
+	if (create_unencoded_m_buf(sesskey, &cipherinfo, &unencoded_m_buf[0]) == 0) {
+		free(unencoded_m_buf);
 		free(encoded_m_buf);
 		free(sesskey);
 		return NULL;
 	}
 	if (__ops_get_debug_level(__FILE__)) {
-		hexdump(stderr, "uuencoded m buf", unencoded_m_buf, SZ_UNENCODED_M_BUF);
+		hexdump(stderr, "uuencoded m buf", unencoded_m_buf, cipherinfo.keysize + 1 + 2);
 	}
-	encode_m_buf(unencoded_m_buf, SZ_UNENCODED_M_BUF, pubkey, encoded_m_buf);
+	encode_m_buf(unencoded_m_buf, cipherinfo.keysize + 1 + 2, pubkey, encoded_m_buf);
 
 	/* and encrypt it */
 	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(unencoded_m_buf);
 			free(encoded_m_buf);
 			free(sesskey);
 			return NULL;
@@ -1037,6 +1042,7 @@
 	case OPS_PKA_DSA:
 	case OPS_PKA_ELGAMAL:
 		(void) fprintf(stderr, "DSA/Elgamal encryption not supported yet\n");
+		free(unencoded_m_buf);
 		free(encoded_m_buf);
 		free(sesskey);
 		return NULL;
@@ -1044,6 +1050,7 @@
 		/* will not get here - for lint only */
 		break;
 	}
+	free(unencoded_m_buf);
 	free(encoded_m_buf);
 	return sesskey;
 }

Index: src/crypto/external/bsd/netpgp/dist/src/lib/create.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/create.h:1.10 src/crypto/external/bsd/netpgp/dist/src/lib/create.h:1.11
--- src/crypto/external/bsd/netpgp/dist/src/lib/create.h:1.10	Tue May 25 01:05:10 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/create.h	Thu Nov  4 15:38:45 2010
@@ -91,7 +91,7 @@
 				const uint8_t *,
 				const int,
 				const __ops_litdata_enum);
-__ops_pk_sesskey_t *__ops_create_pk_sesskey(const __ops_key_t *);
+__ops_pk_sesskey_t *__ops_create_pk_sesskey(const __ops_key_t *, const char *);
 unsigned __ops_write_pk_sesskey(__ops_output_t *, __ops_pk_sesskey_t *);
 unsigned __ops_write_xfer_pubkey(__ops_output_t *,
 				const __ops_key_t *, const unsigned);

Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.28 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.29
--- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c:1.28	Wed Sep  8 03:21:22 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.c	Thu Nov  4 15:38:45 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.28 2010/09/08 03:21:22 agc Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.29 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -305,7 +305,8 @@
 			const char *outfile,
 			const __ops_key_t *key,
 			const unsigned use_armour,
-			const unsigned allow_overwrite)
+			const unsigned allow_overwrite,
+			const char *cipher)
 {
 	__ops_output_t	*output;
 	__ops_memory_t	*inmem;
@@ -328,7 +329,7 @@
 	}
 
 	/* Push the encrypted writer */
-	if (!__ops_push_enc_se_ip(output, key)) {
+	if (!__ops_push_enc_se_ip(output, key, cipher)) {
 		__ops_memory_free(inmem);
 		return 0;
 	}
@@ -349,7 +350,8 @@
 			const void *input,
 			const size_t insize,
 			const __ops_key_t *pubkey,
-			const unsigned use_armour)
+			const unsigned use_armour,
+			const char *cipher)
 {
 	__ops_output_t	*output;
 	__ops_memory_t	*outmem;
@@ -369,7 +371,7 @@
 	}
 
 	/* Push the encrypted writer */
-	__ops_push_enc_se_ip(output, pubkey);
+	__ops_push_enc_se_ip(output, pubkey, cipher);
 
 	/* This does the writing */
 	__ops_write(output, input, (unsigned)insize);
Index: src/crypto/external/bsd/netpgp/dist/src/lib/writer.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.28 src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.29
--- src/crypto/external/bsd/netpgp/dist/src/lib/writer.c:1.28	Sun Aug 15 16:36:24 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/writer.c	Thu Nov  4 15:38:45 2010
@@ -58,7 +58,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: writer.c,v 1.28 2010/08/15 16:36:24 agc Exp $");
+__RCSID("$NetBSD: writer.c,v 1.29 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1026,7 +1026,7 @@
 \brief Push Encrypted SE IP Writer onto stack
 */
 int 
-__ops_push_enc_se_ip(__ops_output_t *output, const __ops_key_t *pubkey)
+__ops_push_enc_se_ip(__ops_output_t *output, const __ops_key_t *pubkey, const char *cipher)
 {
 	__ops_pk_sesskey_t *encrypted_pk_sesskey;
 	encrypt_se_ip_t *se_ip;
@@ -1039,7 +1039,7 @@
 	}
 
 	/* Create and write encrypted PK session key */
-	if ((encrypted_pk_sesskey = __ops_create_pk_sesskey(pubkey)) == NULL) {
+	if ((encrypted_pk_sesskey = __ops_create_pk_sesskey(pubkey, cipher)) == NULL) {
 		(void) fprintf(stderr, "__ops_push_enc_se_ip: null pk sesskey\n");
 		return 0;
 	}
@@ -1409,7 +1409,7 @@
 \param pubkey
 */
 void 
-__ops_push_stream_enc_se_ip(__ops_output_t *output, const __ops_key_t *pubkey)
+__ops_push_stream_enc_se_ip(__ops_output_t *output, const __ops_key_t *pubkey, const char *cipher)
 {
 	__ops_pk_sesskey_t	*encrypted_pk_sesskey;
 	str_enc_se_ip_t		*se_ip;
@@ -1422,7 +1422,7 @@
 			"__ops_push_stream_enc_se_ip: bad alloc\n");
 		return;
 	}
-	encrypted_pk_sesskey = __ops_create_pk_sesskey(pubkey);
+	encrypted_pk_sesskey = __ops_create_pk_sesskey(pubkey, cipher);
 	__ops_write_pk_sesskey(output, encrypted_pk_sesskey);
 
 	/* Setup the se_ip */

Index: src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.23 src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.24
--- src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h:1.23	Thu Nov  4 06:45:28 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/crypto.h	Thu Nov  4 15:38:45 2010
@@ -169,7 +169,7 @@
 
 unsigned   __ops_encrypt_file(__ops_io_t *, const char *, const char *,
 			const __ops_key_t *,
-			const unsigned, const unsigned);
+			const unsigned, const unsigned, const char *);
 unsigned   __ops_decrypt_file(__ops_io_t *,
 			const char *,
 			const char *,
@@ -182,11 +182,9 @@
 			__ops_cbfunc_t *);
 
 __ops_memory_t *
-__ops_encrypt_buf(__ops_io_t *,
-			const void *,
-			const size_t,
+__ops_encrypt_buf(__ops_io_t *, const void *, const size_t,
 			const __ops_key_t *,
-			const unsigned);
+			const unsigned, const char *);
 __ops_memory_t *
 __ops_decrypt_buf(__ops_io_t *,
 			const void *,

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.79 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.80
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.79	Thu Nov  4 06:45:28 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Thu Nov  4 15:38:45 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.79 2010/11/04 06:45:28 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.80 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1189,7 +1189,7 @@
 		out = outname;
 	}
 	return (int)__ops_encrypt_file(io, f, out, key, (unsigned)armored,
-					overwrite);
+				overwrite, netpgp_getvar(netpgp, "cipher"));
 }
 
 #define ARMOR_HEAD	"-----BEGIN PGP MESSAGE-----"
@@ -1494,7 +1494,8 @@
 			"netpgp_encrypt_buf: input size is larger than output size\n");
 		return 0;
 	}
-	enc = __ops_encrypt_buf(io, in, insize, keypair, (unsigned)armored);
+	enc = __ops_encrypt_buf(io, in, insize, keypair, (unsigned)armored,
+				netpgp_getvar(netpgp, "cipher"));
 	m = MIN(__ops_mem_len(enc), outsize);
 	(void) memcpy(out, __ops_mem_data(enc), m);
 	__ops_memory_free(enc);

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.42 src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.43
--- src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c:1.42	Wed Sep  8 03:21:22 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/packet-parse.c	Thu Nov  4 15:38:45 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.42 2010/09/08 03:21:22 agc Exp $");
+__RCSID("$NetBSD: packet-parse.c,v 1.43 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #ifdef HAVE_OPENSSL_CAST_H
@@ -2651,10 +2651,7 @@
 	unsigned		 k;
 	BIGNUM			*enc_m;
 	int			 n;
-	/* Can't rely on it being CAST5 */
-	/* \todo FIXME RW */
-	/* const size_t sz_unencoded_m_buf=CAST_KEY_LENGTH+1+2; */
-	uint8_t		 unencoded_m_buf[1024];
+	uint8_t		 	 unencoded_m_buf[1024];
 
 	if (!limread(&c, 1, region, stream)) {
 		return 0;

Index: src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.15 src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.16
--- src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c:1.15	Thu Nov  4 07:35:08 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/symmetric.c	Thu Nov  4 15:38:45 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.15 2010/11/04 07:35:08 agc Exp $");
+__RCSID("$NetBSD: symmetric.c,v 1.16 2010/11/04 15:38:45 agc Exp $");
 #endif
 
 #include "crypto.h"
@@ -757,6 +757,10 @@
 	case OPS_SA_AES_256:
 	case OPS_SA_CAST5:
 	case OPS_SA_TRIPLEDES:
+#ifndef OPENSSL_NO_CAMELLIA
+	case OPS_SA_CAMELLIA_128:
+	case OPS_SA_CAMELLIA_256:
+#endif
 #ifndef OPENSSL_NO_IDEA
 	case OPS_SA_IDEA:
 #endif

Reply via email to