Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Bergmann2017-03-01 12:29:04 +0000
committerOlaf Bergmann2017-03-01 12:29:04 +0000
commitc04557d2bd624ea2611cc447356c1d077df8610a (patch)
treea3f22513ba568dc2f0bc66e92c5f08743dc9295d
parentcbd170584b3ed6ad7e73786f2bfddce62f0637c2 (diff)
downloadorg.eclipse.tinydtls-c04557d2bd624ea2611cc447356c1d077df8610a.tar.gz
org.eclipse.tinydtls-c04557d2bd624ea2611cc447356c1d077df8610a.tar.xz
org.eclipse.tinydtls-c04557d2bd624ea2611cc447356c1d077df8610a.zip
sha2.c: Changed address calculation to avoid type punning.
Use pointer arithmetics instead of taking the address of a dereferenced array value to quiet warning about type punned pointer. Change-Id: I6c833dafbf26502c8b4d132f21a733cc4f133bdb
-rw-r--r--sha2/sha2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sha2/sha2.c b/sha2/sha2.c
index c5e45b3..5f55352 100644
--- a/sha2/sha2.c
+++ b/sha2/sha2.c
@@ -637,7 +637,7 @@ void dtls_sha256_final(sha2_byte digest[], dtls_sha256_ctx* context) {
*context->buffer = 0x80;
}
/* Set the bit count: */
- *(sha2_word64*)&context->buffer[DTLS_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+ *(sha2_word64*)(context->buffer+DTLS_SHA256_SHORT_BLOCK_LENGTH) = context->bitcount;
/* Final transform: */
dtls_sha256_transform(context, (sha2_word32*)context->buffer);

Back to the top