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.
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "security_module.hpp"
|
|
#include <boost/optional/optional.hpp>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace pki
|
|
{
|
|
|
|
class CredentialStorage;
|
|
|
|
class OpenSslSecurityModule : public SecurityModule
|
|
{
|
|
public:
|
|
OpenSslSecurityModule(std::shared_ptr<CredentialStorage>);
|
|
|
|
Sha256Hash calculate_sha256_hash(const std::uint8_t* buffer, std::size_t length) override;
|
|
Sha384Hash calculate_sha384_hash(const std::uint8_t* buffer, std::size_t length) override;
|
|
bool verify(const Sha256Hash&, const Signature&, const PublicKey&) override;
|
|
bool verify(const Sha384Hash&, const Signature&, const PublicKey&) override;
|
|
ByteBuffer generate_nonce(std::size_t length) override;
|
|
std::unique_ptr<EciesContext> create_ecies_context(const PublicKey& receiver, const Sha256Hash& info) override;
|
|
ByteBuffer calculate_hmac_sha256(const ByteBuffer& key, const ByteBuffer& data) override;
|
|
|
|
boost::optional<Signature> sign(const ByteBuffer& data, const PublicKey&) override;
|
|
|
|
/**
|
|
* Creates a new public and private key pair.
|
|
* The private key is intentionally not returned but only stored in the credential storage.
|
|
*/
|
|
PublicKey create_key(KeyType) override;
|
|
|
|
bool discard_key(const PublicKey&) override;
|
|
|
|
private:
|
|
bool verify(const uint8_t* digest, std::size_t dlen, const Signature&, const PublicKey&);
|
|
boost::optional<Signature> sign(const ByteBuffer&, const PrivateKey&);
|
|
|
|
std::shared_ptr<CredentialStorage> m_credential_storage;
|
|
};
|
|
|
|
} // namespace pki
|
|
} // namespace vanetza
|