cversion.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include "internal/cryptlib.h"
  10. #include "buildinf.h"
  11. #if !OPENSSL_API_3
  12. unsigned long OpenSSL_version_num(void)
  13. {
  14. return OPENSSL_VERSION_NUMBER;
  15. }
  16. #endif
  17. unsigned int OPENSSL_version_major(void)
  18. {
  19. return OPENSSL_VERSION_MAJOR;
  20. }
  21. unsigned int OPENSSL_version_minor(void)
  22. {
  23. return OPENSSL_VERSION_MINOR;
  24. }
  25. unsigned int OPENSSL_version_patch(void)
  26. {
  27. return OPENSSL_VERSION_PATCH;
  28. }
  29. const char *OPENSSL_version_pre_release(void)
  30. {
  31. return OPENSSL_VERSION_PRE_RELEASE_STR;
  32. }
  33. const char *OPENSSL_version_build_metadata(void)
  34. {
  35. return OPENSSL_VERSION_BUILD_METADATA_STR;
  36. }
  37. const char *OpenSSL_version(int t)
  38. {
  39. switch (t) {
  40. case OPENSSL_VERSION:
  41. return OPENSSL_VERSION_TEXT;
  42. case OPENSSL_VERSION_STRING:
  43. return OPENSSL_VERSION_STR;
  44. case OPENSSL_FULL_VERSION_STRING:
  45. return OPENSSL_FULL_VERSION_STR;
  46. case OPENSSL_BUILT_ON:
  47. return DATE;
  48. case OPENSSL_CFLAGS:
  49. return compiler_flags;
  50. case OPENSSL_PLATFORM:
  51. return PLATFORM;
  52. case OPENSSL_DIR:
  53. #ifdef OPENSSLDIR
  54. return "OPENSSLDIR: \"" OPENSSLDIR "\"";
  55. #else
  56. return "OPENSSLDIR: N/A";
  57. #endif
  58. case OPENSSL_ENGINES_DIR:
  59. #ifdef ENGINESDIR
  60. return "ENGINESDIR: \"" ENGINESDIR "\"";
  61. #else
  62. return "ENGINESDIR: N/A";
  63. #endif
  64. }
  65. return "not available";
  66. }