aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2015-01-12Remove special case in parserBjörn Gustavsson
The parser handled the builtin ABSTRACT-SYNTAX and TYPE-IDENTIFIER classes specially, which caused problems. It turns out that there is no longer any need to handle those classes specially.
2015-01-12Improve handling of BIT STRING valuesBjörn Gustavsson
2015-01-12Check more errors in the simplified syntaxBjörn Gustavsson
An optional group must not contain mandatory class fields. All mandatory fields must be included in the simplified syntax.
2015-01-12Add the rfcs test caseBjörn Gustavsson
Add the ASN.1 specs from RFC-5911 and RFC-5912.
2015-01-12Handle CLASS.&field when checking valuesBjörn Gustavsson
2015-01-12Clean up and correct validation of OBJECT IDENTIFIER/RELATIVE-OIDDan Gudmundsson
Besides simplifying the code and doing better error checking and error reporting, fix the following bugs: Support retrieving an OBJECT IDENTIFIER/RELATIVE-OID from an object. Example: oid OBJECT IDENTIFIER ::= some-object.&some-field Allow an integer constant first in an OBJECT IDENTIFIER: integer INTEGER ::= 0 oid OBJECT IDENTIFIER ::= {integer 1}
2015-01-12Fix object set duplication testBjörn Gustavsson
Wrong fields in the record where checked when sorting, which caused duplicate objects to exist in constructed object sets and later caused an error.
2015-01-12per/uper: Fix code generation for nested types in objectsBjörn Gustavsson
2015-01-12Clean up use of asn1ct_gen:gen_types()Björn Gustavsson
asn1ct_gen:gen_types/3 is called by gen_encode_constructed/4 and generates encode *and* decode functions for any nested types. To faciliate future rewriting, where we might want to tweak code generation for encode and decode separately, refactor the code so that gen_encode_constructed/4 will only encode functions for nested types, and gen_deccode_constructed/4 will generate decode functions for nested types.
2015-01-12Correct recursion in OCTET STRING value definitionsBjörn Gustavsson
2015-01-12Fix BER code generationDan Gudmundsson
PKIX1Explicit-2009 did not compile.
2015-01-12Clean up get_fieldname_element/3Björn Gustavsson
Also add proper error handling.
2015-01-12Provide more reliable location of errorsBjörn Gustavsson
File names and line number information was not reliable available when producing error messages. Some items have embedded line number information, and sometimes the S#state.type and/or S#state.value could be used to retrieve the line number information. To make sure that we can always retrieve at least an approximate error location, store the top-level construct being checked in S#state.error_context. Example of top-level constructs: Seq ::= SEQUENCE {...} i INTEGER ::= 42 This is a short-term solution. In the long term, we would want the parser to include line number information in all items.
2015-01-12asn1: Fix BER generation for non optional and extended object setsDan Gudmundsson
Object sets with extension mark and without optional fields was not generated properly. It needs the default [enc|dec]_xxx function clause for the open type but no other clauses.
2015-01-12Rewrite matching of object definitions using the simplified syntaxBjörn Gustavsson
Rewrite the confusing and buggy matching of an object definition against the simplified syntax. While we are at it, we will also add proper error handling.
2015-01-12Simplify handling of an empty object definitionBjörn Gustavsson
When the parser sees: something SOMETHING ::= {} it has no way of knowing whether 'something' is an value or an object. It depends on how SOMETHING is defined. For example: SOMETHING ::= SEQUENCE {} or SOMETHING ::= CLASS { &id OPTIONAL } Because of that ambiguity, there is no way to avoid a special case when we check an object definition. However, there is no need to invent an entire new checking function for this special case. It is much easier to just pretend that the parser gave us {object,defaultsyntax,[]} and let check_objectdefn/3 check it in the usual way.
2015-01-12Use object_to_check/1 in two forgotten placesBjörn Gustavsson
An #'Externavaluereference'{} may either be a value or an object. In places where objects are expected, we will need to call object_to_check/1 to convert an #'Externavaluereference'{} to an object. It was forgotten in two places.
2015-01-12Refactor code involving calls to get_fieldname_element/3Björn Gustavsson
Refactor and clean up code. While at it, add error handling and test cases. (Also add test cases for the existing values in ValueTest.asn while we are it.) Add support for defining INTEGER constants by extracting fields from objects. Example: int-from-object INTEGER ::= object.&id When extracting values from objects in constraints, only one level of extraction would work. That is, the following would work: SomeName ::= INTEGER (object.&int) but not: SomeName ::= INTEGER (object.&obj.&int)
2015-01-12Check INTEGER values betterBjörn Gustavsson
There is duplicated effort in that validate_integer() checks whether the integer value is valid, and then normalize_integer() does mostly the same work in order to convert the value to an integer. Eliminate the validate_integer() function and incorporate its checks into normalize_integer(). Also produce proper error messages.
2015-01-12Check CLASS names for validityBjörn Gustavsson
Class names must start with an uppercase letter and only contain uppercase letters, digits, or hyphens. The parser will not allow class names that don't start with an uppercase letter, so we don't have to check that.
2015-01-12Add a new test case to test values in ValueTest.asn1Björn Gustavsson
We only tested that ValueTest.asn1 would compile, no that the values were correct.
2015-01-12Use the #objectclass{} record instead of a tupleBjörn Gustavsson
Don't build a record using the tuple syntax. It is bad in case we would want to change the record definition later.
2015-01-12Correct typo in an error messageBjörn Gustavsson
2015-01-12Merge branch 'bjorn/compiler/beam_dead/OTP-12393'Björn Gustavsson
* bjorn/compiler/beam_dead/OTP-12393: Update the comments that explain what beam_dead does Improve optimization of bs_start_match2 Extend count_bits_matched/3 to handle the UTF instructions misc_SUITE: Cover the exception handling code in beam_dead Generalize optimizations using shortcut_rel_op/4 beam_dead: Optimize branches from relational conditionals
2015-01-12Update the comments that explain what beam_dead doesBjörn Gustavsson
2015-01-09Improve optimization of bs_start_match2Björn Gustavsson
2015-01-09Extend count_bits_matched/3 to handle the UTF instructionsBjörn Gustavsson
While we are, clean up the comments and rearrange the code for clarity. Also add a test to cover the last uncovered line in beam_dead.erl.
2015-01-09misc_SUITE: Cover the exception handling code in beam_deadBjörn Gustavsson
Amend the test suite to call beam_dead as originally intended (and not beam_block), and modify the input data so that the exception will occur within the try ... catch block in function/2.
2015-01-09Generalize optimizations using shortcut_rel_op/4Björn Gustavsson
Better optimizations with less code.
2015-01-09beam_dead: Optimize branches from relational conditionalsBjörn Gustavsson
The BEAM compiler translates code such as: is_hex_digit(D) when $0 =< D, D =< $9 -> true; is_hex_digit(D) when $a =< D, D =< $z -> true; is_hex_digit(D) when $A =< D, D =< $Z -> true; is_hex_digit(_) -> false. to something like this: L0: test is_ge L1 {x,0} 48 test is_ge L1 57 {x,0} move true {x,0} return. L1: test is_ge L2 {x,0} 97 test is_ge L2 122 {x,0} move true {x,0} return L2: test is_ge L3 {x,0} 65 test is_ge L3 90 {x,0} move true {x,0} return L3: move false {x,0} return We can see that tests will be repeated even if they cannot possibly succeed. For instance, if we pass in {x,0} equal to 32, the first test that {x,0} is greater than or equal to 48 at L0 will fail. The control will transfer to L1, where it will be tested whether {x,0} is greater than 97. That test will fail and control will pass to L2, where again the test will fail. The compiler can do better by short-circuiting repeating tests: L0: test is_ge L3 {x,0} 48 test is_ge L1 57 {x,0} move true {x,0} return. L1: test is_ge L2 {x,0} 97 test is_ge L3 122 {x,0} move true {x,0} return L2: test is_ge L3 {x,0} 65 test is_ge L3 90 {x,0} move true {x,0} return L3: move false {x,0} return
2015-01-07Merge branch 'maint'Marcus Arendt
2014-12-29Merge branch 'lemenkov/use_os_getenv_2'Marcus Arendt
* lemenkov/use_os_getenv_2: fix missing include Start using os:getenv/2 fun Introduce os:getenv/2
2014-12-26Fix grammarDerek Brown
2014-12-22Merge branch 'maint'Bruce Yinhe
2014-12-22Merge branch 'mikpe/fix-eacces-spelling' into maintBruce Yinhe
* mikpe/fix-eacces-spelling: fix eacces spelling
2014-12-22Merge branch 'arekinath/aes-evp/OTP-12380'Marcus Arendt
* arekinath/aes-evp/OTP-12380: crypto: use EVP for AES-CBC
2014-12-19fix missing includeMarcus Arendt
2014-12-19Merge branch 'lukas/erts/crashdump_improvements/OTP-12377'Lukas Larsson
* lukas/erts/crashdump_improvements/OTP-12377: erts: Make main thread safe from pipe closed event erts: Improve crash dumps erts: Rename sys_sigset to sys_signal erts: Introduce thread suspend functions erts: Remove usage of QUANTIFY signal erts: Add support for thread names ets: Increase data available in crash dumps and ets:info erts: Start compilation of beam_emu earlier
2014-12-19ets: Increase data available in crash dumps and ets:infoLukas Larsson
OTP-12376
2014-12-19Merge branch 'maint'Hans Nilsson
2014-12-19Merge branch 'hans/eldap/bad_return_close/OTP-12349' into maintHans Nilsson
* hans/eldap/bad_return_close/OTP-12349: eldap: Remove trailing white space. eldap: Test cases for a few return values (open, close) eldap: updated eldap:close in tests eldap: Makes close/1 return as documented.
2014-12-19eldap: fix merge conflictHans Nilsson
2014-12-19Merge branch 'hans/eldap/test_improvents/OTP-12355' into maintHans Nilsson
* hans/eldap/test_improvents/OTP-12355: eldap: Corrects SSL over IPv6 test. eldap: Removes eldap_misc_SUITE that is now included in eldap_basic_SUITE. eldap: Add encode/decode tests. eldap: Merge eldap_connections_SUITE into eldab_basic_SUITE eldap: Adds ssl to connections test suite eldap: Updates basic test suite - Splits one large testcase into smaller ones. - Makes tests independent - Adds some tests.
2014-12-18Merge branch 'maint'Bruce Yinhe
2014-12-18Merge branch 'haguenau/fix-endianness-speling' into maintBruce Yinhe
* haguenau/fix-endianness-speling: Replaced "Endianess" with "Endianness" everywhere
2014-12-17eldap: Remove trailing white space.Hans Nilsson
2014-12-17eldap: Test cases for a few return values (open, close)Hans Nilsson
2014-12-17eldap: updated eldap:close in testsHans Nilsson
2014-12-17eldap: Makes close/1 return as documented.Hans Nilsson
2014-12-17eldap: Corrects SSL over IPv6 test.Hans Nilsson