Skip to content

Commit

Permalink
Fix #131: Compile with -fno-strict-aliasing
Browse files Browse the repository at this point in the history
or drill will fail signature chasing
  • Loading branch information
wtoorop committed Oct 7, 2021
1 parent 15fa2ee commit 4d2057f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* PR #108: Fix for ldns-compare-zones net detecting when first zone
has a RRset that shrinks from two to one RRs, or grows from one
to two RRs. Thanks Emilio Caballero
* Fix #131: Drill sig chasing breaks with gcc-11 and
strict-aliasing. Thanks Stanislav Levin

1.7.1 2019-07-26
* bugfix: Manage verification paths for OpenSSL >= 1.1.0
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ ACX_CHECK_COMPILER_FLAG(Wstrict-prototypes, [CFLAGS="-Wstrict-prototypes $CFLAGS
#ACX_CHECK_COMPILER_FLAG(Wshadow, [CFLAGS="-Wshadow $CFLAGS"])
ACX_CHECK_COMPILER_FLAG(Wunused-function, [CFLAGS="-Wunused-function $CFLAGS"])
ACX_CHECK_COMPILER_FLAG(Wmissing-prototypes, [CFLAGS="-Wmissing-prototypes $CFLAGS"])
ACX_CHECK_COMPILER_FLAG(fno-strict-aliasing, [CFLAGS="-fno-strict-aliasing $CFLAGS"])

AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT])

Expand Down
6 changes: 3 additions & 3 deletions sha2.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ typedef union _ldns_sha2_buffer_union {
uint64_t* theLongs;
} ldns_sha2_buffer_union;

void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
void ldns_sha256_final(sha2_byte digest[LDNS_SHA256_DIGEST_LENGTH], ldns_sha256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
size_t usedspace;
ldns_sha2_buffer_union cast_var;
Expand Down Expand Up @@ -905,7 +905,7 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
}

void ldns_sha512_final(sha2_byte digest[], ldns_sha512_CTX* context) {
void ldns_sha512_final(sha2_byte digest[LDNS_SHA512_DIGEST_LENGTH], ldns_sha512_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;

/* Sanity check: */
Expand Down Expand Up @@ -958,7 +958,7 @@ void ldns_sha384_update(ldns_sha384_CTX* context, const sha2_byte* data, size_t
ldns_sha512_update((ldns_sha512_CTX*)context, data, len);
}

void ldns_sha384_final(sha2_byte digest[], ldns_sha384_CTX* context) {
void ldns_sha384_final(sha2_byte digest[LDNS_SHA384_DIGEST_LENGTH], ldns_sha384_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;

/* Sanity check: */
Expand Down

0 comments on commit 4d2057f

Please sign in to comment.