diff options
author | Ilya V. Matveychikov <i.matveychikov@securitycode.ru> | 2015-03-04 03:25:42 +0300 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-03-04 10:35:27 +0100 |
commit | 44aa4bd16a73f2e3fc54b7abc944f5643211d93e (patch) | |
tree | b39feeb29fd393c5064cd082bfd8878458917ebb /tests/suite | |
parent | 2c1cf20141d5377511b8cd075baac14be5df2dac (diff) | |
download | gnutls-44aa4bd16a73f2e3fc54b7abc944f5643211d93e.tar.gz |
asn1random.pl: generate simple tags only
Do not emit tags with numbers greater than or equal 31 as they must be
encoded an octet sequence (ref X.690-0207 # 8.1.2.4)
Signed-off-by: Ilya V. Matveychikov <i.matveychikov@securitycode.ru>
Diffstat (limited to 'tests/suite')
-rwxr-xr-x | tests/suite/asn1random.pl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/suite/asn1random.pl b/tests/suite/asn1random.pl index 79e70a6b62..3e01b58c9c 100755 --- a/tests/suite/asn1random.pl +++ b/tests/suite/asn1random.pl @@ -54,7 +54,14 @@ sub emit_asn1_hdr($$) $l = 0x84; } - $output .= pack("CC", $tag == -1 ? int(rand(255)) & ~0x20 : $tag, $l); + # autogenerate tag, if it is not passed + if ($tag == -1) { $tag = int(rand(255)) & ~0x20; } + + # don't emit tag numbers >= 31 (X.690-0207 -- 8.1.2.4) + if (($tag & 0x1f) == 0x1f) { $tag &= ~1; } + + $output .= pack("CC", $tag, $l); + if ($len < 0x80) { } elsif ($len <= 0xff) { $output .= pack("C", $len); |