summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-05-08 21:30:37 +0000
committermiod <miod@openbsd.org>2015-05-08 21:30:37 +0000
commit1b3c0eece63d3416338f2e160004a37f7eb0010e (patch)
tree4fab46e19d6f7e896c5f68f3a31b64702011e4ef
parentWhen changing screen saver parameters with wsconsctl (or any other way to (diff)
downloadwireguard-openbsd-1b3c0eece63d3416338f2e160004a37f7eb0010e.tar.xz
wireguard-openbsd-1b3c0eece63d3416338f2e160004a37f7eb0010e.zip
Make this run on strict alignment architectures.
-rw-r--r--regress/lib/libcrypto/bio/biotest.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/regress/lib/libcrypto/bio/biotest.c b/regress/lib/libcrypto/bio/biotest.c
index c150c0b54e7..f83ef2c5c13 100644
--- a/regress/lib/libcrypto/bio/biotest.c
+++ b/regress/lib/libcrypto/bio/biotest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biotest.c,v 1.4 2014/07/11 08:48:52 bcook Exp $ */
+/* $OpenBSD: biotest.c,v 1.5 2015/05/08 21:30:37 miod Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -81,16 +81,19 @@ static int
do_bio_get_host_ip_tests(void)
{
struct bio_get_host_ip_test *bgit;
- unsigned char ip[4];
+ union {
+ unsigned char c[4];
+ uint32_t i;
+ } ip;
int failed = 0;
size_t i;
int ret;
for (i = 0; i < N_BIO_GET_IP_TESTS; i++) {
bgit = &bio_get_host_ip_tests[i];
- memset(ip, 0, sizeof(*ip));
+ memset(&ip, 0, sizeof(ip));
- ret = BIO_get_host_ip(bgit->input, ip);
+ ret = BIO_get_host_ip(bgit->input, ip.c);
if (ret != bgit->ret) {
fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n",
i, bgit->input, ret ? "success" : "failure",
@@ -98,10 +101,10 @@ do_bio_get_host_ip_tests(void)
failed = 1;
continue;
}
- if (ret && ntohl(*((uint32_t *)ip)) != bgit->ip) {
+ if (ret && ntohl(ip.i) != bgit->ip) {
fprintf(stderr, "FAIL: test %zi (\"%s\") returned ip "
"%x != %x\n", i, bgit->input,
- ntohl(*((uint32_t *)ip)), bgit->ip);
+ ntohl(ip.i), bgit->ip);
failed = 1;
}
}