cversion.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. #ifndef NO_WINDOWS_BRAINDEATH
  11. # include "buildinf.h"
  12. #endif
  13. unsigned long OpenSSL_version_num(void)
  14. {
  15. return OPENSSL_VERSION_NUMBER;
  16. }
  17. const char *OpenSSL_version(int t)
  18. {
  19. if (t == OPENSSL_VERSION)
  20. return OPENSSL_VERSION_TEXT;
  21. if (t == OPENSSL_BUILT_ON) {
  22. #ifdef DATE
  23. # ifdef OPENSSL_USE_BUILD_DATE
  24. return (DATE);
  25. # else
  26. return ("built on: reproducible build, date unspecified");
  27. # endif
  28. #else
  29. return ("built on: date not available");
  30. #endif
  31. }
  32. if (t == OPENSSL_CFLAGS) {
  33. #ifdef CFLAGS
  34. return (CFLAGS);
  35. #else
  36. return ("compiler: information not available");
  37. #endif
  38. }
  39. if (t == OPENSSL_PLATFORM) {
  40. #ifdef PLATFORM
  41. return (PLATFORM);
  42. #else
  43. return ("platform: information not available");
  44. #endif
  45. }
  46. if (t == OPENSSL_DIR) {
  47. #ifdef OPENSSLDIR
  48. return "OPENSSLDIR: \"" OPENSSLDIR "\"";
  49. #else
  50. return "OPENSSLDIR: N/A";
  51. #endif
  52. }
  53. if (t == OPENSSL_ENGINES_DIR) {
  54. #ifdef ENGINESDIR
  55. return "ENGINESDIR: \"" ENGINESDIR "\"";
  56. #else
  57. return "ENGINESDIR: N/A";
  58. #endif
  59. }
  60. return ("not available");
  61. }