diff options
Diffstat (limited to 'tests/Test_simple.c')
-rw-r--r-- | tests/Test_simple.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/Test_simple.c b/tests/Test_simple.c index a846958..6cd07e0 100644 --- a/tests/Test_simple.c +++ b/tests/Test_simple.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Free Software Foundation, Inc. + * Copyright (C) 2011-2022 Free Software Foundation, Inc. * * This file is part of LIBTASN1. * @@ -87,6 +87,22 @@ main (int argc, char *argv[]) int ret_len, bit_len; size_t i; + { + unsigned int etype = 38; + unsigned int my_str_len = 10; + unsigned char my_str[10]; + unsigned int tl_len = 10; + unsigned char tl[10]; + + /* https://gitlab.com/gnutls/libtasn1/-/issues/32 */ + result = asn1_encode_simple_der (etype, my_str, my_str_len, tl, &tl_len); + if (result != ASN1_VALUE_NOT_VALID) + { + fprintf (stderr, "asn1_encode_simple_der out of range etype\n"); + return 1; + } + } + /* Dummy test */ asn1_bit_der (NULL, 0, der, &der_len); @@ -128,7 +144,8 @@ main (int argc, char *argv[]) if (result != ASN1_SUCCESS || ret_len != tv[i].derlen || bit_len != tv[i].bitlen) { - fprintf (stderr, "asn1_get_bit_der iter %lu, err: %d\n", (unsigned long) i, result); + fprintf (stderr, "asn1_get_bit_der iter %lu, err: %d\n", + (unsigned long) i, result); return 1; } } |