Skip to contentSkip to conversation

hardknott fixes

PATCH In review Yi Zhao 2 participants 8 messages Apr 22, 2021 – Apr 23, 2021

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

cover hardknott fixes

Changqing Li (1):
openssh: refresh patches to 8.5p1

Chen Qi (1):
layer.conf: add hardknott to LAYERSERIES_COMPAT

Yi Zhao (4):
README.build: add "Known Issues" section
openssh: refresh patches to 8.4p1
openssh: fix the double free error for ssh-cavs
openssh: set kex->sessin_id via sshbuf_put in ssh-cavs

 README.build                                  |  28 +++
 conf/layer.conf                               |   2 +-
 .../0001-conditional-enable-fips-mode.patch   |  46 ++---
 ...ps.patch => 0001-openssh-8.4p1-fips.patch} | 173 +++++++-----------
 ...1-ssh-cavs-fix-the-double-free-error.patch | 161 ++++++++++++++++
 ...avs-set-kex-sessin_id-via-sshbuf_put.patch |  45 +++++
 recipes-connectivity/openssh/openssh_fips.inc |   4 +-
 7 files changed, 327 insertions(+), 132 deletions(-)
 rename recipes-connectivity/openssh/openssh/{0001-openssh-8.2p1-fips.patch => 0001-openssh-8.4p1-fips.patch} (73%)
 create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-fix-the-double-free-error.patch
 create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-set-kex-sessin_id-via-sshbuf_put.patch
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/6 README.build: add "Known Issues" section

There is an openssl build error if the prebuilt FIPS object module is built on target with a CPU which supports AVX/AVX2 instruction set. Add section "Known Issues" to describe this issue.

---
 README.build | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
README.build +28 -0
index 102c850..36e3875 100644
@@ -254,3 +254,31 @@ Note this sample command is functionally equivalent to:
 $ env OPENSSL_FIPS=1 openssl sha1 -hmac etaonrishdlcupfm fips_hmac.c
 HMAC-SHA1(fips_hmac.c)= ae25ad68d9a8cc04075100563a437fa37829afcc
 
+=======================
+Known Issues
+=======================
+If the CPU on target machine which building FIPS object module is newer than
+Nehalem (e.g. Sandy Brigde) or is an Intel Atom processor. Then you may
+encounter an error when building openssl with the FIPS object module:
+qemu: uncaught target signal 4 (Illegal instruction).
+
+The current processor emulated in qemu is set to Nehalem. But the GCC will use
+-march=native to enable all instruction subsets supported by the target machine
+when building FIPS object module. The illegal instruction error will occur if
+some instruction subsets (e.g AVX/AVX2) are not supported by Nehalem.
+
+To check if the CPU is Intel Atom:
+$ cat /proc/cpuinfo | grep "Atom"
+
+To check if the CPU supports AVX/AVX2:
+$ cat /proc/cpuinfo | grep "avx"
+Or:
+$ gcc -dM -E - < /dev/null | grep "AVX"
+
+As a workaround, we can specify -march=nehalem in GCC before build the FIPS
+object module:
+$ export CC="gcc -march=nehalem"
+$ ./config [no-asm]
+$ make
+$ make install
+
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 2/6 openssh: refresh patches to 8.4p1

In reply to Yi Zhao

Refresh patches to openssh-8.4p1. Reference:
http://pkgs.fedoraproject.org/cgit/rpms/openssh.git/plain/openssh-7.7p1-fips.patch
(commit: fbd5f1bee2e2cdc7b1b47f4604b8347d8c3ed63f)

---
 .../0001-conditional-enable-fips-mode.patch   |  40 ++---
 ...ps.patch => 0001-openssh-8.4p1-fips.patch} | 159 +++++++-----------
 recipes-connectivity/openssh/openssh_fips.inc |   2 +-
 3 files changed, 80 insertions(+), 121 deletions(-)
 rename recipes-connectivity/openssh/openssh/{0001-openssh-8.2p1-fips.patch => 0001-openssh-8.4p1-fips.patch} (75%)
recipes-connectivity/openssh/openssh/0001-conditional-enable-fips-mode.patch +20 -20
index 942fda6..17c5967 100644
@@ -1,4 +1,4 @@
-From ef6490841a73b4f71ca35e09328c6a8b0ad9dba9 Mon Sep 17 00:00:00 2001
+From 571b24129e3c3a84e38a59a32aa61fa40e04e1e2 Mon Sep 17 00:00:00 2001
 From: Hongxu Jia <[email protected]>
 Date: Sat, 21 Dec 2019 13:03:23 +0800
 Subject: [PATCH] conditional enable fips mode
@@ -44,10 +44,10 @@ index 06566d3..a10566d 100644
  	sanitise_stdfd();
  
 diff --git a/sftp-server.c b/sftp-server.c
-index 359204f..346255a 100644
+index 55386fa..8c1634e 100644
 --- a/sftp-server.c
 +++ b/sftp-server.c
-@@ -1576,6 +1576,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
+@@ -1577,6 +1577,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
  	extern char *optarg;
  	extern char *__progname;
  
@@ -56,7 +56,7 @@ index 359204f..346255a 100644
  	log_init(__progname, log_level, log_facility, log_stderr);
  
 diff --git a/sftp.c b/sftp.c
-index ff14d3c..a633200 100644
+index c88c861..171bc56 100644
 --- a/sftp.c
 +++ b/sftp.c
 @@ -2390,6 +2390,7 @@ main(int argc, char **argv)
@@ -68,10 +68,10 @@ index ff14d3c..a633200 100644
  	sanitise_stdfd();
  	msetlocale();
 diff --git a/ssh-add.c b/ssh-add.c
-index 8057eb1..19f3da2 100644
+index 936dc21..b7ac2d2 100644
 --- a/ssh-add.c
 +++ b/ssh-add.c
-@@ -628,6 +628,7 @@ main(int argc, char **argv)
+@@ -671,6 +671,7 @@ main(int argc, char **argv)
  	SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
  	LogLevel log_level = SYSLOG_LEVEL_INFO;
  
@@ -80,10 +80,10 @@ index 8057eb1..19f3da2 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-agent.c b/ssh-agent.c
-index 7eb6f0d..1409044 100644
+index e1fd1f3..da49b57 100644
 --- a/ssh-agent.c
 +++ b/ssh-agent.c
-@@ -1196,6 +1196,7 @@ main(int ac, char **av)
+@@ -1289,6 +1289,7 @@ main(int ac, char **av)
  	size_t npfd = 0;
  	u_int maxfds;
  
@@ -92,10 +92,10 @@ index 7eb6f0d..1409044 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-keygen.c b/ssh-keygen.c
-index feafe73..9b832f6 100644
+index cb8e569..67c7d62 100644
 --- a/ssh-keygen.c
 +++ b/ssh-keygen.c
-@@ -3140,6 +3140,7 @@ main(int argc, char **argv)
+@@ -3184,6 +3184,7 @@ main(int argc, char **argv)
  	extern int optind;
  	extern char *optarg;
  
@@ -104,10 +104,10 @@ index feafe73..9b832f6 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-keyscan.c b/ssh-keyscan.c
-index a5e6440..e56a9d1 100644
+index ca19042..c667f2c 100644
 --- a/ssh-keyscan.c
 +++ b/ssh-keyscan.c
-@@ -675,6 +675,7 @@ main(int argc, char **argv)
+@@ -667,6 +667,7 @@ main(int argc, char **argv)
  	extern int optind;
  	extern char *optarg;
  
@@ -116,7 +116,7 @@ index a5e6440..e56a9d1 100644
  	seed_rng();
  	TAILQ_INIT(&tq);
 diff --git a/ssh-keysign.c b/ssh-keysign.c
-index 3e3ea3e..4804c42 100644
+index 7991e0f..26a3bab 100644
 --- a/ssh-keysign.c
 +++ b/ssh-keysign.c
 @@ -173,6 +173,7 @@ main(int argc, char **argv)
@@ -128,7 +128,7 @@ index 3e3ea3e..4804c42 100644
  		fatal("%s: pledge: %s", __progname, strerror(errno));
  
 diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
-index 17220d6..1af0c2e 100644
+index d73e835..e508684 100644
 --- a/ssh-pkcs11-helper.c
 +++ b/ssh-pkcs11-helper.c
 @@ -332,6 +332,7 @@ main(int argc, char **argv)
@@ -140,22 +140,22 @@ index 17220d6..1af0c2e 100644
  	seed_rng();
  	TAILQ_INIT(&pkcs11_keylist);
 diff --git a/ssh.c b/ssh.c
-index 49331fc..06836dd 100644
+index aabd5d3..81393f1 100644
 --- a/ssh.c
 +++ b/ssh.c
-@@ -606,6 +606,7 @@ main(int ac, char **av)
- 	u_char conn_hash[SSH_DIGEST_MAX_LENGTH];
+@@ -660,6 +660,7 @@ main(int ac, char **av)
  	size_t n, len;
+ 	u_int j;
  
 +	ssh_enable_fips_mode();
  	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
  	sanitise_stdfd();
  
 diff --git a/sshd.c b/sshd.c
-index b86d682..304bf01 100644
+index 1f1fcc2..0f68419 100644
 --- a/sshd.c
 +++ b/sshd.c
-@@ -1514,6 +1514,7 @@ main(int ac, char **av)
+@@ -1553,6 +1553,7 @@ main(int ac, char **av)
  	Authctxt *authctxt;
  	struct connection_info *connection_info = NULL;
  
@@ -208,5 +208,5 @@ index abaf7ad..b3b1c8c 100644
  		__attribute__((__nonnull__ (2)));
 +void	ssh_enable_fips_mode(void);
 -- 
-2.7.4
+2.17.1
 
recipes-connectivity/openssh/openssh/0001-openssh-8.4p1-fips.patch renamed from recipes-connectivity/openssh/openssh/0001-openssh-8.2p1-fips.patch +59 -100

309 lines not on this page · raw message

recipes-connectivity/openssh/openssh_fips.inc +1 -1
index c74532f..4fdb2aa 100644
@@ -6,7 +6,7 @@ DEPENDS += " \
 RRECOMMENDS_${PN}-sshd_remove = "rng-tools"
 
 SRC_URI += " \
-    file://0001-openssh-8.2p1-fips.patch \
+    file://0001-openssh-8.4p1-fips.patch \
     file://0001-conditional-enable-fips-mode.patch \
     file://openssh-6.6p1-ctr-cavstest.patch \
     file://openssh-6.7p1-kdf-cavs.patch \
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH 3/6 openssh: fix the double free error for ssh-cavs

In reply to Yi Zhao

There is a 'double free or corruption' error when running ssh-cavs:

$ /usr/libexec/ssh-cavs -K
0055d50f2d163cc07cd8a93cc7c3430c30ce786b572c01ad29fec7597000cf8618d664e2ec3dcbc8bb7a1a7eb7ef67f61cdaf291625da879186ac0a5cb27af571b59612d6a6e0627344d846271959fda61c78354aa498773d59762f8ca2d0215ec590d8633de921f920d41e47b3de6ab9a3d0869e1c826d0e4adebf8e3fb646a15dea20a410b44e969f4b791ed6a67f13f1b74234004d5fa5e87eff7abc32d49bbdf44d7b0107e8f10609233b7e2b7eff74a4daf25641de7553975dac6ac1e5117df6f6dbaa1c263d23a6c3e5a3d7d49ae8a828c1e333ac3f85fbbf57b5c1a45be45e43a7be1a4707eac779b8285522d1f531fe23f890fd38a004339932b93eda4
-H d3ab91a850febb417a25d892ec48ed5952c7a5de -s d3ab91a850febb417a25d892ec48ed5952c7a5de -i 8 -e 24 -m 20
Initial IV (client to server) = 4bb320d1679dfd3a
Initial IV (server to client) = 43dea6fdf263a308
Encryption key (client to server) = 13048cc600b9d3cf9095aa6cf8e2ff9cf1c54ca0520c89ed
Encryption key (server to client) = 1e483c5134e901aa11fc4e0a524e7ec7b75556148a222bb0
Integrity key (client to server) = ecef63a092b0dcc585bdc757e01b2740af57d640
Integrity key (server to client) = 7424b05f3c44a72b4ebd281fb71f9cbe7b64d479
double free or corruption (out)
Aborted

Since openssh 8.x, the ssh->kex has been allocated when struct ssh is initialized in function ssh_alloc_session_state()[1] and will be freed in function ssh_packet_close()[2]. We don't need to make the ssh->kex to point a extra kex struct which will cause the memory corruption and memory leak.

---
 ...1-ssh-cavs-fix-the-double-free-error.patch | 161 ++++++++++++++++++
 recipes-connectivity/openssh/openssh_fips.inc |   1 +
 2 files changed, 162 insertions(+)
 create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-fix-the-double-free-error.patch
recipes-connectivity/openssh/openssh/0001-ssh-cavs-fix-the-double-free-error.patch new file +161 -0
new file mode 100644
index 0000000..7d7fc14
@@ -0,0 +1,161 @@
+From b6202d402a27467a8a4bacaca4064ee731a03fa7 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Sun, 17 Jan 2021 11:17:53 +0800
+Subject: [PATCH] ssh-cavs: fix the double free error
+
+There is a 'double free or corruption' error when running ssh-cavs:
+$ /usr/libexec/ssh-cavs -K
+0055d50f2d163cc07cd8a93cc7c3430c30ce786b572c01ad29fec7597000cf8618d664e2ec3dcbc8bb7a1a7eb7ef67f61cdaf291625da879186ac0a5cb27af571b59612d6a6e0627344d846271959fda61c78354aa498773d59762f8ca2d0215ec590d8633de921f920d41e47b3de6ab9a3d0869e1c826d0e4adebf8e3fb646a15dea20a410b44e969f4b791ed6a67f13f1b74234004d5fa5e87eff7abc32d49bbdf44d7b0107e8f10609233b7e2b7eff74a4daf25641de7553975dac6ac1e5117df6f6dbaa1c263d23a6c3e5a3d7d49ae8a828c1e333ac3f85fbbf57b5c1a45be45e43a7be1a4707eac779b8285522d1f531fe23f890fd38a004339932b93eda4
+-H d3ab91a850febb417a25d892ec48ed5952c7a5de -s d3ab91a850febb417a25d892ec48ed5952c7a5de -i 8 -e 24 -m 20
+Initial IV (client to server) = 4bb320d1679dfd3a
+Initial IV (server to client) = 43dea6fdf263a308
+Encryption key (client to server) = 13048cc600b9d3cf9095aa6cf8e2ff9cf1c54ca0520c89ed
+Encryption key (server to client) = 1e483c5134e901aa11fc4e0a524e7ec7b75556148a222bb0
+Integrity key (client to server) = ecef63a092b0dcc585bdc757e01b2740af57d640
+Integrity key (server to client) = 7424b05f3c44a72b4ebd281fb71f9cbe7b64d479
+double free or corruption (out)
+Aborted
+
+Since openssh 8.x, the ssh->kex has been allocated when struct ssh is
+initialized in function ssh_alloc_session_state()[1] and will be freed
+in function ssh_packet_close()[2]. We don't need to make the ssh->kex to
+point a extra kex struct which will cause the memory corruption and
+memory leak.
+
+[1] https://github.com/openssh/openssh-portable/commit/0a843d9a0e805f14653a555f5c7a8ba99d62c12d
+[2] https://github.com/openssh/openssh-portable/commit/55ef3e9cbd5b336bd0f89205716924886fcf86de
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ ssh-cavs.c | 60 ++++++++++++++++++++++++------------------------------
+ 1 file changed, 27 insertions(+), 33 deletions(-)
+
+diff --git a/ssh-cavs.c b/ssh-cavs.c
+index b74ae7f..641a453 100644
+--- a/ssh-cavs.c
++++ b/ssh-cavs.c
+@@ -164,7 +164,6 @@ struct kdf_cavs {
+ static int sshkdf_cavs(struct kdf_cavs *test)
+ {
+ 	int ret = 0;
+-	struct kex kex;
+ 	struct sshbuf *Kb = NULL;
+ 	BIGNUM *Kbn = NULL;
+ 	int mode = 0;
+@@ -175,8 +174,6 @@ static int sshkdf_cavs(struct kdf_cavs *test)
+ #define HEXOUTLEN 500
+ 	char hex[HEXOUTLEN];
+ 
+-	memset(&kex, 0, sizeof(struct kex));
+-
+ 	Kbn = BN_new();
+ 	BN_bin2bn(test->K, test->Klen, Kbn);
+ 	if (!Kbn) {
+@@ -192,24 +189,29 @@ static int sshkdf_cavs(struct kdf_cavs *test)
+ 	}
+ 	sshbuf_put_bignum2(Kb, Kbn);
+ 
+-	kex.session_id = test->session_id;
+-	kex.session_id_len = test->session_id_len;
++	if ((ssh = ssh_packet_set_connection(NULL, -1, -1)) == NULL){
++		printf("Allocation error\n");
++		goto out;
++	}
++
++	ssh->kex->session_id = test->session_id;
++	ssh->kex->session_id_len = test->session_id_len;
+ 
+ 	/* setup kex */
+ 
+ 	/* select the right hash based on struct ssh_digest digests */
+ 	switch (test->ik_len) {
+ 		case 20:
+-			kex.hash_alg = SSH_DIGEST_SHA1;
++			ssh->kex->hash_alg = SSH_DIGEST_SHA1;
+ 			break;
+ 		case 32:
+-			kex.hash_alg = SSH_DIGEST_SHA256;
++			ssh->kex->hash_alg = SSH_DIGEST_SHA256;
+ 			break;
+ 		case 48:
+-			kex.hash_alg = SSH_DIGEST_SHA384;
++			ssh->kex->hash_alg = SSH_DIGEST_SHA384;
+ 			break;
+ 		case 64:
+-			kex.hash_alg = SSH_DIGEST_SHA512;
++			ssh->kex->hash_alg = SSH_DIGEST_SHA512;
+ 			break;
+ 		default:
+ 			printf("Wrong hash type %u\n", test->ik_len);
+@@ -219,41 +221,35 @@ static int sshkdf_cavs(struct kdf_cavs *test)
+ 
+ 	/* implement choose_enc */
+ 	for (mode = 0; mode < 2; mode++) {
+-		kex.newkeys[mode] = calloc(1, sizeof(struct newkeys));
+-		if (!kex.newkeys[mode]) {
++		ssh->kex->newkeys[mode] = calloc(1, sizeof(struct newkeys));
++		if (!ssh->kex->newkeys[mode]) {
+ 			printf("allocation of newkeys failed\n");
+ 			ret = 1;
+ 			goto out;
+ 		}
+-		kex.newkeys[mode]->enc.iv_len = test->iv_len;
+-		kex.newkeys[mode]->enc.key_len = test->ek_len;
+-		kex.newkeys[mode]->enc.block_size = (test->iv_len == 64) ? 8 : 16;
+-		kex.newkeys[mode]->mac.key_len = test->ik_len;
++		ssh->kex->newkeys[mode]->enc.iv_len = test->iv_len;
++		ssh->kex->newkeys[mode]->enc.key_len = test->ek_len;
++		ssh->kex->newkeys[mode]->enc.block_size = (test->iv_len == 64) ? 8 : 16;
++		ssh->kex->newkeys[mode]->mac.key_len = test->ik_len;
+ 	}
+ 
+ 	/* implement kex_choose_conf */
+-	kex.we_need = kex.newkeys[0]->enc.key_len;
+-	if (kex.we_need < kex.newkeys[0]->enc.block_size)
+-		kex.we_need = kex.newkeys[0]->enc.block_size;
+-	if (kex.we_need < kex.newkeys[0]->enc.iv_len)
+-		kex.we_need = kex.newkeys[0]->enc.iv_len;
+-	if (kex.we_need < kex.newkeys[0]->mac.key_len)
+-		kex.we_need = kex.newkeys[0]->mac.key_len;
++	ssh->kex->we_need = ssh->kex->newkeys[0]->enc.key_len;
++	if (ssh->kex->we_need < ssh->kex->newkeys[0]->enc.block_size)
++		ssh->kex->we_need = ssh->kex->newkeys[0]->enc.block_size;
++	if (ssh->kex->we_need < ssh->kex->newkeys[0]->enc.iv_len)
++		ssh->kex->we_need = ssh->kex->newkeys[0]->enc.iv_len;
++	if (ssh->kex->we_need < ssh->kex->newkeys[0]->mac.key_len)
++		ssh->kex->we_need = ssh->kex->newkeys[0]->mac.key_len;
+ 
+ 	/* MODE_OUT (1) -> server to client
+ 	 * MODE_IN (0) -> client to server */
+-	kex.server = 1;
++	ssh->kex->server = 1;
+ 
+-	/* do it */
+-	if ((ssh = ssh_packet_set_connection(NULL, -1, -1)) == NULL){
+-		printf("Allocation error\n");
+-		goto out;
+-	}
+-	ssh->kex = &kex;
+ 	kex_derive_keys(ssh, test->H, test->Hlen, Kb);
+ 
+-	ctoskeys = kex.newkeys[0];
+-	stockeys = kex.newkeys[1];
++	ctoskeys = ssh->kex->newkeys[0];
++	stockeys = ssh->kex->newkeys[1];
+ 
+ 	/* get data */
+ 	memset(hex, 0, HEXOUTLEN);
+@@ -376,8 +372,6 @@ int main(int argc, char *argv[])
+ 	ret = sshkdf_cavs(&test);
+ 
+ out:
+-	if (test.session_id)
+-		free(test.session_id);
+ 	if (test.K)
+ 		free(test.K);
+ 	if (test.H)
+-- 
+2.17.1
+
recipes-connectivity/openssh/openssh_fips.inc +1 -0
index 4fdb2aa..961f2d5 100644
@@ -10,6 +10,7 @@ SRC_URI += " \
     file://0001-conditional-enable-fips-mode.patch \
     file://openssh-6.6p1-ctr-cavstest.patch \
     file://openssh-6.7p1-kdf-cavs.patch \
+    file://0001-ssh-cavs-fix-the-double-free-error.patch \
 "
 
 do_install_append() {
Signature · 1 line
2.25.1
author
#4 lore raw

PATCH 4/6 openssh: refresh patches to 8.5p1

In reply to Yi Zhao

From: Changqing Li <[email protected]>

---
 .../0001-conditional-enable-fips-mode.patch   | 40 ++++++++--------
 .../openssh/0001-openssh-8.4p1-fips.patch     | 48 +++++++++----------
 2 files changed, 44 insertions(+), 44 deletions(-)
recipes-connectivity/openssh/openssh/0001-conditional-enable-fips-mode.patch +20 -20
index 17c5967..9fd19c0 100644
@@ -1,4 +1,4 @@
-From 571b24129e3c3a84e38a59a32aa61fa40e04e1e2 Mon Sep 17 00:00:00 2001
+From 48888de317391522186c6ae24a8d6d7d7add2673 Mon Sep 17 00:00:00 2001
 From: Hongxu Jia <[email protected]>
 Date: Sat, 21 Dec 2019 13:03:23 +0800
 Subject: [PATCH] conditional enable fips mode
@@ -44,10 +44,10 @@ index 06566d3..a10566d 100644
  	sanitise_stdfd();
  
 diff --git a/sftp-server.c b/sftp-server.c
-index 55386fa..8c1634e 100644
+index 7300900..42da9d7 100644
 --- a/sftp-server.c
 +++ b/sftp-server.c
-@@ -1577,6 +1577,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
+@@ -1616,6 +1616,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
  	extern char *optarg;
  	extern char *__progname;
  
@@ -56,10 +56,10 @@ index 55386fa..8c1634e 100644
  	log_init(__progname, log_level, log_facility, log_stderr);
  
 diff --git a/sftp.c b/sftp.c
-index c88c861..171bc56 100644
+index fb3c08d..85b9b67 100644
 --- a/sftp.c
 +++ b/sftp.c
-@@ -2390,6 +2390,7 @@ main(int argc, char **argv)
+@@ -2345,6 +2345,7 @@ main(int argc, char **argv)
  	size_t num_requests = DEFAULT_NUM_REQUESTS;
  	long long limit_kbps = 0;
  
@@ -68,10 +68,10 @@ index c88c861..171bc56 100644
  	sanitise_stdfd();
  	msetlocale();
 diff --git a/ssh-add.c b/ssh-add.c
-index 936dc21..b7ac2d2 100644
+index 7edb9f9..c75f85b 100644
 --- a/ssh-add.c
 +++ b/ssh-add.c
-@@ -671,6 +671,7 @@ main(int argc, char **argv)
+@@ -667,6 +667,7 @@ main(int argc, char **argv)
  	SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
  	LogLevel log_level = SYSLOG_LEVEL_INFO;
  
@@ -80,10 +80,10 @@ index 936dc21..b7ac2d2 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-agent.c b/ssh-agent.c
-index e1fd1f3..da49b57 100644
+index 58fe6dd..9018a7c 100644
 --- a/ssh-agent.c
 +++ b/ssh-agent.c
-@@ -1289,6 +1289,7 @@ main(int ac, char **av)
+@@ -1388,6 +1388,7 @@ main(int ac, char **av)
  	size_t npfd = 0;
  	u_int maxfds;
  
@@ -92,10 +92,10 @@ index e1fd1f3..da49b57 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-keygen.c b/ssh-keygen.c
-index cb8e569..67c7d62 100644
+index 6451584..246caa1 100644
 --- a/ssh-keygen.c
 +++ b/ssh-keygen.c
-@@ -3184,6 +3184,7 @@ main(int argc, char **argv)
+@@ -3153,6 +3153,7 @@ main(int argc, char **argv)
  	extern int optind;
  	extern char *optarg;
  
@@ -104,7 +104,7 @@ index cb8e569..67c7d62 100644
  	sanitise_stdfd();
  
 diff --git a/ssh-keyscan.c b/ssh-keyscan.c
-index ca19042..c667f2c 100644
+index 7abbcbf..b604bfd 100644
 --- a/ssh-keyscan.c
 +++ b/ssh-keyscan.c
 @@ -667,6 +667,7 @@ main(int argc, char **argv)
@@ -116,7 +116,7 @@ index ca19042..c667f2c 100644
  	seed_rng();
  	TAILQ_INIT(&tq);
 diff --git a/ssh-keysign.c b/ssh-keysign.c
-index 7991e0f..26a3bab 100644
+index 907162d..294148a 100644
 --- a/ssh-keysign.c
 +++ b/ssh-keysign.c
 @@ -173,6 +173,7 @@ main(int argc, char **argv)
@@ -128,10 +128,10 @@ index 7991e0f..26a3bab 100644
  		fatal("%s: pledge: %s", __progname, strerror(errno));
  
 diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
-index d73e835..e508684 100644
+index a9a6fe3..3c76f70 100644
 --- a/ssh-pkcs11-helper.c
 +++ b/ssh-pkcs11-helper.c
-@@ -332,6 +332,7 @@ main(int argc, char **argv)
+@@ -326,6 +326,7 @@ main(int argc, char **argv)
  	extern char *__progname;
  	struct pollfd pfd[2];
  
@@ -140,22 +140,22 @@ index d73e835..e508684 100644
  	seed_rng();
  	TAILQ_INIT(&pkcs11_keylist);
 diff --git a/ssh.c b/ssh.c
-index aabd5d3..81393f1 100644
+index 729d87a..ab78b53 100644
 --- a/ssh.c
 +++ b/ssh.c
-@@ -660,6 +660,7 @@ main(int ac, char **av)
- 	size_t n, len;
+@@ -650,6 +650,7 @@ main(int ac, char **av)
  	u_int j;
+ 	struct ssh_conn_info *cinfo = NULL;
  
 +	ssh_enable_fips_mode();
  	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
  	sanitise_stdfd();
  
 diff --git a/sshd.c b/sshd.c
-index 1f1fcc2..0f68419 100644
+index fee4703..07faf7b 100644
 --- a/sshd.c
 +++ b/sshd.c
-@@ -1553,6 +1553,7 @@ main(int ac, char **av)
+@@ -1534,6 +1534,7 @@ main(int ac, char **av)
  	Authctxt *authctxt;
  	struct connection_info *connection_info = NULL;
  
recipes-connectivity/openssh/openssh/0001-openssh-8.4p1-fips.patch +24 -24

168 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#5 lore raw

PATCH 5/6 openssh: set kex->sessin_id via sshbuf_put in ssh-cavs

In reply to Yi Zhao

The kex->session_id has been replaced from u_char * to sshbuf and kex->session_id_len has been removed in openssh 8.5[1]. Update ssh-cavs to adapt it.

Fixes:
ssh-cavs.c:198:12: error: 'struct kex' has no member named 'session_id_len'; did you mean 'session_id'?

  198 |  ssh->kex->session_id_len = test->session_id_len;
      |            ^~~~~~~~~~~~~~
      |            session_id

[1] https://github.com/openssh/openssh-portable/commit/39be3dc209f28f9c1ebfeba42adde8963b01e1cd

---
 ...avs-set-kex-sessin_id-via-sshbuf_put.patch | 45 +++++++++++++++++++
 recipes-connectivity/openssh/openssh_fips.inc |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-set-kex-sessin_id-via-sshbuf_put.patch
recipes-connectivity/openssh/openssh/0001-ssh-cavs-set-kex-sessin_id-via-sshbuf_put.patch new file +45 -0
new file mode 100644
index 0000000..20e8604
@@ -0,0 +1,45 @@
+From 3841d7c1057e62a57c49e5042080202739c9bf98 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Thu, 8 Apr 2021 15:09:21 +0800
+Subject: [PATCH] ssh-cavs: set kex->sessin_id via sshbuf_put
+
+The kex->session_id has been replaced from u_char * to sshbuf and
+kex->session_id_len has been removed in openssh 8.5[1]. Update ssh-cavs
+to adapt it.
+
+Fixes:
+ssh-cavs.c:198:12: error: 'struct kex' has no member named 'session_id_len'; did you mean 'session_id'?
+  198 |  ssh->kex->session_id_len = test->session_id_len;
+      |            ^~~~~~~~~~~~~~
+      |            session_id
+
+[1] https://github.com/openssh/openssh-portable/commit/39be3dc209f28f9c1ebfeba42adde8963b01e1cd
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ ssh-cavs.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/ssh-cavs.c b/ssh-cavs.c
+index 641a453..48bae74 100644
+--- a/ssh-cavs.c
++++ b/ssh-cavs.c
+@@ -194,8 +194,11 @@ static int sshkdf_cavs(struct kdf_cavs *test)
+ 		goto out;
+ 	}
+ 
+-	ssh->kex->session_id = test->session_id;
+-	ssh->kex->session_id_len = test->session_id_len;
++	if (sshbuf_put(ssh->kex->session_id, test->session_id, test->session_id_len) != 0) {
++		printf("cannot convert session_id into sshbuf\n");
++		ret = 1;
++		goto out;
++	}
+ 
+ 	/* setup kex */
+ 
+-- 
+2.17.1
+
recipes-connectivity/openssh/openssh_fips.inc +1 -0
index 961f2d5..194a6f4 100644
@@ -11,6 +11,7 @@ SRC_URI += " \
     file://openssh-6.6p1-ctr-cavstest.patch \
     file://openssh-6.7p1-kdf-cavs.patch \
     file://0001-ssh-cavs-fix-the-double-free-error.patch \
+    file://0001-ssh-cavs-set-kex-sessin_id-via-sshbuf_put.patch \
 "
 
 do_install_append() {
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH 6/6 layer.conf: add hardknott to LAYERSERIES_COMPAT

In reply to Yi Zhao

From: Chen Qi <[email protected]>

---
 conf/layer.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
conf/layer.conf +1 -1
index 892cf79..01026f0 100644
@@ -10,7 +10,7 @@ BBFILE_PRIORITY_meta-openssl-one-zero-two-fips = "5"
 
 LAYERVERSION_meta-openssl-one-zero-two-fips = "1"
 
-LAYERSERIES_COMPAT_meta-openssl-one-zero-two-fips = "zeus"
+LAYERSERIES_COMPAT_meta-openssl-one-zero-two-fips = "hardknott"
 
 LAYERPATH_meta-openssl-one-zero-two-fips = "${LAYERDIR}"
 
Signature · 1 line
2.25.1
#7 lore raw
In reply to Yi Zhao

Merged.

Quoted 25 lines · Yi Zhao

Changqing Li (1):
openssh: refresh patches to 8.5p1

Chen Qi (1):
layer.conf: add hardknott to LAYERSERIES_COMPAT

Yi Zhao (4):
README.build: add "Known Issues" section
openssh: refresh patches to 8.4p1
openssh: fix the double free error for ssh-cavs
openssh: set kex->sessin_id via sshbuf_put in ssh-cavs

  README.build                                  |  28 +++
  conf/layer.conf                               |   2 +-
  .../0001-conditional-enable-fips-mode.patch   |  46 ++---
  ...ps.patch => 0001-openssh-8.4p1-fips.patch} | 173 +++++++-----------
  ...1-ssh-cavs-fix-the-double-free-error.patch | 161 ++++++++++++++++
  ...avs-set-kex-sessin_id-via-sshbuf_put.patch |  45 +++++
  recipes-connectivity/openssh/openssh_fips.inc |   4 +-
  7 files changed, 327 insertions(+), 132 deletions(-)

rename recipes-connectivity/openssh/openssh/{0001-openssh-8.2p1-fips.patch => 0001-openssh-8.4p1-fips.patch} (73%) create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-fix-the-double-free-error.patch create mode 100644 recipes-connectivity/openssh/openssh/0001-ssh-cavs-set-kex-sessin_id-via-sshbuf_put.patch