diff options
author | jsing <> | 2017-12-09 14:34:09 +0000 |
---|---|---|
committer | jsing <> | 2017-12-09 14:34:09 +0000 |
commit | 5c2bceb7260d85c5f53787effeef311181bebc6c (patch) | |
tree | 9d0b6ce1c9f7f46902ca1642cf9c2d1cc2aad1fa | |
parent | 7181944223368eb06c1423f5fcc1e06b662ed31b (diff) | |
download | openbsd-5c2bceb7260d85c5f53787effeef311181bebc6c.tar.gz openbsd-5c2bceb7260d85c5f53787effeef311181bebc6c.tar.bz2 openbsd-5c2bceb7260d85c5f53787effeef311181bebc6c.zip |
Use a test value that fits into a long on both 32-bit and 64-bit
architectures, so that the regress passes on both.
-rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1evp.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1evp.c b/src/regress/lib/libcrypto/asn1/asn1evp.c index dd87bbb020..d1870f9acc 100644 --- a/src/regress/lib/libcrypto/asn1/asn1evp.c +++ b/src/regress/lib/libcrypto/asn1/asn1evp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1evp.c,v 1.1 2017/11/28 16:47:55 jsing Exp $ */ | 1 | /* $OpenBSD: asn1evp.c,v 1.2 2017/12/09 14:34:09 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -21,10 +21,12 @@ | |||
21 | 21 | ||
22 | #include <openssl/asn1.h> | 22 | #include <openssl/asn1.h> |
23 | 23 | ||
24 | #define TEST_NUM 0x7fffffffL | ||
25 | |||
24 | unsigned char asn1_atios[] = { | 26 | unsigned char asn1_atios[] = { |
25 | 0x30, 0x14, 0x02, 0x08, 0x7f, 0xff, 0xff, 0xff, | 27 | 0x30, 0x10, 0x02, 0x04, 0x7f, 0xff, 0xff, 0xff, |
26 | 0xff, 0xff, 0xff, 0xff, 0x04, 0x08, 0x00, 0x01, | 28 | 0x04, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
27 | 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | 29 | 0x06, 0x07, |
28 | }; | 30 | }; |
29 | 31 | ||
30 | unsigned char test_octetstring[] = { | 32 | unsigned char test_octetstring[] = { |
@@ -66,7 +68,7 @@ int | |||
66 | main(int argc, char **argv) | 68 | main(int argc, char **argv) |
67 | { | 69 | { |
68 | unsigned char data[16]; | 70 | unsigned char data[16]; |
69 | long num = LONG_MAX; | 71 | long num = TEST_NUM; |
70 | int failed = 1; | 72 | int failed = 1; |
71 | ASN1_TYPE at; | 73 | ASN1_TYPE at; |
72 | int len; | 74 | int len; |
@@ -100,8 +102,8 @@ main(int argc, char **argv) | |||
100 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); | 102 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); |
101 | goto done; | 103 | goto done; |
102 | } | 104 | } |
103 | if (num != LONG_MAX) { | 105 | if (num != TEST_NUM) { |
104 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, LONG_MAX); | 106 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); |
105 | goto done; | 107 | goto done; |
106 | } | 108 | } |
107 | if (compare_data("octet string", data, len, | 109 | if (compare_data("octet string", data, len, |
@@ -120,8 +122,8 @@ main(int argc, char **argv) | |||
120 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); | 122 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); |
121 | goto done; | 123 | goto done; |
122 | } | 124 | } |
123 | if (num != LONG_MAX) { | 125 | if (num != TEST_NUM) { |
124 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, LONG_MAX); | 126 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); |
125 | goto done; | 127 | goto done; |
126 | } | 128 | } |
127 | if (len != sizeof(test_octetstring)) { | 129 | if (len != sizeof(test_octetstring)) { |