Files
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
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.
2026-09-24 10:56:05 +02:00

73 lines
1.9 KiB
C++

#ifndef FA909143_0CE7_4397_A42B_5CDA56AB4716
#define FA909143_0CE7_4397_A42B_5CDA56AB4716
#include <vanetza/security/ecc_point.hpp>
#include <vanetza/security/signature.hpp>
#include <cassert>
namespace vanetza
{
namespace security
{
EcdsaSignatureFuture::EcdsaSignatureFuture(std::shared_future<EcdsaSignature> future,
EcdsaSignature placeholder) :
m_future(future), m_placeholder(std::move(placeholder))
{
if (!m_future.valid()) {
throw std::invalid_argument("EcdsaSignature future has to be valid");
}
}
const EcdsaSignature& EcdsaSignatureFuture::get() const
{
assert(m_future.valid());
const EcdsaSignature& signature = m_future.get();
assert(signature.s.size() == m_placeholder.s.size());
assert(signature.R.which() == m_placeholder.R.which());
assert(get_length(signature.R) == get_length(m_placeholder.R));
return signature;
}
std::size_t EcdsaSignatureFuture::size() const
{
return get_length(m_placeholder.R) + m_placeholder.s.size();
}
ByteBuffer extract_signature_buffer(const SomeEcdsaSignature& sig)
{
struct extraction_visitor : public boost::static_visitor<>
{
void operator()(const EcdsaSignature& sig)
{
m_buffer = convert_for_signing(sig.R);
m_buffer.insert(m_buffer.end(), sig.s.begin(), sig.s.end());
}
void operator()(const EcdsaSignatureFuture& sig_future)
{
const EcdsaSignature& sig = sig_future.get();
(*this)(sig);
}
ByteBuffer m_buffer;
};
extraction_visitor visitor;
boost::apply_visitor(visitor, sig);
return visitor.m_buffer;
}
ByteBuffer extract_signature_buffer(const Signature& sig)
{
ByteBuffer buffer = sig.r;
buffer.insert(buffer.end(), sig.s.begin(), sig.s.end());
return buffer;
}
} // namespace security
} // namespace vanetza
#endif /* FA909143_0CE7_4397_A42B_5CDA56AB4716 */