e_capi_err.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Generated by util/mkerr.pl DO NOT EDIT
  3. * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License 2.0 (the "License"). You may not use
  6. * this file except in compliance with the License. You can obtain a copy
  7. * in the file LICENSE in the source distribution or at
  8. * https://www.openssl.org/source/license.html
  9. */
  10. #include <openssl/err.h>
  11. #include "e_capi_err.h"
  12. #ifndef OPENSSL_NO_ERR
  13. static ERR_STRING_DATA CAPI_str_functs[] = {
  14. {ERR_PACK(0, CAPI_F_CAPI_CERT_GET_FNAME, 0), "capi_cert_get_fname"},
  15. {ERR_PACK(0, CAPI_F_CAPI_CTRL, 0), "capi_ctrl"},
  16. {ERR_PACK(0, CAPI_F_CAPI_CTX_NEW, 0), "capi_ctx_new"},
  17. {ERR_PACK(0, CAPI_F_CAPI_CTX_SET_PROVNAME, 0), "capi_ctx_set_provname"},
  18. {ERR_PACK(0, CAPI_F_CAPI_DSA_DO_SIGN, 0), "capi_dsa_do_sign"},
  19. {ERR_PACK(0, CAPI_F_CAPI_GET_KEY, 0), "capi_get_key"},
  20. {ERR_PACK(0, CAPI_F_CAPI_GET_PKEY, 0), "capi_get_pkey"},
  21. {ERR_PACK(0, CAPI_F_CAPI_GET_PROVNAME, 0), "capi_get_provname"},
  22. {ERR_PACK(0, CAPI_F_CAPI_GET_PROV_INFO, 0), "capi_get_prov_info"},
  23. {ERR_PACK(0, CAPI_F_CAPI_INIT, 0), "capi_init"},
  24. {ERR_PACK(0, CAPI_F_CAPI_LIST_CONTAINERS, 0), "capi_list_containers"},
  25. {ERR_PACK(0, CAPI_F_CAPI_LOAD_PRIVKEY, 0), "capi_load_privkey"},
  26. {ERR_PACK(0, CAPI_F_CAPI_OPEN_STORE, 0), "capi_open_store"},
  27. {ERR_PACK(0, CAPI_F_CAPI_RSA_PRIV_DEC, 0), "capi_rsa_priv_dec"},
  28. {ERR_PACK(0, CAPI_F_CAPI_RSA_PRIV_ENC, 0), "capi_rsa_priv_enc"},
  29. {ERR_PACK(0, CAPI_F_CAPI_RSA_SIGN, 0), "capi_rsa_sign"},
  30. {ERR_PACK(0, CAPI_F_CAPI_VTRACE, 0), "capi_vtrace"},
  31. {ERR_PACK(0, CAPI_F_CERT_SELECT_DIALOG, 0), "cert_select_dialog"},
  32. {ERR_PACK(0, CAPI_F_CLIENT_CERT_SELECT, 0), ""},
  33. {ERR_PACK(0, CAPI_F_WIDE_TO_ASC, 0), "wide_to_asc"},
  34. {0, NULL}
  35. };
  36. static ERR_STRING_DATA CAPI_str_reasons[] = {
  37. {ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "cant create hash object"},
  38. {ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "cant find capi context"},
  39. {ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "cant get key"},
  40. {ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "cant set hash value"},
  41. {ERR_PACK(0, 0, CAPI_R_CRYPTACQUIRECONTEXT_ERROR),
  42. "cryptacquirecontext error"},
  43. {ERR_PACK(0, 0, CAPI_R_CRYPTENUMPROVIDERS_ERROR),
  44. "cryptenumproviders error"},
  45. {ERR_PACK(0, 0, CAPI_R_DECRYPT_ERROR), "decrypt error"},
  46. {ERR_PACK(0, 0, CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized"},
  47. {ERR_PACK(0, 0, CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error"},
  48. {ERR_PACK(0, 0, CAPI_R_ERROR_ADDING_CERT), "error adding cert"},
  49. {ERR_PACK(0, 0, CAPI_R_ERROR_CREATING_STORE), "error creating store"},
  50. {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_FRIENDLY_NAME),
  51. "error getting friendly name"},
  52. {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),
  53. "error getting key provider info"},
  54. {ERR_PACK(0, 0, CAPI_R_ERROR_OPENING_STORE), "error opening store"},
  55. {ERR_PACK(0, 0, CAPI_R_ERROR_SIGNING_HASH), "error signing hash"},
  56. {ERR_PACK(0, 0, CAPI_R_FILE_OPEN_ERROR), "file open error"},
  57. {ERR_PACK(0, 0, CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported"},
  58. {ERR_PACK(0, 0, CAPI_R_GETUSERKEY_ERROR), "getuserkey error"},
  59. {ERR_PACK(0, 0, CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length"},
  60. {ERR_PACK(0, 0, CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
  61. "invalid dsa public key blob magic number"},
  62. {ERR_PACK(0, 0, CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method"},
  63. {ERR_PACK(0, 0, CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob"},
  64. {ERR_PACK(0, 0, CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
  65. "invalid rsa public key blob magic number"},
  66. {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error"},
  67. {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),
  68. "pubkey export length error"},
  69. {ERR_PACK(0, 0, CAPI_R_UNKNOWN_COMMAND), "unknown command"},
  70. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_ALGORITHM_NID),
  71. "unsupported algorithm nid"},
  72. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PADDING), "unsupported padding"},
  73. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),
  74. "unsupported public key algorithm"},
  75. {ERR_PACK(0, 0, CAPI_R_WIN32_ERROR), "win32 error"},
  76. {0, NULL}
  77. };
  78. #endif
  79. static int lib_code = 0;
  80. static int error_loaded = 0;
  81. static int ERR_load_CAPI_strings(void)
  82. {
  83. if (lib_code == 0)
  84. lib_code = ERR_get_next_error_library();
  85. if (!error_loaded) {
  86. #ifndef OPENSSL_NO_ERR
  87. ERR_load_strings(lib_code, CAPI_str_functs);
  88. ERR_load_strings(lib_code, CAPI_str_reasons);
  89. #endif
  90. error_loaded = 1;
  91. }
  92. return 1;
  93. }
  94. static void ERR_unload_CAPI_strings(void)
  95. {
  96. if (error_loaded) {
  97. #ifndef OPENSSL_NO_ERR
  98. ERR_unload_strings(lib_code, CAPI_str_functs);
  99. ERR_unload_strings(lib_code, CAPI_str_reasons);
  100. #endif
  101. error_loaded = 0;
  102. }
  103. }
  104. static void ERR_CAPI_error(int function, int reason, char *file, int line)
  105. {
  106. if (lib_code == 0)
  107. lib_code = ERR_get_next_error_library();
  108. ERR_PUT_error(lib_code, function, reason, file, line);
  109. }