From: seolheui kim Date: Tue, 12 Jun 2018 02:22:01 +0000 (+0900) Subject: Modify enum values for corrupted encryption X-Git-Tag: accepted/tizen/4.0/unified/20180613.234958^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=952a2c4ba1c9ac31841a35c3918a03a288b1351d;p=platform%2Fcore%2Fsecurity%2Fode.git Modify enum values for corrupted encryption - combine State::CorruptedEncryption and State::CorruptedDecryption with State::Corrupted to avoid build break since State::Corrupted is used in other packages. Change-Id: I14ba9ee1c51dc35240a7151f7ddf545453555ced Signed-off-by: seolheui kim --- diff --git a/lib/ode/common.h b/lib/ode/common.h index f2fc30b..b84a848 100644 --- a/lib/ode/common.h +++ b/lib/ode/common.h @@ -70,8 +70,7 @@ typedef enum { typedef enum { ODE_STATE_UNENCRYPTED = 0x00, /**< Device is not encrypted */ ODE_STATE_ENCRYPTED = 0x01, /**< Device is encrypted */ - ODE_STATE_CORRUPTED_ENCRYPTION = 0x02, /**< Device is corrupted because of encryption error */ - ODE_STATE_CORRUPTED_DECRYPTION = 0x03, /**< Device is corrupted becouse of decryption error */ + ODE_STATE_CORRUPTED = 0x02, /**< Device is corrupted because of encryption error */ } ode_state_e; /** diff --git a/rmi/external-encryption.h b/rmi/external-encryption.h index 540d947..b944090 100644 --- a/rmi/external-encryption.h +++ b/rmi/external-encryption.h @@ -49,9 +49,8 @@ public: enum State { Unencrypted = 0x00, Encrypted = 0x01, - CorruptedEncryption = 0x02, - CorruptedDecryption = 0x03, - Invalid = 0x04, + Corrupted = 0x02, + Invalid = 0x03, }; virtual int getState() = 0; diff --git a/rmi/internal-encryption.h b/rmi/internal-encryption.h index 659482e..c20f7f9 100644 --- a/rmi/internal-encryption.h +++ b/rmi/internal-encryption.h @@ -48,9 +48,8 @@ public: enum State { Unencrypted = 0x00, Encrypted = 0x01, - CorruptedEncryption = 0x02, - CorruptedDecryption = 0x03, - Invalid = 0x04, + Corrupted = 0x02, + Invalid = 0x03, }; virtual int getState() = 0; diff --git a/server/external-encryption.cpp b/server/external-encryption.cpp index dfed067..09af99f 100644 --- a/server/external-encryption.cpp +++ b/server/external-encryption.cpp @@ -426,10 +426,8 @@ int ExternalEncryptionServer::getState() return State::Encrypted; else if (valueStr == "unencrypted") return State::Unencrypted; - else if (valueStr == "error_partially_encrypted") - return State::CorruptedEncryption; - else if (valueStr == "error_partially_decrypted") - return State::CorruptedDecryption; + else if (valueStr == "error_partially_encrypted" || valueStr == "error_partially_decrypted") + return State::Corrupted; return State::Invalid; } diff --git a/server/internal-encryption.cpp b/server/internal-encryption.cpp index 1900f62..ed5b6fc 100644 --- a/server/internal-encryption.cpp +++ b/server/internal-encryption.cpp @@ -510,7 +510,7 @@ int InternalEncryptionServer::recovery() if (state == State::Unencrypted) return error::NoSuchDevice; - if (state == State::CorruptedEncryption || state == State::CorruptedDecryption) + if (state == State::Corrupted) Ext4Tool::mkfs(engine->getSource()); std::fstream fs; @@ -571,10 +571,8 @@ int InternalEncryptionServer::getState() return State::Encrypted; else if (valueStr == "unencrypted") return State::Unencrypted; - else if (valueStr == "error_partially_encrypted") - return State::CorruptedEncryption; - else if (valueStr == "error_partially_decrypted") - return State::CorruptedDecryption; + else if (valueStr == "error_partially_encrypted" || valueStr == "error_partially_decrypted") + return State::Corrupted; return State::Invalid; } diff --git a/tools/cli/ode-admin-cli.cpp b/tools/cli/ode-admin-cli.cpp index 5bdf1d1..7c8247b 100644 --- a/tools/cli/ode-admin-cli.cpp +++ b/tools/cli/ode-admin-cli.cpp @@ -549,11 +549,8 @@ static inline int get_state(const std::string name) case ODE_STATE_UNENCRYPTED: std::cout << "Unencrypted"; break; - case ODE_STATE_CORRUPTED_ENCRYPTION: - std::cout << "Corrupted Encryption"; - break; - case ODE_STATE_CORRUPTED_DECRYPTION: - std::cout << "Corrupted Decryption"; + case ODE_STATE_CORRUPTED: + std::cout << "Corrupted"; break; default: std::cout << "Invalid";