Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
9 年前
差異永不過期
清除
匯出
分享
解釋
11 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
60 行
全部複製
9 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
60 行
全部複製
複製
已複製
複製
已複製
Index:
ssl/s3_lib.c
diff --git a/ssl/s3_lib.c b/
ssl/s3_lib.c
===================================================================
index e94ee83..3cd7e3a 100644
--- a/ssl/s3_lib.c
2016-11-10 15:03:46.000000000 +0100
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
2016-12-08 03:08:45.167225455 +0100
+++ b/ssl/s3_lib.c
@@ -3582,6 +3582,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
@@ -3582,6 +3582,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
*s, STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *prio, *allow;
STACK_OF(SSL_CIPHER) *prio, *allow;
int i, ii, ok;
int i, ii, ok;
unsigned long alg_k, alg_a, mask_k, mask_a;
unsigned long alg_k, alg_a, mask_k, mask_a;
+ int use_chacha = 0;
+ int use_chacha = 0;
/* Let's see which ciphers we can support */
/* Let's see which ciphers we can support */
複製
已複製
複製
已複製
@@ -3610,13 +3611,20 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
@@ -3610,13 +3611,20 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
*s, STACK_OF(SSL_CIPHER) *clnt,
fprintf(stderr, "%p:%s\n", (void *)c, c->name);
fprintf(stderr, "%p:%s\n", (void *)c, c->name);
}
}
#endif
#endif
-
-
+retry:
+retry:
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) {
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) {
prio = srvr;
prio = srvr;
allow = clnt;
allow = clnt;
複製
已複製
複製
已複製
+
/* Use ChaCha20+Poly1305 if
f
it's client's most preferred cipher suite */
+
/* Use ChaCha20+Poly1305 if
it's client's most preferred cipher suite */
+ if (sk_SSL_CIPHER_num(clnt) > 0) {
+ if (sk_SSL_CIPHER_num(clnt) > 0) {
+ c = sk_SSL_CIPHER_value(clnt, 0);
+ c = sk_SSL_CIPHER_value(clnt, 0);
+ if (c->algorithm_enc == SSL_CHACHA20POLY1305)
+ if (c->algorithm_enc == SSL_CHACHA20POLY1305)
+ use_chacha = 1;
+ use_chacha = 1;
+ }
+ }
} else {
} else {
prio = clnt;
prio = clnt;
allow = srvr;
allow = srvr;
+ use_chacha = 1;
+ use_chacha = 1;
}
}
tls1_set_cert_validity(s);
tls1_set_cert_validity(s);
複製
已複製
複製
已複製
@@ -3634,6 +3642,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
@@ -3634,6 +3642,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL
*s, STACK_OF(SSL_CIPHER) *clnt,
DTLS_VERSION_GT(s->version, c->max_dtls)))
DTLS_VERSION_GT(s->version, c->max_dtls)))
continue;
continue;
複製
已複製
複製
已複製
+
/* Skip ChaCha unless top client priority */
+
/* Skip ChaCha unless top client priority */
+ if
(
(c->algorithm_enc == SSL_CHACHA20POLY1305
)
&& !use_chacha)
+ if
(c->algorithm_enc == SSL_CHACHA20POLY1305
&& !use_chacha)
+ continue;
+ continue;
+
+
mask_k = s->s3->tmp.mask_k;
mask_k = s->s3->tmp.mask_k;
mask_a = s->s3->tmp.mask_a;
mask_a = s->s3->tmp.mask_a;
#ifndef OPENSSL_NO_SRP
#ifndef OPENSSL_NO_SRP
複製
已複製
複製
已複製
@@ -3687,6 +3699,
15
@@ const SSL_CIPHER *ssl3_choose_cipher(SSL
@@ -3687,6 +3699,
14
@@ const SSL_CIPHER *ssl3_choose_cipher(SSL
*s, STACK_OF(SSL_CIPHER) *clnt,
break;
break;
}
}
}
}
+
+
複製
已複製
複製
已複製
+
if (ret == NULL && !use_chacha) {
+
if (ret == NULL && !use_chacha) {
+ /* If no shared cipher was found due to some unusual preferences, try
+ /* If no shared cipher was found due to some unusual preferences, try
+ * again with CHACHA enabled even if not top priority */
+ * again with CHACHA enabled even if not top priority */
+ use_chacha = 1;
+ use_chacha = 1;
+ goto retry;
+ goto retry;
+ }
+ }
+
+
複製
已複製
複製
已複製
+
return (ret);
return (ret);
}
}
複製
已複製
複製
已複製
已保存差異
原始文本
開啟檔案
Index: ssl/s3_lib.c =================================================================== --- a/ssl/s3_lib.c 2016-11-10 15:03:46.000000000 +0100 +++ b/ssl/s3_lib.c 2016-12-08 03:08:45.167225455 +0100 @@ -3582,6 +3582,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL STACK_OF(SSL_CIPHER) *prio, *allow; int i, ii, ok; unsigned long alg_k, alg_a, mask_k, mask_a; + int use_chacha = 0; /* Let's see which ciphers we can support */ @@ -3610,13 +3611,20 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL fprintf(stderr, "%p:%s\n", (void *)c, c->name); } #endif - +retry: if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) { prio = srvr; allow = clnt; + /* Use ChaCha20+Poly1305 iff it's client's most preferred cipher suite */ + if (sk_SSL_CIPHER_num(clnt) > 0) { + c = sk_SSL_CIPHER_value(clnt, 0); + if (c->algorithm_enc == SSL_CHACHA20POLY1305) + use_chacha = 1; + } } else { prio = clnt; allow = srvr; + use_chacha = 1; } tls1_set_cert_validity(s); @@ -3634,6 +3642,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL DTLS_VERSION_GT(s->version, c->max_dtls))) continue; + /* Skip ChaCha unless top client priority */ + if ((c->algorithm_enc == SSL_CHACHA20POLY1305) && !use_chacha) + continue; + mask_k = s->s3->tmp.mask_k; mask_a = s->s3->tmp.mask_a; #ifndef OPENSSL_NO_SRP @@ -3687,6 +3699,15 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL break; } } + + if (ret == NULL && !use_chacha) { + /* If no shared cipher was found due to some unusual preferences, try + * again with CHACHA enabled even if not top priority */ + use_chacha = 1; + goto retry; + } + + return (ret); }
更改後文本
開啟檔案
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index e94ee83..3cd7e3a 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -3582,6 +3582,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, STACK_OF(SSL_CIPHER) *prio, *allow; int i, ii, ok; unsigned long alg_k, alg_a, mask_k, mask_a; + int use_chacha = 0; /* Let's see which ciphers we can support */ @@ -3610,13 +3611,20 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, fprintf(stderr, "%p:%s\n", (void *)c, c->name); } #endif - +retry: if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || tls1_suiteb(s)) { prio = srvr; allow = clnt; + /* Use ChaCha20+Poly1305 if it's client's most preferred cipher suite */ + if (sk_SSL_CIPHER_num(clnt) > 0) { + c = sk_SSL_CIPHER_value(clnt, 0); + if (c->algorithm_enc == SSL_CHACHA20POLY1305) + use_chacha = 1; + } } else { prio = clnt; allow = srvr; + use_chacha = 1; } tls1_set_cert_validity(s); @@ -3634,6 +3642,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, DTLS_VERSION_GT(s->version, c->max_dtls))) continue; + /* Skip ChaCha unless top client priority */ + if (c->algorithm_enc == SSL_CHACHA20POLY1305 && !use_chacha) + continue; + mask_k = s->s3->tmp.mask_k; mask_a = s->s3->tmp.mask_a; #ifndef OPENSSL_NO_SRP @@ -3687,6 +3699,14 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, break; } } + + if (ret == NULL && !use_chacha) { + /* If no shared cipher was found due to some unusual preferences, try + * again with CHACHA enabled even if not top priority */ + use_chacha = 1; + goto retry; + } + return (ret); }
尋找差異