This commit is contained in:
Günter Obiltschnig
2018-03-05 22:15:39 +01:00
parent c5acb2ac27
commit 451f05121e
2 changed files with 39 additions and 39 deletions

View File

@@ -103,7 +103,7 @@ public:
PROTO_TLSV1_2 = 0x10 PROTO_TLSV1_2 = 0x10
}; };
struct Params struct NetSSL_API Params
{ {
Params(); Params();
/// Initializes the struct with default values. /// Initializes the struct with default values.
@@ -151,9 +151,9 @@ public:
Context(Usage usage, const Params& params); Context(Usage usage, const Params& params);
/// Creates a Context using the given parameters. /// Creates a Context using the given parameters.
/// ///
/// * usage specifies whether the context is used by a client or server. /// * usage specifies whether the context is used by a client or server.
/// * params specifies the context parameters. /// * params specifies the context parameters.
Context( Context(
Usage usage, Usage usage,
@@ -164,26 +164,26 @@ public:
int verificationDepth = 9, int verificationDepth = 9,
bool loadDefaultCAs = false, bool loadDefaultCAs = false,
const std::string& cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); const std::string& cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
/// Creates a Context. /// Creates a Context.
/// ///
/// * usage specifies whether the context is used by a client or server. /// * usage specifies whether the context is used by a client or server.
/// * privateKeyFile contains the path to the private key file used for encryption. /// * privateKeyFile contains the path to the private key file used for encryption.
/// Can be empty if no private key file is used. /// Can be empty if no private key file is used.
/// * certificateFile contains the path to the certificate file (in PEM format). /// * certificateFile contains the path to the certificate file (in PEM format).
/// If the private key and the certificate are stored in the same file, this /// If the private key and the certificate are stored in the same file, this
/// can be empty if privateKeyFile is given. /// can be empty if privateKeyFile is given.
/// * caLocation contains the path to the file or directory containing the /// * caLocation contains the path to the file or directory containing the
/// CA/root certificates. Can be empty if the OpenSSL builtin CA certificates /// CA/root certificates. Can be empty if the OpenSSL builtin CA certificates
/// are used (see loadDefaultCAs). /// are used (see loadDefaultCAs).
/// * verificationMode specifies whether and how peer certificates are validated. /// * verificationMode specifies whether and how peer certificates are validated.
/// * verificationDepth sets the upper limit for verification chain sizes. Verification /// * verificationDepth sets the upper limit for verification chain sizes. Verification
/// will fail if a certificate chain larger than this is encountered. /// will fail if a certificate chain larger than this is encountered.
/// * loadDefaultCAs specifies whether the builtin CA certificates from OpenSSL are used. /// * loadDefaultCAs specifies whether the builtin CA certificates from OpenSSL are used.
/// * cipherList specifies the supported ciphers in OpenSSL notation. /// * cipherList specifies the supported ciphers in OpenSSL notation.
/// ///
/// Note: If the private key is protected by a passphrase, a PrivateKeyPassphraseHandler /// Note: If the private key is protected by a passphrase, a PrivateKeyPassphraseHandler
/// must have been setup with the SSLManager, or the SSLManager's PrivateKeyPassphraseRequired /// must have been setup with the SSLManager, or the SSLManager's PrivateKeyPassphraseRequired
/// event must be handled. /// event must be handled.
Context( Context(
Usage usage, Usage usage,
@@ -192,20 +192,20 @@ public:
int verificationDepth = 9, int verificationDepth = 9,
bool loadDefaultCAs = false, bool loadDefaultCAs = false,
const std::string& cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); const std::string& cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
/// Creates a Context. /// Creates a Context.
/// ///
/// * usage specifies whether the context is used by a client or server. /// * usage specifies whether the context is used by a client or server.
/// * caLocation contains the path to the file or directory containing the /// * caLocation contains the path to the file or directory containing the
/// CA/root certificates. Can be empty if the OpenSSL builtin CA certificates /// CA/root certificates. Can be empty if the OpenSSL builtin CA certificates
/// are used (see loadDefaultCAs). /// are used (see loadDefaultCAs).
/// * verificationMode specifies whether and how peer certificates are validated. /// * verificationMode specifies whether and how peer certificates are validated.
/// * verificationDepth sets the upper limit for verification chain sizes. Verification /// * verificationDepth sets the upper limit for verification chain sizes. Verification
/// will fail if a certificate chain larger than this is encountered. /// will fail if a certificate chain larger than this is encountered.
/// * loadDefaultCAs specifies whether the builtin CA certificates from OpenSSL are used. /// * loadDefaultCAs specifies whether the builtin CA certificates from OpenSSL are used.
/// * cipherList specifies the supported ciphers in OpenSSL notation. /// * cipherList specifies the supported ciphers in OpenSSL notation.
/// ///
/// Note that a private key and/or certificate must be specified with /// Note that a private key and/or certificate must be specified with
/// usePrivateKey()/useCertificate() before the Context can be used. /// usePrivateKey()/useCertificate() before the Context can be used.
~Context(); ~Context();
/// Destroys the Context. /// Destroys the Context.

View File

@@ -511,7 +511,7 @@ void Context::initDH(const std::string& dhParamsFile)
std::string msg = Utility::getLastError(); std::string msg = Utility::getLastError();
throw SSLContextException("Error creating Diffie-Hellman parameters", msg); throw SSLContextException("Error creating Diffie-Hellman parameters", msg);
} }
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
BIGNUM* p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0); BIGNUM* p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
BIGNUM* g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0); BIGNUM* g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
DH_set0_pqg(dh, p, 0, g); DH_set0_pqg(dh, p, 0, g);