cryptostub.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 1999 - 2005, Digium, Inc.
  5. *
  6. * Mark Spencer <markster@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. #include <unistd.h>
  19. #include <stdlib.h>
  20. #include "asterisk/crypto.h"
  21. #include "asterisk/logger.h"
  22. /* Hrm, I wonder if the compiler is smart enough to only create two functions
  23. for all these... I could force it to only make two, but those would be some
  24. really nasty looking casts. */
  25. static struct ast_key *stub_ast_key_get(const char *kname, int ktype)
  26. {
  27. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  28. return NULL;
  29. }
  30. static int stub_ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
  31. {
  32. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  33. return -1;
  34. }
  35. static int stub_ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig)
  36. {
  37. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  38. return -1;
  39. }
  40. static int stub_ast_sign(struct ast_key *key, char *msg, char *sig)
  41. {
  42. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  43. return -1;
  44. }
  45. static int stub_ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *sig)
  46. {
  47. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  48. return -1;
  49. }
  50. static int stub_ast_encdec_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
  51. {
  52. ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
  53. return -1;
  54. }
  55. struct ast_key *(*ast_key_get)(const char *key, int type) =
  56. stub_ast_key_get;
  57. int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig) =
  58. stub_ast_check_signature;
  59. int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) =
  60. stub_ast_check_signature_bin;
  61. int (*ast_sign)(struct ast_key *key, char *msg, char *sig) =
  62. stub_ast_sign;
  63. int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) =
  64. stub_ast_sign_bin;
  65. int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
  66. stub_ast_encdec_bin;
  67. int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
  68. stub_ast_encdec_bin;