commit 33a7c297f9976d9d23fa2912c3ad56e0d91b091a from: Martijn van Duren date: Fri Dec 16 10:28:37 2022 UTC Revert previous. It's too early to remove the guards just yet. commit - 07480b90f4ee9246fdc55bbcdd0370c031923420 commit + 33a7c297f9976d9d23fa2912c3ad56e0d91b091a blob - 058d1919ba16827a0f2c32e04405586ccb316117 blob + 19746f9f6e583080de34e95de1b6cf3d9929833d --- Makefile +++ Makefile @@ -7,6 +7,9 @@ MANDIR= ${LOCALBASE}/man/man SRCS+= main.c mheader.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} blob - 011d047d5401c07146103693f7b58fc5289bdf94 blob + 1f97bd28f4172df60f52b0b2bae40bc4fa0817a0 --- Makefile.gnu +++ Makefile.gnu @@ -7,6 +7,9 @@ MANDIR= ${LOCALBASE}/share/man/man8 SRCS+= main.c mheader.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} blob - 8b2d2131ea121f527e174e6b59a4bdde8f844193 blob + 2961793635330ed82f566e8870166a7f012e7e7a --- main.c +++ main.c @@ -136,11 +136,13 @@ main(int argc, char *argv[]) hashalg = optarg + 4; keyid = EVP_PKEY_RSA; sephash = 0; +#ifdef HAVE_ED25519 } else if (strncmp(optarg, "ed25519-", 8) == 0) { hashalg = optarg + 8; cryptalg = "ed25519"; keyid = EVP_PKEY_ED25519; sephash = 1; +#endif } else osmtpd_errx(1, "invalid algorithm"); break; @@ -694,6 +696,7 @@ dkim_sign(struct osmtpd_ctx *ctx) dkim_errx(message, "Can't finalize signature context"); goto fail; } +#ifdef HAVE_ED25519 } else { if (EVP_DigestFinal_ex(message->dctx, bdigest, &digestsz) != 1) { @@ -712,6 +715,7 @@ dkim_sign(struct osmtpd_ctx *ctx) dkim_errx(message, "Failed to finalize signature"); goto fail; } +#endif } if ((tmp = malloc(linelen)) == NULL) { dkim_err(message, "Can't allocate space for signature"); @@ -722,12 +726,14 @@ dkim_sign(struct osmtpd_ctx *ctx) dkim_errx(message, "Failed to finalize signature"); goto fail; } +#ifdef HAVE_ED25519 } else { if (EVP_DigestSign(message->dctx, tmp, &linelen, bdigest, digestsz) != 1) { dkim_errx(message, "Failed to finalize signature"); goto fail; } +#endif } if ((b = malloc((((linelen + 2) / 3) * 4) + 1)) == NULL) { dkim_err(message, "Can't create DKIM signature");