Skip to content

Commit 9749241

Browse files
committed
libopendkim: set sig_signalg before feature checks in dkim_siglist_setup()
When opendkim is compiled without Ed25519 support and receives a message signed with ed25519-sha256, sig_signalg was left at its memset default (0 = DKIM_SIGN_RSASHA1) because the continue statement in the feature check jumped past the assignment. The AR header would then incorrectly report header.a=rsa-sha1 instead of header.a=ed25519-sha256. Assign sig_signalg immediately when signalg is decoded from the a= tag, before any continue that might skip the signature. Fixes #27
1 parent ecf7d40 commit 9749241

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libopendkim/dkim.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,8 +2121,9 @@ dkim_siglist_setup(DKIM *dkim)
21212121
}
21222122
else
21232123
{
2124-
signalg = dkim_name_to_code(dkim_table_algorithms,
2125-
(char *) param);
2124+
dkim->dkim_siglist[c]->sig_signalg = signalg =
2125+
dkim_name_to_code(dkim_table_algorithms,
2126+
(char *) param);
21262127

21272128
if (signalg == -1)
21282129
{
@@ -2165,7 +2166,6 @@ dkim_siglist_setup(DKIM *dkim)
21652166
/* NOTREACHED */
21662167
}
21672168

2168-
dkim->dkim_siglist[c]->sig_signalg = signalg;
21692169
dkim->dkim_siglist[c]->sig_hashtype = hashtype;
21702170
}
21712171

0 commit comments

Comments
 (0)