obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "certificate.hpp"
|
|
#include "response_codes.hpp"
|
|
#include <vanetza/common/byte_buffer.hpp>
|
|
#include <boost/optional/optional.hpp>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace pki
|
|
{
|
|
|
|
class SecurityModule;
|
|
|
|
/**
|
|
* \brief Decoded view of an InnerEcResponse payload.
|
|
* \see TS 102 941 §6.2.3.2.2
|
|
*/
|
|
struct EnrolmentResponse
|
|
{
|
|
EnrolmentResponseCode code; // EA's responseCode; parsing succeeds for any value
|
|
ByteBuffer request_hash; // SHA-256 prefix of the matching request
|
|
boost::optional<Certificate> certificate; // new EC; present iff one was decoded — caller must still check `code == ok`
|
|
};
|
|
|
|
/**
|
|
* Parse a decrypted EnrolmentResponse per ETSI TS 102 941 §6.2.3.2.2.
|
|
*
|
|
* Verifies:
|
|
* - outer Ieee1609Dot2Data is signedData
|
|
* - signer = digest, matching HashedId8(ea_certificate)
|
|
* - tbsData.headerInfo.psid == aid::SCR
|
|
* - outer signature verifies against ea_certificate
|
|
* - inner EtsiTs102941Data.version == v1
|
|
* - inner content variant is enrolmentResponse
|
|
*
|
|
* For a non-ok responseCode the function returns normally and `code` holds it;
|
|
* `certificate` is populated iff the response actually contains one.
|
|
*
|
|
* \throws DecodingFailure on structural failure
|
|
* \throws VerificationFailure on signer-digest or signature mismatch
|
|
*/
|
|
EnrolmentResponse parse_enrolment_response(SecurityModule& security, const ByteBuffer& decrypted,
|
|
const Certificate& ea_certificate);
|
|
|
|
} // namespace pki
|
|
} // namespace vanetza
|