Append() public method

public Append ( byte x ) : void
x byte
return void
Exemplo n.º 1
0
        public override void DispatchCommand(CommandModifier active, byte[] inBuf, out byte[] outBuf)
        {
            outBuf = new byte[] { 0x80, 0x01,            // TPM_ST_NO_SESSIONS
                                  0, 0, 0, 0x0A,         // length
                                  0x40, 0x28, 0x00, 0x10 // TSS_DISPATCH_FAILED
            };
            if (CommandStream == null)
            {
                return;
            }
            if (LinuxTrm)
            {
                if (Globs.NetToHost4U(Globs.CopyData(inBuf, 6, 4)) == (uint)TpmCc.Startup)
                {
                    outBuf[6] = outBuf[7] = 0; outBuf[8] = 0x01; outBuf[9] = 0; // TPM_RC_INITIALIZE
                    return;
                }
            }
            UndoCancelContext();
            var b = new ByteBuf();

            b.Append(Globs.HostToNet((int)TcpTpmCommands.SendCommand));
            b.Append(new[] { active.ActiveLocality });
            if (LinuxTrm && OldTrm)
            {
                b.Append(new byte [] { 0, 1 });
            }
            b.Append(Globs.HostToNet(inBuf.Length));
            b.Append(inBuf);
            Write(CommandStream, b.GetBuffer());

            outBuf = ReadVarArray(CommandStream);

            GetAck(CommandStream, "DispatchCommand");
        }
Exemplo n.º 2
0
        private void SendVarArrayCmdAndGetAck(NetworkStream stream, TcpTpmCommands cmd, byte[] buf)
        {
            var b = new ByteBuf();

            b.Append(Globs.HostToNet((int)cmd));
            b.Append(Globs.HostToNet(buf.Length));
            b.Append(buf);
            Write(stream, b.GetBuffer());

            GetAck(stream, cmd.ToString());
        }
Exemplo n.º 3
0
 void ToNetValueType(Object o, string name)
 {
     if (Repr == DataRepresentation.Tpm)
     {
         Buffer.Append(Globs.HostToNet(o));
         return;
     }
     if (Repr == DataRepresentation.LittleEndian)
     {
         Buffer.Append(Globs.GetBytes(o));
     }
     throw new Exception("Unsupported marshaling type");
 }
Exemplo n.º 4
0
        public override void DispatchCommand(CommandModifier active, byte[] inBuf, out byte[] outBuf)
        {
            UndoCancelContext();
            var b = new ByteBuf();

            b.Append(Globs.HostToNet((int)TcpTpmCommands.SendCommand));
            b.Append(new[] { active.ActiveLocality });
            b.Append(Globs.HostToNet(inBuf.Length));
            b.Append(inBuf);
            Write(CommandStream, b.GetBuffer());

            outBuf = ReadVarArray(CommandStream);

            GetAck(CommandStream, "DispatchCommand");
        }