Bug 822365: Fix the constant-time versions of HMAC-MD5 and SSLv3 MD5 MAC.
Remove the workaround from ssl3_ComputeRecordMACConstantTime. The patch is contributed by Adam Langley <agl@chromium.org>. r=rrelyea,wtc. Modified Files: lib/freebl/hmacct.c lib/softoken/sftkhmac.c lib/ssl/ssl3con.c git-svn-id: svn://10.0.0.236/trunk@264696 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -172,8 +172,16 @@ static SECStatus mac(
|
||||
if (mdLengthSize == 16) {
|
||||
j = 8;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
lengthBytes[4+i+j] = bits >> (8*(7-i));
|
||||
if (hashObj->type == HASH_AlgMD5) {
|
||||
/* MD5 appends a little-endian length. */
|
||||
for (i = 0; i < 4; i++) {
|
||||
lengthBytes[i+j] = bits >> (8*i);
|
||||
}
|
||||
} else {
|
||||
/* All other TLS hash functions use a big-endian length. */
|
||||
for (i = 0; i < 4; i++) {
|
||||
lengthBytes[4+i+j] = bits >> (8*(7-i));
|
||||
}
|
||||
}
|
||||
|
||||
if (k > 0) {
|
||||
|
||||
@@ -106,7 +106,7 @@ sftk_MACConstantTimeCtx* sftk_SSLv3MACConstantTime_New(CK_MECHANISM_PTR mech,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (params->hashAlg == CKM_MD5) {
|
||||
if (params->hashAlg == CKM_SSL3_MD5_MAC) {
|
||||
padLength = 48;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/* $Id: ssl3con.c,v 1.198 2013-02-05 18:10:45 wtc%google.com Exp $ */
|
||||
/* $Id: ssl3con.c,v 1.199 2013-02-06 02:02:38 wtc%google.com Exp $ */
|
||||
|
||||
/* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */
|
||||
|
||||
@@ -2063,12 +2063,6 @@ ssl3_ComputeRecordMACConstantTime(
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
if (spec->cipher_def->cipher == cipher_rc2_40) {
|
||||
/* This function doesn't work for SSL3_RSA_EXPORT_WITH_RC2_CBC_40_MD5.
|
||||
* We fallback on the non-constant time version. */
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
if (spec->mac_def->mac == mac_null) {
|
||||
*outLen = 0;
|
||||
return SECSuccess;
|
||||
|
||||
Reference in New Issue
Block a user