Skip to content

Support ed25519 in opendkim tools, fix orphaned opendkim-genzone bug #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions libopendkim/base32.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,21 @@ dkim_base32_encode(char *buf, size_t *buflen, const void *data, size_t size)

#ifdef TEST
#include <openssl/sha.h>
#include <openssl/evp.h>

int
main(int argc, char **argv)
{
int x;
size_t buflen;
SHA_CTX sha;
char buf[128];
unsigned char shaout[SHA_DIGEST_LENGTH];

memset(buf, '\0', sizeof buf);
buflen = sizeof buf;

SHA1_Init(&sha);
SHA1_Update(&sha, argv[1], strlen(argv[1]));
SHA1_Final(shaout, &sha);
(void) EVP_Digest(argv[1], strlen(argv[1]), shaout, NULL, EVP_sha1(),
NULL);

x = dkim_base32_encode(buf, &buflen, shaout, SHA_DIGEST_LENGTH);

Expand Down
16 changes: 5 additions & 11 deletions libopendkim/dkim-atps.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#else /* USE_GNUTLS */
/* openssl includes */
# include <openssl/sha.h>
# include <openssl/evp.h>
#endif /* USE_GNUTLS */

/* prototypes */
Expand Down Expand Up @@ -113,11 +114,6 @@ dkim_atps_check(DKIM *dkim, DKIM_SIGINFO *sig, struct timeval *timeout,
u_char *eom;
#ifdef USE_GNUTLS
gnutls_hash_hd_t ctx;
#else /* USE_GNUTLS */
SHA_CTX ctx;
# ifdef HAVE_SHA256
SHA256_CTX ctx2;
# endif /* HAVE_SHA256 */
#endif /* USE_GNUTLS */
struct timeval to;
HEADER hdr;
Expand Down Expand Up @@ -198,16 +194,14 @@ dkim_atps_check(DKIM *dkim, DKIM_SIGINFO *sig, struct timeval *timeout,
switch (hash)
{
case DKIM_HASHTYPE_SHA1:
SHA1_Init(&ctx);
SHA1_Update(&ctx, sdomain, strlen(sdomain));
SHA1_Final(digest, &ctx);
(void) EVP_Digest(sdomain, strlen(sdomain), digest,
NULL, EVP_sha1(), NULL);
break;

# ifdef HAVE_SHA256
case DKIM_HASHTYPE_SHA256:
SHA256_Init(&ctx2);
SHA256_Update(&ctx2, sdomain, strlen(sdomain));
SHA256_Final(digest, &ctx2);
(void) EVP_Digest(sdomain, strlen(sdomain), digest,
NULL, EVP_sha256(), NULL);
break;
# endif /* HAVE_SHA256 */

Expand Down
Loading