vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Dmitry Belyavskiy eb1b5e
--- openssh-9.3p1/openbsd-compat/openssl-compat.c	2023-03-15 22:28:19.000000000 +0100
Dmitry Belyavskiy eb1b5e
+++ /home/dbelyavs/work/upstream/openssh-portable/openbsd-compat/openssl-compat.c	2023-05-25 14:19:42.870841944 +0200
Dmitry Belyavskiy eb1b5e
@@ -33,10 +33,10 @@
Dmitry Belyavskiy eb1b5e
 
Dmitry Belyavskiy eb1b5e
 /*
Dmitry Belyavskiy eb1b5e
  * OpenSSL version numbers: MNNFFPPS: major minor fix patch status
Dmitry Belyavskiy eb1b5e
- * We match major, minor, fix and status (not patch) for <1.0.0.
Dmitry Belyavskiy eb1b5e
- * After that, we acceptable compatible fix versions (so we
Dmitry Belyavskiy eb1b5e
- * allow 1.0.1 to work with 1.0.0). Going backwards is only allowed
Dmitry Belyavskiy eb1b5e
- * within a patch series.
Dmitry Belyavskiy eb1b5e
+ * Versions >=3 require only major versions to match.
Dmitry Belyavskiy eb1b5e
+ * For versions <3, we accept compatible fix versions (so we allow 1.0.1
Dmitry Belyavskiy eb1b5e
+ * to work with 1.0.0). Going backwards is only allowed within a patch series.
Dmitry Belyavskiy eb1b5e
+ * See https://www.openssl.org/policies/releasestrat.html
Dmitry Belyavskiy eb1b5e
  */
Dmitry Belyavskiy eb1b5e
 
Dmitry Belyavskiy eb1b5e
 int
Dmitry Belyavskiy eb1b5e
@@ -48,15 +48,17 @@
Dmitry Belyavskiy eb1b5e
 	if (headerver == libver)
Dmitry Belyavskiy eb1b5e
 		return 1;
Dmitry Belyavskiy eb1b5e
 
Dmitry Belyavskiy eb1b5e
-	/* for versions < 1.0.0, major,minor,fix,status must match */
Dmitry Belyavskiy eb1b5e
-	if (headerver < 0x1000000f) {
Dmitry Belyavskiy eb1b5e
-		mask = 0xfffff00fL; /* major,minor,fix,status */
Dmitry Belyavskiy eb1b5e
+	/*
Dmitry Belyavskiy eb1b5e
+	 * For versions >= 3.0, only the major and status must match.
Dmitry Belyavskiy eb1b5e
+	 */
Dmitry Belyavskiy eb1b5e
+	if (headerver >= 0x3000000f) {
Dmitry Belyavskiy eb1b5e
+		mask = 0xf000000fL; /* major,status */
Dmitry Belyavskiy eb1b5e
 		return (headerver & mask) == (libver & mask);
Dmitry Belyavskiy eb1b5e
 	}
Dmitry Belyavskiy eb1b5e
 
Dmitry Belyavskiy eb1b5e
 	/*
Dmitry Belyavskiy eb1b5e
-	 * For versions >= 1.0.0, major,minor,status must match and library
Dmitry Belyavskiy eb1b5e
-	 * fix version must be equal to or newer than the header.
Dmitry Belyavskiy eb1b5e
+	 * For versions >= 1.0.0, but <3, major,minor,status must match and
Dmitry Belyavskiy eb1b5e
+	 * library fix version must be equal to or newer than the header.
Dmitry Belyavskiy eb1b5e
 	 */
Dmitry Belyavskiy eb1b5e
 	mask = 0xfff0000fL; /* major,minor,status */
Dmitry Belyavskiy eb1b5e
 	hfix = (headerver & 0x000ff000) >> 12;