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.
This commit is contained in:
Carlos Martín Nieto 2014-12-12 09:15:49 +01:00
parent 2156e293c7
commit 20fdb1c664

2
key.go
View File

@ -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")
}