mirror of https://github.com/ARMmbed/mbed-os.git
restructure cases to avoid warnings
parent
4c56d4c90b
commit
533f6a464a
|
@ -353,27 +353,21 @@ public:
|
||||||
switch (securityMode) {
|
switch (securityMode) {
|
||||||
case SECURITY_MODE_ENCRYPTION_OPEN_LINK:
|
case SECURITY_MODE_ENCRYPTION_OPEN_LINK:
|
||||||
return setLinkEncryption(connection, link_encryption_t::NOT_ENCRYPTED);
|
return setLinkEncryption(connection, link_encryption_t::NOT_ENCRYPTED);
|
||||||
break;
|
|
||||||
|
|
||||||
case SECURITY_MODE_ENCRYPTION_NO_MITM:
|
case SECURITY_MODE_ENCRYPTION_NO_MITM:
|
||||||
return setLinkEncryption(connection, link_encryption_t::ENCRYPTED);
|
return setLinkEncryption(connection, link_encryption_t::ENCRYPTED);
|
||||||
break;
|
|
||||||
|
|
||||||
case SECURITY_MODE_ENCRYPTION_WITH_MITM:
|
case SECURITY_MODE_ENCRYPTION_WITH_MITM:
|
||||||
return setLinkEncryption(connection, link_encryption_t::ENCRYPTED_WITH_MITM);
|
return setLinkEncryption(connection, link_encryption_t::ENCRYPTED_WITH_MITM);
|
||||||
break;
|
|
||||||
|
|
||||||
case SECURITY_MODE_SIGNED_NO_MITM:
|
case SECURITY_MODE_SIGNED_NO_MITM:
|
||||||
return getSigningKey(connection, false);
|
return getSigningKey(connection, false);
|
||||||
break;
|
|
||||||
|
|
||||||
case SECURITY_MODE_SIGNED_WITH_MITM:
|
case SECURITY_MODE_SIGNED_WITH_MITM:
|
||||||
return getSigningKey(connection, true);
|
return getSigningKey(connection, true);
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return BLE_ERROR_INVALID_PARAM;
|
return BLE_ERROR_INVALID_PARAM;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,23 +456,23 @@ public:
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(encryption.value()) {
|
if (encryption == link_encryption_t::NOT_ENCRYPTED) {
|
||||||
case link_encryption_t::NOT_ENCRYPTED:
|
|
||||||
if (entry->encrypted) {
|
if (entry->encrypted) {
|
||||||
return pal.disable_encryption(connection);
|
return pal.disable_encryption(connection);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case link_encryption_t::ENCRYPTED:
|
} else if (encryption == link_encryption_t::ENCRYPTED) {
|
||||||
|
|
||||||
/* if already better than encrypted don't bother */
|
/* if already better than encrypted don't bother */
|
||||||
if (current_encryption == link_encryption_t::ENCRYPTED_WITH_MITM) {
|
if (current_encryption == link_encryption_t::ENCRYPTED_WITH_MITM) {
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
entry->encryption_requested = true;
|
entry->encryption_requested = true;
|
||||||
return enable_encryption(connection);
|
return enable_encryption(connection);
|
||||||
break;
|
|
||||||
|
|
||||||
case link_encryption_t::ENCRYPTED_WITH_MITM:
|
} else if (encryption == link_encryption_t::ENCRYPTED_WITH_MITM) {
|
||||||
|
|
||||||
if (entry->mitm && !entry->encrypted) {
|
if (entry->mitm && !entry->encrypted) {
|
||||||
entry->encryption_requested = true;
|
entry->encryption_requested = true;
|
||||||
return enable_encryption(connection);
|
return enable_encryption(connection);
|
||||||
|
@ -486,9 +480,8 @@ public:
|
||||||
entry->encryption_requested = true;
|
entry->encryption_requested = true;
|
||||||
return requestAuthentication(connection);
|
return requestAuthentication(connection);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
} else {
|
||||||
return BLE_ERROR_INVALID_PARAM;
|
return BLE_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue