memcpy(iv_s, iv, iv_size);
}
} else if (argc == 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to use an empty IV, which is NOT recommend");
- iv_s = emalloc(iv_size + 1);
- memset(iv_s, 0, iv_size + 1);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Encryption mode requires an initialization vector");
+ efree(key_s);
+ RETURN_FALSE;
}
}
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);
+var_dump(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT));
--EXPECTF--
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
+Warning: mcrypt_cbc(): Encryption mode requires an initialization vector in %s on line %d
+bool(false)
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);
+var_dump(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT));
--EXPECTF--
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
-Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
+Warning: mcrypt_cfb(): Encryption mode requires an initialization vector in %s on line %d
+bool(false)
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(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);
+var_dump(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv));
--EXPECTF--
PHP Testfest 2008
-Warning: mcrypt_decrypt(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
+Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector in %s on line %d
+bool(false)
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-bool(false)
\ No newline at end of file
+bool(false)