Skip to content

Commit ac177ec

Browse files
sergio-correiaansasaki
authored andcommitted
Fix RSA2048 algorithm reporting in keylime agent
Change EncryptionAlgorithm::Rsa2048 display from "rsa" to "rsa2048" to be consistent with other specific algorithm reporting (similar to ECC fix in f2979c4). Signed-off-by: Sergio Correia <[email protected]>
1 parent 6f41aa8 commit ac177ec

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

keylime-agent/src/agent_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod tests {
109109
let result: JsonWrapper<AgentInfo> = test::read_body_json(resp).await;
110110
assert_eq!(result.results.agent_uuid.as_str(), "DEADBEEF");
111111
assert_eq!(result.results.tpm_hash_alg.as_str(), "sha256");
112-
assert_eq!(result.results.tpm_enc_alg.as_str(), "rsa");
112+
assert_eq!(result.results.tpm_enc_alg.as_str(), "rsa2048");
113113
assert_eq!(result.results.tpm_sign_alg.as_str(), "rsassa");
114114

115115
// Explicitly drop QuoteData to cleanup keys

keylime-agent/src/quotes_handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ mod tests {
385385
let result: JsonWrapper<KeylimeQuote> =
386386
test::read_body_json(resp).await;
387387
assert_eq!(result.results.hash_alg.as_str(), "sha256");
388-
assert_eq!(result.results.enc_alg.as_str(), "rsa");
388+
assert_eq!(result.results.enc_alg.as_str(), "rsa2048");
389389
assert_eq!(result.results.sign_alg.as_str(), "rsassa");
390390
assert!(
391391
pkey_pub_from_pem(&result.results.pubkey.unwrap()) //#[allow_ci]
@@ -431,7 +431,7 @@ mod tests {
431431
let result: JsonWrapper<KeylimeQuote> =
432432
test::read_body_json(resp).await;
433433
assert_eq!(result.results.hash_alg.as_str(), "sha256");
434-
assert_eq!(result.results.enc_alg.as_str(), "rsa");
434+
assert_eq!(result.results.enc_alg.as_str(), "rsa2048");
435435
assert_eq!(result.results.sign_alg.as_str(), "rsassa");
436436
assert!(
437437
pkey_pub_from_pem(&result.results.pubkey.unwrap()) //#[allow_ci]
@@ -493,7 +493,7 @@ mod tests {
493493
let result: JsonWrapper<KeylimeQuote> =
494494
test::read_body_json(resp).await;
495495
assert_eq!(result.results.hash_alg.as_str(), "sha256");
496-
assert_eq!(result.results.enc_alg.as_str(), "rsa");
496+
assert_eq!(result.results.enc_alg.as_str(), "rsa2048");
497497
assert_eq!(result.results.sign_alg.as_str(), "rsassa");
498498

499499
if let Some(ima_mutex) = &quotedata.ima_ml_file {

keylime/src/algorithms.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl fmt::Display for EncryptionAlgorithm {
274274
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
275275
let value = match self {
276276
EncryptionAlgorithm::Rsa1024 => "rsa1024",
277-
EncryptionAlgorithm::Rsa2048 => "rsa", /* for backwards compatibility */
277+
EncryptionAlgorithm::Rsa2048 => "rsa2048",
278278
EncryptionAlgorithm::Rsa3072 => "rsa3072",
279279
EncryptionAlgorithm::Rsa4096 => "rsa4096",
280280
EncryptionAlgorithm::Ecc192 => "ecc192",

keylime/src/context_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ mod tests {
631631
assert!(!context_info.get_public_key_as_base64().unwrap().is_empty()); //#[allow_ci]
632632
assert_eq!(context_info.get_key_class(), "asymmetric");
633633
assert_eq!(context_info.get_key_size(), 2048);
634-
assert_eq!(context_info.get_key_algorithm(), "rsa");
634+
assert_eq!(context_info.get_key_algorithm(), "rsa2048");
635635
let ek_handle = context_info.get_ek_handle();
636636
let ak_handle = context_info.get_ak_handle();
637637
assert!(context_info
@@ -740,7 +740,7 @@ mod tests {
740740
assert!(!context_info.get_public_key_as_base64().unwrap().is_empty()); //#[allow_ci]
741741
assert_eq!(context_info.get_key_class(), "asymmetric");
742742
assert_eq!(context_info.get_key_size(), 2048);
743-
assert_eq!(context_info.get_key_algorithm(), "rsa");
743+
assert_eq!(context_info.get_key_algorithm(), "rsa2048");
744744
assert!(!context_info.get_ak_key_class_str().is_empty());
745745
assert!(!context_info.get_ak_key_algorithm_str().is_empty());
746746
assert!(context_info.get_ak_key_size().is_ok());

0 commit comments

Comments
 (0)