#48371 [Opn->Asn]: Documentation for: mcrypt_get_key_size()
| From: | kalle@php.net | Date: | Tue, 23 Jun 2009 15:51:10 +0000 |
| Subject: | #48371 [Opn->Asn]: Documentation for: mcrypt_get_key_size() | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2399@lists.php.net to get a copy of this message | ||
ID: 48371
Updated by: kalle@php.net
Reported By: alias301 at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
Assigned To: kalle
New Comment:
Thanks for your detailed comment, I didn't see it before now because I
was set as assigned but Ill look into it ;)
Previous Comments:
------------------------------------------------------------------------
[2009-05-28 01:46:40] alias301 at gmail dot com
The prototype says:
int mcrypt_get_key_size ( string $cipher , string $module )
where $module = 'ecb';
however the prototype:
resource mcrypt_module_open ( string $algorithm , string
$algorithm_directory , string $mode , string $mode_directory )
says $mode = 'ofb'; // which could also be 'ecb'
which means that the documentation is not connsistent shich can lead to
others believing (like me at first) that $module was the module resource
that had been opened with mcrypt_module_open() and part of documentation
is being conssistent, so I believe that it should be a prototype of: int
mcrypt_get_key_size ( string $cipher , string $mode ) so as to convey
the correct message to those who will use this documentation.
Also, to add to this I have checked with the source for the mcrypt
extension as in the code is shows this call:
td = mcrypt_module_open(cipher, cipher_dir_string, module,
module_dir_string);
So, I guess my question is why is it that the extension uses module
when clearly the documentation shows mode.
This clearly need to be fixed so that the function calls have matching
documentation.
----
Also, this clearly shows that in the C source that mcrypt_module_open()
does use that variable as mode *not* module
if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
&cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
&mode, &mode_len, &mode_dir, &mode_dir_len)) {
return;
}
Thank You
------------------------------------------------------------------------
[2009-05-25 18:21:38] kalle@php.net
Its $module as per its source, see php-src/ext/mcrypt/mcrypt.c, in the
PHP_FUNCTION(mcrypt_get_key_size) block.
The link have been fixed in CVS.
------------------------------------------------------------------------
[2009-05-24 02:48:20] alias301 at gmail dot com
Description:
------------
The documentation for mcrypt_get_key_size() says that it wants the
$module as the second parameter, but should be $mode
Also, were it says "Example #1 mcrypt_get_block_size() example" it
should be "Example #1 mcrypt_get_key_size() example"
See: http://us3.php.net/function.mcrypt_get_key_size
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48371&edit=1