diff options
| author | doug <> | 2015-04-25 15:28:47 +0000 |
|---|---|---|
| committer | doug <> | 2015-04-25 15:28:47 +0000 |
| commit | 14b4339c31e6165fb11bbb889e4b24b201ac5e29 (patch) | |
| tree | 2d4124d3ad14035e2d57d39b5be185892b4a24c7 /src/regress/lib/libssl | |
| parent | 3df6efe196d3800ced15968c2150a1178d09a381 (diff) | |
| download | openbsd-14b4339c31e6165fb11bbb889e4b24b201ac5e29.tar.gz openbsd-14b4339c31e6165fb11bbb889e4b24b201ac5e29.tar.bz2 openbsd-14b4339c31e6165fb11bbb889e4b24b201ac5e29.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/lib/libssl')
| -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 |
