]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/cversion.c
Add NEWS entry about deprecation of command line public tools
[thirdparty/openssl.git] / crypto / cversion.c
CommitLineData
2039c421
RS
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
0e9725bc 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
2039c421
RS
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
d02b48c6
RE
8 */
9
b39fc560 10#include "internal/cryptlib.h"
2e0fc875 11
0904e79a 12#include "buildinf.h"
d02b48c6 13
39e46af6 14unsigned long OpenSSL_version_num(void)
0f113f3e 15{
b0700d2c
RS
16 return OPENSSL_VERSION_NUMBER;
17}
3a63dbef
RL
18
19unsigned int OPENSSL_version_major(void)
20{
21 return OPENSSL_VERSION_MAJOR;
22}
23
24unsigned int OPENSSL_version_minor(void)
25{
26 return OPENSSL_VERSION_MINOR;
27}
28
29unsigned int OPENSSL_version_patch(void)
30{
31 return OPENSSL_VERSION_PATCH;
32}
33
34const char *OPENSSL_version_pre_release(void)
35{
26b7cc0d 36 return OPENSSL_VERSION_PRE_RELEASE;
3a63dbef
RL
37}
38
39const char *OPENSSL_version_build_metadata(void)
40{
26b7cc0d 41 return OPENSSL_VERSION_BUILD_METADATA;
3a63dbef 42}
b0700d2c 43
363e941e
BE
44extern char ossl_cpu_info_str[];
45
b0700d2c
RS
46const char *OpenSSL_version(int t)
47{
8a8d9e19
RS
48 switch (t) {
49 case OPENSSL_VERSION:
0f113f3e 50 return OPENSSL_VERSION_TEXT;
3a63dbef
RL
51 case OPENSSL_VERSION_STRING:
52 return OPENSSL_VERSION_STR;
53 case OPENSSL_FULL_VERSION_STRING:
54 return OPENSSL_FULL_VERSION_STR;
8a8d9e19 55 case OPENSSL_BUILT_ON:
26a7d938 56 return DATE;
8a8d9e19
RS
57 case OPENSSL_CFLAGS:
58 return compiler_flags;
59 case OPENSSL_PLATFORM:
26a7d938 60 return PLATFORM;
8a8d9e19 61 case OPENSSL_DIR:
673b3fde 62#ifdef OPENSSLDIR
0f113f3e 63 return "OPENSSLDIR: \"" OPENSSLDIR "\"";
673b3fde 64#else
0f113f3e 65 return "OPENSSLDIR: N/A";
e09621ff 66#endif
8a8d9e19 67 case OPENSSL_ENGINES_DIR:
e09621ff
RL
68#ifdef ENGINESDIR
69 return "ENGINESDIR: \"" ENGINESDIR "\"";
70#else
71 return "ENGINESDIR: N/A";
47ca8338
RL
72#endif
73 case OPENSSL_MODULES_DIR:
74#ifdef MODULESDIR
75 return "MODULESDIR: \"" MODULESDIR "\"";
76#else
77 return "MODULESDIR: N/A";
d02b48c6 78#endif
363e941e
BE
79 case OPENSSL_CPU_INFO:
80 if (OPENSSL_info(OPENSSL_INFO_CPU_SETTINGS) != NULL)
81 return ossl_cpu_info_str;
82 else
83 return "CPUINFO: N/A";
0f113f3e 84 }
26a7d938 85 return "not available";
0f113f3e 86}