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

Side by Side Diff: nss/lib/pk11wrap/pk11load.c

Issue 1843333003: Update NSPR to 4.12 and NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: 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
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 /* 4 /*
5 * The following handles the loading, unloading and management of 5 * The following handles the loading, unloading and management of
6 * various PCKS #11 modules 6 * various PCKS #11 modules
7 */ 7 */
8 #define FORCE_PR_LOG 1 8 #define FORCE_PR_LOG 1
9 #include "seccomon.h" 9 #include "seccomon.h"
10 #include "pkcs11.h" 10 #include "pkcs11.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 /* 493 /*
494 * We need to get the function list 494 * We need to get the function list
495 */ 495 */
496 if ((*entry)((CK_FUNCTION_LIST_PTR *)&mod->functionList) != CKR_OK) 496 if ((*entry)((CK_FUNCTION_LIST_PTR *)&mod->functionList) != CKR_OK)
497 goto fail; 497 goto fail;
498 498
499 #ifdef DEBUG_MODULE 499 #ifdef DEBUG_MODULE
500 if (PR_TRUE) { 500 if (PR_TRUE) {
501 » modToDBG = PR_GetEnv("NSS_DEBUG_PKCS11_MODULE"); 501 » modToDBG = PR_GetEnvSecure("NSS_DEBUG_PKCS11_MODULE");
502 if (modToDBG && strcmp(mod->commonName, modToDBG) == 0) { 502 if (modToDBG && strcmp(mod->commonName, modToDBG) == 0) {
503 mod->functionList = (void *)nss_InsertDeviceLog( 503 mod->functionList = (void *)nss_InsertDeviceLog(
504 (CK_FUNCTION_LIST_PTR)mod->functionList); 504 (CK_FUNCTION_LIST_PTR)mod->functionList);
505 } 505 }
506 } 506 }
507 #endif 507 #endif
508 508
509 mod->isThreadSafe = PR_TRUE; 509 mod->isThreadSafe = PR_TRUE;
510 510
511 /* Now we initialize the module */ 511 /* Now we initialize the module */
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 mod->loaded = PR_TRUE; 584 mod->loaded = PR_TRUE;
585 mod->moduleID = nextModuleID++; 585 mod->moduleID = nextModuleID++;
586 return SECSuccess; 586 return SECSuccess;
587 fail2: 587 fail2:
588 if (enforceAlreadyInitializedError || (!alreadyLoaded)) { 588 if (enforceAlreadyInitializedError || (!alreadyLoaded)) {
589 PK11_GETTAB(mod)->C_Finalize(NULL); 589 PK11_GETTAB(mod)->C_Finalize(NULL);
590 } 590 }
591 fail: 591 fail:
592 mod->functionList = NULL; 592 mod->functionList = NULL;
593 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); 593 disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
594 if (library && !disableUnload) { 594 if (library && !disableUnload) {
595 PR_UnloadLibrary(library); 595 PR_UnloadLibrary(library);
596 } 596 }
597 return SECFailure; 597 return SECFailure;
598 } 598 }
599 599
600 SECStatus 600 SECStatus
601 SECMOD_UnloadModule(SECMODModule *mod) { 601 SECMOD_UnloadModule(SECMODModule *mod) {
602 PRLibrary *library; 602 PRLibrary *library;
603 char *disableUnload = NULL; 603 char *disableUnload = NULL;
604 604
605 if (!mod->loaded) { 605 if (!mod->loaded) {
606 return SECFailure; 606 return SECFailure;
607 } 607 }
608 if (finalizeModules) { 608 if (finalizeModules) {
609 if (mod->functionList &&!mod->moduleDBOnly) { 609 if (mod->functionList &&!mod->moduleDBOnly) {
610 PK11_GETTAB(mod)->C_Finalize(NULL); 610 PK11_GETTAB(mod)->C_Finalize(NULL);
611 } 611 }
612 } 612 }
613 mod->moduleID = 0; 613 mod->moduleID = 0;
614 mod->loaded = PR_FALSE; 614 mod->loaded = PR_FALSE;
615 615
616 /* do we want the semantics to allow unloading the internal library? 616 /* do we want the semantics to allow unloading the internal library?
617 * if not, we should change this to SECFailure and move it above the 617 * if not, we should change this to SECFailure and move it above the
618 * mod->loaded = PR_FALSE; */ 618 * mod->loaded = PR_FALSE; */
619 if (mod->internal && (mod->dllName == NULL)) { 619 if (mod->internal && (mod->dllName == NULL)) {
620 #ifndef NSS_STATIC 620 #ifndef NSS_STATIC
621 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) { 621 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) {
622 if (softokenLib) { 622 if (softokenLib) {
623 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); 623 disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
624 if (!disableUnload) { 624 if (!disableUnload) {
625 #ifdef DEBUG 625 #ifdef DEBUG
626 PRStatus status = PR_UnloadLibrary(softokenLib); 626 PRStatus status = PR_UnloadLibrary(softokenLib);
627 PORT_Assert(PR_SUCCESS == status); 627 PORT_Assert(PR_SUCCESS == status);
628 #else 628 #else
629 PR_UnloadLibrary(softokenLib); 629 PR_UnloadLibrary(softokenLib);
630 #endif 630 #endif
631 } 631 }
632 softokenLib = NULL; 632 softokenLib = NULL;
633 } 633 }
634 loadSoftokenOnce = pristineCallOnce; 634 loadSoftokenOnce = pristineCallOnce;
635 } 635 }
636 #endif 636 #endif
637 return SECSuccess; 637 return SECSuccess;
638 } 638 }
639 639
640 library = (PRLibrary *)mod->library; 640 library = (PRLibrary *)mod->library;
641 /* paranoia */ 641 /* paranoia */
642 if (library == NULL) { 642 if (library == NULL) {
643 #if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS) 643 #if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
644 if (strstr(mod->dllName, "nssckbi") != NULL) { 644 if (strstr(mod->dllName, "nssckbi") != NULL) {
645 return SECSuccess; 645 return SECSuccess;
646 } 646 }
647 #endif 647 #endif
648 return SECFailure; 648 return SECFailure;
649 } 649 }
650 650
651 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); 651 disableUnload = PR_GetEnvSecure("NSS_DISABLE_UNLOAD");
652 if (!disableUnload) { 652 if (!disableUnload) {
653 PR_UnloadLibrary(library); 653 PR_UnloadLibrary(library);
654 } 654 }
655 return SECSuccess; 655 return SECSuccess;
656 } 656 }
657 657
658 void 658 void
659 nss_DumpModuleLog(void) 659 nss_DumpModuleLog(void)
660 { 660 {
661 #ifdef DEBUG_MODULE 661 #ifdef DEBUG_MODULE
662 if (modToDBG) { 662 if (modToDBG) {
663 print_final_statistics(); 663 print_final_statistics();
664 } 664 }
665 #endif 665 #endif
666 } 666 }
OLDNEW
« no previous file with comments | « nss/lib/pk11wrap/pk11akey.c ('k') | nss/lib/pk11wrap/pk11mech.c » ('j') | nss/lib/util/secoid.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698