Skip to content

Commit da60849

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Add missing X509 purpose constants
2 parents 66ecee6 + 1e53e14 commit da60849

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ext/openssl/openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,9 +1175,9 @@ PHP_MINIT_FUNCTION(openssl)
11751175
REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT);
11761176
REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT);
11771177
REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT);
1178-
#ifdef X509_PURPOSE_ANY
11791178
REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT);
1180-
#endif
1179+
REGISTER_LONG_CONSTANT("X509_PURPOSE_OCSP_HELPER", X509_PURPOSE_OCSP_HELPER, CONST_CS|CONST_PERSISTENT);
1180+
REGISTER_LONG_CONSTANT("X509_PURPOSE_TIMESTAMP_SIGN", X509_PURPOSE_TIMESTAMP_SIGN, CONST_CS|CONST_PERSISTENT);
11811181

11821182
/* digest algorithm constants */
11831183
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT);

ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN));
3737
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT));
3838
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN));
3939
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY));
40+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER));
41+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN));
4042

4143
/* int openssl_x509_checkpurpose ( mixed $x509cert , int $purpose [, array $cainfo = array() ] ); */
4244
var_dump(openssl_x509_checkpurpose($cert, X509_PURPOSE_SSL_CLIENT, array($cpca)));
@@ -60,6 +62,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN, array($cpca))
6062
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT, array($cpca)));
6163
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN, array($cpca)));
6264
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY, array($cpca)));
65+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER, array($cpca)));
66+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN, array($cpca)));
6367

6468
/* int openssl_x509_checkpurpose ( mixed $x509cert , int $purpose [, array $cainfo = array() [, string $untrustedfile ]] ); function */
6569
var_dump(openssl_x509_checkpurpose($cert, X509_PURPOSE_SSL_CLIENT, array($cpca), $utfl));
@@ -83,6 +87,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN, array($cpca),
8387
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT, array($cpca), $utfl));
8488
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN, array($cpca), $utfl));
8589
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY, array($cpca), $utfl));
90+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER, array($cpca), $utfl));
91+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN, array($cpca), $utfl));
8692
?>
8793
--EXPECT--
8894
bool(false)
@@ -113,6 +119,8 @@ bool(false)
113119
bool(false)
114120
bool(false)
115121
bool(false)
122+
bool(false)
123+
bool(false)
116124
int(-1)
117125
int(-1)
118126
int(-1)
@@ -127,6 +135,8 @@ bool(true)
127135
bool(true)
128136
bool(true)
129137
bool(true)
138+
bool(true)
139+
bool(false)
130140
bool(false)
131141
bool(false)
132142
bool(false)
@@ -148,3 +158,5 @@ bool(true)
148158
bool(true)
149159
bool(true)
150160
bool(true)
161+
bool(true)
162+
bool(false)

0 commit comments

Comments
 (0)