Skip to content

Commit

Permalink
p11mod: Friendly trace for GetAttributeValue query
Browse files Browse the repository at this point in the history
Refs #58
  • Loading branch information
Jeremy Rand committed Aug 9, 2022
1 parent 464e518 commit 7dc4b42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion p11mod/p11mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func (ll *llBackend) GetAttributeValue(sh pkcs11.SessionHandle, oh pkcs11.Object
result := make([]*pkcs11.Attribute, len(a))
for i, t := range a {
if trace {
log.Printf("p11mod GetAttributeValue: Type %d", t.Type)
log.Printf("p11mod GetAttributeValue: querying %s", pkcs11mod.AttrTrace(t))
}

value, err := object.Attribute(t.Type)
Expand Down
4 changes: 2 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func fromTemplate(template []*pkcs11.Attribute, clist C.CK_ATTRIBUTE_PTR) error
bufferTooSmall := false
for i, x := range template {
if trace {
log.Printf("pkcs11mod fromTemplate: %s", attrTrace(x))
log.Printf("pkcs11mod fromTemplate: %s", AttrTrace(x))
}

c := l1[i]
Expand Down Expand Up @@ -371,7 +371,7 @@ var strCKA = map[uint]string{
pkcs11.CKA_CERT_MD5_HASH:"CKA_CERT_MD5_HASH",
}

func attrTrace(a *pkcs11.Attribute) string {
func AttrTrace(a *pkcs11.Attribute) string {
t, ok := strCKA[a.Type]
if !ok {
t = fmt.Sprintf("%d", a.Type)
Expand Down

0 comments on commit 7dc4b42

Please sign in to comment.