~ubuntu-branches/ubuntu/raring/nss/raring-security

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/ssl/sslcon.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-25 13:46:06 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100325134606-bl6liuok2w9l7snv
Tags: 3.12.6-0ubuntu1
* New upstream release 3.12.6 RTM (NSS_3_12_6_RTM)
  - fixes CVE-2009-3555 aka US-CERT VU#120541
* Adjust patches to changed upstream code base
  - update debian/patches/38_kbsd.patch
  - update debian/patches/38_mips64_build.patch
  - update debian/patches/85_security_load.patch
* Remove patches that are merged upstream
  - delete debian/patches/91_nonexec_stack.patch
  - update debian/patches/series
* Bump nspr dependency to 4.8
  - update debian/control
* Add new symbols for 3.12.6
  - update debian/libnss3-1d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 * the terms of any one of the MPL, the GPL or the LGPL.
38
38
 *
39
39
 * ***** END LICENSE BLOCK ***** */
40
 
/* $Id: sslcon.c,v 1.36 2009/03/04 21:57:18 nelson%bolyard.com Exp $ */
 
40
/* $Id: sslcon.c,v 1.39 2010/02/04 03:08:44 wtc%google.com Exp $ */
41
41
 
42
42
#include "nssrenam.h"
43
43
#include "cert.h"
2731
2731
    DUMP_MSG(29, (ss, data, ss->gs.recordLen));
2732
2732
    if ((ss->gs.recordLen != 1 + SSL_CHALLENGE_BYTES) ||
2733
2733
        (data[0] != SSL_MT_SERVER_VERIFY) ||
2734
 
        PORT_Memcmp(data+1, ss->sec.ci.clientChallenge, SSL_CHALLENGE_BYTES)) {
 
2734
        NSS_SecureMemcmp(data+1, ss->sec.ci.clientChallenge,
 
2735
                         SSL_CHALLENGE_BYTES)) {
2735
2736
        /* Bad server */
2736
2737
        PORT_SetError(SSL_ERROR_BAD_SERVER);
2737
2738
        goto loser;
3006
3007
    unsigned int      i;
3007
3008
    int               sendLen, sidLen = 0;
3008
3009
    SECStatus         rv;
 
3010
    TLSExtensionData  *xtnData;
3009
3011
 
3010
3012
    PORT_Assert( ss->opt.noLocks || ssl_Have1stHandshakeLock(ss) );
3011
3013
 
3150
3152
    localCipherSpecs = ss->cipherSpecs;
3151
3153
    localCipherSize  = ss->sizeCipherSpecs;
3152
3154
 
3153
 
    sendLen = SSL_HL_CLIENT_HELLO_HBYTES + localCipherSize + sidLen +
 
3155
    /* Add 3 for SCSV */
 
3156
    sendLen = SSL_HL_CLIENT_HELLO_HBYTES + localCipherSize + 3 + sidLen +
3154
3157
        SSL_CHALLENGE_BYTES;
3155
3158
 
3156
3159
    /* Generate challenge bytes for server */
3175
3178
    
3176
3179
    msg[1] = MSB(ss->clientHelloVersion);
3177
3180
    msg[2] = LSB(ss->clientHelloVersion);
3178
 
    msg[3] = MSB(localCipherSize);
3179
 
    msg[4] = LSB(localCipherSize);
 
3181
    /* Add 3 for SCSV */
 
3182
    msg[3] = MSB(localCipherSize + 3);
 
3183
    msg[4] = LSB(localCipherSize + 3);
3180
3184
    msg[5] = MSB(sidLen);
3181
3185
    msg[6] = LSB(sidLen);
3182
3186
    msg[7] = MSB(SSL_CHALLENGE_BYTES);
3184
3188
    cp += SSL_HL_CLIENT_HELLO_HBYTES;
3185
3189
    PORT_Memcpy(cp, localCipherSpecs, localCipherSize);
3186
3190
    cp += localCipherSize;
 
3191
    /*
 
3192
     * Add SCSV.  SSL 2.0 cipher suites are listed before SSL 3.0 cipher
 
3193
     * suites in localCipherSpecs for compatibility with SSL 2.0 servers.
 
3194
     * Since SCSV looks like an SSL 3.0 cipher suite, we can't add it at
 
3195
     * the beginning.
 
3196
     */
 
3197
    cp[0] = 0x00;
 
3198
    cp[1] = 0x00;
 
3199
    cp[2] = 0xff;
 
3200
    cp += 3;
3187
3201
    if (sidLen) {
3188
3202
        PORT_Memcpy(cp, sid->u.ssl2.sessionID, sidLen);
3189
3203
        cp += sidLen;
3206
3220
        goto loser;
3207
3221
    }
3208
3222
 
 
3223
    /*
 
3224
     * Since we sent the SCSV, pretend we sent empty RI extension.  We need
 
3225
     * to record the extension has been advertised after ssl3_InitState has
 
3226
     * been called, which ssl3_StartHandshakeHash took care for us above.
 
3227
     */
 
3228
    xtnData = &ss->xtnData;
 
3229
    xtnData->advertised[xtnData->numAdvertised++] = ssl_renegotiation_info_xtn;
 
3230
 
3209
3231
    /* Setup to receive servers hello message */
3210
3232
    ssl_GetRecvBufLock(ss);
3211
3233
    ss->gs.recordLen = 0;