Skip to content

Commit

Permalink
cu_cp,security: make getter function const
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianEckermann committed Jun 21, 2024
1 parent 9984206 commit ac07f4c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions include/srsran/security/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ struct security_context {

bool select_algorithms(preferred_integrity_algorithms pref_inte_list, preferred_ciphering_algorithms pref_ciph_list);
void generate_as_keys();
sec_as_config get_as_config(sec_domain domain);
sec_128_as_config get_128_as_config(sec_domain domain);
void horizontal_key_derivation(pci_t target_pci, unsigned target_ssb_arfcn);
[[nodiscard]] sec_as_config get_as_config(sec_domain domain) const;
[[nodiscard]] sec_128_as_config get_128_as_config(sec_domain domain) const;
void horizontal_key_derivation(pci_t target_pci, unsigned target_ssb_arfcn);
};

/******************************************************************************
Expand Down
12 changes: 6 additions & 6 deletions lib/cu_cp/ue_security_manager/ue_security_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ ue_security_manager::ue_security_manager(const security_manager_config& cfg_) :
}

// up_ue_security_manager
security::sec_as_config ue_security_manager::get_up_as_config()
security::sec_as_config ue_security_manager::get_up_as_config() const
{
return sec_context.get_as_config(security::sec_domain::up);
}

security::sec_128_as_config ue_security_manager::get_up_128_as_config()
security::sec_128_as_config ue_security_manager::get_up_128_as_config() const
{
return sec_context.get_128_as_config(security::sec_domain::up);
}
Expand Down Expand Up @@ -66,22 +66,22 @@ void ue_security_manager::enable_security()
security_enabled = true;
}

security::security_context ue_security_manager::get_security_context()
security::security_context ue_security_manager::get_security_context() const
{
return sec_context;
}

security::sec_selected_algos ue_security_manager::get_security_algos()
security::sec_selected_algos ue_security_manager::get_security_algos() const
{
return sec_context.sel_algos;
}

security::sec_as_config ue_security_manager::get_rrc_as_config()
security::sec_as_config ue_security_manager::get_rrc_as_config() const
{
return sec_context.get_as_config(security::sec_domain::rrc);
}

security::sec_128_as_config ue_security_manager::get_rrc_128_as_config()
security::sec_128_as_config ue_security_manager::get_rrc_128_as_config() const
{
return sec_context.get_128_as_config(security::sec_domain::rrc);
}
Expand Down
18 changes: 9 additions & 9 deletions lib/cu_cp/ue_security_manager/ue_security_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ class ue_security_manager
~ue_security_manager() = default;

// up_ue_security_manager
security::sec_as_config get_up_as_config();
security::sec_128_as_config get_up_128_as_config();
[[nodiscard]] security::sec_as_config get_up_as_config() const;
[[nodiscard]] security::sec_128_as_config get_up_128_as_config() const;

// ngap_ue_security_manager
bool init_security_context(security::security_context sec_ctxt);
[[nodiscard]] bool is_security_enabled() const;

// rrc_ue_security_manager
void enable_security();
security::security_context get_security_context();
security::sec_selected_algos get_security_algos();
security::sec_as_config get_rrc_as_config();
security::sec_128_as_config get_rrc_128_as_config();
void update_security_context(security::security_context sec_ctxt);
void horizontal_key_derivation(pci_t target_pci, unsigned target_ssb_arfcn);
void enable_security();
[[nodiscard]] security::security_context get_security_context() const;
[[nodiscard]] security::sec_selected_algos get_security_algos() const;
[[nodiscard]] security::sec_as_config get_rrc_as_config() const;
[[nodiscard]] security::sec_128_as_config get_rrc_128_as_config() const;
void update_security_context(security::security_context sec_ctxt);
void horizontal_key_derivation(pci_t target_pci, unsigned target_ssb_arfcn);

private:
security_manager_config cfg;
Expand Down
4 changes: 2 additions & 2 deletions lib/security/security.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ void security_context::horizontal_key_derivation(pci_t target_pci, unsigned targ
generate_as_keys();
}

sec_128_as_config security_context::get_128_as_config(sec_domain domain)
sec_128_as_config security_context::get_128_as_config(sec_domain domain) const
{
return truncate_config(get_as_config(domain));
}

sec_as_config security_context::get_as_config(sec_domain domain)
sec_as_config security_context::get_as_config(sec_domain domain) const
{
srsran_sanity_check(sel_algos.algos_selected, "Tried to get AS config, but no algorithms are selected");
sec_as_config as_cfg;
Expand Down

0 comments on commit ac07f4c

Please sign in to comment.