From 20fdb1c6641337f12113d9a25f847cb97f6eb93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 12 Dec 2014 09:15:49 +0100 Subject: [PATCH] Work with versions pickier about C types Newer versions of Go (at least 1.4) do not like mixing C pointer types. Cast an unsafe.Pointer to *C.char to make the compiler see matching types. --- key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/key.go b/key.go index 2c4eceb..e16da2f 100644 --- a/key.go +++ b/key.go @@ -321,7 +321,7 @@ func GenerateRSAKey(bits int) (PrivateKey, error) { if key == nil { return nil, errors.New("failed to allocate EVP_PKEY") } - if C.EVP_PKEY_assign(key, C.EVP_PKEY_RSA, unsafe.Pointer(rsa)) != 1 { + if C.EVP_PKEY_assign(key, C.EVP_PKEY_RSA, (*C.char)(unsafe.Pointer(rsa))) != 1 { C.EVP_PKEY_free(key) return nil, errors.New("failed to assign RSA key") }