Fix Bleichenbacher PKCS #1 1.5 countermeasure.
[oweals/openssl.git] / ssl / ssl.h
index 7c60bb74015d3e038d1bf717a23277a45cb1c735..9de9e611abd733161480f00bd69836fffdcd17d4 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -192,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;
@@ -237,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);
@@ -366,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. */
@@ -391,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;
+       {
+       int id;
+       char *name;
 #ifndef NO_COMP
-    COMP_METHOD *method;
+       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
        {
@@ -615,7 +556,7 @@ struct ssl_st
 #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 */
@@ -1120,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);
@@ -1237,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
@@ -1268,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. */
 
@@ -1292,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
@@ -1322,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
@@ -1530,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
@@ -1617,4 +1564,3 @@ int SSL_COMP_add_compression_method(int id,char *cm);
 }
 #endif
 #endif
-