php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
xp_ssl.c File Reference
#include "php.h"
#include "ext/standard/file.h"
#include "ext/standard/url.h"
#include "streams/php_streams_int.h"
#include "zend_smart_str.h"
#include "php_openssl.h"
#include "php_network.h"
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/err.h>
#include <openssl/bn.h>
#include <openssl/dh.h>

Go to the source code of this file.

Data Structures

struct  _php_openssl_sni_cert_t
 
struct  _php_openssl_handshake_bucket_t
 
struct  _php_openssl_alpn_ctx_t
 
struct  _php_openssl_netstream_data_t
 

Macros

#define MSG_DONTWAIT   0
 
#define STREAM_CRYPTO_IS_CLIENT   (1<<0)
 
#define STREAM_CRYPTO_METHOD_SSLv2   (1<<1)
 
#define STREAM_CRYPTO_METHOD_SSLv3   (1<<2)
 
#define STREAM_CRYPTO_METHOD_TLSv1_0   (1<<3)
 
#define STREAM_CRYPTO_METHOD_TLSv1_1   (1<<4)
 
#define STREAM_CRYPTO_METHOD_TLSv1_2   (1<<5)
 
#define STREAM_CRYPTO_METHOD_TLSv1_3   (1<<6)
 
#define HAVE_TLS1   1
 
#define HAVE_TLS11   1
 
#define HAVE_TLS12   1
 
#define HAVE_TLS13   1
 
#define HAVE_ECDH   1
 
#define HAVE_TLS_SNI   1
 
#define HAVE_TLS_ALPN   1
 
#define HAVE_SEC_LEVEL   1
 
#define HAVE_SSL3   1
 
#define PHP_OPENSSL_MIN_PROTO_VERSION   STREAM_CRYPTO_METHOD_SSLv3
 
#define PHP_OPENSSL_MAX_PROTO_VERSION   STREAM_CRYPTO_METHOD_TLSv1_3
 
#define GET_VER_OPT(_name)
 
#define GET_VER_OPT_STRING(_name, _str)
 
#define GET_VER_OPT_STRINGL(_name, _str, _len)
 
#define GET_VER_OPT_LONG(_name, _num)
 
#define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out)
 
#define SERVER_MICROSOFT_IIS   "Server: Microsoft-IIS"
 
#define SERVER_GOOGLE   "Server: GFE/"
 

Typedefs

typedef struct _php_openssl_sni_cert_t php_openssl_sni_cert_t
 
typedef struct _php_openssl_handshake_bucket_t php_openssl_handshake_bucket_t
 
typedef struct _php_openssl_alpn_ctx_t php_openssl_alpn_ctx
 
typedef struct _php_openssl_netstream_data_t php_openssl_netstream_data_t
 

Functions

php_streamphp_openssl_get_stream_from_ssl_handle (const SSL *ssl)
 
zend_stringphp_openssl_x509_fingerprint (X509 *peer, const char *method, bool raw)
 
int php_openssl_get_ssl_stream_data_index (void)
 
php_streamphp_openssl_ssl_socket_factory (const char *proto, size_t protolen, const char *resourcename, size_t resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC)
 

Macro Definition Documentation

◆ GET_VER_OPT

#define GET_VER_OPT ( _name)
Value:
(PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", _name)) != NULL)
zval * val
Definition ffi.c:4262
#define NULL
Definition gdcache.h:45
PHPAPI zval * php_stream_context_get_option(php_stream_context *context, const char *wrappername, const char *optionname)
Definition streams.c:2407
#define PHP_STREAM_CONTEXT(stream)

Definition at line 109 of file xp_ssl.c.

◆ GET_VER_OPT_LONG

#define GET_VER_OPT_LONG ( _name,
_num )
Value:
if (GET_VER_OPT(_name)) _num = zval_get_long(val)
#define GET_VER_OPT(_name)
Definition xp_ssl.c:109

Definition at line 126 of file xp_ssl.c.

◆ GET_VER_OPT_STRING

#define GET_VER_OPT_STRING ( _name,
_str )
Value:
do { \
if (GET_VER_OPT(_name)) { \
if (try_convert_to_string(val)) _str = Z_STRVAL_P(val); \
} \
} while (0)
#define Z_STRVAL_P(zval_p)
Definition zend_types.h:975

Definition at line 111 of file xp_ssl.c.

◆ GET_VER_OPT_STRINGL

#define GET_VER_OPT_STRINGL ( _name,
_str,
_len )
Value:
do { \
if (GET_VER_OPT(_name)) { \
if (try_convert_to_string(val)) { \
_str = Z_STRVAL_P(val); \
_len = Z_STRLEN_P(val); \
} \
} \
} while (0)
#define Z_STRLEN_P(zval_p)
Definition zend_types.h:978

Definition at line 117 of file xp_ssl.c.

◆ HAVE_ECDH

#define HAVE_ECDH   1

Definition at line 84 of file xp_ssl.c.

◆ HAVE_SEC_LEVEL

#define HAVE_SEC_LEVEL   1

Definition at line 93 of file xp_ssl.c.

◆ HAVE_SSL3

#define HAVE_SSL3   1

Definition at line 97 of file xp_ssl.c.

◆ HAVE_TLS1

#define HAVE_TLS1   1

Definition at line 68 of file xp_ssl.c.

◆ HAVE_TLS11

#define HAVE_TLS11   1

Definition at line 72 of file xp_ssl.c.

◆ HAVE_TLS12

#define HAVE_TLS12   1

Definition at line 76 of file xp_ssl.c.

◆ HAVE_TLS13

#define HAVE_TLS13   1

Definition at line 80 of file xp_ssl.c.

◆ HAVE_TLS_ALPN

#define HAVE_TLS_ALPN   1

Definition at line 89 of file xp_ssl.c.

◆ HAVE_TLS_SNI

#define HAVE_TLS_SNI   1

Definition at line 88 of file xp_ssl.c.

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   0

Definition at line 51 of file xp_ssl.c.

◆ PHP_OPENSSL_MAX_PROTO_VERSION

#define PHP_OPENSSL_MAX_PROTO_VERSION   STREAM_CRYPTO_METHOD_TLSv1_3

Definition at line 103 of file xp_ssl.c.

◆ PHP_OPENSSL_MIN_PROTO_VERSION

#define PHP_OPENSSL_MIN_PROTO_VERSION   STREAM_CRYPTO_METHOD_SSLv3

Definition at line 98 of file xp_ssl.c.

◆ PHP_X509_NAME_ENTRY_TO_UTF8

#define PHP_X509_NAME_ENTRY_TO_UTF8 ( ne,
i,
out )
Value:
ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i)))
out($f, $s)

Definition at line 130 of file xp_ssl.c.

◆ SERVER_GOOGLE

#define SERVER_GOOGLE   "Server: GFE/"

◆ SERVER_MICROSOFT_IIS

#define SERVER_MICROSOFT_IIS   "Server: Microsoft-IIS"

◆ STREAM_CRYPTO_IS_CLIENT

#define STREAM_CRYPTO_IS_CLIENT   (1<<0)

Definition at line 59 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_SSLv2

#define STREAM_CRYPTO_METHOD_SSLv2   (1<<1)

Definition at line 60 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_SSLv3

#define STREAM_CRYPTO_METHOD_SSLv3   (1<<2)

Definition at line 61 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_TLSv1_0

#define STREAM_CRYPTO_METHOD_TLSv1_0   (1<<3)

Definition at line 62 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_TLSv1_1

#define STREAM_CRYPTO_METHOD_TLSv1_1   (1<<4)

Definition at line 63 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_TLSv1_2

#define STREAM_CRYPTO_METHOD_TLSv1_2   (1<<5)

Definition at line 64 of file xp_ssl.c.

◆ STREAM_CRYPTO_METHOD_TLSv1_3

#define STREAM_CRYPTO_METHOD_TLSv1_3   (1<<6)

Definition at line 65 of file xp_ssl.c.

Typedef Documentation

◆ php_openssl_alpn_ctx

◆ php_openssl_handshake_bucket_t

◆ php_openssl_netstream_data_t

◆ php_openssl_sni_cert_t

Function Documentation

◆ php_openssl_get_ssl_stream_data_index()

int php_openssl_get_ssl_stream_data_index ( void )
extern

Definition at line 618 of file openssl.c.

◆ php_openssl_get_stream_from_ssl_handle()

php_stream * php_openssl_get_stream_from_ssl_handle ( const SSL * ssl)
extern

Definition at line 613 of file openssl.c.

◆ php_openssl_ssl_socket_factory()

php_stream * php_openssl_ssl_socket_factory ( const char * proto,
size_t protolen,
const char * resourcename,
size_t resourcenamelen,
const char * persistent_id,
int options,
int flags,
struct timeval * timeout,
php_stream_context *context STREAMS_DC )

Definition at line 2770 of file xp_ssl.c.

◆ php_openssl_x509_fingerprint()

zend_string * php_openssl_x509_fingerprint ( X509 * peer,
const char * method,
bool raw )
extern

Definition at line 1896 of file openssl.c.