Implement msg_callback for SSL 2.0.
[openssl.git] / ssl / ssl_locl.h
index e56bbf9c3a56764d862be352959deb51e9ecde5a..17e9bef832581c8e6e53469ba9f790ac796b7c3c 100644 (file)
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
+/* ====================================================================
+ * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
 
 #ifndef HEADER_SSL_LOCL_H
 #define HEADER_SSL_LOCL_H
 #include <string.h>
 #include <errno.h>
 
-#include "openssl/e_os.h"
+#include "e_os.h"
 
 #include <openssl/buffer.h>
 #include <openssl/comp.h>
 #include <openssl/x509.h>
 #include <openssl/err.h>
 #include <openssl/ssl.h>
+#include <openssl/symhacks.h>
+
+#ifdef OPENSSL_BUILD_SHLIBSSL
+# undef OPENSSL_EXTERN
+# define OPENSSL_EXTERN OPENSSL_EXPORT
+#endif
 
 #define PKCS1_CHECK
 
 #define SSL_FZA                        (SSL_aFZA|SSL_kFZA|SSL_eFZA)
 #define SSL_KRB5                (SSL_kKRB5|SSL_aKRB5)
 
-#define SSL_ENC_MASK           0x0007F000L
+#define SSL_ENC_MASK           0x0087F000L
 #define SSL_DES                        0x00001000L
 #define SSL_3DES               0x00002000L
 #define SSL_RC4                        0x00004000L
 #define SSL_IDEA               0x00010000L
 #define SSL_eFZA               0x00020000L
 #define SSL_eNULL              0x00040000L
+#define SSL_AES                        0x00800000L
 
 #define SSL_MAC_MASK           0x00180000L
 #define SSL_MD5                        0x00080000L
@@ -317,11 +377,11 @@ typedef struct cert_st
        int valid;
        unsigned long mask;
        unsigned long export_mask;
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
        RSA *rsa_tmp;
        RSA *(*rsa_tmp_cb)(SSL *ssl,int is_export,int keysize);
 #endif
-#ifndef NO_DH
+#ifndef OPENSSL_NO_DH
        DH *dh_tmp;
        DH *(*dh_tmp_cb)(SSL *ssl,int is_export,int keysize);
 #endif
@@ -344,10 +404,10 @@ typedef struct sess_cert_st
        /* Obviously we don't have the private keys of these,
         * so maybe we shouldn't even use the CERT_PKEY type here. */
 
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
        RSA *peer_rsa_tmp; /* not used for SSL 2 */
 #endif
-#ifndef NO_DH
+#ifndef OPENSSL_NO_DH
        DH *peer_dh_tmp; /* not used for SSL 2 */
 #endif
 
@@ -404,9 +464,9 @@ OPENSSL_EXTERN SSL3_ENC_METHOD ssl3_undef_enc_method;
 OPENSSL_EXTERN SSL_CIPHER ssl2_ciphers[];
 OPENSSL_EXTERN SSL_CIPHER ssl3_ciphers[];
 
-#ifdef VMS
+#ifdef OPENSSL_SYS_VMS
 #undef SSL_COMP_get_compression_methods
-#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods
+#define SSL_COMP_get_compression_methods       SSL_COMP_get_compress_methods
 #endif
 
 
@@ -466,12 +526,12 @@ void      ssl2_free(SSL *s);
 int    ssl2_accept(SSL *s);
 int    ssl2_connect(SSL *s);
 int    ssl2_read(SSL *s, void *buf, int len);
-int    ssl2_peek(SSL *s, char *buf, int len);
+int    ssl2_peek(SSL *s, void *buf, int len);
 int    ssl2_write(SSL *s, const void *buf, int len);
 int    ssl2_shutdown(SSL *s);
 void   ssl2_clear(SSL *s);
-long   ssl2_ctrl(SSL *s,int cmd, long larg, char *parg);
-long   ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, char *parg);
+long   ssl2_ctrl(SSL *s,int cmd, long larg, void *parg);
+long   ssl2_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg);
 long   ssl2_callback_ctrl(SSL *s,int cmd, void (*fp)());
 long   ssl2_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)());
 int    ssl2_pending(SSL *s);
@@ -497,7 +557,7 @@ SSL_CIPHER *ssl3_get_cipher(unsigned int u);
 int ssl3_renegotiate(SSL *ssl); 
 int ssl3_renegotiate_check(SSL *ssl); 
 int ssl3_dispatch_alert(SSL *s);
-int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len);
+int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
 int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
 int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1, EVP_MD_CTX *ctx2,
        const char *sender, int slen,unsigned char *p);
@@ -506,20 +566,20 @@ void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
 int ssl3_enc(SSL *s, int send_data);
 int ssl3_mac(SSL *ssl, unsigned char *md, int send_data);
 unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
-SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *have,
-                              STACK_OF(SSL_CIPHER) *pref);
+SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,STACK_OF(SSL_CIPHER) *clnt,
+                              STACK_OF(SSL_CIPHER) *srvr);
 int    ssl3_setup_buffers(SSL *s);
 int    ssl3_new(SSL *s);
 void   ssl3_free(SSL *s);
 int    ssl3_accept(SSL *s);
 int    ssl3_connect(SSL *s);
 int    ssl3_read(SSL *s, void *buf, int len);
-int    ssl3_peek(SSL *s,char *buf, int len);
+int    ssl3_peek(SSL *s, void *buf, int len);
 int    ssl3_write(SSL *s, const void *buf, int len);
 int    ssl3_shutdown(SSL *s);
 void   ssl3_clear(SSL *s);
-long   ssl3_ctrl(SSL *s,int cmd, long larg, char *parg);
-long   ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, char *parg);
+long   ssl3_ctrl(SSL *s,int cmd, long larg, void *parg);
+long   ssl3_ctx_ctrl(SSL_CTX *s,int cmd, long larg, void *parg);
 long   ssl3_callback_ctrl(SSL *s,int cmd, void (*fp)());
 long   ssl3_ctx_callback_ctrl(SSL_CTX *s,int cmd, void (*fp)());
 int    ssl3_pending(SSL *s);
@@ -532,7 +592,7 @@ int ssl23_write_bytes(SSL *s);
 int tls1_new(SSL *s);
 void tls1_free(SSL *s);
 void tls1_clear(SSL *s);
-long tls1_ctrl(SSL *s,int cmd, long larg, char *parg);
+long tls1_ctrl(SSL *s,int cmd, long larg, void *parg);
 long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)());
 SSL_METHOD *tlsv1_base_method(void );