aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authordinoex <dinoex@FreeBSD.org>2018-03-05 01:45:26 +0800
committerdinoex <dinoex@FreeBSD.org>2018-03-05 01:45:26 +0800
commit37fe67a63dfe40ddb11cf66e853700c5bd5af357 (patch)
treebb66309fc5ef7e0d9ababa2ad9653b2a4d96c1df /mail
parent53d66819731f4451e21411ee89fd7c1af4ab5ed2 (diff)
downloadfreebsd-ports-gnome-37fe67a63dfe40ddb11cf66e853700c5bd5af357.tar.gz
freebsd-ports-gnome-37fe67a63dfe40ddb11cf66e853700c5bd5af357.tar.zst
freebsd-ports-gnome-37fe67a63dfe40ddb11cf66e853700c5bd5af357.zip
- fix build with openssl 1.1 and libressl
Diffstat (limited to 'mail')
-rw-r--r--mail/sendmail/Makefile2
-rw-r--r--mail/sendmail/files/patch-sm_os_freebsd.h (renamed from mail/sendmail/files/patch-include_sm_os_sm__os__freebsd.h)0
-rw-r--r--mail/sendmail/files/patch-tls.c184
3 files changed, 185 insertions, 1 deletions
diff --git a/mail/sendmail/Makefile b/mail/sendmail/Makefile
index 097180b25d7f..b0f3ffd00128 100644
--- a/mail/sendmail/Makefile
+++ b/mail/sendmail/Makefile
@@ -2,7 +2,7 @@
PORTNAME= sendmail
PORTVERSION= 8.15.2
-PORTREVISION= 7
+PORTREVISION= 8
CATEGORIES= mail ipv6
MASTER_SITES= ftp://ftp.sendmail.org/pub/sendmail/
PKGNAMESUFFIX?= ${TLS_SUFFIX}${SASL_SUFFIX}${LDAP_SUFFIX}${BDB_SUFFIX}${PKGNAMESUFFIX2}
diff --git a/mail/sendmail/files/patch-include_sm_os_sm__os__freebsd.h b/mail/sendmail/files/patch-sm_os_freebsd.h
index 427c6d1c3a15..427c6d1c3a15 100644
--- a/mail/sendmail/files/patch-include_sm_os_sm__os__freebsd.h
+++ b/mail/sendmail/files/patch-sm_os_freebsd.h
diff --git a/mail/sendmail/files/patch-tls.c b/mail/sendmail/files/patch-tls.c
new file mode 100644
index 000000000000..59e2cda8bc7e
--- /dev/null
+++ b/mail/sendmail/files/patch-tls.c
@@ -0,0 +1,184 @@
+--- sendmail/tls.c.orig 2015-06-20 01:37:28 UTC
++++ sendmail/tls.c
+@@ -16,6 +16,9 @@ SM_RCSID("@(#)$Id: tls.c,v 8.127 2013-11
+ # include <openssl/err.h>
+ # include <openssl/bio.h>
+ # include <openssl/pem.h>
++# if !NO_DH
++# include <openssl/dh.h>
++# endif /* !NO_DH */
+ # ifndef HASURANDOMDEV
+ # include <openssl/rand.h>
+ # endif /* ! HASURANDOMDEV */
+@@ -44,6 +47,22 @@ static bool tls_safe_f __P((char *, long
+ static int tls_verify_log __P((int, X509_STORE_CTX *, const char *));
+
+ # if !NO_DH
++# if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100001L || \
++ defined(LIBRESSL_VERSION_NUMBER)
++static int
++DH_set0_pqg(dh, p, q, g)
++ DH *dh;
++ BIGNUM *p;
++ BIGNUM *q;
++ BIGNUM *g;
++{
++ dh->p=p;
++ dh->q=q;
++ dh->g=g;
++ return 1; /* success */
++}
++# endif /* !defined() || OPENSSL_VERSION_NUMBER < 0x00907000L */
++
+ static DH *get_dh512 __P((void));
+
+ static unsigned char dh512_p[] =
+@@ -64,13 +83,21 @@ static DH *
+ get_dh512()
+ {
+ DH *dh = NULL;
++ BIGNUM *dhp_bn, *dhg_bn;
+
+ if ((dh = DH_new()) == NULL)
+ return NULL;
+- dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
+- dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
+- if ((dh->p == NULL) || (dh->g == NULL))
+- return NULL;
++ dhp_bn=BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
++ dhg_bn=BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
++ if ((dhp_bn == NULL) || (dhg_bn == NULL) || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn))
++ {
++ DH_free(dh);
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
++ return(NULL);
++ }
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
+ return dh;
+ }
+
+@@ -117,16 +144,21 @@ get_dh2048()
+ };
+ static unsigned char dh2048_g[]={ 0x02, };
+ DH *dh;
++ BIGNUM *dhp_bn, *dhg_bn;
+
+ if ((dh=DH_new()) == NULL)
+ return(NULL);
+- dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
+- dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
+- if ((dh->p == NULL) || (dh->g == NULL))
++ dhp_bn=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
++ dhg_bn=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
++ if ((dhp_bn == NULL) || (dhg_bn == NULL) || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn))
+ {
+ DH_free(dh);
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
+ return(NULL);
+ }
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
+ return(dh);
+ }
+ # endif /* !NO_DH */
+@@ -708,6 +740,44 @@ load_certkey(ssl, srv, certfile, keyfile
+
+ static char server_session_id_context[] = "sendmail8";
+
++# if !TLS_NO_RSA
++static RSA *
++sm_RSA_generate_key(num, e)
++ int num;
++ unsigned long e;
++{
++ RSA *rsa;
++ BIGNUM *bn_rsa_r4;
++ int rc;
++
++ rsa = RSA_new();
++ if (rsa == NULL)
++ {
++ if (LogLevel > 0)
++ sm_syslog(LOG_ERR, NOQID,
++ "STARTTLS=server, tmp_rsa_key: RSA_new failed!");
++ return NULL;
++ }
++ rc = BN_set_word(bn_rsa_r4, RSA_F4);
++ if (rc == 0)
++ {
++ if (LogLevel > 0)
++ sm_syslog(LOG_ERR, NOQID,
++ "STARTTLS=server, tmp_rsa_key: BN_set_word failed!");
++ RSA_free(rsa);
++ return NULL;
++ }
++ rc = RSA_generate_key_ex(rsa, RSA_KEYLENGTH, bn_rsa_r4, NULL);
++ BN_free(bn_rsa_r4);
++ if (rc != 0)
++ {
++ RSA_free(rsa);
++ return NULL;
++ }
++ return rsa;
++}
++# endif /* !TLS_NO_RSA */
++
+ /* 0.9.8a and b have a problem with SSL_OP_TLS_BLOCK_PADDING_BUG */
+ #if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+ # define SM_SSL_OP_TLS_BLOCK_PADDING_BUG 1
+@@ -926,7 +996,7 @@ inittls(ctx, req, options, srv, certfile
+ {
+ /* get a pointer to the current certificate validation store */
+ store = SSL_CTX_get_cert_store(*ctx); /* does not fail */
+- crl_file = BIO_new(BIO_s_file_internal());
++ crl_file = BIO_new(BIO_s_file());
+ if (crl_file != NULL)
+ {
+ if (BIO_read_filename(crl_file, CRLFile) >= 0)
+@@ -1003,8 +1073,7 @@ inittls(ctx, req, options, srv, certfile
+ if (bitset(TLS_I_RSA_TMP, req)
+ # if SM_CONF_SHM
+ && ShmId != SM_SHM_NO_ID &&
+- (rsa_tmp = RSA_generate_key(RSA_KEYLENGTH, RSA_F4, NULL,
+- NULL)) == NULL
++ (rsa_tmp = sm_RSA_generate_key(RSA_KEYLENGTH, RSA_F4)) == NULL
+ # else /* SM_CONF_SHM */
+ && 0 /* no shared memory: no need to generate key now */
+ # endif /* SM_CONF_SHM */
+@@ -1209,9 +1278,10 @@ inittls(ctx, req, options, srv, certfile
+ if (tTd(96, 2))
+ sm_dprintf("inittls: Generating %d bit DH parameters\n", bits);
+
++ dsa=DSA_new();
+ /* this takes a while! */
+- dsa = DSA_generate_parameters(bits, NULL, 0, NULL,
+- NULL, 0, NULL);
++ (void)DSA_generate_parameters_ex(dsa, bits, NULL, 0,
++ NULL, NULL, NULL);
+ dh = DSA_dup_DH(dsa);
+ DSA_free(dsa);
+ }
+@@ -1744,7 +1814,7 @@ tmp_rsa_key(s, export, keylength)
+
+ if (rsa_tmp != NULL)
+ RSA_free(rsa_tmp);
+- rsa_tmp = RSA_generate_key(RSA_KEYLENGTH, RSA_F4, NULL, NULL);
++ rsa_tmp = sm_RSA_generate_key(RSA_KEYLENGTH, RSA_F4);
+ if (rsa_tmp == NULL)
+ {
+ if (LogLevel > 0)
+@@ -1971,9 +2041,9 @@ x509_verify_cb(ok, ctx)
+ {
+ if (LogLevel > 13)
+ tls_verify_log(ok, ctx, "x509");
+- if (ctx->error == X509_V_ERR_UNABLE_TO_GET_CRL)
++ if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_UNABLE_TO_GET_CRL)
+ {
+- ctx->error = 0;
++ X509_STORE_CTX_set_error(ctx, 0);
+ return 1; /* override it */
+ }
+ }