Fixes for OpenSSL without MD2 support.

This commit is contained in:
obache 2011-12-18 11:33:42 +00:00
parent 78f0d39199
commit 3578ee84ea
3 changed files with 57 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.62 2011/12/17 12:48:23 marino Exp $
# $NetBSD: Makefile,v 1.63 2011/12/18 11:33:42 obache Exp $
DISTNAME= cue-snap-20100426
PKGNAME= ${DISTNAME:S/snap-//}
@ -10,9 +10,6 @@ HOMEPAGE= # not available
COMMENT= Mh-e like mail user agent
LICENSE= modified-bsd
# When cue supports OpenSSL 1.0 (e.g no MD2), remove following line:
NOT_FOR_PLATFORM= DragonFly-*-*
PKG_DESTDIR_SUPPORT= user-destdir
GNU_CONFIGURE= yes

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.33 2011/11/27 13:05:33 obache Exp $
$NetBSD: distinfo,v 1.34 2011/12/18 11:33:42 obache Exp $
SHA1 (cue-snap-20100426.tar.gz) = 37f758bb65a9b5e6089b23aabd655d2fdadc76e2
RMD160 (cue-snap-20100426.tar.gz) = cb908dc73c662ee22811cc4c09a64d81684eedea
Size (cue-snap-20100426.tar.gz) = 256759 bytes
SHA1 (patch-aa) = c83665ce01f9a56652a3ad650910f9b810cae4b4
SHA1 (patch-configure.in) = 3f7c2fe9ce3ab851d06cc6d4e31e8c3bdde6d709
SHA1 (patch-pgp.c) = 88f370cf04d8806c2df02653f7857460151c93f6

View file

@ -0,0 +1,54 @@
$NetBSD: patch-pgp.c,v 1.1 2011/12/18 11:33:42 obache Exp $
* for OpenSSL without MD2 support.
--- pgp.c.orig 2009-12-16 05:51:12.000000000 +0000
+++ pgp.c
@@ -763,7 +763,9 @@ pgp_hashalg_md(int alg)
case PGP_HASH_SHA1: return EVP_sha1();
case PGP_HASH_RIPEMD160: return EVP_ripemd160();
case PGP_HASH_DWSHA: return NULL;
+#ifndef OPENSSL_NO_MD2
case PGP_HASH_MD2: return EVP_md2();
+#endif
case PGP_HASH_TIGER192: return NULL;
case PGP_HASH_HAVAL_5_160: return NULL;
}
@@ -1418,11 +1420,13 @@ pgp_comp_data(struct pgp_pkt *pkt)
static const EVP_MD *
pgp_asn1_md(u_char **pp, int len)
{
+#ifndef OPENSSL_NO_MD2
static const u_char asn1_md2[] = {
0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x02, 0x02, 0x05, 0x00,
0x04, 0x10
};
+#endif
static const u_char asn1_md5[] = {
0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00,
@@ -1437,11 +1441,13 @@ pgp_asn1_md(u_char **pp, int len)
0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14
};
+#ifndef OPENSSL_NO_MD2
if (len > sizeof(asn1_md2)
&& memcmp(*pp, asn1_md2, sizeof(asn1_md2)) == 0) {
*pp += sizeof(asn1_md2);
return EVP_md2();
}
+#endif
if (len > sizeof(asn1_md5)
&& memcmp(*pp, asn1_md5, sizeof(asn1_md5)) == 0) {
*pp += sizeof(asn1_md5);
@@ -1969,7 +1975,9 @@ pgp_show_hashalg(int alg)
case PGP_HASH_SHA1: return "SHA1";
case PGP_HASH_RIPEMD160: return "RIPEMD160";
case PGP_HASH_DWSHA: return "DWSHA";
+#ifndef OPENSSL_NO_MD2
case PGP_HASH_MD2: return "MD2";
+#endif
case PGP_HASH_TIGER192: return "TIGER192";
case PGP_HASH_HAVAL_5_160: return "HAVAL-5-160";
}