OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 for (cur = ss->ssl3.peerCertChain; cur; cur = cur->next) { | 89 for (cur = ss->ssl3.peerCertChain; cur; cur = cur->next) { |
90 if (*certsSize < inSize) | 90 if (*certsSize < inSize) |
91 certs[*certsSize] = CERT_DupCertificate(cur->cert); | 91 certs[*certsSize] = CERT_DupCertificate(cur->cert); |
92 (*certsSize)++; | 92 (*certsSize)++; |
93 } | 93 } |
94 | 94 |
95 return SECSuccess; | 95 return SECSuccess; |
96 } | 96 } |
97 | 97 |
| 98 SECStatus |
| 99 SSL_SetPredictedPeerCertificates(PRFileDesc *fd, CERTCertificate **certs, |
| 100 unsigned int numCerts) |
| 101 { |
| 102 sslSocket *ss; |
| 103 unsigned int i; |
| 104 |
| 105 ss = ssl_FindSocket(fd); |
| 106 if (!ss) { |
| 107 SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetPredictedPeerCertificates", |
| 108 SSL_GETPID(), fd)); |
| 109 return SECFailure; |
| 110 } |
| 111 |
| 112 ss->ssl3.predictedCertChain = |
| 113 PORT_NewArray(CERTCertificate*, numCerts + 1); |
| 114 if (!ss->ssl3.predictedCertChain) |
| 115 return SECFailure; /* error code was set */ |
| 116 for (i = 0; i < numCerts; i++) |
| 117 ss->ssl3.predictedCertChain[i] = CERT_DupCertificate(certs[i]); |
| 118 ss->ssl3.predictedCertChain[numCerts] = NULL; |
| 119 |
| 120 return SECSuccess; |
| 121 } |
| 122 |
98 /* NEED LOCKS IN HERE. */ | 123 /* NEED LOCKS IN HERE. */ |
99 CERTCertificate * | 124 CERTCertificate * |
100 SSL_LocalCertificate(PRFileDesc *fd) | 125 SSL_LocalCertificate(PRFileDesc *fd) |
101 { | 126 { |
102 sslSocket *ss; | 127 sslSocket *ss; |
103 | 128 |
104 ss = ssl_FindSocket(fd); | 129 ss = ssl_FindSocket(fd); |
105 if (!ss) { | 130 if (!ss) { |
106 SSL_DBG(("%d: SSL[%d]: bad socket in PeerCertificate", | 131 SSL_DBG(("%d: SSL[%d]: bad socket in PeerCertificate", |
107 SSL_GETPID(), fd)); | 132 SSL_GETPID(), fd)); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 hostname = ss->url; | 354 hostname = ss->url; |
330 if (hostname && hostname[0]) | 355 if (hostname && hostname[0]) |
331 rv = CERT_VerifyCertName(ss->sec.peerCert, hostname); | 356 rv = CERT_VerifyCertName(ss->sec.peerCert, hostname); |
332 else | 357 else |
333 rv = SECFailure; | 358 rv = SECFailure; |
334 if (rv != SECSuccess) | 359 if (rv != SECSuccess) |
335 PORT_SetError(SSL_ERROR_BAD_CERT_DOMAIN); | 360 PORT_SetError(SSL_ERROR_BAD_CERT_DOMAIN); |
336 | 361 |
337 return rv; | 362 return rv; |
338 } | 363 } |
OLD | NEW |