Beispiel #1
0
 public ResponseAuthHandleInfoCore(TPMBlob blob, long startIndex)
 {
     blob.Seek(startIndex, SeekOrigin.Begin);
     _nonceEven           = blob.ReadBytes(20);
     _continueAuthSession = blob.ReadBool();
     _tpmAuthData         = blob.ReadBytes(20);
 }
        protected override TPMBlob TransmitMe(TPMBlob requestBlob)
        {
            using (_commandAuthHelper.AcquireLock())
            {
                try
                {
                    TPMBlob responseBlob;
                    //Make sure that all Authorization handles are loaded
                    _commandAuthHelper.LoadAuthorizationHandles(_currentAuthorizationInfos);

                    requestBlob.Seek(0, SeekOrigin.End);
                    foreach (AuthorizationInfo authInfo in _currentAuthorizationInfos)
                    {
                        WriteAuthorizationInfo(requestBlob, authInfo);
                    }

                    lock (_tpmProvider)
                    {
                        try
                        {
                            _log.DebugFormat("Processing {0}", this);
                            _log.DebugFormat("AuthHandles: ");
                            foreach (AuthorizationInfo authInfo in _currentAuthorizationInfos)
                            {
                                _log.DebugFormat(authInfo.Handle.ToString());
                            }
                            _log.DebugFormat("Before execution: {0}", GetCommandInternalsBeforeExecute());

                            responseBlob = _tpmProvider.TransmitAndCheck(requestBlob);
                        }
                        catch (Exception)
                        {
                            _log.DebugFormat("{0} FAILED", this);
                            throw;
                        }
                        finally
                        {
                            _log.DebugFormat("Processed {0}", this);
                        }
                    }
                    ReleaseAuthHandles(false, responseBlob);
                    return(responseBlob);
                }
                catch (Exception)
                {
                    ReleaseAuthHandles(true, null);
                    throw;
                }
            }
        }