2
0

cversion.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. unsigned long OpenSSL_version_num(void)
  12. {
  13. return OPENSSL_VERSION_NUMBER;
  14. }
  15. unsigned int OPENSSL_version_major(void)
  16. {
  17. return OPENSSL_VERSION_MAJOR;
  18. }
  19. unsigned int OPENSSL_version_minor(void)
  20. {
  21. return OPENSSL_VERSION_MINOR;
  22. }
  23. unsigned int OPENSSL_version_patch(void)
  24. {
  25. return OPENSSL_VERSION_PATCH;
  26. }
  27. const char *OPENSSL_version_pre_release(void)
  28. {
  29. return OPENSSL_VERSION_PRE_RELEASE_STR;
  30. }
  31. const char *OPENSSL_version_build_metadata(void)
  32. {
  33. return OPENSSL_VERSION_BUILD_METADATA_STR;
  34. }
  35. extern char ossl_cpu_info_str[];
  36. const char *OpenSSL_version(int t)
  37. {
  38. switch (t) {
  39. case OPENSSL_VERSION:
  40. return OPENSSL_VERSION_TEXT;
  41. case OPENSSL_VERSION_STRING:
  42. return OPENSSL_VERSION_STR;
  43. case OPENSSL_FULL_VERSION_STRING:
  44. return OPENSSL_FULL_VERSION_STR;
  45. case OPENSSL_BUILT_ON:
  46. return DATE;
  47. case OPENSSL_CFLAGS:
  48. return compiler_flags;
  49. case OPENSSL_PLATFORM:
  50. return PLATFORM;
  51. case OPENSSL_DIR:
  52. #ifdef OPENSSLDIR
  53. return "OPENSSLDIR: \"" OPENSSLDIR "\"";
  54. #else
  55. return "OPENSSLDIR: N/A";
  56. #endif
  57. case OPENSSL_ENGINES_DIR:
  58. #ifdef ENGINESDIR
  59. return "ENGINESDIR: \"" ENGINESDIR "\"";
  60. #else
  61. return "ENGINESDIR: N/A";
  62. #endif
  63. case OPENSSL_MODULES_DIR:
  64. #ifdef MODULESDIR
  65. return "MODULESDIR: \"" MODULESDIR "\"";
  66. #else
  67. return "MODULESDIR: N/A";
  68. #endif
  69. case OPENSSL_CPU_INFO:
  70. if (OPENSSL_info(OPENSSL_INFO_CPU_SETTINGS) != NULL)
  71. return ossl_cpu_info_str;
  72. else
  73. return "CPUINFO: N/A";
  74. }
  75. return "not available";
  76. }