Merge pull request #23 from carlosmn/osx

OSX fixes
This commit is contained in:
JT Olds 2015-01-22 17:16:51 -07:00
commit 2c9a3f31d1
3 changed files with 4 additions and 3 deletions

View File

@ -18,4 +18,5 @@ package openssl
// #cgo pkg-config: libssl // #cgo pkg-config: libssl
// #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN // #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN
// #cgo darwin CFLAGS: -Wno-deprecated-declarations
import "C" import "C"

4
ctx.go
View File

@ -63,7 +63,7 @@ static long SSL_CTX_set_tmp_ecdh_not_a_macro(SSL_CTX* ctx, EC_KEY *key) {
#endif #endif
static const SSL_METHOD *OUR_TLSv1_1_method() { static const SSL_METHOD *OUR_TLSv1_1_method() {
#ifdef TLS1_1_VERSION #if defined(TLS1_1_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX)
return TLSv1_1_method(); return TLSv1_1_method();
#else #else
return NULL; return NULL;
@ -71,7 +71,7 @@ static const SSL_METHOD *OUR_TLSv1_1_method() {
} }
static const SSL_METHOD *OUR_TLSv1_2_method() { static const SSL_METHOD *OUR_TLSv1_2_method() {
#ifdef TLS1_2_VERSION #if defined(TLS1_2_VERSION) && !defined(OPENSSL_SYSNAME_MACOSX)
return TLSv1_2_method(); return TLSv1_2_method();
#else #else
return NULL; return NULL;

2
key.go
View File

@ -321,7 +321,7 @@ func GenerateRSAKey(bits int) (PrivateKey, error) {
if key == nil { if key == nil {
return nil, errors.New("failed to allocate EVP_PKEY") 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) C.EVP_PKEY_free(key)
return nil, errors.New("failed to assign RSA key") return nil, errors.New("failed to assign RSA key")
} }