Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • ITS ITS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ITS - Intelligent Transport SystemsITS - Intelligent Transport Systems
  • ITSITS
  • Issues
  • #17
Closed
Open
Issue created Jul 22, 2019 by Szilveszter TÓTH@toths

Errors because of removing trailing 0A and 0D bytes from HTTP responses

Dear ETSI ITS Team,

We are using the STF525 branch of the project to test our (Microsec's) V2X PKI infrastructure software. This is a great help and many thanks for building such a useful testing tool!

During our tests sometimes we get a message from the test suite as follows:

fx__decrypt__aes__128__ccm__test: Failed to decrypt message

As we investigated further, we saw that the error was that the last byte of the authTag was changed to 00. When the HTTP response was read, it contained either 0A (LF) or 0D (CR) as the last byte:

MTC@aa2a65190077: http_codec::decode_body: Aligned body='...0EB347CDCF7EEDE541E20E517455770D'O
MTC@aa2a65190077: http_codec::decode_body: counter=1
MTC@aa2a65190077: http_codec::decode_body: body length=331
MTC@aa2a65190077: http_codec::decode_body: Finalised body='...0EB347CDCF7EEDE541E20E51745577'O 

As you can see, here we have already lost the last byte (0D). The authTag is incorrect too:

MTC@aa2a65190077: fx__decrypt__aes__128__ccm__test: tag: '0EB347CDCF7EEDE541E20E5174557700'O

The following code snippet removes trailing CR/LF bytes from HTTP responses, which may be incorrect and causes the above phenomenon:

  // Remove CRLF if any
  int counter = 0;
  if ((body[body.lengthof() - 1].get_octet() == 0x0d) || (body[body.lengthof() - 1].get_octet() == 0x0a)) {
    counter += 1;
    if ((body[body.lengthof() - 2].get_octet() == 0x0d) || (body[body.lengthof() - 2].get_octet() == 0x0a)) {
      counter += 1;
    }
  }
  loggers::get_instance().log("http_codec::decode_body: counter=%d", counter);

How can we correctly transfer an HTTP response which contains trailing 0A or 0D bytes to the test system? Now the only solution is re-running the test to see the error message (probably) disappear.

Thanks in advance for your response,

BR,

Szilveszter Tóth

Microsec

Edited Jul 22, 2019 by Szilveszter TÓTH
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking