package.xml 0000644 0001750 0001750 00000017142 14242662241 012467 0 ustar derick derick
mcryptpecl.php.netBindings for the libmcrypt libraryProvides bindings for the unmaintained libmcrypt.Derick Rethansderickderick@php.netnoSascha Schumannsassascha@schumann.cxnoLeighleighleigh@php.netyes2022-05-231.0.51.0.0stablestablePHP License
- Make release to advertise PHP 8 support, which it already had.
7.2.08.2.08.2.01.4.0mcrypt
mcrypt-1.0.5/tests/blowfish.phpt 0000644 0001750 0001750 00000023740 14242662241 016204 0 ustar derick derick --TEST--
Test for blowfish compatibility
--SKIPIF--
--FILE--
--EXPECTF--
key plain crypt guess stat
Deprecated: Function mcrypt_module_open() is deprecated in %s%eblowfish.php on line %d
0000000000000000 0000000000000000
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
4ef997456198dd78 4ef997456198dd78 OK
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
51866fd5b85ecb8a 51866fd5b85ecb8a OK
3000000000000000 1000000000000001
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
7d856f9a613063f2 7d856f9a613063f2 OK
1111111111111111 1111111111111111
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
2466dd878b963c9d 2466dd878b963c9d OK
0123456789ABCDEF 1111111111111111
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
61f9c3802281b096 61f9c3802281b096 OK
1111111111111111 0123456789ABCDEF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
7d0cc630afda1ec7 7d0cc630afda1ec7 OK
FEDCBA9876543210 0123456789ABCDEF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
0aceab0fc6a0a28d 0aceab0fc6a0a28d OK
7CA110454A1A6E57 01A1D6D039776742
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
59c68245eb05282b 59c68245eb05282b OK
0131D9619DC1376E 5CD54CA83DEF57DA
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
b1b8cc0b250f09a0 b1b8cc0b250f09a0 OK
07A1133E4A0B2686 0248D43806F67172
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
1730e5778bea1da4 1730e5778bea1da4 OK
3849674C2602319E 51454B582DDF440A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
a25e7856cf2651eb a25e7856cf2651eb OK
04B915BA43FEB5B6 42FD443059577FA2
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
353882b109ce8f1a 353882b109ce8f1a OK
0113B970FD34F2CE 059B5E0851CF143A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
48f4d0884c379918 48f4d0884c379918 OK
0170F175468FB5E6 0756D8E0774761D2
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
432193b78951fc98 432193b78951fc98 OK
43297FAD38E373FE 762514B829BF486A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
13f04154d69d1ae5 13f04154d69d1ae5 OK
07A7137045DA2A16 3BDD119049372802
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
2eedda93ffd39c79 2eedda93ffd39c79 OK
04689104C2FD3B2F 26955F6835AF609A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
d887e0393c2da6e3 d887e0393c2da6e3 OK
37D06BB516CB7546 164D5E404F275232
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
5f99d04f5b163969 5f99d04f5b163969 OK
1F08260D1AC2465E 6B056E18759F5CCA
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
4a057a3b24d3977b 4a057a3b24d3977b OK
584023641ABA6176 004BD6EF09176062
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
452031c1e4fada8e 452031c1e4fada8e OK
025816164629B007 480D39006EE762F2
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
7555ae39f59b87bd 7555ae39f59b87bd OK
49793EBC79B3258F 437540C8698F3CFA
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
53c55f9cb49fc019 53c55f9cb49fc019 OK
4FB05E1515AB73A7 072D43A077075292
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
7a8e7bfa937e89a3 7a8e7bfa937e89a3 OK
49E95D6D4CA229BF 02FE55778117F12A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
cf9c5d7a4986adb5 cf9c5d7a4986adb5 OK
018310DC409B26D6 1D9D5C5018F728C2
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
d1abb290658bc778 d1abb290658bc778 OK
1C587F1C13924FEF 305532286D6F295A
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
55cb3774d13ef201 55cb3774d13ef201 OK
0101010101010101 0123456789ABCDEF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
fa34ec4847b268b2 fa34ec4847b268b2 OK
1F1F1F1F0E0E0E0E 0123456789ABCDEF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
a790795108ea3cae a790795108ea3cae OK
E0FEE0FEF1FEF1FE 0123456789ABCDEF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
c39e072d9fac631d c39e072d9fac631d OK
0000000000000000 FFFFFFFFFFFFFFFF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
014933e0cdaff6e4 014933e0cdaff6e4 OK
FFFFFFFFFFFFFFFF 0000000000000000
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
f21e9a77b71c49bc f21e9a77b71c49bc OK
0123456789ABCDEF 0000000000000000
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
245946885754369a 245946885754369a OK
FEDCBA9876543210 FFFFFFFFFFFFFFFF
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
6b5c5a9c5d9e0a5a 6b5c5a9c5d9e0a5a OK
Deprecated: Function mcrypt_module_open() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic_init() is deprecated in %s%eblowfish.php on line %d
Deprecated: Function mcrypt_generic() is deprecated in %s%eblowfish.php on line %d
6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc
mcrypt-1.0.5/tests/bug35496.phpt 0000644 0001750 0001750 00000001411 14242662241 015546 0 ustar derick derick --TEST--
Bug #35496 (Crash in mcrypt_generic()/mdecrypt_generic() without proper init).
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug35496.php on line 2
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug35496.php on line 3
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 3
Deprecated: Function mdecrypt_generic() is deprecated in %s%ebug35496.php on line 4
Warning: mdecrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 4
mcrypt-1.0.5/tests/bug37595.phpt 0000644 0001750 0001750 00000006503 14242662241 015557 0 ustar derick derick --TEST--
Bug #37595 (mcrypt_generic calculates data length in wrong way)
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug37595.php on line 18
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
string(8) "12345678"
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
string(16) "123456789 "
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
string(8) " 1234567"
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Warning: mcrypt_generic(): An empty string was passed in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
bool(false)
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
string(16) "1234567812345678"
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 30
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug37595.php on line 31
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug37595.php on line 33
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug37595.php on line 35
string(24) "12345678123456789 "
Deprecated: Function mcrypt_module_close() is deprecated in %s%ebug37595.php on line 39
Done
mcrypt-1.0.5/tests/bug41252.phpt 0000644 0001750 0001750 00000001133 14242662241 015532 0 ustar derick derick --TEST--
Bug #41252 (Calling mcrypt_generic without first calling mcrypt_generic_init crashes)
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug41252.php on line 2
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug41252.php on line 3
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug41252.php on line 3
I'm alive!
mcrypt-1.0.5/tests/bug43143.phpt 0000644 0001750 0001750 00000001513 14242662241 015535 0 ustar derick derick --TEST--
Bug #43143 (Warning about empty IV with MCRYPT_MODE_ECB)
--SKIPIF--
--FILE--
--EXPECTF--
ECB
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 5
CFB
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 9
Warning: mcrypt_encrypt(): Encryption mode requires an initialization vector of size 32 in %sbug43143.php on line 9
END
mcrypt-1.0.5/tests/bug46010.phpt 0000644 0001750 0001750 00000001455 14242662241 015536 0 ustar derick derick --TEST--
Bug #46010 (warnings incorrectly generated for iv in ecb mode)
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 4
string(16) "f7a2ce11d4002294"
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 5
string(16) "f7a2ce11d4002294"
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug46010.php on line 6
string(16) "f7a2ce11d4002294"
mcrypt-1.0.5/tests/bug49738.phpt 0000644 0001750 0001750 00000001461 14242662241 015557 0 ustar derick derick --TEST--
Bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes)
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_open() is deprecated in %s%ebug49738.php on line 2
Deprecated: Function mcrypt_generic_init() is deprecated in %s%ebug49738.php on line 3
Deprecated: Function mcrypt_generic_deinit() is deprecated in %s%ebug49738.php on line 4
Deprecated: Function mcrypt_generic() is deprecated in %s%ebug49738.php on line 5
Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug49738.php on line 5
mcrypt-1.0.5/tests/bug55169.phpt 0000644 0001750 0001750 00000002344 14242662241 015553 0 ustar derick derick --TEST--
mcrypt_create_iv https://bugs.php.net/bug.php?id=55169
--CREDITS--
Ryan Biesemeyer
--SKIPIF--
--FILE--
--EXPECTF--
Input: 1
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 1
Hex: %x
Input: 2
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 2
Hex: %x
Input: 4
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 4
Hex: %x
Input: 8
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 8
Hex: %x
Input: 16
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 16
Hex: %x
Input: 32
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 32
Hex: %x
Input: 64
Deprecated: Function mcrypt_create_iv() is deprecated in %s%ebug55169.php on line 4
Length: 64
Hex: %x
mcrypt-1.0.5/tests/bug70625.phpt 0000644 0001750 0001750 00000001206 14242662241 015541 0 ustar derick derick --TEST--
Bug #70625: mcrypt_encrypt() : won't return data when no IV was specified under RC4
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug70625.php on line 4
string(14) "d5c9a57023d0f1"
Deprecated: Function mcrypt_decrypt() is deprecated in %s%ebug70625.php on line 6
string(7) "payload"
mcrypt-1.0.5/tests/bug8040.phpt 0000644 0001750 0001750 00000000721 14242662241 015452 0 ustar derick derick --TEST--
Bug #8040 (MCRYPT_MODE_* do not seem to exist)
--SKIPIF--
--FILE--
--EXPECTF--
twofish
cbc
cbc
cipher=twofish mode1=cbc
mcrypt-1.0.5/tests/mcrypt_cbc_3des_decrypt.phpt 0000644 0001750 0001750 00000006476 14242662241 021173 0 ustar derick derick --TEST--
Test mcrypt_cbc() function : basic functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
string(32) "736563726574206d6573736167650000"
key length=26
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 41
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
string(32) "659ec947f4dc3a3b9c50de744598d3c8"
iv length=9
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc_3des_decrypt.php on line 48
Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/mcrypt_cbc_3des_encrypt.phpt 0000644 0001750 0001750 00000006037 14242662241 021176 0 ustar derick derick --TEST--
Test mcrypt_cbc() function : basic functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
key length=26
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 28
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
Warning: mcrypt_encrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
iv length=9
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc_3des_encrypt.php on line 35
Warning: mcrypt_encrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/mcrypt_cbc.phpt 0000644 0001750 0001750 00000002366 14242662241 016515 0 ustar derick derick --TEST--
mcrypt_cbc
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_get_iv_size() is deprecated in %s%emcrypt_cbc.php on line 6
Deprecated: Function mcrypt_create_iv() is deprecated in %s%emcrypt_cbc.php on line 6
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_cbc.php on line 7
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc.php on line 10
PHP Testfest 2008
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_cbc.php on line 13
Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
bool(false)
mcrypt-1.0.5/tests/mcrypt_cfb.phpt 0000644 0001750 0001750 00000002363 14242662241 016515 0 ustar derick derick --TEST--
mcrypt_cfb
--SKIPIF--
--FILE--
--FILE--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt_decrypt() : basic functionality ***
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
string(32) "736563726574206d6573736167650000"
key length=26
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 44
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
string(32) "659ec947f4dc3a3b9c50de744598d3c8"
iv length=9
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_cbc.php on line 51
Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/mcrypt_decrypt_3des_ecb.phpt 0000644 0001750 0001750 00000006242 14242662241 021164 0 ustar derick derick --TEST--
Test mcrypt_decrypt() function : basic functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt_decrypt() : basic functionality ***
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
string(32) "736563726574206d6573736167650000"
key length=26
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 43
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=9
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_decrypt_3des_ecb.php on line 50
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
===DONE===
mcrypt-1.0.5/tests/mcrypt_decrypt.phpt 0000644 0001750 0001750 00000003116 14242662241 017432 0 ustar derick derick --TEST--
mcrypt_decrypt
--SKIPIF--
--FILE--
--FILE--
===DONE===
--EXPECTF--
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
string(32) "736563726574206d6573736167650000"
key length=26
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 42
Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=9
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_ecb_3des_decrypt.php on line 49
string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
===DONE===
mcrypt-1.0.5/tests/mcrypt_ecb_3des_encrypt.phpt 0000644 0001750 0001750 00000006020 14242662241 021170 0 ustar derick derick --TEST--
Test mcrypt_ecb() function : basic functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
key length=26
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 31
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
iv length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
iv length=9
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_ecb_3des_encrypt.php on line 38
string(112) "440a6f54601969b15e81df09cd381ef585fede5f3620587fd1a949c520aed9f6d10ebbabf2cea3e1f04c9251c2878c0ca37d51c80d490165"
===DONE===
mcrypt-1.0.5/tests/mcrypt_ecb.phpt 0000644 0001750 0001750 00000002163 14242662241 016512 0 ustar derick derick --TEST--
mcrypt_ecb
--SKIPIF--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
int(16)
[1]=>
int(24)
[2]=>
int(32)
} mcrypt-1.0.5/tests/mcrypt_enc_is_block_algorithm_mode.phpt 0000644 0001750 0001750 00000002356 14242662241 023451 0 ustar derick derick --TEST--
mcrypt_enc_is_block_algorithm_mode
--SKIPIF--
--FILE--
--FILE--
--FILE--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt_encrypt() : TripleDES functionality ***
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
key length=26
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 40
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
Warning: mcrypt_encrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
iv length=9
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_cbc.php on line 47
Warning: mcrypt_encrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/mcrypt_encrypt_3des_ecb.phpt 0000644 0001750 0001750 00000006144 14242662241 021177 0 ustar derick derick --TEST--
Test mcrypt_encrypt() function : TripleDES functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt_encrypt() : TripleDES functionality ***
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=20
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
key length=26
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 25
Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
string(0) ""
--- testing different iv lengths
iv length=4
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
iv length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
iv length=9
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_encrypt_3des_ecb.php on line 39
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
===DONE===
mcrypt-1.0.5/tests/mcrypt_enc_self_test.phpt 0000644 0001750 0001750 00000000666 14242662241 020604 0 ustar derick derick --TEST--
mcrypt_enc_self_test
--SKIPIF--
--FILE--
--FILE--
$iv, 'key'=>$key);
$fp = fopen($secretfile, 'wb');
stream_filter_append($fp, 'mcrypt.tripledes', STREAM_FILTER_WRITE, $opts);
fwrite($fp, 'Secret secret secret data');
fclose($fp);
echo md5_file($secretfile)."\n";
$fp = fopen($secretfile, 'rb');
stream_filter_append($fp, 'mdecrypt.tripledes', STREAM_FILTER_READ, $opts);
$data = stream_get_contents($fp);
fclose($fp);
echo $data."\n";
@unlink($secretfile);
--EXPECTF--
FOUND
FOUND
Deprecated: stream_filter_append(): mcrypt and mdecrypt stream filters have been deprecated in %s%emcrypt_filters.php on line 17
32e14bd3c31f2bd666e4290ebdb166a7
Deprecated: stream_filter_append(): mcrypt and mdecrypt stream filters have been deprecated in %s%emcrypt_filters.php on line 24
Secret secret secret data mcrypt-1.0.5/tests/mcrypt_get_block_size.phpt 0000644 0001750 0001750 00000001217 14242662241 020743 0 ustar derick derick --TEST--
mcrypt_get_block_size
--SKIPIF--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
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"
} mcrypt-1.0.5/tests/mcrypt_module_get_algo_block_size.phpt 0000644 0001750 0001750 00000002445 14242662241 023316 0 ustar derick derick --TEST--
mcrypt_module_get_algo_block_size
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 2
int(32)
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 3
int(24)
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 4
int(8)
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 5
int(8)
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 6
int(16)
Deprecated: Function mcrypt_module_get_algo_block_size() is deprecated in %s%emcrypt_module_get_algo_block_size.php on line 7
int(8)
mcrypt-1.0.5/tests/mcrypt_module_get_algo_key_size.phpt 0000644 0001750 0001750 00000002403 14242662241 023006 0 ustar derick derick --TEST--
mcrypt_module_get_algo_key_size
--SKIPIF--
--FILE--
--EXPECTF--
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 2
int(32)
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 3
int(32)
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 4
int(128)
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 5
int(16)
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 6
int(32)
Deprecated: Function mcrypt_module_get_algo_key_size() is deprecated in %s%emcrypt_module_get_algo_key_size.php on line 7
int(56)
mcrypt-1.0.5/tests/mcrypt_module_get_supported_key_sizes.phpt 0000644 0001750 0001750 00000001154 14242662241 024276 0 ustar derick derick --TEST--
mcrypt_module_get_supported_key_sizes
--SKIPIF--
--FILE--
int(16)
[1]=>
int(24)
[2]=>
int(32)
}
Deprecated: Function mcrypt_module_get_supported_key_sizes() is deprecated in %s%emcrypt_module_get_supported_key_sizes.php on line 3
array(0) {
} mcrypt-1.0.5/tests/mcrypt_module_is_block_algorithm_mode.phpt 0000644 0001750 0001750 00000001737 14242662241 024173 0 ustar derick derick --TEST--
mcrypt_module_is_block_algorithm_mode
--SKIPIF--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt : Rijndael128 functionality ***
--- testing different key lengths
key length=0
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
Warning: mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
key length=8
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
key length=16
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101"
--- testing different iv lengths
iv length=0
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
Warning: mcrypt_decrypt(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
Warning: mcrypt_decrypt(): Received initialization vector of size 8, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
iv length=16
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
string(32) "42adc8c0db19473f2c684ff2d6e828a5"
iv length=17
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_128BitKey.php on line %d
Warning: mcrypt_decrypt(): Received initialization vector of size 17, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/mcrypt_rijndael128_256BitKey.phpt 0000644 0001750 0001750 00000011234 14242662241 021507 0 ustar derick derick --TEST--
Test mcrypt_encrypt() function : AES functionality
--SKIPIF--
--FILE--
===DONE===
--EXPECTF--
*** Testing mcrypt : Rijndael128 functionality ***
--- testing different key lengths
key length=20
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
key length=24
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
string(128) "8ecdf1ed5742aff16ef34c819c8d22c707c54f4d9ffc18e5f6ab79fe68c25705351e2c001a0b9f29e5def67570ca9da644efb69a8bb97940cb4bec094dae8bb5"
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=30
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
Warning: mcrypt_encrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
Warning: mcrypt_decrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
key length=32
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
string(128) "f23bc103bfd0859a8318acee6d96e5f43dff68f3cdeae817a1e77c33492e32bdb82c5f660fcd1a2bfda70d9de4d5d8028ce179a9e2f7f9ee7dd61c7b4b409e95"
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=40
Deprecated: Function mcrypt_encrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 43
Warning: mcrypt_encrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
Deprecated: Function mcrypt_decrypt() is deprecated in %s%emcrypt_rijndael128_256BitKey.php on line 45
Warning: mcrypt_decrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
string(0) ""
===DONE===
mcrypt-1.0.5/tests/vectors.txt 0000644 0001750 0001750 00000004141 14242662241 015712 0 ustar derick derick 0000000000000000 0000000000000000 4EF997456198DD78
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 51866FD5B85ECB8A
3000000000000000 1000000000000001 7D856F9A613063F2
1111111111111111 1111111111111111 2466DD878B963C9D
0123456789ABCDEF 1111111111111111 61F9C3802281B096
1111111111111111 0123456789ABCDEF 7D0CC630AFDA1EC7
FEDCBA9876543210 0123456789ABCDEF 0ACEAB0FC6A0A28D
7CA110454A1A6E57 01A1D6D039776742 59C68245EB05282B
0131D9619DC1376E 5CD54CA83DEF57DA B1B8CC0B250F09A0
07A1133E4A0B2686 0248D43806F67172 1730E5778BEA1DA4
3849674C2602319E 51454B582DDF440A A25E7856CF2651EB
04B915BA43FEB5B6 42FD443059577FA2 353882B109CE8F1A
0113B970FD34F2CE 059B5E0851CF143A 48F4D0884C379918
0170F175468FB5E6 0756D8E0774761D2 432193B78951FC98
43297FAD38E373FE 762514B829BF486A 13F04154D69D1AE5
07A7137045DA2A16 3BDD119049372802 2EEDDA93FFD39C79
04689104C2FD3B2F 26955F6835AF609A D887E0393C2DA6E3
37D06BB516CB7546 164D5E404F275232 5F99D04F5B163969
1F08260D1AC2465E 6B056E18759F5CCA 4A057A3B24D3977B
584023641ABA6176 004BD6EF09176062 452031C1E4FADA8E
025816164629B007 480D39006EE762F2 7555AE39F59B87BD
49793EBC79B3258F 437540C8698F3CFA 53C55F9CB49FC019
4FB05E1515AB73A7 072D43A077075292 7A8E7BFA937E89A3
49E95D6D4CA229BF 02FE55778117F12A CF9C5D7A4986ADB5
018310DC409B26D6 1D9D5C5018F728C2 D1ABB290658BC778
1C587F1C13924FEF 305532286D6F295A 55CB3774D13EF201
0101010101010101 0123456789ABCDEF FA34EC4847B268B2
1F1F1F1F0E0E0E0E 0123456789ABCDEF A790795108EA3CAE
E0FEE0FEF1FEF1FE 0123456789ABCDEF C39E072D9FAC631D
0000000000000000 FFFFFFFFFFFFFFFF 014933E0CDAFF6E4
FFFFFFFFFFFFFFFF 0000000000000000 F21E9A77B71C49BC
0123456789ABCDEF 0000000000000000 245946885754369A
FEDCBA9876543210 FFFFFFFFFFFFFFFF 6B5C5A9C5D9E0A5A
mcrypt-1.0.5/config.m4 0000644 0001750 0001750 00000002644 14242662241 014037 0 ustar derick derick AC_DEFUN([PHP_MCRYPT_CHECK_VERSION],[
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-I$MCRYPT_DIR/include
AC_MSG_CHECKING(for libmcrypt version)
AC_EGREP_CPP(yes,[
#include
#if MCRYPT_API_VERSION >= 20021217
yes
#endif
],[
AC_MSG_RESULT(>= 2.5.6)
],[
AC_MSG_ERROR(libmcrypt version 2.5.6 or greater required.)
])
CPPFLAGS=$old_CPPFLAGS
])
PHP_ARG_WITH(mcrypt, for mcrypt support,
[ --with-mcrypt[=DIR] Include mcrypt support])
if test "$PHP_MCRYPT" != "no"; then
for i in $PHP_MCRYPT /usr/local /usr; do
test -f $i/include/mcrypt.h && MCRYPT_DIR=$i && break
done
if test -z "$MCRYPT_DIR"; then
AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
fi
PHP_MCRYPT_CHECK_VERSION
PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
[
PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
],[
PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
[
AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
],[
AC_MSG_ERROR([Sorry, I was not able to diagnose which libmcrypt version you have installed.])
],[
-L$MCRYPT_DIR/$PHP_LIBDIR
])
],[
-L$MCRYPT_DIR/$PHP_LIBDIR -lltdl
])
PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/$PHP_LIBDIR, MCRYPT_SHARED_LIBADD)
PHP_ADD_INCLUDE($MCRYPT_DIR/include)
PHP_SUBST(MCRYPT_SHARED_LIBADD)
PHP_NEW_EXTENSION(mcrypt, mcrypt.c mcrypt_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
mcrypt-1.0.5/config.w32 0000644 0001750 0001750 00000001160 14242662241 014122 0 ustar derick derick // vim:ft=javascript
ARG_WITH("mcrypt", "mcrypt support", "no");
if (PHP_MCRYPT != "no") {
if (CHECK_HEADER_ADD_INCLUDE('mcrypt.h', 'CFLAGS_MCRYPT') &&
CHECK_HEADER_ADD_INCLUDE('dirent.h', 'CFLAGS_MCRYPT') &&
CHECK_LIB('libmcrypt_a.lib;libmcrypt.lib', 'mcrypt') &&
CHECK_LIB('dirent_a.lib', 'mcrypt') &&
CHECK_LIB('Advapi32.lib', 'mcrypt')
) {
EXTENSION('mcrypt', 'mcrypt.c mcrypt_filter.c', PHP_MCRYPT_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_LIBMCRYPT', 1);
AC_DEFINE('HAVE_LIBMCRYPT24', 1);
} else {
WARNING("mcrypt not enabled; libraries and headers not found");
}
}
mcrypt-1.0.5/mcrypt.c 0000644 0001750 0001750 00000115267 14242662241 014020 0 ustar derick derick /*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann |
| Derick Rethans |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#if HAVE_LIBMCRYPT
#if PHP_WIN32
# include "win32/winutil.h"
#endif
#include "php_mcrypt.h"
#include "fcntl.h"
#define NON_FREE
#define MCRYPT2
#include "mcrypt.h"
#include "php_ini.h"
#include "php_globals.h"
#include "ext/standard/info.h"
#include "ext/standard/php_rand.h"
#include "zend_smart_str.h"
#include "php_mcrypt_filter.h"
static int le_mcrypt;
typedef struct _php_mcrypt {
MCRYPT td;
zend_bool init;
} php_mcrypt;
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_open, 0, 0, 4)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, cipher_directory)
ZEND_ARG_INFO(0, mode)
ZEND_ARG_INFO(0, mode_directory)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_generic_init, 0, 0, 3)
ZEND_ARG_INFO(0, td)
ZEND_ARG_INFO(0, key)
ZEND_ARG_INFO(0, iv)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_generic, 0, 0, 2)
ZEND_ARG_INFO(0, td)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mdecrypt_generic, 0, 0, 2)
ZEND_ARG_INFO(0, td)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_supported_key_sizes, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_self_test, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_close, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_generic_deinit, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_is_block_algorithm_mode, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_is_block_algorithm, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_is_block_mode, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_block_size, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_key_size, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_iv_size, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_algorithms_name, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_enc_get_modes_name, 0, 0, 1)
ZEND_ARG_INFO(0, td)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_self_test, 0, 0, 1)
ZEND_ARG_INFO(0, algorithm)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_is_block_algorithm_mode, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_is_block_algorithm, 0, 0, 1)
ZEND_ARG_INFO(0, algorithm)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_is_block_mode, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_get_algo_block_size, 0, 0, 1)
ZEND_ARG_INFO(0, algorithm)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_get_algo_key_size, 0, 0, 1)
ZEND_ARG_INFO(0, algorithm)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_module_get_supported_key_sizes, 0, 0, 1)
ZEND_ARG_INFO(0, algorithm)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_list_algorithms, 0, 0, 0)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_list_modes, 0, 0, 0)
ZEND_ARG_INFO(0, lib_dir)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_get_key_size, 0, 0, 2)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, module)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_get_block_size, 0, 0, 2)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, module)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_get_iv_size, 0, 0, 2)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, module)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_get_cipher_name, 0, 0, 1)
ZEND_ARG_INFO(0, cipher)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_encrypt, 0, 0, 4)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, key)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, mode)
ZEND_ARG_INFO(0, iv)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_decrypt, 0, 0, 4)
ZEND_ARG_INFO(0, cipher)
ZEND_ARG_INFO(0, key)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, mode)
ZEND_ARG_INFO(0, iv)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_mcrypt_create_iv, 0, 0, 1)
ZEND_ARG_INFO(0, size)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO()
/* }}} */
const zend_function_entry mcrypt_functions[] = { /* {{{ */
PHP_DEP_FE(mcrypt_get_key_size, arginfo_mcrypt_get_key_size)
PHP_DEP_FE(mcrypt_get_block_size, arginfo_mcrypt_get_block_size)
PHP_DEP_FE(mcrypt_get_cipher_name, arginfo_mcrypt_get_cipher_name)
PHP_DEP_FE(mcrypt_create_iv, arginfo_mcrypt_create_iv)
PHP_DEP_FE(mcrypt_list_algorithms, arginfo_mcrypt_list_algorithms)
PHP_DEP_FE(mcrypt_list_modes, arginfo_mcrypt_list_modes)
PHP_DEP_FE(mcrypt_get_iv_size, arginfo_mcrypt_get_iv_size)
PHP_DEP_FE(mcrypt_encrypt, arginfo_mcrypt_encrypt)
PHP_DEP_FE(mcrypt_decrypt, arginfo_mcrypt_decrypt)
PHP_DEP_FE(mcrypt_module_open, arginfo_mcrypt_module_open)
PHP_DEP_FE(mcrypt_generic_init, arginfo_mcrypt_generic_init)
PHP_DEP_FE(mcrypt_generic, arginfo_mcrypt_generic)
PHP_DEP_FE(mdecrypt_generic, arginfo_mdecrypt_generic)
PHP_DEP_FE(mcrypt_generic_deinit, arginfo_mcrypt_generic_deinit)
PHP_DEP_FE(mcrypt_enc_self_test, arginfo_mcrypt_enc_self_test)
PHP_DEP_FE(mcrypt_enc_is_block_algorithm_mode, arginfo_mcrypt_enc_is_block_algorithm_mode)
PHP_DEP_FE(mcrypt_enc_is_block_algorithm, arginfo_mcrypt_enc_is_block_algorithm)
PHP_DEP_FE(mcrypt_enc_is_block_mode, arginfo_mcrypt_enc_is_block_mode)
PHP_DEP_FE(mcrypt_enc_get_block_size, arginfo_mcrypt_enc_get_block_size)
PHP_DEP_FE(mcrypt_enc_get_key_size, arginfo_mcrypt_enc_get_key_size)
PHP_DEP_FE(mcrypt_enc_get_supported_key_sizes, arginfo_mcrypt_enc_get_supported_key_sizes)
PHP_DEP_FE(mcrypt_enc_get_iv_size, arginfo_mcrypt_enc_get_iv_size)
PHP_DEP_FE(mcrypt_enc_get_algorithms_name, arginfo_mcrypt_enc_get_algorithms_name)
PHP_DEP_FE(mcrypt_enc_get_modes_name, arginfo_mcrypt_enc_get_modes_name)
PHP_DEP_FE(mcrypt_module_self_test, arginfo_mcrypt_module_self_test)
PHP_DEP_FE(mcrypt_module_is_block_algorithm_mode, arginfo_mcrypt_module_is_block_algorithm_mode)
PHP_DEP_FE(mcrypt_module_is_block_algorithm, arginfo_mcrypt_module_is_block_algorithm)
PHP_DEP_FE(mcrypt_module_is_block_mode, arginfo_mcrypt_module_is_block_mode)
PHP_DEP_FE(mcrypt_module_get_algo_block_size, arginfo_mcrypt_module_get_algo_block_size)
PHP_DEP_FE(mcrypt_module_get_algo_key_size, arginfo_mcrypt_module_get_algo_key_size)
PHP_DEP_FE(mcrypt_module_get_supported_key_sizes, arginfo_mcrypt_module_get_supported_key_sizes)
PHP_DEP_FE(mcrypt_module_close, arginfo_mcrypt_module_close)
PHP_FE_END
};
/* }}} */
static PHP_MINFO_FUNCTION(mcrypt);
static PHP_MINIT_FUNCTION(mcrypt);
static PHP_MSHUTDOWN_FUNCTION(mcrypt);
static PHP_GINIT_FUNCTION(mcrypt);
static PHP_GSHUTDOWN_FUNCTION(mcrypt);
ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
zend_module_entry mcrypt_module_entry = {
STANDARD_MODULE_HEADER,
"mcrypt",
mcrypt_functions,
PHP_MINIT(mcrypt), PHP_MSHUTDOWN(mcrypt),
NULL, NULL,
PHP_MINFO(mcrypt),
PHP_MCRYPT_VERSION,
PHP_MODULE_GLOBALS(mcrypt),
PHP_GINIT(mcrypt),
PHP_GSHUTDOWN(mcrypt),
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_MCRYPT
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(mcrypt)
#endif
#define MCRYPT_ENCRYPT 0
#define MCRYPT_DECRYPT 1
typedef enum {
RANDOM = 0,
URANDOM,
RAND
} iv_source;
#define MCRYPT_GET_INI \
cipher_dir_string = MCG(algorithms_dir); \
module_dir_string = MCG(modes_dir);
/*
* #warning is not ANSI C
* #warning Invalidate resource if the param count is wrong, or other problems
* #warning occurred during functions.
*/
#define MCRYPT_GET_CRYPT_ARGS \
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sssz|s", \
&cipher, &cipher_len, &key, &key_len, &data, &data_len, &mode, &iv, &iv_len) == FAILURE) { \
return; \
}
#define MCRYPT_GET_TD_ARG \
zval *mcryptind; \
php_mcrypt *pm; \
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &mcryptind) == FAILURE) { \
return; \
} \
if ((pm = (php_mcrypt *)zend_fetch_resource(Z_RES_P(mcryptind), "MCrypt", le_mcrypt)) == NULL) { \
RETURN_FALSE; \
}
#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
char *dir = NULL; \
size_t dir_len; \
char *module; \
size_t module_len; \
if (zend_parse_parameters (ZEND_NUM_ARGS(), \
"s|s", &module, &module_len, &dir, &dir_len) == FAILURE) { \
return; \
}
#define MCRYPT_OPEN_MODULE_FAILED "Module initialization failed"
#define MCRYPT_ENTRY2_2_4(a,b) REGISTER_STRING_CONSTANT("MCRYPT_" #a, b, CONST_PERSISTENT)
#define MCRYPT_ENTRY2_4(a) MCRYPT_ENTRY_NAMED(a, a)
#define PHP_MCRYPT_INIT_CHECK \
if (!pm->init) { \
php_error_docref(NULL, E_WARNING, "Operation disallowed prior to mcrypt_generic_init()."); \
RETURN_FALSE; \
} \
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("mcrypt.algorithms_dir", NULL, PHP_INI_ALL, OnUpdateString, algorithms_dir, zend_mcrypt_globals, mcrypt_globals)
STD_PHP_INI_ENTRY("mcrypt.modes_dir", NULL, PHP_INI_ALL, OnUpdateString, modes_dir, zend_mcrypt_globals, mcrypt_globals)
PHP_INI_END()
static void php_mcrypt_module_dtor(zend_resource *rsrc) /* {{{ */
{
php_mcrypt *pm = (php_mcrypt *) rsrc->ptr;
if (pm) {
mcrypt_generic_deinit(pm->td);
mcrypt_module_close(pm->td);
efree(pm);
pm = NULL;
}
}
/* }}} */
static PHP_GINIT_FUNCTION(mcrypt)
{/*{{{*/
#if defined(COMPILE_DL_MCRYPT) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
mcrypt_globals->fd[RANDOM] = -1;
mcrypt_globals->fd[URANDOM] = -1;
}/*}}}*/
static PHP_GSHUTDOWN_FUNCTION(mcrypt)
{/*{{{*/
if (mcrypt_globals->fd[RANDOM] > 0) {
close(mcrypt_globals->fd[RANDOM]);
mcrypt_globals->fd[RANDOM] = -1;
}
if (mcrypt_globals->fd[URANDOM] > 0) {
close(mcrypt_globals->fd[URANDOM]);
mcrypt_globals->fd[URANDOM] = -1;
}
}/*}}}*/
static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */
{
le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
/* modes for mcrypt_??? routines */
REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
/* sources for mcrypt_create_iv */
REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT);
/* ciphers */
MCRYPT_ENTRY2_2_4(3DES, "tripledes");
MCRYPT_ENTRY2_2_4(ARCFOUR_IV, "arcfour-iv");
MCRYPT_ENTRY2_2_4(ARCFOUR, "arcfour");
MCRYPT_ENTRY2_2_4(BLOWFISH, "blowfish");
MCRYPT_ENTRY2_2_4(BLOWFISH_COMPAT, "blowfish-compat");
MCRYPT_ENTRY2_2_4(CAST_128, "cast-128");
MCRYPT_ENTRY2_2_4(CAST_256, "cast-256");
MCRYPT_ENTRY2_2_4(CRYPT, "crypt");
MCRYPT_ENTRY2_2_4(DES, "des");
MCRYPT_ENTRY2_2_4(ENIGNA, "crypt");
MCRYPT_ENTRY2_2_4(GOST, "gost");
MCRYPT_ENTRY2_2_4(LOKI97, "loki97");
MCRYPT_ENTRY2_2_4(PANAMA, "panama");
MCRYPT_ENTRY2_2_4(RC2, "rc2");
MCRYPT_ENTRY2_2_4(RIJNDAEL_128, "rijndael-128");
MCRYPT_ENTRY2_2_4(RIJNDAEL_192, "rijndael-192");
MCRYPT_ENTRY2_2_4(RIJNDAEL_256, "rijndael-256");
MCRYPT_ENTRY2_2_4(SAFER64, "safer-sk64");
MCRYPT_ENTRY2_2_4(SAFER128, "safer-sk128");
MCRYPT_ENTRY2_2_4(SAFERPLUS, "saferplus");
MCRYPT_ENTRY2_2_4(SERPENT, "serpent");
MCRYPT_ENTRY2_2_4(THREEWAY, "threeway");
MCRYPT_ENTRY2_2_4(TRIPLEDES, "tripledes");
MCRYPT_ENTRY2_2_4(TWOFISH, "twofish");
MCRYPT_ENTRY2_2_4(WAKE, "wake");
MCRYPT_ENTRY2_2_4(XTEA, "xtea");
MCRYPT_ENTRY2_2_4(IDEA, "idea");
MCRYPT_ENTRY2_2_4(MARS, "mars");
MCRYPT_ENTRY2_2_4(RC6, "rc6");
MCRYPT_ENTRY2_2_4(SKIPJACK, "skipjack");
/* modes */
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();
php_stream_filter_register_factory("mcrypt.*", &php_mcrypt_filter_factory);
php_stream_filter_register_factory("mdecrypt.*", &php_mcrypt_filter_factory);
return SUCCESS;
}
/* }}} */
static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */
{
php_stream_filter_unregister_factory("mcrypt.*");
php_stream_filter_unregister_factory("mdecrypt.*");
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
#include "zend_smart_str.h"
PHP_MINFO_FUNCTION(mcrypt) /* {{{ */
{
char **modules;
char mcrypt_api_no[16];
int i, count;
smart_str tmp1 = {0};
smart_str tmp2 = {0};
modules = mcrypt_list_algorithms(MCG(algorithms_dir), &count);
if (count == 0) {
smart_str_appends(&tmp1, "none");
}
for (i = 0; i < count; i++) {
smart_str_appends(&tmp1, modules[i]);
smart_str_appendc(&tmp1, ' ');
}
smart_str_0(&tmp1);
mcrypt_free_p(modules, count);
modules = mcrypt_list_modes(MCG(modes_dir), &count);
if (count == 0) {
smart_str_appends(&tmp2, "none");
}
for (i = 0; i < count; i++) {
smart_str_appends(&tmp2, modules[i]);
smart_str_appendc(&tmp2, ' ');
}
smart_str_0 (&tmp2);
mcrypt_free_p (modules, count);
snprintf (mcrypt_api_no, 16, "%d", MCRYPT_API_VERSION);
php_info_print_table_start();
php_info_print_table_header(2, "mcrypt support", "enabled");
php_info_print_table_header(2, "mcrypt_filter support", "enabled");
php_info_print_table_row(2, "Extension version", PHP_MCRYPT_VERSION);
php_info_print_table_row(2, "Library version", LIBMCRYPT_VERSION);
php_info_print_table_row(2, "Api No", mcrypt_api_no);
php_info_print_table_row(2, "Supported ciphers", ZSTR_VAL(tmp1.s));
php_info_print_table_row(2, "Supported modes", ZSTR_VAL(tmp2.s));
smart_str_free(&tmp1);
smart_str_free(&tmp2);
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
/* }}} */
/* {{{ proto resource mcrypt_module_open(string cipher, string cipher_directory, string mode, string mode_directory)
Opens the module of the algorithm and the mode to be used */
PHP_FUNCTION(mcrypt_module_open)
{
char *cipher, *cipher_dir;
char *mode, *mode_dir;
size_t cipher_len, cipher_dir_len;
size_t mode_len, mode_dir_len;
MCRYPT td;
php_mcrypt *pm;
if (zend_parse_parameters (ZEND_NUM_ARGS(), "ssss",
&cipher, &cipher_len, &cipher_dir, &cipher_dir_len,
&mode, &mode_len, &mode_dir, &mode_dir_len)) {
return;
}
td = mcrypt_module_open (
cipher,
cipher_dir_len > 0 ? cipher_dir : MCG(algorithms_dir),
mode,
mode_dir_len > 0 ? mode_dir : MCG(modes_dir)
);
if (td == MCRYPT_FAILED) {
php_error_docref(NULL, E_WARNING, "Could not open encryption module");
RETURN_FALSE;
} else {
pm = emalloc(sizeof(php_mcrypt));
pm->td = td;
pm->init = 0;
RETURN_RES(zend_register_resource(pm, le_mcrypt));
}
}
/* }}} */
/* {{{ proto int mcrypt_generic_init(resource td, string key, string iv)
This function initializes all buffers for the specific module */
PHP_FUNCTION(mcrypt_generic_init)
{
char *key, *iv;
size_t key_len, iv_len;
zval *mcryptind;
unsigned char *key_s, *iv_s;
int max_key_size, key_size, iv_size;
php_mcrypt *pm;
int result = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &mcryptind, &key, &key_len, &iv, &iv_len) == FAILURE) {
return;
}
if ((pm = (php_mcrypt *)zend_fetch_resource(Z_RES_P(mcryptind), "MCrypt", le_mcrypt)) == NULL) {
RETURN_FALSE;
}
max_key_size = mcrypt_enc_get_key_size(pm->td);
iv_size = mcrypt_enc_get_iv_size(pm->td);
if (key_len == 0) {
php_error_docref(NULL, E_WARNING, "Key size is 0");
}
key_s = emalloc(key_len);
memset(key_s, 0, key_len);
iv_s = emalloc(iv_size + 1);
memset(iv_s, 0, iv_size + 1);
if (key_len > (size_t)max_key_size) {
php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %zd, max: %d", key_len, max_key_size);
key_size = max_key_size;
} else {
key_size = (int)key_len;
}
memcpy(key_s, key, key_len);
if (iv_len != (size_t)iv_size) {
php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size);
if (iv_len > (size_t)iv_size) {
iv_len = iv_size;
}
}
memcpy(iv_s, iv, iv_len);
mcrypt_generic_deinit(pm->td);
result = mcrypt_generic_init(pm->td, key_s, key_size, iv_s);
/* If this function fails, close the mcrypt module to prevent crashes
* when further functions want to access this resource */
if (result < 0) {
zend_list_close(Z_RES_P(mcryptind));
switch (result) {
case -3:
php_error_docref(NULL, E_WARNING, "Key length incorrect");
break;
case -4:
php_error_docref(NULL, E_WARNING, "Memory allocation error");
break;
case -1:
default:
php_error_docref(NULL, E_WARNING, "Unknown error");
break;
}
} else {
pm->init = 1;
}
RETVAL_LONG(result);
efree(iv_s);
efree(key_s);
}
/* }}} */
/* {{{ proto string mcrypt_generic(resource td, string data)
This function encrypts the plaintext */
PHP_FUNCTION(mcrypt_generic)
{
zval *mcryptind;
char *data;
size_t data_len;
php_mcrypt *pm;
zend_string* data_str;
int block_size, data_size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &mcryptind, &data, &data_len) == FAILURE) {
return;
}
if ((pm = (php_mcrypt *)zend_fetch_resource(Z_RES_P(mcryptind), "MCrypt", le_mcrypt)) == NULL) {
RETURN_FALSE;
}
PHP_MCRYPT_INIT_CHECK
if (data_len == 0) {
php_error_docref(NULL, E_WARNING, "An empty string was passed");
RETURN_FALSE;
}
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
/* Check blocksize */
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
block_size = mcrypt_enc_get_block_size(pm->td);
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
if (data_size <= 0) {
php_error_docref(NULL, E_WARNING, "Integer overflow in data size");
RETURN_FALSE;
}
data_str = zend_string_alloc(data_size, 0);
memset(ZSTR_VAL(data_str), 0, data_size);
memcpy(ZSTR_VAL(data_str), data, data_len);
} else { /* It's not a block algorithm */
data_size = (int)data_len;
data_str = zend_string_alloc(data_size, 0);
memset(ZSTR_VAL(data_str), 0, data_size);
memcpy(ZSTR_VAL(data_str), data, data_len);
}
mcrypt_generic(pm->td, ZSTR_VAL(data_str), data_size);
ZSTR_VAL(data_str)[data_size] = '\0';
RETVAL_NEW_STR(data_str);
}
/* }}} */
/* {{{ proto string mdecrypt_generic(resource td, string data)
This function decrypts the plaintext */
PHP_FUNCTION(mdecrypt_generic)
{
zval *mcryptind;
char *data;
size_t data_len;
php_mcrypt *pm;
char* data_s;
int block_size, data_size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &mcryptind, &data, &data_len) == FAILURE) {
return;
}
if ((pm = (php_mcrypt *)zend_fetch_resource(Z_RES_P(mcryptind), "MCrypt", le_mcrypt)) == NULL) {
RETURN_FALSE;
}
PHP_MCRYPT_INIT_CHECK
if (data_len == 0) {
php_error_docref(NULL, E_WARNING, "An empty string was passed");
RETURN_FALSE;
}
/* Check blocksize */
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
block_size = mcrypt_enc_get_block_size(pm->td);
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
if (data_size <= 0) {
php_error_docref(NULL, E_WARNING, "Integer overflow in data size");
RETURN_FALSE;
}
data_s = emalloc((size_t)data_size + 1);
memset(data_s, 0, data_size);
memcpy(data_s, data, data_len);
} else { /* It's not a block algorithm */
data_size = (int)data_len;
data_s = emalloc(data_size + 1);
memset(data_s, 0, data_size);
memcpy(data_s, data, data_len);
}
mdecrypt_generic(pm->td, data_s, data_size);
RETVAL_STRINGL(data_s, data_size);
efree(data_s);
}
/* }}} */
/* {{{ proto array mcrypt_enc_get_supported_key_sizes(resource td)
This function decrypts the crypttext */
PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
{
int i, count = 0;
int *key_sizes;
MCRYPT_GET_TD_ARG
array_init(return_value);
key_sizes = mcrypt_enc_get_supported_key_sizes(pm->td, &count);
for (i = 0; i < count; i++) {
add_index_long(return_value, i, key_sizes[i]);
}
mcrypt_free(key_sizes);
}
/* }}} */
/* {{{ proto int mcrypt_enc_self_test(resource td)
This function runs the self test on the algorithm specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_self_test)
{
MCRYPT_GET_TD_ARG
RETURN_LONG(mcrypt_enc_self_test(pm->td));
}
/* }}} */
/* {{{ proto bool mcrypt_module_close(resource td)
Free the descriptor td */
PHP_FUNCTION(mcrypt_module_close)
{
MCRYPT_GET_TD_ARG
zend_list_close(Z_RES_P(mcryptind));
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mcrypt_generic_deinit(resource td)
This function terminates encrypt specified by the descriptor td */
PHP_FUNCTION(mcrypt_generic_deinit)
{
MCRYPT_GET_TD_ARG
if (mcrypt_generic_deinit(pm->td) < 0) {
php_error_docref(NULL, E_WARNING, "Could not terminate encryption specifier");
RETURN_FALSE;
}
pm->init = 0;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool mcrypt_enc_is_block_algorithm_mode(resource td)
Returns TRUE if the mode is for use with block algorithms */
PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode)
{
MCRYPT_GET_TD_ARG
if (mcrypt_enc_is_block_algorithm_mode(pm->td) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool mcrypt_enc_is_block_algorithm(resource td)
Returns TRUE if the alrogithm is a block algorithms */
PHP_FUNCTION(mcrypt_enc_is_block_algorithm)
{
MCRYPT_GET_TD_ARG
if (mcrypt_enc_is_block_algorithm(pm->td) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool mcrypt_enc_is_block_mode(resource td)
Returns TRUE if the mode outputs blocks */
PHP_FUNCTION(mcrypt_enc_is_block_mode)
{
MCRYPT_GET_TD_ARG
if (mcrypt_enc_is_block_mode(pm->td) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int mcrypt_enc_get_block_size(resource td)
Returns the block size of the cipher specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_get_block_size)
{
MCRYPT_GET_TD_ARG
RETURN_LONG(mcrypt_enc_get_block_size(pm->td));
}
/* }}} */
/* {{{ proto int mcrypt_enc_get_key_size(resource td)
Returns the maximum supported key size in bytes of the algorithm specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_get_key_size)
{
MCRYPT_GET_TD_ARG
RETURN_LONG(mcrypt_enc_get_key_size(pm->td));
}
/* }}} */
/* {{{ proto int mcrypt_enc_get_iv_size(resource td)
Returns the size of the IV in bytes of the algorithm specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_get_iv_size)
{
MCRYPT_GET_TD_ARG
RETURN_LONG(mcrypt_enc_get_iv_size(pm->td));
}
/* }}} */
/* {{{ proto string mcrypt_enc_get_algorithms_name(resource td)
Returns the name of the algorithm specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_get_algorithms_name)
{
char *name;
MCRYPT_GET_TD_ARG
name = mcrypt_enc_get_algorithms_name(pm->td);
RETVAL_STRING(name);
mcrypt_free(name);
}
/* }}} */
/* {{{ proto string mcrypt_enc_get_modes_name(resource td)
Returns the name of the mode specified by the descriptor td */
PHP_FUNCTION(mcrypt_enc_get_modes_name)
{
char *name;
MCRYPT_GET_TD_ARG
name = mcrypt_enc_get_modes_name(pm->td);
RETVAL_STRING(name);
mcrypt_free(name);
}
/* }}} */
/* {{{ proto bool mcrypt_module_self_test(string algorithm [, string lib_dir])
Does a self test of the module "module" */
PHP_FUNCTION(mcrypt_module_self_test)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
if (mcrypt_module_self_test(module, dir) == 0) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool mcrypt_module_is_block_algorithm_mode(string mode [, string lib_dir])
Returns TRUE if the mode is for use with block algorithms */
PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
{
MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
if (mcrypt_module_is_block_algorithm_mode(module, dir) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool mcrypt_module_is_block_algorithm(string algorithm [, string lib_dir])
Returns TRUE if the algorithm is a block algorithm */
PHP_FUNCTION(mcrypt_module_is_block_algorithm)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
if (mcrypt_module_is_block_algorithm(module, dir) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool mcrypt_module_is_block_mode(string mode [, string lib_dir])
Returns TRUE if the mode outputs blocks of bytes */
PHP_FUNCTION(mcrypt_module_is_block_mode)
{
MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
if (mcrypt_module_is_block_mode(module, dir) == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int mcrypt_module_get_algo_block_size(string algorithm [, string lib_dir])
Returns the block size of the algorithm */
PHP_FUNCTION(mcrypt_module_get_algo_block_size)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir));
}
/* }}} */
/* {{{ proto int mcrypt_module_get_algo_key_size(string algorithm [, string lib_dir])
Returns the maximum supported key size of the algorithm */
PHP_FUNCTION(mcrypt_module_get_algo_key_size)
{
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir));
}
/* }}} */
/* {{{ proto array mcrypt_module_get_supported_key_sizes(string algorithm [, string lib_dir])
This function decrypts the crypttext */
PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
{
int i, count = 0;
int *key_sizes;
MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
array_init(return_value);
key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count);
for (i = 0; i < count; i++) {
add_index_long(return_value, i, key_sizes[i]);
}
mcrypt_free(key_sizes);
}
/* }}} */
/* {{{ proto array mcrypt_list_algorithms([string lib_dir])
List all algorithms in "module_dir" */
PHP_FUNCTION(mcrypt_list_algorithms)
{
char **modules;
char *lib_dir = MCG(algorithms_dir);
size_t lib_dir_len;
int i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",
&lib_dir, &lib_dir_len) == FAILURE) {
return;
}
array_init(return_value);
modules = mcrypt_list_algorithms(lib_dir, &count);
if (count == 0) {
php_error_docref(NULL, E_WARNING, "No algorithms found in module dir");
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i]);
}
mcrypt_free_p(modules, count);
}
/* }}} */
/* {{{ proto array mcrypt_list_modes([string lib_dir])
List all modes "module_dir" */
PHP_FUNCTION(mcrypt_list_modes)
{
char **modules;
char *lib_dir = MCG(modes_dir);
size_t lib_dir_len;
int i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",
&lib_dir, &lib_dir_len) == FAILURE) {
return;
}
array_init(return_value);
modules = mcrypt_list_modes(lib_dir, &count);
if (count == 0) {
php_error_docref(NULL, E_WARNING, "No modes found in module dir");
}
for (i = 0; i < count; i++) {
add_index_string(return_value, i, modules[i]);
}
mcrypt_free_p(modules, count);
}
/* }}} */
/* {{{ proto int mcrypt_get_key_size(string cipher, string module)
Get the key size of cipher */
PHP_FUNCTION(mcrypt_get_key_size)
{
char *cipher;
char *module;
size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
MCRYPT_GET_INI
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&cipher, &cipher_len, &module, &module_len) == FAILURE) {
return;
}
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
RETVAL_LONG(mcrypt_enc_get_key_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int mcrypt_get_block_size(string cipher, string module)
Get the key size of cipher */
PHP_FUNCTION(mcrypt_get_block_size)
{
char *cipher;
char *module;
size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
MCRYPT_GET_INI
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&cipher, &cipher_len, &module, &module_len) == FAILURE) {
return;
}
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
RETVAL_LONG(mcrypt_enc_get_block_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto int mcrypt_get_iv_size(string cipher, string module)
Get the IV size of cipher (Usually the same as the blocksize) */
PHP_FUNCTION(mcrypt_get_iv_size)
{
char *cipher;
char *module;
size_t cipher_len, module_len;
char *cipher_dir_string;
char *module_dir_string;
MCRYPT td;
MCRYPT_GET_INI
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&cipher, &cipher_len, &module, &module_len) == FAILURE) {
return;
}
td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string);
if (td != MCRYPT_FAILED) {
RETVAL_LONG(mcrypt_enc_get_iv_size(td));
mcrypt_module_close(td);
} else {
php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto string mcrypt_get_cipher_name(string cipher)
Get the key size of cipher */
PHP_FUNCTION(mcrypt_get_cipher_name)
{
char *cipher_dir_string;
char *module_dir_string;
char *cipher_name;
char *cipher;
size_t cipher_len;
MCRYPT td;
MCRYPT_GET_INI
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&cipher, &cipher_len) == FAILURE) {
return;
}
/* The code below is actually not very nice, but I didn't see a better
* method */
td = mcrypt_module_open(cipher, cipher_dir_string, "ecb", module_dir_string);
if (td != MCRYPT_FAILED) {
cipher_name = mcrypt_enc_get_algorithms_name(td);
mcrypt_module_close(td);
RETVAL_STRING(cipher_name);
mcrypt_free(cipher_name);
} else {
td = mcrypt_module_open(cipher, cipher_dir_string, "stream", module_dir_string);
if (td != MCRYPT_FAILED) {
cipher_name = mcrypt_enc_get_algorithms_name(td);
mcrypt_module_close(td);
RETVAL_STRING(cipher_name);
mcrypt_free(cipher_name);
} else {
php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
}
}
/* }}} */
static char *php_mcrypt_get_key_size_str(
int max_key_size, const int *key_sizes, int key_size_count) /* {{{ */
{
if (key_size_count == 0) {
char *str;
spprintf(&str, 0, "Only keys of size 1 to %d supported", max_key_size);
return str;
} else if (key_size_count == 1) {
char *str;
spprintf(&str, 0, "Only keys of size %d supported", key_sizes[0]);
return str;
} else {
int i;
char *result = NULL;
smart_str str = {0};
smart_str_appends(&str, "Only keys of sizes ");
for (i = 0; i < key_size_count; ++i) {
if (i == key_size_count - 1) {
smart_str_appends(&str, " or ");
} else if (i != 0) {
smart_str_appends(&str, ", ");
}
smart_str_append_long(&str, key_sizes[i]);
}
smart_str_appends(&str, " supported");
smart_str_0(&str);
result = estrndup(ZSTR_VAL(str.s), ZSTR_LEN(str.s));
smart_str_free(&str);
return result;
}
}
/* }}} */
static zend_bool php_mcrypt_is_valid_key_size(
int key_size, int max_key_size, int *key_sizes, int key_size_count) /* {{{ */
{
int i;
if (key_size <= 0 || key_size > max_key_size) {
return 0;
}
if (key_size_count == 0) {
/* All key sizes are valid */
return 1;
}
for (i = 0; i < key_size_count; i++) {
if (key_sizes[i] == key_size) {
return 1;
}
}
return 0;
}
/* }}} */
static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size) /* {{{ */
{
int key_size_count;
int max_key_size = mcrypt_enc_get_key_size(td);
int *key_sizes = mcrypt_enc_get_supported_key_sizes(td, &key_size_count);
zend_bool is_valid_key_size = php_mcrypt_is_valid_key_size(
key_size, max_key_size, key_sizes, key_size_count
);
if (!is_valid_key_size) {
char *key_size_str = php_mcrypt_get_key_size_str(
max_key_size, key_sizes, key_size_count
);
php_error_docref(NULL, E_WARNING,
"Key of size %d not supported by this algorithm. %s", key_size, key_size_str
);
efree(key_size_str);
}
if (key_sizes) {
mcrypt_free(key_sizes);
}
return is_valid_key_size ? SUCCESS : FAILURE;
}
/* }}} */
static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size) /* {{{ */
{
if (mcrypt_enc_mode_has_iv(td) == 1) {
int expected_iv_size = mcrypt_enc_get_iv_size(td);
if (expected_iv_size == 0) {
/* Algorithm does not use IV, even though mode supports it */
return SUCCESS;
}
if (!iv) {
php_error_docref(NULL, E_WARNING,
"Encryption mode requires an initialization vector of size %d", expected_iv_size
);
return FAILURE;
}
if (iv_size != expected_iv_size) {
php_error_docref(NULL, E_WARNING,
"Received initialization vector of size %d, but size %d is required "
"for this encryption mode", iv_size, expected_iv_size
);
return FAILURE;
}
}
return SUCCESS;
}
/* }}} */
static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, const char *data, size_t data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value) /* {{{ */
{
char *cipher_dir_string;
char *module_dir_string;
zend_long data_size;
char *data_s;
MCRYPT td;
MCRYPT_GET_INI
td = mcrypt_module_open(cipher, cipher_dir_string, mode, module_dir_string);
if (td == MCRYPT_FAILED) {
php_error_docref(NULL, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
if (php_mcrypt_ensure_valid_key_size(td, (int)key_len) == FAILURE) {
mcrypt_module_close(td);
RETURN_FALSE;
}
if (php_mcrypt_ensure_valid_iv(td, iv, (int)iv_len) == FAILURE) {
mcrypt_module_close(td);
RETURN_FALSE;
}
/* Check blocksize */
if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
int block_size = mcrypt_enc_get_block_size(td);
data_size = ((((zend_long)data_len - 1) / block_size) + 1) * block_size;
data_s = emalloc(data_size + 1);
memset(data_s, 0, data_size);
memcpy(data_s, data, data_len);
} else { /* It's not a block algorithm */
data_size = data_len;
data_s = emalloc(data_size + 1);
memcpy(data_s, data, data_len);
}
if (mcrypt_generic_init(td, (void *) key, (int)key_len, (void *) iv) < 0) {
efree(data_s);
zend_throw_error(NULL, "Mcrypt initialisation failed");
mcrypt_module_close(td);
RETURN_FALSE;
}
if (dencrypt == MCRYPT_ENCRYPT) {
mcrypt_generic(td, data_s, (int)data_size);
} else {
mdecrypt_generic(td, data_s, (int)data_size);
}
data_s[data_size] = 0;
RETVAL_STRINGL(data_s, data_size);
efree(data_s);
/* freeing vars */
mcrypt_generic_end(td);
}
/* }}} */
/* {{{ proto string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
OFB crypt/decrypt data using key key with cipher cipher starting with iv */
PHP_FUNCTION(mcrypt_encrypt)
{
char *cipher, *key, *data, *mode, *iv = NULL;
size_t cipher_len, key_len, data_len, mode_len, iv_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss|s", &cipher, &cipher_len,
&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
return;
}
php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_ENCRYPT, return_value);
}
/* }}} */
/* {{{ proto string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
OFB crypt/decrypt data using key key with cipher cipher starting with iv */
PHP_FUNCTION(mcrypt_decrypt)
{
char *cipher, *key, *data, *mode, *iv = NULL;
size_t cipher_len, key_len, data_len, mode_len, iv_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss|s", &cipher, &cipher_len,
&key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
return;
}
php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_DECRYPT, return_value);
}
/* }}} */
/* {{{ proto string mcrypt_create_iv(int size, int source)
Create an initialization vector (IV) */
PHP_FUNCTION(mcrypt_create_iv)
{
char *iv;
zend_long source = URANDOM;
zend_long size;
int n = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &size, &source) == FAILURE) {
return;
}
if (size <= 0 || size >= INT_MAX) {
php_error_docref(NULL, E_WARNING, "Cannot create an IV with a size of less than 1 or greater than %d", INT_MAX);
RETURN_FALSE;
}
iv = ecalloc(size + 1, 1);
if (source == RANDOM || source == URANDOM) {
#if PHP_WIN32
/* random/urandom equivalent on Windows */
BYTE *iv_b = (BYTE *) iv;
if (php_win32_get_random_bytes(iv_b, (size_t) size) == FAILURE){
efree(iv);
php_error_docref(NULL, E_WARNING, "Could not gather sufficient random data");
RETURN_FALSE;
}
n = (int)size;
#else
int *fd = &MCG(fd[source]);
size_t read_bytes = 0;
if (*fd < 0) {
*fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY);
if (*fd < 0) {
efree(iv);
php_error_docref(NULL, E_WARNING, "Cannot open source device");
RETURN_FALSE;
}
}
while ((zend_long)read_bytes < size) {
n = read(*fd, iv + read_bytes, size - read_bytes);
if (n <= 0) {
break;
}
read_bytes += n;
}
n = read_bytes;
if (n < size) {
efree(iv);
php_error_docref(NULL, E_WARNING, "Could not gather sufficient random data");
RETURN_FALSE;
}
#endif
} else {
n = (int)size;
while (size) {
iv[--size] = (char) (255.0 * php_rand() / RAND_MAX);
}
}
RETVAL_STRINGL(iv, n);
efree(iv);
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
mcrypt-1.0.5/mcrypt_filter.c 0000644 0001750 0001750 00000020735 14242662241 015360 0 ustar derick derick /*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon |
+----------------------------------------------------------------------+
*/
#include "php.h"
#include "php_mcrypt_filter.h"
#include "php_ini.h"
#include
typedef struct _php_mcrypt_filter_data {
MCRYPT module;
char encrypt;
int blocksize;
char *block_buffer;
int block_used;
char persistent;
} php_mcrypt_filter_data;
static php_stream_filter_status_t php_mcrypt_filter(
php_stream *stream,
php_stream_filter *thisfilter,
php_stream_bucket_brigade *buckets_in,
php_stream_bucket_brigade *buckets_out,
size_t *bytes_consumed,
int flags)
{
php_mcrypt_filter_data *data;
php_stream_bucket *bucket;
size_t consumed = 0;
php_stream_filter_status_t exit_status = PSFS_FEED_ME;
if (!thisfilter || !Z_PTR(thisfilter->abstract)) {
/* Should never happen */
return PSFS_ERR_FATAL;
}
data = (php_mcrypt_filter_data *)(Z_PTR(thisfilter->abstract));
while(buckets_in->head) {
bucket = buckets_in->head;
consumed += bucket->buflen;
if (data->blocksize) {
/* Blockmode cipher */
char *outchunk;
int chunklen = (int)(bucket->buflen + data->block_used), n;
php_stream_bucket *newbucket;
outchunk = pemalloc(chunklen, data->persistent);
if (data->block_used) {
memcpy(outchunk, data->block_buffer, data->block_used);
}
memcpy(outchunk + data->block_used, bucket->buf, bucket->buflen);
for(n=0; (n + data->blocksize) <= chunklen; n += data->blocksize) {
if (data->encrypt) {
mcrypt_generic(data->module, outchunk + n, data->blocksize);
} else {
mdecrypt_generic(data->module, outchunk + n, data->blocksize);
}
}
data->block_used = chunklen - n;
memcpy(data->block_buffer, outchunk + n, data->block_used);
newbucket = php_stream_bucket_new(stream, outchunk, n, 1, data->persistent);
php_stream_bucket_append(buckets_out, newbucket);
exit_status = PSFS_PASS_ON;
php_stream_bucket_unlink(bucket);
php_stream_bucket_delref(bucket);
} else {
/* Stream cipher */
php_stream_bucket_make_writeable(bucket);
if (data->encrypt) {
mcrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
} else {
mdecrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
}
php_stream_bucket_append(buckets_out, bucket);
exit_status = PSFS_PASS_ON;
}
}
if ((flags & PSFS_FLAG_FLUSH_CLOSE) && data->blocksize && data->block_used) {
php_stream_bucket *newbucket;
memset(data->block_buffer + data->block_used, 0, data->blocksize - data->block_used);
if (data->encrypt) {
mcrypt_generic(data->module, data->block_buffer, data->blocksize);
} else {
mdecrypt_generic(data->module, data->block_buffer, data->blocksize);
}
newbucket = php_stream_bucket_new(stream, data->block_buffer, data->blocksize, 0, data->persistent);
php_stream_bucket_append(buckets_out, newbucket);
exit_status = PSFS_PASS_ON;
}
if (bytes_consumed) {
*bytes_consumed = consumed;
}
return exit_status;
}
static void php_mcrypt_filter_dtor(php_stream_filter *thisfilter)
{
if (thisfilter && Z_PTR(thisfilter->abstract)) {
php_mcrypt_filter_data *data = (php_mcrypt_filter_data*) Z_PTR(thisfilter->abstract);
if (data->block_buffer) {
pefree(data->block_buffer, data->persistent);
}
mcrypt_generic_deinit(data->module);
mcrypt_module_close(data->module);
pefree(data, data->persistent);
}
}
static php_stream_filter_ops php_mcrypt_filter_ops = {
php_mcrypt_filter,
php_mcrypt_filter_dtor,
"mcrypt.*"
};
/* {{{ php_mcrypt_filter_create
* Instantiate mcrypt filter
*/
static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
{
int encrypt = 1, iv_len, key_len, keyl, result;
const char *cipher = filtername + sizeof("mcrypt.") - 1;
zval *tmpzval;
MCRYPT mcrypt_module;
char *iv = NULL, *key = NULL;
char *algo_dir = INI_STR("mcrypt.algorithms_dir");
char *mode_dir = INI_STR("mcrypt.modes_dir");
char *mode = "cbc";
php_mcrypt_filter_data *data;
php_error_docref(NULL, E_DEPRECATED, "mcrypt and mdecrypt stream filters have been deprecated");
if (strncasecmp(filtername, "mdecrypt.", sizeof("mdecrypt.") - 1) == 0) {
encrypt = 0;
cipher += sizeof("de") - 1;
} else if (strncasecmp(filtername, "mcrypt.", sizeof("mcrypt.") - 1) != 0) {
/* Should never happen */
return NULL;
}
if (!filterparams || Z_TYPE_P(filterparams) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Filter parameters for %s must be an array", filtername);
return NULL;
}
if ((tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("mode")))) {
if (Z_TYPE_P(tmpzval) == IS_STRING) {
mode = Z_STRVAL_P(tmpzval);
} else {
php_error_docref(NULL, E_WARNING, "mode is not a string, ignoring");
}
}
if ((tmpzval=zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("algorithms_dir")))) {
if (Z_TYPE_P(tmpzval) == IS_STRING) {
algo_dir = Z_STRVAL_P(tmpzval);
} else {
php_error_docref(NULL, E_WARNING, "algorithms_dir is not a string, ignoring");
}
}
if ((tmpzval=zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("modes_dir")))) {
if (Z_TYPE_P(tmpzval) == IS_STRING) {
mode_dir = Z_STRVAL_P(tmpzval);
} else {
php_error_docref(NULL, E_WARNING, "modes_dir is not a string, ignoring");
}
}
if ((tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("key"))) &&
Z_TYPE_P(tmpzval) == IS_STRING) {
key = Z_STRVAL_P(tmpzval);
key_len = (int)Z_STRLEN_P(tmpzval);
} else {
php_error_docref(NULL, E_WARNING, "key not specified or is not a string");
return NULL;
}
mcrypt_module = mcrypt_module_open((char *)cipher, algo_dir, mode, mode_dir);
if (mcrypt_module == MCRYPT_FAILED) {
php_error_docref(NULL, E_WARNING, "Could not open encryption module");
return NULL;
}
iv_len = mcrypt_enc_get_iv_size(mcrypt_module);
keyl = mcrypt_enc_get_key_size(mcrypt_module);
if (keyl < key_len) {
key_len = keyl;
}
if (!(tmpzval = zend_hash_str_find(Z_ARRVAL_P(filterparams), ZEND_STRL("iv"))) ||
Z_TYPE_P(tmpzval) != IS_STRING) {
php_error_docref(NULL, E_WARNING, "Filter parameter[iv] not provided or not of type: string");
mcrypt_module_close(mcrypt_module);
return NULL;
}
iv = emalloc(iv_len + 1);
if ((size_t)iv_len <= Z_STRLEN_P(tmpzval)) {
memcpy(iv, Z_STRVAL_P(tmpzval), iv_len);
} else {
memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval));
memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval));
}
result = mcrypt_generic_init(mcrypt_module, key, key_len, iv);
efree(iv);
if (result < 0) {
switch (result) {
case -3:
php_error_docref(NULL, E_WARNING, "Key length incorrect");
break;
case -4:
php_error_docref(NULL, E_WARNING, "Memory allocation error");
break;
case -1:
default:
php_error_docref(NULL, E_WARNING, "Unknown error");
break;
}
mcrypt_module_close(mcrypt_module);
return NULL;
}
data = pemalloc(sizeof(php_mcrypt_filter_data), persistent);
data->module = mcrypt_module;
data->encrypt = encrypt;
if (mcrypt_enc_is_block_mode(mcrypt_module)) {
data->blocksize = mcrypt_enc_get_block_size(mcrypt_module);
data->block_buffer = pemalloc(data->blocksize, persistent);
} else {
data->blocksize = 0;
data->block_buffer = NULL;
}
data->block_used = 0;
data->persistent = persistent;
return php_stream_filter_alloc(&php_mcrypt_filter_ops, data, persistent);
}
/* }}} */
php_stream_filter_factory php_mcrypt_filter_factory = {
php_mcrypt_filter_create
};
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
mcrypt-1.0.5/php_mcrypt.h 0000644 0001750 0001750 00000006256 14242662241 014671 0 ustar derick derick /*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2019 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Sascha Schumann |
| Derick Rethans |
+----------------------------------------------------------------------+
*/
#ifndef PHP_MCRYPT_H
#define PHP_MCRYPT_H
#if HAVE_LIBMCRYPT
#ifdef ZTS
#include "TSRM.h"
#endif
extern zend_module_entry mcrypt_module_entry;
#define mcrypt_module_ptr &mcrypt_module_entry
#define PHP_MCRYPT_VERSION "1.0.5"
/* Functions for both old and new API */
PHP_FUNCTION(mcrypt_ecb);
PHP_FUNCTION(mcrypt_cbc);
PHP_FUNCTION(mcrypt_cfb);
PHP_FUNCTION(mcrypt_ofb);
PHP_FUNCTION(mcrypt_get_cipher_name);
PHP_FUNCTION(mcrypt_get_block_size);
PHP_FUNCTION(mcrypt_get_key_size);
PHP_FUNCTION(mcrypt_create_iv);
/* Support functions for old API */
PHP_FUNCTION(mcrypt_list_algorithms);
PHP_FUNCTION(mcrypt_list_modes);
PHP_FUNCTION(mcrypt_get_iv_size);
PHP_FUNCTION(mcrypt_encrypt);
PHP_FUNCTION(mcrypt_decrypt);
/* Functions for new API */
PHP_FUNCTION(mcrypt_module_open);
PHP_FUNCTION(mcrypt_generic_init);
PHP_FUNCTION(mcrypt_generic);
PHP_FUNCTION(mdecrypt_generic);
PHP_FUNCTION(mcrypt_generic_deinit);
PHP_FUNCTION(mcrypt_enc_self_test);
PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode);
PHP_FUNCTION(mcrypt_enc_is_block_algorithm);
PHP_FUNCTION(mcrypt_enc_is_block_mode);
PHP_FUNCTION(mcrypt_enc_get_block_size);
PHP_FUNCTION(mcrypt_enc_get_key_size);
PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes);
PHP_FUNCTION(mcrypt_enc_get_iv_size);
PHP_FUNCTION(mcrypt_enc_get_algorithms_name);
PHP_FUNCTION(mcrypt_enc_get_modes_name);
PHP_FUNCTION(mcrypt_module_self_test);
PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode);
PHP_FUNCTION(mcrypt_module_is_block_algorithm);
PHP_FUNCTION(mcrypt_module_is_block_mode);
PHP_FUNCTION(mcrypt_module_get_algo_block_size);
PHP_FUNCTION(mcrypt_module_get_algo_key_size);
PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
PHP_FUNCTION(mcrypt_module_close);
ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
int le_h;
char *modes_dir;
char *algorithms_dir;
int fd[2]; // RANDOM = 0, URANDOM = 1
ZEND_END_MODULE_GLOBALS(mcrypt)
#define MCG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mcrypt, v)
#else
#define mcrypt_module_ptr NULL
#endif
#define phpext_mcrypt_ptr mcrypt_module_ptr
#endif
mcrypt-1.0.5/php_mcrypt_filter.h 0000644 0001750 0001750 00000002722 14242662241 016230 0 ustar derick derick /*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sara Golemon |
+----------------------------------------------------------------------+
*/
#ifndef PHP_MCRYPT_FILTER_H
#define PHP_MCRYPT_FILTER_H
extern php_stream_filter_factory php_mcrypt_filter_factory;
PHP_MINIT_FUNCTION(mcrypt_filter);
PHP_MSHUTDOWN_FUNCTION(mcrypt_filter);
PHP_MINFO_FUNCTION(mcrypt_filter);
#endif /* PHP_MCRYPT_FILTER_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
mcrypt-1.0.5/LICENSE 0000644 0001750 0001750 00000006204 14242662241 013331 0 ustar derick derick --------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2016 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see .
PHP includes the Zend Engine, freely available at
.