Skip to content

Commit a45be93

Browse files
committed
libopendkim,opendkim: add DKIM_SIGERROR_UNSUPPORTED_A and warn when skipping unsupported algorithm
Distinguish between a genuinely invalid a= tag value (DKIM_SIGERROR_INVALID_A) and a valid algorithm that was not compiled into this build (DKIM_SIGERROR_UNSUPPORTED_A, e.g. ed25519-sha256 without Ed25519 support). Ed25519 is in wide deployment now; silently skipping these signatures without any log output makes it hard to diagnose why valid signatures are being ignored. opendkim now logs LOG_WARNING when a signature is skipped for this reason, naming the algorithm so operators know exactly what support to add.
1 parent 9749241 commit a45be93

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

libopendkim/dkim-tables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ static struct dkim_nametable prv_sigerrors[] = /* signature parsing errors */
194194
{ "conditional signature not satisfied", DKIM_SIGERROR_CONDITIONAL },
195195
{ "too many signature indirections", DKIM_SIGERROR_CONDLOOP },
196196
#endif /* _FFR_CONDITIONAL */
197+
{ "algorithm not supported in this build", DKIM_SIGERROR_UNSUPPORTED_A },
197198
{ NULL, -1 },
198199
};
199200
DKIM_NAMETABLE *dkim_table_sigerrors = prv_sigerrors;

libopendkim/dkim.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,7 +2144,7 @@ dkim_siglist_setup(DKIM *dkim)
21442144
}
21452145
else
21462146
{
2147-
dkim->dkim_siglist[c]->sig_error = DKIM_SIGERROR_INVALID_A;
2147+
dkim->dkim_siglist[c]->sig_error = DKIM_SIGERROR_UNSUPPORTED_A;
21482148
continue;
21492149
}
21502150
break;
@@ -2156,7 +2156,7 @@ dkim_siglist_setup(DKIM *dkim)
21562156
}
21572157
else
21582158
{
2159-
dkim->dkim_siglist[c]->sig_error = DKIM_SIGERROR_INVALID_A;
2159+
dkim->dkim_siglist[c]->sig_error = DKIM_SIGERROR_UNSUPPORTED_A;
21602160
continue;
21612161
}
21622162
break;

libopendkim/dkim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ typedef int DKIM_SIGERROR;
168168
#define DKIM_SIGERROR_KEYTOOSMALL 46 /* too few key bits */
169169
#define DKIM_SIGERROR_CONDITIONAL 47 /* conditional sig error */
170170
#define DKIM_SIGERROR_CONDLOOP 48 /* conditional sig loop */
171+
#define DKIM_SIGERROR_UNSUPPORTED_A 49 /* a= algorithm not supported in this build */
171172

172173
extern DKIM_NAMETABLE *dkim_table_sigerrors;
173174

opendkim/opendkim.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5503,6 +5503,7 @@ dkimf_arfdkim(msgctx dfc)
55035503
case DKIM_SIGERROR_INVALID_BC:
55045504
case DKIM_SIGERROR_MISSING_A:
55055505
case DKIM_SIGERROR_INVALID_A:
5506+
case DKIM_SIGERROR_UNSUPPORTED_A:
55065507
case DKIM_SIGERROR_MISSING_H:
55075508
case DKIM_SIGERROR_INVALID_L:
55085509
case DKIM_SIGERROR_INVALID_Q:
@@ -10732,6 +10733,20 @@ dkimf_ar_all_sigs(char *hdr, size_t hdrlen, struct dkimf_dstring *tmpstr,
1073210733

1073310734
sigerror = dkim_sig_geterror(sigs[c]);
1073410735

10736+
if (sigerror == DKIM_SIGERROR_UNSUPPORTED_A)
10737+
{
10738+
dkim_alg_t unsup_alg;
10739+
if (dkim_sig_getsignalg(sigs[c],
10740+
&unsup_alg) == DKIM_STAT_OK)
10741+
{
10742+
dkimf_log(conf, LOG_WARNING,
10743+
"%s: signature ignored: algorithm '%s' not supported in this build",
10744+
JOBID(dfc->mctx_jobid),
10745+
dkim_code_to_name(dkim_table_algorithms,
10746+
unsup_alg));
10747+
}
10748+
}
10749+
1073510750
if (dkim_sig_getkeysize(sigs[c],
1073610751
&keybits) != DKIM_STAT_OK)
1073710752
keybits = 0;

0 commit comments

Comments
 (0)