mirror of
https://github.com/libp2p/go-openssl.git
synced 2025-03-30 14:20:07 +08:00
commit
2c9a3f31d1
1
build.go
1
build.go
@ -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
4
ctx.go
@ -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
2
key.go
@ -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")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user