From 6f7cf39dfbec03af3f32bca5c6d0242881447d28 Mon Sep 17 00:00:00 2001 From: Raphael Riebl Date: Mon, 9 Sep 2024 16:54:21 +0000 Subject: [PATCH] security: enable moving certificates into v3::CertificateCache --- vanetza/security/v3/certificate_cache.cpp | 4 ++-- vanetza/security/v3/certificate_cache.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vanetza/security/v3/certificate_cache.cpp b/vanetza/security/v3/certificate_cache.cpp index 76b29432d..fffc9dd28 100644 --- a/vanetza/security/v3/certificate_cache.cpp +++ b/vanetza/security/v3/certificate_cache.cpp @@ -18,11 +18,11 @@ const Certificate* CertificateCache::lookup(const HashedId8& digest) const } } -void CertificateCache::store(const Certificate& cert) +void CertificateCache::store(Certificate cert) { auto maybe_hash = cert.calculate_digest(); if (maybe_hash) { - m_storage.emplace(*maybe_hash, cert); + m_storage.emplace(*maybe_hash, std::move(cert)); m_digests.insert(*maybe_hash); } } diff --git a/vanetza/security/v3/certificate_cache.hpp b/vanetza/security/v3/certificate_cache.hpp index 5db9239a2..c3c8712e5 100644 --- a/vanetza/security/v3/certificate_cache.hpp +++ b/vanetza/security/v3/certificate_cache.hpp @@ -29,7 +29,7 @@ class CertificateCache * Store a (pre-validated) certificate in cache * \param cert certificate */ - void store(const Certificate& cert); + void store(Certificate cert); size_t size() const { return m_storage.size(); }