t1_lib.c revision 160814
1238825Smm/* ssl/t1_lib.c */ 2238825Smm/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3238825Smm * All rights reserved. 4238825Smm * 5238825Smm * This package is an SSL implementation written 6238825Smm * by Eric Young (eay@cryptsoft.com). 7238825Smm * The implementation was written so as to conform with Netscapes SSL. 8238825Smm * 9238825Smm * This library is free for commercial and non-commercial use as long as 10238825Smm * the following conditions are aheared to. The following conditions 11238825Smm * apply to all code found in this distribution, be it the RC4, RSA, 12238825Smm * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13238825Smm * included with this distribution is covered by the same copyright terms 14238825Smm * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15238825Smm * 16238825Smm * Copyright remains Eric Young's, and as such any Copyright notices in 17238825Smm * the code are not to be removed. 18238825Smm * If this package is used in a product, Eric Young should be given attribution 19238825Smm * as the author of the parts of the library used. 20238825Smm * This can be in the form of a textual message at program startup or 21238825Smm * in documentation (online or textual) provided with the package. 22238825Smm * 23238825Smm * Redistribution and use in source and binary forms, with or without 24238825Smm * modification, are permitted provided that the following conditions 25238825Smm * are met: 26238825Smm * 1. Redistributions of source code must retain the copyright 27238825Smm * notice, this list of conditions and the following disclaimer. 28238825Smm * 2. Redistributions in binary form must reproduce the above copyright 29238825Smm * notice, this list of conditions and the following disclaimer in the 30238825Smm * documentation and/or other materials provided with the distribution. 31238825Smm * 3. All advertising materials mentioning features or use of this software 32238825Smm * must display the following acknowledgement: 33238825Smm * "This product includes cryptographic software written by 34238825Smm * Eric Young (eay@cryptsoft.com)" 35238825Smm * The word 'cryptographic' can be left out if the rouines from the library 36238825Smm * being used are not cryptographic related :-). 37238825Smm * 4. If you include any Windows specific code (or a derivative thereof) from 38238825Smm * the apps directory (application code) you must include an acknowledgement: 39238825Smm * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40238825Smm * 41238825Smm * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42238825Smm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43302001Smm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44238825Smm * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45238825Smm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46238825Smm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47238825Smm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48238825Smm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49238825Smm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50238825Smm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51238825Smm * SUCH DAMAGE. 52238825Smm * 53238825Smm * The licence and distribution terms for any publically available version or 54238825Smm * derivative of this code cannot be changed. i.e. this code cannot simply be 55238825Smm * copied and put under another distribution licence 56238825Smm * [including the GNU Public Licence.] 57238825Smm */ 58238825Smm 59238825Smm#include <stdio.h> 60238825Smm#include <openssl/objects.h> 61238825Smm#include "ssl_locl.h" 62238825Smm 63238825Smmconst char *tls1_version_str="TLSv1" OPENSSL_VERSION_PTEXT; 64238825Smm 65238825SmmSSL3_ENC_METHOD TLSv1_enc_data={ 66238825Smm tls1_enc, 67238825Smm tls1_mac, 68238825Smm tls1_setup_key_block, 69238825Smm tls1_generate_master_secret, 70238825Smm tls1_change_cipher_state, 71238825Smm tls1_final_finish_mac, 72238825Smm TLS1_FINISH_MAC_LENGTH, 73238825Smm tls1_cert_verify_mac, 74238825Smm TLS_MD_CLIENT_FINISH_CONST,TLS_MD_CLIENT_FINISH_CONST_SIZE, 75238825Smm TLS_MD_SERVER_FINISH_CONST,TLS_MD_SERVER_FINISH_CONST_SIZE, 76238825Smm tls1_alert_code, 77238825Smm }; 78238825Smm 79238825Smmlong tls1_default_timeout(void) 80238825Smm { 81238825Smm /* 2 hours, the 24 hours mentioned in the TLSv1 spec 82238825Smm * is way too long for http, the cache would over fill */ 83238825Smm return(60*60*2); 84238825Smm } 85238825Smm 86238825SmmIMPLEMENT_tls1_meth_func(tlsv1_base_method, 87238825Smm ssl_undefined_function, 88238825Smm ssl_undefined_function, 89238825Smm ssl_bad_method) 90238825Smm 91238825Smmint tls1_new(SSL *s) 92238825Smm { 93238825Smm if (!ssl3_new(s)) return(0); 94238825Smm s->method->ssl_clear(s); 95238825Smm return(1); 96348608Smm } 97348608Smm 98348608Smmvoid tls1_free(SSL *s) 99238825Smm { 100238825Smm ssl3_free(s); 101238825Smm } 102238825Smm 103238825Smmvoid tls1_clear(SSL *s) 104238825Smm { 105238825Smm ssl3_clear(s); 106238825Smm s->version=TLS1_VERSION; 107238825Smm } 108238825Smm 109238825Smm#if 0 110238825Smmlong tls1_ctrl(SSL *s, int cmd, long larg, char *parg) 111238825Smm { 112238825Smm return(0); 113238825Smm } 114238825Smm 115238825Smmlong tls1_callback_ctrl(SSL *s, int cmd, void *(*fp)()) 116238825Smm { 117238825Smm return(0); 118238825Smm } 119238825Smm#endif 120238825Smm