xref: /dragonfly/crypto/libressl/crypto/cversion.c (revision 72c33676)
172c33676SMaxim Ag /* $OpenBSD: cversion.c,v 1.17 2018/02/17 06:56:12 jsing Exp $ */
2f5b1c8a1SJohn Marino /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3f5b1c8a1SJohn Marino  * All rights reserved.
4f5b1c8a1SJohn Marino  *
5f5b1c8a1SJohn Marino  * This package is an SSL implementation written
6f5b1c8a1SJohn Marino  * by Eric Young (eay@cryptsoft.com).
7f5b1c8a1SJohn Marino  * The implementation was written so as to conform with Netscapes SSL.
8f5b1c8a1SJohn Marino  *
9f5b1c8a1SJohn Marino  * This library is free for commercial and non-commercial use as long as
10f5b1c8a1SJohn Marino  * the following conditions are aheared to.  The following conditions
11f5b1c8a1SJohn Marino  * apply to all code found in this distribution, be it the RC4, RSA,
12f5b1c8a1SJohn Marino  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13f5b1c8a1SJohn Marino  * included with this distribution is covered by the same copyright terms
14f5b1c8a1SJohn Marino  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15f5b1c8a1SJohn Marino  *
16f5b1c8a1SJohn Marino  * Copyright remains Eric Young's, and as such any Copyright notices in
17f5b1c8a1SJohn Marino  * the code are not to be removed.
18f5b1c8a1SJohn Marino  * If this package is used in a product, Eric Young should be given attribution
19f5b1c8a1SJohn Marino  * as the author of the parts of the library used.
20f5b1c8a1SJohn Marino  * This can be in the form of a textual message at program startup or
21f5b1c8a1SJohn Marino  * in documentation (online or textual) provided with the package.
22f5b1c8a1SJohn Marino  *
23f5b1c8a1SJohn Marino  * Redistribution and use in source and binary forms, with or without
24f5b1c8a1SJohn Marino  * modification, are permitted provided that the following conditions
25f5b1c8a1SJohn Marino  * are met:
26f5b1c8a1SJohn Marino  * 1. Redistributions of source code must retain the copyright
27f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer.
28f5b1c8a1SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
29f5b1c8a1SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
30f5b1c8a1SJohn Marino  *    documentation and/or other materials provided with the distribution.
31f5b1c8a1SJohn Marino  * 3. All advertising materials mentioning features or use of this software
32f5b1c8a1SJohn Marino  *    must display the following acknowledgement:
33f5b1c8a1SJohn Marino  *    "This product includes cryptographic software written by
34f5b1c8a1SJohn Marino  *     Eric Young (eay@cryptsoft.com)"
35f5b1c8a1SJohn Marino  *    The word 'cryptographic' can be left out if the rouines from the library
36f5b1c8a1SJohn Marino  *    being used are not cryptographic related :-).
37f5b1c8a1SJohn Marino  * 4. If you include any Windows specific code (or a derivative thereof) from
38f5b1c8a1SJohn Marino  *    the apps directory (application code) you must include an acknowledgement:
39f5b1c8a1SJohn Marino  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40f5b1c8a1SJohn Marino  *
41f5b1c8a1SJohn Marino  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42f5b1c8a1SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43f5b1c8a1SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44f5b1c8a1SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45f5b1c8a1SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46f5b1c8a1SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47f5b1c8a1SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48f5b1c8a1SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49f5b1c8a1SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50f5b1c8a1SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51f5b1c8a1SJohn Marino  * SUCH DAMAGE.
52f5b1c8a1SJohn Marino  *
53f5b1c8a1SJohn Marino  * The licence and distribution terms for any publically available version or
54f5b1c8a1SJohn Marino  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55f5b1c8a1SJohn Marino  * copied and put under another distribution licence
56f5b1c8a1SJohn Marino  * [including the GNU Public Licence.]
57f5b1c8a1SJohn Marino  */
58f5b1c8a1SJohn Marino 
59f5b1c8a1SJohn Marino #include <openssl/crypto.h>
60f5b1c8a1SJohn Marino #include <openssl/opensslv.h>
61f5b1c8a1SJohn Marino 
62f5b1c8a1SJohn Marino #include "cryptlib.h"
63f5b1c8a1SJohn Marino 
64f5b1c8a1SJohn Marino const char *
SSLeay_version(int t)65f5b1c8a1SJohn Marino SSLeay_version(int t)
66f5b1c8a1SJohn Marino {
67f5b1c8a1SJohn Marino 	switch (t) {
68f5b1c8a1SJohn Marino 	case SSLEAY_VERSION:
69f5b1c8a1SJohn Marino 		return OPENSSL_VERSION_TEXT;
70f5b1c8a1SJohn Marino 	case SSLEAY_BUILT_ON:
71f5b1c8a1SJohn Marino 		return("built on: date not available");
72f5b1c8a1SJohn Marino 	case SSLEAY_CFLAGS:
73f5b1c8a1SJohn Marino 		return("compiler: information not available");
74f5b1c8a1SJohn Marino 	case SSLEAY_PLATFORM:
75f5b1c8a1SJohn Marino 		return("platform: information not available");
76f5b1c8a1SJohn Marino 	case SSLEAY_DIR:
77f5b1c8a1SJohn Marino 		return "OPENSSLDIR: \"" OPENSSLDIR "\"";
78f5b1c8a1SJohn Marino 	}
79f5b1c8a1SJohn Marino 	return("not available");
80f5b1c8a1SJohn Marino }
81f5b1c8a1SJohn Marino 
82f5b1c8a1SJohn Marino unsigned long
SSLeay(void)83f5b1c8a1SJohn Marino SSLeay(void)
84f5b1c8a1SJohn Marino {
85f5b1c8a1SJohn Marino 	return (SSLEAY_VERSION_NUMBER);
86f5b1c8a1SJohn Marino }
8772c33676SMaxim Ag 
8872c33676SMaxim Ag const char *
OpenSSL_version(int t)8972c33676SMaxim Ag OpenSSL_version(int t)
9072c33676SMaxim Ag {
9172c33676SMaxim Ag 	switch (t) {
9272c33676SMaxim Ag 	case OPENSSL_VERSION:
9372c33676SMaxim Ag 		return OPENSSL_VERSION_TEXT;
9472c33676SMaxim Ag 	case OPENSSL_BUILT_ON:
9572c33676SMaxim Ag 		return("built on: date not available");
9672c33676SMaxim Ag 	case OPENSSL_CFLAGS:
9772c33676SMaxim Ag 		return("compiler: information not available");
9872c33676SMaxim Ag 	case OPENSSL_PLATFORM:
9972c33676SMaxim Ag 		return("platform: information not available");
10072c33676SMaxim Ag 	case OPENSSL_DIR:
10172c33676SMaxim Ag 		return "OPENSSLDIR: \"" OPENSSLDIR "\"";
10272c33676SMaxim Ag 	case OPENSSL_ENGINES_DIR:
10372c33676SMaxim Ag 		return "ENGINESDIR: N/A";
10472c33676SMaxim Ag 	}
10572c33676SMaxim Ag 	return("not available");
10672c33676SMaxim Ag }
10772c33676SMaxim Ag 
10872c33676SMaxim Ag unsigned long
OpenSSL_version_num(void)10972c33676SMaxim Ag OpenSSL_version_num(void)
11072c33676SMaxim Ag {
11172c33676SMaxim Ag 	return SSLeay();
11272c33676SMaxim Ag }
113