php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8040 MCRYPT_MODE_ does not seem to exist
Submitted: 2000-11-29 19:40 UTC Modified: 2000-12-15 10:53 UTC
From: barton at applitec dot com Assigned: derick (profile)
Status: Closed Package: mcrypt related
PHP Version: 4.0.2 OS: linux RedHat 7.0
Private report: No CVE-ID: None
 [2000-11-29 19:40 UTC] barton at applitec dot com
I have mcrypt libmcrypt 2.4.7. 
Following simple script:

define("CIPHER", MCRYPT_TWOFISH);
define("MODE1", MCRYPT_MODE_CBC);
define("MODE2", MCRYPT_CBC);

print("cipher=". CIPHER . " mode1=" . MODE1 . "mode2=" . MODE2 . "<br>\n");

What prints is "cipher=twofish mode1=MCRYPT_MODE_CBC MODE2=MCRYPT_CBC"

The mcrypt.h file has #define MCRYPT_CBC "cbc"
so I don't understand?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-30 06:34 UTC] derick@php.net
The following is defined in the code (PHP wrapper):

#if HAVE_LIBMCRYPT24
    MCRYPT_ENTRY2_2_4(ARCFOUR_IV, "arcfour-iv");
    MCRYPT_ENTRY2_2_4(ARCFOUR, "arcfour");
    MCRYPT_ENTRY2_2_4(BLOWFISH, "blowfish");
...
    MCRYPT_ENTRY2_2_4(MODE_CBC, "cbc");
    MCRYPT_ENTRY2_2_4(MODE_CFB, "cfb");
    MCRYPT_ENTRY2_2_4(MODE_ECB, "ecb");
    MCRYPT_ENTRY2_2_4(MODE_NOFB, "nofb");
    MCRYPT_ENTRY2_2_4(MODE_OFB, "ofb");
    MCRYPT_ENTRY2_2_4(MODE_STREAM, "stream");
    REGISTER_INI_ENTRIES();
#endif

So if MCRYPT_BLOWFISH works, then MCRYPT_MODE_CBC should work too.
I'm going to check this out later.
 [2000-12-15 10:53 UTC] derick@php.net
The following code snippet:

<?php
    echo MCRYPT_TWOFISH."<BR>\n";
    echo MCRYPT_MODE_CBC."<BR>\n";
?>

<?php
    define ("MODE1", MCRYPT_MODE_CBC);
    echo MODE1."<BR>\n";
?>

<?php
    define ("CIPHER", MCRYPT_TWOFISH);
    define ("MODE1", MCRYPT_MODE_CBC);
    define ("MODE2", MCRYPT_CBC);

    printf ("cipher=".CIPHER. " mode1=".MODE1. " mode2=". MODE2."<BR>\n");
?>

procudes this:

   twofish
   cbc
   cbc
   cipher=twofish mode1=cbc mode2=MCRYPT_CBC

Which is expected. From source code analyses it is not even possible that MCRYPT_TWOFISH is defined, but MCRYPT_MODE_CBC is not.

So closing
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 15 10:01:26 2020 UTC