1
0
mirror of https://github.com/libp2p/go-openssl.git synced 2025-04-25 17:50:23 +08:00

fix darwin build

since apple packages a really old openssl version, some of the constants
introduced recently were not present. on darwin, don't compile them in unless
explicititly asked for with the 'brew' build tag.

fixes 
This commit is contained in:
Jeff Wendling 2014-10-09 11:25:36 -06:00
parent 62e1937684
commit 67e06b66c4
3 changed files with 44 additions and 11 deletions

View File

@ -109,16 +109,7 @@ const (
InvalidExtension VerifyResult = C.X509_V_ERR_INVALID_EXTENSION
InvalidPolicyExtension VerifyResult = C.X509_V_ERR_INVALID_POLICY_EXTENSION
NoExplicitPolicy VerifyResult = C.X509_V_ERR_NO_EXPLICIT_POLICY
DifferentCrlScope VerifyResult = C.X509_V_ERR_DIFFERENT_CRL_SCOPE
UnsupportedExtensionFeature VerifyResult = C.X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE
UnnestedResource VerifyResult = C.X509_V_ERR_UNNESTED_RESOURCE
PermittedViolation VerifyResult = C.X509_V_ERR_PERMITTED_VIOLATION
ExcludedViolation VerifyResult = C.X509_V_ERR_EXCLUDED_VIOLATION
SubtreeMinmax VerifyResult = C.X509_V_ERR_SUBTREE_MINMAX
UnsupportedConstraintType VerifyResult = C.X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
UnsupportedConstraintSyntax VerifyResult = C.X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX
UnsupportedNameSyntax VerifyResult = C.X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
CrlPathValidationError VerifyResult = C.X509_V_ERR_CRL_PATH_VALIDATION_ERROR
ApplicationVerification VerifyResult = C.X509_V_ERR_APPLICATION_VERIFICATION
)

2
ctx.go
View File

@ -361,8 +361,6 @@ const (
NoSSLv2 Options = C.SSL_OP_NO_SSLv2
NoSSLv3 Options = C.SSL_OP_NO_SSLv3
NoTLSv1 Options = C.SSL_OP_NO_TLSv1
NoTLSv1_1 Options = C.SSL_OP_NO_TLSv1_1
NoTLSv1_2 Options = C.SSL_OP_NO_TLSv1_2
CipherServerPreference Options = C.SSL_OP_CIPHER_SERVER_PREFERENCE
NoSessionResumptionOrRenegotiation Options = C.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
NoTicket Options = C.SSL_OP_NO_TICKET

44
old_openssl_compat.go Normal file
View File

@ -0,0 +1,44 @@
// Copyright (C) 2014 Space Monkey, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !darwin brew
// +build cgo
package openssl
// #include <openssl/ssl.h>
import "C"
// these constants do not exist in the openssl version packaged with os x. when
// darwin decides to update the base openssl version, we can move these back
// to the appropriate spots in the source. as a workaround, if you need access
// to these constants on darwin, use homebrew or whatever to install a more
// recent version of os x, and build the package with the '-tags brew' flag
const (
UnsupportedConstraintSyntax VerifyResult = C.X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX
UnsupportedConstraintType VerifyResult = C.X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE
UnsupportedExtensionFeature VerifyResult = C.X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE
ExcludedViolation VerifyResult = C.X509_V_ERR_EXCLUDED_VIOLATION
SubtreeMinmax VerifyResult = C.X509_V_ERR_SUBTREE_MINMAX
UnsupportedNameSyntax VerifyResult = C.X509_V_ERR_UNSUPPORTED_NAME_SYNTAX
DifferentCrlScope VerifyResult = C.X509_V_ERR_DIFFERENT_CRL_SCOPE
PermittedViolation VerifyResult = C.X509_V_ERR_PERMITTED_VIOLATION
CrlPathValidationError VerifyResult = C.X509_V_ERR_CRL_PATH_VALIDATION_ERROR
)
const (
NoTLSv1_1 Options = C.SSL_OP_NO_TLSv1_1
NoTLSv1_2 Options = C.SSL_OP_NO_TLSv1_2
)