This change should be suitable as a workaround for the Solaris x86
[oweals/openssl.git] / ssl / ssl.h
index 16fe6940b8248eb9b76618eb421ac1380700afe9..9de9e611abd733161480f00bd69836fffdcd17d4 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
 #ifndef HEADER_SSL_H 
 #define HEADER_SSL_H 
 
+#ifndef NO_COMP
+#include <openssl/comp.h>
+#endif
+#ifndef NO_BIO
+#include <openssl/bio.h>
+#endif
+#ifndef NO_X509
+#include <openssl/x509.h>
+#endif
 #include <openssl/safestack.h>
 
 #ifdef  __cplusplus
@@ -183,37 +192,6 @@ typedef struct ssl_cipher_st
        } SSL_CIPHER;
 
 DECLARE_STACK_OF(SSL_CIPHER)
-/* This block of defines is updated by a perl script, please do not touch! */
-#ifndef DEBUG_SAFESTACK
-       #define sk_SSL_CIPHER_new(a) sk_new((int (*) \
-               (const char * const *, const char * const *))(a))
-       #define sk_SSL_CIPHER_new_null() sk_new_null()
-       #define sk_SSL_CIPHER_free(a) sk_free(a)
-       #define sk_SSL_CIPHER_num(a) sk_num(a)
-       #define sk_SSL_CIPHER_value(a,b) ((SSL_CIPHER *) \
-               sk_value((a),(b)))
-       #define sk_SSL_CIPHER_set(a,b,c) ((SSL_CIPHER *) \
-               sk_set((a),(b),(char *)(c)))
-       #define sk_SSL_CIPHER_zero(a) sk_zero(a)
-       #define sk_SSL_CIPHER_push(a,b) sk_push((a),(char *)(b))
-       #define sk_SSL_CIPHER_unshift(a,b) sk_unshift((a),(b))
-       #define sk_SSL_CIPHER_find(a,b) sk_find((a), (char *)(b))
-       #define sk_SSL_CIPHER_delete(a,b) ((SSL_CIPHER *) \
-               sk_delete((a),(b)))
-       #define sk_SSL_CIPHER_delete_ptr(a,b) ((SSL_CIPHER *) \
-               sk_delete_ptr((a),(char *)(b)))
-       #define sk_SSL_CIPHER_insert(a,b,c) sk_insert((a),(char *)(b),(c))
-       #define sk_SSL_CIPHER_set_cmp_func(a,b) ((int (*) \
-               (const SSL_CIPHER * const *,const SSL_CIPHER * const *)) \
-               sk_set_cmp_func((a),(int (*) \
-               (const char * const *, const char * const *))(b)))
-       #define sk_SSL_CIPHER_dup(a) sk_dup(a)
-       #define sk_SSL_CIPHER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
-       #define sk_SSL_CIPHER_shift(a) ((SSL_CIPHER *)sk_shift(a))
-       #define sk_SSL_CIPHER_pop(a) ((SSL_CIPHER *)sk_pop(a))
-       #define sk_SSL_CIPHER_sort(a) sk_sort(a)
-#endif /* !DEBUG_SAFESTACK */
-/* End of perl script block, you may now edit :-) */
 
 typedef struct ssl_st SSL;
 typedef struct ssl_ctx_st SSL_CTX;
@@ -228,7 +206,7 @@ typedef struct ssl_method_st
        int (*ssl_accept)(SSL *s);
        int (*ssl_connect)(SSL *s);
        int (*ssl_read)(SSL *s,void *buf,int len);
-       int (*ssl_peek)(SSL *s,char *buf,int len);
+       int (*ssl_peek)(SSL *s,void *buf,int len);
        int (*ssl_write)(SSL *s,const void *buf,int len);
        int (*ssl_shutdown)(SSL *s);
        int (*ssl_renegotiate)(SSL *s);
@@ -357,6 +335,9 @@ typedef struct ssl_session_st
  * the misconception that non-blocking SSL_write() behaves like
  * non-blocking write(): */
 #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L
+/* Never bother the application with retries if the transport
+ * is blocking: */
+#define SSL_MODE_AUTO_RETRY 0x00000004L
 
 /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,
  * they cannot be used to clear bits. */
@@ -382,48 +363,17 @@ typedef struct ssl_session_st
 #define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT     (1024*20)
 
 typedef struct ssl_comp_st
-{
-    int id;
-    char *name;
-#ifdef HEADER_COMP_H
-    COMP_METHOD *method;
+       {
+       int id;
+       char *name;
+#ifndef NO_COMP
+       COMP_METHOD *method;
 #else
-    char *method;
+       char *method;
 #endif
-} SSL_COMP;
+       } SSL_COMP;
 
 DECLARE_STACK_OF(SSL_COMP)
-/* This block of defines is updated by a perl script, please do not touch! */
-#ifndef DEBUG_SAFESTACK
-       #define sk_SSL_COMP_new(a) sk_new((int (*) \
-               (const char * const *, const char * const *))(a))
-       #define sk_SSL_COMP_new_null() sk_new_null()
-       #define sk_SSL_COMP_free(a) sk_free(a)
-       #define sk_SSL_COMP_num(a) sk_num(a)
-       #define sk_SSL_COMP_value(a,b) ((SSL_COMP *) \
-               sk_value((a),(b)))
-       #define sk_SSL_COMP_set(a,b,c) ((SSL_COMP *) \
-               sk_set((a),(b),(char *)(c)))
-       #define sk_SSL_COMP_zero(a) sk_zero(a)
-       #define sk_SSL_COMP_push(a,b) sk_push((a),(char *)(b))
-       #define sk_SSL_COMP_unshift(a,b) sk_unshift((a),(b))
-       #define sk_SSL_COMP_find(a,b) sk_find((a), (char *)(b))
-       #define sk_SSL_COMP_delete(a,b) ((SSL_COMP *) \
-               sk_delete((a),(b)))
-       #define sk_SSL_COMP_delete_ptr(a,b) ((SSL_COMP *) \
-               sk_delete_ptr((a),(char *)(b)))
-       #define sk_SSL_COMP_insert(a,b,c) sk_insert((a),(char *)(b),(c))
-       #define sk_SSL_COMP_set_cmp_func(a,b) ((int (*) \
-               (const SSL_COMP * const *,const SSL_COMP * const *)) \
-               sk_set_cmp_func((a),(int (*) \
-               (const char * const *, const char * const *))(b)))
-       #define sk_SSL_COMP_dup(a) sk_dup(a)
-       #define sk_SSL_COMP_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b))
-       #define sk_SSL_COMP_shift(a) ((SSL_COMP *)sk_shift(a))
-       #define sk_SSL_COMP_pop(a) ((SSL_COMP *)sk_pop(a))
-       #define sk_SSL_COMP_sort(a) sk_sort(a)
-#endif /* !DEBUG_SAFESTACK */
-/* End of perl script block, you may now edit :-) */
 
 struct ssl_ctx_st
        {
@@ -603,10 +553,10 @@ struct ssl_st
         * same.  This is so data can be read and written to different
         * handlers */
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
        BIO *rbio; /* used by SSL_read */
        BIO *wbio; /* used by SSL_write */
-       BIO *bbio; /* used during session-id reuse to concatinate
+       BIO *bbio; /* used during session-id reuse to concatenate
                    * messages */
 #else
        char *rbio; /* used by SSL_read */
@@ -667,7 +617,7 @@ struct ssl_st
 
        EVP_CIPHER_CTX *enc_read_ctx;           /* cryptographic state */
        const EVP_MD *read_hash;                /* used for mac generation */
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
        COMP_CTX *expand;                       /* uncompress */
 #else
        char *expand;
@@ -675,7 +625,7 @@ struct ssl_st
 
        EVP_CIPHER_CTX *enc_write_ctx;          /* cryptographic state */
        const EVP_MD *write_hash;               /* used for mac generation */
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
        COMP_CTX *compress;                     /* compression */
 #else
        char *compress; 
@@ -961,7 +911,7 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
 #define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_sub_to_stack
 #endif
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 BIO_METHOD *BIO_f_ssl(void);
 BIO *BIO_new_ssl(SSL_CTX *ctx,int client);
 BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
@@ -998,7 +948,7 @@ int SSL_set_fd(SSL *s, int fd);
 int    SSL_set_rfd(SSL *s, int fd);
 int    SSL_set_wfd(SSL *s, int fd);
 #endif
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 void   SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
 BIO *  SSL_get_rbio(SSL *s);
 BIO *  SSL_get_wbio(SSL *s);
@@ -1053,7 +1003,7 @@ int       SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b);
 #ifndef NO_FP_API
 int    SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses);
 #endif
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 int    SSL_SESSION_print(BIO *fp,SSL_SESSION *ses);
 #endif
 void   SSL_SESSION_free(SSL_SESSION *ses);
@@ -1111,9 +1061,9 @@ int SSL_set_trust(SSL *s, int trust);
 void   SSL_free(SSL *ssl);
 int    SSL_accept(SSL *ssl);
 int    SSL_connect(SSL *ssl);
-int    SSL_read(SSL *ssl,char *buf,int num);
-int    SSL_peek(SSL *ssl,char *buf,int num);
-int    SSL_write(SSL *ssl,const char *buf,int num);
+int    SSL_read(SSL *ssl,void *buf,int num);
+int    SSL_peek(SSL *ssl,void *buf,int num);
+int    SSL_write(SSL *ssl,const void *buf,int num);
 long   SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg);
 long   SSL_callback_ctrl(SSL *, int, void (*)());
 long   SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, char *parg);
@@ -1228,7 +1178,7 @@ int SSL_get_ex_data_X509_STORE_CTX_idx(void );
 #define SSL_CTX_get_read_ahead(ctx) \
        SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
 #define SSL_CTX_set_read_ahead(ctx,m) \
-       SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,0,NULL)
+       SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
 
      /* NB: the keylength is only applicable when is_export is true */
 #ifndef NO_RSA
@@ -1249,7 +1199,7 @@ void SSL_set_tmp_dh_callback(SSL *ssl,
                                           int keylength));
 #endif
 
-#ifdef HEADER_COMP_H
+#ifndef NO_COMP
 int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
 #else
 int SSL_COMP_add_compression_method(int id,char *cm);
@@ -1259,6 +1209,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 /* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
  */
+void ERR_load_SSL_strings(void);
 
 /* Error codes for the SSL functions. */
 
@@ -1283,12 +1234,15 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 #define SSL_F_SSL23_CONNECT                             117
 #define SSL_F_SSL23_GET_CLIENT_HELLO                    118
 #define SSL_F_SSL23_GET_SERVER_HELLO                    119
+#define SSL_F_SSL23_PEEK                                237
 #define SSL_F_SSL23_READ                                120
 #define SSL_F_SSL23_WRITE                               121
 #define SSL_F_SSL2_ACCEPT                               122
 #define SSL_F_SSL2_CONNECT                              123
 #define SSL_F_SSL2_ENC_INIT                             124
+#define SSL_F_SSL2_PEEK                                         234
 #define SSL_F_SSL2_READ                                         125
+#define SSL_F_SSL2_READ_INTERNAL                        236
 #define SSL_F_SSL2_SET_CERTIFICATE                      126
 #define SSL_F_SSL2_WRITE                                127
 #define SSL_F_SSL3_ACCEPT                               128
@@ -1313,6 +1267,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 #define SSL_F_SSL3_GET_SERVER_DONE                      145
 #define SSL_F_SSL3_GET_SERVER_HELLO                     146
 #define SSL_F_SSL3_OUTPUT_CERT_CHAIN                    147
+#define SSL_F_SSL3_PEEK                                         235
 #define SSL_F_SSL3_READ_BYTES                           148
 #define SSL_F_SSL3_READ_N                               149
 #define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST             150
@@ -1521,6 +1476,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 #define SSL_R_READ_WRONG_PACKET_TYPE                    212
 #define SSL_R_RECORD_LENGTH_MISMATCH                    213
 #define SSL_R_RECORD_TOO_LARGE                          214
+#define SSL_R_RECORD_TOO_SMALL                          1093
 #define SSL_R_REQUIRED_CIPHER_MISSING                   215
 #define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO                216
 #define SSL_R_REUSE_CERT_TYPE_NOT_ZERO                  217
@@ -1608,4 +1564,3 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 }
 #endif
 #endif
-