Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sub-parsers for SEQUENCE/SET OF #30

Open
vanrein opened this issue Mar 3, 2017 · 2 comments
Open

Support for sub-parsers for SEQUENCE/SET OF #30

vanrein opened this issue Mar 3, 2017 · 2 comments

Comments

@vanrein
Copy link
Owner

vanrein commented Mar 3, 2017

Quick DER chooses to be simplistic in terms of memory management. Layers built around it, such as LillyDAP may well be smarter.

This means that the one thing Quick DER refuses, namely to parse SEQUENCE OF and SET OF, can be supported with some help of the outer layer. The issue now is to make Quick DER support such outer layers (and test it with LillyDAP).

We could map to a dernode union instead of dercursor for these structures, and initially der_unpack() into the same form as now namely the dercursor in the wire variant of the union; surrounding code in the smarter application can then be mapped to the info form with an array pointer derray and array length count dercnt. The array elements themselves are dernode values once more. It is the application's knowledge when to use the wire form and when to use info. It usually maps one way after der_unpack() and the other way before der_pack().

Finally, the ASN.1 compiler must produce useful definitions that guide the application to the indices and syntaxes of sub-elements -- which must be supportive of a recursive procedure because, for instance, there may be a SEQUENCE OF inside of a SEQUENCE OF. Such recursion would of course apply to each individual element, as the structure is repeating.

Once this is done, we shall consider adding generic code to Quick DER, using a callback for memory allocation.

@vanrein
Copy link
Owner Author

vanrein commented Mar 6, 2017

Commit 3a360ae does most of this, but it is not yet complete.

  • DONE: Controls translates with bad/default field names; idd geen name, want geen SEQUENCE!
  • DONE: No psub generated for SearchResultEntry, which refers to a def with SEQUENCE OF
  • DONE: Endless recursion for PSUB from RFC 4511: Filter -> and -> Filter
  • DONE: Filter -> substrings -> SubstringFilters -> substrings: 2x offsetof() but both on _Filter and not on _SubstringFilters
  • TODO: Check _mod_tp: rfc4373.UpdateOperationList -> SEQUENCE OF SEQUENCE -> AddRequest -> attributes -> SEQUENCE OF
  • TODO: rfc4373.UpdateOperationList, updateOperation.addRequest offsets both in UpdateOperationList
  • DONE: Recursive includes of ASN.1 modules
  • TODO: Define struct psub_somestruct and consider if it needs a size for the repeated type

@vanrein vanrein changed the title Support for sub-parsers Support for sub-parsers for SEQUENCE/SET OF Mar 6, 2017
@vanrein
Copy link
Owner Author

vanrein commented Mar 7, 2017

Commit 3b12800 resolved most issues that showed up while working on the code and inspecting header files:

  • DONE: Controls below, translates with bad/default field names; idd geen name, want geen SEQUENCE!
  • DONE: No psub generated for SearchResultEntry, which refers to a def with SEQUENCE OF
  • DONE: Endless recursion for PSUB from RFC 4511: Filter -> and -> Filter, see below
  • DONE: Filter -> substrings -> SubstringFilters -> substrings: 2x offsetof() but both on _Filter
  • DONE: Recursive includes of ASN.1 modules
  • DONE: Define struct psub_somestruct and consider if it needs a size for the repeated type
  • DONE: Do not generate derwalk[] and struct psub_somestruct when out-of-module / out-of-type
  • DONE: Refs like DER_xxxx_mod_tp_at have tp=dest instead of tp=source: AuthzData_authz_data in Authn
  • DONE: Generate DER_PACK_mod_tp_at when tp.at is a repeated type / follow NamedType coolness too
  • DONE: Generate DER_OVLY_mod_tp_at when tp.at is a repeated type / follow NamedType coolness too
  • DONE: Test that all definitions are found, and it can all compile properly
  • DONE: Badly gen'd DER_ELEMSZ (rfc4511,AttributeList,0) --> should be ,attribute) due to NamedType
  • DONE: Badly gen'd DER_PACK/PSUB_rfc4511_AttributesList_0 should be _attribute due to NamedType
  • DONE: Check _mod_tp: rfc4373.UpdateOperationList -> SEQ-OF-SEQ -> AddRequest -> attributes -> SEQ-OF
  • DONE: rfc4373.UpdateOperationList, updateOperation.addRequest offsets both in UpdateOperationList
  • DONE: rfc4373 nested structs, moet zijn: updoplist_0 -> dan + updateOperation -> dan + addRequest
  • TODO: rfc4373 has UpdateOperationList_0 type yet skips the _0 as if it were a default, not element
  • DONE: Write library routines to support memory allocating applications that use Quick DER
  • DONE: struct DER_OVLY_xyz before the field defs does not mean that plain type DER_OVLY_xyz exists
  • DONE: DER_OFFSET / DER_ELEMSZ could use "struct" if it weren't for the #define DER_OVLY_ aliases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant