diff options
author | Sascha Schumann <sas@php.net> | 1999-04-25 20:32:15 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 1999-04-25 20:32:15 +0000 |
commit | 7d1ee82d79d786fe63c6acdcbb4283928ec24c41 (patch) | |
tree | 3cb3d0ac7d6f590073e5944909a4933a108e6046 | |
parent | 10710c046d7f01cc19fcee6f36f5fe1c197da54e (diff) | |
download | php-git-7d1ee82d79d786fe63c6acdcbb4283928ec24c41.tar.gz |
add get_(key|block)_size
-rw-r--r-- | ext/mcrypt/mcrypt.c | 32 | ||||
-rw-r--r-- | ext/mcrypt/php_mcrypt.h | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 7ee2564720..821060baa3 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -38,6 +38,8 @@ function_entry mcrypt_functions[] = { PHP_FE(mcrypt_ecb, NULL) PHP_FE(mcrypt_cbc, NULL) + PHP_FE(mcrypt_get_block_size, NULL) + PHP_FE(mcrypt_get_key_size, NULL) {0}, }; @@ -85,6 +87,36 @@ static int php3_minit_mcrypt(INIT_FUNC_ARGS) return SUCCESS; } +/* proto mcrypt_get_key_size(int cipher) + get the key size of cipher */ +PHP_FUNCTION(mcrypt_get_key_size) +{ + pval *cipher; + + if(ARG_COUNT(ht) != 1 || getParameters(ht, 1, &cipher) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(cipher); + + RETURN_LONG(get_key_size(cipher->value.lval)); +} + +/* proto mcrypt_get_block_size(int cipher) + get the block size of cipher */ +PHP_FUNCTION(mcrypt_get_block_size) +{ + pval *cipher; + + if(ARG_COUNT(ht) != 1 || getParameters(ht, 1, &cipher) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(cipher); + + RETURN_LONG(get_block_size(cipher->value.lval)); +} + /* proto mcrypt_cbc(int cipher, string key, string data, int mode) CBC crypt/decrypt data using key key with cipher cipher */ PHP_FUNCTION(mcrypt_cbc) diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h index 46cdb3dd7e..6c59f4db4b 100644 --- a/ext/mcrypt/php_mcrypt.h +++ b/ext/mcrypt/php_mcrypt.h @@ -8,6 +8,8 @@ extern zend_module_entry mcrypt_module_entry; PHP_FUNCTION(mcrypt_ecb); PHP_FUNCTION(mcrypt_cbc); +PHP_FUNCTION(mcrypt_get_block_size); +PHP_FUNCTION(mcrypt_get_key_size); #else #define mcrypt_module_ptr NULL |