OLD | NEW |
(Empty) | |
| 1 Name: Tomcat Native Fork for Netty |
| 2 Short Name: netty-tcnative |
| 3 URL: https://github.com/netty/netty-tcnative |
| 4 SHA: 856865181ca38c07b7d2be619903ee98f6f77a23 netty-tcnative-1.1.33.zip |
| 5 Version: 1.1.33 |
| 6 Date: October 13, 2015 |
| 7 Revision: 2aa47be27783ec31086ca9881402f845543de4e6 |
| 8 License: Apache 2.0 |
| 9 License File: NOT_SHIPPED |
| 10 Security Critical: no |
| 11 The library is not security critical because it is used for tests only. |
| 12 Do not link it into production code. |
| 13 |
| 14 Description: |
| 15 netty-tcnative is a fork of Tomcat Native. It includes a set of changes cont
ributed |
| 16 by Twitter, Inc, such as: |
| 17 |
| 18 Simplified distribution and linkage of native library |
| 19 Complete mavenization of the project |
| 20 Improved OpenSSL support |
| 21 |
| 22 Local Modifications: |
| 23 |
| 24 diff -ruN ./original/src/main/c/ssl.c ./src/third_party/netty-tcnative/src/c/ssl
.c |
| 25 --- ./original/src/main/c/ssl.c 2015-10-13 08:36:59.000000000 -0400 |
| 26 +++ ./src/third_party/netty-tcnative/src/c/ssl.c 2016-01-04 10:18:31.7297
65992 -0500 |
| 27 @@ -1821,7 +1821,7 @@ |
| 28 verify = SSL_VERIFY_NONE; |
| 29 |
| 30 UNREFERENCED(o); |
| 31 - TCN_ASSERT(ctx != 0); |
| 32 + TCN_ASSERT(c->ctx != 0); |
| 33 c->verify_mode = level; |
| 34 |
| 35 if (c->verify_mode == SSL_CVERIFY_UNSET) |
| 36 |
| 37 diff --git a/c/ssl.c b/c/ssl.c |
| 38 index 89e6cad..c80f1ea 100644 |
| 39 --- a/c/ssl.c |
| 40 +++ b/c/ssl.c |
| 41 @@ -232,8 +232,8 @@ static const jint supported_ssl_opts = 0 |
| 42 static int ssl_tmp_key_init_rsa(int bits, int idx) |
| 43 { |
| 44 #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(OPENSSL_USE_DEPRECATED) |
| 45 - if (!(SSL_temp_keys[idx] = |
| 46 - RSA_generate_key(bits, RSA_F4, NULL, NULL))) { |
| 47 + SSL_temp_keys[idx] = RSA_new(); |
| 48 + if (RSA_generate_key_ex(SSL_temp_keys[idx], bits, RSA_F4, NULL)) { |
| 49 #ifdef OPENSSL_FIPS |
| 50 /** |
| 51 * With FIPS mode short RSA keys cannot be |
| 52 @@ -246,6 +246,8 @@ static int ssl_tmp_key_init_rsa(int bits, int idx) |
| 53 return 1; |
| 54 } |
| 55 else { |
| 56 + RSA_free(SSL_temp_keys[idx]); |
| 57 + SSL_temp_keys[idx] = NULL; |
| 58 return 0; |
| 59 } |
| 60 #else |
| 61 @@ -610,45 +612,6 @@ int SSL_rand_seed(const char *file) |
| 62 return RAND_status(); |
| 63 } |
| 64 |
| 65 -static int ssl_rand_make(const char *file, int len, int base64) |
| 66 -{ |
| 67 - int r; |
| 68 - int num = len; |
| 69 - BIO *out = NULL; |
| 70 - |
| 71 - out = BIO_new(BIO_s_file()); |
| 72 - if (out == NULL) |
| 73 - return 0; |
| 74 - if ((r = BIO_write_filename(out, (char *)file)) < 0) { |
| 75 - BIO_free_all(out); |
| 76 - return 0; |
| 77 - } |
| 78 - if (base64) { |
| 79 - BIO *b64 = BIO_new(BIO_f_base64()); |
| 80 - if (b64 == NULL) { |
| 81 - BIO_free_all(out); |
| 82 - return 0; |
| 83 - } |
| 84 - out = BIO_push(b64, out); |
| 85 - } |
| 86 - while (num > 0) { |
| 87 - unsigned char buf[4096]; |
| 88 - int len = num; |
| 89 - if (len > sizeof(buf)) |
| 90 - len = sizeof(buf); |
| 91 - r = RAND_bytes(buf, len); |
| 92 - if (r <= 0) { |
| 93 - BIO_free_all(out); |
| 94 - return 0; |
| 95 - } |
| 96 - BIO_write(out, buf, len); |
| 97 - num -= len; |
| 98 - } |
| 99 - r = BIO_flush(out); |
| 100 - BIO_free_all(out); |
| 101 - return r > 0 ? 1 : 0; |
| 102 -} |
| 103 - |
| 104 TCN_IMPLEMENT_CALL(jint, SSL, initialize)(TCN_STDARGS, jstring engine) |
| 105 { |
| 106 int r = 0; |
| 107 @@ -785,17 +748,6 @@ TCN_IMPLEMENT_CALL(jboolean, SSL, randSave)(TCN_STDARGS, js
tring file) |
| 108 return r ? JNI_TRUE : JNI_FALSE; |
| 109 } |
| 110 |
| 111 -TCN_IMPLEMENT_CALL(jboolean, SSL, randMake)(TCN_STDARGS, jstring file, |
| 112 - jint length, jboolean base64) |
| 113 -{ |
| 114 - TCN_ALLOC_CSTRING(file); |
| 115 - int r; |
| 116 - UNREFERENCED(o); |
| 117 - r = ssl_rand_make(J2S(file), length, base64); |
| 118 - TCN_FREE_CSTRING(file); |
| 119 - return r ? JNI_TRUE : JNI_FALSE; |
| 120 -} |
| 121 - |
| 122 TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, jstring file) |
| 123 { |
| 124 TCN_ALLOC_CSTRING(file); |
| 125 |
| 126 |
OLD | NEW |