Dmitry Belyavskiy d8b51e
--- openssh-9.3p1/openbsd-compat/openssl-compat.c	2023-03-15 22:28:19.000000000 +0100
Dmitry Belyavskiy d8b51e
+++ /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat/openssl-compat.c	2023-05-25 14:19:42.870841944 +0200
Dmitry Belyavskiy d8b51e
@@ -33,10 +33,10 @@
Dmitry Belyavskiy d8b51e
 
Dmitry Belyavskiy d8b51e
 /*
Dmitry Belyavskiy d8b51e
  * OpenSSL version numbers: MNNFFPPS: major minor fix patch status
Dmitry Belyavskiy d8b51e
- * We match major, minor, fix and status (not patch) for <1.0.0.
Dmitry Belyavskiy d8b51e
- * After that, we acceptable compatible fix versions (so we
Dmitry Belyavskiy d8b51e
- * allow 1.0.1 to work with 1.0.0). Going backwards is only allowed
Dmitry Belyavskiy d8b51e
- * within a patch series.
Dmitry Belyavskiy d8b51e
+ * Versions >=3 require only major versions to match.
Dmitry Belyavskiy d8b51e
+ * For versions <3, we accept compatible fix versions (so we allow 1.0.1
Dmitry Belyavskiy d8b51e
+ * to work with 1.0.0). Going backwards is only allowed within a patch series.
Dmitry Belyavskiy d8b51e
+ * See https://www.openssl.org/policies/releasestrat.html
Dmitry Belyavskiy d8b51e
  */
Dmitry Belyavskiy d8b51e
 
Dmitry Belyavskiy d8b51e
 int
Dmitry Belyavskiy d8b51e
@@ -48,15 +48,17 @@
Dmitry Belyavskiy d8b51e
 	if (headerver == libver)
Dmitry Belyavskiy d8b51e
 		return 1;
Dmitry Belyavskiy d8b51e
 
Dmitry Belyavskiy d8b51e
-	/* for versions < 1.0.0, major,minor,fix,status must match */
Dmitry Belyavskiy d8b51e
-	if (headerver < 0x1000000f) {
Dmitry Belyavskiy d8b51e
-		mask = 0xfffff00fL; /* major,minor,fix,status */
Dmitry Belyavskiy d8b51e
+	/*
Dmitry Belyavskiy d8b51e
+	 * For versions >= 3.0, only the major and status must match.
Dmitry Belyavskiy d8b51e
+	 */
Dmitry Belyavskiy d8b51e
+	if (headerver >= 0x3000000f) {
Dmitry Belyavskiy d8b51e
+		mask = 0xf000000fL; /* major,status */
Dmitry Belyavskiy d8b51e
 		return (headerver & mask) == (libver & mask);
Dmitry Belyavskiy d8b51e
 	}
Dmitry Belyavskiy d8b51e
 
Dmitry Belyavskiy d8b51e
 	/*
Dmitry Belyavskiy d8b51e
-	 * For versions >= 1.0.0, major,minor,status must match and library
Dmitry Belyavskiy d8b51e
-	 * fix version must be equal to or newer than the header.
Dmitry Belyavskiy d8b51e
+	 * For versions >= 1.0.0, but <3, major,minor,status must match and
Dmitry Belyavskiy d8b51e
+	 * library fix version must be equal to or newer than the header.
Dmitry Belyavskiy d8b51e
 	 */
Dmitry Belyavskiy d8b51e
 	mask = 0xfff0000fL; /* major,minor,status */
Dmitry Belyavskiy d8b51e
 	hfix = (headerver & 0x000ff000) >> 12;
Dmitry Belyavskiy d18e1c
diff -up openssh-8.7p1/configure.ac.check openssh-8.7p1/configure.ac
Dmitry Belyavskiy d18e1c
--- openssh-8.7p1/configure.ac.check	2023-11-27 14:54:32.959113758 +0100
Dmitry Belyavskiy d18e1c
+++ openssh-8.7p1/configure.ac	2023-11-27 14:54:49.467500523 +0100
Dmitry Belyavskiy d18e1c
@@ -2821,7 +2821,7 @@ if test "x$openssl" = "xyes" ; then
Dmitry Belyavskiy d18e1c
 				;;
Dmitry Belyavskiy d18e1c
 			101*)   ;; # 1.1.x
Dmitry Belyavskiy d18e1c
 			200*)   ;; # LibreSSL
Dmitry Belyavskiy d18e1c
-			300*)   ;; # OpenSSL development branch.
Dmitry Belyavskiy d18e1c
+			30*)   ;; # OpenSSL 3.x series
Dmitry Belyavskiy d18e1c
 		        *)
Dmitry Belyavskiy d18e1c
 				AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_library_ver")])
Dmitry Belyavskiy d18e1c
 		                ;;