func getPubKey(rw io.ReadWriter, keyHandle tpmutil.Handle, ca *commandAuth) (*pubKey, *responseAuth, uint32, error) {
	in := []interface{}{keyHandle, ca}
	var pk pubKey
	var ra responseAuth
	out := []interface{}{&pk, &ra}
	ret, err := submitTPMRequest(rw, tagRQUAuth1Command, ordGetPubKey, in, out)
	if err != nil {
		return nil, nil, 0, err
	}
	return &pk, &ra, ret, nil
}
getPubKey gets a public key from the TPM
package tpm
import (
	"encoding/binary"
	"errors"
	"io"
	"github.com/google/go-tpm/tpmutil"
)
func submitTPMRequest(rw io.ReadWriter, tag uint16, ord uint32, in []interface{}, out []interface{}) (uint32, error) {
	resp, code, err := tpmutil.RunCommand(rw, tpmutil.Tag(tag), tpmutil.Command(ord), in...)
	if err != nil {
		return 0, err
	}
	if code != tpmutil.RCSuccess {
		return uint32(code), tpmError(code)
	}
	_, err = tpmutil.Unpack(resp, out...)
	return 0, err
}
func oiap(rw io.ReadWriter) (*oiapResponse, error) {
	var resp oiapResponse
	out := []interface{}{&resp}
	if _, err := submitTPMRequest(rw, tagRQUCommand, ordOIAP, nil, out); err != nil {
		return nil, err
	}
	return &resp, nil
}
func osap(rw io.ReadWriter, osap *osapCommand) (*osapResponse, error) {
	in := []interface{}{osap}
	var resp osapResponse
	out := []interface{}{&resp}
	if _, err := submitTPMRequest(rw, tagRQUCommand, ordOSAP, in, out); err != nil {
		return nil, err
	}
	return &resp, nil
}
func seal(rw io.ReadWriter, sc *sealCommand, pcrs *pcrInfoLong, data tpmutil.U32Bytes, ca *commandAuth) (*tpmStoredData, *responseAuth, uint32, error) {
	pcrsize := binary.Size(pcrs)
	if pcrsize < 0 {
		return nil, nil, 0, errors.New("couldn't compute the size of a pcrInfoLong")
	}
	in := []interface{}{sc, uint32(pcrsize), pcrs, data, ca}
	var tsd tpmStoredData
	var ra responseAuth
	out := []interface{}{&tsd, &ra}
	ret, err := submitTPMRequest(rw, tagRQUAuth1Command, ordSeal, in, out)
	if err != nil {
		return nil, nil, 0, err
	}
	return &tsd, &ra, ret, nil
}
func unseal(rw io.ReadWriter, keyHandle tpmutil.Handle, sealed *tpmStoredData, ca1 *commandAuth, ca2 *commandAuth) ([]byte, *responseAuth, *responseAuth, uint32, error) {
	in := []interface{}{keyHandle, sealed, ca1, ca2}
	var outb tpmutil.U32Bytes
	var ra1 responseAuth
	var ra2 responseAuth
	out := []interface{}{&outb, &ra1, &ra2}
	ret, err := submitTPMRequest(rw, tagRQUAuth2Command, ordUnseal, in, out)
	if err != nil {
		return nil, nil, nil, 0, err
	}
	return outb, &ra1, &ra2, ret, nil
}
func authorizeMigrationKey(rw io.ReadWriter, migrationScheme MigrationScheme, migrationKey pubKey, ca *commandAuth) ([]byte, *responseAuth, uint32, error) {
	in := []interface{}{migrationScheme, migrationKey, ca}
	var ra responseAuth
	var migrationAuth migrationKeyAuth
	out := []interface{}{&migrationAuth, &ra}
	ret, err := submitTPMRequest(rw, tagRQUAuth1Command, ordAuthorizeMigrationKey, in, out)
	if err != nil {
		return nil, nil, 0, err
	}
	authBlob, err := tpmutil.Pack(migrationAuth)
	if err != nil {
		return nil, nil, 0, err
	}
	return authBlob, &ra, ret, nil
}
func createMigrationBlob(rw io.ReadWriter, parentHandle tpmutil.Handle, migrationScheme MigrationScheme, migrationKey []byte, encData tpmutil.U32Bytes, ca1 *commandAuth, ca2 *commandAuth) ([]byte, []byte, *responseAuth, *responseAuth, uint32, error) {
	in := []interface{}{parentHandle, migrationScheme, migrationKey, encData, ca1, ca2}
	var rand tpmutil.U32Bytes
	var outData tpmutil.U32Bytes
	var ra1 responseAuth
	var ra2 responseAuth
	out := []interface{}{&rand, &outData, &ra1, &ra2}
	ret, err := submitTPMRequest(rw, tagRQUAuth2Command, ordCreateMigrationBlob, in, out)
	if err != nil {
		return nil, nil, nil, nil, 0, err
	}
	return rand, outData, &ra1, &ra2, ret, nil
}
func flushSpecific(rw io.ReadWriter, handle tpmutil.Handle, resourceType uint32) error {
	_, err := submitTPMRequest(rw, tagRQUCommand, ordFlushSpecific, []interface{}{handle, resourceType}, nil)
	return err
}
func loadKey2(rw io.ReadWriter, k *key, ca *commandAuth) (tpmutil.Handle, *responseAuth, uint32, error) {
	in := []interface{}{khSRK, k, ca}
	var keyHandle tpmutil.Handle
	var ra responseAuth
	out := []interface{}{&keyHandle, &ra}
	ret, err := submitTPMRequest(rw, tagRQUAuth1Command, ordLoadKey2, in, out)
	if err != nil {
		return 0, nil, 0, err
	}
	return keyHandle, &ra, ret, nil
}