diff --git a/peripheral/gatt.c b/peripheral/gatt.c
index e1bf8fb..8df62a6 100644
--- a/peripheral/gatt.c
+++ b/peripheral/gatt.c
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
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;
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
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
/* 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
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)
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
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
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,