@@ -903,12 +903,10 @@ func unmarshalParameter[C Command[R, *R], R any](buf *bytes.Buffer, cmd *C, i in
903903 return unmarshalStructField (buf , cmdValue , fieldIndex )
904904}
905905
906- // populateHandlesFromNames populates the handle fields of a command with NamedHandles
906+ // populateHandlesFromNames populates the handle fields of a command with handles
907907// created from the provided names.
908908//
909- // Supports different handle types based on struct tags:
910- // - gotpm:"handle" → NamedHandle (without handle value)
911- // - gotpm:"handle,auth" → AuthHandle (without handle value and nil Auth)
909+ // All handle fields are populated with [UnmarshalledHandle]
912910func populateHandlesFromNames [C Command [R , * R ], R any ](cmd * C , names []TPM2BName ) error {
913911 cmdValue := reflect .ValueOf (cmd ).Elem ()
914912 cmdType := reflect .TypeOf (* cmd )
@@ -930,19 +928,8 @@ func populateHandlesFromNames[C Command[R, *R], R any](cmd *C, names []TPM2BName
930928 return fmt .Errorf ("not enough names for handle field %d" , i )
931929 }
932930
933- // Create the appropriate handle type based on the "auth" tag
934- var handleValue any
935- if hasTag (field , "auth" ) {
936- handleValue = AuthHandle {
937- Handle : 0 , // Handle value not available from CommandPreimage
938- Name : names [nameIdx ],
939- Auth : nil , // No session available
940- }
941- } else {
942- handleValue = NamedHandle {
943- Handle : 0 , // Handle value not available from CommandPreimage
944- Name : names [nameIdx ],
945- }
931+ handleValue := UnmarshalledHandle {
932+ Name : names [nameIdx ],
946933 }
947934
948935 cmdValue .Field (i ).Set (reflect .ValueOf (handleValue ))
0 commit comments