@@ -17,7 +17,7 @@ const (
17
17
18
18
type Device interface {
19
19
ProbeDevice () error
20
- Report (nonce , userData string , extraArgs map [string ]any ) (evidence_api.CcReport , error )
20
+ Report (nonce , userData [] byte , extraArgs map [string ]any ) (evidence_api.CcReport , error )
21
21
Name () string
22
22
CCType () evidence_api.CC_Type
23
23
Version () evidence_api.DeviceVersion
@@ -27,7 +27,7 @@ type GenericDevice struct {
27
27
Device
28
28
}
29
29
30
- func (d * GenericDevice ) Report (nonce , userData string , extraArgs map [string ]any ) (evidence_api.CcReport , error ) {
30
+ func (d * GenericDevice ) Report (nonce , userData [] byte , extraArgs map [string ]any ) (evidence_api.CcReport , error ) {
31
31
var err error
32
32
if _ , err = os .Stat (TSM_PREFIX ); os .IsNotExist (err ) {
33
33
return evidence_api.CcReport {}, errors .New ("Configfs TSM is not supported in the current environment." )
@@ -36,18 +36,18 @@ func (d *GenericDevice) Report(nonce, userData string, extraArgs map[string]any)
36
36
// concatenate nonce and userData
37
37
// check if the data is base64 encoded, if yes, decode before doing hash
38
38
hasher := sha512 .New ()
39
- if nonce != "" {
40
- val , err := base64 .StdEncoding .DecodeString (nonce )
39
+ if nonce != nil {
40
+ val , err := base64 .StdEncoding .DecodeString (string ( nonce ) )
41
41
if err != nil {
42
- hasher .Write ([] byte ( nonce ) )
42
+ hasher .Write (nonce )
43
43
} else {
44
44
hasher .Write (val )
45
45
}
46
46
}
47
- if userData != "" {
48
- val , err := base64 .StdEncoding .DecodeString (userData )
47
+ if userData != nil {
48
+ val , err := base64 .StdEncoding .DecodeString (string ( userData ) )
49
49
if err != nil {
50
- hasher .Write ([] byte ( userData ) )
50
+ hasher .Write (userData )
51
51
} else {
52
52
hasher .Write (val )
53
53
}
0 commit comments