summaryrefslogtreecommitdiff
path: root/src/regress
diff options
context:
space:
mode:
authordoug <>2015-04-25 15:28:47 +0000
committerdoug <>2015-04-25 15:28:47 +0000
commitf7c257c94b0ba9258a1f7a5ec03099db9586b791 (patch)
tree2d4124d3ad14035e2d57d39b5be185892b4a24c7 /src/regress
parent61630c9631a2bd70570f348c1a65eefb0a864d9d (diff)
downloadopenbsd-f7c257c94b0ba9258a1f7a5ec03099db9586b791.tar.gz
openbsd-f7c257c94b0ba9258a1f7a5ec03099db9586b791.tar.bz2
openbsd-f7c257c94b0ba9258a1f7a5ec03099db9586b791.zip
Check for invalid leading zeros in CBS_get_asn1_uint64.
ASN.1 integers cannot have all zeros or all ones for the first 9 bits. This rule ensures the numbers are encoded with the smallest number of content octets (see ITU-T Rec X.690 section 8.3.2). Based on BoringSSL commit 5933723b7b592e9914f703d630b596e140c93e16 ok deraadt@ jsing@
Diffstat (limited to 'src/regress')
-rw-r--r--src/regress/lib/libssl/bytestring/bytestringtest.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/regress/lib/libssl/bytestring/bytestringtest.c b/src/regress/lib/libssl/bytestring/bytestringtest.c
index 8269151127..7ae9397a35 100644
--- a/src/regress/lib/libssl/bytestring/bytestringtest.c
+++ b/src/regress/lib/libssl/bytestring/bytestringtest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bytestringtest.c,v 1.3 2015/02/16 06:48:17 doug Exp $ */ 1/* $OpenBSD: bytestringtest.c,v 1.4 2015/04/25 15:28:47 doug Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -607,8 +607,10 @@ static const ASN1_INVALID_UINT64_TEST kAsn1InvalidUint64Tests[] = {
607 {"\x02\x00", 2}, 607 {"\x02\x00", 2},
608 /* Negative number. */ 608 /* Negative number. */
609 {"\x02\x01\x80", 3}, 609 {"\x02\x01\x80", 3},
610 /* Overflow */ 610 /* Overflow. */
611 {"\x02\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11}, 611 {"\x02\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00", 11},
612 /* Leading zeros. */
613 {"\x02\x02\x00\x01", 4},
612}; 614};
613 615
614static int 616static int