Skip to contentSkip to conversation

openssl: drop support for deprecated algorithms

PATCH In review Richard Purdie 7 participants 14 messages Dec 19, 2020 – Dec 23, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): AM0PR08MB361713C43176BFA1C7295477C5C20@AM0PR08MB3617.eurprd08.prod.outlook.com

#1 lore raw

PATCH 1/1 openssl: drop support for deprecated algorithms

The OE-Core list needs to be included on this so I'm doing so.

Cheers,

Richard

1. Drop support for many deprecated algorithms by default
2. Allow dropping support for TLS 1.0/1.1 via PACKAGECONFIG

---
 meta/recipes-connectivity/openssl/openssl_1.1.1g.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +7 -1
index 8159558..f9764bd 100644
@@ -33,6 +33,8 @@ PACKAGECONFIG_class-native = ""
 PACKAGECONFIG_class-nativesdk = ""
 
 PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
 CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+
 do_configure () {
 	os=${HOST_OS}
 	case $os in
@@ -122,7 +128,7 @@ do_configure () {
 	# WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
 	# environment variables set by bitbake. Adjust the environment variables instead.
 	HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-	perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
+	perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
 	perl ${B}/configdata.pm --dump
 }
 
Signature · 1 line
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#229): https://lists.yoctoproject.org/g/yocto-security/message/229
Mute This Topic: https://lists.yoctoproject.org/mt/79085238/1686473
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto-security/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

This looks a good improvement to me. I think it perhaps is a good idea to disable them across
all openssl recipe types, but we might find issues with native/nativesdk versions

Quoted 62 lines · Richard Purdie

The OE-Core list needs to be included on this so I'm doing so.

Cheers,

Richard

---------- Forwarded message ----------
From: Shachar Menashe <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Bcc:
Date: Sat, 19 Dec 2020 16:04:30 +0000
Subject: [yocto-security] [PATCH] openssl: drop support for deprecated algorithms
1. Drop support for many deprecated algorithms by default
2. Allow dropping support for TLS 1.0/1.1 via PACKAGECONFIG

---
 meta/recipes-connectivity/openssl/openssl_1.1.1g.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +7 -2
index 8159558..f9764bd 100644
@@ -33,6 +33,8 @@ PACKAGECONFIG_class-native = ""
 PACKAGECONFIG_class-nativesdk = ""
 
 PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
 CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+
 do_configure () {
        os=${HOST_OS}
        case $os in
@@ -122,7 +128,7 @@ do_configure () {
        # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
        # environment variables set by bitbake. Adjust the environment variables instead.
        HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
+       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
        perl ${B}/configdata.pm --dump
 }
 
--

2.17.1

#3 lore raw
In reply to Richard Purdie

What version of oe-core does this target? master already has 1.1.1i.

Also, I have doubts whether we should maintain 'deprecated crypto' lists, as we are not qualified to judge what is deprecated, and crucially, keep the list correctly updated. Isn't openssl upstream supposed to make those decisions?

Alex

Quoted 78 lines · Richard Purdie

The OE-Core list needs to be included on this so I'm doing so.

Cheers,

Richard

---------- Forwarded message ----------
From: Shachar Menashe <[email protected]>
To: "[email protected]" < [email protected]>
Cc:
Bcc:
Date: Sat, 19 Dec 2020 16:04:30 +0000
Subject: [yocto-security] [PATCH] openssl: drop support for deprecated algorithms
1. Drop support for many deprecated algorithms by default
2. Allow dropping support for TLS 1.0/1.1 via PACKAGECONFIG

---
 meta/recipes-connectivity/openssl/openssl_1.1.1g.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +0 -0
index 8159558..f9764bd 100644
@@ -33,6 +33,8 @@ PACKAGECONFIG_class-native = ""
 PACKAGECONFIG_class-nativesdk = ""
 
 PACKAGECONFIG[cryptodev-linux] =

"enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk =

"--with-rand-seed=os,devrandom"
CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +3 -2
-DENGINESDIR=/not/builtin"
 CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin
-DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5

no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +1 -0
+
 do_configure () {
        os=${HOST_OS}
        case $os in
@@ -122,7 +128,7 @@ do_configure () {
        # WARNING: do not set compiler/linker flags (-I/-D etc.) in

EXTRA_OECONF, as they will fully replace the

        # environment variables set by bitbake. Adjust the environment
variables instead.
        HASHBANGPERL="/usr/bin/env perl" PERL=perl
PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS}
--prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir}
$target
+       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS}
${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix
--openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
        perl ${B}/configdata.pm --dump
 }

--
2.17.1

#4 lore raw
Quoted 4 lines · Alexander Kanavin

What version of oe-core does this target? master already has 1.1.1i.

Also, I have doubts whether we should maintain 'deprecated crypto' lists, as we are not qualified to judge what is deprecated, and crucially, keep the list correctly updated. Isn't openssl upstream supposed to make those decisions?

upstream openssl enables almost all of the algorithms it supports. Providing a way
for users to add/remove algorithms with some defaults I think its a good thing.

Quoted 69 lines

Alex

Quoted 62 lines · Richard Purdie

The OE-Core list needs to be included on this so I'm doing so.

Cheers,

Richard

---------- Forwarded message ----------
From: Shachar Menashe <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Bcc:
Date: Sat, 19 Dec 2020 16:04:30 +0000
Subject: [yocto-security] [PATCH] openssl: drop support for deprecated algorithms
1. Drop support for many deprecated algorithms by default
2. Allow dropping support for TLS 1.0/1.1 via PACKAGECONFIG

---
 meta/recipes-connectivity/openssl/openssl_1.1.1g.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +7 -2
index 8159558..f9764bd 100644
@@ -33,6 +33,8 @@ PACKAGECONFIG_class-native = ""
 PACKAGECONFIG_class-nativesdk = ""
 
 PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
 CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+
 do_configure () {
        os=${HOST_OS}
        case $os in
@@ -122,7 +128,7 @@ do_configure () {
        # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
        # environment variables set by bitbake. Adjust the environment variables instead.
        HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
+       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
        perl ${B}/configdata.pm --dump
 }
 
--

2.17.1

#5 lore raw
In reply to Richard Purdie
Quoted 7 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
  B = "${WORKDIR}/build"
  do_configure[cleandirs] = "${B}"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 7 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
  CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
  CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Quoted 2 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +0 -0
  do_configure () {
  	os=${HOST_OS}
#6 lore raw
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
  B = "${WORKDIR}/build"
  do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
  CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
  CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

Cheers,

Richard

#7 lore raw
Quoted 24 lines · Richard Purdie
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
   B = "${WORKDIR}/build"
   do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
   CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
   CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Quoted 6 lines

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

I'm not sure I follow, as this is a "hard" assign - if it would (in theory) a ??= assignment, yes then it would be fine. Still that leaves us with a not commonly known variable, while PACKAGECONFIG is more widely accepted in 3rd party layers/distros from my experience.

Quoted 5 lines

Cheers,

Richard

#8 lore raw
Quoted 30 lines · Konrad Weihmann
Quoted 28 lines · Richard Purdie
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
   B = "${WORKDIR}/build"
   do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
   CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
   CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

Quoted 7 lines
Quoted 2 lines

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

I'm not sure I follow, as this is a "hard" assign - if it would (in theory) a ??= assignment, yes then it would be fine. Still that leaves us with a not commonly known variable, while PACKAGECONFIG is more widely accepted in 3rd party layers/distros from my experience.

You could do various things to this from a distro config, e.g.:

DEPRECATED_CRYPTO_FLAGS_pn-openssl = "xxx"

or

DEPRECATED_CRYPTO_FLAGS_pn-openssl_<distrooverride> = "xxx"

DEPRECATED_CRYPTO_FLAGS_pn-openssl_append = " extra-disable"

DEPRECATED_CRYPTO_FLAGS_pn-openssl_remove = "add-me-back"

so I'd say that its not a particularly "hard" assignment?

We could make it a ??= but I'm not sure it would change much practcial use as it would almost always be with an override of some sort?

Whilst PACKAGECONFIG is more well known,the variable name here may actually improve readability...

Cheers,

Richard

#9 lore raw
Quoted 52 lines · Richard Purdie
Quoted 30 lines · Konrad Weihmann
Quoted 28 lines · Richard Purdie
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
   B = "${WORKDIR}/build"
   do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
   CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
   CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

Quoted 7 lines
Quoted 2 lines

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

I'm not sure I follow, as this is a "hard" assign - if it would (in theory) a ??= assignment, yes then it would be fine. Still that leaves us with a not commonly known variable, while PACKAGECONFIG is more widely accepted in 3rd party layers/distros from my experience.

You could do various things to this from a distro config, e.g.:

DEPRECATED_CRYPTO_FLAGS_pn-openssl = "xxx"

or

DEPRECATED_CRYPTO_FLAGS_pn-openssl_<distrooverride> = "xxx"

DEPRECATED_CRYPTO_FLAGS_pn-openssl_append = " extra-disable"

DEPRECATED_CRYPTO_FLAGS_pn-openssl_remove = "add-me-back"

Quoted 7 lines

so I'd say that its not a particularly "hard" assignment?

We could make it a ??= but I'm not sure it would change much practcial use as it would almost always be with an override of some sort?

Whilst PACKAGECONFIG is more well known,the variable name here may actually improve readability...

Does it? It just looks like an extension of a definition of PACKAGECONFIG but with the logic all reversed (e.g. instead of adding FOO to PACKAGECONFIG to enable support for something we now have to add no-FOO to the new custom variable to disable something). Inverting the logic of all the options makes it closer to the semantics expected by the openssl configure scripts, but makes it further from the semantics expected by someone using OE to configure a package (who is presumably used to the "add FOO to PACKAGECONFIG to enable something" convention).

Converting all these options to individual PACKAGECONFIG options but not adding them to the default value PACKAGECONFIG seems like the better approach. Users who need to enable a particular algorithm can then add it to PACKAGECONFIG in the usual way.

In general, disabling old or unused algorithms by default is a good change though.

#10 lore raw
In reply to Konrad Weihmann
Quoted 31 lines · Konrad Weihmann
Quoted 28 lines · Richard Purdie
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
   B = "${WORKDIR}/build"
   do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
   CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
   CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

Quoted 7 lines
Quoted 2 lines

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

I'm not sure I follow, as this is a "hard" assign - if it would (in theory) a ??= assignment, yes then it would be fine. Still that leaves us with a not commonly known variable, while PACKAGECONFIG is more widely accepted in 3rd party layers/distros from my experience.

In the past I had done something similar w/ PACKAGECONFIG, and then had a comment in the recipe that indicated that certain items were not recommended with a link to the OpenSSL documentation where it explained that.

It might also be a reasonable idea (security wise, maybe not OE wise) to display a bb.warn if one of the 'unsafe' crypto algorithms is enabled.

As for someone mentioning that it's unclear if we should be maintaining a list, in the past there was a list in the OpenSSL documentation. I would certainly rely on that list as what should and should not be enabled by default (with exceptions as appropriate.)

--Mark

Quoted 9 lines
Quoted 9 lines

Cheers,

Richard

#11 lore raw
In reply to Richard Purdie
Quoted 25 lines · Richard Purdie
Quoted 11 lines · Konrad Weihmann
Quoted 10 lines · Richard Purdie

PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +2 -0
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
  B = "${WORKDIR}/build"
  do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
  CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
  CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
Quoted 11 lines

meta/recipes-connectivity/openssl/openssl_1.1.1g.bb EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" · line 60

Quoted 4 lines
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +4 -0
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+

From my perspective this breaks backward compatibility, so I would
rather have them all that as optional PACKAGECONFIG fields (which also does make it easier for ppl, still relying on one of those algorithms, for whatever reason, to re-enable them) - with the current approach all one could do is to override it with a bbappend - and tbh letting ppl have bbappends for this recipe, doesn't sound like the best idea in the long run to "enforce" any kind of "security" or "hardening"

Quoted 6 lines

Having it as a variable does mean you could customise the variable and doesn't mean it has to be done with a bbappend, it can be set from a distro config too.

I'm not sure turning each one into a packageconfig is going to be more helpful compared to this in practise...

I agree, its good as it is, we are able to append/remove options from it via config or recipe metadata in custom layers if needed.

Quoted 8 lines

Cheers,

Richard

#12 lore raw
In reply to Richard Purdie

so there are some build failures seen due to this change on meta-oe here is sample.

https://errors.yoctoproject.org/Errors/Build/113701/

Quoted 62 lines · Richard Purdie

The OE-Core list needs to be included on this so I'm doing so.

Cheers,

Richard

---------- Forwarded message ----------
From: Shachar Menashe <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Bcc:
Date: Sat, 19 Dec 2020 16:04:30 +0000
Subject: [yocto-security] [PATCH] openssl: drop support for deprecated algorithms
1. Drop support for many deprecated algorithms by default
2. Allow dropping support for TLS 1.0/1.1 via PACKAGECONFIG

---
 meta/recipes-connectivity/openssl/openssl_1.1.1g.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-connectivity/openssl/openssl_1.1.1g.bb +7 -2
index 8159558..f9764bd 100644
@@ -33,6 +33,8 @@ PACKAGECONFIG_class-native = ""
 PACKAGECONFIG_class-nativesdk = ""
 
 PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
+PACKAGECONFIG[no-tls1] = "no-tls1"
+PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
 
 B = "${WORKDIR}/build"
 do_configure[cleandirs] = "${B}"
@@ -52,6 +54,10 @@ EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
 CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
 
+# Disable deprecated crypto algorithms
+# Retained for compatibilty - des (curl), dh (python-ssl), dsa (rpm)
+DEPRECATED_CRYPTO_FLAGS = " no-ssl no-idea no-psk no-rc2 no-rc4 no-rc5 no-md2 no-md4 no-srp no-camellia no-bf no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-whirlpool"
+
 do_configure () {
        os=${HOST_OS}
        case $os in
@@ -122,7 +128,7 @@ do_configure () {
        # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
        # environment variables set by bitbake. Adjust the environment variables instead.
        HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
+       perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
        perl ${B}/configdata.pm --dump
 }
 
--

2.17.1

#13 lore raw

Yeah, the patch is actually targeted for dunfell branch, but I understood the policy is first merging to master... So I will rebase the patch on master and retest everything

#14 lore raw
Quoted 3 lines · Shachar Menashe

Yeah, the patch is actually targeted for dunfell branch, but I understood the policy is first merging to master... So I will rebase the patch on master and retest everything

I did rebase the patch and its currently queued in master-next to see how it worked out.

Khem has posted a good follow up showing it caused some issues for recipes in meta-openembedded so we have a list of the software removing those algorithms caused problems with.

We'd need to sort this out in master before we can think about dunfell.

Cheers,

Richard