@@ -1239,9 +1239,13 @@ PHP_METHOD(Phar, getSupportedSignatures)
1239
1239
add_next_index_stringl (return_value , "SHA-512" , 7 );
1240
1240
#ifdef PHAR_HAVE_OPENSSL
1241
1241
add_next_index_stringl (return_value , "OpenSSL" , 7 );
1242
+ add_next_index_stringl (return_value , "OpenSSL_SHA256" , 14 );
1243
+ add_next_index_stringl (return_value , "OpenSSL_SHA512" , 14 );
1242
1244
#else
1243
1245
if (zend_hash_str_exists (& module_registry , "openssl" , sizeof ("openssl" )- 1 )) {
1244
1246
add_next_index_stringl (return_value , "OpenSSL" , 7 );
1247
+ add_next_index_stringl (return_value , "OpenSSL_SHA256" , 14 );
1248
+ add_next_index_stringl (return_value , "OpenSSL_SHA512" , 14 );
1245
1249
}
1246
1250
#endif
1247
1251
}
@@ -3003,6 +3007,8 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
3003
3007
case PHAR_SIG_MD5 :
3004
3008
case PHAR_SIG_SHA1 :
3005
3009
case PHAR_SIG_OPENSSL :
3010
+ case PHAR_SIG_OPENSSL_SHA256 :
3011
+ case PHAR_SIG_OPENSSL_SHA512 :
3006
3012
if (phar_obj -> archive -> is_persistent && FAILURE == phar_copy_on_write (& (phar_obj -> archive ))) {
3007
3013
zend_throw_exception_ex (phar_ce_PharException , 0 , "phar \"%s\" is persistent, unable to copy on write" , phar_obj -> archive -> fname );
3008
3014
RETURN_THROWS ();
@@ -3041,19 +3047,25 @@ PHP_METHOD(Phar, getSignature)
3041
3047
add_assoc_stringl (return_value , "hash" , phar_obj -> archive -> signature , phar_obj -> archive -> sig_len );
3042
3048
switch (phar_obj -> archive -> sig_flags ) {
3043
3049
case PHAR_SIG_MD5 :
3044
- add_assoc_stringl (return_value , "hash_type" , "MD5" , 3 );
3050
+ add_assoc_string (return_value , "hash_type" , "MD5" );
3045
3051
break ;
3046
3052
case PHAR_SIG_SHA1 :
3047
- add_assoc_stringl (return_value , "hash_type" , "SHA-1" , 5 );
3053
+ add_assoc_string (return_value , "hash_type" , "SHA-1" );
3048
3054
break ;
3049
3055
case PHAR_SIG_SHA256 :
3050
- add_assoc_stringl (return_value , "hash_type" , "SHA-256" , 7 );
3056
+ add_assoc_string (return_value , "hash_type" , "SHA-256" );
3051
3057
break ;
3052
3058
case PHAR_SIG_SHA512 :
3053
- add_assoc_stringl (return_value , "hash_type" , "SHA-512" , 7 );
3059
+ add_assoc_string (return_value , "hash_type" , "SHA-512" );
3054
3060
break ;
3055
3061
case PHAR_SIG_OPENSSL :
3056
- add_assoc_stringl (return_value , "hash_type" , "OpenSSL" , 7 );
3062
+ add_assoc_string (return_value , "hash_type" , "OpenSSL" );
3063
+ break ;
3064
+ case PHAR_SIG_OPENSSL_SHA256 :
3065
+ add_assoc_string (return_value , "hash_type" , "OpenSSL_SHA256" );
3066
+ break ;
3067
+ case PHAR_SIG_OPENSSL_SHA512 :
3068
+ add_assoc_string (return_value , "hash_type" , "OpenSSL_SHA512" );
3057
3069
break ;
3058
3070
default :
3059
3071
unknown = strpprintf (0 , "Unknown (%u)" , phar_obj -> archive -> sig_flags );
@@ -5064,6 +5076,8 @@ void phar_object_init(void) /* {{{ */
5064
5076
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "PHPS" , PHAR_MIME_PHPS )
5065
5077
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "MD5" , PHAR_SIG_MD5 )
5066
5078
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "OPENSSL" , PHAR_SIG_OPENSSL )
5079
+ REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "OPENSSL_SHA256" , PHAR_SIG_OPENSSL_SHA256 )
5080
+ REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "OPENSSL_SHA512" , PHAR_SIG_OPENSSL_SHA512 )
5067
5081
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "SHA1" , PHAR_SIG_SHA1 )
5068
5082
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "SHA256" , PHAR_SIG_SHA256 )
5069
5083
REGISTER_PHAR_CLASS_CONST_LONG (phar_ce_archive , "SHA512" , PHAR_SIG_SHA512 )
0 commit comments