diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/bio/biotest.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/regress/lib/libcrypto/bio/biotest.c b/src/regress/lib/libcrypto/bio/biotest.c index c150c0b54e..f83ef2c5c1 100644 --- a/src/regress/lib/libcrypto/bio/biotest.c +++ b/src/regress/lib/libcrypto/bio/biotest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: biotest.c,v 1.4 2014/07/11 08:48:52 bcook Exp $ */ | 1 | /* $OpenBSD: biotest.c,v 1.5 2015/05/08 21:30:37 miod Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -81,16 +81,19 @@ static int | |||
| 81 | do_bio_get_host_ip_tests(void) | 81 | do_bio_get_host_ip_tests(void) |
| 82 | { | 82 | { |
| 83 | struct bio_get_host_ip_test *bgit; | 83 | struct bio_get_host_ip_test *bgit; |
| 84 | unsigned char ip[4]; | 84 | union { |
| 85 | unsigned char c[4]; | ||
| 86 | uint32_t i; | ||
| 87 | } ip; | ||
| 85 | int failed = 0; | 88 | int failed = 0; |
| 86 | size_t i; | 89 | size_t i; |
| 87 | int ret; | 90 | int ret; |
| 88 | 91 | ||
| 89 | for (i = 0; i < N_BIO_GET_IP_TESTS; i++) { | 92 | for (i = 0; i < N_BIO_GET_IP_TESTS; i++) { |
| 90 | bgit = &bio_get_host_ip_tests[i]; | 93 | bgit = &bio_get_host_ip_tests[i]; |
| 91 | memset(ip, 0, sizeof(*ip)); | 94 | memset(&ip, 0, sizeof(ip)); |
| 92 | 95 | ||
| 93 | ret = BIO_get_host_ip(bgit->input, ip); | 96 | ret = BIO_get_host_ip(bgit->input, ip.c); |
| 94 | if (ret != bgit->ret) { | 97 | if (ret != bgit->ret) { |
| 95 | fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n", | 98 | fprintf(stderr, "FAIL: test %zi (\"%s\") %s, want %s\n", |
| 96 | i, bgit->input, ret ? "success" : "failure", | 99 | i, bgit->input, ret ? "success" : "failure", |
| @@ -98,10 +101,10 @@ do_bio_get_host_ip_tests(void) | |||
| 98 | failed = 1; | 101 | failed = 1; |
| 99 | continue; | 102 | continue; |
| 100 | } | 103 | } |
| 101 | if (ret && ntohl(*((uint32_t *)ip)) != bgit->ip) { | 104 | if (ret && ntohl(ip.i) != bgit->ip) { |
| 102 | fprintf(stderr, "FAIL: test %zi (\"%s\") returned ip " | 105 | fprintf(stderr, "FAIL: test %zi (\"%s\") returned ip " |
| 103 | "%x != %x\n", i, bgit->input, | 106 | "%x != %x\n", i, bgit->input, |
| 104 | ntohl(*((uint32_t *)ip)), bgit->ip); | 107 | ntohl(ip.i), bgit->ip); |
| 105 | failed = 1; | 108 | failed = 1; |
| 106 | } | 109 | } |
| 107 | } | 110 | } |
