]> Cypherpunks.ru repositories - gostls13.git/blob - misc/cgo/test/issue24161e1/main.go
1b30b9a9fc3201dad45ff3cf0375823bfb945141
[gostls13.git] / misc / cgo / test / 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 //go:build darwin
6 // +build darwin
7
8 package issue24161e1
9
10 /*
11 #cgo CFLAGS: -x objective-c
12 #cgo LDFLAGS: -framework CoreFoundation -framework Security
13 #include <TargetConditionals.h>
14 #include <CoreFoundation/CoreFoundation.h>
15 #include <Security/Security.h>
16 #if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
17   typedef CFStringRef SecKeyAlgorithm;
18   static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
19   #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()
20   static SecKeyAlgorithm foo(void){return NULL;}
21 #endif
22 */
23 import "C"
24 import (
25         "fmt"
26         "testing"
27 )
28
29 func f1() {
30         C.SecKeyCreateSignature(0, C.kSecKeyAlgorithmECDSASignatureDigestX962SHA1, 0, nil)
31 }
32
33 func f2(e C.CFErrorRef) {
34         if desc := C.CFErrorCopyDescription(e); desc != 0 {
35                 fmt.Println(desc)
36         }
37 }
38
39 func Test(t *testing.T) {}