Diff between a4695fe19cca9b746cb4d34bfcce75ca35fcc3c9 and 06be53208f7dcf78bc74bdb88614001f067c4b49

Changed Files

File Additions Deletions Status
src/shared/att.c +12 -5 modified

Full Patch

diff --git a/src/shared/att.c b/src/shared/att.c
index f1e0f59..3071b51 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -603,13 +603,20 @@ static bool change_security(struct bt_att *att, uint8_t ecode)
 	security = bt_att_get_security(att);
 
 	if (ecode == BT_ATT_ERROR_INSUFFICIENT_ENCRYPTION &&
-					security < BT_ATT_SECURITY_MEDIUM)
+					security < BT_ATT_SECURITY_MEDIUM) {
 		security = BT_ATT_SECURITY_MEDIUM;
-	else if (ecode == BT_ATT_ERROR_AUTHENTICATION &&
-					security < BT_ATT_SECURITY_HIGH)
-		security = BT_ATT_SECURITY_HIGH;
-	else
+	} else if (ecode == BT_ATT_ERROR_AUTHENTICATION) {
+		if (security < BT_ATT_SECURITY_MEDIUM)
+			security = BT_ATT_SECURITY_MEDIUM;
+		else if (security < BT_ATT_SECURITY_HIGH)
+			security = BT_ATT_SECURITY_HIGH;
+		else if (security < BT_ATT_SECURITY_FIPS)
+			security = BT_ATT_SECURITY_FIPS;
+		else
+			return false;
+	} else {
 		return false;
+	}
 
 	return bt_att_set_security(att, security);
 }