s2_meth.c revision 55715
1198092Srdivacky/* ssl/s2_meth.c */ 2198092Srdivacky/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3198092Srdivacky * All rights reserved. 4198092Srdivacky * 5198092Srdivacky * This package is an SSL implementation written 6198092Srdivacky * by Eric Young (eay@cryptsoft.com). 7198092Srdivacky * The implementation was written so as to conform with Netscapes SSL. 8198092Srdivacky * 9198092Srdivacky * This library is free for commercial and non-commercial use as long as 10198092Srdivacky * the following conditions are aheared to. The following conditions 11198092Srdivacky * apply to all code found in this distribution, be it the RC4, RSA, 12198092Srdivacky * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13198092Srdivacky * included with this distribution is covered by the same copyright terms 14202379Srdivacky * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15198092Srdivacky * 16198092Srdivacky * Copyright remains Eric Young's, and as such any Copyright notices in 17199482Srdivacky * the code are not to be removed. 18198893Srdivacky * If this package is used in a product, Eric Young should be given attribution 19198893Srdivacky * as the author of the parts of the library used. 20198092Srdivacky * This can be in the form of a textual message at program startup or 21198092Srdivacky * in documentation (online or textual) provided with the package. 22198092Srdivacky * 23198092Srdivacky * Redistribution and use in source and binary forms, with or without 24198092Srdivacky * modification, are permitted provided that the following conditions 25198092Srdivacky * are met: 26198092Srdivacky * 1. Redistributions of source code must retain the copyright 27198092Srdivacky * notice, this list of conditions and the following disclaimer. 28198092Srdivacky * 2. Redistributions in binary form must reproduce the above copyright 29198092Srdivacky * notice, this list of conditions and the following disclaimer in the 30198092Srdivacky * documentation and/or other materials provided with the distribution. 31198092Srdivacky * 3. All advertising materials mentioning features or use of this software 32198092Srdivacky * must display the following acknowledgement: 33198092Srdivacky * "This product includes cryptographic software written by 34198092Srdivacky * Eric Young (eay@cryptsoft.com)" 35198092Srdivacky * The word 'cryptographic' can be left out if the rouines from the library 36198092Srdivacky * being used are not cryptographic related :-). 37198092Srdivacky * 4. If you include any Windows specific code (or a derivative thereof) from 38198092Srdivacky * the apps directory (application code) you must include an acknowledgement: 39198092Srdivacky * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40198092Srdivacky * 41198092Srdivacky * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42198092Srdivacky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43198092Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44198092Srdivacky * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45198092Srdivacky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46198092Srdivacky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47198092Srdivacky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48198092Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49200583Srdivacky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50200583Srdivacky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51200583Srdivacky * SUCH DAMAGE. 52200583Srdivacky * 53200583Srdivacky * The licence and distribution terms for any publically available version or 54200583Srdivacky * derivative of this code cannot be changed. i.e. this code cannot simply be 55200583Srdivacky * copied and put under another distribution licence 56200583Srdivacky * [including the GNU Public Licence.] 57200583Srdivacky */ 58200583Srdivacky 59200583Srdivacky#ifndef NO_RSA 60200583Srdivacky#include <stdio.h> 61200583Srdivacky#include <openssl/objects.h> 62200583Srdivacky#include "ssl_locl.h" 63200583Srdivacky 64200583Srdivackystatic SSL_METHOD *ssl2_get_method(int ver); 65200583Srdivackystatic SSL_METHOD *ssl2_get_method(int ver) 66200583Srdivacky { 67200583Srdivacky if (ver == SSL2_VERSION) 68200583Srdivacky return(SSLv2_method()); 69200583Srdivacky else 70200583Srdivacky return(NULL); 71200583Srdivacky } 72200583Srdivacky 73200583SrdivackySSL_METHOD *SSLv2_method(void) 74200583Srdivacky { 75200583Srdivacky static int init=1; 76200583Srdivacky static SSL_METHOD SSLv2_data; 77200583Srdivacky 78200583Srdivacky if (init) 79200583Srdivacky { 80200583Srdivacky memcpy((char *)&SSLv2_data,(char *)sslv2_base_method(), 81200583Srdivacky sizeof(SSL_METHOD)); 82200583Srdivacky SSLv2_data.ssl_connect=ssl2_connect; 83200583Srdivacky SSLv2_data.ssl_accept=ssl2_accept; 84200583Srdivacky SSLv2_data.get_ssl_method=ssl2_get_method; 85200583Srdivacky init=0; 86200583Srdivacky } 87200583Srdivacky return(&SSLv2_data); 88200583Srdivacky } 89200583Srdivacky#endif 90200583Srdivacky