]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/cversion.c
Refactor the computation of API version limits
[thirdparty/openssl.git] / crypto / cversion.c
CommitLineData
2039c421
RS
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
2039c421
RS
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
d02b48c6
RE
8 */
9
b39fc560 10#include "internal/cryptlib.h"
2e0fc875 11
0904e79a 12#include "buildinf.h"
d02b48c6 13
fcd2d5a6 14#if !OPENSSL_API_3
39e46af6 15unsigned long OpenSSL_version_num(void)
0f113f3e 16{
b0700d2c
RS
17 return OPENSSL_VERSION_NUMBER;
18}
3a63dbef
RL
19#endif
20
21unsigned int OPENSSL_version_major(void)
22{
23 return OPENSSL_VERSION_MAJOR;
24}
25
26unsigned int OPENSSL_version_minor(void)
27{
28 return OPENSSL_VERSION_MINOR;
29}
30
31unsigned int OPENSSL_version_patch(void)
32{
33 return OPENSSL_VERSION_PATCH;
34}
35
36const char *OPENSSL_version_pre_release(void)
37{
38 return OPENSSL_VERSION_PRE_RELEASE_STR;
39}
40
41const char *OPENSSL_version_build_metadata(void)
42{
43 return OPENSSL_VERSION_BUILD_METADATA_STR;
44}
b0700d2c
RS
45
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";
d02b48c6 72#endif
0f113f3e 73 }
26a7d938 74 return "not available";
0f113f3e 75}