提交 f9cf774c 编写于 作者: M Matt Caswell

Ensure we unpad in constant time for read pipelining

The read pipelining code broke constant time unpadding. See GitHub
issue #1438
Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 0f022f5a
...@@ -831,9 +831,15 @@ int tls1_enc(SSL *s, SSL3_RECORD *recs, unsigned int n_recs, int send) ...@@ -831,9 +831,15 @@ int tls1_enc(SSL *s, SSL3_RECORD *recs, unsigned int n_recs, int send)
int tmpret; int tmpret;
for (ctr = 0; ctr < n_recs; ctr++) { for (ctr = 0; ctr < n_recs; ctr++) {
tmpret = tls1_cbc_remove_padding(s, &recs[ctr], bs, mac_size); tmpret = tls1_cbc_remove_padding(s, &recs[ctr], bs, mac_size);
if (tmpret == -1) /*
return -1; * If tmpret == 0 then this means publicly invalid so we can
ret &= tmpret; * short circuit things here. Otherwise we must respect constant
* time behaviour.
*/
if (tmpret == 0)
return 0;
ret = constant_time_select_int(constant_time_eq_int(tmpret, 1),
ret, -1);
} }
} }
if (pad && !send) { if (pad && !send) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册