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

Side by Side Diff: net/third_party/nss/ssl/derive.c

Issue 11275240: Update net/third_party/nss/ssl to NSS 3.14. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Upload before commit Created 8 years, 1 month 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
« no previous file with comments | « net/third_party/nss/ssl/cmpcert.c ('k') | net/third_party/nss/ssl/dtls1con.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Key Derivation that doesn't use PKCS11 2 * Key Derivation that doesn't use PKCS11
3 * 3 *
4 * ***** BEGIN LICENSE BLOCK ***** 4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 * The contents of this file are subject to the Mozilla Public License Version 7 /* $Id: derive.c,v 1.16 2012/06/11 02:38:30 emaldona%redhat.com Exp $ */
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is the Netscape security libraries.
18 *
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1994-2005
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39 /* $Id: derive.c,v 1.13 2011/03/22 22:15:22 alexei.volkov.bugs%sun.com Exp $ */
40 8
41 #include "ssl.h" /* prereq to sslimpl.h */ 9 #include "ssl.h" /* prereq to sslimpl.h */
42 #include "certt.h" /* prereq to sslimpl.h */ 10 #include "certt.h" /* prereq to sslimpl.h */
43 #include "keythi.h" /* prereq to sslimpl.h */ 11 #include "keythi.h" /* prereq to sslimpl.h */
44 #include "sslimpl.h" 12 #include "sslimpl.h"
13 #ifndef NO_PKCS11_BYPASS
45 #include "blapi.h" 14 #include "blapi.h"
15 #endif
46 16
47 #include "keyhi.h" 17 #include "keyhi.h"
48 #include "pk11func.h" 18 #include "pk11func.h"
49 #include "secasn1.h" 19 #include "secasn1.h"
50 #include "cert.h" 20 #include "cert.h"
51 #include "secmodt.h" 21 #include "secmodt.h"
52 22
53 #include "sslproto.h" 23 #include "sslproto.h"
54 #include "sslerr.h" 24 #include "sslerr.h"
55 25
26 #ifndef NO_PKCS11_BYPASS
56 /* make this a macro! */ 27 /* make this a macro! */
57 #ifdef NOT_A_MACRO 28 #ifdef NOT_A_MACRO
58 static void 29 static void
59 buildSSLKey(unsigned char * keyBlock, unsigned int keyLen, SECItem * result, 30 buildSSLKey(unsigned char * keyBlock, unsigned int keyLen, SECItem * result,
60 const char * label) 31 const char * label)
61 { 32 {
62 result->type = siBuffer; 33 result->type = siBuffer;
63 result->data = keyBlock; 34 result->data = keyBlock;
64 result->len = keyLen; 35 result->len = keyLen;
65 PRINT_BUF(100, (NULL, label, keyBlock, keyLen)); 36 PRINT_BUF(100, (NULL, label, keyBlock, keyLen));
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (ms == NULL) 534 if (ms == NULL)
564 return(SECFailure); 535 return(SECFailure);
565 536
566 rv = PK11_ExtractKeyValue(ms); 537 rv = PK11_ExtractKeyValue(ms);
567 *pcbp = (rv == SECSuccess); 538 *pcbp = (rv == SECSuccess);
568 PK11_FreeSymKey(ms); 539 PK11_FreeSymKey(ms);
569 540
570 return(rv); 541 return(rv);
571 542
572 } 543 }
544 #endif /* !NO_PKCS11_BYPASS */
573 545
574 /* Check the key exchange algorithm for each cipher in the list to see if 546 /* Check the key exchange algorithm for each cipher in the list to see if
575 * a master secret key can be extracted. If the KEA will use keys from the 547 * a master secret key can be extracted. If the KEA will use keys from the
576 * specified cert make sure the extract operation is attempted from the slot 548 * specified cert make sure the extract operation is attempted from the slot
577 * where the private key resides. 549 * where the private key resides.
578 * If MS can be extracted for all ciphers, (*pcanbypass) is set to TRUE and 550 * If MS can be extracted for all ciphers, (*pcanbypass) is set to TRUE and
579 * SECSuccess is returned. In all other cases but one (*pcanbypass) is 551 * SECSuccess is returned. In all other cases but one (*pcanbypass) is
580 * set to FALSE and SECFailure is returned. 552 * set to FALSE and SECFailure is returned.
581 * In that last case Derive() has been called successfully but the MS is null, 553 * In that last case Derive() has been called successfully but the MS is null,
582 * CanBypass sets (*pcanbypass) to FALSE and returns SECSuccess indicating the 554 * CanBypass sets (*pcanbypass) to FALSE and returns SECSuccess indicating the
583 * arguments were all valid but the slot cannot be bypassed. 555 * arguments were all valid but the slot cannot be bypassed.
584 */ 556 */
585 557
586 /* XXX Add SSL_CBP_TLS1_1 and test it in protocolmask when setting isTLS. */ 558 /* XXX Add SSL_CBP_TLS1_1 and test it in protocolmask when setting isTLS. */
587 559
588 SECStatus 560 SECStatus
589 SSL_CanBypass(CERTCertificate *cert, SECKEYPrivateKey *srvPrivkey, 561 SSL_CanBypass(CERTCertificate *cert, SECKEYPrivateKey *srvPrivkey,
590 PRUint32 protocolmask, PRUint16 *ciphersuites, int nsuites, 562 PRUint32 protocolmask, PRUint16 *ciphersuites, int nsuites,
591 PRBool *pcanbypass, void *pwArg) 563 PRBool *pcanbypass, void *pwArg)
592 { SECStatus» rv; 564 {
565 #ifdef NO_PKCS11_BYPASS
566 if (!pcanbypass) {
567 PORT_SetError(SEC_ERROR_INVALID_ARGS);
568 return SECFailure;
569 }
570 *pcanbypass = PR_FALSE;
571 return SECSuccess;
572 #else
573 SECStatus» rv;
593 int i; 574 int i;
594 PRUint16 suite; 575 PRUint16 suite;
595 PK11SymKey * pms = NULL; 576 PK11SymKey * pms = NULL;
596 SECKEYPublicKey * srvPubkey = NULL; 577 SECKEYPublicKey * srvPubkey = NULL;
597 KeyType privKeytype; 578 KeyType privKeytype;
598 PK11SlotInfo * slot = NULL; 579 PK11SlotInfo * slot = NULL;
599 SECItem param; 580 SECItem param;
600 CK_VERSION version; 581 CK_VERSION version;
601 CK_MECHANISM_TYPE mechanism_array[2]; 582 CK_MECHANISM_TYPE mechanism_array[2];
602 SECItem enc_pms = {siBuffer, NULL, 0}; 583 SECItem enc_pms = {siBuffer, NULL, 0};
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 853 }
873 #endif /* NSS_ENABLE_ECC */ 854 #endif /* NSS_ENABLE_ECC */
874 855
875 if (srvPubkey) { 856 if (srvPubkey) {
876 SECKEY_DestroyPublicKey(srvPubkey); 857 SECKEY_DestroyPublicKey(srvPubkey);
877 srvPubkey = NULL; 858 srvPubkey = NULL;
878 } 859 }
879 860
880 861
881 return rv; 862 return rv;
863 #endif /* NO_PKCS11_BYPASS */
882 } 864 }
883 865
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/cmpcert.c ('k') | net/third_party/nss/ssl/dtls1con.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698