aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
AgeCommit message (Collapse)Author
2015-03-06asn1ct_gen: Correct generation of .hrl files for multiple ellipsesBjörn Gustavsson
2015-03-06Fix BER code generationDan Gudmundsson
PKIX1Explicit-2009 did not compile. This commit was cherry-picked from 3ab3b07a already merged into master.
2014-12-09Prepare releaseErlang/OTP
2014-11-27Merge branch 'dgud/asn1/fix-seqtag/OTP-12326' into maintDan Gudmundsson
* dgud/asn1/fix-seqtag/OTP-12326: asn1: Fix EXTERNAL (1994 variant) type conversion
2014-11-26asn1: Fix EXTERNAL (1994 variant) type conversionDan Gudmundsson
Missed to add seqtag handling for EXTERNAL type conversion, bug introduced in c266196c016fc1156c7a18cfeec4920ee4075519
2014-11-24Fix IMPLICIT tagging when TagDefault is AUTOMATICSimon Cornish
This patch fixes a bug with compliance to X.680 (200811) s31.2.7 Basically, when TagDefault is AUTOMATIC then tags are IMPLICIT unless EXPLICIT is given.
2014-11-18Add test for IMPLICIT tagging when TagDefault is AUTOMATICSimon Cornish
2014-09-29BER decoding: Don't allow primitives with indefinite lengthsBjörn Gustavsson
According to the BER encoding rules, only constructed values may have indefinite lengths. A primitive value must be encoded with a definite length. Reported-by: Simon Cornish
2014-09-15Update release notesErlang/OTP
2014-09-15Update version numbersErlang/OTP
2014-09-08Merge branch 'bjorn/asn1/misc-bug-fixes/OTP-12125' into maintBjörn Gustavsson
* bjorn/asn1/misc-bug-fixes/OTP-12125: Workaround for combining two object sets separated by extension Clean up and correct handling of parameters for parameterized types Check the formal parameter for parameterized type definitions Report errors also for unused parameterized types Remove unused code for ABSTRACT-SYNTAX and TYPE-IDENTIFIER Correct expansion of parameterized types Add the module name to the #classdef{} record Eliminate the use of #identifier{} outside the tokeniser and parser Fix problem with object identifiers in external modules Rewrite get_referenced_type/2 Teach the ASN.1 compiler to handle objects in field names Teach the ASN.1 compiler to understand "EXPORTS ALL" Teach the ASN.1 compiler the parse option
2014-09-08Merge branch 'bjorn/asn1/decoding-robustness/OTP-12145' into maintBjörn Gustavsson
* bjorn/asn1/decoding-robustness/OTP-12145: BER decoding: Improve error checking for indefinite length BER: Test decoding of indefinite lengths
2014-09-01Workaround for combining two object sets separated by extensionBjörn Gustavsson
The following type of code would crash the compiler: OSET SOME-CLASS ::= {OSET1, ..., OSET2}
2014-09-01Clean up and correct handling of parameters for parameterized typesBjörn Gustavsson
The previous code looked at the actual parameters supplied when instantiating the type to determine the type of the argument; the correct way is to determine the type by looking at the governor and case of the formal parameter.
2014-09-01Check the formal parameter for parameterized type definitionsBjörn Gustavsson
Check the formal parameters for a parameterized type definition. If the governor for a formal parameter is absent, the formal parameter must be in upper case.
2014-09-01Report errors also for unused parameterized typesBjörn Gustavsson
Definitions for parameterized types are verified once very early, and one more time when they are instantiated. Errors found during the first check were ignored, so errors for unused parameterized types were not reported.
2014-09-01Remove unused code for ABSTRACT-SYNTAX and TYPE-IDENTIFIERBjörn Gustavsson
Before classes were fully implemented, there was support for ABSTRACT-SYNTAX and TYPE-IDENTIFIER. Some of that code is still there and is no longer used. Get rid of it and correct comments.
2014-09-01Correct expansion of parameterized typesBjörn Gustavsson
Attempting to compile: SomeType{SOME-CLASS-NAME, SOME-CLASS-NAME:SomeSet} ::= ... SEQUENCE { something SOME-CLASS-NAME.&id({SomeSet}) } would crash the compiler, because the actual parameter for SOME-CLASS-NAME was not substituted into the governor for the SomeSet parameter. While we are at it, combine the functionality of is_class/2 and get_class_def/2 (eliminating is_class/2). Most callers call both function.
2014-09-01Add the module name to the #classdef{} recordBjörn Gustavsson
If we want construct an #'Externaltypereference'{} from a #classdef{} record, we will need the module name.
2014-09-01Eliminate the use of #identifier{} outside the tokeniser and parserBjörn Gustavsson
The only remaining use of #identifier{} in asn1ct_check was in a temporary packaging of a value that would be ultimately be put into #valuedef{}. Therefore we can eliminate that last usage but putting the value directly into a #valuedef{} and we can move the record definition into asn1ct_parser2.
2014-09-01Fix problem with object identifiers in external modulesBjörn Gustavsson
When parsing ASN.1, certain constructs can only be understood in the full context of the entire ASN.1 module. For instance, the value following ID in this simplified excerpt from MTSAbstractService88: administration-88 PORT ::= { ID {id-pt-administration 88} } the value following "ID" can be interpreted either as value for: SEQUENCE { id-pt-administration INTEGER } or as an OBJECT IDENTIFIER. Our ASN.1 parser assumes that a SEQUENCE is meant, and if that later turns out to be wrong, the SEQUENCE value is rewritten to an OBJECT IDENTIFIER. The problem is that at the time of the rewrite, we no longer know in which ASN.1 module id-pt-administration was defined in, and we have to use the module name in the state{} record. Unfortunately, the module name in the state{} record may not always be correct. While there are attempts in the code to keep the module name up-to-date when checking imported types, it is not done consistently, and it seems to be a difficult and error-prone task to attempt to make it consistent. A safer and less error-prone approach is to make sure that we don't lose the module name while parsing. To make it clear what we are doing, we will introduce a new #seqtag{} record that are used for tags in SEQUENCE values. The name is based on its primary use. The record also contains the module in case it happens to be an OBJECT IDENTIFIER.
2014-09-01Rewrite get_referenced_type/2Björn Gustavsson
Make sure that we continue to follow external references until we find a real type.
2014-09-01Teach the ASN.1 compiler to handle objects in field namesBjörn Gustavsson
2014-09-01Teach the ASN.1 compiler to understand "EXPORTS ALL"Björn Gustavsson
EXPORTS ALL is the same as leaving out the EXPORTS statement.
2014-09-01Teach the ASN.1 compiler the parse optionBjörn Gustavsson
2014-08-25Fix misspellings of 'another'Tuncer Ayaz
2014-08-11BER decoding: Improve error checking for indefinite lengthBjörn Gustavsson
When an indefinite length was given, the decoder could look beyond the end of the buffer for the 0,0 that signals the end of the value.
2014-08-11BER: Test decoding of indefinite lengthsBjörn Gustavsson
The BER encoder always encodes length as definite lengths. Therefore indefinite lengths are not well-tested. Add code to the roundtrip functions in asn1_test_list to automatically rewrite definite lengths to indefinite length and call the decoder again.
2014-06-19Prepare releaseErlang/OTP
2014-06-05BER: Eliminate dialyzer warnings for specialized decode functionsBjörn Gustavsson
2014-06-05BER: Eliminate dialyzer warning for encoding of BIT STRINGsBjörn Gustavsson
2014-06-05BER: Optimize encoding of ENUMERATEDBjörn Gustavsson
This will also eliminate a dialyzer warning.
2014-06-05BER: Remove a redundant clause in encoding of open typesBjörn Gustavsson
The clause is just an optimization for a (extremly rare) special case. Removing it will eliminate a dialyzer warning.
2014-06-05(U)PER: Fix decoding of named INTEGERBjörn Gustavsson
2014-06-05(U)PER: Fix encoding of a semi-constrained, named INTEGERBjörn Gustavsson
The code generator would crash.
2014-06-05(U)PER: Optimize handling of named BIT STRING with a lower zero boundBjörn Gustavsson
If a named BIT STRING has a lower size bound of 0, treat it the same way as if there was no constraint for the purposes of trailing zero bits. That change will eliminate a dialyzer warning.
2014-06-05PER: Optimize encoding of character strings with simple rangesBjörn Gustavsson
The encoder for the following type would generate a dialyzer warning: Ns ::= NumericString (FROM ("0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9")) Optimize this case to make it slightly faster as well as eliminate the dialyzer warning.
2014-06-05PER: Remove unnecessary clause for handling DEFAULTBjörn Gustavsson
2014-06-05(U)PER: Suppress dialyzer warnings for complete/1Björn Gustavsson
2014-06-05Test suites: Add support for running Dialyzer on generated codeBjörn Gustavsson
Running dialyzer on test suites is good for finding both bugs and useless dialyzer warnings. Add a mechanism in asn1_test_lib for turning on running of dialyzer on all generated code. Turned off by default, because it is slow and because there are still a few dialyzer warnings left.
2014-06-05Improve tests of DEFAULT valuesBjörn Gustavsson
2014-06-05Correct OCTET STRING default when legacy_erlang_types is activeBjörn Gustavsson
The default value for an OCTET STRING when legacy_erlang_types was active would be a binary instead of a list.
2014-06-05Remove old DEFAULT-checking code made obsolete in the previous commitBjörn Gustavsson
2014-06-05Rewrite the code for testing DEFAULT for DERBjörn Gustavsson
The old code for testing DEFAULT values is messy, inefficient, and causes dialyzer warnings.
2014-05-06Test DEFAULT more thoroughlyBjörn Gustavsson
We need to test DEFAULT values both with and without legacy_erlang_types.
2014-05-06Set.py: Correct illegal DEFAULT valueBjörn Gustavsson
If SetIn is defined like this: SetIn ::= SET { boolIn BOOLEAN, intIn INTEGER } then it may not be used with an empty DEFAULT value like this: SetDef1 ::= SET { set1 SetIn DEFAULT {} } The ASN.1 compiler prints an warning message, but still generates code. (That should be fixed.) Fix the incorrect ASN.1 specification by making the components in SetIn optional: SetIn ::= SET { boolIn BOOLEAN OPTIONAL, intIn INTEGER OPTIONAL }
2014-05-06BER: Optimize decoding of ENUMERATEDBjörn Gustavsson
2014-05-06BER: Suppress dialyzer warnings for encode_bit_string/4Björn Gustavsson
We don't want to touch the code used for encoding BIT STRINGs when 'legacy_erl_types' is active, since it will be removed within two or three major releases. But we do want to suppress the dialyzer warnings in the meantime. The easiest way is to call encode_bit_string/4 with unknown types from an exported function that is never actually called like this: -export(['dialyzer-suppressions'/0]). 'dialyzer-suppressions'(Arg) -> {A,B,C,D} = Arg, encode_bit_string(A, B, C, D), ok.
2014-04-29BER: Inline testing of constraints when decodingBjörn Gustavsson
Calling library routines for validation of constraints may cause dialyzer warnings if some type of constraints handled by the library routine are not used in a specific ASN.1 module. To avoid those warnings (and slightly speed up the decoding), inline the constraint checking.
2014-04-16Refactor gen_dec_prim/3 to facilitate future optimizationsBjörn Gustavsson