TITAN ASN.1 compiler / BER decoder/ AUTOMATIC TAGS? [message #1805403] |
Sat, 13 April 2019 21:33 |
|
In Osmocom, we wanted to use TITAN also for 3G related tests, not just for 2G. In order to do that, we need support for (among other things) RANAP, which is specified in ASN.1 APER. WE do have an industry-proven ASN.1 compiler/runtime that can do the APER/BER transcoding. However, I simply cannot get TITAN to parse the BER generated by this compiler. Other BER decoders (using the same ASN.1 syntax) can decode that BER without any trouble. Maybe the'yre too tolerant? Or maybe TITAN is too strict?
The error message is:
RANAP_Selftests.ttcn:49: Dynamic test case error: While BER-decoding type '@RANAPMIN.RANAP-PDU': While decoding '@RANAPMIN.RANAP-PDU' type: Alternative 'initiatingMessage': While decoding '@RANAPMIN.InitiatingMessage' type: Component 'value_': While checking tags (expecting [2]): Tag mismatch: Received: [UNIVERSAL 16].
So TITAN is expecting a context-speciifc tag "2" , rather than the UNIVERSAL 16 (used for SEQUENCE). I wonder why that is?
I've been trying to wrap my head around this the first time in June last year, but gave up. I finally found the time to debug a bit further. In order to reduce the complexity, I created a rather simple test case at http://git.osmocom.org/osmo-ttcn3-hacks/tree/asn-test/ranap/min?h=laforge/iu which I also have attached here.
The APER original is '000f4010000001001740095046239134707780f3'O, the BER transcoded value is 'a01c80010f8101013014a0123010800117810101800846239134707780f3'O or in other ("unber") format:
<C O="0" T="[0]" TL="2" V="28">
<P O="2" T="[0]" TL="2" V="1"></P>
<P O="5" T="[1]" TL="2" V="1"></P>
<C O="8" T="[UNIVERSAL 16]" TL="2" V="20" A="SEQUENCE">
<C O="10" T="[0]" TL="2" V="18">
<C O="12" T="[UNIVERSAL 16]" TL="2" V="16" A="SEQUENCE">
<P O="14" T="[0]" TL="2" V="1"></P>
<P O="17" T="[1]" TL="2" V="1"></P>
<P O="20" T="[0]" TL="2" V="8">F#‘4pw€ó</P>
</C O="30" T="[UNIVERSAL 16]" A="SEQUENCE" L="18">
</C O="30" T="[0]" L="20">
</C O="30" T="[UNIVERSAL 16]" A="SEQUENCE" L="22">
</C O="30" T="[0]" L="30">
So
* at offset 0 we have the overall container of the InitiatingMessage
* at offset 2 we have the procedureCode
* at offset 5 we have the criticality
* at offset 8 we have the ProtocolIE-Container
* at offset 12 we have the PermanentNAS-UE-ID
* at offset 14 we have the ProtocolIE-ID
* at offset 17 we have the criticality
* at offset 20 we have the PermanentNAS-UE-ID/IMSI
I honestly believe the "constructed" UNIVERSAL 16 at ofset 8 to be correct, as the ProtocolIE-Container is a SEQUENCE, and SEQUENCE shall be encoded as UNIVERSAL 16, right?
Anyone with detailed ASN.1 BER knowledge who can help?
|
|
|
Re: TITAN ASN.1 compiler / BER decoder/ AUTOMATIC TAGS? [message #1805436 is a reply to message #1805403] |
Mon, 15 April 2019 10:00 |
|
It seems like there was a problem in the BER encoder of the [unnamed] prorprieetary ASN.1 compiler I used. It turns out being proprietary doesn't mean it's free of bugs :P
In the end, it may also very well be that the BER rules permit for multiple alternatives (BER is not very strict, unlike DER) and we're seeing an incompatibility.
In any case, I've verified that TITAN is able to consume the BER encoding of OSS Nokalva, so at least those two implementations seem to agree on the BER encoding.
Please don't spend any time following-up on this until I have concluded that in fact there is a problem in TITAN.
|
|
|
|
|
|
Re: TITAN ASN.1 compiler / BER decoder/ AUTOMATIC TAGS? [message #1805817 is a reply to message #1805815] |
Wed, 24 April 2019 15:34 |
Gyorgy Rethy Messages: 31 Registered: April 2015 |
Member |
|
|
The reason is:
RANAP-PDU-Descriptions {
...
DEFINITIONS AUTOMATIC TAGS ::=
Automatic tagging is assigning to each SEQUENCE/SET/CHOICE field, without a manually assigned tag, the subsequent context specific implicit tag, starting with [0]. This implicit tag at encoding overwrites the "original" tag of the field, i.e. the type identification tag (in case of explicit tagging the context specific tag would wrap the "type tag").
So, in RANAP Initiating message:
InitiatingMessage ::= SEQUENCE {
procedureCode RANAP-ELEMENTARY-PROCEDURE.&procedureCode ({RANAP-ELEMENTARY-PROCEDURES}),
criticality RANAP-ELEMENTARY-PROCEDURE.&criticality ({RANAP-ELEMENTARY-PROCEDURES}{@procedureCode}),
value RANAP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({RANAP-ELEMENTARY-PROCEDURES}{@procedureCode})
}
automatic tagging will assign the context-specific tag [2] to the field "value", which overwrites the [UNIVERSAL 16] tag of the information element's InitiatingMessage type, identified by the actual value of the procedureCode field .
|
|
|
Powered by
FUDForum. Page generated in 0.03637 seconds