OLD | NEW |
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 /* | 2 /* |
3 * SSL3 Protocol | 3 * SSL3 Protocol |
4 * | 4 * |
5 * This Source Code Form is subject to the terms of the Mozilla Public | 5 * This Source Code Form is subject to the terms of the Mozilla Public |
6 * License, v. 2.0. If a copy of the MPL was not distributed with this | 6 * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
8 | 8 |
9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ | 9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ |
10 | 10 |
(...skipping 12390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12401 pref = suite->enabled; | 12401 pref = suite->enabled; |
12402 rv = SECSuccess; | 12402 rv = SECSuccess; |
12403 } else { | 12403 } else { |
12404 pref = SSL_NOT_ALLOWED; | 12404 pref = SSL_NOT_ALLOWED; |
12405 rv = SECFailure; /* err code was set by Lookup. */ | 12405 rv = SECFailure; /* err code was set by Lookup. */ |
12406 } | 12406 } |
12407 *enabled = pref; | 12407 *enabled = pref; |
12408 return rv; | 12408 return rv; |
12409 } | 12409 } |
12410 | 12410 |
| 12411 SECStatus |
| 12412 ssl3_CipherOrderSet(sslSocket *ss, const ssl3CipherSuite *ciphers, unsigned int
len) |
| 12413 { |
| 12414 unsigned int i; |
| 12415 |
| 12416 for (i = 0; i < len; i++) { |
| 12417 PRUint16 id = ciphers[i]; |
| 12418 unsigned int existingIndex, j; |
| 12419 PRBool found = PR_FALSE; |
| 12420 |
| 12421 for (j = i; j < ssl_V3_SUITES_IMPLEMENTED; j++) { |
| 12422 if (ss->cipherSuites[j].cipher_suite == id) { |
| 12423 existingIndex = j; |
| 12424 found = PR_TRUE; |
| 12425 break; |
| 12426 } |
| 12427 } |
| 12428 |
| 12429 if (!found) { |
| 12430 PORT_SetError(SSL_ERROR_UNKNOWN_CIPHER_SUITE); |
| 12431 return SECFailure; |
| 12432 } |
| 12433 |
| 12434 if (existingIndex != i) { |
| 12435 const ssl3CipherSuiteCfg temp = ss->cipherSuites[i]; |
| 12436 ss->cipherSuites[i] = ss->cipherSuites[existingIndex]; |
| 12437 ss->cipherSuites[existingIndex] = temp; |
| 12438 } |
| 12439 } |
| 12440 |
| 12441 /* Disable all cipher suites that weren't included. */ |
| 12442 for (; i < ssl_V3_SUITES_IMPLEMENTED; i++) { |
| 12443 ss->cipherSuites[i].enabled = 0; |
| 12444 } |
| 12445 |
| 12446 return SECSuccess; |
| 12447 } |
| 12448 |
12411 /* copy global default policy into socket. */ | 12449 /* copy global default policy into socket. */ |
12412 void | 12450 void |
12413 ssl3_InitSocketPolicy(sslSocket *ss) | 12451 ssl3_InitSocketPolicy(sslSocket *ss) |
12414 { | 12452 { |
12415 PORT_Memcpy(ss->cipherSuites, cipherSuites, sizeof cipherSuites); | 12453 PORT_Memcpy(ss->cipherSuites, cipherSuites, sizeof cipherSuites); |
12416 } | 12454 } |
12417 | 12455 |
12418 SECStatus | 12456 SECStatus |
12419 ssl3_GetTLSUniqueChannelBinding(sslSocket *ss, | 12457 ssl3_GetTLSUniqueChannelBinding(sslSocket *ss, |
12420 unsigned char *out, | 12458 unsigned char *out, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12633 PORT_Free(ss->ssl3.hs.recvdFragments.buf); | 12671 PORT_Free(ss->ssl3.hs.recvdFragments.buf); |
12634 } | 12672 } |
12635 } | 12673 } |
12636 | 12674 |
12637 ss->ssl3.initialized = PR_FALSE; | 12675 ss->ssl3.initialized = PR_FALSE; |
12638 | 12676 |
12639 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); | 12677 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); |
12640 } | 12678 } |
12641 | 12679 |
12642 /* End of ssl3con.c */ | 12680 /* End of ssl3con.c */ |
OLD | NEW |