aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
AgeCommit message (Collapse)Author
2013-03-12PER: Ensure that the complete encoding is at least one byteBjörn Gustavsson
If the encoding is empty (i.e. if a top-level type is single-valued and therefore not encoding), the result should be a single zero byte.
2013-03-08PER/UPER: Correct decoding of ENUMERATEDs with a single valueBjörn Gustavsson
An ENUMERATED with as single value is not encoded. The decoder incorrectly assumed that it was encoded in one bit.
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-16asn1ct: Eliminate use of obsolete size/1Björn Gustavsson
Also teach otp_SUITE:call_to_size/1 that calls to size/1 is no longer allowed within the asn1 application.
2013-02-16Eliminate use of obsolete size/1 in generated codeBjörn Gustavsson
It is recommended to use byte_size/1 or tuple_size/1 instead of size/1.
2013-02-15BER: Fix broken table constraints inside a SET OF/SEQUENCE OFBjörn Gustavsson
2013-02-14der: Correct code generation for checking of empty setsBjörn Gustavsson
The ASN.1 compiler would generate an Erlang module with incorrect syntax for: T DEFINITIONS AUTOMATIC TAGS ::= BEGIN Empty ::= SET { } S ::= SEQUENCE { e Empty DEFAULT {} } END
2013-02-14per,uper: Fix breakage of compilation of InformationFrameworkBjörn Gustavsson
Commit f16f43446a04c459486356c0b4ad517cc9201895 broke compilation of InformationFramework for per and uper.
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-25Merge branch 'bjorn/asn1/further-cleanup/OTP-10588'Björn Gustavsson
* bjorn/asn1/further-cleanup/OTP-10588: (28 commits) Don't export encode_disp/2 and decode_disp/2 in generated modules Remove vestiges of support for the {TypeName,Value} notation Simplify the functions for decoding lengths per,uper: Optimize decoding of the remaining data types per,uper: Optimize decoding of the remaining string types Share all code for dec_gen_prim/3 between per/uper back-ends per,uper: Optimize decoding of the string data types testPrimStrings: Test some constraints By default, encode BIT STRING to bitstrings Teach encode functions to accept a bitstring term for a BIT STRING Fix EXTERNAL 1990/1994 conversion information loss uper: Look up some SizeConstraints at compile-time Enumeration decoding: Don't emit a default clause if it cannot match Slightly optimize per encoding of large INTEGERs with constraints BER run-time: Refactor decoding of string data types Refactor decoding of BIT STRINGs Optimize encoding of ENUMERATED in per and uper Remove the unused run-time modules eldap: Remove calls to undocumented asn1rt* functions BER: Correct bug in 'undec_rest' ...
2013-01-24Don't export encode_disp/2 and decode_disp/2 in generated modulesBjörn Gustavsson
Those functions were exported for no good reason.
2013-01-24Remove vestiges of support for the {TypeName,Value} notationBjörn Gustavsson
Support in BER was removed in 3d1279f3cebfdd2483c3afea9f225613fe45cd00.
2013-01-23Simplify the functions for decoding lengthsBjörn Gustavsson
Now that the decoding of all types are generated inline, we can take out most of the code for decoding lengths.
2013-01-23per,uper: Optimize decoding of the remaining data typesBjörn Gustavsson
2013-01-23per,uper: Optimize decoding of the remaining string typesBjörn Gustavsson
2013-01-23Share all code for dec_gen_prim/3 between per/uper back-endsBjörn Gustavsson
2013-01-23per,uper: Optimize decoding of the string data typesBjörn Gustavsson
2013-01-23By default, encode BIT STRING to bitstringsBjörn Gustavsson
Add the option 'legacy_bit_string' to decode to the old list format.
2013-01-23Turn warnings to errors on selected applicationsBjörn Gustavsson
2013-01-22Teach encode functions to accept a bitstring term for a BIT STRINGBjörn Gustavsson
We do it in the simplest possible way by converting the bitstring to a compact bitstring tuple. The encoding of BIT STRINGs should be cleaned up and optimized.
2013-01-22Fix EXTERNAL 1990/1994 conversion information lossBjörn Gustavsson
There are two different definitions of the EXTERNAL data type in ASN.1: the original from 1990 and an updated from 1994. Both defintions are encoded in the same way (in BER). There are still systems in use that use the old definition of EXTERNAL, so the asn1 application must still support both. It has been decided that the asn1 application should handle both the forms without any compiler options. Internally the asn1 application uses the 1990 definition. The encode functions will accept both definitions, but translate the 1994 format to the 1990 format if needed. When decoding, it will decode to the 1990 definition format first and then translate to the 1994 defintion format. One problem with this approach is that the conversion to the 1994 format may not be loss-less (where the 1990 defintion had a CHOICE between an OPEN TYPE, OCTET STRING, or BIT STRING, the 1994 definition only supports an OCTET STRING), and therefore it might not be possible to correctly re-encode the data in the 1990 format. It seems that the only reliable way to handle that problem is to not do the conversion to the 1994 format if the conversion is not loss-less. (There is an attempt when translating to the 1990 format to recover the CHOICE alternative based on the Erlang type of the data value, but that is neither reliable nor future-proof.) That is, when decoding an EXTERNAL value, the resulting tuple could either conform to the 1990 or 1994 definition, and applications must be prepared to handle that. The mail conversation where this issue was first reported can be found here: http://erlang.org/pipermail/erlang-questions/2011-April/057697.html Reported-by: Harald Welte <[email protected]>
2013-01-22uper: Look up some SizeConstraints at compile-timeBjörn Gustavsson
2013-01-22Enumeration decoding: Don't emit a default clause if it cannot matchBjörn Gustavsson
Dialyzer will warn for default clauses that cannot possible match.
2013-01-22Slightly optimize per encoding of large INTEGERs with constraintsBjörn Gustavsson
2013-01-22BER run-time: Refactor decoding of string data typesBjörn Gustavsson
In the BER run-time code (asn1rtt_ber), there is a general function for decoding a string: decode_restricted_string(Tlv, Range, StringType, TagsIn) But the StringType argument is not important. It is only used internally in asn1rtt_ber to distinguish universal strings and BMP strings from other strings. By slightly refactoring the string decoding code, we can eliminate the StringType argument and a subsequent run-time test on the string type. That will slightly reduce code size, slightly increase speed, and eliminate Dialyzer warnings.
2013-01-22Refactor decoding of BIT STRINGsBjörn Gustavsson
Refactor decoding of BIT STRINGs so that the run-time code does not spend testing conditions that are known already at compile-time (which wastes time and produces unnecessary Dialyzer warnings). There are three ways to decode BIT STRINGs: 1) To a list of bit names (and {bit,Position} for unnamed positions) if the BIT STRING type has any bit names. 2a) To a list of ones and zeros if there are no named bits, and the compact_bit_string option was NOT given. 2b) To a {Unused,Bin} tuple if there are no named bits compact_bit_string option WAS given. Structure the decoding functions in the same way.
2013-01-22Optimize encoding of ENUMERATED in per and uperBjörn Gustavsson
Always pre-encode the values for the enumeration. Clean up the code and let the per and uper back-ends share the code.
2013-01-22Remove the unused run-time modulesBjörn Gustavsson
2013-01-22Correct error handling for the NIF functionsBjörn Gustavsson
Also make sure that the error handling is contained within the asn1rt_nif module and does not leak out to generated code.
2013-01-22Generate modules with selected run-time functions for compiler usageBjörn Gustavsson
2013-01-22Remove the 'inline' and '{inline,OutputFile}' optionsBjörn Gustavsson
2013-01-22Add and use asn1rtt_extBjörn Gustavsson
2013-01-22Add and use asn1rtt_checkBjörn Gustavsson
2013-01-22Add run-time library templates and use themBjörn Gustavsson
The template modules (asn1rtt_*.erl) are based on the existing run-time modules, but with some simplifications and improvements, for example: The run-time functions for BER encoding took a Constraint argument which was not used. It has been eliminated, along with the unused StringType argument for the encode_restricted_string function. The Range argument for decode_enumerated() has been dropped since it was not used.
2013-01-22Add a mechanism for embedding run-time functions into the generated codeBjörn Gustavsson
2013-01-22Fix a bug where necessary alignment would be skippedBjörn Gustavsson
2013-01-18Merge branch 'nox/enable-silent-rules/OTP-10726'Björn-Egil Dahlberg
* nox/enable-silent-rules/OTP-10726: Implement ./otp_build configure --enable-silent-rules
2013-01-15Implement ./otp_build configure --enable-silent-rulesAnthony Ramine
With silent rules, the output of make is less verbose and compilation warnings are easier to spot. Silent rules are disabled by default and can be disabled or enabled at will by make V=0 and make V=1.
2013-01-10Merge branch 'bjorn/asn1/extension-addition-groups/OTP-10664'Björn Gustavsson
* bjorn/asn1/extension-addition-groups/OTP-10664: Fix a bug for multiple extension addition groups
2013-01-07Fix a bug for multiple extension addition groupsBjörn Gustavsson
Encoding would fail.
2012-12-21Always inline decoding of open typesBjörn Gustavsson
2012-12-19Eliminate code duplicationBjörn Gustavsson
It seems that the code was duplicated only to avoid emitting a semi-colon before the first case clause. Handle that by passing a Sep argument instead. While at it, also do the following clean-ups: * Replace lists:keysearch/3 with lists:keyfind/3. * Replace the use of is_record/2 with matching
2012-12-19per: Slightly optimize encoding of fixed OCTET STRINGsBjörn Gustavsson
Do the following optimizations: * Optimize construction of OCTET STRINGs of size 2 by using the 45 opcode instead of the 10 opcode for each character. * Use exact comparison (implicit by matching) instead of '=='. * Use list literals when more than one integer is added to a list (e.g. [[45,16,2],...] instead of [45,16,2,...]). Results in fewer BEAM instructions and less garbage. * Cons instead of building a nested list when possible. Example: [20,TempLen|TmpVal] instead of [20,TempLen,TmpVal]. * Omit the "2" opcode (align to byte boundary) before the "20" and "21" opcodes (because they imply alignment). * Assign the value to be encoded to a temporary variable, to avoid calling element/2 more than once.
2012-12-19per: Fix encoding of OCTET STRINGs with fixed length of 256 or moreBjörn Gustavsson
2012-12-19Remove support for the {Typename,Value} notation in encodingBjörn Gustavsson
Support for the notation was removed in 6ef8cbdaaaa1c30a7dc462063.
2012-12-18asn1ct_parser2: Let synonyms share parsing codeBjörn Gustavsson
UNION and "|" are synonyms, as are INTERSECTION and "^". Use the same parsing code for the synonyms.
2012-12-18Add a test case for constraint equivalenceBjörn Gustavsson
The constraint simplification pass need to be seriously rethought and rewritten. As a starting point, add a test case to test that equivalent ways to write a constraint are reduced to the same simplified constraint. Fix a few obvious bugs to make the test cases to pass.
2012-12-18Make .abs file consultableBjörn Gustavsson
2012-12-18Fix a bug in skipping of extensionsBjörn Gustavsson
Extensions following a double bracket group were not skipped correctly. Fix this bug and add tests to ensure that extensions are skipped correctly.
2012-12-18asn1rt_uper_bin: Correct incorrect skipping of extensionsBjörn Gustavsson
Commit 1b622484ea984f3bc424d2a6760e2d961bfcf816 changed the type of the extension bitmap for uper (from a tuple to a bitstring), but did not do the the corresponding change to the run-time module.