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. 8280304Sjkim * 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). 15280304Sjkim * 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. 22280304Sjkim * 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 :-). 37280304Sjkim * 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)" 40280304Sjkim * 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. 52280304Sjkim * 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 66280304Sjkim * 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 136280304Sjkim#define PROG version_main 13755714Skris 13859191Skrisint MAIN(int, char **); 13959191Skris 14055714Skrisint MAIN(int argc, char **argv) 141280304Sjkim{ 142280304Sjkim int i, ret = 0; 143280304Sjkim int cflags = 0, version = 0, date = 0, options = 0, platform = 0, dir = 0; 14455714Skris 145280304Sjkim apps_startup(); 14655714Skris 147280304Sjkim if (bio_err == NULL) 148280304Sjkim if ((bio_err = BIO_new(BIO_s_file())) != NULL) 149280304Sjkim BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT); 15055714Skris 151280304Sjkim if (argc == 1) 152280304Sjkim version = 1; 153280304Sjkim for (i = 1; i < argc; i++) { 154280304Sjkim if (strcmp(argv[i], "-v") == 0) 155280304Sjkim version = 1; 156280304Sjkim else if (strcmp(argv[i], "-b") == 0) 157280304Sjkim date = 1; 158280304Sjkim else if (strcmp(argv[i], "-f") == 0) 159280304Sjkim cflags = 1; 160280304Sjkim else if (strcmp(argv[i], "-o") == 0) 161280304Sjkim options = 1; 162280304Sjkim else if (strcmp(argv[i], "-p") == 0) 163280304Sjkim platform = 1; 164280304Sjkim else if (strcmp(argv[i], "-d") == 0) 165280304Sjkim dir = 1; 166280304Sjkim else if (strcmp(argv[i], "-a") == 0) 167280304Sjkim date = version = cflags = options = platform = dir = 1; 168280304Sjkim else { 169280304Sjkim BIO_printf(bio_err, "usage:version -[avbofpd]\n"); 170280304Sjkim ret = 1; 171280304Sjkim goto end; 172280304Sjkim } 173280304Sjkim } 17455714Skris 175280304Sjkim if (version) { 176280304Sjkim if (SSLeay() == SSLEAY_VERSION_NUMBER) { 177280304Sjkim printf("%s\n", SSLeay_version(SSLEAY_VERSION)); 178280304Sjkim } else { 179280304Sjkim printf("%s (Library: %s)\n", 180280304Sjkim OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); 181280304Sjkim } 182280304Sjkim } 183280304Sjkim if (date) 184280304Sjkim printf("%s\n", SSLeay_version(SSLEAY_BUILT_ON)); 185280304Sjkim if (platform) 186280304Sjkim printf("%s\n", SSLeay_version(SSLEAY_PLATFORM)); 187280304Sjkim if (options) { 188280304Sjkim printf("options: "); 189280304Sjkim printf("%s ", BN_options()); 190109998Smarkm#ifndef OPENSSL_NO_MD2 191280304Sjkim printf("%s ", MD2_options()); 19255714Skris#endif 193109998Smarkm#ifndef OPENSSL_NO_RC4 194280304Sjkim printf("%s ", RC4_options()); 19555714Skris#endif 196109998Smarkm#ifndef OPENSSL_NO_DES 197280304Sjkim printf("%s ", DES_options()); 19855714Skris#endif 199109998Smarkm#ifndef OPENSSL_NO_IDEA 200280304Sjkim printf("%s ", idea_options()); 20155714Skris#endif 202109998Smarkm#ifndef OPENSSL_NO_BF 203280304Sjkim printf("%s ", BF_options()); 20455714Skris#endif 205280304Sjkim printf("\n"); 206280304Sjkim } 207280304Sjkim if (cflags) 208280304Sjkim printf("%s\n", SSLeay_version(SSLEAY_CFLAGS)); 209280304Sjkim if (dir) 210280304Sjkim printf("%s\n", SSLeay_version(SSLEAY_DIR)); 211280304Sjkim end: 212280304Sjkim apps_shutdown(); 213280304Sjkim OPENSSL_EXIT(ret); 214280304Sjkim} 215