Skip to contentSkip to conversation

package/mbedtls: add configurable SRTP support

PATCH In review Dmitry Ilyin 2 participants 5 messages Aug 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/mbedtls: add configurable SRTP support

This adds new BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT option to have MbedTLS builds that support SRTP (required option for AWS WebRTC library)

---
 package/mbedtls/Config.in  | 6 ++++++
 package/mbedtls/mbedtls.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/mbedtls/Config.in +6 -0
index a39ba65d98..f06a27fc5c 100644
@@ -29,4 +29,10 @@ config BR2_PACKAGE_MBEDTLS_COMPRESSION
 	  sure CRIME and similar attacks are not applicable to your
 	  particular situation.
 
+config BR2_PACKAGE_MBEDTLS_SRTP
+	bool "enable SRTP support"
+	help
+	  Enable support for negotiation of DTLS-SRTP (RFC 5764)
+	  through the use_srtp extension.
+
 endif
package/mbedtls/mbedtls.mk +8 -0
index af87d62b30..9f9aee1fec 100644
@@ -72,4 +72,12 @@ else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
 endif
 
+ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT),y)
+define MBEDTLS_ENABLE_SRTP
+	$(SED) "s://#define MBEDTLS_SSL_DTLS_SRTP:#define MBEDTLS_SSL_DTLS_SRTP:" \
+		$(@D)/include/mbedtls/config.h
+endef
+MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_SRTP
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Dmitry, All,

On 2022-08-28 16:05 +0300, Dmitry Ilyin spake thusly:

Quoted 2 lines

This adds new BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT option to have MbedTLS builds that support SRTP (required option for AWS WebRTC library)

You need to sign-off your change:
https://buildroot.org/downloads/manual/manual.html#submitting-patches

Also, what do you mean by "required option for AWS WebRTC library"?

If you are referring to a package that is present in Buildroot, then that package should also be fixed to select that option. The only package I could find in Buildroot, that is both websocket-related and uses mbedtls, is package/libwebsockets/. If that's what you were refering to, then the conditin to use mbedtls should be changed (in a separate, follow-up patch):

    -else ifeq ($(BR2_PACKAGE_MBEDTLS),y)
    +else ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP),y)

Regards,
Yann E. MORIN.

Quoted 44 lines
---
 package/mbedtls/Config.in  | 6 ++++++
 package/mbedtls/mbedtls.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/mbedtls/Config.in +6 -0
index a39ba65d98..f06a27fc5c 100644
@@ -29,4 +29,10 @@ config BR2_PACKAGE_MBEDTLS_COMPRESSION
 	  sure CRIME and similar attacks are not applicable to your
 	  particular situation.
 
+config BR2_PACKAGE_MBEDTLS_SRTP
+	bool "enable SRTP support"
+	help
+	  Enable support for negotiation of DTLS-SRTP (RFC 5764)
+	  through the use_srtp extension.
+
 endif
package/mbedtls/mbedtls.mk +8 -0
index af87d62b30..9f9aee1fec 100644
@@ -72,4 +72,12 @@ else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
 endif
 
+ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT),y)
+define MBEDTLS_ENABLE_SRTP
+	$(SED) "s://#define MBEDTLS_SSL_DTLS_SRTP:#define MBEDTLS_SSL_DTLS_SRTP:" \
+		$(@D)/include/mbedtls/config.h
+endef
+MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_SRTP
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

I used git send-email origin/master command to submit the patch using
http://underpop.online.fr/b/buildroot/en/submitting-patches.htm.gz manual.

The original outgoing/0001-package-mbedtls-add-configurable-SRTP-support.patch file has Signed-off-by: line, but I have no idea how to use this old-school machinery to work properly to appear the line in the mail-list.

About mentioned WebRTC library, this is
https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/ that I plan to add on final step when its all dependencies will be resolved.

вс, 28 авг. 2022 г. в 17:01, Yann E. MORIN <[email protected]>:

Quoted 85 lines

Dmitry, All,

On 2022-08-28 16:05 +0300, Dmitry Ilyin spake thusly:

Quoted 2 lines

This adds new BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT option to have MbedTLS builds that support SRTP (required option for AWS WebRTC library)

You need to sign-off your change:
https://buildroot.org/downloads/manual/manual.html#submitting-patches

Also, what do you mean by "required option for AWS WebRTC library"?

If you are referring to a package that is present in Buildroot, then that package should also be fixed to select that option. The only package I could find in Buildroot, that is both websocket-related and uses mbedtls, is package/libwebsockets/. If that's what you were refering to, then the conditin to use mbedtls should be changed (in a separate, follow-up patch):

    -else ifeq ($(BR2_PACKAGE_MBEDTLS),y)
    +else ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP),y)

Regards,
Yann E. MORIN.

package/mbedtls/mbedtls.mk else ifeq

Quoted 25 lines
---
 package/mbedtls/Config.in  | 6 ++++++
 package/mbedtls/mbedtls.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/mbedtls/Config.in +6 -0
index a39ba65d98..f06a27fc5c 100644
@@ -29,4 +29,10 @@ config BR2_PACKAGE_MBEDTLS_COMPRESSION
        sure CRIME and similar attacks are not applicable to your
        particular situation.
 
+config BR2_PACKAGE_MBEDTLS_SRTP
+     bool "enable SRTP support"
+     help
+       Enable support for negotiation of DTLS-SRTP (RFC 5764)
+       through the use_srtp extension.
+
 endif
package/mbedtls/mbedtls.mk +0 -0
index af87d62b30..9f9aee1fec 100644
@@ -72,4 +72,12 @@ else ifeq

($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)

package/mbedtls/mbedtls.mk else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)

Quoted 6 lines
package/mbedtls/mbedtls.mk +3 -0
 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
 endif
 
+ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT),y)
+define MBEDTLS_ENABLE_SRTP
+     $(SED) "s://#define MBEDTLS_SSL_DTLS_SRTP:#define

MBEDTLS_SSL_DTLS_SRTP:" \

Quoted 9 lines
package/mbedtls/mbedtls.mk +5 -1
+             $(@D)/include/mbedtls/config.h
+endef
+MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_SRTP
+endif
+
 $(eval $(cmake-package))
--

2.37.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Signature · 2 lines
Best regards,
Dmitry Ilyin

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 package/mbedtls: add configurable SRTP support

This adds new BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT option to have MbedTLS builds that support SRTP (required option for AWS WebRTC library)

---
 package/mbedtls/Config.in  | 6 ++++++
 package/mbedtls/mbedtls.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/mbedtls/Config.in +6 -0
index a39ba65d98..f06a27fc5c 100644
@@ -29,4 +29,10 @@ config BR2_PACKAGE_MBEDTLS_COMPRESSION
 	  sure CRIME and similar attacks are not applicable to your
 	  particular situation.
 
+config BR2_PACKAGE_MBEDTLS_SRTP
+	bool "enable SRTP support"
+	help
+	  Enable support for negotiation of DTLS-SRTP (RFC 5764)
+	  through the use_srtp extension.
+
 endif
package/mbedtls/mbedtls.mk +8 -0
index af87d62b30..9f9aee1fec 100644
@@ -72,4 +72,12 @@ else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
 endif
 
+ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT),y)
+define MBEDTLS_ENABLE_SRTP
+	$(SED) "s://#define MBEDTLS_SSL_DTLS_SRTP:#define MBEDTLS_SSL_DTLS_SRTP:" \
+		$(@D)/include/mbedtls/config.h
+endef
+MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_SRTP
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Dmitry, All,

On 2022-08-28 18:53 +0300, Dmitry Ilyin spake thusly:

Quoted 2 lines

This adds new BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT option to have MbedTLS builds that support SRTP (required option for AWS WebRTC library)

I've slightly reworded the commit log.

Quoted 11 lines
---
 package/mbedtls/Config.in  | 6 ++++++
 package/mbedtls/mbedtls.mk | 8 ++++++++
 2 files changed, 14 insertions(+)
package/mbedtls/Config.in +0 -0
index a39ba65d98..f06a27fc5c 100644

package/mbedtls/Config.in config BR2_PACKAGE_MBEDTLS_COMPRESSION · line 32

Quoted 4 lines
package/mbedtls/Config.in +1 -0
@@ -29,4 +29,10 @@ config BR2_PACKAGE_MBEDTLS_COMPRESSION
 	  sure CRIME and similar attacks are not applicable to your
 	  particular situation.
 
+config BR2_PACKAGE_MBEDTLS_SRTP

I've renamed the option to BR2_PACKAGE_MBEDTLS_DTLS_SRTP because this is what it drives: support for DTLS-SRTP.

Quoted 11 lines
package/mbedtls/Config.in +5 -0
+	bool "enable SRTP support"
+	help
+	  Enable support for negotiation of DTLS-SRTP (RFC 5764)
+	  through the use_srtp extension.
+
 endif
package/mbedtls/mbedtls.mk +0 -0
index af87d62b30..9f9aee1fec 100644

package/mbedtls/mbedtls.mk else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y) · line 75

Quoted 4 lines
package/mbedtls/mbedtls.mk +1 -0
@@ -72,4 +72,12 @@ else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
 endif
 
+ifeq ($(BR2_PACKAGE_MBEDTLS_SRTP_SUPPORT),y)

The variable was not what it is named in the Config.in. Anyway, I also renamed it accordingly.

package/mbedtls/mbedtls.mk else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y) · line 76

Quoted 1 line
package/mbedtls/mbedtls.mk +1 -0
+define MBEDTLS_ENABLE_SRTP

And I have also renamed the hook.

Applied to next, thanks.

Regards,
Yann E. MORIN.

Quoted 14 lines
package/mbedtls/mbedtls.mk +6 -0
+	$(SED) "s://#define MBEDTLS_SSL_DTLS_SRTP:#define MBEDTLS_SSL_DTLS_SRTP:" \
+		$(@D)/include/mbedtls/config.h
+endef
+MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_SRTP
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot