]> granicus.if.org Git - php/commitdiff
add get_(key|block)_size
authorSascha Schumann <sas@php.net>
Sun, 25 Apr 1999 20:32:15 +0000 (20:32 +0000)
committerSascha Schumann <sas@php.net>
Sun, 25 Apr 1999 20:32:15 +0000 (20:32 +0000)
ext/mcrypt/mcrypt.c
ext/mcrypt/php_mcrypt.h

index 7ee2564720abedb2211458ba5cbcb85cc7c2d405..821060baa3eb4f6f782426d6416345cd489e5302 100644 (file)
@@ -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)
index 46cdb3dd7edf74dd5ed0952a0c676f7f4d1bbd5e..6c59f4db4b00364246b8bb82f846152d478f9252 100644 (file)
@@ -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