main.go 1.0 KB

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