readability

pull/6188/head
paul-szczepanek-arm 2018-01-22 14:37:34 +00:00
parent 533f6a464a
commit 1208dc7c34
1 changed files with 10 additions and 5 deletions

View File

@ -346,6 +346,7 @@ public:
if (!entry) { if (!entry) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
if (entry->encryption_requested) { if (entry->encryption_requested) {
return BLE_ERROR_OPERATION_NOT_PERMITTED; return BLE_ERROR_OPERATION_NOT_PERMITTED;
} }
@ -384,6 +385,7 @@ public:
if (!entry) { if (!entry) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
if (!entry->signing_key && enabled) { if (!entry->signing_key && enabled) {
KeyDistribution distribution = key_distribution; KeyDistribution distribution = key_distribution;
distribution.set_signing(enabled); distribution.set_signing(enabled);
@ -395,6 +397,7 @@ public:
distribution distribution
); );
} }
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
@ -549,6 +552,7 @@ public:
if (!entry) { if (!entry) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
if (entry->signing_key && (entry->mitm || !authenticated)) { if (entry->signing_key && (entry->mitm || !authenticated)) {
/* we have a key that is either authenticated or we don't care if it is /* we have a key that is either authenticated or we don't care if it is
* so retrieve it from the db now */ * so retrieve it from the db now */
@ -557,6 +561,7 @@ public:
connection connection
); );
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} else { } else {
/* we don't have the right key so we need to get it first /* we don't have the right key so we need to get it first
* keys exchange will create the signingKey event */ * keys exchange will create the signingKey event */
@ -637,13 +642,13 @@ public:
bool OOBProvidesMITM = true bool OOBProvidesMITM = true
) { ) {
SecurityEntry_t *entry = db.get_entry(connection); SecurityEntry_t *entry = db.get_entry(connection);
if (entry) { if (!entry) {
return BLE_ERROR_INVALID_PARAM;
}
entry->oob = useOOB; entry->oob = useOOB;
entry->oob_mitm_protection = OOBProvidesMITM; entry->oob_mitm_protection = OOBProvidesMITM;
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} else {
return BLE_ERROR_INVALID_PARAM;
}
} }
virtual ble_error_t confirmationEntered( virtual ble_error_t confirmationEntered(