version.c revision 160814
155714Skris/* apps/version.c */ 255714Skris/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 355714Skris * All rights reserved. 455714Skris * 555714Skris * This package is an SSL implementation written 655714Skris * by Eric Young (eay@cryptsoft.com). 755714Skris * The implementation was written so as to conform with Netscapes SSL. 855714Skris * 955714Skris * This library is free for commercial and non-commercial use as long as 1055714Skris * the following conditions are aheared to. The following conditions 1155714Skris * apply to all code found in this distribution, be it the RC4, RSA, 1255714Skris * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1355714Skris * included with this distribution is covered by the same copyright terms 1455714Skris * except that the holder is Tim Hudson (tjh@cryptsoft.com). 1555714Skris * 1655714Skris * Copyright remains Eric Young's, and as such any Copyright notices in 1755714Skris * the code are not to be removed. 1855714Skris * If this package is used in a product, Eric Young should be given attribution 1955714Skris * as the author of the parts of the library used. 2055714Skris * This can be in the form of a textual message at program startup or 2155714Skris * in documentation (online or textual) provided with the package. 2255714Skris * 2355714Skris * Redistribution and use in source and binary forms, with or without 2455714Skris * modification, are permitted provided that the following conditions 2555714Skris * are met: 2655714Skris * 1. Redistributions of source code must retain the copyright 2755714Skris * notice, this list of conditions and the following disclaimer. 2855714Skris * 2. Redistributions in binary form must reproduce the above copyright 2955714Skris * notice, this list of conditions and the following disclaimer in the 3055714Skris * documentation and/or other materials provided with the distribution. 3155714Skris * 3. All advertising materials mentioning features or use of this software 3255714Skris * must display the following acknowledgement: 3355714Skris * "This product includes cryptographic software written by 3455714Skris * Eric Young (eay@cryptsoft.com)" 3555714Skris * The word 'cryptographic' can be left out if the rouines from the library 3655714Skris * being used are not cryptographic related :-). 3755714Skris * 4. If you include any Windows specific code (or a derivative thereof) from 3855714Skris * the apps directory (application code) you must include an acknowledgement: 3955714Skris * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 4055714Skris * 4155714Skris * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4255714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4455714Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5155714Skris * SUCH DAMAGE. 5255714Skris * 5355714Skris * The licence and distribution terms for any publically available version or 5455714Skris * derivative of this code cannot be changed. i.e. this code cannot simply be 5555714Skris * copied and put under another distribution licence 5655714Skris * [including the GNU Public Licence.] 5755714Skris */ 58109998Smarkm/* ==================================================================== 59109998Smarkm * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. 60109998Smarkm * 61109998Smarkm * Redistribution and use in source and binary forms, with or without 62109998Smarkm * modification, are permitted provided that the following conditions 63109998Smarkm * are met: 64109998Smarkm * 65109998Smarkm * 1. Redistributions of source code must retain the above copyright 66109998Smarkm * notice, this list of conditions and the following disclaimer. 67109998Smarkm * 68109998Smarkm * 2. Redistributions in binary form must reproduce the above copyright 69109998Smarkm * notice, this list of conditions and the following disclaimer in 70109998Smarkm * the documentation and/or other materials provided with the 71109998Smarkm * distribution. 72109998Smarkm * 73109998Smarkm * 3. All advertising materials mentioning features or use of this 74109998Smarkm * software must display the following acknowledgment: 75109998Smarkm * "This product includes software developed by the OpenSSL Project 76109998Smarkm * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 77109998Smarkm * 78109998Smarkm * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 79109998Smarkm * endorse or promote products derived from this software without 80109998Smarkm * prior written permission. For written permission, please contact 81109998Smarkm * openssl-core@openssl.org. 82109998Smarkm * 83109998Smarkm * 5. Products derived from this software may not be called "OpenSSL" 84109998Smarkm * nor may "OpenSSL" appear in their names without prior written 85109998Smarkm * permission of the OpenSSL Project. 86109998Smarkm * 87109998Smarkm * 6. Redistributions of any form whatsoever must retain the following 88109998Smarkm * acknowledgment: 89109998Smarkm * "This product includes software developed by the OpenSSL Project 90109998Smarkm * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 91109998Smarkm * 92109998Smarkm * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 93109998Smarkm * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 94109998Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 95109998Smarkm * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 96109998Smarkm * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 97109998Smarkm * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 98109998Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 99109998Smarkm * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100109998Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101109998Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102109998Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103109998Smarkm * OF THE POSSIBILITY OF SUCH DAMAGE. 104109998Smarkm * ==================================================================== 105109998Smarkm * 106109998Smarkm * This product includes cryptographic software written by Eric Young 107109998Smarkm * (eay@cryptsoft.com). This product includes software written by Tim 108109998Smarkm * Hudson (tjh@cryptsoft.com). 109109998Smarkm * 110109998Smarkm */ 11155714Skris 11255714Skris#include <stdio.h> 11355714Skris#include <stdlib.h> 11455714Skris#include <string.h> 11555714Skris#include "apps.h" 11655714Skris#include <openssl/evp.h> 11755714Skris#include <openssl/crypto.h> 118160814Ssimon#include <openssl/bn.h> 119109998Smarkm#ifndef OPENSSL_NO_MD2 120109998Smarkm# include <openssl/md2.h> 121109998Smarkm#endif 122109998Smarkm#ifndef OPENSSL_NO_RC4 123109998Smarkm# include <openssl/rc4.h> 124109998Smarkm#endif 125109998Smarkm#ifndef OPENSSL_NO_DES 126109998Smarkm# include <openssl/des.h> 127109998Smarkm#endif 128109998Smarkm#ifndef OPENSSL_NO_IDEA 129109998Smarkm# include <openssl/idea.h> 130109998Smarkm#endif 131109998Smarkm#ifndef OPENSSL_NO_BF 132109998Smarkm# include <openssl/blowfish.h> 133109998Smarkm#endif 13455714Skris 13555714Skris#undef PROG 13655714Skris#define PROG version_main 13755714Skris 13859191Skrisint MAIN(int, char **); 13959191Skris 14055714Skrisint MAIN(int argc, char **argv) 14155714Skris { 14255714Skris int i,ret=0; 143109998Smarkm int cflags=0,version=0,date=0,options=0,platform=0,dir=0; 14455714Skris 14555714Skris apps_startup(); 14655714Skris 14755714Skris if (bio_err == NULL) 14855714Skris if ((bio_err=BIO_new(BIO_s_file())) != NULL) 14955714Skris BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); 15055714Skris 15155714Skris if (argc == 1) version=1; 15255714Skris for (i=1; i<argc; i++) 15355714Skris { 15455714Skris if (strcmp(argv[i],"-v") == 0) 15555714Skris version=1; 15655714Skris else if (strcmp(argv[i],"-b") == 0) 15755714Skris date=1; 15855714Skris else if (strcmp(argv[i],"-f") == 0) 15955714Skris cflags=1; 16055714Skris else if (strcmp(argv[i],"-o") == 0) 16155714Skris options=1; 16255714Skris else if (strcmp(argv[i],"-p") == 0) 16355714Skris platform=1; 164109998Smarkm else if (strcmp(argv[i],"-d") == 0) 165109998Smarkm dir=1; 16655714Skris else if (strcmp(argv[i],"-a") == 0) 167109998Smarkm date=version=cflags=options=platform=dir=1; 16855714Skris else 16955714Skris { 17055714Skris BIO_printf(bio_err,"usage:version -[avbofp]\n"); 17155714Skris ret=1; 17255714Skris goto end; 17355714Skris } 17455714Skris } 17555714Skris 176160814Ssimon if (version) 177160814Ssimon { 178160814Ssimon if (SSLeay() == SSLEAY_VERSION_NUMBER) 179160814Ssimon { 180160814Ssimon printf("%s\n",SSLeay_version(SSLEAY_VERSION)); 181160814Ssimon } 182160814Ssimon else 183160814Ssimon { 184160814Ssimon printf("%s (Library: %s)\n", 185160814Ssimon OPENSSL_VERSION_TEXT, 186160814Ssimon SSLeay_version(SSLEAY_VERSION)); 187160814Ssimon } 188160814Ssimon } 18955714Skris if (date) printf("%s\n",SSLeay_version(SSLEAY_BUILT_ON)); 19055714Skris if (platform) printf("%s\n",SSLeay_version(SSLEAY_PLATFORM)); 19155714Skris if (options) 19255714Skris { 19355714Skris printf("options: "); 19455714Skris printf("%s ",BN_options()); 195109998Smarkm#ifndef OPENSSL_NO_MD2 19655714Skris printf("%s ",MD2_options()); 19755714Skris#endif 198109998Smarkm#ifndef OPENSSL_NO_RC4 19955714Skris printf("%s ",RC4_options()); 20055714Skris#endif 201109998Smarkm#ifndef OPENSSL_NO_DES 202109998Smarkm printf("%s ",DES_options()); 20355714Skris#endif 204109998Smarkm#ifndef OPENSSL_NO_IDEA 20555714Skris printf("%s ",idea_options()); 20655714Skris#endif 207109998Smarkm#ifndef OPENSSL_NO_BF 20855714Skris printf("%s ",BF_options()); 20955714Skris#endif 21055714Skris printf("\n"); 21155714Skris } 21255714Skris if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS)); 213109998Smarkm if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR)); 21455714Skrisend: 215109998Smarkm apps_shutdown(); 216109998Smarkm OPENSSL_EXIT(ret); 21755714Skris } 218