Skip to content

Commit 92fa4bd

Browse files
authored
Merge branch 'master' into fix_s1ap_code_generation_2
2 parents bb330ec + 07f8c3e commit 92fa4bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4147
-1308
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,24 @@ stamp-h*
4040
# /skeletons
4141
/skeletons/check-*
4242

43+
# /tests/
44+
/tests/tests-asn1c-smoke/Makefile.am.libasncodec
45+
/tests/tests-asn1c-smoke/Makefile.am.sample
46+
/tests/tests-asn1c-smoke/*.[acho]
47+
/tests/tests-asn1c-smoke/*.asn
48+
/tests/tests-asn1c-smoke/*.txt
49+
/tests/tests-asn1c-smoke/converter-example
50+
4351
# /tests/
4452
/tests/tests-c-compiler/test-*
4553

4654
# /tests/tests-skeletons
4755
/tests/tests-skeletons/check-*
4856
!/tests/tests-skeletons/check-*.c
4957

58+
# /tests/tests-randomized
59+
/tests/tests-randomized/test-param-helper
60+
5061
# /doc/docsrc
5162
doc/docsrc/*.aux
5263
doc/docsrc/*.dvi

ChangeLog

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99

1010
NOTABLE:
1111
* converter-sample.c renamed into converter-example.c.
12-
* OBJECT IDENTIFIER and RELATIVE-OID API simplified.
12+
* asn1c -no-gen-example option to disable converter-example generation.
1313
* Added random value generation (-R option to converter-example).
1414
* Added LibFuzzer-based randomized tests for supported transfer syntaxes
1515
(DER, OER, UPER, XER) into tests/tests-randomized. See the following
1616
article to get the latest LibFuzzer-enabled clang on macOS:
1717
https://medium.com/@levwalkin/compile-llvm-clang-libfuzzer-b61e82718430
1818
then ensure the new clang is in the way:
1919
CC=clang CXX=clang++ ./configure --enable-Werror --enable-test-fuzzer
20+
* OBJECT IDENTIFIER and RELATIVE-OID API simplified.
2021
* uper_encode() API got new argument (breaks API compatibility).
22+
* asn1c -gen-XXX flags are deprecated. Use -no-gen-XXX to disable codecs.
2123

2224
FIXES:
2325
* CVE-2017-12966 verified not present.

asn1c/asn1c.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ int
5656
main(int ac, char **av) {
5757
enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS;
5858
enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS;
59-
enum asn1c_flags asn1_compiler_flags = A1C_NO_C99;
59+
enum asn1c_flags asn1_compiler_flags =
60+
A1C_NO_C99 | A1C_GEN_OER | A1C_GEN_PER | A1C_GEN_EXAMPLE;
6061
enum asn1print_flags asn1_printer_flags = APF_NOFLAGS;
6162
int print_arg__print_out = 0; /* Don't compile, just print parsed */
6263
int print_arg__fix_n_print = 0; /* Fix and print */
@@ -71,7 +72,7 @@ main(int ac, char **av) {
7172
/*
7273
* Process command-line options.
7374
*/
74-
while((ch = getopt(ac, av, "EFf:g:hLPp:RS:vW:X")) != -1) switch(ch) {
75+
while((ch = getopt(ac, av, "EFf:g:hn:LPp:RS:vW:X")) != -1) switch(ch) {
7576
case 'E':
7677
print_arg__print_out = 1;
7778
break;
@@ -121,13 +122,27 @@ main(int ac, char **av) {
121122
asn1_compiler_flags |= A1C_GEN_PER;
122123
} else if(strcmp(optarg, "en-OER") == 0) {
123124
asn1_compiler_flags |= A1C_GEN_OER;
125+
} else if(strcmp(optarg, "en-example") == 0) {
126+
asn1_compiler_flags |= A1C_GEN_EXAMPLE;
124127
} else {
125128
fprintf(stderr, "-g%s: Invalid argument\n", optarg);
126129
exit(EX_USAGE);
127130
}
128131
break;
129132
case 'h':
130133
usage(av[0]);
134+
case 'n':
135+
if(strcmp(optarg, "o-gen-PER") == 0) {
136+
asn1_compiler_flags &= ~A1C_GEN_PER;
137+
} else if(strcmp(optarg, "o-gen-OER") == 0) {
138+
asn1_compiler_flags &= ~A1C_GEN_OER;
139+
} else if(strcmp(optarg, "o-gen-example") == 0) {
140+
asn1_compiler_flags &= ~A1C_GEN_EXAMPLE;
141+
} else {
142+
fprintf(stderr, "-n%s: Invalid argument\n", optarg);
143+
exit(EX_USAGE);
144+
}
145+
break;
131146
case 'P':
132147
asn1_compiler_flags |= A1C_PRINT_COMPILED;
133148
asn1_compiler_flags &= ~A1C_NO_C99;
@@ -500,14 +515,15 @@ usage(const char *av0) {
500515
" -fincludes-quoted Generate #includes in \"double\" instead of <angle> quotes\n"
501516
" -fknown-extern-type=<name> Pretend the specified type is known\n"
502517
" -fline-refs Include ASN.1 module's line numbers in comments\n"
503-
" -fno-constraints Do not generate constraint checking code\n"
504-
" -fno-include-deps Do not generate courtesy #includes for dependencies\n"
518+
" -fno-constraints Do not generate the constraint checking code\n"
519+
" -fno-include-deps Do not generate the courtesy #includes for dependencies\n"
505520
" -funnamed-unions Enable unnamed unions in structures\n"
506521
" -fwide-types Use INTEGER_t instead of \"long\" by default, etc.\n"
507522
"\n"
508523

509-
" -gen-OER Generate OER (X.696) support code\n"
510-
" -gen-PER Generate PER (X.691) support code\n"
524+
" -no-gen-OER Do not generate the OER (X.696) support code\n"
525+
" -no-gen-PER Do not generate the PER (X.691) support code\n"
526+
" -no-gen-example Do not generate the ASN.1 format converter example\n"
511527
" -pdu={all|auto|Type} Generate PDU table (discover PDUs automatically)\n"
512528
"\n"
513529

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ AM_CONDITIONAL([HAVE_PANDOC], [test -n "$PANDOC"])
288288
AC_CONFIG_FILES([\
289289
tests/tests-c-compiler/check-src/Makefile \
290290
tests/tests-asn1c-compiler/Makefile \
291+
tests/tests-asn1c-smoke/Makefile \
291292
tests/tests-randomized/Makefile \
292293
tests/tests-c-compiler/Makefile \
293294
tests/tests-skeletons/Makefile \

doc/asn1c-usage.pdf

38.3 KB
Binary file not shown.

doc/docsrc/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ regen:
88
$(XELATEX) $(XELATEX_FLAGS) -no-pdf $(TEXSRC)
99
$(XELATEX) $(XELATEX_FLAGS) $(TEXSRC)
1010

11-
EXTRA_DIST = $(srcdir)/*.tex
11+
EXTRA_DIST = $(srcdir)/*.tex $(srcdir)/*.inc
1212

1313
CLEANFILES = *.*~ *.aux *.dvi *.log *.out *.toc

0 commit comments

Comments
 (0)