10Sstevel@tonic-gate /* apps/version.c */
20Sstevel@tonic-gate /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
30Sstevel@tonic-gate * All rights reserved.
40Sstevel@tonic-gate *
50Sstevel@tonic-gate * This package is an SSL implementation written
60Sstevel@tonic-gate * by Eric Young (eay@cryptsoft.com).
70Sstevel@tonic-gate * The implementation was written so as to conform with Netscapes SSL.
80Sstevel@tonic-gate *
90Sstevel@tonic-gate * This library is free for commercial and non-commercial use as long as
100Sstevel@tonic-gate * the following conditions are aheared to. The following conditions
110Sstevel@tonic-gate * apply to all code found in this distribution, be it the RC4, RSA,
120Sstevel@tonic-gate * lhash, DES, etc., code; not just the SSL code. The SSL documentation
130Sstevel@tonic-gate * included with this distribution is covered by the same copyright terms
140Sstevel@tonic-gate * except that the holder is Tim Hudson (tjh@cryptsoft.com).
150Sstevel@tonic-gate *
160Sstevel@tonic-gate * Copyright remains Eric Young's, and as such any Copyright notices in
170Sstevel@tonic-gate * the code are not to be removed.
180Sstevel@tonic-gate * If this package is used in a product, Eric Young should be given attribution
190Sstevel@tonic-gate * as the author of the parts of the library used.
200Sstevel@tonic-gate * This can be in the form of a textual message at program startup or
210Sstevel@tonic-gate * in documentation (online or textual) provided with the package.
220Sstevel@tonic-gate *
230Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without
240Sstevel@tonic-gate * modification, are permitted provided that the following conditions
250Sstevel@tonic-gate * are met:
260Sstevel@tonic-gate * 1. Redistributions of source code must retain the copyright
270Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer.
280Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright
290Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the
300Sstevel@tonic-gate * documentation and/or other materials provided with the distribution.
310Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this software
320Sstevel@tonic-gate * must display the following acknowledgement:
330Sstevel@tonic-gate * "This product includes cryptographic software written by
340Sstevel@tonic-gate * Eric Young (eay@cryptsoft.com)"
350Sstevel@tonic-gate * The word 'cryptographic' can be left out if the rouines from the library
360Sstevel@tonic-gate * being used are not cryptographic related :-).
370Sstevel@tonic-gate * 4. If you include any Windows specific code (or a derivative thereof) from
380Sstevel@tonic-gate * the apps directory (application code) you must include an acknowledgement:
390Sstevel@tonic-gate * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
400Sstevel@tonic-gate *
410Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
420Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
430Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
440Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
450Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
460Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
470Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
480Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
490Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
500Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
510Sstevel@tonic-gate * SUCH DAMAGE.
520Sstevel@tonic-gate *
530Sstevel@tonic-gate * The licence and distribution terms for any publically available version or
540Sstevel@tonic-gate * derivative of this code cannot be changed. i.e. this code cannot simply be
550Sstevel@tonic-gate * copied and put under another distribution licence
560Sstevel@tonic-gate * [including the GNU Public Licence.]
570Sstevel@tonic-gate */
580Sstevel@tonic-gate /* ====================================================================
590Sstevel@tonic-gate * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
600Sstevel@tonic-gate *
610Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without
620Sstevel@tonic-gate * modification, are permitted provided that the following conditions
630Sstevel@tonic-gate * are met:
640Sstevel@tonic-gate *
650Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright
660Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer.
670Sstevel@tonic-gate *
680Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright
690Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in
700Sstevel@tonic-gate * the documentation and/or other materials provided with the
710Sstevel@tonic-gate * distribution.
720Sstevel@tonic-gate *
730Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this
740Sstevel@tonic-gate * software must display the following acknowledgment:
750Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project
760Sstevel@tonic-gate * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
770Sstevel@tonic-gate *
780Sstevel@tonic-gate * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
790Sstevel@tonic-gate * endorse or promote products derived from this software without
800Sstevel@tonic-gate * prior written permission. For written permission, please contact
810Sstevel@tonic-gate * openssl-core@openssl.org.
820Sstevel@tonic-gate *
830Sstevel@tonic-gate * 5. Products derived from this software may not be called "OpenSSL"
840Sstevel@tonic-gate * nor may "OpenSSL" appear in their names without prior written
850Sstevel@tonic-gate * permission of the OpenSSL Project.
860Sstevel@tonic-gate *
870Sstevel@tonic-gate * 6. Redistributions of any form whatsoever must retain the following
880Sstevel@tonic-gate * acknowledgment:
890Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project
900Sstevel@tonic-gate * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
910Sstevel@tonic-gate *
920Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
930Sstevel@tonic-gate * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
940Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
950Sstevel@tonic-gate * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
960Sstevel@tonic-gate * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
970Sstevel@tonic-gate * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
980Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
990Sstevel@tonic-gate * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1000Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1010Sstevel@tonic-gate * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1020Sstevel@tonic-gate * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1030Sstevel@tonic-gate * OF THE POSSIBILITY OF SUCH DAMAGE.
1040Sstevel@tonic-gate * ====================================================================
1050Sstevel@tonic-gate *
1060Sstevel@tonic-gate * This product includes cryptographic software written by Eric Young
1070Sstevel@tonic-gate * (eay@cryptsoft.com). This product includes software written by Tim
1080Sstevel@tonic-gate * Hudson (tjh@cryptsoft.com).
1090Sstevel@tonic-gate *
1100Sstevel@tonic-gate */
1110Sstevel@tonic-gate
1120Sstevel@tonic-gate #include <stdio.h>
1130Sstevel@tonic-gate #include <stdlib.h>
1140Sstevel@tonic-gate #include <string.h>
1150Sstevel@tonic-gate #include "apps.h"
1160Sstevel@tonic-gate #include <openssl/evp.h>
1170Sstevel@tonic-gate #include <openssl/crypto.h>
118*2139Sjp161948 #include <openssl/bn.h>
1190Sstevel@tonic-gate #ifndef OPENSSL_NO_MD2
1200Sstevel@tonic-gate # include <openssl/md2.h>
1210Sstevel@tonic-gate #endif
1220Sstevel@tonic-gate #ifndef OPENSSL_NO_RC4
1230Sstevel@tonic-gate # include <openssl/rc4.h>
1240Sstevel@tonic-gate #endif
1250Sstevel@tonic-gate #ifndef OPENSSL_NO_DES
1260Sstevel@tonic-gate # include <openssl/des.h>
1270Sstevel@tonic-gate #endif
1280Sstevel@tonic-gate #ifndef OPENSSL_NO_IDEA
1290Sstevel@tonic-gate # include <openssl/idea.h>
1300Sstevel@tonic-gate #endif
1310Sstevel@tonic-gate #ifndef OPENSSL_NO_BF
1320Sstevel@tonic-gate # include <openssl/blowfish.h>
1330Sstevel@tonic-gate #endif
1340Sstevel@tonic-gate
1350Sstevel@tonic-gate #undef PROG
1360Sstevel@tonic-gate #define PROG version_main
1370Sstevel@tonic-gate
1380Sstevel@tonic-gate int MAIN(int, char **);
1390Sstevel@tonic-gate
MAIN(int argc,char ** argv)1400Sstevel@tonic-gate int MAIN(int argc, char **argv)
1410Sstevel@tonic-gate {
1420Sstevel@tonic-gate int i,ret=0;
1430Sstevel@tonic-gate int cflags=0,version=0,date=0,options=0,platform=0,dir=0;
1440Sstevel@tonic-gate
1450Sstevel@tonic-gate apps_startup();
1460Sstevel@tonic-gate
1470Sstevel@tonic-gate if (bio_err == NULL)
1480Sstevel@tonic-gate if ((bio_err=BIO_new(BIO_s_file())) != NULL)
1490Sstevel@tonic-gate BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
1500Sstevel@tonic-gate
1510Sstevel@tonic-gate if (argc == 1) version=1;
1520Sstevel@tonic-gate for (i=1; i<argc; i++)
1530Sstevel@tonic-gate {
1540Sstevel@tonic-gate if (strcmp(argv[i],"-v") == 0)
1550Sstevel@tonic-gate version=1;
1560Sstevel@tonic-gate else if (strcmp(argv[i],"-b") == 0)
1570Sstevel@tonic-gate date=1;
1580Sstevel@tonic-gate else if (strcmp(argv[i],"-f") == 0)
1590Sstevel@tonic-gate cflags=1;
1600Sstevel@tonic-gate else if (strcmp(argv[i],"-o") == 0)
1610Sstevel@tonic-gate options=1;
1620Sstevel@tonic-gate else if (strcmp(argv[i],"-p") == 0)
1630Sstevel@tonic-gate platform=1;
1640Sstevel@tonic-gate else if (strcmp(argv[i],"-d") == 0)
1650Sstevel@tonic-gate dir=1;
1660Sstevel@tonic-gate else if (strcmp(argv[i],"-a") == 0)
1670Sstevel@tonic-gate date=version=cflags=options=platform=dir=1;
1680Sstevel@tonic-gate else
1690Sstevel@tonic-gate {
1700Sstevel@tonic-gate BIO_printf(bio_err,"usage:version -[avbofp]\n");
1710Sstevel@tonic-gate ret=1;
1720Sstevel@tonic-gate goto end;
1730Sstevel@tonic-gate }
1740Sstevel@tonic-gate }
1750Sstevel@tonic-gate
176*2139Sjp161948 if (version)
177*2139Sjp161948 {
178*2139Sjp161948 if (SSLeay() == SSLEAY_VERSION_NUMBER)
179*2139Sjp161948 {
180*2139Sjp161948 printf("%s\n",SSLeay_version(SSLEAY_VERSION));
181*2139Sjp161948 }
182*2139Sjp161948 else
183*2139Sjp161948 {
184*2139Sjp161948 printf("%s (Library: %s)\n",
185*2139Sjp161948 OPENSSL_VERSION_TEXT,
186*2139Sjp161948 SSLeay_version(SSLEAY_VERSION));
187*2139Sjp161948 }
188*2139Sjp161948 }
1890Sstevel@tonic-gate if (date) printf("%s\n",SSLeay_version(SSLEAY_BUILT_ON));
1900Sstevel@tonic-gate if (platform) printf("%s\n",SSLeay_version(SSLEAY_PLATFORM));
1910Sstevel@tonic-gate if (options)
1920Sstevel@tonic-gate {
1930Sstevel@tonic-gate printf("options: ");
1940Sstevel@tonic-gate printf("%s ",BN_options());
1950Sstevel@tonic-gate #ifndef OPENSSL_NO_MD2
1960Sstevel@tonic-gate printf("%s ",MD2_options());
1970Sstevel@tonic-gate #endif
1980Sstevel@tonic-gate #ifndef OPENSSL_NO_RC4
1990Sstevel@tonic-gate printf("%s ",RC4_options());
2000Sstevel@tonic-gate #endif
2010Sstevel@tonic-gate #ifndef OPENSSL_NO_DES
2020Sstevel@tonic-gate printf("%s ",DES_options());
2030Sstevel@tonic-gate #endif
2040Sstevel@tonic-gate #ifndef OPENSSL_NO_IDEA
2050Sstevel@tonic-gate printf("%s ",idea_options());
2060Sstevel@tonic-gate #endif
2070Sstevel@tonic-gate #ifndef OPENSSL_NO_BF
2080Sstevel@tonic-gate printf("%s ",BF_options());
2090Sstevel@tonic-gate #endif
2100Sstevel@tonic-gate printf("\n");
2110Sstevel@tonic-gate }
2120Sstevel@tonic-gate if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
2130Sstevel@tonic-gate if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
2140Sstevel@tonic-gate end:
2150Sstevel@tonic-gate apps_shutdown();
2160Sstevel@tonic-gate OPENSSL_EXIT(ret);
2170Sstevel@tonic-gate }
218