OLD | NEW |
1 /* | 1 /* |
2 * vtables (and methods that call through them) for the 4 types of | 2 * vtables (and methods that call through them) for the 4 types of |
3 * SSLSockets supported. Only one type is still supported. | 3 * SSLSockets supported. Only one type is still supported. |
4 * Various other functions. | 4 * Various other functions. |
5 * | 5 * |
6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
8 * | 8 * |
9 * The contents of this file are subject to the Mozilla Public License Version | 9 * The contents of this file are subject to the Mozilla Public License Version |
10 * 1.1 (the "License"); you may not use this file except in compliance with | 10 * 1.1 (the "License"); you may not use this file except in compliance with |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ss->ephemeralECDHKeyPair = !os->ephemeralECDHKeyPair ? NULL : | 329 ss->ephemeralECDHKeyPair = !os->ephemeralECDHKeyPair ? NULL : |
330 ssl3_GetKeyPairRef(os->ephemeralECDHKeyPair); | 330 ssl3_GetKeyPairRef(os->ephemeralECDHKeyPair); |
331 /* | 331 /* |
332 * XXX the preceding CERT_ and SECKEY_ functions can fail and return NULL. | 332 * XXX the preceding CERT_ and SECKEY_ functions can fail and return NULL. |
333 * XXX We should detect this, and not just march on with NULL pointers. | 333 * XXX We should detect this, and not just march on with NULL pointers. |
334 */ | 334 */ |
335 ss->authCertificate = os->authCertificate; | 335 ss->authCertificate = os->authCertificate; |
336 ss->authCertificateArg = os->authCertificateArg; | 336 ss->authCertificateArg = os->authCertificateArg; |
337 ss->getClientAuthData = os->getClientAuthData; | 337 ss->getClientAuthData = os->getClientAuthData; |
338 ss->getClientAuthDataArg = os->getClientAuthDataArg; | 338 ss->getClientAuthDataArg = os->getClientAuthDataArg; |
| 339 #ifdef NSS_PLATFORM_CLIENT_AUTH |
| 340 ss->getPlatformClientAuthData = os->getPlatformClientAuthData; |
| 341 ss->getPlatformClientAuthDataArg = os->getPlatformClientAuthDataArg; |
| 342 #endif |
339 ss->sniSocketConfig = os->sniSocketConfig; | 343 ss->sniSocketConfig = os->sniSocketConfig; |
340 ss->sniSocketConfigArg = os->sniSocketConfigArg; | 344 ss->sniSocketConfigArg = os->sniSocketConfigArg; |
341 ss->handleBadCert = os->handleBadCert; | 345 ss->handleBadCert = os->handleBadCert; |
342 ss->badCertArg = os->badCertArg; | 346 ss->badCertArg = os->badCertArg; |
343 ss->handshakeCallback = os->handshakeCallback; | 347 ss->handshakeCallback = os->handshakeCallback; |
344 ss->handshakeCallbackData = os->handshakeCallbackData; | 348 ss->handshakeCallbackData = os->handshakeCallbackData; |
345 ss->pkcs11PinArg = os->pkcs11PinArg; | 349 ss->pkcs11PinArg = os->pkcs11PinArg; |
346 | 350 |
347 /* Create security data */ | 351 /* Create security data */ |
348 rv = ssl_CopySecurityInfo(ss, os); | 352 rv = ssl_CopySecurityInfo(ss, os); |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 } | 1440 } |
1437 | 1441 |
1438 if (sm->authCertificate) | 1442 if (sm->authCertificate) |
1439 ss->authCertificate = sm->authCertificate; | 1443 ss->authCertificate = sm->authCertificate; |
1440 if (sm->authCertificateArg) | 1444 if (sm->authCertificateArg) |
1441 ss->authCertificateArg = sm->authCertificateArg; | 1445 ss->authCertificateArg = sm->authCertificateArg; |
1442 if (sm->getClientAuthData) | 1446 if (sm->getClientAuthData) |
1443 ss->getClientAuthData = sm->getClientAuthData; | 1447 ss->getClientAuthData = sm->getClientAuthData; |
1444 if (sm->getClientAuthDataArg) | 1448 if (sm->getClientAuthDataArg) |
1445 ss->getClientAuthDataArg = sm->getClientAuthDataArg; | 1449 ss->getClientAuthDataArg = sm->getClientAuthDataArg; |
| 1450 #ifdef NSS_PLATFORM_CLIENT_AUTH |
| 1451 if (sm->getPlatformClientAuthData) |
| 1452 ss->getPlatformClientAuthData = sm->getPlatformClientAuthData; |
| 1453 if (sm->getPlatformClientAuthDataArg) |
| 1454 ss->getPlatformClientAuthDataArg = sm->getPlatformClientAuthDataArg; |
| 1455 #endif |
1446 if (sm->sniSocketConfig) | 1456 if (sm->sniSocketConfig) |
1447 ss->sniSocketConfig = sm->sniSocketConfig; | 1457 ss->sniSocketConfig = sm->sniSocketConfig; |
1448 if (sm->sniSocketConfigArg) | 1458 if (sm->sniSocketConfigArg) |
1449 ss->sniSocketConfigArg = sm->sniSocketConfigArg; | 1459 ss->sniSocketConfigArg = sm->sniSocketConfigArg; |
1450 if (sm->handleBadCert) | 1460 if (sm->handleBadCert) |
1451 ss->handleBadCert = sm->handleBadCert; | 1461 ss->handleBadCert = sm->handleBadCert; |
1452 if (sm->badCertArg) | 1462 if (sm->badCertArg) |
1453 ss->badCertArg = sm->badCertArg; | 1463 ss->badCertArg = sm->badCertArg; |
1454 if (sm->handshakeCallback) | 1464 if (sm->handshakeCallback) |
1455 ss->handshakeCallback = sm->handshakeCallback; | 1465 ss->handshakeCallback = sm->handshakeCallback; |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 } | 2459 } |
2450 ss->stepDownKeyPair = NULL; | 2460 ss->stepDownKeyPair = NULL; |
2451 ss->dbHandle = CERT_GetDefaultCertDB(); | 2461 ss->dbHandle = CERT_GetDefaultCertDB(); |
2452 | 2462 |
2453 /* Provide default implementation of hooks */ | 2463 /* Provide default implementation of hooks */ |
2454 ss->authCertificate = SSL_AuthCertificate; | 2464 ss->authCertificate = SSL_AuthCertificate; |
2455 ss->authCertificateArg = (void *)ss->dbHandle; | 2465 ss->authCertificateArg = (void *)ss->dbHandle; |
2456 ss->sniSocketConfig = NULL; | 2466 ss->sniSocketConfig = NULL; |
2457 ss->sniSocketConfigArg = NULL; | 2467 ss->sniSocketConfigArg = NULL; |
2458 ss->getClientAuthData = NULL; | 2468 ss->getClientAuthData = NULL; |
| 2469 #ifdef NSS_PLATFORM_CLIENT_AUTH |
| 2470 ss->getPlatformClientAuthData = NULL; |
| 2471 ss->getPlatformClientAuthDataArg = NULL; |
| 2472 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
2459 ss->handleBadCert = NULL; | 2473 ss->handleBadCert = NULL; |
2460 ss->badCertArg = NULL; | 2474 ss->badCertArg = NULL; |
2461 ss->pkcs11PinArg = NULL; | 2475 ss->pkcs11PinArg = NULL; |
2462 | 2476 |
2463 ssl_ChooseOps(ss); | 2477 ssl_ChooseOps(ss); |
2464 ssl2_InitSocketPolicy(ss); | 2478 ssl2_InitSocketPolicy(ss); |
2465 ssl3_InitSocketPolicy(ss); | 2479 ssl3_InitSocketPolicy(ss); |
2466 | 2480 |
2467 if (makeLocks) { | 2481 if (makeLocks) { |
2468 status = ssl_MakeLocks(ss); | 2482 status = ssl_MakeLocks(ss); |
2469 if (status != SECSuccess) | 2483 if (status != SECSuccess) |
2470 goto loser; | 2484 goto loser; |
2471 } | 2485 } |
2472 status = ssl_CreateSecurityInfo(ss); | 2486 status = ssl_CreateSecurityInfo(ss); |
2473 if (status != SECSuccess) | 2487 if (status != SECSuccess) |
2474 goto loser; | 2488 goto loser; |
2475 status = ssl_InitGather(&ss->gs); | 2489 status = ssl_InitGather(&ss->gs); |
2476 if (status != SECSuccess) { | 2490 if (status != SECSuccess) { |
2477 loser: | 2491 loser: |
2478 ssl_DestroySocketContents(ss); | 2492 ssl_DestroySocketContents(ss); |
2479 ssl_DestroyLocks(ss); | 2493 ssl_DestroyLocks(ss); |
2480 PORT_Free(ss); | 2494 PORT_Free(ss); |
2481 ss = NULL; | 2495 ss = NULL; |
2482 } | 2496 } |
2483 } | 2497 } |
2484 return ss; | 2498 return ss; |
2485 } | 2499 } |
2486 | 2500 |
OLD | NEW |