174664626SKris Kennaway /* ssl/t1_lib.c */ 274664626SKris Kennaway /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 374664626SKris Kennaway * All rights reserved. 474664626SKris Kennaway * 574664626SKris Kennaway * This package is an SSL implementation written 674664626SKris Kennaway * by Eric Young (eay@cryptsoft.com). 774664626SKris Kennaway * The implementation was written so as to conform with Netscapes SSL. 874664626SKris Kennaway * 974664626SKris Kennaway * This library is free for commercial and non-commercial use as long as 1074664626SKris Kennaway * the following conditions are aheared to. The following conditions 1174664626SKris Kennaway * apply to all code found in this distribution, be it the RC4, RSA, 1274664626SKris Kennaway * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1374664626SKris Kennaway * included with this distribution is covered by the same copyright terms 1474664626SKris Kennaway * except that the holder is Tim Hudson (tjh@cryptsoft.com). 1574664626SKris Kennaway * 1674664626SKris Kennaway * Copyright remains Eric Young's, and as such any Copyright notices in 1774664626SKris Kennaway * the code are not to be removed. 1874664626SKris Kennaway * If this package is used in a product, Eric Young should be given attribution 1974664626SKris Kennaway * as the author of the parts of the library used. 2074664626SKris Kennaway * This can be in the form of a textual message at program startup or 2174664626SKris Kennaway * in documentation (online or textual) provided with the package. 2274664626SKris Kennaway * 2374664626SKris Kennaway * Redistribution and use in source and binary forms, with or without 2474664626SKris Kennaway * modification, are permitted provided that the following conditions 2574664626SKris Kennaway * are met: 2674664626SKris Kennaway * 1. Redistributions of source code must retain the copyright 2774664626SKris Kennaway * notice, this list of conditions and the following disclaimer. 2874664626SKris Kennaway * 2. Redistributions in binary form must reproduce the above copyright 2974664626SKris Kennaway * notice, this list of conditions and the following disclaimer in the 3074664626SKris Kennaway * documentation and/or other materials provided with the distribution. 3174664626SKris Kennaway * 3. All advertising materials mentioning features or use of this software 3274664626SKris Kennaway * must display the following acknowledgement: 3374664626SKris Kennaway * "This product includes cryptographic software written by 3474664626SKris Kennaway * Eric Young (eay@cryptsoft.com)" 3574664626SKris Kennaway * The word 'cryptographic' can be left out if the rouines from the library 3674664626SKris Kennaway * being used are not cryptographic related :-). 3774664626SKris Kennaway * 4. If you include any Windows specific code (or a derivative thereof) from 3874664626SKris Kennaway * the apps directory (application code) you must include an acknowledgement: 3974664626SKris Kennaway * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 4074664626SKris Kennaway * 4174664626SKris Kennaway * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4274664626SKris Kennaway * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4374664626SKris Kennaway * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4474664626SKris Kennaway * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4574664626SKris Kennaway * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4674664626SKris Kennaway * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4774664626SKris Kennaway * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4874664626SKris Kennaway * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4974664626SKris Kennaway * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5074664626SKris Kennaway * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5174664626SKris Kennaway * SUCH DAMAGE. 5274664626SKris Kennaway * 5374664626SKris Kennaway * The licence and distribution terms for any publically available version or 5474664626SKris Kennaway * derivative of this code cannot be changed. i.e. this code cannot simply be 5574664626SKris Kennaway * copied and put under another distribution licence 5674664626SKris Kennaway * [including the GNU Public Licence.] 5774664626SKris Kennaway */ 5874664626SKris Kennaway 5974664626SKris Kennaway #include <stdio.h> 6074664626SKris Kennaway #include <openssl/objects.h> 6174664626SKris Kennaway #include "ssl_locl.h" 6274664626SKris Kennaway 63f579bf8eSKris Kennaway const char *tls1_version_str="TLSv1" OPENSSL_VERSION_PTEXT; 6474664626SKris Kennaway 6574664626SKris Kennaway static long tls1_default_timeout(void); 6674664626SKris Kennaway 6774664626SKris Kennaway static SSL3_ENC_METHOD TLSv1_enc_data={ 6874664626SKris Kennaway tls1_enc, 6974664626SKris Kennaway tls1_mac, 7074664626SKris Kennaway tls1_setup_key_block, 7174664626SKris Kennaway tls1_generate_master_secret, 7274664626SKris Kennaway tls1_change_cipher_state, 7374664626SKris Kennaway tls1_final_finish_mac, 7474664626SKris Kennaway TLS1_FINISH_MAC_LENGTH, 7574664626SKris Kennaway tls1_cert_verify_mac, 7674664626SKris Kennaway TLS_MD_CLIENT_FINISH_CONST,TLS_MD_CLIENT_FINISH_CONST_SIZE, 7774664626SKris Kennaway TLS_MD_SERVER_FINISH_CONST,TLS_MD_SERVER_FINISH_CONST_SIZE, 7874664626SKris Kennaway tls1_alert_code, 7974664626SKris Kennaway }; 8074664626SKris Kennaway 8174664626SKris Kennaway static SSL_METHOD TLSv1_data= { 8274664626SKris Kennaway TLS1_VERSION, 8374664626SKris Kennaway tls1_new, 8474664626SKris Kennaway tls1_clear, 8574664626SKris Kennaway tls1_free, 8674664626SKris Kennaway ssl_undefined_function, 8774664626SKris Kennaway ssl_undefined_function, 8874664626SKris Kennaway ssl3_read, 8974664626SKris Kennaway ssl3_peek, 9074664626SKris Kennaway ssl3_write, 9174664626SKris Kennaway ssl3_shutdown, 9274664626SKris Kennaway ssl3_renegotiate, 9374664626SKris Kennaway ssl3_renegotiate_check, 9474664626SKris Kennaway ssl3_ctrl, 9574664626SKris Kennaway ssl3_ctx_ctrl, 9674664626SKris Kennaway ssl3_get_cipher_by_char, 9774664626SKris Kennaway ssl3_put_cipher_by_char, 9874664626SKris Kennaway ssl3_pending, 9974664626SKris Kennaway ssl3_num_ciphers, 10074664626SKris Kennaway ssl3_get_cipher, 10174664626SKris Kennaway ssl_bad_method, 10274664626SKris Kennaway tls1_default_timeout, 10374664626SKris Kennaway &TLSv1_enc_data, 104f579bf8eSKris Kennaway ssl_undefined_function, 105f579bf8eSKris Kennaway ssl3_callback_ctrl, 106f579bf8eSKris Kennaway ssl3_ctx_callback_ctrl, 10774664626SKris Kennaway }; 10874664626SKris Kennaway 10974664626SKris Kennaway static long tls1_default_timeout(void) 11074664626SKris Kennaway { 11174664626SKris Kennaway /* 2 hours, the 24 hours mentioned in the TLSv1 spec 11274664626SKris Kennaway * is way too long for http, the cache would over fill */ 11374664626SKris Kennaway return(60*60*2); 11474664626SKris Kennaway } 11574664626SKris Kennaway 11674664626SKris Kennaway SSL_METHOD *tlsv1_base_method(void) 11774664626SKris Kennaway { 11874664626SKris Kennaway return(&TLSv1_data); 11974664626SKris Kennaway } 12074664626SKris Kennaway 12174664626SKris Kennaway int tls1_new(SSL *s) 12274664626SKris Kennaway { 12374664626SKris Kennaway if (!ssl3_new(s)) return(0); 12474664626SKris Kennaway s->method->ssl_clear(s); 12574664626SKris Kennaway return(1); 12674664626SKris Kennaway } 12774664626SKris Kennaway 12874664626SKris Kennaway void tls1_free(SSL *s) 12974664626SKris Kennaway { 13074664626SKris Kennaway ssl3_free(s); 13174664626SKris Kennaway } 13274664626SKris Kennaway 13374664626SKris Kennaway void tls1_clear(SSL *s) 13474664626SKris Kennaway { 13574664626SKris Kennaway ssl3_clear(s); 13674664626SKris Kennaway s->version=TLS1_VERSION; 13774664626SKris Kennaway } 13874664626SKris Kennaway 13974664626SKris Kennaway #if 0 14074664626SKris Kennaway long tls1_ctrl(SSL *s, int cmd, long larg, char *parg) 14174664626SKris Kennaway { 14274664626SKris Kennaway return(0); 14374664626SKris Kennaway } 144f579bf8eSKris Kennaway 145f579bf8eSKris Kennaway long tls1_callback_ctrl(SSL *s, int cmd, void *(*fp)()) 146f579bf8eSKris Kennaway { 147f579bf8eSKris Kennaway return(0); 148f579bf8eSKris Kennaway } 14974664626SKris Kennaway #endif 150