Diff between 9963e6949e6f141d89f2b6e6f42319d760bebe1b and c7499543ffe26fa81bc0aa0a9676f8398a538ccd

Changed Files

File Additions Deletions Status
peripheral/gatt.c +1 -1 modified
src/shared/att.c +2 -2 modified
src/shared/att.h +2 -2 modified
src/shared/gatt-client.c +3 -3 modified
src/shared/gatt-server.c +1 -1 modified
unit/test-gatt.c +1 -1 modified

Full Patch

diff --git a/peripheral/gatt.c b/peripheral/gatt.c
index e1bf8fb..8df62a6 100644
--- a/peripheral/gatt.c
+++ b/peripheral/gatt.c
@@ -126,7 +126,7 @@ static struct gatt_conn *gatt_conn_new(int fd)
 	bt_att_set_close_on_unref(conn->att, true);
 	bt_att_register_disconnect(conn->att, gatt_conn_disconnect, conn, NULL);
 
-	bt_att_set_sec_level(conn->att, BT_SECURITY_MEDIUM);
+	bt_att_set_security(conn->att, BT_SECURITY_MEDIUM);
 
 	conn->gatt = bt_gatt_server_new(gatt_db, conn->att, mtu);
 	if (!conn->gatt) {
diff --git a/src/shared/att.c b/src/shared/att.c
index f24da18..c5eaa09 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -1341,7 +1341,7 @@ bool bt_att_unregister_all(struct bt_att *att)
 	return true;
 }
 
-int bt_att_get_sec_level(struct bt_att *att)
+int bt_att_get_security(struct bt_att *att)
 {
 	struct bt_security sec;
 	socklen_t len;
@@ -1360,7 +1360,7 @@ int bt_att_get_sec_level(struct bt_att *att)
 	return sec.level;
 }
 
-bool bt_att_set_sec_level(struct bt_att *att, int level)
+bool bt_att_set_security(struct bt_att *att, int level)
 {
 	struct bt_security sec;
 
diff --git a/src/shared/att.h b/src/shared/att.h
index fb6247e..80810a1 100644
--- a/src/shared/att.h
+++ b/src/shared/att.h
@@ -83,8 +83,8 @@ bool bt_att_unregister_disconnect(struct bt_att *att, unsigned int id);
 
 bool bt_att_unregister_all(struct bt_att *att);
 
-int bt_att_get_sec_level(struct bt_att *att);
-bool bt_att_set_sec_level(struct bt_att *att, int level);
+int bt_att_get_security(struct bt_att *att);
+bool bt_att_set_security(struct bt_att *att, int level);
 
 bool bt_att_set_local_key(struct bt_att *att, uint8_t sign_key[16],
 			bt_att_counter_func_t func, void *user_data);
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 7b628fe..56bad60 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -2217,7 +2217,7 @@ unsigned int bt_gatt_client_write_without_response(
 
 	/* Only use signed write if unencrypted */
 	if (signed_write) {
-		security = bt_att_get_sec_level(client->att);
+		security = bt_att_get_security(client->att);
 		op = security > BT_SECURITY_LOW ?  BT_ATT_OP_WRITE_CMD :
 						BT_ATT_OP_SIGNED_WRITE_CMD;
 	} else
@@ -3004,7 +3004,7 @@ bool bt_gatt_client_set_sec_level(struct bt_gatt_client *client,
 	if (!client)
 		return false;
 
-	return bt_att_set_sec_level(client->att, level);
+	return bt_att_set_security(client->att, level);
 }
 
 int bt_gatt_client_get_sec_level(struct bt_gatt_client *client)
@@ -3012,5 +3012,5 @@ int bt_gatt_client_get_sec_level(struct bt_gatt_client *client)
 	if (!client)
 		return -1;
 
-	return bt_att_get_sec_level(client->att);
+	return bt_att_get_security(client->att);
 }
diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index ae77dcc..6167065 100644
--- a/src/shared/gatt-server.c
+++ b/src/shared/gatt-server.c
@@ -395,7 +395,7 @@ static uint8_t check_permissions(struct bt_gatt_server *server,
 	if (!perm)
 		return 0;
 
-	security = bt_att_get_sec_level(server->att);
+	security = bt_att_get_security(server->att);
 	if (perm & BT_ATT_PERM_AUTHEN && security < BT_ATT_SECURITY_HIGH)
 		return BT_ATT_ERROR_AUTHENTICATION;
 
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index caaacbd..a7ea7cd 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -1002,7 +1002,7 @@ static void test_signed_write_seclevel(struct context *context)
 	g_assert(bt_att_set_local_key(context->att, key, local_counter,
 								context));
 
-	g_assert(bt_att_set_sec_level(context->att, BT_ATT_SECURITY_MEDIUM));
+	g_assert(bt_att_set_security(context->att, BT_ATT_SECURITY_MEDIUM));
 
 	g_assert(bt_gatt_client_write_without_response(context->client,
 							step->handle,