p11-kit.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (c) 2011 Collabora Ltd.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above
  9. * copyright notice, this list of conditions and the
  10. * following disclaimer.
  11. * * Redistributions in binary form must reproduce the
  12. * above copyright notice, this list of conditions and
  13. * the following disclaimer in the documentation and/or
  14. * other materials provided with the distribution.
  15. * * The names of contributors to this software may not be
  16. * used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  30. * DAMAGE.
  31. *
  32. * Author: Stef Walter <stefw@collabora.co.uk>
  33. */
  34. #ifndef __P11_KIT_H__
  35. #define __P11_KIT_H__
  36. #include "p11-kit/pkcs11.h"
  37. /*
  38. * If the caller is using the PKCS#11 GNU calling convention, then we cater
  39. * to that here.
  40. */
  41. #ifdef CRYPTOKI_GNU
  42. typedef ck_rv_t CK_RV;
  43. typedef struct ck_function_list* CK_FUNCTION_LIST_PTR;
  44. typedef struct ck_function_list CK_FUNCTION_LIST;
  45. #endif
  46. #include "p11-kit/deprecated.h"
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. enum {
  51. P11_KIT_MODULE_UNMANAGED = 1 << 0,
  52. P11_KIT_MODULE_CRITICAL = 1 << 1,
  53. P11_KIT_MODULE_TRUSTED = 1 << 2,
  54. P11_KIT_MODULE_VERBOSE = 1 << 3,
  55. P11_KIT_MODULE_MASK = (1 << 4) - 1
  56. };
  57. typedef void (* p11_kit_destroyer) (void *data);
  58. CK_FUNCTION_LIST ** p11_kit_modules_load (const char *reserved,
  59. int flags);
  60. CK_RV p11_kit_modules_initialize (CK_FUNCTION_LIST **modules,
  61. p11_kit_destroyer failure_callback);
  62. CK_FUNCTION_LIST ** p11_kit_modules_load_and_initialize (int flags);
  63. CK_RV p11_kit_modules_finalize (CK_FUNCTION_LIST **modules);
  64. void p11_kit_modules_release (CK_FUNCTION_LIST **modules);
  65. void p11_kit_modules_finalize_and_release (CK_FUNCTION_LIST **modules);
  66. CK_FUNCTION_LIST * p11_kit_module_for_name (CK_FUNCTION_LIST **modules,
  67. const char *name);
  68. char * p11_kit_module_get_filename (CK_FUNCTION_LIST *module);
  69. char * p11_kit_module_get_name (CK_FUNCTION_LIST *module);
  70. int p11_kit_module_get_flags (CK_FUNCTION_LIST *module);
  71. CK_FUNCTION_LIST * p11_kit_module_load (const char *module_path,
  72. int flags);
  73. CK_RV p11_kit_module_initialize (CK_FUNCTION_LIST *module);
  74. CK_RV p11_kit_module_finalize (CK_FUNCTION_LIST *module);
  75. void p11_kit_module_release (CK_FUNCTION_LIST *module);
  76. char * p11_kit_config_option (CK_FUNCTION_LIST *module,
  77. const char *option);
  78. const char* p11_kit_strerror (CK_RV rv);
  79. size_t p11_kit_space_strlen (const unsigned char *string,
  80. size_t max_length);
  81. char* p11_kit_space_strdup (const unsigned char *string,
  82. size_t max_length);
  83. void p11_kit_be_quiet (void);
  84. void p11_kit_be_loud (void);
  85. #ifdef P11_KIT_FUTURE_UNSTABLE_API
  86. void p11_kit_set_progname (const char *progname);
  87. void p11_kit_override_system_files (const char *system_conf,
  88. const char *user_conf,
  89. const char *package_modules,
  90. const char *system_modules,
  91. const char *user_modules);
  92. #endif
  93. const char * p11_kit_message (void);
  94. #ifdef __cplusplus
  95. } /* extern "C" */
  96. #endif
  97. #endif /* __P11_KIT_H__ */