pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mail/enma enma: Fix building with OpenSSL 1.1. From Fr...
details: https://anonhg.NetBSD.org/pkgsrc/rev/827c0c139b22
branches: trunk
changeset: 425118:827c0c139b22
user: nia <nia%pkgsrc.org@localhost>
date: Thu Mar 19 10:52:11 2020 +0000
description:
enma: Fix building with OpenSSL 1.1. From FreeBSD Ports.
diffstat:
mail/enma/distinfo | 4 +-
mail/enma/patches/patch-libsauth_src_dkimdigester.c | 158 +++++++++++++++++++
mail/enma/patches/patch-libsauth_src_dkimpublickey.c | 22 ++
3 files changed, 183 insertions(+), 1 deletions(-)
diffs (202 lines):
diff -r 88af2dc51a58 -r 827c0c139b22 mail/enma/distinfo
--- a/mail/enma/distinfo Thu Mar 19 10:48:08 2020 +0000
+++ b/mail/enma/distinfo Thu Mar 19 10:52:11 2020 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.5 2015/11/03 23:27:04 agc Exp $
+$NetBSD: distinfo,v 1.6 2020/03/19 10:52:11 nia Exp $
SHA1 (enma-1.2.0.tar.gz) = 91d3863dc144c8567d18744d8219b8d0049ebe75
RMD160 (enma-1.2.0.tar.gz) = 80c38ba76d2a51a8703bbc3d2073dbd8aaa51f22
SHA512 (enma-1.2.0.tar.gz) = f7829a0746aebd738424cd339032b27899e06ac3779993b59e967575ad4535ee5ea4b92d09cd5ddc54e3ce89b82f1b753e11edc3e334cf71d330dd33d5ef3b74
Size (enma-1.2.0.tar.gz) = 411233 bytes
SHA1 (patch-ac) = a97b34f626e3ee2c6e4c61ecf412b9ae044ce083
+SHA1 (patch-libsauth_src_dkimdigester.c) = 25b9111bd99ffffdb24db92a086365633b2152e1
+SHA1 (patch-libsauth_src_dkimpublickey.c) = 0bbf047de855db9022812dad00455c875ab58943
diff -r 88af2dc51a58 -r 827c0c139b22 mail/enma/patches/patch-libsauth_src_dkimdigester.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/enma/patches/patch-libsauth_src_dkimdigester.c Thu Mar 19 10:52:11 2020 +0000
@@ -0,0 +1,158 @@
+$NetBSD: patch-libsauth_src_dkimdigester.c,v 1.1 2020/03/19 10:52:11 nia Exp $
+
+Fix building with OpenSSL 1.1.
+
+From Yoshihiro Takahashi / FreeBSD Ports.
+
+--- libsauth/src/dkimdigester.c.orig 2011-10-16 08:08:36.000000000 +0000
++++ libsauth/src/dkimdigester.c
+@@ -32,12 +32,17 @@ RCSID("$Id: dkimdigester.c 1365 2011-10-
+ #include "dkimpolicybase.h"
+ #include "dkimdigester.h"
+
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
++#define EVP_MD_CTX_new EVP_MD_CTX_create
++#define EVP_MD_CTX_free EVP_MD_CTX_destroy
++#endif
++
+ struct DkimDigester {
+ const DkimPolicyBase *policy;
+ const EVP_MD *digest_alg;
+ int pubkey_alg;
+- EVP_MD_CTX header_digest;
+- EVP_MD_CTX body_digest;
++ EVP_MD_CTX *header_digest;
++ EVP_MD_CTX *body_digest;
+ DkimCanonicalizer *canon;
+ /// body length limit. sig-l-tag itself. -1 for unlimited.
+ long long body_length_limit;
+@@ -210,13 +215,23 @@ DkimDigester_new(const DkimPolicyBase *p
+ if (NULL == self->canon) {
+ goto cleanup;
+ } // end if
+- if (0 == EVP_DigestInit(&(self->header_digest), self->digest_alg)) {
++ if (NULL == (self->header_digest = EVP_MD_CTX_new())) {
++ DkimLogNoResource(self->policy);
++ DkimDigester_free(self);
++ return DSTAT_SYSERR_NORESOURCE;
++ } // end if
++ if (0 == EVP_DigestInit(self->header_digest, self->digest_alg)) {
+ DkimLogSysError(policy, "Digest Initialization (of header) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ SETDEREF(dstat, DSTAT_SYSERR_NORESOURCE);
+ goto cleanup;
+ } // end if
+- if (0 == EVP_DigestInit(&(self->body_digest), self->digest_alg)) {
++ if (NULL == (self->body_digest = EVP_MD_CTX_new())) {
++ DkimLogNoResource(self->policy);
++ DkimDigester_free(self);
++ return DSTAT_SYSERR_NORESOURCE;
++ } // end if
++ if (0 == EVP_DigestInit(self->body_digest, self->digest_alg)) {
+ DkimLogSysError(policy, "Digest Initialization (of body) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ SETDEREF(dstat, DSTAT_SYSERR_NORESOURCE);
+@@ -246,8 +261,13 @@ DkimDigester_free(DkimDigester *self)
+ if (NULL != self->canon) {
+ DkimCanonicalizer_free(self->canon);
+ } // end if
+- (void) EVP_MD_CTX_cleanup(&(self->header_digest));
+- (void) EVP_MD_CTX_cleanup(&(self->body_digest));
++
++ if (NULL != self->header_digest) {
++ EVP_MD_CTX_free(self->header_digest);
++ }
++ if (NULL != self->body_digest) {
++ EVP_MD_CTX_free(self->body_digest);
++ }
+
+ // No need to clean up "self->digest_alg"
+
+@@ -289,7 +309,7 @@ DkimDigester_updateBodyChunk(DkimDigeste
+ } // end if
+
+ if (0 < srclen) {
+- if (0 == EVP_DigestUpdate(&self->body_digest, buf, srclen)) {
++ if (0 == EVP_DigestUpdate(self->body_digest, buf, srclen)) {
+ DkimLogSysError(self->policy, "Digest update (of body) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
+@@ -360,7 +380,7 @@ DkimDigester_updateHeader(DkimDigester *
+ // discard errors occurred in functions for debugging
+ (void) DkimDigester_dumpCanonicalizedHeader(self, canonbuf, canonsize);
+
+- if (0 == EVP_DigestUpdate(&self->header_digest, canonbuf, canonsize)) {
++ if (0 == EVP_DigestUpdate(self->header_digest, canonbuf, canonsize)) {
+ DkimLogSysError(self->policy, "Digest update (of header) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
+@@ -487,7 +507,7 @@ DkimDigester_updateSignatureHeader(DkimD
+ (void) DkimDigester_dumpCanonicalizedHeader(self, canonbuf, canonsize);
+
+ // update digest
+- if (0 == EVP_DigestUpdate(&self->header_digest, canonbuf, canonsize)) {
++ if (0 == EVP_DigestUpdate(self->header_digest, canonbuf, canonsize)) {
+ DkimLogSysError(self->policy, "Digest update (of signature header) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
+@@ -524,9 +544,9 @@ DkimDigester_verifyMessage(DkimDigester
+
+ // check if the type of the public key is suitable for the algorithm
+ // specified by sig-a-tag of the DKIM-Signature header.
+- if (publickey->type != self->pubkey_alg) {
++ if (EVP_PKEY_base_id(publickey) != self->pubkey_alg) {
+ DkimLogPermFail(self->policy, "Public key algorithm mismatch: signature=0x%x, pubkey=0x%x",
+- publickey->type, self->pubkey_alg);
++ EVP_PKEY_base_id(publickey), self->pubkey_alg);
+ return DSTAT_PERMFAIL_PUBLICKEY_TYPE_MISMATCH;
+ } // end if
+
+@@ -541,7 +561,7 @@ DkimDigester_verifyMessage(DkimDigester
+ if (DSTAT_OK != ret) {
+ return ret;
+ } // end if
+- if (0 == EVP_DigestFinal(&self->body_digest, md, &mdlen)) {
++ if (0 == EVP_DigestFinal(self->body_digest, md, &mdlen)) {
+ DkimLogSysError(self->policy, "Digest finish (of body) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
+@@ -573,7 +593,7 @@ DkimDigester_verifyMessage(DkimDigester
+ const XBuffer *headerhash = DkimSignature_getSignatureValue(signature);
+ signbuf = (const unsigned char *) XBuffer_getBytes(headerhash);
+ signlen = XBuffer_getSize(headerhash);
+- int vret = EVP_VerifyFinal(&self->header_digest, signbuf, signlen, publickey);
++ int vret = EVP_VerifyFinal(self->header_digest, signbuf, signlen, publickey);
+ // EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some other error occurred.
+ switch (vret) {
+ case 1: // the signature is correct
+@@ -614,10 +634,10 @@ DkimDigester_signMessage(DkimDigester *s
+ assert(NULL != privatekey);
+
+ // XXX signature ã?¨ self ã?®ç½²å??/ã??ã?¤ã?¸ã?§ã?¹ã??ã?¢ã?«ã?´ã?ªã?ºã? ã??ä¸?è?´ã??ã?¦ã??ã??ã??確èª?ã??ã??æ?¹ã??ã??ã??
+- if (privatekey->type != self->pubkey_alg) {
++ if (EVP_PKEY_base_id(privatekey) != self->pubkey_alg) {
+ DkimLogPermFail(self->policy,
+ "Public key algorithm mismatch: signature=0x%x, privatekey=0x%x",
+- privatekey->type, self->pubkey_alg);
++ EVP_PKEY_base_id(privatekey), self->pubkey_alg);
+ return DSTAT_PERMFAIL_PUBLICKEY_TYPE_MISMATCH;
+ } // end if
+
+@@ -636,7 +656,7 @@ DkimDigester_signMessage(DkimDigester *s
+ unsigned char bodyhashbuf[EVP_MD_size(self->digest_alg)]; // EVP_MAX_MD_SIZE instead of EVP_MD_size() is safer(?)
+ unsigned int bodyhashlen;
+ bodyhashlen = EVP_MD_size(self->digest_alg);
+- if (0 == EVP_DigestFinal(&self->body_digest, bodyhashbuf, &bodyhashlen)) {
++ if (0 == EVP_DigestFinal(self->body_digest, bodyhashbuf, &bodyhashlen)) {
+ DkimLogSysError(self->policy, "DigestFinal (of body) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
+@@ -676,7 +696,7 @@ DkimDigester_signMessage(DkimDigester *s
+
+ unsigned char signbuf[EVP_PKEY_size(privatekey)];
+ unsigned int signlen;
+- if (0 == EVP_SignFinal(&self->header_digest, signbuf, &signlen, privatekey)) {
++ if (0 == EVP_SignFinal(self->header_digest, signbuf, &signlen, privatekey)) {
+ DkimLogSysError(self->policy, "SignFinal (of body) failed");
+ DkimDigester_logOpenSSLErrors(self);
+ return DSTAT_SYSERR_DIGEST_UPDATE_FAILURE;
diff -r 88af2dc51a58 -r 827c0c139b22 mail/enma/patches/patch-libsauth_src_dkimpublickey.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/enma/patches/patch-libsauth_src_dkimpublickey.c Thu Mar 19 10:52:11 2020 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-libsauth_src_dkimpublickey.c,v 1.1 2020/03/19 10:52:11 nia Exp $
+
+Fix building with OpenSSL 1.1.
+
+From Yoshihiro Takahashi / FreeBSD Ports.
+
+--- libsauth/src/dkimpublickey.c.orig 2011-11-07 02:09:09.000000000 +0000
++++ libsauth/src/dkimpublickey.c
+@@ -398,11 +398,11 @@ DkimPublicKey_build(const DkimPolicyBase
+ // compare key type key-k-tag declared and stored in key-p-tag
+ switch (self->keytype) {
+ case DKIM_KEY_TYPE_RSA:
+- if (EVP_PKEY_RSA != EVP_PKEY_type(self->pkey->type)) {
++ if (EVP_PKEY_RSA != EVP_PKEY_base_id(self->pkey)) {
+ DkimLogPermFail
+ (policy,
+ "key-k-tag and key-p-tag doesn't match: domain=%s, keyalg=0x%x, keytype=0x%x",
+- domain, self->keytype, EVP_PKEY_type(self->pkey->type));
++ domain, self->keytype, EVP_PKEY_base_id(self->pkey));
+ SETDEREF(dstat, DSTAT_PERMFAIL_PUBLICKEY_TYPE_MISMATCH);
+ goto cleanup;
+ } // end if
Home |
Main Index |
Thread Index |
Old Index