summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2016-12-21 15:13:29 +0000
committerjsing <>2016-12-21 15:13:29 +0000
commitd27b27ec032705ab124d3547a20ddbe9d7597c22 (patch)
treea6250760fa29119c5b19d00c531f45a03694d166
parent718ab6235df17d368ba0344f7397cb2cb7e569b2 (diff)
downloadopenbsd-d27b27ec032705ab124d3547a20ddbe9d7597c22.tar.gz
openbsd-d27b27ec032705ab124d3547a20ddbe9d7597c22.tar.bz2
openbsd-d27b27ec032705ab124d3547a20ddbe9d7597c22.zip
Ensure negative time/timeout are handled appropriately.
-rw-r--r--src/regress/lib/libssl/asn1/asn1test.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/regress/lib/libssl/asn1/asn1test.c b/src/regress/lib/libssl/asn1/asn1test.c
index f71044c62b..946c672d74 100644
--- a/src/regress/lib/libssl/asn1/asn1test.c
+++ b/src/regress/lib/libssl/asn1/asn1test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1test.c,v 1.3 2014/12/07 20:00:13 bcook Exp $ */ 1/* $OpenBSD: asn1test.c,v 1.4 2016/12/21 15:13:29 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -165,6 +165,28 @@ struct ssl_asn1_test ssl_asn1_tests[] = {
165 }, 165 },
166 348, 166 348,
167 }, 167 },
168 {
169 {
170 .cipher_id = 0x03000000L | 1,
171 .ssl_version = TLS1_2_VERSION,
172 .timeout = -1,
173 },
174 {
175 0x0,
176 },
177 -1,
178 },
179 {
180 {
181 .cipher_id = 0x03000000L | 1,
182 .ssl_version = TLS1_2_VERSION,
183 .time = -1,
184 },
185 {
186 0x0,
187 },
188 -1,
189 },
168}; 190};
169 191
170#define N_SSL_ASN1_TESTS \ 192#define N_SSL_ASN1_TESTS \
@@ -295,6 +317,10 @@ do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat)
295 goto failed; 317 goto failed;
296 } 318 }
297 319
320 /* See if the test is expected to fail... */
321 if (sat->asn1_len == -1)
322 return (0);
323
298 if ((asn1 = malloc(len)) == NULL) 324 if ((asn1 = malloc(len)) == NULL)
299 errx(1, "failed to allocate memory"); 325 errx(1, "failed to allocate memory");
300 326