Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osxkeychain/osxkeychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func FindAndValidateIdentity(identityLabel string) (*IdentityWithRefModel, error
// you can use the ReleaseIdentityWithRefList method to do that
func FindIdentity(identityLabel string) ([]IdentityWithRefModel, error) {

queryDict := C.CFDictionaryCreateMutable(nil, 0, nil, nil)
queryDict := C.CFDictionaryCreateMutable(C.kCFAllocatorDefault, 0, nil, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reference/docs why C.kCFAllocatorDefault?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the change was based on keybase/go-keychain#31 where it was explained:

golang/go@94076fe made C type checking stricter.
This caused problems where we were passing in nil for CFAllocatorRef, as Go 1.11
will require those to be 0 instead.

Use the typed constant kCFAllocatorDefault to avoid this problem.

Also add a .travis.yml config and test on various Go versions, including master.

This PR is based on code from #30 by
@kevinburkeomg.

defer C.CFRelease(C.CFTypeRef(queryDict))
C.CFDictionaryAddValue(queryDict, unsafe.Pointer(C.kSecClass), unsafe.Pointer(C.kSecClassIdentity))
C.CFDictionaryAddValue(queryDict, unsafe.Pointer(C.kSecMatchLimit), unsafe.Pointer(C.kSecMatchLimitAll))
Expand Down