Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions keylime-push-model-agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
tpm_encryption_alg: config.get_tpm_encryption_alg(),
tpm_hash_alg: config.get_tpm_hash_alg(),
tpm_signing_alg: config.get_tpm_signing_alg(),
agent_data_path: config.get_agent_data_path(),

Check warning on line 224 in keylime-push-model-agent/src/main.rs

View check run for this annotation

Codecov / codecov/patch

keylime-push-model-agent/src/main.rs#L224

Added line #L224 was not covered by tests
},
)?;
Ok(Some(context_info))
Expand Down
1 change: 1 addition & 0 deletions keylime-push-model-agent/src/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ mod tests {
tpm_encryption_alg: "rsa".to_string(),
tpm_hash_alg: "sha256".to_string(),
tpm_signing_alg: "rsassa".to_string(),
agent_data_path: "".to_string(),
};
let mut context_info = ContextInfo::new_from_str(alg_config)
.expect("Failed to create context info from string");
Expand Down
3 changes: 3 additions & 0 deletions keylime-push-model-agent/src/struct_filler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ mod tests {
tpm_encryption_alg: config.get_tpm_encryption_alg(),
tpm_hash_alg: config.get_tpm_hash_alg(),
tpm_signing_alg: config.get_tpm_signing_alg(),
agent_data_path: "".to_string(),
},
)
.expect("Failed to create context info from string");
Expand All @@ -685,6 +686,7 @@ mod tests {
tpm_encryption_alg: config.get_tpm_encryption_alg(),
tpm_hash_alg: config.get_tpm_hash_alg(),
tpm_signing_alg: config.get_tpm_signing_alg(),
agent_data_path: "".to_string(),
},
)
.expect("Failed to create context info from string");
Expand All @@ -707,6 +709,7 @@ mod tests {
tpm_encryption_alg: config.get_tpm_encryption_alg(),
tpm_hash_alg: config.get_tpm_hash_alg(),
tpm_signing_alg: config.get_tpm_signing_alg(),
agent_data_path: "".to_string(),
},
)
.expect("Failed to create context info from string");
Expand Down
13 changes: 12 additions & 1 deletion keylime/src/config/push_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
});

pub trait PushModelConfigTrait {
fn get_agent_data_path(&self) -> String;
fn get_certification_keys_server_identifier(&self) -> String;
fn get_contact_ip(&self) -> String;
fn get_contact_port(&self) -> u32;
Expand Down Expand Up @@ -66,6 +67,7 @@
impl Default for PushModelConfig {
fn default() -> Self {
PushModelConfig {
agent_data_path: DEFAULT_AGENT_DATA_PATH.to_string(),
certification_keys_server_identifier:
DEFAULT_CERTIFICATION_KEYS_SERVER_IDENTIFIER.to_string(),
contact_ip: DEFAULT_CONTACT_IP.to_string(),
Expand Down Expand Up @@ -116,6 +118,7 @@
}

pub struct PushModelConfig {
agent_data_path: String,
api_versions: Vec<String>,
certification_keys_server_identifier: String,
contact_ip: String,
Expand Down Expand Up @@ -151,6 +154,10 @@
}

impl PushModelConfigTrait for PushModelConfig {
fn get_agent_data_path(&self) -> String {
self.agent_data_path.clone()
}

Check warning on line 159 in keylime/src/config/push_model.rs

View check run for this annotation

Codecov / codecov/patch

keylime/src/config/push_model.rs#L159

Added line #L159 was not covered by tests

fn get_certification_keys_server_identifier(&self) -> String {
self.certification_keys_server_identifier.clone()
}
Expand Down Expand Up @@ -257,7 +264,8 @@

fn display(&self) -> String {
format!(
"PushModelConfig {{ certification_keys_server_identifier: {},
"PushModelConfig {{ agent_data_path: {},
certification_keys_server_identifier: {},

Check warning on line 268 in keylime/src/config/push_model.rs

View check run for this annotation

Codecov / codecov/patch

keylime/src/config/push_model.rs#L267-L268

Added lines #L267 - L268 were not covered by tests
contact_ip: {}, contact_port: {},
enable_iak_idevid: {}, ek_handle: {},
ima_logs_appendable: {}, ima_logs_formats: {:?}, ima_logs_supports_partial_access: {},
Expand All @@ -269,6 +277,7 @@
uefi_logs_appendable: {}, uefi_logs_formats: {:?},
tpm_encryption_alg: {}, tpm_hash_alg: {}, tpm_signing_alg: {},
api_versions: {:?}, registrar_api_versions: {:?}, uuid: {} }}",
self.agent_data_path,

Check warning on line 280 in keylime/src/config/push_model.rs

View check run for this annotation

Codecov / codecov/patch

keylime/src/config/push_model.rs#L280

Added line #L280 was not covered by tests
self.certification_keys_server_identifier,
self.contact_ip,
self.contact_port,
Expand Down Expand Up @@ -316,6 +325,7 @@
pmc.get_certification_keys_server_identifier()
== DEFAULT_CERTIFICATION_KEYS_SERVER_IDENTIFIER
);
assert!(pmc.get_agent_data_path() == DEFAULT_AGENT_DATA_PATH);
assert!(pmc.get_contact_ip() == DEFAULT_CONTACT_IP);
assert!(pmc.get_contact_port() == DEFAULT_CONTACT_PORT);
assert!(pmc.get_ek_handle() == DEFAULT_PUSH_EK_HANDLE);
Expand Down Expand Up @@ -381,6 +391,7 @@
fn test_display_config() {
let pmc = PushModelConfig::new();
let display_string = pmc.to_string();
assert!(display_string.contains(&pmc.get_agent_data_path()));
assert!(display_string
.contains(&pmc.get_certification_keys_server_identifier()));
assert!(display_string.contains(&pmc.get_contact_ip()));
Expand Down
Loading