dsp             Sat May 17 23:27:43 2008 UTC

  Added files:                 
    /php-src/ext/mcrypt/tests   mcrypt_cbc.phpt mcrypt_cbf.phpt 
                                mcrypt_create_iv.phpt mcrypt_decrypt.phpt 
                                mcrypt_ecb.phpt 
                                mcrypt_enc_get_algorithms_name.phpt 
                                mcrypt_enc_get_block_size.phpt 
                                mcrypt_enc_get_iv_size.phpt 
                                mcrypt_enc_get_key_size.phpt 
                                mcrypt_enc_get_mode_name.phpt 
                                mcrypt_enc_get_supported_key_sizes.phpt 
                                mcrypt_enc_is_block_algorithm.phpt 
                                mcrypt_enc_is_block_algorithm_mode.phpt 
                                mcrypt_enc_is_block_mode.phpt 
                                mcrypt_enc_self_test.phpt 
                                mcrypt_get_block_size.phpt 
                                mcrypt_get_cipher_name.phpt 
                                mcrypt_get_iv_size.phpt 
                                mcrypt_get_key_size.phpt 
                                mcrypt_list_algorithms.phpt 
                                mcrypt_list_modes.phpt 
                                mcrypt_module_get_algo_block_size.phpt 
                                mcrypt_module_get_algo_key_size.phpt 
                                mcrypt_module_get_supported_key_sizes.phpt 
                                mcrypt_module_is_block_algorithm.phpt 
                                mcrypt_module_is_block_algorithm_mode.phpt 
                                mcrypt_module_is_block_mode.phpt 
                                mcrypt_module_open.phpt 
                                mcrypt_module_self_test.phpt 
                                mcrypt_ofb.phpt 
  Log:
  Tests from Munich PHP Testfest 2008
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_cbc.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_cbc.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_cbc.phpt
--TEST--
mcrypt_cbc
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
$key      = "FooBar";
$secret   = "PHP Testfest 2008";
$cipher   = MCRYPT_RIJNDAEL_128;

$iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), 
MCRYPT_RAND);
$enc_data = mcrypt_cbc($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);

// we have to trim as AES rounds the blocks and decrypt doesnt detect that
echo trim(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";

// a warning must be issued if we don't use a IV on a AES cipher, that usually 
requires an IV
mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT);

--EXPECTF--
PHP Testfest 2008

Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommended in 
%s on line %d

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_cbf.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_cbf.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_cbf.phpt
--TEST--
mcrypt_cbf
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
$key      = "FooBar";
$secret   = "PHP Testfest 2008";
$cipher   = MCRYPT_RIJNDAEL_128;

$iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), 
MCRYPT_RAND);
$enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);

// we have to trim as AES rounds the blocks and decrypt doesnt detect that
echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";

// a warning must be issued if we don't use a IV on a AES cipher, that usually 
requires an IV
mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT);

--EXPECTF--
PHP Testfest 2008

Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommended in 
%s on line %d

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_create_iv.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_create_iv.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_create_iv.phpt
--TEST--
mcrypt_create_iv
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$iv1 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, 
MCRYPT_MODE_ECB), MCRYPT_RAND);
$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_192, 
MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, 
MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);

echo strlen($iv1) . "\n";
echo strlen($iv2) . "\n";
echo strlen($iv3) . "\n";
--EXPECT--
16
24
32

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_decrypt.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_decrypt.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_decrypt.phpt
--TEST--
mcrypt_decrypt
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
$key      = "FooBar";
$secret   = "PHP Testfest 2008";
$mode     = MCRYPT_MODE_CBC;
$cipher   = MCRYPT_RIJNDAEL_128;

$iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, $mode), MCRYPT_RAND);
$enc_data = mcrypt_encrypt($cipher, $key, $secret, $mode, $iv);

// we have to trim as AES rounds the blocks and decrypt doesnt detect that
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, $mode, $iv)) . "\n";

// a warning must be issued if we don't use a IV on a AES cipher, that usually 
requires an IV
mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC);

var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, 
MCRYPT_MODE_CBC, $iv), "Testfest") !== false);
--EXPECTF--
PHP Testfest 2008

Warning: mcrypt_decrypt(): Attempt to use an empty IV, which is NOT recommended 
in %s on line %d

Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in 
%s on line %d
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_ecb.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_ecb.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_ecb.phpt
--TEST--
mcrypt_ecb
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
$key      = "FooBar";
$secret   = "PHP Testfest 2008";
$cipher   = MCRYPT_RIJNDAEL_128;

$iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), 
MCRYPT_RAND);
$enc_data = mcrypt_ecb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);

// we have to trim as AES rounds the blocks and decrypt doesnt detect that
echo trim(mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";

// a warning must be issued if we don't use a IV on a AES cipher, that usually 
requires an IV
mcrypt_ecb($cipher, $key, $enc_data, MCRYPT_DECRYPT);

--EXPECTF--
PHP Testfest 2008

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_algorithms_name.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_algorithms_name.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_algorithms_name.phpt
--TEST--
mcrypt_enc_get_algorithms_name
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td  = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_ECB, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_RC2, '', MCRYPT_MODE_CBC, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
$td  = mcrypt_module_open('des', '', 'ecb', '');
echo mcrypt_enc_get_algorithms_name($td) . "\n";
--EXPECT--
Rijndael-128
Rijndael-128
RC2
Blowfish
DES
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_block_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_block_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_block_size.phpt
--TEST--
mcrypt_enc_get_block_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_block_size($td));
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_block_size($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_get_block_size($td));
--EXPECT--
int(32)
int(8)
int(1)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_iv_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_iv_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_iv_size.phpt
--TEST--
mcrypt_enc_get_iv_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_iv_size($td));
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_iv_size($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_get_iv_size($td));
--EXPECT--
int(32)
int(8)
int(0)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_key_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_key_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_key_size.phpt
--TEST--
mcrypt_enc_get_key_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_key_size($td));
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_get_key_size($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_get_key_size($td));
--EXPECT--
int(32)
int(24)
int(32)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_mode_name.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_mode_name.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_mode_name.phpt
--TEST--
mcrypt_enc_get_modes_name
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td  = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_ECB, '');
echo mcrypt_enc_get_modes_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
echo mcrypt_enc_get_modes_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
echo mcrypt_enc_get_modes_name($td) . "\n";
$td  = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_OFB, '');
echo mcrypt_enc_get_modes_name($td) . "\n";
$td  = mcrypt_module_open('des', '', 'ecb', '');
echo mcrypt_enc_get_modes_name($td) . "\n";
$td  = mcrypt_module_open('des', '', 'cbc', '');
echo mcrypt_enc_get_modes_name($td) . "\n";
--EXPECT--
ECB
CBC
STREAM
OFB
ECB
CBC

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_get_supported_key_sizes.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_get_supported_key_sizes.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_get_supported_key_sizes.phpt
--TEST--
mcrypt_enc_get_supported_key_sizes
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td  = mcrypt_module_open('rijndael-256', '', 'ecb', '');
$var = mcrypt_enc_get_supported_key_sizes($td);
var_dump($var);
--EXPECT--
array(3) {
  [0]=>
  int(16)
  [1]=>
  int(24)
  [2]=>
  int(32)
}
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm.phpt
--TEST--
mcrypt_enc_is_block_algorithm
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_is_block_algorithm($td));
$td = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_is_block_algorithm($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_is_block_algorithm($td));
--EXPECT--
bool(true)
bool(true)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm_mode.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm_mode.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_is_block_algorithm_mode.phpt
--TEST--
mcrypt_enc_is_block_algorithm_mode
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '',  MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_is_block_algorithm_mode($td));
--EXPECT--
bool(true)
bool(true)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_is_block_mode.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_is_block_mode.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_is_block_mode.phpt
--TEST--
mcrypt_enc_is_block_mode
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_is_block_mode($td));
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, '');
var_dump(mcrypt_enc_is_block_mode($td));
$td = mcrypt_module_open(MCRYPT_ARCFOUR, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_is_block_mode($td));
$td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, '');
var_dump(mcrypt_enc_is_block_mode($td));
--EXPECT--
bool(true)
bool(true)
bool(false)
bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_enc_self_test.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_enc_self_test.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_enc_self_test.phpt
--TEST--
mcrypt_enc_self_test
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
var_dump(mcrypt_enc_self_test($td));
--EXPECT--
int(0)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_get_block_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_get_block_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_get_block_size.phpt
--TEST--
mcrypt_get_block_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_block_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_block_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
--EXPECT--
int(32)
int(8)
int(1)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_get_cipher_name.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_get_cipher_name.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_get_cipher_name.phpt
--TEST--
mcrypt_get_cipher_name
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
echo mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_256) . "\n";
echo mcrypt_get_cipher_name(MCRYPT_RC2) . "\n";
echo mcrypt_get_cipher_name(MCRYPT_ARCFOUR) . "\n";
echo mcrypt_get_cipher_name(MCRYPT_WAKE) . "\n";
--EXPECT--
Rijndael-256
RC2
RC4
WAKE

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_get_iv_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_get_iv_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_get_iv_size.phpt
--TEST--
mcrypt_enc_get_iv_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_iv_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
var_dump(mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_STREAM));
--EXPECTF--
int(32)
int(8)
int(0)

Warning: mcrypt_get_iv_size(): Module initialization failed in %s on line %d
bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_get_key_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_get_key_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_get_key_size.phpt
--TEST--
mcrypt_get_key_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_get_key_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_key_size(MCRYPT_3DES, MCRYPT_MODE_CBC));
var_dump(mcrypt_get_key_size(MCRYPT_WAKE, MCRYPT_MODE_STREAM));
--EXPECT--
int(32)
int(24)
int(32)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_list_algorithms.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_list_algorithms.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_list_algorithms.phpt
--TEST--
mcrypt_list_algorithms
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
foreach (mcrypt_list_algorithms() as $algo) {
        if (in_array($algo, array('rijndael-256', 'des', 'blowfish', 
'twofish'))) {
           echo "FOUND\n";
        }
}
--EXPECT--
FOUND
FOUND
FOUND
FOUND
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_list_modes.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_list_modes.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_list_modes.phpt
--TEST--
mcrypt_list_modes
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_list_modes());
--EXPECT--
array(8) {
  [0]=>
  string(3) "cbc"
  [1]=>
  string(3) "cfb"
  [2]=>
  string(3) "ctr"
  [3]=>
  string(3) "ecb"
  [4]=>
  string(4) "ncfb"
  [5]=>
  string(4) "nofb"
  [6]=>
  string(3) "ofb"
  [7]=>
  string(6) "stream"
}

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_get_algo_block_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_get_algo_block_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_get_algo_block_size.phpt
--TEST--
mcrypt_module_get_algo_block_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RIJNDAEL_256));
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RIJNDAEL_192));
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_RC2));
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_XTEA));
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_CAST_128));
var_dump(mcrypt_module_get_algo_block_size(MCRYPT_BLOWFISH));
--EXPECT--
int(32)
int(24)
int(8)
int(8)
int(8)
int(8)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_get_algo_key_size.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_get_algo_key_size.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_get_algo_key_size.phpt
--TEST--
mcrypt_module_get_algo_key_size
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RIJNDAEL_256));
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RIJNDAEL_192));
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_RC2));
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_XTEA));
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_CAST_128));
var_dump(mcrypt_module_get_algo_key_size(MCRYPT_BLOWFISH));
--EXPECT--
int(32)
int(32)
int(128)
int(16)
int(16)
int(56)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_get_supported_key_sizes.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_get_supported_key_sizes.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_get_supported_key_sizes.phpt
--TEST--
mcrypt_module_get_supported_key_sizes
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_get_supported_key_sizes(MCRYPT_RIJNDAEL_256));
var_dump(mcrypt_module_get_supported_key_sizes(MCRYPT_RC2));
--EXPECT--
array(3) {
  [0]=>
  int(16)
  [1]=>
  int(24)
  [2]=>
  int(32)
}
array(0) {
}
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm.phpt
--TEST--
mcrypt_module_is_block_algorithm
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_RIJNDAEL_128));
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_DES));
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_WAKE));
var_dump(mcrypt_module_is_block_algorithm(MCRYPT_XTEA));
--EXPECT--
bool(true)
bool(true)
bool(false)
bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm_mode.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm_mode.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_is_block_algorithm_mode.phpt
--TEST--
mcrypt_module_is_block_algorithm_mode
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_CBC));
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_ECB));
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_STREAM));
var_dump(mcrypt_module_is_block_algorithm_mode(MCRYPT_MODE_OFB));
--EXPECT--
bool(true)
bool(true)
bool(false)
bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_is_block_mode.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_is_block_mode.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_is_block_mode.phpt
--TEST--
mcrypt_module_is_block_mode
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_CBC));
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_ECB));
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_STREAM));
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_NOFB));
var_dump(mcrypt_module_is_block_mode(MCRYPT_MODE_OFB));
--EXPECT--
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_open.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_open.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_open.phpt
--TEST--
mcrypt_module_open
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''));
mcrypt_module_open('', '', '', '');

--EXPECTF--
resource(%d) of type (mcrypt)

Warning: mcrypt_module_open(): Could not open encryption module in %s on line %d


http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_module_self_test.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_module_self_test.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_module_self_test.phpt
--TEST--
mcrypt_module_self_test
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
var_dump(mcrypt_module_self_test(MCRYPT_RIJNDAEL_128));
var_dump(mcrypt_module_self_test(MCRYPT_RC2));
var_dump(mcrypt_module_self_test(''));
--EXPECT--
bool(true)
bool(true)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/mcrypt/tests/mcrypt_ofb.phpt?view=markup&rev=1.1
Index: php-src/ext/mcrypt/tests/mcrypt_ofb.phpt
+++ php-src/ext/mcrypt/tests/mcrypt_ofb.phpt
--TEST--
mcrypt_ofb
--SKIPIF--
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
--FILE--
<?php
$key      = "FooBar";
$secret   = "PHP Testfest 2008";
$cipher   = MCRYPT_RIJNDAEL_128;

$iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), 
MCRYPT_RAND);
$enc_data = mcrypt_ofb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);

// we have to trim as AES rounds the blocks and decrypt doesnt detect that
echo trim(mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";

// a warning must be issued if we don't use a IV on a AES cipher, that usually 
requires an IV
mcrypt_ofb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv);

--EXPECT--
PHP Testfest 2008

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to