Exemple #1
0
static void printCapabilities(int fd) {
	fprintf(stdout, "  Capabilities:\n");
	fprintf(stdout, "    DRM_CAP_DUMB_BUFFER: %s\n",
			getCapability(fd, DRM_CAP_DUMB_BUFFER));
	fprintf(stdout, "    DRM_CAP_VBLANK_HIGH_CRTC: %s\n",
			getCapability(fd, DRM_CAP_VBLANK_HIGH_CRTC));
	fprintf(stdout, "    DRM_CAP_DUMB_PREFERRED_DEPTH: %s\n",
			getCapability(fd, DRM_CAP_DUMB_PREFERRED_DEPTH));
	fprintf(stdout, "    DRM_CAP_DUMB_PREFER_SHADOW: %s\n",
			getCapability(fd, DRM_CAP_DUMB_PREFER_SHADOW));
	fprintf(stdout, "    DRM_CAP_PRIME: %s\n",
			getCapability(fd, DRM_CAP_PRIME));
}
Exemple #2
0
void State::disable(GLenum capability, int index)
{
    Capability* cap = getCapability(capability);
    cap->disable(index);
    if (m_mode == ImmediateMode)
        cap->apply();
}
Exemple #3
0
void State::enable(GLenum capability)
{
    Capability* cap = getCapability(capability);
    cap->enable();
    if (m_mode == ImmediateMode)
        cap->apply();
}
Exemple #4
0
TSS_RESULT getNVDataPublic(TSS_HTPM hTpm, TPM_NV_INDEX nvindex,
                           TPM_NV_DATA_PUBLIC **pub)
{
	TSS_RESULT res;
	UINT32 ulResultLen;
	BYTE *pResult;
	UINT64 off = 0;

	res = getCapability(hTpm, TSS_TPMCAP_NV_INDEX, sizeof(UINT32),
			    (BYTE *)&nvindex, &ulResultLen, &pResult);

	if (res != TSS_SUCCESS)
		return res;

	*pub = calloc(1, sizeof(TPM_NV_DATA_PUBLIC));
	if (*pub == NULL) {
		res = TSS_E_OUTOFMEMORY;
		goto err_exit;
	}

	res = unloadNVDataPublic(&off, pResult, ulResultLen, *pub);

	if (res != TSS_SUCCESS) {
		freeNVDataPublic(*pub);
		*pub = NULL;
	}
err_exit:
	return res;
}
Exemple #5
0
void State::enable(const GLenum capability, const int index)
{   
    Capability* cap = getCapability(capability);
    cap->enable(index);
    if (m_mode == ImmediateMode)
        cap->apply();
}
Exemple #6
0
void State::disable(const GLenum capability)
{
    Capability* cap = getCapability(capability);
    cap->disable();
    if (m_mode == ImmediateMode)
        cap->apply();
}
void LLViewerRegion::setSeedCapability(const std::string& url)
{
  if (getCapability("Seed") == url)
    {
      llwarns << "Ignoring duplicate seed capability" << llendl;
      return;
    }
	m_eventPoll.reset();
	
	m_capabilities.clear();
	setCapability("Seed", url);

	LLSD capabilityNames = LLSD::emptyArray();
	capabilityNames.append("ChatSessionRequest");
	capabilityNames.append("CopyInventoryFromNotecard");
	capabilityNames.append("DispatchRegionInfo");
	capabilityNames.append("EstateChangeInfo");
	capabilityNames.append("EventQueueGet");
	capabilityNames.append("FetchInventory");
	capabilityNames.append("WebFetchInventoryDescendents");
	capabilityNames.append("FetchLib");
	capabilityNames.append("FetchLibDescendents");
	capabilityNames.append("GroupProposalBallot");
	capabilityNames.append("HomeLocation");
	capabilityNames.append("MapLayer");
	capabilityNames.append("MapLayerGod");
	capabilityNames.append("NewFileAgentInventory");
	capabilityNames.append("ParcelPropertiesUpdate");
	capabilityNames.append("ParcelVoiceInfoRequest");
	capabilityNames.append("ProvisionVoiceAccountRequest");
	capabilityNames.append("RemoteParcelRequest");
	capabilityNames.append("RequestTextureDownload");
	capabilityNames.append("SearchStatRequest");
	capabilityNames.append("SearchStatTracking");
	capabilityNames.append("SendPostcard");
	capabilityNames.append("SendUserReport");
	capabilityNames.append("SendUserReportWithScreenshot");
	capabilityNames.append("ServerReleaseNotes");
	capabilityNames.append("StartGroupProposal");
	capabilityNames.append("UntrustedSimulatorMessage");
	capabilityNames.append("UpdateAgentLanguage");
	capabilityNames.append("UpdateGestureAgentInventory");
	capabilityNames.append("UpdateNotecardAgentInventory");
	capabilityNames.append("UpdateScriptAgent");
	capabilityNames.append("UpdateGestureTaskInventory");
	capabilityNames.append("UpdateNotecardTaskInventory");
	capabilityNames.append("UpdateScriptTask");
	capabilityNames.append("UploadBakedTexture");
	capabilityNames.append("ViewerStartAuction");
	capabilityNames.append("ViewerStats");
	// Please add new capabilities alphabetically to reduce
	// merge conflicts.

	llinfos << "posting to seed " << url << llendl;

	m_httpResponderPtr = BaseCapabilitiesComplete::build(this) ;
	LLHTTPClient::post( url, capabilityNames, m_httpResponderPtr );
}
void LLViewerRegion::failedSeedCapability()
{
	// Should we retry asking for caps?
	mImpl->mSeedCapAttempts++;
	std::string url = getCapability("Seed");
	if ( url.empty() )
	{
		LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL;
		return;
	}
	// After a few attempts, continue login.  We will keep trying once in-world:
	if ( mImpl->mSeedCapAttempts >= mImpl->mSeedCapMaxAttemptsBeforeLogin &&
		 STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState() )
	{
		LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED );
	}

	if ( mImpl->mSeedCapAttempts < mImpl->mSeedCapMaxAttempts)
	{
		LLSD capabilityNames = LLSD::emptyArray();
		mImpl->buildCapabilityNames(capabilityNames);

		llinfos << "posting to seed " << url << " (retry " 
				<< mImpl->mSeedCapAttempts << ")" << llendl;

		S32 id = ++mImpl->mHttpResponderID;
		LLHTTPClient::post(url, capabilityNames, 
						BaseCapabilitiesComplete::build(getHandle(), id),
						LLSD(), CAP_REQUEST_TIMEOUT);
	}
	else
	{
		// *TODO: Give a user pop-up about this error?
		LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts.  Giving up!" << LL_ENDL;
	}
}
void LLViewerRegion::setSeedCapability(const std::string& url)
{
	if (getCapability("Seed") == url)
    {
		// llwarns << "Ignoring duplicate seed capability" << llendl;
		return;
    }
	
	delete mImpl->mEventPoll;
	mImpl->mEventPoll = NULL;
	
	mImpl->mCapabilities.clear();
	setCapability("Seed", url);

	LLSD capabilityNames = LLSD::emptyArray();
	mImpl->buildCapabilityNames(capabilityNames);

	llinfos << "posting to seed " << url << llendl;

	S32 id = ++mImpl->mHttpResponderID;
	LLHTTPClient::post(url, capabilityNames, 
						BaseCapabilitiesComplete::build(getHandle(), id),
						LLSD(), CAP_REQUEST_TIMEOUT);
}
Exemple #10
0
int OpenTxFirmware::getCapability(const Capability capability)
{
  switch (capability) {
    case Imperial:
      if (IS_ARM(board))
        return 0;
      else
        return id.contains("imperial") ? 1 : 0;
    case ModelImage:
      if (IS_TARANIS(board))
        return 1;
      else
        return 0;
    case HasBeeper:
      if (IS_ARM(board))
        return 0;
      else
        return 1;
    case HasPxxCountry:
      return 1;
    case HasGeneralUnits:
      if (IS_ARM(board))
        return 1;
      else
        return 0;
    case HasNegAndSwitches:
      if (IS_ARM(board))
        return 1;
      else
        return 0;
    case PPMExtCtrl:
      return 1;
    case PPMFrameLength:
      return 40;
    case FlightModes:
      if (IS_ARM(board))
        return 9;
      else if (board==BOARD_GRUVIN9X)
        return 6;
      else
        return 5;
    case FlightModesHaveFades:
      return 1;
    case Heli:
      if (IS_TARANIS(board))
        return id.contains("noheli") ? 0 : 1;
      else
        return id.contains("heli") ? 1 : 0;
    case Gvars:
      if (IS_TARANIS(board))
        return id.contains("nogvars") ? 0 : 9;
      else if (id.contains("gvars"))
        return IS_ARM(board) ? 9 : 5;
      else
        return 0;
    case FlightModesName:
      return (IS_TARANIS(board) ? 10 : 6);
    case GvarsName:
      return 6;
    case HasChNames:
      return (IS_TARANIS(board) ? 1 : 0);
    case GvarsInCS:
    case HasFAIMode:
      return 1;
    case GvarsAreNamed:
    case GvarsFlightModes:
      return ((IS_ARM(board) || board==BOARD_GRUVIN9X) ? 1 : 0);
    case Mixes:
      return (IS_ARM(board) ? O9X_ARM_MAX_MIXERS : O9X_MAX_MIXERS);
    case OffsetWeight:
      return (IS_ARM(board) ? 500 : 245);
    case Timers:
      return 2;
    case PermTimers:
      if (board == BOARD_GRUVIN9X || IS_ARM(board))
        return 1;
      else
        return 0;
    case Pots:
      return (IS_TARANIS(board) ? 5 : 3);
    case Switches:
      return (IS_TARANIS(board) ? 8 : 7);
    case SwitchesPositions:
      return (IS_TARANIS(board) ? 22 : 9);
    case CustomFunctions:
      if (IS_ARM(board))
        return 64;
      else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
        return 24;
      else
        return 16;
    case LogicalSwitches:
      if (IS_ARM(board))
        return 32;
      else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
        return 15;
      else
        return 12;
    case CustomAndSwitches:
      if (IS_ARM(board))
        return getCapability(LogicalSwitches);
      else
        return 15/*4bits*/-9/*sw positions*/;
    case LogicalSwitchesExt:
      return (IS_ARM(board) ? true : false);
    case RotaryEncoders:
      if (board == BOARD_GRUVIN9X)
        return 2;
      else if (IS_SKY9X(board))
        return 1;
      else
        return 0;
    case Outputs:
      return (IS_ARM(board) ? O9X_ARM_NUM_CHNOUT : O9X_NUM_CHNOUT);
    case NumCurvePoints:
      return (IS_ARM(board) ? 512 : 104);
    case VoicesAsNumbers:
      return (IS_ARM(board) ? 0 : 1);
    case VoicesMaxLength:
      return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 :  6) : 0);
    case MultiLangVoice:
      return (IS_ARM(board) ? 1 : 0);
    case SoundPitch:
      return 1;
    case Haptic:
      return (board == BOARD_GRUVIN9X || IS_SKY9X(board) || board == BOARD_TARANIS_PLUS || id.contains("haptic"));
    case ModelTrainerEnable:
      if (IS_ARM(board))
        return 1;
      else
        return 0;
    case MaxVolume:
      return (IS_ARM(board) ? 23 : 7);
    case HasSoundMixer:
      return (IS_ARM(board) ? 1 : 0);
    case ExtraInputs:
      return 1;
    case ExtendedTrims:
      return 500;
    case Simulation:
      return 1;
    case DSM2Indexes:
      return 1;
    case NumCurves:
      return (IS_TARANIS(board) ? 32 : (IS_ARM(board) ? 16 : 8));
    case HasMixerNames:
      return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
    case HasExpoNames:
      return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
    case HasNoExpo:
      return (IS_TARANIS(board) ? false : true);
    case ChannelsName:
      return (IS_TARANIS(board) ? 6 : 0);
    case HasCvNames:
      return (IS_TARANIS(board) ? 1 : 0);
    case Telemetry:
      return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
    case TelemetryBars:
      return 1;
    case TelemetryCustomScreens:
      return IS_TARANIS(board) ? 3 : 2;
    case TelemetryCustomScreensFieldsPerLine:
      return IS_TARANIS(board) ? 3 : 2;
    case NoTelemetryProtocol:
      return IS_TARANIS(board) ? 1 : 0;
    case TelemetryUnits:
      return 0;
    case TelemetryTimeshift:
      return 1;
    case TelemetryMaxMultiplier:
      return (IS_ARM(board) ? 32 : 8);
    case PPMCenter:
      return 1;
    case SYMLimits:
      return 1;
    case OptrexDisplay:
      return (board==BOARD_SKY9X ? true : false);
    case HasVario:
      return 1;
    case HasVarioSink:
      return ((board == BOARD_GRUVIN9X || IS_ARM(board)) ? true : false);
    case HasFailsafe:
      return (IS_ARM(board) ? 32 : 0);
    case NumModules:
      return (IS_ARM(board) && !IS_9XRPRO(board)) ? 2 : 1;
    case HasPPMStart:
      return (IS_ARM(board) ? true : false);
    case HasCurrentCalibration:
      return (IS_SKY9X(board) ? true : false);
    case HasVolume:
      return (IS_ARM(board) ? true : false);
    case HasBrightness:
      return (IS_ARM(board) ? true : false);
    case PerModelTimers:
      return 1;
    case SlowScale:
      return (IS_ARM(board) ? 10 : 2);
    case SlowRange:
      return (IS_ARM(board) ? 250 : 15);
    case CSFunc:
      return 18;
    case HasSDLogs:
      return ((board == BOARD_GRUVIN9X || IS_ARM(board)) ? true : false);
    case LCDWidth:
      return (IS_TARANIS(board) ? 212 : 128) ;
    case GetThrSwitch:
      return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ;
    case HasDisplayText:
      return IS_ARM(board) ? 1 : 0;
    case VirtualInputs:
      return IS_TARANIS(board) ? 32 : 0;
    case TrainerInputs:
      return IS_ARM(board) ? 16 : 8;
    case LuaScripts:
      return IS_TARANIS(board) ? 7 : 0;
    case LuaInputsPerScript:
      return IS_TARANIS(board) ? 10 : 0;
    case LuaOutputsPerScript:
      return IS_TARANIS(board) ? 6 : 0;
    case LimitsPer1000:
    case EnhancedCurves:
      return IS_TARANIS(board);
    case HasFasOffset:
      return (IS_STOCK(board) ? false : true);
    case HasMahPersistent:
      return (IS_ARM(board) ? true : false);
    case MultiposPots:
      return IS_TARANIS(board) ? 3 : 0;
    case MultiposPotsPositions:
      return IS_TARANIS(board) ? 6 : 0;
    case SimulatorVariant:
      if (board == BOARD_STOCK)
        return SIMU_STOCK_VARIANTS;
      else if (board == BOARD_M128)
        return SIMU_M128_VARIANTS;
      else
        return 0;
    case MavlinkTelemetry:
      return id.contains("mavlink") ? 1 : 0;
    default:
      return 0;
  }
}
Exemple #11
0
static int getCapabilities( DEVICE_INFO *deviceInfo,
							const PKCS11_MECHANISM_INFO *mechanismInfoPtr, 
							const int maxMechanisms )
	{
	CAPABILITY_INFO_LIST *capabilityInfoListTail = \
				( CAPABILITY_INFO_LIST * ) deviceInfo->capabilityInfoList;
	int i;

	assert( isWritePtr( deviceInfo, sizeof( DEVICE_INFO ) ) );
	assert( isReadPtr( mechanismInfoPtr, \
					   maxMechanisms * sizeof( PKCS11_MECHANISM_INFO ) ) );

	static_assert( sizeof( CAPABILITY_INFO ) == sizeof( VARIABLE_CAPABILITY_INFO ),
				   "Variable capability-info-struct" );

	/* Find the end of the list to add new capabilities */
	if( capabilityInfoListTail != NULL )
		{
		while( capabilityInfoListTail->next != NULL )
			capabilityInfoListTail = capabilityInfoListTail->next;
		}

	/* Add capability information for each recognised mechanism type */
	for( i = 0; i < maxMechanisms && \
				mechanismInfoPtr[ i ].mechanism != CKM_NONE; i++ )
		{
		CAPABILITY_INFO_LIST *newCapabilityList;
		CAPABILITY_INFO *newCapability;
		const CRYPT_ALGO_TYPE cryptAlgo = mechanismInfoPtr[ i ].cryptAlgo;

		/* If the assertion below triggers then the PKCS #11 driver is 
		   broken since it's returning inconsistent information such as 
		   illegal key length data, conflicting algorithm information, etc 
		   etc.  This assertion is included here to detect buggy drivers 
		   early on rather than forcing users to step through the PKCS #11 
		   glue code to find out why an operation is failing.
		   
		   Because some tinkertoy implementations support only the bare 
		   minimum functionality (e.g.RSA private key ops and nothing else),
		   we allow asymmetric functionality for PKCs */
		newCapability = getCapability( deviceInfo, &mechanismInfoPtr[ i ],
									   maxMechanisms - i );
		if( newCapability == NULL )
			continue;
		REQUIRES( sanityCheckCapability( newCapability ) );
		if( ( newCapabilityList = \
						clAlloc( "getCapabilities", \
								 sizeof( CAPABILITY_INFO_LIST ) ) ) == NULL )
			{
			clFree( "getCapabilities", newCapability );
			continue;
			}
		newCapabilityList->info = newCapability;
		newCapabilityList->next = NULL;
		if( deviceInfo->capabilityInfoList == NULL )
			deviceInfo->capabilityInfoList = newCapabilityList;
		else
			capabilityInfoListTail->next = newCapabilityList;
		capabilityInfoListTail = newCapabilityList;

		/* Since there may be alternative mechanisms to the current one 
		   defined, we have to skip mechanisms until we find a ones for a
		   new algorithm */
		while( mechanismInfoPtr[ i + 1 ].cryptAlgo == cryptAlgo && \
			   i < maxMechanisms )
			i++;
		ENSURES( i < maxMechanisms );
		}
	ENSURES( i < maxMechanisms );

	return( ( deviceInfo->capabilityInfoList == NULL ) ? CRYPT_ERROR : CRYPT_OK );
	}
void LLViewerRegion::setSeedCapability(const std::string& url)
{
	if (getCapability("Seed") == url)
    {
		// llwarns << "Ignoring duplicate seed capability" << llendl;
		return;
    }
	
	delete mEventPoll;
	mEventPoll = NULL;
	
	mCapabilities.clear();
	setCapability("Seed", url);

	LLSD capabilityNames = LLSD::emptyArray();
	
	capabilityNames.append("AttachmentResources");
	capabilityNames.append("AvatarPickerSearch");
	capabilityNames.append("ChatSessionRequest");
	capabilityNames.append("CopyInventoryFromNotecard");
	capabilityNames.append("DispatchRegionInfo");
	capabilityNames.append("EstateChangeInfo");
	capabilityNames.append("EventQueueGet");
	capabilityNames.append("ObjectMedia");
	capabilityNames.append("ObjectMediaNavigate");

	if (gSavedSettings.getBOOL("UseHTTPInventory"))
	{
		capabilityNames.append("FetchLib2");
		capabilityNames.append("FetchLibDescendents2");
		capabilityNames.append("FetchInventory2");
		capabilityNames.append("FetchInventoryDescendents2");
	}

	capabilityNames.append("GetDisplayNames");
	capabilityNames.append("GetTexture");
	capabilityNames.append("GroupProposalBallot");
	capabilityNames.append("HomeLocation");
	capabilityNames.append("LandResources");
	capabilityNames.append("MapLayer");
	capabilityNames.append("MapLayerGod");
	capabilityNames.append("NewFileAgentInventory");
	capabilityNames.append("ParcelPropertiesUpdate");
	capabilityNames.append("ParcelMediaURLFilterList");
	capabilityNames.append("ParcelNavigateMedia");
	capabilityNames.append("ParcelVoiceInfoRequest");
	capabilityNames.append("ProductInfoRequest");
	capabilityNames.append("ProvisionVoiceAccountRequest");
	capabilityNames.append("RemoteParcelRequest");
	capabilityNames.append("RequestTextureDownload");
	capabilityNames.append("SearchStatRequest");
	capabilityNames.append("SearchStatTracking");
	capabilityNames.append("SendPostcard");
	capabilityNames.append("SendUserReport");
	capabilityNames.append("SendUserReportWithScreenshot");
	capabilityNames.append("ServerReleaseNotes");
	capabilityNames.append("SetDisplayName");
	capabilityNames.append("SimConsoleAsync");
	capabilityNames.append("StartGroupProposal");
	capabilityNames.append("TextureStats");
	capabilityNames.append("UntrustedSimulatorMessage");
	capabilityNames.append("UpdateAgentInformation");
	capabilityNames.append("UpdateAgentLanguage");
	capabilityNames.append("UpdateGestureAgentInventory");
	capabilityNames.append("UpdateNotecardAgentInventory");
	capabilityNames.append("UpdateScriptAgent");
	capabilityNames.append("UpdateGestureTaskInventory");
	capabilityNames.append("UpdateNotecardTaskInventory");
	capabilityNames.append("UpdateScriptTask");
	capabilityNames.append("UploadBakedTexture");
	capabilityNames.append("ViewerMetrics");
	capabilityNames.append("ViewerStartAuction");
	capabilityNames.append("ViewerStats");
	// Please add new capabilities alphabetically to reduce
	// merge conflicts.

	llinfos << "posting to seed " << url << llendl;

	mHttpResponderPtr = BaseCapabilitiesComplete::build(this) ;
	LLHTTPClient::post(url, capabilityNames, mHttpResponderPtr);
}
Exemple #13
0
int cmdVersion(const char *a_szCmd)
{
	TSS_HTPM hTpm;
	UINT32 uiSubCap;
	BYTE *pSubCap;
	UINT32 uiResultLen;
	BYTE *pResult;
	int iRc = -1;

	if (contextCreate(&hContext) != TSS_SUCCESS)
		goto out;

	if (contextConnect(hContext) != TSS_SUCCESS)
		goto out_close;

	if (contextGetTpm(hContext, &hTpm) != TSS_SUCCESS)
		goto out_close;

#ifdef TSS_LIB_IS_12
	{
		UINT64 offset;
		TSS_RESULT uiResult;
		TPM_CAP_VERSION_INFO versionInfo;
		int tmpLogLevel = iLogLevel;

		/* disable logging during this call. If we're on a 1.1 TPM, it'd throw an error */
		iLogLevel = LOG_LEVEL_NONE;

		if ((uiResult = getCapability(hTpm, TSS_TPMCAP_VERSION_VAL, 0, NULL, &uiResultLen,
					      &pResult)) != TSS_SUCCESS) {
			iLogLevel = tmpLogLevel;
			if (uiResult == TPM_E_BAD_MODE)
				goto print_cap_version;
			else
				goto out_close;
		}
		iLogLevel = tmpLogLevel;

		offset = 0;
		if ((uiResult = unloadVersionInfo(&offset, pResult, &versionInfo))) {
			goto out_close;
		}

		logMsg(_("  TPM 1.2 Version Info:\n"));
		logMsg(_("  Chip Version:        %hhu.%hhu.%hhu.%hhu\n"),
		       versionInfo.version.major, versionInfo.version.minor,
		       versionInfo.version.revMajor, versionInfo.version.revMinor);
		logMsg(_("  Spec Level:          %hu\n"), versionInfo.specLevel);
		logMsg(_("  Errata Revision:     %hhu\n"), versionInfo.errataRev);
		logMsg(_("  TPM Vendor ID:       %c%c%c%c\n"),
		       versionInfo.tpmVendorID[0], versionInfo.tpmVendorID[1],
		       versionInfo.tpmVendorID[2], versionInfo.tpmVendorID[3]);

		if (versionInfo.vendorSpecificSize) {
			logMsg(_("  Vendor Specific data: "));
			logHex(versionInfo.vendorSpecificSize, versionInfo.vendorSpecific);

			free(versionInfo.vendorSpecific);
		}
	}

print_cap_version:
#endif
	if (getCapability(hTpm, TSS_TPMCAP_VERSION, 0, NULL, &uiResultLen,
			  &pResult) != TSS_SUCCESS)
		goto out_close;
	logMsg(_("  TPM Version:         "));
	logHex(uiResultLen, pResult);

	uiSubCap = TSS_TPMCAP_PROP_MANUFACTURER;
	pSubCap = (BYTE *) & uiSubCap;
	if (getCapability(hTpm, TSS_TPMCAP_PROPERTY, sizeof(uiSubCap),
			  pSubCap, &uiResultLen, &pResult) != TSS_SUCCESS)
		goto out_close;
	logMsg(_("  Manufacturer Info:   "));
	logHex(uiResultLen, pResult);

	iRc = 0;
	logSuccess(a_szCmd);

      out_close:
	contextClose(hContext);

      out:
	return iRc;
}
Exemple #14
0
/*
 * Main MME Manager task which has to handle all incoming 
 * transformer management requests such as creating transformer
 * instantiations etc.
 *
 * May be run from the MME_Run() call
 */
void
mme_manager_task (void *param)
{
  MME_ERROR         res = MME_INTERNAL_ERROR;

  ICS_PORT          port;
  ICS_ERROR         err = ICS_SYSTEM_ERROR;

  MME_assert(mme_state);

  /* The local port was created in MME_Init() */
  port = mme_state->managerPort;
  MME_assert(port != ICS_INVALID_HANDLE_VALUE);

  MME_PRINTF(MME_DBG_MANAGER, "Starting: state %p port 0x%x\n", mme_state, port);

  /*
   * Loop forever, servicing requests
   */
  while (1)
  {
    ICS_MSG_DESC       rdesc;
    mme_manager_msg_t *message;
    
    /* 
     * Post a blocking receive
     */
    err = ICS_msg_recv(port, &rdesc, ICS_TIMEOUT_INFINITE);

    if (err != ICS_SUCCESS)
    {
      /* Don't report PORT_CLOSED as errors */
      if (err == ICS_PORT_CLOSED)
      {
	res = MME_SUCCESS;
      }
      else
      {
	MME_EPRINTF(MME_DBG_MANAGER, "ICS_msg_receive returned error : %s (%d)\n", 
		    ics_err_str(err), err);
	res = MME_ICS_ERROR;
      }

      /* Get outta here */
      break;
    }

    MME_assert(rdesc.data);
    MME_assert(rdesc.size);
    MME_assert(!(rdesc.mflags & ICS_INLINE));

    message = (mme_manager_msg_t *) rdesc.data;

    MME_PRINTF(MME_DBG_MANAGER, "received request: data %p size %d type 0x%x\n",
	       rdesc.data, rdesc.size, message->type);

    MME_assert(rdesc.size >= sizeof(mme_manager_msg_t));

    switch (message->type)
    {
    case _MME_MANAGER_TRANS_INIT:
      /* Instantiate a transformer instance */
      res = initTransformer(rdesc.srcCpu, rdesc.size, message);
      break;

    case _MME_MANAGER_TRANS_TERM:
      /* Terminate a transformer instance */
      res = termTransformer(rdesc.srcCpu, rdesc.size, message);
      break;

    case _MME_MANAGER_GET_CAPABILITY:
      /* Query a transformer capability */
      res = getCapability(rdesc.srcCpu, rdesc.size, message);
      break;

    default:
      MME_EPRINTF(MME_DBG_MANAGER, "port 0x%x Incorrect message %p size %d type 0x%x received\n",
		  port, rdesc.data, rdesc.size, message->type);

      MME_assert(0);

      /* Send a NACK to srcCpu */
      res = sendReply(message, rdesc.size, MME_INVALID_ARGUMENT);

      break;
    }

    MME_ASSERT(res == MME_SUCCESS);

    MME_PRINTF(MME_DBG_MANAGER, "completed req 0x%x res %d\n", message->type, res);

  } /* while(1) */

  /* Inform MME_Run() we are now exiting */
  _ICS_OS_EVENT_POST(&mme_state->managerExit);

  MME_PRINTF(MME_DBG_MANAGER, "exit : %s (%d)\n",
	     MME_Error_Str(res), res);

  return;
}