diff options
author | doug <> | 2015-04-25 15:28:47 +0000 |
---|---|---|
committer | doug <> | 2015-04-25 15:28:47 +0000 |
commit | f7c257c94b0ba9258a1f7a5ec03099db9586b791 (patch) | |
tree | 2d4124d3ad14035e2d57d39b5be185892b4a24c7 /src/regress | |
parent | 61630c9631a2bd70570f348c1a65eefb0a864d9d (diff) | |
download | openbsd-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.c | 6 |
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 | ||
614 | static int | 616 | static int |