Source file misc/cgo/test/testdata/issue24161e1/main.go

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build darwin
     6  
     7  package issue24161e1
     8  
     9  /*
    10  #cgo CFLAGS: -x objective-c
    11  #cgo LDFLAGS: -framework CoreFoundation -framework Security
    12  #include <TargetConditionals.h>
    13  #include <CoreFoundation/CoreFoundation.h>
    14  #include <Security/Security.h>
    15  #if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
    16    typedef CFStringRef SecKeyAlgorithm;
    17    static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
    18    #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()
    19    static SecKeyAlgorithm foo(void){return NULL;}
    20  #endif
    21  */
    22  import "C"
    23  import (
    24  	"fmt"
    25  	"testing"
    26  )
    27  
    28  func f1() {
    29  	C.SecKeyCreateSignature(0, C.kSecKeyAlgorithmECDSASignatureDigestX962SHA1, 0, nil)
    30  }
    31  
    32  func f2(e C.CFErrorRef) {
    33  	if desc := C.CFErrorCopyDescription(e); desc != 0 {
    34  		fmt.Println(desc)
    35  	}
    36  }
    37  
    38  func Test(t *testing.T) {}
    39  

View as plain text