diff options
author | Pawel Kowalski <p.kowalski2@partner.samsung.com> | 2018-06-15 11:24:08 +0200 |
---|---|---|
committer | Pawel Kowalski <p.kowalski2@partner.samsung.com> | 2018-06-15 11:26:09 +0200 |
commit | 5c7e0aaf17a296535495e3431db6a86ad64064b3 (patch) | |
tree | d7cca0250c60fbc69eb70a7039d0f9659f81b9d0 /src | |
parent | 1701584f7841a79ae4e97699a8c4ac9f0a09c38f (diff) | |
parent | e527f54afdf27ab8ce73a22d05d69e5482f5e92b (diff) | |
download | libtasn1-5c7e0aaf17a296535495e3431db6a86ad64064b3.tar.gz libtasn1-5c7e0aaf17a296535495e3431db6a86ad64064b3.tar.bz2 libtasn1-5c7e0aaf17a296535495e3431db6a86ad64064b3.zip |
Merge branch 'upstream' into tizensubmit/tizen_5.0/20181101.000007submit/tizen/20180615.093304accepted/tizen/unified/20180620.131427accepted/tizen/5.0/unified/20181102.030257
Change-Id: I254f6095d312777427a57af3ed346986a28f3aaa
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.in | 25 | ||||
-rw-r--r-- | src/asn1Coding.c | 2 | ||||
-rw-r--r-- | src/asn1Decoding.c | 45 | ||||
-rw-r--r-- | src/asn1Parser.c | 2 | ||||
-rw-r--r-- | src/benchmark.c | 2 |
5 files changed, 50 insertions, 26 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 0999657..9b270e8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/largefile.m4 \ + $(top_srcdir)/gl/m4/limits-h.m4 \ $(top_srcdir)/gl/m4/longlong.m4 $(top_srcdir)/gl/m4/lseek.m4 \ $(top_srcdir)/gl/m4/malloc.m4 \ $(top_srcdir)/gl/m4/manywarnings.m4 \ @@ -152,10 +153,10 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/version-etc.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/warnings.m4 $(top_srcdir)/gl/m4/wchar_t.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/update-header-version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -394,6 +395,7 @@ GNULIB_MKTIME = @GNULIB_MKTIME@ GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -410,6 +412,7 @@ GNULIB_PUTCHAR = @GNULIB_PUTCHAR@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -458,6 +461,7 @@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -486,6 +490,7 @@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ @@ -498,6 +503,7 @@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -551,6 +557,7 @@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -576,6 +583,7 @@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -615,6 +623,7 @@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -644,6 +653,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIMITS_H = @LIMITS_H@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ @@ -656,6 +666,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ @@ -669,6 +680,7 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ @@ -762,9 +774,11 @@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -793,6 +807,7 @@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -821,13 +836,13 @@ STRIP = @STRIP@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ diff --git a/src/asn1Coding.c b/src/asn1Coding.c index d4df593..b516bfe 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -188,7 +188,7 @@ main (int argc, char *argv[]) default: fprintf (stderr, "asn1Coding: ?? getopt returned character code Ox%x ??\n", - option_result); + (unsigned)option_result); } } diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c index b52e791..65456bf 100644 --- a/src/asn1Decoding.c +++ b/src/asn1Decoding.c @@ -59,6 +59,7 @@ described in ASN.1 DEFINITIONS file, and print decoded structures.\n\ printf ("\ -b, --benchmark perform a benchmark on decoding\n\ -s, --strict use strict DER decoding\n\ + -t, --no-time-strict use strict DER decoding but not in time fields\n\ -h, --help display this help and exit\n\ -v, --version output version information and exit\n"); emit_bug_reporting_address (); @@ -72,6 +73,7 @@ main (int argc, char *argv[]) static const struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"strict", no_argument, 0, 's'}, + {"no-time-strict", no_argument, 0, 't'}, {"debug", no_argument, 0, 'd'}, {"benchmark", no_argument, 0, 'b'}, {"version", no_argument, 0, 'v'}, @@ -87,7 +89,7 @@ main (int argc, char *argv[]) int asn1_result = ASN1_SUCCESS; unsigned char *der; int der_len = 0, benchmark = 0; - int strict = 0, debug = 0; + int flags = 0, debug = 0; /* FILE *outputFile; */ set_program_name (argv[0]); @@ -98,7 +100,7 @@ main (int argc, char *argv[]) { option_result = - getopt_long (argc, argv, "hbdsvc", long_options, &option_index); + getopt_long (argc, argv, "hbdsvtc", long_options, &option_index); if (option_result == -1) break; @@ -115,7 +117,10 @@ main (int argc, char *argv[]) debug = 1; break; case 's': - strict = 1; + case 't': + flags |= ASN1_DECODE_FLAG_STRICT_DER; + if (option_result == 't') + flags |= ASN1_DECODE_FLAG_ALLOW_INCORRECT_TIME; break; case 'v': /* VERSION */ version_etc (stdout, program_name, PACKAGE, VERSION, @@ -131,7 +136,7 @@ main (int argc, char *argv[]) default: fprintf (stderr, "asn1Decoding: ?? getopt returned character code Ox%x ??\n", - option_result); + (unsigned)option_result); } } @@ -142,14 +147,18 @@ main (int argc, char *argv[]) usage (EXIT_FAILURE); } - inputFileAsnName = (char *) malloc (strlen (argv[optind]) + 1); - strcpy (inputFileAsnName, argv[optind]); + inputFileAsnName = strdup(argv[optind]); + inputFileDerName = strdup(argv[optind + 1]); + typeName = strdup(argv[optind + 2]); - inputFileDerName = (char *) malloc (strlen (argv[optind + 1]) + 1); - strcpy (inputFileDerName, argv[optind + 1]); - - typeName = (char *) malloc (strlen (argv[optind + 2]) + 1); - strcpy (typeName, argv[optind + 2]); + if (!(inputFileAsnName && inputFileDerName && typeName)) + { + fprintf(stderr, "allocation failed\n"); + free(inputFileAsnName); + free(inputFileDerName); + free(typeName); + exit(1); + } asn1_result = asn1_parser2tree (inputFileAsnName, &definitions, errorDescription); @@ -219,7 +228,7 @@ main (int argc, char *argv[]) fclose(inputFile); */ - if (decode (definitions, typeName, der, der_len, benchmark, strict) != ASN1_SUCCESS) + if (decode (definitions, typeName, der, der_len, benchmark, flags) != ASN1_SUCCESS) { asn1_delete_structure (&definitions); free (inputFileAsnName); @@ -245,7 +254,7 @@ main (int argc, char *argv[]) static int simple_decode (asn1_node definitions, const char *typeName, void *der, - int der_len, int benchmark, int strict) + int der_len, int benchmark, int flags) { int asn1_result; @@ -265,9 +274,9 @@ simple_decode (asn1_node definitions, const char *typeName, void *der, return asn1_result; } - if (strict != 0) + if (flags != 0) asn1_result = - asn1_der_decoding2(&structure, der, &der_len, ASN1_DECODE_FLAG_STRICT_DER, errorDescription); + asn1_der_decoding2(&structure, der, &der_len, flags, errorDescription); else asn1_result = asn1_der_decoding (&structure, der, der_len, errorDescription); @@ -293,19 +302,19 @@ simple_decode (asn1_node definitions, const char *typeName, void *der, static int decode (asn1_node definitions, const char *typeName, void *der, int der_len, - int benchmark, int strict) + int benchmark, int flags) { struct benchmark_st st; if (benchmark == 0) - return simple_decode (definitions, typeName, der, der_len, benchmark, strict); + return simple_decode (definitions, typeName, der, der_len, benchmark, flags); else { start_benchmark (&st); do { - simple_decode (definitions, typeName, der, der_len, benchmark, strict); + simple_decode (definitions, typeName, der, der_len, benchmark, flags); st.size++; } while (benchmark_must_finish == 0); diff --git a/src/asn1Parser.c b/src/asn1Parser.c index 7a3ae67..475bfc9 100644 --- a/src/asn1Parser.c +++ b/src/asn1Parser.c @@ -139,7 +139,7 @@ main (int argc, char *argv[]) default: fprintf (stderr, "asn1Parser: ?? getopt returned character code Ox%x ??\n", - option_result); + (unsigned)option_result); } } diff --git a/src/benchmark.c b/src/benchmark.c index 751586b..f36115b 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -30,7 +30,7 @@ int benchmark_must_finish = 0; #if defined _WIN32 #include <windows.h> -DWORD WINAPI +static DWORD WINAPI alarm_handler (LPVOID lpParameter) { HANDLE wtimer = *((HANDLE *) lpParameter); |