Skip to content

Commit

Permalink
security: Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
xweissada committed Dec 13, 2024
1 parent be89b19 commit 31ce6c1
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 180 deletions.
2 changes: 0 additions & 2 deletions vanetza/security/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ add_vanetza_component(security
v2/validity_restriction.cpp
v2/verification.cpp
v3/asn1_conversions.cpp
v3/basic_elements.cpp
v3/certificate.cpp
v3/certificate_cache.cpp
v3/certificate_validator.cpp
Expand All @@ -60,7 +59,6 @@ add_vanetza_component(security
v3/static_certificate_provider.cpp
v3/persistence.cpp
v3/trust_store.cpp
v3/validity_restriction.cpp
)
target_link_libraries(security PUBLIC asn1 asn1_security common net)
target_link_libraries(security PRIVATE GeographicLib::GeographicLib)
Expand Down
46 changes: 0 additions & 46 deletions vanetza/security/v3/basic_elements.cpp

This file was deleted.

48 changes: 0 additions & 48 deletions vanetza/security/v3/basic_elements.hpp

This file was deleted.

41 changes: 2 additions & 39 deletions vanetza/security/v3/certificate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ bool valid_at_location(const asn1::EtsiTs103097Certificate& cert, const Position
return is_inside(location, region->choice.rectangularRegion);
case Vanetza_Security_GeographicRegion_PR_polygonalRegion:
// not supported yet
return false;
return true;
case Vanetza_Security_GeographicRegion_PR_identifiedRegion:
// not supported yet
return false;
return true;
default:
// unknown region restriction
return false;
Expand Down Expand Up @@ -226,43 +226,6 @@ bool CertificateView::is_canonical() const
return m_cert ? v3::is_canonical(*m_cert) : false;
}

StartAndEndValidity CertificateView::get_start_and_end_validity() const
{
StartAndEndValidity start_and_end;
start_and_end.start_validity = Time32(m_cert->toBeSigned.validityPeriod.start);
Time32 duration = 0;
switch (m_cert->toBeSigned.validityPeriod.duration.present)
{
case Vanetza_Security_Duration_PR_NOTHING:
break;
case Vanetza_Security_Duration_PR_microseconds:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.microseconds/1000000;
break;
case Vanetza_Security_Duration_PR_milliseconds:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.milliseconds/1000;
break;
case Vanetza_Security_Duration_PR_seconds:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.seconds;
break;
case Vanetza_Security_Duration_PR_minutes:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.minutes*60;
break;
case Vanetza_Security_Duration_PR_hours:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.hours*60*60;
break;
case Vanetza_Security_Duration_PR_sixtyHours:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.sixtyHours*60*60*60;
break;
case Vanetza_Security_Duration_PR_years:
duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.years*60*60*24*365;
break;
default:
break;
}
start_and_end.end_validity = start_and_end.start_validity + duration;
return start_and_end;
}

bool is_canonical(const asn1::EtsiTs103097Certificate& cert)
{
bool compressed_point = true;
Expand Down
3 changes: 0 additions & 3 deletions vanetza/security/v3/certificate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vanetza/security/public_key.hpp>
#include <vanetza/security/signature.hpp>
#include <vanetza/security/v3/asn1_types.hpp>
#include <vanetza/security/v3/validity_restriction.hpp>
#include <boost/optional/optional_fwd.hpp>
#include <list>

Expand Down Expand Up @@ -41,8 +40,6 @@ class CertificateView
*/
boost::optional<HashedId8> calculate_digest() const;

StartAndEndValidity get_start_and_end_validity() const;

KeyType get_verification_key_type() const;

/**
Expand Down
18 changes: 0 additions & 18 deletions vanetza/security/v3/validity_restriction.cpp

This file was deleted.

24 changes: 0 additions & 24 deletions vanetza/security/v3/validity_restriction.hpp

This file was deleted.

0 comments on commit 31ce6c1

Please sign in to comment.