Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: net/third_party/nss/patches/cipherorder.patch

Issue 91913002: net: boost AES-GCM ciphers if the machine has AES-NI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add new symbol to .def Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 diff --git a/nss/lib/ssl/ssl.h b/nss/lib/ssl/ssl.h
2 index 67cc3a7..9899e0a 100644
3 --- a/nss/lib/ssl/ssl.h
4 +++ b/nss/lib/ssl/ssl.h
5 @@ -263,6 +263,13 @@ SSL_IMPORT SECStatus SSL_CipherPrefGetDefault(PRInt32 ciphe r, PRBool *enabled);
6 SSL_IMPORT SECStatus SSL_CipherPolicySet(PRInt32 cipher, PRInt32 policy);
7 SSL_IMPORT SECStatus SSL_CipherPolicyGet(PRInt32 cipher, PRInt32 *policy);
8
9 +/* SSL_CipherOrderSet sets the cipher suite preference order from |ciphers|,
10 + * which must be an array of cipher suite ids of length |len|. All the given
11 + * cipher suite ids must appear in the array that is returned by
12 + * |SSL_GetImplementedCiphers| and may only appear once, at most. */
13 +SSL_IMPORT SECStatus SSL_CipherOrderSet(PRFileDesc *fd, const PRUint16 *ciphers ,
14 + unsigned int len);
15 +
16 /* SSLChannelBindingType enumerates the types of supported channel binding
17 * values. See RFC 5929. */
18 typedef enum SSLChannelBindingType {
19 diff --git a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c
20 index 0f1eea4..20dd5677 100644
21 --- a/nss/lib/ssl/ssl3con.c
22 +++ b/nss/lib/ssl/ssl3con.c
23 @@ -12408,6 +12408,44 @@ ssl3_CipherPrefGet(sslSocket *ss, ssl3CipherSuite which , PRBool *enabled)
24 return rv;
25 }
26
27 +SECStatus
28 +ssl3_CipherOrderSet(sslSocket *ss, const ssl3CipherSuite *ciphers, unsigned int len)
29 +{
30 + unsigned int i;
31 +
32 + for (i = 0; i < len; i++) {
33 + PRUint16 id = ciphers[i];
34 + unsigned int existingIndex, j;
35 + PRBool found = PR_FALSE;
36 +
37 + for (j = i; j < ssl_V3_SUITES_IMPLEMENTED; j++) {
38 + if (ss->cipherSuites[j].cipher_suite == id) {
39 + existingIndex = j;
40 + found = PR_TRUE;
41 + break;
42 + }
43 + }
44 +
45 + if (!found) {
46 + PORT_SetError(SSL_ERROR_UNKNOWN_CIPHER_SUITE);
47 + return SECFailure;
48 + }
49 +
50 + if (existingIndex != i) {
51 + const ssl3CipherSuiteCfg temp = ss->cipherSuites[i];
52 + ss->cipherSuites[i] = ss->cipherSuites[existingIndex];
53 + ss->cipherSuites[existingIndex] = temp;
54 + }
55 + }
56 +
57 + /* Disable all cipher suites that weren't included. */
58 + for (; i < ssl_V3_SUITES_IMPLEMENTED; i++) {
59 + ss->cipherSuites[i].enabled = 0;
60 + }
61 +
62 + return SECSuccess;
63 +}
64 +
65 /* copy global default policy into socket. */
66 void
67 ssl3_InitSocketPolicy(sslSocket *ss)
68 diff --git a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h
69 index 79aca60..2c4b632 100644
70 --- a/nss/lib/ssl/sslimpl.h
71 +++ b/nss/lib/ssl/sslimpl.h
72 @@ -1693,6 +1693,8 @@ extern SECStatus ssl3_CipherPrefSet(sslSocket *ss, ssl3Cip herSuite which, PRBool
73 extern SECStatus ssl3_CipherPrefGet(sslSocket *ss, ssl3CipherSuite which, PRBoo l *on);
74 extern SECStatus ssl2_CipherPrefSet(sslSocket *ss, PRInt32 which, PRBool enable d);
75 extern SECStatus ssl2_CipherPrefGet(sslSocket *ss, PRInt32 which, PRBool *enabl ed);
76 +extern SECStatus ssl3_CipherOrderSet(sslSocket *ss, const ssl3CipherSuite *ciph er,
77 + unsigned int len);
78
79 extern SECStatus ssl3_SetPolicy(ssl3CipherSuite which, PRInt32 policy);
80 extern SECStatus ssl3_GetPolicy(ssl3CipherSuite which, PRInt32 *policy);
81 diff --git a/nss/lib/ssl/sslsock.c b/nss/lib/ssl/sslsock.c
82 index b5c17f0..23a1b6b 100644
83 --- a/nss/lib/ssl/sslsock.c
84 +++ b/nss/lib/ssl/sslsock.c
85 @@ -1329,6 +1329,19 @@ SSL_CipherPrefSet(PRFileDesc *fd, PRInt32 which, PRBool e nabled)
86 return rv;
87 }
88
89 +SECStatus
90 +SSL_CipherOrderSet(PRFileDesc *fd, const PRUint16 *ciphers, unsigned int len)
91 +{
92 + sslSocket *ss = ssl_FindSocket(fd);
93 +
94 + if (!ss) {
95 + SSL_DBG(("%d: SSL[%d]: bad socket in CipherOrderSet", SSL_GETPID(),
96 + fd));
97 + return SECFailure;
98 + }
99 + return ssl3_CipherOrderSet(ss, ciphers, len);
100 +}
101 +
102 SECStatus
103 SSL_CipherPrefGet(PRFileDesc *fd, PRInt32 which, PRBool *enabled)
104 {
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698