1 diff -burN android-openssl.orig/openssl.config android-openssl/openssl.config 2 --- android-openssl.orig/openssl.config 2013-06-21 14:24:36.298545589 -0700 3 +++ android-openssl/openssl.config 2013-06-21 14:30:36.253997113 -0700 4 @@ -995,6 +995,7 @@ 5 eng_dyn_dirs.patch \ 6 fix_clang_build.patch \ 7 x509_hash_name_algorithm_change.patch \ 8 +reduce_client_hello_size.patch \ 9 " 10 11 OPENSSL_PATCHES_progs_SOURCES="\ 12 @@ -1054,3 +1055,7 @@ 13 OPENSSL_PATCHES_x509_hash_name_algorithm_change_SOURCES="\ 14 crypto/x509/by_dir.c \ 15 " 16 + 17 +OPENSSL_PATCHES_reduce_client_hello_size_SOURCES="\ 18 +ssl/t1_lib.c \ 19 +" 20 diff -burN android-openssl.orig/patches/reduce_client_hello_size.patch android-openssl/patches/reduce_client_hello_size.patch 21 --- android-openssl.orig/patches/reduce_client_hello_size.patch 1969-12-31 16:00:00.000000000 -0800 22 +++ android-openssl/patches/reduce_client_hello_size.patch 2013-06-21 14:35:14.508212895 -0700 23 @@ -0,0 +1,64 @@ 24 +diff -burN android-openssl.orig/ssl/t1_lib.c android-openssl/ssl/t1_lib.c 25 +--- android-openssl.orig/ssl/t1_lib.c 2013-06-21 14:24:45.338681810 -0700 26 ++++ android-openssl/ssl/t1_lib.c 2013-06-21 14:34:07.977205221 -0700 27 +@@ -202,33 +202,14 @@ 28 + NID_secp521r1 /* secp521r1 (25) */ 29 + }; 30 + 31 ++/* We support only the elliptic curves that are also supported by NSS 32 ++ * to improve compatibility with sites that don't accept large ClientHellos. 33 ++ */ 34 + static int pref_list[] = 35 + { 36 +- NID_sect571r1, /* sect571r1 (14) */ 37 +- NID_sect571k1, /* sect571k1 (13) */ 38 + NID_secp521r1, /* secp521r1 (25) */ 39 +- NID_sect409k1, /* sect409k1 (11) */ 40 +- NID_sect409r1, /* sect409r1 (12) */ 41 + NID_secp384r1, /* secp384r1 (24) */ 42 +- NID_sect283k1, /* sect283k1 (9) */ 43 +- NID_sect283r1, /* sect283r1 (10) */ 44 +- NID_secp256k1, /* secp256k1 (22) */ 45 + NID_X9_62_prime256v1, /* secp256r1 (23) */ 46 +- NID_sect239k1, /* sect239k1 (8) */ 47 +- NID_sect233k1, /* sect233k1 (6) */ 48 +- NID_sect233r1, /* sect233r1 (7) */ 49 +- NID_secp224k1, /* secp224k1 (20) */ 50 +- NID_secp224r1, /* secp224r1 (21) */ 51 +- NID_sect193r1, /* sect193r1 (4) */ 52 +- NID_sect193r2, /* sect193r2 (5) */ 53 +- NID_secp192k1, /* secp192k1 (18) */ 54 +- NID_X9_62_prime192v1, /* secp192r1 (19) */ 55 +- NID_sect163k1, /* sect163k1 (1) */ 56 +- NID_sect163r1, /* sect163r1 (2) */ 57 +- NID_sect163r2, /* sect163r2 (3) */ 58 +- NID_secp160k1, /* secp160k1 (15) */ 59 +- NID_secp160r1, /* secp160r1 (16) */ 60 +- NID_secp160r2, /* secp160r2 (17) */ 61 + }; 62 + 63 + int tls1_ec_curve_id2nid(int curve_id) 64 +@@ -1703,17 +1684,18 @@ 65 + if (using_ecc) 66 + { 67 + if (s->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->tlsext_ecpointformatlist); 68 +- if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) 69 ++ /* To save an additional 2 bytes in the ClientHello, we only advertise support 70 ++ * for the only EC Point Format that NSS supports (instead of all 3). 71 ++ */ 72 ++ if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(1)) == NULL) 73 + { 74 + SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT,ERR_R_MALLOC_FAILURE); 75 + return -1; 76 + } 77 +- s->tlsext_ecpointformatlist_length = 3; 78 ++ s->tlsext_ecpointformatlist_length = 1; 79 + s->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_uncompressed; 80 +- s->tlsext_ecpointformatlist[1] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime; 81 +- s->tlsext_ecpointformatlist[2] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2; 82 + 83 +- /* we support all named elliptic curves in draft-ietf-tls-ecc-12 */ 84 ++ /* we only advertise support for elliptic curves in NSA Suite B */ 85 + if (s->tlsext_ellipticcurvelist != NULL) OPENSSL_free(s->tlsext_ellipticcurvelist); 86 + s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2; 87 + if ((s->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) 88