]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/cversion.c
Add CPU info to the speed command summary
[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
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 45
363e941e
BE
46extern char ossl_cpu_info_str[];
47
b0700d2c
RS
48const char *OpenSSL_version(int t)
49{
8a8d9e19
RS
50 switch (t) {
51 case OPENSSL_VERSION:
0f113f3e 52 return OPENSSL_VERSION_TEXT;
3a63dbef
RL
53 case OPENSSL_VERSION_STRING:
54 return OPENSSL_VERSION_STR;
55 case OPENSSL_FULL_VERSION_STRING:
56 return OPENSSL_FULL_VERSION_STR;
8a8d9e19 57 case OPENSSL_BUILT_ON:
26a7d938 58 return DATE;
8a8d9e19
RS
59 case OPENSSL_CFLAGS:
60 return compiler_flags;
61 case OPENSSL_PLATFORM:
26a7d938 62 return PLATFORM;
8a8d9e19 63 case OPENSSL_DIR:
673b3fde 64#ifdef OPENSSLDIR
0f113f3e 65 return "OPENSSLDIR: \"" OPENSSLDIR "\"";
673b3fde 66#else
0f113f3e 67 return "OPENSSLDIR: N/A";
e09621ff 68#endif
8a8d9e19 69 case OPENSSL_ENGINES_DIR:
e09621ff
RL
70#ifdef ENGINESDIR
71 return "ENGINESDIR: \"" ENGINESDIR "\"";
72#else
73 return "ENGINESDIR: N/A";
47ca8338
RL
74#endif
75 case OPENSSL_MODULES_DIR:
76#ifdef MODULESDIR
77 return "MODULESDIR: \"" MODULESDIR "\"";
78#else
79 return "MODULESDIR: N/A";
d02b48c6 80#endif
363e941e
BE
81 case OPENSSL_CPU_INFO:
82 if (OPENSSL_info(OPENSSL_INFO_CPU_SETTINGS) != NULL)
83 return ossl_cpu_info_str;
84 else
85 return "CPUINFO: N/A";
0f113f3e 86 }
26a7d938 87 return "not available";
0f113f3e 88}