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.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#include <vanetza/security/v3/certificate_cache.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace security
|
||||
{
|
||||
namespace v3
|
||||
{
|
||||
|
||||
const Certificate* CertificateCache::lookup(const HashedId8& digest) const
|
||||
{
|
||||
auto found = m_storage.find(digest);
|
||||
if (found != m_storage.end()) {
|
||||
return &found->second;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const Certificate* CertificateCache::lookup(const HashedId3& digest) const
|
||||
{
|
||||
auto found = m_short_digests.find(digest);
|
||||
if (found != m_short_digests.end()) {
|
||||
return &found->second->second;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CertificateCache::store(Certificate cert)
|
||||
{
|
||||
auto maybe_hash = cert.calculate_digest();
|
||||
if (maybe_hash) {
|
||||
CertificateMap::iterator it;
|
||||
bool inserted;
|
||||
std::tie(it, inserted) = m_storage.emplace(*maybe_hash, std::move(cert));
|
||||
if (inserted) {
|
||||
m_short_digests.emplace(truncate(*maybe_hash), it);
|
||||
m_digests.insert(*maybe_hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CertificateCache::announce(const HashedId8& digest)
|
||||
{
|
||||
bool inserted = false;
|
||||
std::tie(std::ignore, inserted) = m_digests.insert(digest);
|
||||
return inserted;
|
||||
}
|
||||
|
||||
bool CertificateCache::is_known(const HashedId8& digest) const
|
||||
{
|
||||
return m_digests.find(digest) != m_digests.end();
|
||||
}
|
||||
|
||||
} // namespace v3
|
||||
} // namespace security
|
||||
} // namespace vanetza
|
||||
Reference in New Issue
Block a user