コード例 #1
0
ファイル: LinuxTpmDevice.cs プロジェクト: tes001/TSS.MSR
        public LinuxTpmDevice(string tpmDevicePath = null)
        {
            _tpmDevicePath = tpmDevicePath ?? "/dev/tpmrm0";
            //Tpm2Device dev = new LinuxTpmDevice("/dev/tpmrm0");
            try
            {
                Connect();
            }
            catch (Exception)
            {
                //Console.WriteLine("Failed to connect to " + tpmDevicePath);

                // If the first attempt to connect was to the kernel mode TRM,
                // then try to connect to the raw TPM device, and vice versa.
                _tpmDevicePath = _tpmDevicePath.Contains("/dev/tpmrm")
                               ? _tpmDevicePath.Replace("/dev/tpmrm", "/dev/tpm") : "/dev/tpmrm0";
                try
                {
                    Connect();
                }
                catch (Exception)
                {
                    //Console.WriteLine("Failed to connect to " + tpmDevicePath);
                    Debug.Assert(_tpmIO == null);
                    TrmDevice = new TcpTpmDevice("127.0.0.1", 2323, false, true);
                    TrmDevice.Connect();
                }
            }
            Close();
        }
コード例 #2
0
ファイル: SlotManager.cs プロジェクト: pdb0102/TSS.MSR
 public Tbs(Tpm2Device theUnderlyingTpm, bool tpmHasRm)
 {
     TpmDevice      = theUnderlyingTpm;
     Tpm            = new Tpm2(TpmDevice);
     ContextManager = new ObjectContextManager();
     if (!tpmHasRm)
     {
         CleanTpm();
     }
 }
コード例 #3
0
ファイル: SlotManager.cs プロジェクト: Microsoft/TSS.MSR
 public Tbs(Tpm2Device theUnderlyingTpm, bool tpmHasRm)
 {
     TpmDevice = theUnderlyingTpm;
     Tpm = new Tpm2(TpmDevice);
     ContextManager = new ObjectContextManager();
     if (!tpmHasRm)
     {
         CleanTpm();
     }
 }
コード例 #4
0
ファイル: LinuxTpmDevice.cs プロジェクト: tes001/TSS.MSR
 protected override void Dispose(bool disposing)
 {
     Close();
     if (disposing)
     {
         if (_tpmIO != null)
         {
             _tpmIO.Dispose();
             _tpmIO = null;
         }
         if (TrmDevice != null)
         {
             TrmDevice.Dispose();
             TrmDevice = null;
         }
     }
 }
コード例 #5
0
        public LinuxTpmDevice(string tpmDevicePath = null)
        {
            _tpmDevicePath = tpmDevicePath ?? "/dev/tpm0";
//            _tpmDevicePath = tpmDevicePath ?? "/dev/tpmrm0";
            try
            {
                Connect();
            }
            catch (Exception)
            {
                //Console.WriteLine("Failed to connect to " + tpmDevicePath);

                try
                {
                    TctiCtx = AbrmdWrapper.Load(out TctiCtxPtr);
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Exception while loading tpm2-abrmd: {e}");
                }

                if (TctiCtx == null)
                {
                    // If the first attempt to connect was to the kernel mode TRM,
                    // then try to connect to the raw TPM device, and vice versa.
                    _tpmDevicePath = _tpmDevicePath.Contains("/dev/tpmrm")
                                   ? _tpmDevicePath.Replace("/dev/tpmrm", "/dev/tpm") : "/dev/tpmrm0";
                    try
                    {
                        Connect();
                    }
                    catch (Exception)
                    {
                        //Console.WriteLine("Failed to connect to " + tpmDevicePath);
                        Debug.Assert(_tpmIO == null);

                        TrmDevice = new TcpTpmDevice("127.0.0.1", 2323, false, true);
                        TrmDevice.Connect();
                    }
                }
            }
            Close();
        }
コード例 #6
0
ファイル: SlotManager.cs プロジェクト: pdb0102/TSS.MSR
 public void DestroyContext(Tpm2Device tpmDevice)
 {
     throw new NotImplementedException("");
 }
コード例 #7
0
 public TpmPassThroughDevice(Tpm2Device underlyingDevice)
 {
     Device = underlyingDevice;
 }
コード例 #8
0
ファイル: SlotManager.cs プロジェクト: Microsoft/TSS.MSR
 public void DestroyContext(Tpm2Device tpmDevice)
 {
     throw new NotImplementedException("");
 }
コード例 #9
0
ファイル: Tpm2.cs プロジェクト: vishalishere/TSS.MSR
 /// <summary>
 /// A Tpm2 must be created attached to an underlying device
 /// </summary>
 /// <param name="device"></param>
 /// <param name="mode"></param>
 public Tpm2(Tpm2Device device, Behavior b = Behavior.Default)
 {
     Device = device;
     _Behavior = b;
     Sessions = new SessionBase[0];
     Helpers = new TpmHelpers(this);
 }
コード例 #10
0
ファイル: Tpm2.cs プロジェクト: vishalishere/TSS.MSR
 public void Dispose()
 {
     if (Device != null)
     {
         Device.Dispose();
     }
     Device = null;
 }