1#include <vanetza/common/factory.hpp>
2#include <vanetza/security/backend.hpp>
15 BackendRegistrar(
const std::string& name)
17 auto f = []() {
return std::unique_ptr<vanetza::security::Backend> {
new T() }; };
18 bool success = backend_factory.add(name, f) && backend_factory.configure_default(name);
26#define VANETZA_REGISTER_CRYPTO_BACKEND(clazz)
28 using namespace vanetza::security;
29 static const BackendRegistrar<clazz> clazz##Factory(clazz::backend_name);
32#include <vanetza/security/backend_null.hpp>
35#ifdef VANETZA_WITH_CRYPTOPP
36# include <vanetza/security/backend_cryptopp.hpp>
40#ifdef VANETZA_WITH_OPENSSL
41# include <vanetza/security/backend_openssl.hpp>
52 return backend_factory;
55std::unique_ptr<Backend> create_backend(
const std::string& name,
const Factory<
Backend>& factory)
57 if (name ==
"default") {
58 return factory.create();
60 return factory.create(name);
64std::unique_ptr<Backend> create_backend_or_throw(
const std::string& name)
66 auto backend = create_backend(name);
68 throw std::runtime_error(
"security backend unavailable");
#define VANETZA_REGISTER_CRYPTO_BACKEND(clazz)