Commit Diff


commit - 736df1a6f70f93d0023fb56e6099621ed3ec0e85
commit + 7258013668ef07ebc2c942108e7b4851c327adaa
blob - 5d624678a5b36aa0d0c091f0f8b0c6c361bf579d
blob + 7bae5abbdcb0556f822c31364031109be9f2c88a
--- Makefile
+++ Makefile
@@ -7,9 +7,21 @@ MANDIR=		${LOCALBASE}/man/man
 
 SRCS+=		main.c ltok.c unpack_dns.c
 
+.ifdef HAVE_ED25519
+CFLAGS+=	-DHAVE_ED25519
+.endif
+.ifdef LIBCRYPTOPC
+CRYPT_CFLAGS!=	pkg-config --cflags ${LIBCRYPTOPC}
+CRYPT_LDFLAGS_L!=pkg-config --libs-only-L ${LIBCRYPTOPC}
+CRYPT_LDFLAGS_libdir!=pkg-config --variable libdir ${LIBCRYPTOPC}
+CRYPT_LDFLAGS=	${CRYPT_LDFLAGS_L}
+CRYPT_LDFLAGS+=	-Wl,-rpath,${CRYPT_LDFLAGS_libdir}
+CRYPT_LDADD!=	pkg-config --libs-only-l ${LIBCRYPTOPC}
+.else
 CRYPT_CFLAGS=
 CRYPT_LDFLAGS=
 CRYPT_LDADD=	-lcrypto
+.endif
 
 CFLAGS+=	-I${LOCALBASE}/include -I${.CURDIR}/openbsd-compat 
 CFLAGS+=	-Wall -I${.CURDIR}
blob - 38df5f23e45bd58b4e32f21e38cf7df51bb2c2cc
blob + 8f324e536ea02ba338e434de491b4f778535a399
--- main.c
+++ main.c
@@ -556,10 +556,12 @@ dkim_signature_parse_a(struct signature *sig, const ch
 		start += 4;
 		sig->ak = EVP_PKEY_RSA;
 		sig->sephash = 0;
+#if HAVE_ED25519
 	} else if (strncmp(start, "ed25519-", 8) == 0) {
 		start += 8;
 		sig->ak = EVP_PKEY_ED25519;
 		sig->sephash = 1;
+#endif
 	} else {
 		dkim_signature_state(sig, DKIM_NEUTRAL, "Unsuppored a tag k");
 		return;
@@ -1210,8 +1212,10 @@ dkim_key_text_parse(struct signature *sig, const char 
 	size_t pkrawlen = 0, pkoff, linelen;
 	int h = 0, k = 0, n = 0, p = 0, s = 0, t = 0, first = 1;
 	BIO *bio;
+#ifdef HAVE_ED25519
 	size_t pklen;
 	int tmp;
+#endif
 
 	key = osmtpd_ltok_skip_fws(key, 1);
 	/* Validate syntax early */
@@ -1283,9 +1287,11 @@ dkim_key_text_parse(struct signature *sig, const char 
 			if (strncmp(key, "rsa", end - key) == 0) {
 				if (sig->ak != EVP_PKEY_RSA)
 					return 0;
+#if HAVE_ED25519
 			} else if (strncmp(key, "ed25519", end - key) == 0) {
 				if (sig->ak != EVP_PKEY_ED25519)
 					return 0;
+#endif
 			} else
 				return 0;
 			key = end;
@@ -1422,6 +1428,7 @@ dkim_key_text_parse(struct signature *sig, const char 
 		sig->p = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);
 		BIO_free(bio);
 		break;
+#if HAVE_ED25519
 	case EVP_PKEY_ED25519:
 		if ((pkrawlen / 4) * 3 >= sizeof(pkimp))
 			return 0;
@@ -1435,6 +1442,7 @@ dkim_key_text_parse(struct signature *sig, const char 
 		sig->p = EVP_PKEY_new_raw_public_key(sig->ak, NULL, pkimp,
 		    pklen);
 		break;
+#endif
 	}
 	if (sig->p == NULL) {
 		/*