OLD | NEW |
1 /* | 1 /* |
2 * Various SSL functions. | 2 * Various SSL functions. |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 #include "cert.h" | 7 #include "cert.h" |
8 #include "secitem.h" | 8 #include "secitem.h" |
9 #include "keyhi.h" | 9 #include "keyhi.h" |
10 #include "ssl.h" | 10 #include "ssl.h" |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 tag = SECOID_GetAlgorithmTag(&(cert->subjectPublicKeyInfo.algorithm)); | 689 tag = SECOID_GetAlgorithmTag(&(cert->subjectPublicKeyInfo.algorithm)); |
690 | 690 |
691 switch (tag) { | 691 switch (tag) { |
692 case SEC_OID_X500_RSA_ENCRYPTION: | 692 case SEC_OID_X500_RSA_ENCRYPTION: |
693 case SEC_OID_PKCS1_RSA_ENCRYPTION: | 693 case SEC_OID_PKCS1_RSA_ENCRYPTION: |
694 keaType = kt_rsa; | 694 keaType = kt_rsa; |
695 break; | 695 break; |
696 case SEC_OID_X942_DIFFIE_HELMAN_KEY: | 696 case SEC_OID_X942_DIFFIE_HELMAN_KEY: |
697 keaType = kt_dh; | 697 keaType = kt_dh; |
698 break; | 698 break; |
699 #ifdef NSS_ENABLE_ECC | 699 #ifndef NSS_DISABLE_ECC |
700 case SEC_OID_ANSIX962_EC_PUBLIC_KEY: | 700 case SEC_OID_ANSIX962_EC_PUBLIC_KEY: |
701 keaType = kt_ecdh; | 701 keaType = kt_ecdh; |
702 break; | 702 break; |
703 #endif /* NSS_ENABLE_ECC */ | 703 #endif /* NSS_DISABLE_ECC */ |
704 default: | 704 default: |
705 keaType = kt_null; | 705 keaType = kt_null; |
706 } | 706 } |
707 | 707 |
708 loser: | 708 loser: |
709 | 709 |
710 return keaType; | 710 return keaType; |
711 } | 711 } |
712 | 712 |
713 static const PRCallOnceType pristineCallOnce; | 713 static const PRCallOnceType pristineCallOnce; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 if (os->sec.hash && os->sec.hashcx) { | 961 if (os->sec.hash && os->sec.hashcx) { |
962 ss->sec.hash = os->sec.hash; | 962 ss->sec.hash = os->sec.hash; |
963 ss->sec.hashcx = os->sec.hash->clone(os->sec.hashcx); | 963 ss->sec.hashcx = os->sec.hash->clone(os->sec.hashcx); |
964 if (os->sec.hashcx && !ss->sec.hashcx) | 964 if (os->sec.hashcx && !ss->sec.hashcx) |
965 goto loser; | 965 goto loser; |
966 } else { | 966 } else { |
967 ss->sec.hash = NULL; | 967 ss->sec.hash = NULL; |
968 ss->sec.hashcx = NULL; | 968 ss->sec.hashcx = NULL; |
969 } | 969 } |
970 | 970 |
971 SECITEM_CopyItem(0, &ss->sec.sendSecret, &os->sec.sendSecret); | 971 if (SECITEM_CopyItem(0, &ss->sec.sendSecret, &os->sec.sendSecret)) |
972 if (os->sec.sendSecret.data && !ss->sec.sendSecret.data) | |
973 goto loser; | 972 goto loser; |
974 SECITEM_CopyItem(0, &ss->sec.rcvSecret, &os->sec.rcvSecret); | 973 if (SECITEM_CopyItem(0, &ss->sec.rcvSecret, &os->sec.rcvSecret)) |
975 if (os->sec.rcvSecret.data && !ss->sec.rcvSecret.data) | |
976 goto loser; | 974 goto loser; |
977 | 975 |
978 /* XXX following code is wrong if either cx != 0 */ | 976 /* XXX following code is wrong if either cx != 0 */ |
979 PORT_Assert(os->sec.readcx == 0); | 977 PORT_Assert(os->sec.readcx == 0); |
980 PORT_Assert(os->sec.writecx == 0); | 978 PORT_Assert(os->sec.writecx == 0); |
981 ss->sec.readcx = os->sec.readcx; | 979 ss->sec.readcx = os->sec.readcx; |
982 ss->sec.writecx = os->sec.writecx; | 980 ss->sec.writecx = os->sec.writecx; |
983 ss->sec.destroy = 0; | 981 ss->sec.destroy = 0; |
984 | 982 |
985 ss->sec.enc = os->sec.enc; | 983 ss->sec.enc = os->sec.enc; |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 if (!ss) { | 1712 if (!ss) { |
1715 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", | 1713 SSL_DBG(("%d: SSL[%d]: bad socket in SNISocketConfigHook", |
1716 SSL_GETPID(), fd)); | 1714 SSL_GETPID(), fd)); |
1717 return SECFailure; | 1715 return SECFailure; |
1718 } | 1716 } |
1719 | 1717 |
1720 ss->sniSocketConfig = func; | 1718 ss->sniSocketConfig = func; |
1721 ss->sniSocketConfigArg = arg; | 1719 ss->sniSocketConfigArg = arg; |
1722 return SECSuccess; | 1720 return SECSuccess; |
1723 } | 1721 } |
OLD | NEW |