Skip to content

Commit

Permalink
SHA256 isn't optional
Browse files Browse the repository at this point in the history
It's been a required part of DKIM since 2007, and there's no reason to
allow people to compile OpenARC without it.
  • Loading branch information
flowerysong committed Oct 3, 2024
1 parent 0e9a149 commit 671a623
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 35 deletions.
11 changes: 1 addition & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ openssl_found="no"

if test \( "$sslpath" = "auto" -o x"$sslpath" = x"yes" \) -a x"$PKG_CONFIG" != x""
then
PKG_CHECK_MODULES([LIBCRYPTO], [openssl >= 0.9.7],
PKG_CHECK_MODULES([LIBCRYPTO], [openssl >= 0.9.8],
[openssl_found="yes"],
[openssl_found="no"
AC_MSG_WARN([pkg-config for openssl not found, trying manual search...])
Expand Down Expand Up @@ -651,15 +651,6 @@ then
]
)

AC_CHECK_DECL([SHA256_DIGEST_LENGTH],
AC_DEFINE([HAVE_SHA256], 1,
[Define to 1 if your crypto library has SHA256 support]),
AC_MSG_WARN([SHA256 is required for DKIM but is not
supported with your version of OpenSSL]),
[
#include <sys/types.h>
#include <openssl/sha.h>])

CFLAGS="$saved_CFLAGS"
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
Expand Down
23 changes: 2 additions & 21 deletions libopenarc/arc-canon.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ arc_canon_free(ARC_MESSAGE *msg, ARC_CANON *canon)
break;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand All @@ -108,7 +107,6 @@ arc_canon_free(ARC_MESSAGE *msg, ARC_CANON *canon)

break;
}
#endif /* HAVE_SHA256 */

default:
assert(0);
Expand Down Expand Up @@ -169,7 +167,6 @@ arc_canon_write(ARC_CANON *canon, u_char *buf, size_t buflen)
break;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand All @@ -182,7 +179,6 @@ arc_canon_write(ARC_CANON *canon, u_char *buf, size_t buflen)

break;
}
#endif /* HAVE_SHA256 */
}

if (canon->canon_remain != (ssize_t) -1)
Expand Down Expand Up @@ -617,7 +613,6 @@ arc_canon_init(ARC_MESSAGE *msg, _Bool tmp, _Bool keep)
break;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand Down Expand Up @@ -651,7 +646,6 @@ arc_canon_init(ARC_MESSAGE *msg, _Bool tmp, _Bool keep)

break;
}
#endif /* HAVE_SHA256 */

default:
assert(0);
Expand Down Expand Up @@ -726,15 +720,8 @@ arc_add_canon(ARC_MESSAGE *msg, int type, arc_canon_t canon, int hashtype,
assert(msg != NULL);
assert(canon == ARC_CANON_SIMPLE || canon == ARC_CANON_RELAXED);

if (arc_libfeature(msg->arc_library, ARC_FEATURE_SHA256))
{
assert(hashtype == ARC_HASHTYPE_SHA1 ||
hashtype == ARC_HASHTYPE_SHA256);
}
else
{
assert(hashtype == ARC_HASHTYPE_SHA1);
}
assert(hashtype == ARC_HASHTYPE_SHA1 ||
hashtype == ARC_HASHTYPE_SHA256);

if (type == ARC_CANONTYPE_HEADER)
{
Expand Down Expand Up @@ -1087,7 +1074,6 @@ arc_canon_finalize(ARC_CANON *canon)
break;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand All @@ -1100,7 +1086,6 @@ arc_canon_finalize(ARC_CANON *canon)

break;
}
#endif /* HAVE_SHA256 */

default:
assert(0);
Expand Down Expand Up @@ -1922,7 +1907,6 @@ arc_canon_closebody(ARC_MESSAGE *msg)
break;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand All @@ -1935,7 +1919,6 @@ arc_canon_closebody(ARC_MESSAGE *msg)

break;
}
#endif /* HAVE_SHA256 */

default:
assert(0);
Expand Down Expand Up @@ -1983,7 +1966,6 @@ arc_canon_getfinal(ARC_CANON *canon, u_char **digest, size_t *dlen)
return ARC_STAT_OK;
}

#ifdef HAVE_SHA256
case ARC_HASHTYPE_SHA256:
{
struct arc_sha256 *sha256;
Expand All @@ -1994,7 +1976,6 @@ arc_canon_getfinal(ARC_CANON *canon, u_char **digest, size_t *dlen)

return ARC_STAT_OK;
}
#endif /* HAVE_SHA256 */

default:
assert(0);
Expand Down
2 changes: 0 additions & 2 deletions libopenarc/arc-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct arc_sha1
u_char sha1_out[SHA_DIGEST_LENGTH];
};

#ifdef HAVE_SHA256
/* struct arc_sha256 -- stuff needed to do a sha256 hash */
struct arc_sha256
{
Expand All @@ -43,7 +42,6 @@ struct arc_sha256
SHA256_CTX sha256_ctx;
u_char sha256_out[SHA256_DIGEST_LENGTH];
};
#endif /* HAVE_SHA256 */

/* struct arc_qmethod -- signature query method */
struct arc_qmethod
Expand Down
2 changes: 0 additions & 2 deletions libopenarc/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,7 @@ arc_init(void)
lib->arcl_dns_waitreply = arc_res_waitreply;
strncpy(lib->arcl_tmpdir, DEFTMPDIR, sizeof lib->arcl_tmpdir - 1);

#ifdef HAVE_SHA256
FEATURE_ADD(lib, ARC_FEATURE_SHA256);
#endif /* HAVE_SHA256 */

return lib;
}
Expand Down

0 comments on commit 671a623

Please sign in to comment.