ext/openssl: 8.2.31+/8.3.31+ fail to build against OpenSSL 1.0.2 (ASN1_STRING_get0_data in xp_ssl.c)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 79/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- backend, build-system
Línea de trabajo
Lee ext/openssl/xp_ssl.c cerca de php_openssl_matches_san_list() y compara la alternativa de compatibilidad con OpenSSL en ext/openssl/openssl.c. Reproduce la compilación con PHP 8.3.36 y OpenSSL 1.0.2; después, verifica que se compile y que la coincidencia de SAN de IP siga funcionando. El trabajo se considera terminado cuando las ramas afectadas de PHP 8.2 y 8.3 se compilen con OpenSSL 1.0.2 sin afectar las compilaciones con versiones más recientes de OpenSSL.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
PHP 8.2.31+ and 8.3.31+ no longer compile against OpenSSL 1.0.2, though both branches still accept it (ext/openssl/config0.m4: "requires OpenSSL >= 1.0.2").
To reproduce, build PHP 8.3.36 (or any 8.3.31+ or 8.2.31+) --with-openssl against OpenSSL 1.0.2, e.g. on CentOS 7 (OpenSSL 1.0.2k, gcc 4.8.5).
Resulted in this output:
ext/openssl/xp_ssl.c: In function 'php_openssl_matches_san_list':
ext/openssl/xp_ssl.c:506:6: warning: implicit declaration of function 'ASN1_STRING_get0_data' [-Wimplicit-function-declaration]
ASN1_STRING_get0_data(san->d.iPAddress)[0],
^
ext/openssl/xp_ssl.c:506:45: error: subscripted value is neither array nor pointer nor vector
ASN1_STRING_get0_data(san->d.iPAddress)[0],
^
ext/openssl/xp_ssl.c:507:45: error: subscripted value is neither array nor pointer nor vector
ext/openssl/xp_ssl.c:508:45: error: subscripted value is neither array nor pointer nor vector
ext/openssl/xp_ssl.c:509:45: error: subscripted value is neither array nor pointer nor vector
ext/openssl/xp_ssl.c:138:10: error: subscripted value is neither array nor pointer nor vector
_bytes[0] << 8 | _bytes[1], \
But I expected the build to succeed, as it does with 8.3.30 / 8.2.30 against the same OpenSSL.
Cause: 19255f4b78 ("Backport compatibility changes for OpenSSL 4.0") changed the IP SAN code in php_openssl_matches_san_list() from san->d.iPAddress->data to ASN1_STRING_get0_data(san->d.iPAddress). ASN1_STRING_get0_data() was added in OpenSSL 1.1.0. ext/openssl/openssl.c already defines a fallback for it under #if PHP_OPENSSL_API_VERSION < 0x10100 (return M_ASN1_STRING_data(asn1);), but that is static to openssl.c, and xp_ssl.c has no equivalent. (ASN1_STRING_length(), used in the same change, does exist in 1.0.2.) PHP-8.2 and PHP-8.3 HEAD are both still affected. 8.4+ requires OpenSSL >= 1.1.1, so it is not.
Suggested fix: the same fallback in xp_ssl.c, under the same guard (it compiles away on 1.1.0+):
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -36,6 +36,10 @@
#include <openssl/bn.h>
#include <openssl/dh.h>
+#if PHP_OPENSSL_API_VERSION < 0x10100
+# define ASN1_STRING_get0_data(asn1) ((const unsigned char *)M_ASN1_STRING_data(asn1))
+#endif
+
#ifdef PHP_WIN32
#include "win32/winutil.h"
#include "win32/time.h"
With that applied, 8.3.36 builds on CentOS 7 against OpenSSL 1.0.2k. A verified TLS connection to a server whose certificate's only SAN is IP:127.0.0.1 succeeds, and the same connection with a peer_name the certificate doesn't cover is refused, so the IP SAN matching works. Alternatively, the fallback could move to php_openssl.h so both files share it.
PHP Version
PHP 8.3.36 (fails to build against OpenSSL 1.0.2; first affected: 8.3.31 and 8.2.31)
Operating System
CentOS 7 (OpenSSL 1.0.2k)
- Lenguaje dominante
- C
- Estrellas
- 41.8k
- Forks
- 8.5k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 145
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de php/php-src
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
php/php-src#25397 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
SNMP accepts malformed remote portsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
php/php-src#25137 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFFPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
php/php-src#24196 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de php/php-src
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
not for AI lovers
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OSGeo/gdal#15515 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Template: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
betaflight/betaflight#16014 ·
Los mantenedores suelen responder en 3 días
-
Bug: [BMC] show techsupport logs ERR "BMC instance is not available" on switch host with a SONiC BMCAbiertoBug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
sonic-net/sonic-buildimage#30701 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:tooling bug platform:android
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
maplibre/maplibre-native-ffi#1791 ·
Los mantenedores suelen responder en 1 día