diff options
Diffstat (limited to 'ext/mcrypt/mcrypt.c')
| -rw-r--r-- | ext/mcrypt/mcrypt.c | 118 | 
1 files changed, 59 insertions, 59 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index d33cdd5972..7b5823ec41 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -330,7 +330,7 @@ typedef enum {   */  #define MCRYPT_GET_CRYPT_ARGS										\ -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssz|s", 	\ +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "sssz|s", 	\  		&cipher, &cipher_len, &key, &key_len, &data, &data_len, &mode, &iv, &iv_len) == FAILURE) {	\  		return;		\  	} @@ -338,7 +338,7 @@ typedef enum {  #define MCRYPT_GET_TD_ARG										\  	zval *mcryptind;											\  	php_mcrypt *pm;													\ -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &mcryptind) == FAILURE) {			\ +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &mcryptind) == FAILURE) {			\  		return;																\  	}																						\  	ZEND_FETCH_RESOURCE (pm, php_mcrypt *, mcryptind, -1, "MCrypt", le_mcrypt);				 @@ -348,7 +348,7 @@ typedef enum {  	size_t   dir_len;                                                      \  	char *module;                                                       \  	size_t   module_len;                                                   \ -	if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC,               \ +	if (zend_parse_parameters (ZEND_NUM_ARGS(),               \  		"s|s", &module, &module_len, &dir, &dir_len) == FAILURE) {      \  		return;                                                         \  	} @@ -360,7 +360,7 @@ typedef enum {  #define PHP_MCRYPT_INIT_CHECK	\  	if (!pm->init) {	\ -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Operation disallowed prior to mcrypt_generic_init().");	\ +		php_error_docref(NULL, E_WARNING, "Operation disallowed prior to mcrypt_generic_init().");	\  		RETURN_FALSE;	\  	}	\ @@ -369,7 +369,7 @@ PHP_INI_BEGIN()  	STD_PHP_INI_ENTRY("mcrypt.modes_dir",      NULL, PHP_INI_ALL, OnUpdateString, modes_dir, zend_mcrypt_globals, mcrypt_globals)  PHP_INI_END() -static void php_mcrypt_module_dtor(zend_resource *rsrc TSRMLS_DC) /* {{{ */ +static void php_mcrypt_module_dtor(zend_resource *rsrc) /* {{{ */  {  	php_mcrypt *pm = (php_mcrypt *) rsrc->ptr;  	if (pm) {	 @@ -435,8 +435,8 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */  	MCRYPT_ENTRY2_2_4(MODE_STREAM, "stream");  	REGISTER_INI_ENTRIES(); -	php_stream_filter_register_factory("mcrypt.*", &php_mcrypt_filter_factory TSRMLS_CC); -	php_stream_filter_register_factory("mdecrypt.*", &php_mcrypt_filter_factory TSRMLS_CC); +	php_stream_filter_register_factory("mcrypt.*", &php_mcrypt_filter_factory); +	php_stream_filter_register_factory("mdecrypt.*", &php_mcrypt_filter_factory);  	return SUCCESS;  } @@ -444,8 +444,8 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */  static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */  { -	php_stream_filter_unregister_factory("mcrypt.*" TSRMLS_CC); -	php_stream_filter_unregister_factory("mdecrypt.*" TSRMLS_CC); +	php_stream_filter_unregister_factory("mcrypt.*"); +	php_stream_filter_unregister_factory("mdecrypt.*");  	UNREGISTER_INI_ENTRIES();  	return SUCCESS; @@ -513,7 +513,7 @@ PHP_FUNCTION(mcrypt_module_open)  	MCRYPT td;  	php_mcrypt *pm; -	if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss", +	if (zend_parse_parameters (ZEND_NUM_ARGS(), "ssss",  		&cipher, &cipher_len, &cipher_dir, &cipher_dir_len,  		&mode,   &mode_len,   &mode_dir,   &mode_dir_len)) {  		return; @@ -527,7 +527,7 @@ PHP_FUNCTION(mcrypt_module_open)  	);  	if (td == MCRYPT_FAILED) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open encryption module"); +		php_error_docref(NULL, E_WARNING, "Could not open encryption module");  		RETURN_FALSE;  	} else {  		pm = emalloc(sizeof(php_mcrypt)); @@ -550,7 +550,7 @@ PHP_FUNCTION(mcrypt_generic_init)  	php_mcrypt *pm;  	int result = 0; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &mcryptind, &key, &key_len, &iv, &iv_len) == FAILURE) { +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &mcryptind, &key, &key_len, &iv, &iv_len) == FAILURE) {  		return;  	} @@ -560,7 +560,7 @@ PHP_FUNCTION(mcrypt_generic_init)  	iv_size = mcrypt_enc_get_iv_size(pm->td);  	if (key_len == 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size is 0"); +		php_error_docref(NULL, E_WARNING, "Key size is 0");  	}  	key_s = emalloc(key_len); @@ -570,7 +570,7 @@ PHP_FUNCTION(mcrypt_generic_init)  	memset(iv_s, 0, iv_size + 1);  	if (key_len > max_key_size) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size); +		php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size);  		key_size = max_key_size;  	} else {  		key_size = (int)key_len; @@ -578,7 +578,7 @@ PHP_FUNCTION(mcrypt_generic_init)  	memcpy(key_s, key, key_len);  	if (iv_len != iv_size) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size); +		php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size);  		if (iv_len > iv_size) {  			iv_len = iv_size;  		} @@ -594,14 +594,14 @@ PHP_FUNCTION(mcrypt_generic_init)  		zend_list_close(Z_RES_P(mcryptind));  		switch (result) {  			case -3: -				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key length incorrect"); +				php_error_docref(NULL, E_WARNING, "Key length incorrect");  				break;  			case -4: -				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Memory allocation error"); +				php_error_docref(NULL, E_WARNING, "Memory allocation error");  				break;  			case -1:  			default: -				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error"); +				php_error_docref(NULL, E_WARNING, "Unknown error");  				break;  		}  	} else { @@ -625,7 +625,7 @@ PHP_FUNCTION(mcrypt_generic)  	char* data_s;  	int block_size, data_size; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &mcryptind, &data, &data_len) == FAILURE) { +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &mcryptind, &data, &data_len) == FAILURE) {  		return;  	} @@ -633,7 +633,7 @@ PHP_FUNCTION(mcrypt_generic)  	PHP_MCRYPT_INIT_CHECK  	if (data_len == 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "An empty string was passed"); +		php_error_docref(NULL, E_WARNING, "An empty string was passed");  		RETURN_FALSE  	} @@ -670,7 +670,7 @@ PHP_FUNCTION(mdecrypt_generic)  	char* data_s;  	int block_size, data_size; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &mcryptind, &data, &data_len) == FAILURE) { +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &mcryptind, &data, &data_len) == FAILURE) {  		return;  	} @@ -678,7 +678,7 @@ PHP_FUNCTION(mdecrypt_generic)  	PHP_MCRYPT_INIT_CHECK  	if (data_len == 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "An empty string was passed"); +		php_error_docref(NULL, E_WARNING, "An empty string was passed");  		RETURN_FALSE  	} @@ -749,7 +749,7 @@ PHP_FUNCTION(mcrypt_generic_deinit)  	MCRYPT_GET_TD_ARG  	if (mcrypt_generic_deinit(pm->td) < 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not terminate encryption specifier"); +		php_error_docref(NULL, E_WARNING, "Could not terminate encryption specifier");  		RETURN_FALSE  	}  	pm->init = 0; @@ -956,7 +956,7 @@ PHP_FUNCTION(mcrypt_list_algorithms)  	size_t   lib_dir_len;  	int   i, count; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",  		&lib_dir, &lib_dir_len) == FAILURE) {  		return;  	} @@ -965,7 +965,7 @@ PHP_FUNCTION(mcrypt_list_algorithms)  	modules = mcrypt_list_algorithms(lib_dir, &count);  	if (count == 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "No algorithms found in module dir"); +		php_error_docref(NULL, E_WARNING, "No algorithms found in module dir");  	}  	for (i = 0; i < count; i++) {  		add_index_string(return_value, i, modules[i]); @@ -983,7 +983,7 @@ PHP_FUNCTION(mcrypt_list_modes)  	size_t   lib_dir_len;  	int   i, count; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",  		&lib_dir, &lib_dir_len) == FAILURE) {  		return;  	} @@ -992,7 +992,7 @@ PHP_FUNCTION(mcrypt_list_modes)  	modules = mcrypt_list_modes(lib_dir, &count);  	if (count == 0) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "No modes found in module dir"); +		php_error_docref(NULL, E_WARNING, "No modes found in module dir");  	}  	for (i = 0; i < count; i++) {  		add_index_string(return_value, i, modules[i]); @@ -1014,7 +1014,7 @@ PHP_FUNCTION(mcrypt_get_key_size)  	MCRYPT_GET_INI -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",  		&cipher, &cipher_len, &module, &module_len) == FAILURE) {  		return;  	} @@ -1024,7 +1024,7 @@ PHP_FUNCTION(mcrypt_get_key_size)  		RETVAL_LONG(mcrypt_enc_get_key_size(td));  		mcrypt_module_close(td);  	} else { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); +		php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);  		RETURN_FALSE;  	}  } @@ -1043,7 +1043,7 @@ PHP_FUNCTION(mcrypt_get_block_size)  	MCRYPT_GET_INI -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",  		&cipher, &cipher_len, &module, &module_len) == FAILURE) {  		return;  	} @@ -1053,7 +1053,7 @@ PHP_FUNCTION(mcrypt_get_block_size)  		RETVAL_LONG(mcrypt_enc_get_block_size(td));  		mcrypt_module_close(td);  	} else { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); +		php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);  		RETURN_FALSE;  	}  } @@ -1072,7 +1072,7 @@ PHP_FUNCTION(mcrypt_get_iv_size)  	MCRYPT_GET_INI -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",  		&cipher, &cipher_len, &module, &module_len) == FAILURE) {  		return;  	} @@ -1082,7 +1082,7 @@ PHP_FUNCTION(mcrypt_get_iv_size)  		RETVAL_LONG(mcrypt_enc_get_iv_size(td));  		mcrypt_module_close(td);  	} else { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); +		php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);  		RETURN_FALSE;  	}  } @@ -1101,7 +1101,7 @@ PHP_FUNCTION(mcrypt_get_cipher_name)  	MCRYPT_GET_INI -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",  		&cipher, &cipher_len) == FAILURE) {  		return;  	} @@ -1122,7 +1122,7 @@ PHP_FUNCTION(mcrypt_get_cipher_name)  			RETVAL_STRING(cipher_name);  			mcrypt_free(cipher_name);  		} else { -			php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); +			php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);  			RETURN_FALSE;  		}  	} @@ -1190,7 +1190,7 @@ static zend_bool php_mcrypt_is_valid_key_size(  }  /* }}} */ -static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size TSRMLS_DC) /* {{{ */ +static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size) /* {{{ */  {  	int key_size_count;  	int max_key_size = mcrypt_enc_get_key_size(td); @@ -1203,7 +1203,7 @@ static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size TSRMLS_DC) /  		char *key_size_str = php_mcrypt_get_key_size_str(  			max_key_size, key_sizes, key_size_count  		); -		php_error_docref(NULL TSRMLS_CC, E_WARNING, +		php_error_docref(NULL, E_WARNING,  			"Key of size %d not supported by this algorithm. %s", key_size, key_size_str  		);  		efree(key_size_str); @@ -1217,20 +1217,20 @@ static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size TSRMLS_DC) /  }  /* }}} */ -static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSRMLS_DC) /* {{{ */ +static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size) /* {{{ */  {  	if (mcrypt_enc_mode_has_iv(td) == 1) {  		int expected_iv_size = mcrypt_enc_get_iv_size(td);  		if (!iv) { -			php_error_docref(NULL TSRMLS_CC, E_WARNING, +			php_error_docref(NULL, E_WARNING,  				"Encryption mode requires an initialization vector of size %d", expected_iv_size  			);  			return FAILURE;  		}  		if (iv_size != expected_iv_size) { -			php_error_docref(NULL TSRMLS_CC, E_WARNING, +			php_error_docref(NULL, E_WARNING,  				"Received initialization vector of size %d, but size %d is required "  				"for this encryption mode", iv_size, expected_iv_size  			); @@ -1242,7 +1242,7 @@ static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSR  }  /* }}} */ -static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, const char *data, size_t data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value TSRMLS_DC) /* {{{ */ +static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, const char *data, size_t data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value) /* {{{ */  {  	char *cipher_dir_string;  	char *module_dir_string; @@ -1254,16 +1254,16 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, c  	td = mcrypt_module_open(cipher, cipher_dir_string, mode, module_dir_string);  	if (td == MCRYPT_FAILED) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); +		php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);  		RETURN_FALSE;  	} -	if (php_mcrypt_ensure_valid_key_size(td, (int)key_len TSRMLS_CC) == FAILURE) { +	if (php_mcrypt_ensure_valid_key_size(td, (int)key_len) == FAILURE) {  		mcrypt_module_close(td);  		RETURN_FALSE;  	} -	if (php_mcrypt_ensure_valid_iv(td, iv, (int)iv_len TSRMLS_CC) == FAILURE) { +	if (php_mcrypt_ensure_valid_iv(td, iv, (int)iv_len) == FAILURE) {  		mcrypt_module_close(td);  		RETURN_FALSE;  	} @@ -1282,7 +1282,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, c  	}  	if (mcrypt_generic_init(td, (void *) key, (int)key_len, (void *) iv) < 0) { -		php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed"); +		php_error_docref(NULL, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");  		mcrypt_module_close(td);  		RETURN_FALSE;  	} @@ -1310,12 +1310,12 @@ PHP_FUNCTION(mcrypt_encrypt)  	char *cipher, *key, *data, *mode, *iv = NULL;  	size_t cipher_len, key_len, data_len, mode_len, iv_len = 0; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len, +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss|s", &cipher, &cipher_len,  		&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {  		return;  	} -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_ENCRYPT, return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_ENCRYPT, return_value);  }  /* }}} */ @@ -1326,12 +1326,12 @@ PHP_FUNCTION(mcrypt_decrypt)  	char *cipher, *key, *data, *mode, *iv = NULL;  	size_t cipher_len, key_len, data_len, mode_len, iv_len = 0; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len, +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss|s", &cipher, &cipher_len,  		&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {  		return;  	} -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_DECRYPT, return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_DECRYPT, return_value);  }  /* }}} */ @@ -1347,7 +1347,7 @@ PHP_FUNCTION(mcrypt_ecb)  	convert_to_long_ex(mode); -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value);  }  /* }}} */ @@ -1363,7 +1363,7 @@ PHP_FUNCTION(mcrypt_cbc)  	convert_to_long_ex(mode); -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value);  }  /* }}} */ @@ -1379,7 +1379,7 @@ PHP_FUNCTION(mcrypt_cfb)  	convert_to_long_ex(mode); -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value);  }  /* }}} */ @@ -1395,7 +1395,7 @@ PHP_FUNCTION(mcrypt_ofb)  	convert_to_long_ex(mode); -	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); +	php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value);  }  /* }}} */ @@ -1408,12 +1408,12 @@ PHP_FUNCTION(mcrypt_create_iv)  	zend_long size;  	int n = 0; -	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) { +	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &size, &source) == FAILURE) {  		return;  	}  	if (size <= 0 || size >= INT_MAX) { -		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create an IV with a size of less than 1 or greater than %d", INT_MAX); +		php_error_docref(NULL, E_WARNING, "Cannot create an IV with a size of less than 1 or greater than %d", INT_MAX);  		RETURN_FALSE;  	} @@ -1425,7 +1425,7 @@ PHP_FUNCTION(mcrypt_create_iv)  		BYTE *iv_b = (BYTE *) iv;  		if (php_win32_get_random_bytes(iv_b, (size_t) size) == FAILURE){  			efree(iv); -			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data"); +			php_error_docref(NULL, E_WARNING, "Could not gather sufficient random data");  			RETURN_FALSE;  		}  		n = (int)size; @@ -1436,7 +1436,7 @@ PHP_FUNCTION(mcrypt_create_iv)  		fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY);  		if (fd < 0) {  			efree(iv); -			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open source device"); +			php_error_docref(NULL, E_WARNING, "Cannot open source device");  			RETURN_FALSE;  		}  		while (read_bytes < size) { @@ -1450,14 +1450,14 @@ PHP_FUNCTION(mcrypt_create_iv)  		close(fd);  		if (n < size) {  			efree(iv); -			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data"); +			php_error_docref(NULL, E_WARNING, "Could not gather sufficient random data");  			RETURN_FALSE;  		}  #endif  	} else {  		n = (int)size;  		while (size) { -			iv[--size] = (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX); +			iv[--size] = (char) (255.0 * php_rand() / RAND_MAX);  		}  	}  	RETVAL_STRINGL(iv, n);  | 
