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

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

Issue 1844813002: Uprev NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more GN fix Created 4 years, 8 months 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
OLDNEW
(Empty)
1 diff --git a/lib/ssl/ssl3con.c b/lib/ssl/ssl3con.c
2 index afab931..e5e620f 100644
3 --- a/lib/ssl/ssl3con.c
4 +++ b/lib/ssl/ssl3con.c
5 @@ -5436,7 +5436,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
6 * the lock across the calls to ssl3_CallHelloExtensionSenders.
7 */
8 if (sid->u.ssl3.lock) {
9 - PR_RWLock_Rlock(sid->u.ssl3.lock);
10 + NSSRWLock_LockRead(sid->u.ssl3.lock);
11 }
12
13 if (isTLS || (ss->firstHsDone && ss->peerRequestedProtection)) {
14 @@ -5445,7 +5445,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
15
16 extLen = ssl3_CallHelloExtensionSenders(ss, PR_FALSE, maxBytes, NULL);
17 if (extLen < 0) {
18 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
19 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
20 return SECFailure;
21 }
22 total_exten_len += extLen;
23 @@ -5472,7 +5472,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
24 /* how many suites are permitted by policy and user preference? */
25 num_suites = count_cipher_suites(ss, ss->ssl3.policy, PR_TRUE);
26 if (!num_suites) {
27 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
28 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
29 return SECFailure; /* count_cipher_suites has set error code. */
30 }
31
32 @@ -5517,7 +5517,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
33
34 rv = ssl3_AppendHandshakeHeader(ss, client_hello, length);
35 if (rv != SECSuccess) {
36 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
37 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
38 return rv; /* err set by ssl3_AppendHandshake* */
39 }
40
41 @@ -5536,21 +5536,21 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
42 rv = ssl3_AppendHandshakeNumber(ss, ss->clientHelloVersion, 2);
43 }
44 if (rv != SECSuccess) {
45 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
46 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
47 return rv; /* err set by ssl3_AppendHandshake* */
48 }
49
50 if (!resending) { /* Don't re-generate if we are in DTLS re-sending mode */
51 rv = ssl3_GetNewRandom(&ss->ssl3.hs.client_random);
52 if (rv != SECSuccess) {
53 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
54 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
55 return rv; /* err set by GetNewRandom. */
56 }
57 }
58 rv = ssl3_AppendHandshake(ss, &ss->ssl3.hs.client_random,
59 SSL3_RANDOM_LENGTH);
60 if (rv != SECSuccess) {
61 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
62 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
63 return rv; /* err set by ssl3_AppendHandshake* */
64 }
65
66 @@ -5560,7 +5560,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
67 else
68 rv = ssl3_AppendHandshakeNumber(ss, 0, 1);
69 if (rv != SECSuccess) {
70 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
71 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
72 return rv; /* err set by ssl3_AppendHandshake* */
73 }
74
75 @@ -5568,14 +5568,14 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
76 rv = ssl3_AppendHandshakeVariable(
77 ss, ss->ssl3.hs.cookie, ss->ssl3.hs.cookieLen, 1);
78 if (rv != SECSuccess) {
79 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
80 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
81 return rv; /* err set by ssl3_AppendHandshake* */
82 }
83 }
84
85 rv = ssl3_AppendHandshakeNumber(ss, num_suites*sizeof(ssl3CipherSuite), 2);
86 if (rv != SECSuccess) {
87 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
88 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
89 return rv; /* err set by ssl3_AppendHandshake* */
90 }
91
92 @@ -5584,7 +5584,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
93 rv = ssl3_AppendHandshakeNumber(ss, TLS_EMPTY_RENEGOTIATION_INFO_SCSV,
94 sizeof(ssl3CipherSuite));
95 if (rv != SECSuccess) {
96 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
97 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
98 return rv; /* err set by ssl3_AppendHandshake* */
99 }
100 actual_count++;
101 @@ -5593,7 +5593,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
102 rv = ssl3_AppendHandshakeNumber(ss, TLS_FALLBACK_SCSV,
103 sizeof(ssl3CipherSuite));
104 if (rv != SECSuccess) {
105 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
106 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
107 return rv; /* err set by ssl3_AppendHandshake* */
108 }
109 actual_count++;
110 @@ -5603,7 +5603,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
111 if (config_match(suite, ss->ssl3.policy, PR_TRUE, &ss->vrange, ss)) {
112 actual_count++;
113 if (actual_count > num_suites) {
114 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
115 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
116 /* set error card removal/insertion error */
117 PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
118 return SECFailure;
119 @@ -5611,7 +5611,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
120 rv = ssl3_AppendHandshakeNumber(ss, suite->cipher_suite,
121 sizeof(ssl3CipherSuite));
122 if (rv != SECSuccess) {
123 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
124 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
125 return rv; /* err set by ssl3_AppendHandshake* */
126 }
127 }
128 @@ -5622,14 +5622,14 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
129 * the server.. */
130 if (actual_count != num_suites) {
131 /* Card removal/insertion error */
132 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
133 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
134 PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
135 return SECFailure;
136 }
137
138 rv = ssl3_AppendHandshakeNumber(ss, numCompressionMethods, 1);
139 if (rv != SECSuccess) {
140 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
141 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
142 return rv; /* err set by ssl3_AppendHandshake* */
143 }
144 for (i = 0; i < compressionMethodsCount; i++) {
145 @@ -5637,7 +5637,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
146 continue;
147 rv = ssl3_AppendHandshakeNumber(ss, compressions[i], 1);
148 if (rv != SECSuccess) {
149 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
150 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
151 return rv; /* err set by ssl3_AppendHandshake* */
152 }
153 }
154 @@ -5648,20 +5648,20 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
155
156 rv = ssl3_AppendHandshakeNumber(ss, maxBytes, 2);
157 if (rv != SECSuccess) {
158 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
159 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
160 return rv; /* err set by AppendHandshake. */
161 }
162
163 extLen = ssl3_CallHelloExtensionSenders(ss, PR_TRUE, maxBytes, NULL);
164 if (extLen < 0) {
165 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
166 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
167 return SECFailure;
168 }
169 maxBytes -= extLen;
170
171 extLen = ssl3_AppendPaddingExtension(ss, paddingExtensionLen, maxBytes);
172 if (extLen < 0) {
173 - if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
174 + if (sid->u.ssl3.lock) { NSSRWLock_UnlockRead(sid->u.ssl3.lock); }
175 return SECFailure;
176 }
177 maxBytes -= extLen;
178 @@ -5670,7 +5670,7 @@ ssl3_SendClientHello(sslSocket *ss, PRBool resending)
179 }
180
181 if (sid->u.ssl3.lock) {
182 - PR_RWLock_Unlock(sid->u.ssl3.lock);
183 + NSSRWLock_UnlockRead(sid->u.ssl3.lock);
184 }
185
186 if (ss->xtnData.sentSessionTicketInClientHello) {
187 diff --git a/lib/ssl/sslimpl.h b/lib/ssl/sslimpl.h
188 index 3403091..874e59c 100644
189 --- a/lib/ssl/sslimpl.h
190 +++ b/lib/ssl/sslimpl.h
191 @@ -742,7 +742,7 @@ struct sslSessionIDStr {
192 * cached. Before then, there is no need to lock anything because
193 * the sid isn't being shared by anything.
194 */
195 - PRRWLock *lock;
196 + NSSRWLock *lock;
197
198 /* The lock must be held while reading or writing these members
199 * because they change while the sid is cached.
200 diff --git a/lib/ssl/sslnonce.c b/lib/ssl/sslnonce.c
201 index cefdda6..28ad364 100644
202 --- a/lib/ssl/sslnonce.c
203 +++ b/lib/ssl/sslnonce.c
204 @@ -136,7 +136,7 @@ ssl_DestroySID(sslSessionID *sid)
205 }
206
207 if (sid->u.ssl3.lock) {
208 - PR_DestroyRWLock(sid->u.ssl3.lock);
209 + NSSRWLock_Destroy(sid->u.ssl3.lock);
210 }
211 }
212
213 @@ -308,7 +308,7 @@ CacheSID(sslSessionID *sid)
214 PRINT_BUF(8, (0, "sessionID:",
215 sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength));
216
217 - sid->u.ssl3.lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, NULL);
218 + sid->u.ssl3.lock = NSSRWLock_New(NSS_RWLOCK_RANK_NONE, NULL);
219 if (!sid->u.ssl3.lock) {
220 return;
221 }
222 @@ -450,7 +450,7 @@ ssl3_SetSIDSessionTicket(sslSessionID *sid,
223 * yet, so no locking is needed.
224 */
225 if (sid->u.ssl3.lock) {
226 - PR_RWLock_Wlock(sid->u.ssl3.lock);
227 + NSSRWLock_LockWrite(sid->u.ssl3.lock);
228 if (sid->u.ssl3.locked.sessionTicket.ticket.data) {
229 SECITEM_FreeItem(&sid->u.ssl3.locked.sessionTicket.ticket,
230 PR_FALSE);
231 @@ -465,6 +465,6 @@ ssl3_SetSIDSessionTicket(sslSessionID *sid,
232 newSessionTicket->ticket.len = 0;
233
234 if (sid->u.ssl3.lock) {
235 - PR_RWLock_Unlock(sid->u.ssl3.lock);
236 + NSSRWLock_UnlockWrite(sid->u.ssl3.lock);
237 }
238 }
OLDNEW
« no previous file with comments | « net/third_party/nss/patches/nobypass.patch ('k') | net/third_party/nss/patches/reorderextensions.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698