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.

86 lines
1.7 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. #define PEP_ENGINE_VERSION "0.5.0"
  2. // this is 20 safewords with 79 chars max
  3. #define MAX_SAFEWORDS_SPACE (20 * 80)
  4. // XML parameters string
  5. #define PARMS_MAX 32768
  6. // maximum busy wait time in ms
  7. #define BUSY_WAIT_TIME 5000
  8. // maximum line length for reading gpg.conf
  9. #define MAX_LINELENGTH 1024
  10. // default keyserver
  11. #define DEFAULT_KEYSERVER "hkp://keys.gnupg.net"
  12. #ifdef WIN32
  13. #include "platform_windows.h"
  14. #define LOCAL_DB windoze_local_db()
  15. #define SYSTEM_DB windoze_system_db()
  16. #define LIBGPGME "libgpgme-11.dll"
  17. #else // UNIX
  18. #define _POSIX_C_SOURCE 200809L
  19. #include <dlfcn.h>
  20. #include "platform_unix.h"
  21. #define LOCAL_DB unix_local_db()
  22. #ifndef SYSTEM_DB
  23. #define SYSTEM_DB "/usr/share/pEp/system.db"
  24. #endif
  25. #ifndef LIBGPGME
  26. #define LIBGPGME "libgpgme-pthread.so"
  27. #endif
  28. #endif
  29. #include <locale.h>
  30. #include <stdlib.h>
  31. #include <string.h>
  32. #include <assert.h>
  33. #include <stdio.h>
  34. #ifndef NDEBUG
  35. #include <stdio.h>
  36. #endif
  37. #ifndef NO_GPG
  38. #include <gpgme.h>
  39. #endif
  40. #include "sqlite3.h"
  41. #define _EXPORT_PEP_ENGINE_DLL
  42. #include "pEpEngine.h"
  43. #ifndef NO_GPG
  44. #include "pgp_gpg_internal.h"
  45. #endif
  46. #include "cryptotech.h"
  47. #include "transport.h"
  48. #define NOT_IMPLEMENTED assert(0)
  49. typedef struct {
  50. const char *version;
  51. #ifndef NO_GPG
  52. void *gpgme;
  53. struct gpg_s gpg;
  54. gpgme_ctx_t ctx;
  55. #endif
  56. PEP_cryptotech_t cryptotech[PEP_crypt__count];
  57. PEP_transport_t transports[PEP_trans__count];
  58. sqlite3 *db;
  59. sqlite3 *system_db;
  60. sqlite3_stmt *log;
  61. sqlite3_stmt *safeword;
  62. sqlite3_stmt *get_identity;
  63. sqlite3_stmt *set_person;
  64. sqlite3_stmt *set_pgp_keypair;
  65. sqlite3_stmt *set_identity;
  66. sqlite3_stmt *set_trust;
  67. sqlite3_stmt *get_trust;
  68. } pEpSession;