summaryrefslogtreecommitdiff
path: root/main/openssl/patches
diff options
context:
space:
mode:
Diffstat (limited to 'main/openssl/patches')
-rw-r--r--main/openssl/patches/handshake_cutthrough.patch311
-rw-r--r--main/openssl/patches/jsse.patch422
-rw-r--r--main/openssl/patches/progs.patch54
3 files changed, 0 insertions, 787 deletions
diff --git a/main/openssl/patches/handshake_cutthrough.patch b/main/openssl/patches/handshake_cutthrough.patch
deleted file mode 100644
index f05a10fd..00000000
--- a/main/openssl/patches/handshake_cutthrough.patch
+++ /dev/null
@@ -1,311 +0,0 @@
-From d0e735d01271055f09bc4a1be034253e6e3c2dee Mon Sep 17 00:00:00 2001
-From: Adam Langley <agl@chromium.org>
-Date: Thu, 24 Jan 2013 16:22:07 -0500
-Subject: [PATCH] handshake_cutthrough
-
-Enables SSL3+ clients to send application data immediately following the
-Finished message even when negotiating full-handshakes. With this
-patch, clients can negotiate SSL connections in 1-RTT even when
-performing full-handshakes.
----
- apps/s_client.c | 13 +++++++++++++
- ssl/s3_clnt.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
- ssl/s3_lib.c | 15 ++++++++++++++-
- ssl/ssl.h | 8 +++++++-
- ssl/ssl3.h | 1 +
- ssl/ssl_lib.c | 13 +++++++++++++
- ssl/ssltest.c | 12 ++++++++++++
- test/testssl | 3 +++
- 8 files changed, 110 insertions(+), 8 deletions(-)
-
-diff --git a/apps/s_client.c b/apps/s_client.c
-index 3ba6605..791e277 100644
---- a/apps/s_client.c
-+++ b/apps/s_client.c
-@@ -361,6 +361,7 @@ static void sc_usage(void)
- BIO_printf(bio_err," -nextprotoneg arg - enable NPN extension, considering named protocols supported (comma-separated list)\n");
- # endif
- #endif
-+ BIO_printf(bio_err," -cutthrough - enable 1-RTT full-handshake for strong ciphers\n");
- BIO_printf(bio_err," -legacy_renegotiation - enable use of legacy renegotiation (dangerous)\n");
- #ifndef OPENSSL_NO_SRTP
- BIO_printf(bio_err," -use_srtp profiles - Offer SRTP key management with a colon-separated profile list\n");
-@@ -577,6 +578,7 @@ int MAIN(int argc, char **argv)
- EVP_PKEY *key = NULL;
- char *CApath=NULL,*CAfile=NULL,*cipher=NULL;
- int reconnect=0,badop=0,verify=SSL_VERIFY_NONE,bugs=0;
-+ int cutthrough=0;
- int crlf=0;
- int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
- SSL_CTX *ctx=NULL;
-@@ -883,6 +885,8 @@ int MAIN(int argc, char **argv)
- }
- # endif
- #endif
-+ else if (strcmp(*argv,"-cutthrough") == 0)
-+ cutthrough=1;
- else if (strcmp(*argv,"-serverpref") == 0)
- off|=SSL_OP_CIPHER_SERVER_PREFERENCE;
- else if (strcmp(*argv,"-legacy_renegotiation") == 0)
-@@ -1158,6 +1162,15 @@ bad:
- SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &next_proto);
- #endif
-
-+ /* Enable handshake cutthrough for client connections using
-+ * strong ciphers. */
-+ if (cutthrough)
-+ {
-+ int ssl_mode = SSL_CTX_get_mode(ctx);
-+ ssl_mode |= SSL_MODE_HANDSHAKE_CUTTHROUGH;
-+ SSL_CTX_set_mode(ctx, ssl_mode);
-+ }
-+
- if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
- if (cipher != NULL)
- if(!SSL_CTX_set_cipher_list(ctx,cipher)) {
-diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
-index 344e2eb..c3bf18a 100644
---- a/ssl/s3_clnt.c
-+++ b/ssl/s3_clnt.c
-@@ -215,6 +215,24 @@ int ssl3_connect(SSL *s)
- }
- #endif
-
-+// BEGIN android-added
-+#if 0
-+/* Send app data in separate packet, otherwise, some particular site
-+ * (only one site so far) closes the socket. http://b/2511073
-+ * Note: there is a very small chance that two TCP packets
-+ * could be arriving at server combined into a single TCP packet,
-+ * then trigger that site to break. We haven't encounter that though.
-+ */
-+// END android-added
-+ if (SSL_get_mode(s) & SSL_MODE_HANDSHAKE_CUTTHROUGH)
-+ {
-+ /* Send app data along with CCS/Finished */
-+ s->s3->flags |= SSL3_FLAGS_DELAY_CLIENT_FINISHED;
-+ }
-+
-+// BEGIN android-added
-+#endif
-+// END android-added
- for (;;)
- {
- state=s->state;
-@@ -526,14 +532,31 @@ int ssl3_connect(SSL *s)
- }
- else
- {
--#ifndef OPENSSL_NO_TLSEXT
-- /* Allow NewSessionTicket if ticket expected */
-- if (s->tlsext_ticket_expected)
-- s->s3->tmp.next_state=SSL3_ST_CR_SESSION_TICKET_A;
-+ if ((SSL_get_mode(s) & SSL_MODE_HANDSHAKE_CUTTHROUGH) && SSL_get_cipher_bits(s, NULL) >= 128
-+ && s->s3->previous_server_finished_len == 0 /* no cutthrough on renegotiation (would complicate the state machine) */
-+ )
-+ {
-+ if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED)
-+ {
-+ s->state=SSL3_ST_CUTTHROUGH_COMPLETE;
-+ s->s3->flags|=SSL3_FLAGS_POP_BUFFER;
-+ s->s3->delay_buf_pop_ret=0;
-+ }
-+ else
-+ {
-+ s->s3->tmp.next_state=SSL3_ST_CUTTHROUGH_COMPLETE;
-+ }
-+ }
- else
-+ {
-+#ifndef OPENSSL_NO_TLSEXT
-+ /* Allow NewSessionTicket if ticket expected */
-+ if (s->tlsext_ticket_expected)
-+ s->s3->tmp.next_state=SSL3_ST_CR_SESSION_TICKET_A;
-+ else
- #endif
--
-- s->s3->tmp.next_state=SSL3_ST_CR_FINISHED_A;
-+ s->s3->tmp.next_state=SSL3_ST_CR_FINISHED_A;
-+ }
- }
- s->init_num=0;
- break;
-@@ -581,6 +604,24 @@ int ssl3_connect(SSL *s)
- s->state=s->s3->tmp.next_state;
- break;
-
-+ case SSL3_ST_CUTTHROUGH_COMPLETE:
-+#ifndef OPENSSL_NO_TLSEXT
-+ /* Allow NewSessionTicket if ticket expected */
-+ if (s->tlsext_ticket_expected)
-+ s->state=SSL3_ST_CR_SESSION_TICKET_A;
-+ else
-+#endif
-+ s->state=SSL3_ST_CR_FINISHED_A;
-+
-+ /* SSL_write() will take care of flushing buffered data if
-+ * DELAY_CLIENT_FINISHED is set.
-+ */
-+ if (!(s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED))
-+ ssl_free_wbio_buffer(s);
-+ ret = 1;
-+ goto end;
-+ /* break; */
-+
- case SSL_ST_OK:
- /* clean a few things up */
- ssl3_cleanup_key_block(s);
-diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
-index e7c5dcb..0d77c40 100644
---- a/ssl/s3_lib.c
-+++ b/ssl/s3_lib.c
-@@ -4199,9 +4199,22 @@ int ssl3_write(SSL *s, const void *buf, int len)
-
- static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
- {
-- int ret;
-+ int n,ret;
-
- clear_sys_error();
-+ if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio))
-+ {
-+ /* Deal with an application that calls SSL_read() when handshake data
-+ * is yet to be written.
-+ */
-+ if (BIO_wpending(s->wbio) > 0)
-+ {
-+ s->rwstate=SSL_WRITING;
-+ n=BIO_flush(s->wbio);
-+ if (n <= 0) return(n);
-+ s->rwstate=SSL_NOTHING;
-+ }
-+ }
- if (s->s3->renegotiate) ssl3_renegotiate_check(s);
- s->s3->in_read_app_data=1;
- ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
-diff --git a/ssl/ssl.h b/ssl/ssl.h
-index f9c9049..f2af98c 100644
---- a/ssl/ssl.h
-+++ b/ssl/ssl.h
-@@ -649,6 +649,10 @@ struct ssl_session_st
- */
- #define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020L
- #define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040L
-+/* When set, clients may send application data before receipt of CCS
-+ * and Finished. This mode enables full-handshakes to 'complete' in
-+ * one RTT. */
-+#define SSL_MODE_HANDSHAKE_CUTTHROUGH 0x00000080L
-
- /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,
- * they cannot be used to clear bits. */
-@@ -1415,10 +1419,12 @@ extern "C" {
- /* Is the SSL_connection established? */
- #define SSL_get_state(a) SSL_state(a)
- #define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK)
--#define SSL_in_init(a) (SSL_state(a)&SSL_ST_INIT)
-+#define SSL_in_init(a) ((SSL_state(a)&SSL_ST_INIT) && \
-+ !SSL_cutthrough_complete(a))
- #define SSL_in_before(a) (SSL_state(a)&SSL_ST_BEFORE)
- #define SSL_in_connect_init(a) (SSL_state(a)&SSL_ST_CONNECT)
- #define SSL_in_accept_init(a) (SSL_state(a)&SSL_ST_ACCEPT)
-+int SSL_cutthrough_complete(const SSL *s);
-
- /* The following 2 states are kept in ssl->rstate when reads fail,
- * you should not need these */
-diff --git a/ssl/ssl3.h b/ssl/ssl3.h
-index 247e88c..bd0d764 100644
---- a/ssl/ssl3.h
-+++ b/ssl/ssl3.h
-@@ -547,6 +547,7 @@ typedef struct ssl3_state_st
- /*client */
- /* extra state */
- #define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT)
-+#define SSL3_ST_CUTTHROUGH_COMPLETE (0x101|SSL_ST_CONNECT)
- #ifndef OPENSSL_NO_SCTP
- #define DTLS1_SCTP_ST_CW_WRITE_SOCK (0x310|SSL_ST_CONNECT)
- #define DTLS1_SCTP_ST_CR_READ_SOCK (0x320|SSL_ST_CONNECT)
-diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
-index 14d143d..a56e6ef 100644
---- a/ssl/ssl_lib.c
-+++ b/ssl/ssl_lib.c
-@@ -3225,6 +3225,19 @@ void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int con
- SSL_callback_ctrl(ssl, SSL_CTRL_SET_MSG_CALLBACK, (void (*)(void))cb);
- }
-
-+int SSL_cutthrough_complete(const SSL *s)
-+ {
-+ return (!s->server && /* cutthrough only applies to clients */
-+ !s->hit && /* full-handshake */
-+ s->version >= SSL3_VERSION &&
-+ s->s3->in_read_app_data == 0 && /* cutthrough only applies to write() */
-+ (SSL_get_mode((SSL*)s) & SSL_MODE_HANDSHAKE_CUTTHROUGH) && /* cutthrough enabled */
-+ SSL_get_cipher_bits(s, NULL) >= 128 && /* strong cipher choosen */
-+ s->s3->previous_server_finished_len == 0 && /* not a renegotiation handshake */
-+ (s->state == SSL3_ST_CR_SESSION_TICKET_A || /* ready to write app-data*/
-+ s->state == SSL3_ST_CR_FINISHED_A));
-+ }
-+
- /* Allocates new EVP_MD_CTX and sets pointer to it into given pointer
- * vairable, freeing EVP_MD_CTX previously stored in that variable, if
- * any. If EVP_MD pointer is passed, initializes ctx with this md
-diff --git a/ssl/ssltest.c b/ssl/ssltest.c
-index 316bbb0..91169bb 100644
---- a/ssl/ssltest.c
-+++ b/ssl/ssltest.c
-@@ -369,6 +369,7 @@ static void sv_usage(void)
- " (default is sect163r2).\n");
- #endif
- fprintf(stderr," -test_cipherlist - verifies the order of the ssl cipher lists\n");
-+ fprintf(stderr," -cutthrough - enable 1-RTT full-handshake for strong ciphers\n");
- }
-
- static void print_details(SSL *c_ssl, const char *prefix)
-@@ -549,6 +550,7 @@ int main(int argc, char *argv[])
- #ifdef OPENSSL_FIPS
- int fips_mode=0;
- #endif
-+ int cutthrough = 0;
-
- verbose = 0;
- debug = 0;
-@@ -765,6 +767,10 @@ int main(int argc, char *argv[])
- {
- test_cipherlist = 1;
- }
-+ else if (strcmp(*argv, "-cutthrough") == 0)
-+ {
-+ cutthrough = 1;
-+ }
- else
- {
- fprintf(stderr,"unknown option %s\n",*argv);
-@@ -900,6 +906,12 @@ bad:
- SSL_CTX_set_cipher_list(c_ctx,cipher);
- SSL_CTX_set_cipher_list(s_ctx,cipher);
- }
-+ if (cutthrough)
-+ {
-+ int ssl_mode = SSL_CTX_get_mode(c_ctx);
-+ ssl_mode |= SSL_MODE_HANDSHAKE_CUTTHROUGH;
-+ SSL_CTX_set_mode(c_ctx, ssl_mode);
-+ }
-
- #ifndef OPENSSL_NO_DH
- if (!no_dhe)
-diff --git a/test/testssl b/test/testssl
-index 4e8542b..b5f90ba 100644
---- a/test/testssl
-+++ b/test/testssl
-@@ -70,6 +70,9 @@ $ssltest -client_auth $CA $extra || exit 1
- echo test sslv2/sslv3 with both client and server authentication
- $ssltest -server_auth -client_auth $CA $extra || exit 1
-
-+echo test sslv2/sslv3 with both client and server authentication and handshake cutthrough
-+$ssltest -server_auth -client_auth -cutthrough $CA $extra || exit 1
-+
- echo test sslv2 via BIO pair
- $ssltest -bio_pair -ssl2 $extra || exit 1
-
---
-1.8.2.1
-
diff --git a/main/openssl/patches/jsse.patch b/main/openssl/patches/jsse.patch
deleted file mode 100644
index 795a2bbb..00000000
--- a/main/openssl/patches/jsse.patch
+++ /dev/null
@@ -1,422 +0,0 @@
---- openssl-1.0.0b.orig/ssl/ssl.h 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl.h 2010-11-30 00:03:47.000000000 +0000
-@@ -1133,6 +1133,9 @@ struct ssl_st
- /* This can also be in the session once a session is established */
- SSL_SESSION *session;
-
-+ /* This can be disabled to prevent the use of uncached sessions */
-+ int session_creation_enabled;
-+
- /* Default generate session ID callback. */
- GEN_SESSION_CB generate_session_id;
-
-@@ -1554,6 +1558,7 @@ const char * SSL_get_cipher_list(const
- char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
- int SSL_get_read_ahead(const SSL * s);
- int SSL_pending(const SSL *s);
-+const char * SSL_authentication_method(const SSL *c);
- #ifndef OPENSSL_NO_SOCK
- int SSL_set_fd(SSL *s, int fd);
- int SSL_set_rfd(SSL *s, int fd);
-@@ -1565,6 +1570,7 @@ BIO * SSL_get_rbio(const SSL *s);
- BIO * SSL_get_wbio(const SSL *s);
- #endif
- int SSL_set_cipher_list(SSL *s, const char *str);
-+int SSL_set_cipher_lists(SSL *s, STACK_OF(SSL_CIPHER) *sk);
- void SSL_set_read_ahead(SSL *s, int yes);
- int SSL_get_verify_mode(const SSL *s);
- int SSL_get_verify_depth(const SSL *s);
-@@ -1580,6 +1586,8 @@ int SSL_use_PrivateKey(SSL *ssl, EVP_PKE
- int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);
- int SSL_use_certificate(SSL *ssl, X509 *x);
- int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
-+int SSL_use_certificate_chain(SSL *ssl, STACK_OF(X509) *cert_chain);
-+STACK_OF(X509) * SSL_get_certificate_chain(SSL *ssl, X509 *x);
-
- #ifndef OPENSSL_NO_STDIO
- int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
-@@ -1615,6 +1623,7 @@ void SSL_copy_session_id(SSL *to,const S
- SSL_SESSION *SSL_SESSION_new(void);
- const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
- unsigned int *len);
-+const char * SSL_SESSION_get_version(const SSL_SESSION *s);
- unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
- #ifndef OPENSSL_NO_FP_API
- int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);
-@@ -1624,6 +1633,7 @@ int SSL_SESSION_print(BIO *fp,const SSL_
- void SSL_SESSION_free(SSL_SESSION *ses);
- int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
- int SSL_set_session(SSL *to, SSL_SESSION *session);
-+void SSL_set_session_creation_enabled(SSL *, int);
- int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);
- int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);
- int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
-@@ -2066,6 +2076,7 @@ void ERR_load_SSL_strings(void);
- #define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244
- #define SSL_F_SSL_USE_CERTIFICATE 198
- #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199
-+#define SSL_F_SSL_USE_CERTIFICATE_CHAIN 2000
- #define SSL_F_SSL_USE_CERTIFICATE_FILE 200
- #define SSL_F_SSL_USE_PRIVATEKEY 201
- #define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202
-@@ -2272,6 +2283,7 @@ void ERR_load_SSL_strings(void);
- #define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345
- #define SSL_R_SERVERHELLO_TLSEXT 275
- #define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277
-+#define SSL_R_SESSION_MAY_NOT_BE_CREATED 2000
- #define SSL_R_SHORT_READ 219
- #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220
- #define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221
---- openssl-1.0.0b.orig/ssl/d1_clnt.c 2010-01-26 19:46:29.000000000 +0000
-+++ openssl-1.0.0b/ssl/d1_clnt.c 2010-11-30 00:03:47.000000000 +0000
-@@ -613,6 +613,12 @@ int dtls1_client_hello(SSL *s)
- #endif
- (s->session->not_resumable))
- {
-+ if (!s->session_creation_enabled)
-+ {
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_DTLS1_CLIENT_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,0))
- goto err;
- }
---- openssl-1.0.0b.orig/ssl/s23_clnt.c 2010-02-16 14:20:40.000000000 +0000
-+++ openssl-1.0.0b/ssl/s23_clnt.c 2010-11-30 00:03:47.000000000 +0000
-@@ -687,6 +687,13 @@ static int ssl23_get_server_hello(SSL *s
-
- /* Since, if we are sending a ssl23 client hello, we are not
- * reusing a session-id */
-+ if (!s->session_creation_enabled)
-+ {
-+ if (!(s->client_version == SSL2_VERSION))
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,0))
- goto err;
-
---- openssl-1.0.0b.orig/ssl/s3_both.c 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/s3_both.c 2010-11-30 00:03:47.000000000 +0000
-@@ -347,8 +347,11 @@ unsigned long ssl3_output_cert_chain(SSL
- unsigned long l=7;
- BUF_MEM *buf;
- int no_chain;
-+ STACK_OF(X509) *cert_chain;
-
-- if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || s->ctx->extra_certs)
-+ cert_chain = SSL_get_certificate_chain(s, x);
-+
-+ if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || s->ctx->extra_certs || cert_chain)
- no_chain = 1;
- else
- no_chain = 0;
-@@ -400,6 +403,10 @@ unsigned long ssl3_output_cert_chain(SSL
- return(0);
- }
-
-+ for (i=0; i<sk_X509_num(cert_chain); i++)
-+ if (ssl3_add_cert_to_buf(buf, &l, sk_X509_value(cert_chain,i)))
-+ return(0);
-+
- l-=7;
- p=(unsigned char *)&(buf->data[4]);
- l2n3(l,p);
---- openssl-1.0.0b.orig/ssl/s3_clnt.c 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/s3_clnt.c 2010-11-30 00:03:47.000000000 +0000
-@@ -686,6 +686,12 @@ int ssl3_client_hello(SSL *s)
- #endif
- (sess->not_resumable))
- {
-+ if (!s->session_creation_enabled)
-+ {
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_SSL3_CLIENT_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,0))
- goto err;
- }
-@@ -894,6 +900,12 @@ int ssl3_get_server_hello(SSL *s)
- s->hit=0;
- if (s->session->session_id_length > 0)
- {
-+ if (!s->session_creation_enabled)
-+ {
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,0))
- {
- al=SSL_AD_INTERNAL_ERROR;
---- openssl-1.0.0b.orig/ssl/s3_srvr.c 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/s3_srvr.c 2010-11-30 00:03:47.000000000 +0000
-@@ -902,6 +902,12 @@ int ssl3_get_client_hello(SSL *s)
- */
- if ((s->new_session && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION)))
- {
-+ if (!s->session_creation_enabled)
-+ {
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,1))
- goto err;
- }
-@@ -916,6 +922,12 @@ int ssl3_get_client_hello(SSL *s)
- goto err;
- else /* i == 0 */
- {
-+ if (!s->session_creation_enabled)
-+ {
-+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
-+ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_SESSION_MAY_NOT_BE_CREATED);
-+ goto err;
-+ }
- if (!ssl_get_new_session(s,1))
- goto err;
- }
---- openssl-1.0.0b.orig/ssl/ssl_ciph.c 2010-06-15 17:25:14.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_ciph.c 2010-11-30 00:03:47.000000000 +0000
-@@ -1652,6 +1652,52 @@ int SSL_CIPHER_get_bits(const SSL_CIPHER
- return(ret);
- }
-
-+/* return string version of key exchange algorithm */
-+const char* SSL_CIPHER_authentication_method(const SSL_CIPHER* cipher)
-+ {
-+ switch (cipher->algorithm_mkey)
-+ {
-+ case SSL_kRSA:
-+ return SSL_TXT_RSA;
-+ case SSL_kDHr:
-+ return SSL_TXT_DH "_" SSL_TXT_RSA;
-+ case SSL_kDHd:
-+ return SSL_TXT_DH "_" SSL_TXT_DSS;
-+ case SSL_kEDH:
-+ switch (cipher->algorithm_auth)
-+ {
-+ case SSL_aDSS:
-+ return "DHE_" SSL_TXT_DSS;
-+ case SSL_aRSA:
-+ return "DHE_" SSL_TXT_RSA;
-+ case SSL_aNULL:
-+ return SSL_TXT_DH "_anon";
-+ default:
-+ return "UNKNOWN";
-+ }
-+ case SSL_kKRB5:
-+ return SSL_TXT_KRB5;
-+ case SSL_kECDHr:
-+ return SSL_TXT_ECDH "_" SSL_TXT_RSA;
-+ case SSL_kECDHe:
-+ return SSL_TXT_ECDH "_" SSL_TXT_ECDSA;
-+ case SSL_kEECDH:
-+ switch (cipher->algorithm_auth)
-+ {
-+ case SSL_aECDSA:
-+ return "ECDHE_" SSL_TXT_ECDSA;
-+ case SSL_aRSA:
-+ return "ECDHE_" SSL_TXT_RSA;
-+ case SSL_aNULL:
-+ return SSL_TXT_ECDH "_anon";
-+ default:
-+ return "UNKNOWN";
-+ }
-+ default:
-+ return "UNKNOWN";
-+ }
-+ }
-+
- SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n)
- {
- SSL_COMP *ctmp;
---- openssl-1.0.0b.orig/ssl/ssl_err.c 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_err.c 2010-11-30 00:03:47.000000000 +0000
-@@ -465,6 +465,7 @@ static ERR_STRING_DATA SSL_str_reasons[]
- {ERR_REASON(SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING),"scsv received when renegotiating"},
- {ERR_REASON(SSL_R_SERVERHELLO_TLSEXT) ,"serverhello tlsext"},
- {ERR_REASON(SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED),"session id context uninitialized"},
-+{ERR_REASON(SSL_R_SESSION_MAY_NOT_BE_CREATED),"session may not be created"},
- {ERR_REASON(SSL_R_SHORT_READ) ,"short read"},
- {ERR_REASON(SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE),"signature for non signing certificate"},
- {ERR_REASON(SSL_R_SSL23_DOING_SESSION_ID_REUSE),"ssl23 doing session id reuse"},
---- openssl-1.0.0b.orig/ssl/ssl_lib.c 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_lib.c 2010-11-30 00:03:47.000000000 +0000
-@@ -326,6 +326,7 @@ SSL *SSL_new(SSL_CTX *ctx)
- OPENSSL_assert(s->sid_ctx_length <= sizeof s->sid_ctx);
- memcpy(&s->sid_ctx,&ctx->sid_ctx,sizeof(s->sid_ctx));
- s->verify_callback=ctx->default_verify_callback;
-+ s->session_creation_enabled=1;
- s->generate_session_id=ctx->generate_session_id;
-
- s->param = X509_VERIFY_PARAM_new();
-@@ -1311,6 +1312,32 @@ int SSL_set_cipher_list(SSL *s,const cha
- return 1;
- }
-
-+/** specify the ciphers to be used by the SSL */
-+int SSL_set_cipher_lists(SSL *s,STACK_OF(SSL_CIPHER) *sk)
-+ {
-+ STACK_OF(SSL_CIPHER) *tmp_cipher_list;
-+
-+ if (sk == NULL)
-+ return 0;
-+
-+ /* Based on end of ssl_create_cipher_list */
-+ tmp_cipher_list = sk_SSL_CIPHER_dup(sk);
-+ if (tmp_cipher_list == NULL)
-+ {
-+ return 0;
-+ }
-+ if (s->cipher_list != NULL)
-+ sk_SSL_CIPHER_free(s->cipher_list);
-+ s->cipher_list = sk;
-+ if (s->cipher_list_by_id != NULL)
-+ sk_SSL_CIPHER_free(s->cipher_list_by_id);
-+ s->cipher_list_by_id = tmp_cipher_list;
-+ (void)sk_SSL_CIPHER_set_cmp_func(s->cipher_list_by_id,ssl_cipher_ptr_id_cmp);
-+
-+ sk_SSL_CIPHER_sort(s->cipher_list_by_id);
-+ return 1;
-+ }
-+
- /* works well for SSLv2, not so good for SSLv3 */
- char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len)
- {
-@@ -2551,22 +2578,45 @@ SSL_METHOD *ssl_bad_method(int ver)
- return(NULL);
- }
-
--const char *SSL_get_version(const SSL *s)
-+static const char *ssl_get_version(int version)
- {
-- if (s->version == TLS1_2_VERSION)
-+ if (version == TLS1_2_VERSION)
- return("TLSv1.2");
-- else if (s->version == TLS1_1_VERSION)
-+ else if (version == TLS1_1_VERSION)
- return("TLSv1.1");
-- else if (s->version == TLS1_VERSION)
-+ else if (version == TLS1_VERSION)
- return("TLSv1");
-- else if (s->version == SSL3_VERSION)
-+ else if (version == SSL3_VERSION)
- return("SSLv3");
-- else if (s->version == SSL2_VERSION)
-+ else if (version == SSL2_VERSION)
- return("SSLv2");
- else
- return("unknown");
- }
-
-+const char *SSL_get_version(const SSL *s)
-+ {
-+ return ssl_get_version(s->version);
-+ }
-+
-+const char *SSL_SESSION_get_version(const SSL_SESSION *s)
-+ {
-+ return ssl_get_version(s->ssl_version);
-+ }
-+
-+const char* SSL_authentication_method(const SSL* ssl)
-+ {
-+ if (ssl->cert != NULL && ssl->cert->rsa_tmp != NULL)
-+ return SSL_TXT_RSA "_" SSL_TXT_EXPORT;
-+ switch (ssl->version)
-+ {
-+ case SSL2_VERSION:
-+ return SSL_TXT_RSA;
-+ default:
-+ return SSL_CIPHER_authentication_method(ssl->s3->tmp.new_cipher);
-+ }
-+ }
-+
- SSL *SSL_dup(SSL *s)
- {
- STACK_OF(X509_NAME) *sk;
---- openssl-1.0.0b.orig/ssl/ssl_locl.h 2010-11-30 00:03:46.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_locl.h 2010-11-30 00:03:47.000000000 +0000
-@@ -456,6 +456,7 @@
- typedef struct cert_pkey_st
- {
- X509 *x509;
-+ STACK_OF(X509) *cert_chain;
- EVP_PKEY *privatekey;
- } CERT_PKEY;
-
---- openssl-1.0.0b.orig/ssl/ssl_rsa.c 2009-09-12 23:09:26.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_rsa.c 2010-11-30 00:03:47.000000000 +0000
-@@ -697,6 +697,44 @@ int SSL_CTX_use_PrivateKey_ASN1(int type
- }
-
-
-+int SSL_use_certificate_chain(SSL *ssl, STACK_OF(X509) *cert_chain)
-+ {
-+ if (ssl == NULL)
-+ {
-+ SSLerr(SSL_F_SSL_USE_CERTIFICATE_CHAIN,ERR_R_PASSED_NULL_PARAMETER);
-+ return(0);
-+ }
-+ if (ssl->cert == NULL)
-+ {
-+ SSLerr(SSL_F_SSL_USE_CERTIFICATE_CHAIN,SSL_R_NO_CERTIFICATE_ASSIGNED);
-+ return(0);
-+ }
-+ if (ssl->cert->key == NULL)
-+ {
-+ SSLerr(SSL_F_SSL_USE_CERTIFICATE_CHAIN,SSL_R_NO_CERTIFICATE_ASSIGNED);
-+ return(0);
-+ }
-+ if (ssl->cert->key->cert_chain != NULL)
-+ sk_X509_pop_free(ssl->cert->key->cert_chain, X509_free);
-+ ssl->cert->key->cert_chain = cert_chain;
-+ return(1);
-+ }
-+
-+STACK_OF(X509) *SSL_get_certificate_chain(SSL *ssl, X509 *x)
-+ {
-+ int i;
-+ if (x == NULL)
-+ return NULL;
-+ if (ssl == NULL)
-+ return NULL;
-+ if (ssl->cert == NULL)
-+ return NULL;
-+ for (i = 0; i < SSL_PKEY_NUM; i++)
-+ if (ssl->cert->pkeys[i].x509 == x)
-+ return ssl->cert->pkeys[i].cert_chain;
-+ return NULL;
-+ }
-+
- #ifndef OPENSSL_NO_STDIO
- /* Read a file that contains our certificate in "PEM" format,
- * possibly followed by a sequence of CA certificates that should be
---- openssl-1.0.0b.orig/ssl/ssl_sess.c 2010-02-01 16:49:42.000000000 +0000
-+++ openssl-1.0.0b/ssl/ssl_sess.c 2010-11-30 00:03:47.000000000 +0000
-@@ -261,6 +261,11 @@ static int def_generate_session_id(const
- return 0;
- }
-
-+void SSL_set_session_creation_enabled (SSL *s, int creation_enabled)
-+ {
-+ s->session_creation_enabled = creation_enabled;
-+ }
-+
- int ssl_get_new_session(SSL *s, int session)
- {
- /* This gets used by clients and servers. */
-@@ -269,6 +274,8 @@ int ssl_get_new_session(SSL *s, int sess
- SSL_SESSION *ss=NULL;
- GEN_SESSION_CB cb = def_generate_session_id;
-
-+ /* caller should check this if they can do better error handling */
-+ if (!s->session_creation_enabled) return(0);
- if ((ss=SSL_SESSION_new()) == NULL) return(0);
-
- /* If the context has a default timeout, use it */
diff --git a/main/openssl/patches/progs.patch b/main/openssl/patches/progs.patch
deleted file mode 100644
index f0879ae7..00000000
--- a/main/openssl/patches/progs.patch
+++ /dev/null
@@ -1,54 +0,0 @@
---- openssl-1.0.0.orig/apps/openssl.c 2009-10-04 09:43:21.000000000 -0700
-+++ openssl-1.0.0/apps/openssl.c 2010-05-18 14:05:14.000000000 -0700
-@@ -275,8 +275,10 @@ int main(int Argc, char *Argv[])
- if (ERR_GET_REASON(ERR_peek_last_error())
- == CONF_R_NO_SUCH_FILE)
- {
-+#if 0 /* ANDROID */
- BIO_printf(bio_err,
- "WARNING: can't open config file: %s\n",p);
-+#endif
- ERR_clear_error();
- NCONF_free(config);
- config = NULL;
---- openssl-1.0.0.orig/apps/progs.h 2009-06-30 08:08:38.000000000 -0700
-+++ openssl-1.0.0/apps/progs.h 2010-05-18 14:05:38.000000000 -0700
-@@ -146,7 +152,9 @@ FUNCTION functions[] = {
- {FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
- #endif
- {FUNC_TYPE_GENERAL,"prime",prime_main},
-+#if 0 /* ANDROID */
- {FUNC_TYPE_GENERAL,"ts",ts_main},
-+#endif
- #ifndef OPENSSL_NO_SRP
- {FUNC_TYPE_GENERAL,"srp",srp_main},
- #endif
---- openssl-1.0.0.orig/apps/speed.c 2010-03-03 11:56:17.000000000 -0800
-+++ openssl-1.0.0/apps/speed.c 2010-05-18 14:05:57.000000000 -0700
-@@ -1718,6 +1718,7 @@ int MAIN(int argc, char **argv)
- }
- }
-
-+#if 0 /* ANDROID */
- if (doit[D_IGE_128_AES])
- {
- for (j=0; j<SIZE_NUM; j++)
-@@ -1763,6 +1764,7 @@ int MAIN(int argc, char **argv)
-
-
- #endif
-+#endif
- #ifndef OPENSSL_NO_CAMELLIA
- if (doit[D_CBC_128_CML])
- {
---- openssl-1.0.0.orig/crypto/ui/ui_openssl.c 2009-10-04 09:43:21.000000000 -0700
-+++ openssl-1.0.0/crypto/ui/ui_openssl.c 2010-05-18 13:36:26.000000000 -0700
-@@ -184,7 +184,7 @@
- # undef SGTTY
- #endif
-
--#if defined(linux) && !defined(TERMIO)
-+#if defined(linux) && !defined(TERMIO) && !defined(__ANDROID__)
- # undef TERMIOS
- # define TERMIO
- # undef SGTTY