You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.4 KiB

27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
27 years ago
  1. #ifndef PHP_MCRYPT_H
  2. #define PHP_MCRYPT_H
  3. #if HAVE_LIBMCRYPT
  4. #ifdef ZTS
  5. #include "TSRM.h"
  6. #endif
  7. #if PHP_API_VERSION < 19990421
  8. #define zend_module_entry zend_module_entry
  9. #include "modules.h"
  10. #include "internal_functions.h"
  11. #endif
  12. extern zend_module_entry mcrypt_module_entry;
  13. #define mcrypt_module_ptr &mcrypt_module_entry
  14. /* Functions for both old and new API */
  15. PHP_FUNCTION(mcrypt_ecb);
  16. PHP_FUNCTION(mcrypt_cbc);
  17. PHP_FUNCTION(mcrypt_cfb);
  18. PHP_FUNCTION(mcrypt_ofb);
  19. PHP_FUNCTION(mcrypt_get_cipher_name);
  20. PHP_FUNCTION(mcrypt_get_block_size);
  21. PHP_FUNCTION(mcrypt_get_key_size);
  22. PHP_FUNCTION(mcrypt_create_iv);
  23. #if HAVE_LIBMCRYPT24
  24. /* Support functions for old API */
  25. PHP_FUNCTION(mcrypt_list_algorithms);
  26. PHP_FUNCTION(mcrypt_list_modes);
  27. PHP_FUNCTION(mcrypt_get_iv_size);
  28. PHP_FUNCTION(mcrypt_encrypt);
  29. PHP_FUNCTION(mcrypt_decrypt);
  30. /* Functions for new API */
  31. PHP_FUNCTION(mcrypt_module_open);
  32. PHP_FUNCTION(mcrypt_generic_init);
  33. PHP_FUNCTION(mcrypt_generic);
  34. PHP_FUNCTION(mdecrypt_generic);
  35. PHP_FUNCTION(mcrypt_generic_end);
  36. PHP_FUNCTION(mcrypt_enc_self_test);
  37. PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode);
  38. PHP_FUNCTION(mcrypt_enc_is_block_algorithm);
  39. PHP_FUNCTION(mcrypt_enc_is_block_mode);
  40. PHP_FUNCTION(mcrypt_enc_get_block_size);
  41. PHP_FUNCTION(mcrypt_enc_get_key_size);
  42. PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes);
  43. PHP_FUNCTION(mcrypt_enc_get_iv_size);
  44. PHP_FUNCTION(mcrypt_enc_get_algorithms_name);
  45. PHP_FUNCTION(mcrypt_enc_get_modes_name);
  46. PHP_FUNCTION(mcrypt_module_self_test);
  47. PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode);
  48. PHP_FUNCTION(mcrypt_module_is_block_algorithm);
  49. PHP_FUNCTION(mcrypt_module_is_block_mode);
  50. PHP_FUNCTION(mcrypt_module_get_algo_block_size);
  51. PHP_FUNCTION(mcrypt_module_get_algo_key_size);
  52. PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
  53. PHP_FUNCTION(mcrypt_module_close);
  54. ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
  55. int le_h;
  56. char *modes_dir;
  57. char *algorithms_dir;
  58. ZEND_END_MODULE_GLOBALS(mcrypt)
  59. #ifdef ZTS
  60. # define MCLS_D zend_mcrypt_globals *mcrypt_globals
  61. # define MCLS_DC , MCLS_D
  62. # define MCLS_C mcrypt_globals
  63. # define MCLS_CC , MCLS_C
  64. # define MCG(v) (mcrypt_globals->v)
  65. # define MCLS_FETCH() zend_mcrypt_globals *mcrypt_globals = ts_resource(mcrypt_globals_id)
  66. #else
  67. # define MCLS_D
  68. # define MCLS_DC
  69. # define MCLS_C
  70. # define MCLS_CC
  71. # define MCG(v) (mcrypt_globals.v)
  72. # define MCLS_FETCH()
  73. #endif
  74. #endif
  75. #else
  76. #define mcrypt_module_ptr NULL
  77. #endif
  78. #define phpext_mcrypt_ptr mcrypt_module_ptr
  79. #endif