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