Age | Commit message (Collapse) | Author |
|
|
|
|
|
* 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'
...
|
|
Those functions were exported for no good reason.
|
|
Support in BER was removed in 3d1279f3cebfdd2483c3afea9f225613fe45cd00.
|
|
Now that the decoding of all types are generated inline, we can
take out most of the code for decoding lengths.
|
|
|
|
|
|
|
|
|
|
|
|
Add the option 'legacy_bit_string' to decode to the old list format.
|
|
|
|
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.
|
|
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]>
|
|
|
|
Dialyzer will warn for default clauses that cannot possible match.
|
|
|
|
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.
|
|
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.
|
|
Always pre-encode the values for the enumeration. Clean up the
code and let the per and uper back-ends share the code.
|
|
|
|
enif_make_new_binary() cannot return NULL, so while at it,
remove the check for return value of enif_make_new_binary()
being NULL.
|
|
Also make sure that the error handling is contained within the
asn1rt_nif module and does not leak out to generated code.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
* nox/enable-silent-rules/OTP-10726:
Implement ./otp_build configure --enable-silent-rules
|
|
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.
|
|
* bjorn/asn1/extension-addition-groups/OTP-10664:
Fix a bug for multiple extension addition groups
|
|
Encoding would fail.
|
|
|
|
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
|
|
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.
|
|
|
|
Support for the notation was removed in 6ef8cbdaaaa1c30a7dc462063.
|
|
UNION and "|" are synonyms, as are INTERSECTION and "^". Use the same
parsing code for the synonyms.
|
|
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.
|
|
|
|
Extensions following a double bracket group were not skipped correctly.
Fix this bug and add tests to ensure that extensions are skipped
correctly.
|
|
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.
|
|
|
|
|
|
Also run the test case for all back-ends.
|
|
|
|
|