File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -300,10 +300,22 @@ func DecodeAttribute(data []byte) C.CK_ATTRIBUTE {
300300 attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (value ))
301301 } else if valueType .Elem () == reflect .TypeOf (* new (C.CK_MECHANISM_TYPE )) {
302302 value := remaining [4 : 4 + attribute .ulValueLen ]
303- attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (value ))
303+ arrayBuffer := bytes .NewBuffer (value )
304+
305+ mechanismTypeArray := make ([]C.CK_MECHANISM_TYPE , attribute .ulValueLen / 8 )
306+ for i := 0 ; i < len (ulongArray ); i ++ {
307+ mechanismTypeArray [i ] = DecodeUnsignedLong (arrayBuffer .Next (8 ))
308+ }
309+ attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (mechanismTypeArray ))
304310 } else if valueType .Elem () == reflect .TypeOf (* new (C.CK_ULONG )) {
305311 value := remaining [4 : 4 + attribute .ulValueLen ]
306- attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (value ))
312+ arrayBuffer := bytes .NewBuffer (value )
313+
314+ ulongArray := make ([]C.CK_ULONG , attribute .ulValueLen / 8 )
315+ for i := 0 ; i < len (ulongArray ); i ++ {
316+ ulongArray [i ] = DecodeUnsignedLong (arrayBuffer .Next (8 ))
317+ }
318+ attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (ulongArray ))
307319 } else if valueType .Elem () == reflect .TypeOf (* new (C.CK_UTF8CHAR )) {
308320 value := remaining [4 : 4 + attribute .ulValueLen ]
309321 attribute .pValue = C .CK_VOID_PTR (unsafe .SliceData (value ))
You can’t perform that action at this time.
0 commit comments