e_capi_err.c 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Generated by util/mkerr.pl DO NOT EDIT
  3. * Copyright 1995-2020 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_reasons[] = {
  14. {ERR_PACK(0, 0, CAPI_R_CANT_CREATE_HASH_OBJECT), "cant create hash object"},
  15. {ERR_PACK(0, 0, CAPI_R_CANT_FIND_CAPI_CONTEXT), "cant find capi context"},
  16. {ERR_PACK(0, 0, CAPI_R_CANT_GET_KEY), "cant get key"},
  17. {ERR_PACK(0, 0, CAPI_R_CANT_SET_HASH_VALUE), "cant set hash value"},
  18. {ERR_PACK(0, 0, CAPI_R_CRYPTACQUIRECONTEXT_ERROR),
  19. "cryptacquirecontext error"},
  20. {ERR_PACK(0, 0, CAPI_R_CRYPTENUMPROVIDERS_ERROR),
  21. "cryptenumproviders error"},
  22. {ERR_PACK(0, 0, CAPI_R_DECRYPT_ERROR), "decrypt error"},
  23. {ERR_PACK(0, 0, CAPI_R_ENGINE_NOT_INITIALIZED), "engine not initialized"},
  24. {ERR_PACK(0, 0, CAPI_R_ENUMCONTAINERS_ERROR), "enumcontainers error"},
  25. {ERR_PACK(0, 0, CAPI_R_ERROR_ADDING_CERT), "error adding cert"},
  26. {ERR_PACK(0, 0, CAPI_R_ERROR_CREATING_STORE), "error creating store"},
  27. {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_FRIENDLY_NAME),
  28. "error getting friendly name"},
  29. {ERR_PACK(0, 0, CAPI_R_ERROR_GETTING_KEY_PROVIDER_INFO),
  30. "error getting key provider info"},
  31. {ERR_PACK(0, 0, CAPI_R_ERROR_OPENING_STORE), "error opening store"},
  32. {ERR_PACK(0, 0, CAPI_R_ERROR_SIGNING_HASH), "error signing hash"},
  33. {ERR_PACK(0, 0, CAPI_R_FILE_OPEN_ERROR), "file open error"},
  34. {ERR_PACK(0, 0, CAPI_R_FUNCTION_NOT_SUPPORTED), "function not supported"},
  35. {ERR_PACK(0, 0, CAPI_R_GETUSERKEY_ERROR), "getuserkey error"},
  36. {ERR_PACK(0, 0, CAPI_R_INVALID_DIGEST_LENGTH), "invalid digest length"},
  37. {ERR_PACK(0, 0, CAPI_R_INVALID_DSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
  38. "invalid dsa public key blob magic number"},
  39. {ERR_PACK(0, 0, CAPI_R_INVALID_LOOKUP_METHOD), "invalid lookup method"},
  40. {ERR_PACK(0, 0, CAPI_R_INVALID_PUBLIC_KEY_BLOB), "invalid public key blob"},
  41. {ERR_PACK(0, 0, CAPI_R_INVALID_RSA_PUBLIC_KEY_BLOB_MAGIC_NUMBER),
  42. "invalid rsa public key blob magic number"},
  43. {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_ERROR), "pubkey export error"},
  44. {ERR_PACK(0, 0, CAPI_R_PUBKEY_EXPORT_LENGTH_ERROR),
  45. "pubkey export length error"},
  46. {ERR_PACK(0, 0, CAPI_R_UNKNOWN_COMMAND), "unknown command"},
  47. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_ALGORITHM_NID),
  48. "unsupported algorithm nid"},
  49. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PADDING), "unsupported padding"},
  50. {ERR_PACK(0, 0, CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM),
  51. "unsupported public key algorithm"},
  52. {ERR_PACK(0, 0, CAPI_R_WIN32_ERROR), "win32 error"},
  53. {0, NULL}
  54. };
  55. #endif
  56. static int lib_code = 0;
  57. static int error_loaded = 0;
  58. static int ERR_load_CAPI_strings(void)
  59. {
  60. if (lib_code == 0)
  61. lib_code = ERR_get_next_error_library();
  62. if (!error_loaded) {
  63. #ifndef OPENSSL_NO_ERR
  64. ERR_load_strings(lib_code, CAPI_str_reasons);
  65. #endif
  66. error_loaded = 1;
  67. }
  68. return 1;
  69. }
  70. static void ERR_unload_CAPI_strings(void)
  71. {
  72. if (error_loaded) {
  73. #ifndef OPENSSL_NO_ERR
  74. ERR_unload_strings(lib_code, CAPI_str_reasons);
  75. #endif
  76. error_loaded = 0;
  77. }
  78. }
  79. static void ERR_CAPI_error(int function, int reason, char *file, int line)
  80. {
  81. if (lib_code == 0)
  82. lib_code = ERR_get_next_error_library();
  83. ERR_raise(lib_code, reason);
  84. ERR_set_debug(file, line, NULL);
  85. }