/* determine if hybrid platform, then actually load the DSO. */ static PRStatus freebl_LoadDSO(void) { PRLibrary *handle; const char *name = getLibName(); if (!name) { /*PR_SetError(PR_LOAD_LIBRARY_ERROR,0); */ return PR_FAILURE; } handle = loader_LoadLibrary(name); if (handle) { void *address = dlsym(handle, "NSSLOW_GetVector"); if (address) { NSSLOWGetVectorFn *getVector = (NSSLOWGetVectorFn *)address; const NSSLOWVector *dsoVector = getVector(); if (dsoVector) { unsigned short dsoVersion = dsoVector->version; unsigned short myVersion = NSSLOW_VERSION; if (MSB(dsoVersion) == MSB(myVersion) && LSB(dsoVersion) >= LSB(myVersion) && dsoVector->length >= sizeof(NSSLOWVector)) { vector = dsoVector; libraryName = name; blLib = handle; return PR_SUCCESS; } } } (void)dlclose(handle); } return PR_FAILURE; }
/* determine if hybrid platform, then actually load the DSO. */ static PRStatus freebl_LoadDSO( void ) { PRLibrary * handle; const char * name = getLibName(); if (!name) { PR_SetError(PR_LOAD_LIBRARY_ERROR, 0); return PR_FAILURE; } handle = loader_LoadLibrary(name); if (handle) { PRFuncPtr address = PR_FindFunctionSymbol(handle, "FREEBL_GetVector"); PRStatus status; if (address) { FREEBLGetVectorFn * getVector = (FREEBLGetVectorFn *)address; const FREEBLVector * dsoVector = getVector(); if (dsoVector) { unsigned short dsoVersion = dsoVector->version; unsigned short myVersion = FREEBL_VERSION; if (MSB(dsoVersion) == MSB(myVersion) && LSB(dsoVersion) >= LSB(myVersion) && dsoVector->length >= sizeof(FREEBLVector)) { vector = dsoVector; libraryName = name; blLib = handle; return PR_SUCCESS; } } } status = PR_UnloadLibrary(handle); PORT_Assert(PR_SUCCESS == status); } return PR_FAILURE; }