@@ -27,26 +27,26 @@ func ExportFromKeychain(itemRefsToExport []C.CFTypeRef, outputFilePath string, i
2727
2828 var exportedData C.CFDataRef
2929 var exportParams C.SecItemImportExportKeyParameters
30- exportParams .keyUsage = nil
31- exportParams .keyAttributes = nil
30+ exportParams .keyUsage = 0
31+ exportParams .keyAttributes = 0
3232 exportParams .version = C .SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION
3333 if isAskForPassword {
3434 exportParams .flags = C .kSecKeySecurePassphrase
35- exportParams .passphrase = nil
36- exportParams .alertTitle = nil
35+ exportParams .passphrase = 0
36+ exportParams .alertTitle = 0
3737
3838 promptText := C .CString ("Enter a password which will be used to protect the exported items" )
3939 defer C .free (unsafe .Pointer (promptText ))
4040 exportParams .alertPrompt = convertCStringToCFString (promptText )
4141 } else {
4242 exportParams .flags = 0
4343 exportParams .passphrase = (C .CFTypeRef )(convertCStringToCFString (passphraseCString ))
44- exportParams .alertTitle = nil
45- exportParams .alertPrompt = nil
44+ exportParams .alertTitle = 0
45+ exportParams .alertPrompt = 0
4646 }
4747
4848 // create a C array from the input
49- ptr := (* unsafe .Pointer )(& itemRefsToExport [0 ])
49+ ptr := (* unsafe .Pointer )(unsafe . Pointer ( & itemRefsToExport [0 ]) )
5050 cfArrayForExport := C .CFArrayCreate (
5151 C .kCFAllocatorDefault ,
5252 ptr ,
@@ -119,7 +119,7 @@ func GetCertificateDataFromIdentityRef(identityRef C.CFTypeRef) (*x509.Certifica
119119 }
120120
121121 certificateCFData := C .SecCertificateCopyData (secCertificateRef )
122- if certificateCFData == nil {
122+ if certificateCFData == 0 {
123123 return nil , errors .New ("GetCertificateDataFromIdentityRef: SecCertificateCopyData: Failed to convert certificate data" )
124124 }
125125 defer C .CFRelease (C .CFTypeRef (certificateCFData ))
@@ -184,7 +184,7 @@ func FindIdentity(identityLabel string) ([]IdentityWithRefModel, error) {
184184 C .CFDictionaryAddValue (queryDict , unsafe .Pointer (C .kSecReturnRef ), unsafe .Pointer (C .kCFBooleanTrue ))
185185
186186 var resultRefs C.CFTypeRef
187- osStatusCode := C .SecItemCopyMatching (queryDict , & resultRefs )
187+ osStatusCode := C .SecItemCopyMatching (( _Ctype_CFDictionaryRef )( queryDict ) , & resultRefs )
188188 if osStatusCode != C .errSecSuccess {
189189 return nil , fmt .Errorf ("Failed to call SecItemCopyMatch - OSStatus: %d" , osStatusCode )
190190 }
@@ -244,10 +244,10 @@ func FindIdentity(identityLabel string) ([]IdentityWithRefModel, error) {
244244
245245func getCFDictValueRef (dict C.CFDictionaryRef , key C.CFTypeRef ) (C.CFTypeRef , error ) {
246246 var retVal C.CFTypeRef
247- exist := C .CFDictionaryGetValueIfPresent (dict , unsafe .Pointer (key ), (* unsafe .Pointer )(retVal ))
247+ exist := C .CFDictionaryGetValueIfPresent (dict , unsafe .Pointer (key ), (* unsafe .Pointer )(unsafe . Pointer ( retVal ) ))
248248 // log.Debugf("retVal: %#v", retVal)
249249 if exist == C .Boolean (0 ) {
250- return nil , errors .New ("getCFDictValueRef: Key doesn't exist" )
250+ return 0 , errors .New ("getCFDictValueRef: Key doesn't exist" )
251251 }
252252 // return retVal, nil
253253
@@ -257,14 +257,14 @@ func getCFDictValueRef(dict C.CFDictionaryRef, key C.CFTypeRef) (C.CFTypeRef, er
257257func getCFDictValueCFStringRef (dict C.CFDictionaryRef , key C.CFTypeRef ) (C.CFStringRef , error ) {
258258 val , err := getCFDictValueRef (dict , key )
259259 if err != nil {
260- return nil , err
260+ return 0 , err
261261 }
262- if val == nil {
263- return nil , errors .New ("getCFDictValueCFStringRef: Nil value returned" )
262+ if val == 0 {
263+ return 0 , errors .New ("getCFDictValueCFStringRef: Nil value returned" )
264264 }
265265
266266 if C .CFGetTypeID (val ) != C .CFStringGetTypeID () {
267- return nil , errors .New ("getCFDictValueCFStringRef: value is not a string" )
267+ return 0 , errors .New ("getCFDictValueCFStringRef: value is not a string" )
268268 }
269269
270270 return C .CFStringRef (val ), nil
@@ -280,7 +280,7 @@ func getCFDictValueUTF8String(dict C.CFDictionaryRef, key C.CFTypeRef) (string,
280280 return "" , err
281281 }
282282 log .Debugf ("valCFStringRef: %#v" , valCFStringRef )
283- if valCFStringRef == nil {
283+ if valCFStringRef == 0 {
284284 return "" , errors .New ("getCFDictValueUTF8String: Nil value" )
285285 }
286286
0 commit comments