diff mbox series

[BlueZ,1/1] client/player: Add command for control of BIS encryption

Message ID 20230912064026.1203509-2-vlad.pruteanu@nxp.com (mailing list archive)
State New, archived
Headers show
Series client/player: Add command for control of BIS encryption | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 8: B3 Line contains hard tab characters (\t): " encryption [on/off]"
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Vlad Pruteanu Sept. 12, 2023, 6:40 a.m. UTC
Currently there is no way to set the BIS encryption from
the bluetoothctl application. This commit adds support
for one.

Usage:
	encryption [on/off]
---
 client/player.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

bluez.test.bot@gmail.com Sept. 12, 2023, 8:12 a.m. UTC | #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=783275

---Test result---

Test Summary:
CheckPatch                    PASS      0.56 seconds
GitLint                       FAIL      0.53 seconds
BuildEll                      PASS      27.76 seconds
BluezMake                     PASS      870.88 seconds
MakeCheck                     PASS      12.28 seconds
MakeDistcheck                 PASS      157.48 seconds
CheckValgrind                 PASS      259.41 seconds
CheckSmatch                   PASS      346.27 seconds
bluezmakeextell               PASS      105.12 seconds
IncrementalBuild              PASS      705.32 seconds
ScanBuild                     PASS      1078.20 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,1/1] client/player: Add command for control of BIS encryption

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
8: B3 Line contains hard tab characters (\t): "	encryption [on/off]"


---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Sept. 12, 2023, 6:28 p.m. UTC | #2
Hi Vlad,

On Mon, Sep 11, 2023 at 11:44 PM Vlad Pruteanu <vlad.pruteanu@nxp.com> wrote:
>
> Currently there is no way to set the BIS encryption from
> the bluetoothctl application. This commit adds support
> for one.
>
> Usage:
>         encryption [on/off]

Don't really like the idea of having encryption here, I'd prompt the
user asking if he wants encryption as part of endpoint.config when we
detect it is for broadcast and if he responds yes then we can prompt
for the key as well.

> ---
>  client/player.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/client/player.c b/client/player.c
> index 42721c210..b1da5e839 100644
> --- a/client/player.c
> +++ b/client/player.c
> @@ -3196,6 +3196,28 @@ done:
>         return bt_shell_noninteractive_quit(EXIT_SUCCESS);
>  }
>
> +static void cmd_encryption_endpoint(int argc, char *argv[])
> +{
> +
> +       uint8_t value;
> +
> +       if (argc < 2) {
> +               bt_shell_printf("Encryption: %s\n",
> +                               bcast_qos.bcast.encryption ? "on" : "off");
> +               return bt_shell_noninteractive_quit(EXIT_SUCCESS);
> +       }
> +
> +       if (!strcmp(argv[1], "on") || !strcmp(argv[1], "yes"))
> +               value = 1;
> +       else if (!strcmp(argv[1], "off") || !strcmp(argv[1], "no"))
> +               value = 0;
> +       else
> +               return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +
> +       bcast_qos.bcast.encryption = value;
> +       return bt_shell_noninteractive_quit(EXIT_SUCCESS);
> +}
> +
>  static const struct bt_shell_menu endpoint_menu = {
>         .name = "endpoint",
>         .desc = "Media Endpoint Submenu",
> @@ -3221,6 +3243,10 @@ static const struct bt_shell_menu endpoint_menu = {
>                                                 cmd_presets_endpoint,
>                                                 "List available presets",
>                                                 uuid_generator },
> +       { "encryption",    "[on/off]",
> +                                               cmd_encryption_endpoint,
> +                                               "Enable/disable BIS encryption (mode 3 security)",
> +                                               NULL },
>         {} },
>  };
>
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/client/player.c b/client/player.c
index 42721c210..b1da5e839 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3196,6 +3196,28 @@  done:
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void cmd_encryption_endpoint(int argc, char *argv[])
+{
+
+	uint8_t value;
+
+	if (argc < 2) {
+		bt_shell_printf("Encryption: %s\n",
+				bcast_qos.bcast.encryption ? "on" : "off");
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
+	if (!strcmp(argv[1], "on") || !strcmp(argv[1], "yes"))
+		value = 1;
+	else if (!strcmp(argv[1], "off") || !strcmp(argv[1], "no"))
+		value = 0;
+	else
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+	bcast_qos.bcast.encryption = value;
+	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
 static const struct bt_shell_menu endpoint_menu = {
 	.name = "endpoint",
 	.desc = "Media Endpoint Submenu",
@@ -3221,6 +3243,10 @@  static const struct bt_shell_menu endpoint_menu = {
 						cmd_presets_endpoint,
 						"List available presets",
 						uuid_generator },
+	{ "encryption",    "[on/off]",
+						cmd_encryption_endpoint,
+						"Enable/disable BIS encryption (mode 3 security)",
+						NULL },
 	{} },
 };