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

Error validating DENM message on TimestampIts #212

Open
liviolima80 opened this issue Dec 7, 2023 · 1 comment
Open

Error validating DENM message on TimestampIts #212

liviolima80 opened this issue Dec 7, 2023 · 1 comment

Comments

@liviolima80
Copy link

Good morning,
I'm using Vanetza for generating DENM messages. When I create the DENM message I set detectionTime and referenceTime in the following way:

vanetza::ManualRuntime runtime_;
uint64_t detectionTime = runtime().now().time_since_epoch()).count();
uint64_t referenceTime= runtime().now().time_since_epoch()).count();
asn_uint642INTEGER(&denm.management.detectionTime, detectionTime);
asn_uint642INTEGER(&denm.management.referenceTime, referenceTime);

I verified that detectionTime and referenceTime are correctly set to elapsed ms from 1/1/2004

When I try to validate the DENM message with the validate() function of vanetza::asn1::Denm I get the following error:

error TimestampIts: value too large (.......\vanetza\vanetza\asn1\its\TimestampIts.c:26)

Investingating the check function for TimestampIts fields there is a control where the decoded field is compared to LONG_MAX (see asn_INTEGER2long function). Since long are 4 bytes and TimestampIts comes from 8 bytes values this control will always fail.

Can you help me to understand where is the issue?

Regards

@riebl
Copy link
Owner

riebl commented Dec 18, 2023

Hi @liviolima80,

are you using some custom ASN.1 stuff? Does Vanetza's ItsAsn1 test case run successfully on your system?
This test case exercises the TimestampIts type using asn_uint642INTEGER and its siblings.

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

2 participants