From c98fde26c96c764dbe821b7f76b7b3b93ac772bf Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 5 Sep 2013 20:24:29 +0000 Subject: Correct Ciphersuite::valid and to_string for CCM --- src/tls/tls_ciphersuite.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tls/tls_ciphersuite.cpp b/src/tls/tls_ciphersuite.cpp index 841ce72e8..b662512fd 100644 --- a/src/tls/tls_ciphersuite.cpp +++ b/src/tls/tls_ciphersuite.cpp @@ -108,7 +108,7 @@ bool Ciphersuite::valid() const const auto mode = cipher_and_mode[1]; #if !defined(BOTAN_HAS_AEAD_CCM) - if(mode == "CCM") + if(mode == "CCM(16,3)" || mode == "CCM(8,3)") return false; #endif @@ -211,6 +211,16 @@ std::string Ciphersuite::to_string() const out << "3DES_EDE"; else if(cipher_algo().find("Camellia") == 0) out << "CAMELLIA_" << std::to_string(8*cipher_keylen()); + else if(cipher_algo().find("/CCM(") != std::string::npos) + { + const std::string base_algo = cipher_algo().substr(0, cipher_algo().find("/CCM(")); + out << replace_chars(base_algo, {'-', '/'}, '_'); + + if(cipher_algo().find("/CCM(8,3)") != std::string::npos) + out << "_CCM_8"; + else + out << "_CCM"; + } else out << replace_chars(cipher_algo(), {'-', '/'}, '_'); -- cgit v1.2.3