Merge "keystore_cli_v2 --prompt_text expects a UTF-8 string" into pi-dev
diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp
index 1b927b8..3e8783b 100644
--- a/keystore/key_store_service.cpp
+++ b/keystore/key_store_service.cpp
@@ -818,6 +818,16 @@
if (!error.isOk()) {
ALOGE("Failed to generate key -> falling back to software keymaster");
securityLevel = SecurityLevel::SOFTWARE;
+
+ // No fall back for 3DES
+ for (auto& param : params.getParameters()) {
+ auto algorithm = authorizationValue(TAG_ALGORITHM, param);
+ if (algorithm.isOk() && algorithm.value() == Algorithm::TRIPLE_DES) {
+ *aidl_return = static_cast<int32_t>(ErrorCode::UNSUPPORTED_ALGORITHM);
+ return Status::ok();
+ }
+ }
+
auto fallback = mKeyStore->getFallbackDevice();
if (!fallback) {
*aidl_return = static_cast<int32_t>(error);
@@ -1031,6 +1041,16 @@
if (!error.isOk()) {
ALOGE("Failed to import key -> falling back to software keymaster");
securityLevel = SecurityLevel::SOFTWARE;
+
+ // No fall back for 3DES
+ for (auto& param : params.getParameters()) {
+ auto algorithm = authorizationValue(TAG_ALGORITHM, param);
+ if (algorithm.isOk() && algorithm.value() == Algorithm::TRIPLE_DES) {
+ *aidl_return = static_cast<int32_t>(ErrorCode::UNSUPPORTED_ALGORITHM);
+ return Status::ok();
+ }
+ }
+
auto fallback = mKeyStore->getFallbackDevice();
if (!fallback) {
*aidl_return = static_cast<int32_t>(error);