client/player: Allow the user to control BIG encryption
cover client/player: Allow the user to control BIG encryption
This commit adds support for controling the use of encryption and setting the broadcast code. This is done as part of the endpoint.config command. For source endpoints the encryption flag and broadcast code can be set, while the sink supports only broadcast code setting. If no custom broadcast code is provided, the default one will be used.
Vlad Pruteanu (1):
client/player: Allow the user to control BIG encryption
client/player.c | 50 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/1 client/player: Allow the user to control BIG encryption
This commit adds support for controling the use of encryption and setting the broadcast code. This is done as part of the endpoint.config command. For source endpoints the encryption flag and broadcast code can be set, while the sink supports only broadcast code setting. If no custom broadcast code is provided, the default one will be used.
--- client/player.c | 50 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)
client/player.c +43 -7
@@ -2792,10 +2792,10 @@ static void cmd_config_endpoint(int argc, char *argv[])const struct capabilities *cap;char *uuid;uint8_t codec_id; -bool broadcast = false; +bool local_ep_not_provided = false; +uint8_t bcode_arg_position =0 ; cfg = new0(struct endpoint_config, 1); -/* Search for the remote endpoint name on DBUS */ cfg->proxy =g_dbus_proxy_lookup (endpoints,NULL , argv[1 ],BLUEZ_MEDIA_ENDPOINT_INTERFACE );
@@ -2815,7 +2815,7 @@ static void cmd_config_endpoint(int argc, char *argv[]) codec_id =strtol (argv[3 ],NULL ,0 ); cap =find_capabilities (uuid, codec_id);if (cap) { - broadcast = true; + local_ep_not_provided = true; cfg->ep =endpoint_new (cap); cfg->ep->preset =find_presets_name (uuid, argv[3 ]);if (!cfg->ep->preset)
@@ -2827,9 +2827,10 @@ static void cmd_config_endpoint(int argc, char *argv[]) } } -if (((broadcast == false) && (argc >3 )) || - ((broadcast == true) && (argc >4 ))) { -char *preset_name = (broadcast == false)?argv[3 ]:argv[4 ]; +if (((local_ep_not_provided == false) && (argc >3 )) || + ((local_ep_not_provided == true) && (argc >4 ))) { +uint8_t offset = (local_ep_not_provided == false)?0 :1 ; +char *preset_name = argv[3 + offset]; preset =preset_find_name (cfg->ep->preset, preset_name);if (!preset) {
@@ -2837,7 +2838,42 @@ static void cmd_config_endpoint(int argc, char *argv[]) goto fail; } +/* If the endpoint is configured to be a source allow +*the user to decide if encryption is enabled or not. +*/ +if (!strcmp (cfg->ep->uuid,BCAA_SERVICE_UUID ) && + argc >4 + offset) { +uint8_t value =strtol (argv[4 + offset], +NULL ,0 ); + +if (value <2 ) + bcast_qos.bcast.encryption = value; +else + goto fail; + } + +/* If the endpoint is configured to be a source or a +*sink allow the user to set a custom broadcast code. +*If no broadcast code is set, the default will be used. +*/ +if (!strcmp (cfg->ep->uuid,BCAA_SERVICE_UUID ) && + (argc >5 + offset)) + bcode_arg_position =5 + offset; + +/*The broadcast code is found at a smaller index due to the sink +*config not using the encryption flag parameter. +*/ +if (!strcmp (cfg->ep->uuid,BAA_SERVICE_UUID ) && + argc >4 + offset) + bcode_arg_position =4 + offset; + +if (bcode_arg_position !=0 ) +for (uint8_t i =0 ; i <16 ; i++) + bcast_qos.bcast.bcode[i] = +strtol (argv[bcode_arg_position + i],NULL ,16 ); +if (cfg->ep->broadcast) { +iov_append (&cfg->ep->bcode, bcast_qos.bcast.bcode,sizeof (bcast_qos.bcast.bcode));/* Copy capabilities for broadcast*/
@@ -3253,7 +3289,7 @@ static const struct bt_shell_menu endpoint_menu = {"Register Endpoint" , local_endpoint_generator }, { "config", -"<endpoint> [local endpoint/UUID] [preset/codec id] [preset]" , +"<endpoint> [local endpoint/UUID] [preset/codec id] [preset] [encryption] [broadcast code=xx xx ...]" , cmd_config_endpoint,"Configure Endpoint" , endpoint_generator },
Signature · 1 line
2.34.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=789283
---Test result---
Test Summary:
CheckPatch PASS 0.57 seconds GitLint PASS 0.35 seconds BuildEll PASS 27.66 seconds BluezMake PASS 785.70 seconds MakeCheck PASS 11.74 seconds MakeDistcheck PASS 160.64 seconds CheckValgrind PASS 257.83 seconds CheckSmatch PASS 350.25 seconds bluezmakeextell PASS 106.06 seconds IncrementalBuild PASS 687.48 seconds ScanBuild PASS 1039.99 seconds
---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz
maintainerHi Vlad,
Quoted 94 lines · Vlad Pruteanu
This commit adds support for controling the use of encryption and setting the broadcast code. This is done as part of the endpoint.config command. For source endpoints the encryption flag and broadcast code can be set, while the sink supports only broadcast code setting. If no custom broadcast code is provided, the default one will be used.
--- client/player.c | 50 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-)client/player.c +42
-6@@ -2792,10 +2792,10 @@ static void cmd_config_endpoint(int argc, char *argv[])const struct capabilities *cap;char *uuid;uint8_t codec_id; -bool broadcast = false; +bool local_ep_not_provided = false; +uint8_t bcode_arg_position =0 ; cfg = new0(struct endpoint_config, 1); -/* Search for the remote endpoint name on DBUS */ cfg->proxy =g_dbus_proxy_lookup (endpoints,NULL , argv[1 ],BLUEZ_MEDIA_ENDPOINT_INTERFACE );@@ -2815,7 +2815,7 @@ static void cmd_config_endpoint(int argc, char *argv[]) codec_id =strtol (argv[3 ],NULL ,0 ); cap =find_capabilities (uuid, codec_id);if (cap) { - broadcast = true; + local_ep_not_provided = true; cfg->ep =endpoint_new (cap); cfg->ep->preset =find_presets_name (uuid, argv[3 ]);if (!cfg->ep->preset)@@ -2827,9 +2827,10 @@ static void cmd_config_endpoint(int argc, char *argv[]) } } -if (((broadcast == false) && (argc >3 )) || - ((broadcast == true) && (argc >4 ))) { -char *preset_name = (broadcast == false)?argv[3 ]:argv[4 ]; +if (((local_ep_not_provided == false) && (argc >3 )) || + ((local_ep_not_provided == true) && (argc >4 ))) { +uint8_t offset = (local_ep_not_provided == false)?0 :1 ; +char *preset_name = argv[3 + offset]; preset =preset_find_name (cfg->ep->preset, preset_name);if (!preset) {@@ -2837,7 +2838,42 @@ static void cmd_config_endpoint(int argc, char *argv[]) goto fail; } +/* If the endpoint is configured to be a source allow +*the user to decide if encryption is enabled or not. +*/ +if (!strcmp (cfg->ep->uuid,BCAA_SERVICE_UUID ) && + argc >4 + offset) { +uint8_t value =strtol (argv[4 + offset], +NULL ,0 ); + +if (value <2 ) + bcast_qos.bcast.encryption = value; +else + goto fail; + } + +/* If the endpoint is configured to be a source or a +*sink allow the user to set a custom broadcast code. +*If no broadcast code is set, the default will be used. +*/ +if (!strcmp (cfg->ep->uuid,BCAA_SERVICE_UUID ) && + (argc >5 + offset)) + bcode_arg_position =5 + offset; + +/*The broadcast code is found at a smaller index due to the sink +*config not using the encryption flag parameter. +*/ +if (!strcmp (cfg->ep->uuid,BAA_SERVICE_UUID ) && + argc >4 + offset) + bcode_arg_position =4 + offset; + +if (bcode_arg_position !=0 ) +for (uint8_t i =0 ; i <16 ; i++) + bcast_qos.bcast.bcode[i] = +strtol (argv[bcode_arg_position + i],NULL ,16 ); +if (cfg->ep->broadcast) { +iov_append (&cfg->ep->bcode, bcast_qos.bcast.bcode,sizeof (bcast_qos.bcast.bcode));/* Copy capabilities for broadcast*/
client/player.c static const struct bt_shell_menu endpoint_menu = { · line 3292
Quoted 5 lines
client/player.c +1
-1@@ -3253,7 +3289,7 @@ static const struct bt_shell_menu endpoint_menu = {"Register Endpoint" , local_endpoint_generator }, { "config", - "<endpoint> [local endpoint/UUID] [preset/codec id] [preset]", + "<endpoint> [local endpoint/UUID] [preset/codec id] [preset] [encryption] [broadcast code=xx xx ...]",
I think I'd prefer to have it prompted (see bt_shell_prompt_input) to the user when we detect it is configuring a broadcast transport, rather than have it passed upfront which might confuse the user of unicast where the encryption is done at a different layer.
Quoted 6 lines
client/player.c +0
-1cmd_config_endpoint,"Configure Endpoint" , endpoint_generator }, --2.34.1
Signature · 1 line
Luiz Augusto von Dentz