diff options
author | Slávek Banko <[email protected]> | 2017-01-01 19:35:39 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2017-01-01 19:35:39 +0100 |
commit | e1861cb6811f7bac405ece204407ca46c000a453 (patch) | |
tree | 8883f182e51c13750d24c5b74ed058d4d9fce99e /tdeio/kssl/kopenssl.cc | |
parent | f32bc5176289b70bf1c6e7d2825d53f190bc4096 (diff) | |
download | tdelibs-e1861cb6811f7bac405ece204407ca46c000a453.tar.gz tdelibs-e1861cb6811f7bac405ece204407ca46c000a453.zip |
Added support for OpenSSL 1.1
Some KOpenSSLProxy methods have been renamed to be consistent
with OpenSSL 1.1 API names and to prevent hidden API changes.
To ensure API / ABI compatibility, the original methods are
still included but have been marked as deprecated.
+ SSLv23_client_method => TLS_client_method
+ X509_STORE_CTX_set_chain => X509_STORE_CTX_set0_untrusted
+ sk_dup => OPENSSL_sk_dup
+ sk_free => OPENSSL_sk_free
+ sk_new => OPENSSL_sk_new
+ sk_num => OPENSSL_sk_num
+ sk_pop => OPENSSL_sk_pop
+ sk_push => OPENSSL_sk_push
+ sk_value => OPENSSL_sk_value
Additional methods have been added to KOpenSSLProxy to support
the new OpenSSL 1.1 API functions that provide access to the
(now) opaque SSL structures. Compatibility with OpenSSL < 1.1
is handled internally in KOpenSSLProxy.
+ BIO_get_data
+ DSA_get0_key
+ DSA_get0_pqg
+ EVP_PKEY_base_id
+ EVP_PKEY_get0_DSA
+ EVP_PKEY_get0_RSA
+ RSA_get0_key
+ X509_CRL_get0_lastUpdate
+ X509_CRL_get0_nextUpdate
+ X509_OBJECT_get0_X509
+ X509_OBJECT_get_type
+ X509_STORE_CTX_get_current_cert
+ X509_STORE_CTX_get_error
+ X509_STORE_CTX_get_error_depth
+ X509_STORE_CTX_set_error
+ X509_STORE_get0_objects
+ X509_STORE_set_verify_cb
+ X509_get0_signature
+ X509_getm_notAfter
+ X509_getm_notBefore
+ X509_subject_name_cmp
+ _SSL_session_reused
+ _SSL_set_options
Method "KSSL::setSession" has been renamed to "KSSL::takeSession"
and its functionality has changed: the session is now transferred
from the argument object to the invoked object. Since it is only
used internally in TDE and the functionality is different, the
method with the previous name has not been preserved.
Signed-off-by: Slávek Banko <[email protected]>
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdeio/kssl/kopenssl.cc')
-rw-r--r-- | tdeio/kssl/kopenssl.cc | 724 |
1 files changed, 612 insertions, 112 deletions
diff --git a/tdeio/kssl/kopenssl.cc b/tdeio/kssl/kopenssl.cc index d4f086d8e..8b1aa20e0 100644 --- a/tdeio/kssl/kopenssl.cc +++ b/tdeio/kssl/kopenssl.cc @@ -56,7 +56,9 @@ static void (*K_SSL_CTX_set_verify)(SSL_CTX *, int, int (*)(int, X509_STORE_CTX *)) = 0L; static int (*K_SSL_use_certificate)(SSL *, X509 *) = 0L; static SSL_CIPHER *(*K_SSL_get_current_cipher)(SSL *) = 0L; -static long (*K_SSL_ctrl) (SSL *,int, long, char *) = 0L; +static long (*K_SSL_set_options)(SSL *ssl, long options) = 0L; +static int (*K_SSL_session_reused)(SSL *ssl) = 0L; +static long (*K_SSL_ctrl) (SSL *,int, long, void *) = 0L; static int (*K_RAND_egd) (const char *) = 0L; static const char* (*K_RAND_file_name) (char *, size_t) = 0L; static int (*K_RAND_load_file) (const char *, long) = 0L; @@ -64,7 +66,7 @@ static int (*K_RAND_write_file) (const char *) = 0L; static SSL_METHOD * (*K_TLSv1_client_method) () = 0L; static SSL_METHOD * (*K_SSLv2_client_method) () = 0L; static SSL_METHOD * (*K_SSLv3_client_method) () = 0L; -static SSL_METHOD * (*K_SSLv23_client_method) () = 0L; +static SSL_METHOD * (*K_TLS_client_method) () = 0L; static X509 * (*K_SSL_get_peer_certificate) (SSL *) = 0L; static int (*K_SSL_CIPHER_get_bits) (SSL_CIPHER *,int *) = 0L; static char * (*K_SSL_CIPHER_get_version) (SSL_CIPHER *) = 0L; @@ -74,6 +76,7 @@ static X509 * (*K_d2i_X509) (X509 **,unsigned char **,long) = 0L; static X509_CRL * (*K_d2i_X509_CRL) (X509_CRL **,unsigned char **,long) = 0L; static int (*K_i2d_X509) (X509 *,unsigned char **) = 0L; static int (*K_X509_cmp) (X509 *, X509 *) = 0L; +static int (*K_X509_subject_name_cmp) (const X509 *, const X509 *) = 0L; static void (*K_X509_STORE_CTX_free) (X509_STORE_CTX *) = 0L; static int (*K_X509_verify_cert) (X509_STORE_CTX *) = 0L; static X509_STORE_CTX *(*K_X509_STORE_CTX_new) (void) = 0L; @@ -91,6 +94,8 @@ static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int, const char *, long, char ** static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *) = 0L; static void (*K_CRYPTO_free) (void *) = 0L; static X509* (*K_X509_dup) (X509 *) = 0L; +static void (*K_X509_get0_signature)(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x) = 0L; static BIO_METHOD *(*K_BIO_s_mem) (void) = 0L; static BIO* (*K_BIO_new) (BIO_METHOD *) = 0L; static BIO* (*K_BIO_new_fp) (FILE *, int) = 0L; @@ -98,6 +103,7 @@ static BIO* (*K_BIO_new_mem_buf) (void *, int) = 0L; static int (*K_BIO_free) (BIO *) = 0L; static long (*K_BIO_ctrl) (BIO *,int,long,void *) = 0L; static int (*K_BIO_write) (BIO *b, const void *data, int len) = 0L; +static void* (*K_BIO_get_data) (BIO *a) = 0L; static int (*K_PEM_ASN1_write_bio) (int (*)(),const char *,BIO *,char *, const EVP_CIPHER *,unsigned char *,int , pem_password_cb *, void *) = 0L; @@ -120,13 +126,16 @@ static int (*K_PKCS12_parse) (PKCS12*, const char *, EVP_PKEY**, X509**, STACK_OF(X509)**) = 0L; static void (*K_EVP_PKEY_free) (EVP_PKEY *) = 0L; static EVP_PKEY* (*K_EVP_PKEY_new) () = 0L; +static int (*K_EVP_PKEY_base_id)(const EVP_PKEY *pkey) = 0L; +static RSA* (*K_EVP_PKEY_get0_RSA)(EVP_PKEY *pkey) = 0L; +static DSA* (*K_EVP_PKEY_get0_DSA)(EVP_PKEY *pkey) = 0L; static void (*K_X509_REQ_free) (X509_REQ *) = 0L; static X509_REQ* (*K_X509_REQ_new) () = 0L; static int (*K_SSL_CTX_use_PrivateKey) (SSL_CTX*, EVP_PKEY*) = 0L; static int (*K_SSL_CTX_use_certificate) (SSL_CTX*, X509*) = 0L; static int (*K_SSL_get_error) (SSL*, int) = 0L; static STACK_OF(X509)* (*K_SSL_get_peer_cert_chain) (SSL*) = 0L; -static void (*K_X509_STORE_CTX_set_chain) (X509_STORE_CTX *, STACK_OF(X509)*) = 0L; +static void (*K_X509_STORE_CTX_set0_untrusted) (X509_STORE_CTX *, STACK_OF(X509)*) = 0L; static void (*K_X509_STORE_CTX_set_purpose) (X509_STORE_CTX *, int) = 0L; static void (*K_sk_free) (STACK*) = 0L; static int (*K_sk_num) (STACK*) = 0L; @@ -134,7 +143,7 @@ static char* (*K_sk_pop) (STACK*) = 0L; static char* (*K_sk_value) (STACK*, int) = 0L; static STACK* (*K_sk_new) (int (*)()) = 0L; static int (*K_sk_push) (STACK*, char*) = 0L; -static STACK* (*K_sk_dup) (STACK *) = 0L; +static STACK* (*K_sk_dup) (const STACK *) = 0L; static char * (*K_i2s_ASN1_INTEGER) (X509V3_EXT_METHOD *, ASN1_INTEGER *) =0L; static ASN1_INTEGER * (*K_X509_get_serialNumber) (X509 *) = 0L; static EVP_PKEY *(*K_X509_get_pubkey)(X509 *) = 0L; @@ -175,7 +184,10 @@ static int (*K_X509_check_purpose)(X509*,int,int) = 0L; static X509_PURPOSE* (*K_X509_PURPOSE_get0)(int) = 0L; static int (*K_EVP_PKEY_assign)(EVP_PKEY*, int, char*) = 0L; static int (*K_X509_REQ_set_pubkey)(X509_REQ*, EVP_PKEY*) = 0L; +static void (*K_RSA_get0_key)(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) = 0L; static RSA *(*K_RSA_generate_key)(int, unsigned long, void (*)(int,int,void *), void *) = 0L; +static void (*K_DSA_get0_pqg)(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) = 0L; +static void (*K_DSA_get0_key)(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) = 0L; static int (*K_i2d_X509_REQ_fp)(FILE*, X509_REQ*) = 0L; static void (*K_ERR_clear_error)() = 0L; static unsigned long (*K_ERR_get_error)() = 0L; @@ -208,7 +220,19 @@ static int (*K_X509_REQ_set_subject_name)(X509_REQ*,X509_NAME*) = 0L; static unsigned char *(*K_ASN1_STRING_data)(ASN1_STRING*) = 0L; static int (*K_ASN1_STRING_length)(ASN1_STRING*) = 0L; static STACK_OF(SSL_CIPHER) *(*K_SSL_get_ciphers)(const SSL *ssl) = 0L; - +static const ASN1_TIME* (*K_X509_CRL_get0_lastUpdate)(const X509_CRL *crl) = 0L; +static const ASN1_TIME* (*K_X509_CRL_get0_nextUpdate)(const X509_CRL *crl) = 0L; +static X509* (*K_X509_STORE_CTX_get_current_cert)(X509_STORE_CTX *ctx) = 0L; +static int (*K_X509_STORE_CTX_get_error)(X509_STORE_CTX *ctx) = 0L; +static int (*K_X509_STORE_CTX_get_error_depth)(X509_STORE_CTX *ctx) = 0L; +static void (*K_X509_STORE_CTX_set_error)(X509_STORE_CTX *ctx, int s) = 0L; +static void (*K_X509_STORE_set_verify_cb)(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb) = 0L; +static STACK_OF(X509_OBJECT)* (*K_X509_STORE_get0_objects)(X509_STORE *v) = 0L; +static X509_LOOKUP_TYPE (*K_X509_OBJECT_get_type)(const X509_OBJECT *a) = 0L; +static X509* (*K_X509_OBJECT_get0_X509)(const X509_OBJECT *a) = 0L; +static ASN1_TIME* (*K_X509_getm_notAfter)(const X509 *x) = 0L; +static ASN1_TIME* (*K_X509_getm_notBefore)(const X509 *x) = 0L; #endif } @@ -407,6 +431,7 @@ TDEConfig *cfg; K_d2i_X509_CRL = (X509_CRL * (*)(X509_CRL **,unsigned char **,long)) GET_CRYPTOLIB_SYMBOL("d2i_X509_CRL"); K_i2d_X509 = (int (*)(X509 *,unsigned char **)) GET_CRYPTOLIB_SYMBOL("i2d_X509"); K_X509_cmp = (int (*)(X509 *, X509 *)) GET_CRYPTOLIB_SYMBOL("X509_cmp"); + K_X509_subject_name_cmp = (int (*)(const X509 *, const X509 *)) GET_CRYPTOLIB_SYMBOL("X509_subject_name_cmp"); K_X509_STORE_CTX_new = (X509_STORE_CTX * (*) (void)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_new"); K_X509_STORE_CTX_free = (void (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_free"); K_X509_verify_cert = (int (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL("X509_verify_cert"); @@ -421,6 +446,8 @@ TDEConfig *cfg; K_X509_LOOKUP_ctrl = (int (*)(X509_LOOKUP *, int, const char *, long, char **)) GET_CRYPTOLIB_SYMBOL("X509_LOOKUP_ctrl"); K_X509_STORE_CTX_init = (void (*)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_init"); K_X509_dup = (X509* (*)(X509*)) GET_CRYPTOLIB_SYMBOL("X509_dup"); + K_X509_get0_signature = (void (*)(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x)) GET_CRYPTOLIB_SYMBOL("X509_get0_signature"); K_BIO_s_mem = (BIO_METHOD *(*) (void)) GET_CRYPTOLIB_SYMBOL("BIO_s_mem"); K_BIO_new = (BIO* (*)(BIO_METHOD *)) GET_CRYPTOLIB_SYMBOL("BIO_new"); K_BIO_new_fp = (BIO* (*)(FILE*, int)) GET_CRYPTOLIB_SYMBOL("BIO_new_fp"); @@ -428,6 +455,7 @@ TDEConfig *cfg; K_BIO_free = (int (*)(BIO*)) GET_CRYPTOLIB_SYMBOL("BIO_free"); K_BIO_ctrl = (long (*) (BIO *,int,long,void *)) GET_CRYPTOLIB_SYMBOL("BIO_ctrl"); K_BIO_write = (int (*) (BIO *b, const void *data, int len)) GET_CRYPTOLIB_SYMBOL("BIO_write"); + K_BIO_get_data = (void* (*)(BIO *a)) GET_CRYPTOLIB_SYMBOL("BIO_get_data"); K_PEM_ASN1_write_bio = (int (*)(int (*)(), const char *,BIO*, char*, const EVP_CIPHER *, unsigned char *, int, pem_password_cb *, void *)) GET_CRYPTOLIB_SYMBOL("PEM_ASN1_write_bio"); #if OPENSSL_VERSION_NUMBER >= 0x10000000L K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*, unsigned char *)) GET_CRYPTOLIB_SYMBOL("ASN1_item_i2d_fp"); @@ -448,17 +476,28 @@ TDEConfig *cfg; X509**, STACK_OF(X509)**)) GET_CRYPTOLIB_SYMBOL("PKCS12_parse"); K_EVP_PKEY_free = (void (*) (EVP_PKEY *)) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_free"); K_EVP_PKEY_new = (EVP_PKEY* (*)()) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_new"); + K_EVP_PKEY_base_id = (int (*)(const EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_base_id"); + K_EVP_PKEY_get0_RSA = (RSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_get0_RSA"); + K_EVP_PKEY_get0_DSA = (DSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_get0_DSA"); K_X509_REQ_free = (void (*)(X509_REQ*)) GET_CRYPTOLIB_SYMBOL("X509_REQ_free"); K_X509_REQ_new = (X509_REQ* (*)()) GET_CRYPTOLIB_SYMBOL("X509_REQ_new"); - K_X509_STORE_CTX_set_chain = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_set_chain"); + K_X509_STORE_CTX_set0_untrusted = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_set0_untrusted"); + if (!K_X509_STORE_CTX_set0_untrusted) K_X509_STORE_CTX_set0_untrusted = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_set_chain"); K_X509_STORE_CTX_set_purpose = (void (*)(X509_STORE_CTX *, int)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_set_purpose"); - K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_free"); - K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_num"); - K_sk_pop = (char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_pop"); - K_sk_value = (char* (*) (STACK *, int)) GET_CRYPTOLIB_SYMBOL("sk_value"); - K_sk_new = (STACK* (*) (int (*)())) GET_CRYPTOLIB_SYMBOL("sk_new"); - K_sk_push = (int (*) (STACK*, char*)) GET_CRYPTOLIB_SYMBOL("sk_push"); - K_sk_dup = (STACK* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_dup"); + K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_free"); + if (!K_sk_free) K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_free"); + K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_num"); + if (!K_sk_num) K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_num"); + K_sk_pop = (char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_pop"); + if (!K_sk_pop) K_sk_pop = (char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL("sk_pop"); + K_sk_value = (char* (*) (STACK *, int)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_value"); + if (!K_sk_value) K_sk_value = (char* (*) (STACK *, int)) GET_CRYPTOLIB_SYMBOL("sk_value"); + K_sk_new = (STACK* (*) (int (*)())) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_new"); + if (!K_sk_new) K_sk_new = (STACK* (*) (int (*)())) GET_CRYPTOLIB_SYMBOL("sk_new"); + K_sk_push = (int (*) (STACK*, char*)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_push"); + if (!K_sk_push) K_sk_push = (int (*) (STACK*, char*)) GET_CRYPTOLIB_SYMBOL("sk_push"); + K_sk_dup = (STACK* (*) (const STACK *)) GET_CRYPTOLIB_SYMBOL("OPENSSL_sk_dup"); + if (!K_sk_dup) K_sk_dup = (STACK* (*) (const STACK *)) GET_CRYPTOLIB_SYMBOL("sk_dup"); K_i2s_ASN1_INTEGER = (char *(*) (X509V3_EXT_METHOD *, ASN1_INTEGER *)) GET_CRYPTOLIB_SYMBOL("i2s_ASN1_INTEGER"); K_X509_get_serialNumber = (ASN1_INTEGER * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL("X509_get_serialNumber"); K_X509_get_pubkey = (EVP_PKEY *(*)(X509 *)) GET_CRYPTOLIB_SYMBOL("X509_get_pubkey"); @@ -503,7 +542,10 @@ TDEConfig *cfg; K_X509_PURPOSE_get0 = (X509_PURPOSE *(*)(int)) GET_CRYPTOLIB_SYMBOL("X509_PURPOSE_get0"); K_EVP_PKEY_assign = (int (*)(EVP_PKEY*, int, char*)) GET_CRYPTOLIB_SYMBOL("EVP_PKEY_assign"); K_X509_REQ_set_pubkey = (int (*)(X509_REQ*, EVP_PKEY*)) GET_CRYPTOLIB_SYMBOL("X509_REQ_set_pubkey"); + K_RSA_get0_key = (void (*)(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)) GET_CRYPTOLIB_SYMBOL("RSA_get0_key"); K_RSA_generate_key = (RSA* (*)(int, unsigned long, void (*)(int,int,void *), void *)) GET_CRYPTOLIB_SYMBOL("RSA_generate_key"); + K_DSA_get0_pqg = (void (*)(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)) GET_CRYPTOLIB_SYMBOL("DSA_get0_pqg"); + K_DSA_get0_key = (void (*)(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key)) GET_CRYPTOLIB_SYMBOL("DSA_get0_key"); K_i2d_X509_REQ_fp = (int (*)(FILE *, X509_REQ *)) GET_CRYPTOLIB_SYMBOL("i2d_X509_REQ_fp"); K_ERR_clear_error = (void (*)()) GET_CRYPTOLIB_SYMBOL("ERR_clear_error"); K_ERR_get_error = (unsigned long (*)()) GET_CRYPTOLIB_SYMBOL("ERR_get_error"); @@ -525,6 +567,19 @@ TDEConfig *cfg; K_X509_REQ_set_subject_name = (int (*)(X509_REQ*,X509_NAME*)) GET_CRYPTOLIB_SYMBOL("X509_REQ_set_subject_name"); K_ASN1_STRING_data = (unsigned char *(*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL("ASN1_STRING_data"); K_ASN1_STRING_length = (int (*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL("ASN1_STRING_length"); + K_X509_CRL_get0_lastUpdate = (const ASN1_TIME* (*)(const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL("X509_CRL_get0_lastUpdate"); + K_X509_CRL_get0_nextUpdate = (const ASN1_TIME* (*)(const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL("X509_CRL_get0_nextUpdate"); + K_X509_STORE_CTX_get_current_cert = (X509* (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_get_current_cert"); + K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_get_error"); + K_X509_STORE_CTX_get_error_depth = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_get_error_depth"); + K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *ctx, int s)) GET_CRYPTOLIB_SYMBOL("X509_STORE_CTX_set_error"); + K_X509_STORE_set_verify_cb = (void (*)(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb)) GET_CRYPTOLIB_SYMBOL("X509_STORE_set_verify_cb"); + K_X509_STORE_get0_objects = (STACK_OF(X509_OBJECT)* (*)(X509_STORE *v)) GET_CRYPTOLIB_SYMBOL("X509_STORE_get0_objects"); + K_X509_OBJECT_get_type = (X509_LOOKUP_TYPE (*)(const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL("X509_OBJECT_get_type"); + K_X509_OBJECT_get0_X509 = (X509* (*)(const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL("X509_OBJECT_get0_X509"); + K_X509_getm_notAfter = (ASN1_TIME* (*)(const X509 *x)) GET_CRYPTOLIB_SYMBOL("X509_getm_notAfter"); + K_X509_getm_notBefore = (ASN1_TIME* (*)(const X509 *x)) GET_CRYPTOLIB_SYMBOL("X509_getm_notBefore"); #endif } @@ -589,12 +644,15 @@ TDEConfig *cfg; GET_SSLLIB_SYMBOL("SSL_CTX_use_certificate"); K_SSL_get_current_cipher = (SSL_CIPHER *(*)(SSL *)) GET_SSLLIB_SYMBOL("SSL_get_current_cipher"); - K_SSL_ctrl = (long (*)(SSL * ,int, long, char *)) + K_SSL_set_options = (long (*)(SSL *ssl, long options)) GET_SSLLIB_SYMBOL("SSL_set_options"); + K_SSL_session_reused = (int (*)(SSL *ssl)) GET_SSLLIB_SYMBOL("SSL_session_reused"); + K_SSL_ctrl = (long (*)(SSL * ,int, long, void *)) GET_SSLLIB_SYMBOL("SSL_ctrl"); K_TLSv1_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("TLSv1_client_method"); K_SSLv2_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("SSLv2_client_method"); K_SSLv3_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("SSLv3_client_method"); - K_SSLv23_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("SSLv23_client_method"); + K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("TLS_client_method"); + if (!K_TLS_client_method) K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL("SSLv23_client_method"); K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) GET_SSLLIB_SYMBOL("SSL_get_peer_certificate"); K_SSL_CIPHER_get_bits = (int (*)(SSL_CIPHER *,int *)) GET_SSLLIB_SYMBOL("SSL_CIPHER_get_bits"); K_SSL_CIPHER_get_version = (char * (*)(SSL_CIPHER *)) GET_SSLLIB_SYMBOL("SSL_CIPHER_get_version"); @@ -692,70 +750,82 @@ KOpenSSLProxy *KOpenSSLProxy::self() { int KOpenSSLProxy::SSL_connect(SSL *ssl) { if (K_SSL_connect) return (K_SSL_connect)(ssl); + kdWarning() << "SSL_connect not defined!" << endl; return -1; } int KOpenSSLProxy::SSL_accept(SSL *ssl) { if (K_SSL_accept) return (K_SSL_accept)(ssl); + kdWarning() << "SSL_accept not defined!" << endl; return -1; } int KOpenSSLProxy::SSL_read(SSL *ssl, void *buf, int num) { if (K_SSL_read) return (K_SSL_read)(ssl, buf, num); + kdWarning() << "SSL_read not defined!" << endl; return -1; } int KOpenSSLProxy::SSL_write(SSL *ssl, const void *buf, int num) { if (K_SSL_write) return (K_SSL_write)(ssl, buf, num); + kdWarning() << "SSL_write not defined!" << endl; return -1; } SSL *KOpenSSLProxy::SSL_new(SSL_CTX *ctx) { if (K_SSL_new) return (K_SSL_new)(ctx); + kdWarning() << "SSL_new not defined!" << endl; return 0L; } void KOpenSSLProxy::SSL_free(SSL *ssl) { if (K_SSL_free) (K_SSL_free)(ssl); + else kdWarning() << "SSL_free not defined!" << endl; } int KOpenSSLProxy::SSL_shutdown(SSL *ssl) { if (K_SSL_shutdown) return (K_SSL_shutdown)(ssl); + kdWarning() << "SSL_shutdown not defined!" << endl; return -1; } SSL_CTX *KOpenSSLProxy::SSL_CTX_new(SSL_METHOD *method) { if (K_SSL_CTX_new) return (K_SSL_CTX_new)(method); + kdWarning() << "SSL_CTX_new not defined!" << endl; return 0L; } void KOpenSSLProxy::SSL_CTX_free(SSL_CTX *ctx) { if (K_SSL_CTX_free) (K_SSL_CTX_free)(ctx); + else kdWarning() << "SSL_CTX_free not defined!" << endl; } int KOpenSSLProxy::SSL_set_fd(SSL *ssl, int fd) { if (K_SSL_set_fd) return (K_SSL_set_fd)(ssl, fd); + kdWarning() << "SSL_sed_fd not defined!" << endl; return -1; } int KOpenSSLProxy::SSL_pending(SSL *ssl) { if (K_SSL_pending) return (K_SSL_pending)(ssl); + kdWarning() << "SSL_pending not defined!" << endl; return -1; } int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) { if (K_SSL_CTX_set_cipher_list) return (K_SSL_CTX_set_cipher_list)(ctx, str); + kdWarning() << "SSL_CTX_set_cipher_list not defined!" << endl; return -1; } @@ -763,820 +833,1095 @@ int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) { void KOpenSSLProxy::SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*verify_callback)(int, X509_STORE_CTX *)) { if (K_SSL_CTX_set_verify) (K_SSL_CTX_set_verify)(ctx, mode, verify_callback); + else kdWarning() << "SSL_CTX_set_verify not defined!" << endl; } int KOpenSSLProxy::SSL_use_certificate(SSL *ssl, X509 *x) { if (K_SSL_use_certificate) return (K_SSL_use_certificate)(ssl, x); + kdWarning() << "SSL_use_certificate not defined!" << endl; return -1; } SSL_CIPHER *KOpenSSLProxy::SSL_get_current_cipher(SSL *ssl) { if (K_SSL_get_current_cipher) return (K_SSL_get_current_cipher)(ssl); + kdWarning() << "SSL_get_current_cipher not defined!" << endl; return 0L; } -long KOpenSSLProxy::SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg) { +long KOpenSSLProxy::_SSL_set_options(SSL *ssl, long options) { + if (K_SSL_set_options) return (K_SSL_set_options)(ssl, options); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return this->SSL_set_options(ssl, options); +#endif + kdWarning() << "SSL_set_options not defined!" << endl; + return -1; +} + + +int KOpenSSLProxy::_SSL_session_reused(SSL *ssl) { + if (K_SSL_session_reused) return (K_SSL_session_reused)(ssl); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return this->SSL_session_reused(ssl); +#endif + kdWarning() << "SSL_session_reused not defined!" << endl; + return -1; +} + + +long KOpenSSLProxy::SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg) { if (K_SSL_ctrl) return (K_SSL_ctrl)(ssl, cmd, larg, parg); + kdWarning() << "SSL_ctrl not defined!" << endl; return -1; } int KOpenSSLProxy::RAND_egd(const char *path) { if (K_RAND_egd) return (K_RAND_egd)(path); + kdWarning() << "RAND_egd not defined!" << endl; return -1; } SSL_METHOD *KOpenSSLProxy::TLSv1_client_method() { if (K_TLSv1_client_method) return (K_TLSv1_client_method)(); + kdWarning() << "TLSv1_client_method not defined!" << endl; return 0L; } SSL_METHOD *KOpenSSLProxy::SSLv2_client_method() { if (K_SSLv2_client_method) return (K_SSLv2_client_method)(); + kdWarning() << "SSLv2_client_method not defined!" << endl; return 0L; } SSL_METHOD *KOpenSSLProxy::SSLv3_client_method() { if (K_SSLv3_client_method) return (K_SSLv3_client_method)(); + kdWarning() << "SSLv3_client_method not defined!" << endl; return 0L; } -SSL_METHOD *KOpenSSLProxy::SSLv23_client_method() { - if (K_SSLv23_client_method) return (K_SSLv23_client_method)(); +SSL_METHOD *KOpenSSLProxy::TLS_client_method() { + if (K_TLS_client_method) return (K_TLS_client_method)(); + kdWarning() << "TLS_client_method not defined!" << endl; return 0L; } X509 *KOpenSSLProxy::SSL_get_peer_certificate(SSL *s) { if (K_SSL_get_peer_certificate) return (K_SSL_get_peer_certificate)(s); + kdWarning() << "SSL_get_peer_certificate not defined!" << endl; return 0L; } int KOpenSSLProxy::SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits) { if (K_SSL_CIPHER_get_bits) return (K_SSL_CIPHER_get_bits)(c, alg_bits); + kdWarning() << "SSL_CIPHER_get_bits not defined!" << endl; return -1; } char * KOpenSSLProxy::SSL_CIPHER_get_version(SSL_CIPHER *c) { if (K_SSL_CIPHER_get_version) return (K_SSL_CIPHER_get_version)(c); + kdWarning() << "SSL_CIPHER_get_version not defined!" << endl; return 0L; } const char * KOpenSSLProxy::SSL_CIPHER_get_name(SSL_CIPHER *c) { if (K_SSL_CIPHER_get_name) return (K_SSL_CIPHER_get_name)(c); + kdWarning() << "SSL_CIPHER_get_name not defined!" << endl; return 0L; } char * KOpenSSLProxy::SSL_CIPHER_description(SSL_CIPHER *c,char *buf,int size) { if (K_SSL_CIPHER_description) return (K_SSL_CIPHER_description)(c,buf,size); + kdWarning() << "SSL_CIPHER_description not defined!" << endl; return 0L; } X509 * KOpenSSLProxy::d2i_X509(X509 **a,unsigned char **pp,long length) { if (K_d2i_X509) return (K_d2i_X509)(a,pp,length); + kdWarning() << "d2i_X509 not defined!" << endl; return 0L; } X509_CRL * KOpenSSLProxy::d2i_X509_CRL(X509_CRL **a,unsigned char **pp,long length) { if (K_d2i_X509_CRL) return (K_d2i_X509_CRL)(a,pp,length); + kdWarning() << "d2i_X509_CRL not defined!" << endl; return 0L; } int KOpenSSLProxy::i2d_X509(X509 *a,unsigned char **pp) { if (K_i2d_X509) return (K_i2d_X509)(a,pp); + kdWarning() << "i2d_X509 not defined!" << endl; return -1; } int KOpenSSLProxy::X509_cmp(X509 *a, X509 *b) { if (K_X509_cmp) return (K_X509_cmp)(a,b); + kdWarning() << "X509_cmp not defined!" << endl; + return 0; +} + + +int KOpenSSLProxy::X509_subject_name_cmp(const X509 *a, const X509 *b) { + if (K_X509_subject_name_cmp) return (K_X509_subject_name_cmp)(a, b); + kdWarning() << "X509_subject_name_cmp not defined!" << endl; return 0; } X509_STORE *KOpenSSLProxy::X509_STORE_new(void) { if (K_X509_STORE_new) return (K_X509_STORE_new)(); + kdWarning() << "X509_STORE_new not defined!" << endl; return 0L; } void KOpenSSLProxy::X509_STORE_free(X509_STORE *v) { if (K_X509_STORE_free) (K_X509_STORE_free)(v); + else kdWarning() << "X509_STORE_free not defined!" << endl; } X509_STORE_CTX *KOpenSSLProxy::X509_STORE_CTX_new(void) { if (K_X509_STORE_CTX_new) return (K_X509_STORE_CTX_new)(); + kdWarning() << "X509_STORE_CTX_new not defined!" << endl; return 0L; } void KOpenSSLProxy::X509_STORE_CTX_free(X509_STORE_CTX *ctx) { if (K_X509_STORE_CTX_free) (K_X509_STORE_CTX_free)(ctx); + else kdWarning() << "X509_STORE_CTX_free not defined!" << endl; } int KOpenSSLProxy::X509_verify_cert(X509_STORE_CTX *ctx) { if (K_X509_verify_cert) return (K_X509_verify_cert)(ctx); + kdWarning() << "X509_verify_cert not defined!" << endl; return -1; } void KOpenSSLProxy::X509_free(X509 *a) { if (K_X509_free) (K_X509_free)(a); + else kdWarning() << "X509_free not defined!" << endl; } void KOpenSSLProxy::X509_CRL_free(X509_CRL *a) { if (K_X509_CRL_free) (K_X509_CRL_free)(a); + else kdWarning() << "X509_CRL_free not defined!" << endl; } char *KOpenSSLProxy::X509_NAME_oneline(X509_NAME *a,char *buf,int size) { if (K_X509_NAME_oneline) return (K_X509_NAME_oneline)(a,buf,size); + kdWarning() << "X509_NAME_online not defined!" << endl; return 0L; } X509_NAME *KOpenSSLProxy::X509_get_subject_name(X509 *a) { if (K_X509_get_subject_name) return (K_X509_get_subject_name)(a); + kdWarning() << "X509_get_subject not defined!" << endl; return 0L; } X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a) { if (K_X509_get_issuer_name) return (K_X509_get_issuer_name)(a); + kdWarning() << "X509_get_issuer not defined!" << endl; return 0L; } X509_LOOKUP *KOpenSSLProxy::X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) { if (K_X509_STORE_add_lookup) return (K_X509_STORE_add_lookup)(v,m); + kdWarning() << "X509_STORE_add_lookup not defined!" << endl; return 0L; } X509_LOOKUP_METHOD *KOpenSSLProxy::X509_LOOKUP_file(void) { if (K_X509_LOOKUP_file) return (K_X509_LOOKUP_file)(); + kdWarning() << "X509_LOOKUP_file not defined!" << endl; return 0L; } void KOpenSSLProxy::X509_LOOKUP_free(X509_LOOKUP *x) { if (K_X509_LOOKUP_free) (K_X509_LOOKUP_free)(x); + else kdWarning() << "X509_LOOKUP_free not defined!" << endl; } int KOpenSSLProxy::X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret) { if (K_X509_LOOKUP_ctrl) return (K_X509_LOOKUP_ctrl)(ctx,cmd,argc,argl,ret); + kdWarning() << "X509_LOOKUP_ctrl not defined!" << endl; return -1; } void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain) { if (K_X509_STORE_CTX_init) (K_X509_STORE_CTX_init)(ctx,store,x509,chain); + else kdWarning() << "X509_STORE_CTX_init not defined!" << endl; } void KOpenSSLProxy::CRYPTO_free(void *x) { if (K_CRYPTO_free) (K_CRYPTO_free)(x); + else kdWarning() << "CRYPTO_free not defined!" << endl; } X509 *KOpenSSLProxy::X509_dup(X509 *x509) { if (K_X509_dup) return (K_X509_dup)(x509); + kdWarning() << "X509_dup not defined!" << endl; return 0L; } +void KOpenSSLProxy::X509_get0_signature(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x) { + if (K_X509_get0_signature) { + (X509_get0_signature)(psig, palg, x); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + if (!x) return; + if (psig) *psig = x->signature; + if (palg) *palg = x->sig_alg; + return; +#endif + kdWarning() << "X509_get0_signature not defined!" << endl; +} + + BIO *KOpenSSLProxy::BIO_new(BIO_METHOD *type) { if (K_BIO_new) return (K_BIO_new)(type); - else return 0L; + kdWarning() << "BIO_new not defined!" << endl; + return 0L; } BIO_METHOD *KOpenSSLProxy::BIO_s_mem(void) { if (K_BIO_s_mem) return (K_BIO_s_mem)(); - else return 0L; + kdWarning() << "BIO_s_mem not defined!" << endl; + return 0L; } BIO *KOpenSSLProxy::BIO_new_fp(FILE *stream, int close_flag) { if (K_BIO_new_fp) return (K_BIO_new_fp)(stream, close_flag); + kdWarning() << "BIO_new_fp not defined!" << endl; return 0L; } BIO *KOpenSSLProxy::BIO_new_mem_buf(void *buf, int len) { if (K_BIO_new_mem_buf) return (K_BIO_new_mem_buf)(buf,len); - else return 0L; + kdWarning() << "BIO_new_mem_buf not defined!" << endl; + return 0L; } int KOpenSSLProxy::BIO_free(BIO *a) { if (K_BIO_free) return (K_BIO_free)(a); + kdWarning() << "BIO_free not defined!" << endl; return -1; } long KOpenSSLProxy::BIO_ctrl(BIO *bp,int cmd,long larg,void *parg) { if (K_BIO_ctrl) return (K_BIO_ctrl)(bp,cmd,larg,parg); - else return 0; // failure return for BIO_ctrl is quite individual, maybe we should abort() instead + kdWarning() << "BIO_ctrl not defined!" << endl; + return 0; // failure return for BIO_ctrl is quite individual, maybe we should abort() instead } int KOpenSSLProxy::BIO_write(BIO *b, const void *data, int len) { if (K_BIO_write) return (K_BIO_write)(b, data, len); - else return -1; + kdWarning() << "BIO_write not defined!" << endl; + return -1; +} + + +void *KOpenSSLProxy::BIO_get_data(BIO *a) { + if (K_BIO_get_data) return (K_BIO_get_data)(a); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return a->ptr; +#endif + kdWarning() << "BIO_get_data not defined!" << endl; + return 0L; } int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) { if (K_PEM_ASN1_write_bio) return (K_PEM_ASN1_write_bio) ((int (*)())K_i2d_X509, PEM_STRING_X509, bp, (char *)x, 0L, 0L, 0, 0L, 0L); - else return -1; + kdWarning() << "PEM_write_bio_X509 not defined!" << endl; + return -1; } #if OPENSSL_VERSION_NUMBER >= 0x10000000L int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) { if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it) return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x); - else return -1; + kdWarning() << "ANS1_i2d_fp not defined!" << endl; + return -1; } #else ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(void) { if (K_X509_asn1_meth) return (K_X509_asn1_meth)(); - else return 0L; + kdWarning() << "X509_ans1_meth not defined!" << endl; + return 0L; } int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) { if (K_ASN1_i2d_fp && K_i2d_ASN1_HEADER) return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x); - else return -1; + kdWarning() << "ANS1_i2d_fp not defined!" << endl; + return -1; } #endif int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) { if (K_X509_print_fp) return (K_X509_print_fp)(fp, x); + kdWarning() << "X509_print not defined!" << endl; return -1; } PKCS12 *KOpenSSLProxy::d2i_PKCS12_fp(FILE *fp, PKCS12 **p12) { if (K_d2i_PKCS12_fp) return (K_d2i_PKCS12_fp)(fp, p12); - else return 0L; + kdWarning() << "d2i_PKCS12_fp not defined!" << endl; + return 0L; } int KOpenSSLProxy::PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass) { if (K_PKCS12_newpass) return (K_PKCS12_newpass)(p12, oldpass, newpass); - else return -1; + kdWarning() << "PKCS12_newpass not defined!" << endl; + return -1; } int KOpenSSLProxy::i2d_PKCS12(PKCS12 *p12, unsigned char **p) { if (K_i2d_PKCS12) return (K_i2d_PKCS12)(p12, p); - else return -1; + kdWarning() << "i2d_PKCS12 not defined!" << endl; + return -1; } int KOpenSSLProxy::i2d_PKCS12_fp(FILE *fp, PKCS12 *p12) { if (K_i2d_PKCS12_fp) return (K_i2d_PKCS12_fp)(fp, p12); - else return -1; + kdWarning() << "i2d_PKCS12_fp not defined!" << endl; + return -1; } PKCS12 *KOpenSSLProxy::PKCS12_new(void) { if (K_PKCS12_new) return (K_PKCS12_new)(); - else return 0L; + kdWarning() << "PKCS12_new not defined!" << endl; + return 0L; } void KOpenSSLProxy::PKCS12_free(PKCS12 *a) { if (K_PKCS12_free) (K_PKCS12_free)(a); + else kdWarning() << "PKCS12_free not defined!" << endl; } int KOpenSSLProxy::PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca) { if (K_PKCS12_parse) return (K_PKCS12_parse) (p12, pass, pkey, cert, ca); - else return -1; + kdWarning() << "PKCS12_parse not defined!" << endl; + return -1; } void KOpenSSLProxy::EVP_PKEY_free(EVP_PKEY *x) { if (K_EVP_PKEY_free) (K_EVP_PKEY_free)(x); + else kdWarning() << "EVP_PKEY_free not defined!" << endl; } EVP_PKEY* KOpenSSLProxy::EVP_PKEY_new() { if (K_EVP_PKEY_new) return (K_EVP_PKEY_new)(); - else return 0L; + kdWarning() << "EVP_PKEY_new not defined!" << endl; + return 0L; +} + + +int KOpenSSLProxy::EVP_PKEY_base_id(const EVP_PKEY *pkey) { + if (K_EVP_PKEY_base_id) return (K_EVP_PKEY_base_id)(pkey); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return pkey->type; +#endif + kdWarning() << "EVP_PKEY_base_id not defined!" << endl; + return -1; +} + + +RSA* KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey) { + if (K_EVP_PKEY_get0_RSA) return (K_EVP_PKEY_get0_RSA)(pkey); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return pkey->pkey.rsa; +#endif + kdWarning() << "EVP_PKEY_get0_RSA not defined!" << endl; + return 0L; +} + + +DSA* KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey) { + if (K_EVP_PKEY_get0_DSA) return (K_EVP_PKEY_get0_DSA)(pkey); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return pkey->pkey.dsa; +#endif + kdWarning() << "EVP_PKEY_get0_DSA not defined!" << endl; + return 0L; } void KOpenSSLProxy::X509_REQ_free(X509_REQ *x) { if (K_X509_REQ_free) (K_X509_REQ_free)(x); + else kdWarning() << "X509_REQ_free not defined!" << endl; } X509_REQ* KOpenSSLProxy::X509_REQ_new() { if (K_X509_REQ_new) return (K_X509_REQ_new)(); - else return 0L; + kdWarning() << "X509_REQ_new not defined!" << endl; + return 0L; } int KOpenSSLProxy::SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) { if (K_SSL_CTX_use_PrivateKey) return (K_SSL_CTX_use_PrivateKey)(ctx,pkey); - else return -1; + kdWarning() << "SSL_CTX_use_PrivateKey not defined!" << endl; + return -1; } int KOpenSSLProxy::SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) { if (K_SSL_CTX_use_certificate) return (K_SSL_CTX_use_certificate)(ctx,x); - else return -1; + kdWarning() << "SSL_CTX_use_certificate not defined!" << endl; + return -1; } int KOpenSSLProxy::SSL_get_error(SSL *ssl, int rc) { if (K_SSL_get_error) return (K_SSL_get_error)(ssl,rc); - else return -1; + kdWarning() << "SSL_get_error not defined!" << endl; + return -1; } STACK_OF(X509) *KOpenSSLProxy::SSL_get_peer_cert_chain(SSL *s) { if (K_SSL_get_peer_cert_chain) return (K_SSL_get_peer_cert_chain)(s); - else return 0L; + kdWarning() << "SSL_get_peer_cert_chain not defined!" << endl; + return 0L; } -void KOpenSSLProxy::sk_free(STACK *s) { +void KOpenSSLProxy::OPENSSL_sk_free(STACK *s) { if (K_sk_free) (K_sk_free)(s); + else kdWarning() << "OPENSSL_sk_free not defined!" << endl; } -int KOpenSSLProxy::sk_num(STACK *s) { +int KOpenSSLProxy::OPENSSL_sk_num(STACK *s) { if (K_sk_num) return (K_sk_num)(s); - else return -1; + kdWarning() << "OPENSSL_sk_num not defined!" << endl; + return -1; } -char *KOpenSSLProxy::sk_pop(STACK *s) { +char *KOpenSSLProxy::OPENSSL_sk_pop(STACK *s) { if (K_sk_pop) return (K_sk_pop)(s); - else return 0L; + kdWarning() << "OPENSSL_sk_pop not defined!" << endl; + return 0L; } -char *KOpenSSLProxy::sk_value(STACK *s, int n) { +char *KOpenSSLProxy::OPENSSL_sk_value(STACK *s, int n) { if (K_sk_value) return (K_sk_value)(s, n); - else return 0L; + kdWarning() << "OPENSSL_sk_value not defined!" << endl; + return 0L; } -void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) { - if (K_X509_STORE_CTX_set_chain) (K_X509_STORE_CTX_set_chain)(v,x); +void KOpenSSLProxy::X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *v, STACK_OF(X509)* x) { + if (K_X509_STORE_CTX_set0_untrusted) (K_X509_STORE_CTX_set0_untrusted)(v,x); + else kdWarning() << "X509_STORE_CTX_set0_untrusted not defined!" << endl; } void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose) { if (K_X509_STORE_CTX_set_purpose) (K_X509_STORE_CTX_set_purpose)(v,purpose); + else kdWarning() << "X509_STORE_CTX_set_purpose not defined!" << endl; } -STACK* KOpenSSLProxy::sk_dup(STACK *s) { +STACK* KOpenSSLProxy::OPENSSL_sk_dup(const STACK *s) { if (K_sk_dup) return (K_sk_dup)(s); - else return 0L; + kdWarning() << "OPENSSL_sk_dup not defined!" << endl; + return 0L; } -STACK* KOpenSSLProxy::sk_new(int (*cmp)()) { +STACK* KOpenSSLProxy::OPENSSL_sk_new(int (*cmp)()) { if (K_sk_new) return (K_sk_new)(cmp); - else return 0L; + kdWarning() << "OPENSSL_sk_new not defined!" << endl; + return 0L; } -int KOpenSSLProxy::sk_push(STACK* s, char* d) { +int KOpenSSLProxy::OPENSSL_sk_push(STACK* s, char* d) { if (K_sk_push) return (K_sk_push)(s,d); - else return -1; + kdWarning() << "OPENSSL_sk_push not defined!" << endl; + return -1; } char *KOpenSSLProxy::i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint) { if (K_i2s_ASN1_INTEGER) return (K_i2s_ASN1_INTEGER)(meth, aint); - else return 0L; + kdWarning() << "i2s_ANS1_INTEGER not defined!" << endl; + return 0L; } ASN1_INTEGER *KOpenSSLProxy::X509_get_serialNumber(X509 *x) { if (K_X509_get_serialNumber) return (K_X509_get_serialNumber)(x); - else return 0L; + kdWarning() << "X509_get_serialNumber not defined!" << endl; + return 0L; } EVP_PKEY *KOpenSSLProxy::X509_get_pubkey(X509 *x) { if (K_X509_get_pubkey) return (K_X509_get_pubkey)(x); - else return 0L; + kdWarning() << "X59_get_pubkey not defined!" << endl; + return 0L; } int KOpenSSLProxy::i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) { if (K_i2d_PublicKey) return (K_i2d_PublicKey)(a,pp); - else return 0; + kdWarning() << "i2d_PublicKey not defined!" << endl; + return 0; } int KOpenSSLProxy::X509_check_private_key(X509 *x, EVP_PKEY *p) { if (K_X509_check_private_key) return (K_X509_check_private_key)(x,p); + kdWarning() << "X509_check_private_key not defined!" << endl; return -1; } char *KOpenSSLProxy::BN_bn2hex(const BIGNUM *a) { if (K_BN_bn2hex) return (K_BN_bn2hex)(a); - else return 0L; + kdWarning() << "BN_bn2hex not defined!" << endl; + return 0L; } int KOpenSSLProxy::X509_digest(const X509 *x,const EVP_MD *t, unsigned char *md, unsigned int *len) { if (K_X509_digest) return (K_X509_digest)(x, t, md, len); - else return -1; + kdWarning() << "X509_digest not defined!" << endl; + return -1; } EVP_MD *KOpenSSLProxy::EVP_md5() { if (K_EVP_md5) return (K_EVP_md5)(); + kdWarning() << "EVP_md5 not defined!" << endl; return 0L; } void KOpenSSLProxy::ASN1_INTEGER_free(ASN1_INTEGER *a) { if (K_ASN1_INTEGER_free) (K_ASN1_INTEGER_free)(a); + else kdWarning() << "ANS1_INTEGER_free not defined!" << endl; } int KOpenSSLProxy::OBJ_obj2nid(ASN1_OBJECT *o) { if (K_OBJ_obj2nid) return (K_OBJ_obj2nid)(o); - else return -1; + kdWarning() << "OBJ_obj2nid not defined!" << endl; + return -1; } const char * KOpenSSLProxy::OBJ_nid2ln(int n) { if (K_OBJ_nid2ln) return (K_OBJ_nid2ln)(n); - else return 0L; + kdWarning() << "OBJ_nid2ln not defined!" << endl; + return 0L; } int KOpenSSLProxy::X509_get_ext_count(X509 *x) { if (K_X509_get_ext_count) return (K_X509_get_ext_count)(x); - else return -1; + kdWarning() << "X509_get_ext_count not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_get_ext_by_NID(X509 *x, int nid, int lastpos) { if (K_X509_get_ext_by_NID) return (K_X509_get_ext_by_NID)(x,nid,lastpos); - else return -1; + kdWarning() << "X509_get_ext_by_NID not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos) { if (K_X509_get_ext_by_OBJ) return (K_X509_get_ext_by_OBJ)(x,obj,lastpos); - else return -1; + kdWarning() << "X509_get_ext_by_OBJ not defined!" << endl; + return -1; } X509_EXTENSION *KOpenSSLProxy::X509_get_ext(X509 *x, int loc) { if (K_X509_get_ext) return (K_X509_get_ext)(x,loc); - else return 0L; + kdWarning() << "X509_get_ext not defined!" << endl; + return 0L; } X509_EXTENSION *KOpenSSLProxy::X509_delete_ext(X509 *x, int loc) { if (K_X509_delete_ext) return (K_X509_delete_ext)(x,loc); - else return 0L; + kdWarning() << "X509_delete_ext not defined!" << endl; + return 0L; } int KOpenSSLProxy::X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc) { if (K_X509_add_ext) return (K_X509_add_ext)(x,ex,loc); - else return -1; + kdWarning() << "X509_add_ext not defined!" << endl; + return -1; } void *KOpenSSLProxy::X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx) { if (K_X509_get_ext_d2i) return (K_X509_get_ext_d2i)(x,nid,crit,idx); - else return 0L; + kdWarning() << "X509_get_ext_d2i not defined!" << endl; + return 0L; } char *KOpenSSLProxy::i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5) { if (K_i2s_ASN1_OCTET_STRING) return (K_i2s_ASN1_OCTET_STRING)(method,ia5); - else return 0L; + kdWarning() << "i2s_ANS1_OCTET_STRING not defined!" << endl; + return 0L; } int KOpenSSLProxy::ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n) { if (K_ASN1_BIT_STRING_get_bit) return (K_ASN1_BIT_STRING_get_bit)(a,n); - else return -1; + kdWarning() << "ANS1_BIT_STRING_get_bit not defined!" << endl; + return -1; } PKCS7 *KOpenSSLProxy::PKCS7_new(void) { if (K_PKCS7_new) return (K_PKCS7_new)(); - else return 0L; + kdWarning() << "PKCS7_new not defined!" << endl; + return 0L; } void KOpenSSLProxy::PKCS7_free(PKCS7 *a) { if (K_PKCS7_free) (K_PKCS7_free)(a); + else kdWarning() << "PKCS7_free not defined!" << endl; } void KOpenSSLProxy::PKCS7_content_free(PKCS7 *a) { if (K_PKCS7_content_free) (K_PKCS7_content_free)(a); + else kdWarning() << "PKCS7_content_free not defined!" << endl; } int KOpenSSLProxy::i2d_PKCS7(PKCS7 *a, unsigned char **pp) { if (K_i2d_PKCS7) return (K_i2d_PKCS7)(a,pp); - else return -1; + kdWarning() << "i2d_PKCS7 not defined!" << endl; + return -1; } PKCS7 *KOpenSSLProxy::d2i_PKCS7(PKCS7 **a, unsigned char **pp,long length) { if (K_d2i_PKCS7) return (K_d2i_PKCS7)(a,pp,length); - else return 0L; + kdWarning() << "d2i_PKCS7 not defined!" << endl; + return 0L; } int KOpenSSLProxy::i2d_PKCS7_fp(FILE *fp,PKCS7 *p7) { if (K_i2d_PKCS7_fp) return (K_i2d_PKCS7_fp)(fp,p7); - else return -1; + kdWarning() << "i2d_PKCS7_fd not defined!" << endl; + return -1; } PKCS7 *KOpenSSLProxy::d2i_PKCS7_fp(FILE *fp,PKCS7 **p7) { if (K_d2i_PKCS7_fp) return (K_d2i_PKCS7_fp)(fp,p7); - else return 0L; + kdWarning() << "d2i_PKCS7_fp not defined!" << endl; + return 0L; } int KOpenSSLProxy::i2d_PKCS7_bio(BIO *bp,PKCS7 *p7) { if (K_i2d_PKCS7_bio) return (K_i2d_PKCS7_bio)(bp, p7); - else return -1; + kdWarning() << "i2d_PKCS7_bio not defined!" << endl; + return -1; } PKCS7 *KOpenSSLProxy::d2i_PKCS7_bio(BIO *bp,PKCS7 **p7) { if (K_d2i_PKCS7_bio) return (K_d2i_PKCS7_bio)(bp, p7); - else return 0L; + kdWarning() << "d2i_PKCS7_bio not defined!" << endl; + return 0L; } PKCS7 *KOpenSSLProxy::PKCS7_dup(PKCS7 *p7) { if (K_PKCS7_dup) return (K_PKCS7_dup)(p7); - else return 0L; + kdWarning() << "PKCS7_dup not defined!" << endl; + return 0L; } PKCS7 *KOpenSSLProxy::PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags) { if (K_PKCS7_sign) return (K_PKCS7_sign)(signcert,pkey,certs,data,flags); - else return 0L; + kdWarning() << "PKCS7_sign not defined!" << endl; + return 0L; } int KOpenSSLProxy::PKCS7_verify(PKCS7* p, STACK_OF(X509)* st, X509_STORE* s, BIO* in, BIO *out, int flags) { if (K_PKCS7_verify) return (K_PKCS7_verify)(p,st,s,in,out,flags); - else return 0; + kdWarning() << "PKCS7_verify not defined!" << endl; + return 0; } STACK_OF(X509) *KOpenSSLProxy::PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) { if (K_PKCS7_get0_signers) return (K_PKCS7_get0_signers)(p7,certs,flags); - else return 0L; + kdWarning() << "PKCS7_get0_signers not defined!" << endl; + return 0L; } PKCS7 *KOpenSSLProxy::PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher, int flags) { if (K_PKCS7_encrypt) return (K_PKCS7_encrypt)(certs,in,cipher,flags); - else return 0L; + kdWarning() << "PKCS7_encrypt not defined!" << endl; + return 0L; } int KOpenSSLProxy::PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags) { if (K_PKCS7_decrypt) return (K_PKCS7_decrypt)(p7,pkey,cert,data,flags); - else return 0; + kdWarning() << "PKCS7_decrypt not defined!" << endl; + return 0; } STACK_OF(X509_NAME) *KOpenSSLProxy::SSL_load_client_CA_file(const char *file) { if (K_SSL_load_client_CA_file) return (K_SSL_load_client_CA_file)(file); - else return 0L; + kdWarning() << "SSL_load_client_CA_file not defined!" << endl; + return 0L; } STACK_OF(X509_INFO) *KOpenSSLProxy::PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u) { if (K_PEM_X509_INFO_read) return (K_PEM_X509_INFO_read)(fp,sk,cb,u); - else return 0L; + kdWarning() << "PEM_X509_INFO_read not defined!" << endl; + return 0L; } X509 *KOpenSSLProxy::X509_d2i_fp(FILE *out, X509** buf) { if (K_ASN1_d2i_fp) return reinterpret_cast<X509 *>((K_ASN1_d2i_fp)(reinterpret_cast<char *(*)()>(K_X509_new), reinterpret_cast<char *(*)()>(K_d2i_X509), out, reinterpret_cast<unsigned char **>(buf))); - else return 0L; + kdWarning() << "X509_d2i_fp not defined!" << endl; + return 0L; } int KOpenSSLProxy::SSL_peek(SSL *ssl,void *buf,int num) { if (K_SSL_peek) return (K_SSL_peek)(ssl,buf,num); - else return -1; + kdWarning() << "SSL_peek not defined!" << endl; + return -1; } const char *KOpenSSLProxy::RAND_file_name(char *buf, size_t num) { if (K_RAND_file_name) return (K_RAND_file_name)(buf, num); - else return 0L; + kdWarning() << "RAND_file_name not defined!" << endl; + return 0L; } int KOpenSSLProxy::RAND_load_file(const char *filename, long max_bytes) { if (K_RAND_load_file) return (K_RAND_load_file)(filename, max_bytes); - else return -1; + kdWarning() << "REND_load_file not defined!" << endl; + return -1; } int KOpenSSLProxy::RAND_write_file(const char *filename) { if (K_RAND_write_file) return (K_RAND_write_file)(filename); - else return -1; + kdWarning() << "RAND_write_file not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_PURPOSE_get_count() { if (K_X509_PURPOSE_get_count) return (K_X509_PURPOSE_get_count)(); - else return -1; + kdWarning() << "X509_PURPOSE_get_count not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_PURPOSE_get_id(X509_PURPOSE *p) { if (K_X509_PURPOSE_get_id) return (K_X509_PURPOSE_get_id)(p); - else return -1; + kdWarning() << "X509_PURPOSE_get_id not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_check_purpose(X509 *x, int id, int ca) { if (K_X509_check_purpose) return (K_X509_check_purpose)(x, id, ca); - else return -1; + kdWarning() << "X509_check_purpose not defined!" << endl; + return -1; } X509_PURPOSE *KOpenSSLProxy::X509_PURPOSE_get0(int idx) { if (K_X509_PURPOSE_get0) return (K_X509_PURPOSE_get0)(idx); - else return 0L; + kdWarning() << "X509_PURPOSE_get0 not defined!" << endl; + return 0L; } int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) { if (K_EVP_PKEY_assign) return (K_EVP_PKEY_assign)(pkey, type, key); - else return -1; + kdWarning() << "EVP_PKEY_assign not defined!" << endl; + return -1; } int KOpenSSLProxy::X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) { if (K_X509_REQ_set_pubkey) return (K_X509_REQ_set_pubkey)(x, pkey); - else return -1; + kdWarning() << "X509_REQ_set_pubkey not defined!" << endl; + return -1; +} + + +void KOpenSSLProxy::RSA_get0_key(const RSA *r, + const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) { + if (K_RSA_get0_key) { + (K_RSA_get0_key)(r, n, e, d); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + if (!r) return; + if (n) *n = r->n; + if (e) *e = r->e; + if (d) *d = r->d; + return; +#endif + kdWarning() << "REG_get0_key not defined!" << endl; } RSA* KOpenSSLProxy::RSA_generate_key(int bits, unsigned long e, void (*callback)(int,int,void *), void *cb_arg) { if (K_RSA_generate_key) return (K_RSA_generate_key)(bits, e, callback, cb_arg); - else return 0L; + kdWarning() << "RSA_generate_key not defined!" << endl; + return 0L; +} + + +void KOpenSSLProxy::DSA_get0_pqg(const DSA *d, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) { + if (K_DSA_get0_pqg) { + (K_DSA_get0_pqg)(d, p, q, g); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + if (!d) return; + if (p) *p = d->p; + if (q) *q = d->q; + if (g) *g = d->g; + return; +#endif + kdWarning() << "DSA_get0_pqg not defined!" << endl; } + +void KOpenSSLProxy::DSA_get0_key(const DSA *d, + const BIGNUM **pub_key, const BIGNUM **priv_key) { + if (K_DSA_get0_key) { + (K_DSA_get0_key)(d, pub_key, priv_key); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + if (!d) return; + if (pub_key) *pub_key = d->pub_key; + if (priv_key) *priv_key = d->priv_key; + return; +#endif + kdWarning() << "DSA_get0_key not defined!" << endl; +} + + STACK *KOpenSSLProxy::X509_get1_email(X509 *x) { if (K_X509_get1_email) return (K_X509_get1_email)(x); - else return 0L; + kdWarning() << "X509_get1_email not defined!" << endl; + return 0L; } void KOpenSSLProxy::X509_email_free(STACK *sk) { if (K_X509_email_free) (K_X509_email_free)(sk); + else kdWarning() << "X509_email_free not defined!" << endl; } EVP_CIPHER *KOpenSSLProxy::EVP_des_ede3_cbc() { if (K_EVP_des_ede3_cbc) return (K_EVP_des_ede3_cbc)(); - else return 0L; + kdWarning() << "EVM_des_ede3_cbc not defined!" << endl; + return 0L; } EVP_CIPHER *KOpenSSLProxy::EVP_des_cbc() { if (K_EVP_des_cbc) return (K_EVP_des_cbc)(); - else return 0L; + kdWarning() << "EVP_des_cbc not defined!" << endl; + return 0L; } EVP_CIPHER *KOpenSSLProxy::EVP_rc2_cbc() { if (K_EVP_rc2_cbc) return (K_EVP_rc2_cbc)(); - else return 0L; + kdWarning() << "EVP_rc2_cbc not defined!" << endl; + return 0L; } EVP_CIPHER *KOpenSSLProxy::EVP_rc2_64_cbc() { if (K_EVP_rc2_64_cbc) return (K_EVP_rc2_64_cbc)(); - else return 0L; + kdWarning() << "EVP_rc2_64_cbc not defined!" << endl; + return 0L; } EVP_CIPHER *KOpenSSLProxy::EVP_rc2_40_cbc() { if (K_EVP_rc2_40_cbc) return (K_EVP_rc2_40_cbc)(); - else return 0L; + kdWarning() << "EVP_rc2_40_cbc not defined!" << endl; + return 0L; } int KOpenSSLProxy::i2d_X509_REQ_fp(FILE *fp, X509_REQ *x) { if (K_i2d_X509_REQ_fp) return (K_i2d_X509_REQ_fp)(fp,x); - else return -1; + kdWarning() << "i2d_X509_REQ_fp not defined!" << endl; + return -1; } void KOpenSSLProxy::ERR_clear_error() { if (K_ERR_clear_error) (K_ERR_clear_error)(); + else kdWarning() << "ERR_clear_error not defined!" << endl; } unsigned long KOpenSSLProxy::ERR_get_error() { if (K_ERR_get_error) return (K_ERR_get_error)(); - else return 0xffffffff; + kdWarning() << "ERR_get_error not defined!" << endl; + return 0xffffffff; } void KOpenSSLProxy::ERR_print_errors_fp(FILE* fp) { if (K_ERR_print_errors_fp) (K_ERR_print_errors_fp)(fp); + else kdWarning() << "ERR_print_errors_fp not defined!" << endl; } SSL_SESSION *KOpenSSLProxy::SSL_get1_session(SSL *ssl) { if (K_SSL_get1_session) return (K_SSL_get1_session)(ssl); - else return 0L; + kdWarning() << "SSL_get1_session not defined!" << endl; + return 0L; } void KOpenSSLProxy::SSL_SESSION_free(SSL_SESSION *session) { if (K_SSL_SESSION_free) (K_SSL_SESSION_free)(session); + else kdWarning() << "SSL_SESSION_free not defined!" << endl; } int KOpenSSLProxy::SSL_set_session(SSL *ssl, SSL_SESSION *session) { if (K_SSL_set_session) return (K_SSL_set_session)(ssl, session); - else return -1; + kdWarning() << "SSL_set_session not defined!" << endl; + return -1; } SSL_SESSION *KOpenSSLProxy::d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, long length) { if (K_d2i_SSL_SESSION) return (K_d2i_SSL_SESSION)(a, pp, length); - else return 0L; + kdWarning() << "d2i_SSL_SESSION not defined!" << endl; + return 0L; } int KOpenSSLProxy::i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) { if (K_i2d_SSL_SESSION) return (K_i2d_SSL_SESSION)(in, pp); - else return -1; + kdWarning() << "i2d_SSL_SESSION not defined!" << endl; + return -1; } int KOpenSSLProxy::i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *p) { if (K_i2d_PrivateKey_fp) return (K_i2d_PrivateKey_fp)(fp, p); - else return -1; + kdWarning() << "i2d_PrivateKey not defined!" << endl; + return -1; } int KOpenSSLProxy::i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *p, const EVP_CIPHER *c, char *k, int klen, pem_password_cb *cb, void *u) { if (K_i2d_PKCS8PrivateKey_fp) return (K_i2d_PKCS8PrivateKey_fp)(fp, p, c, k, klen, cb, u); - else return -1; + kdWarning() << "i2d_PKCS8PrivateKey_fp not defined!" << endl; + return -1; } void KOpenSSLProxy::RSA_free(RSA *rsa) { if (K_RSA_free) (K_RSA_free)(rsa); + else kdWarning() << "RSA_free not defined!" << endl; } EVP_CIPHER *KOpenSSLProxy::EVP_bf_cbc() { if (K_EVP_bf_cbc) return (K_EVP_bf_cbc)(); + kdWarning() << "EVP_bf_cbc not defined!" << endl; return 0L; } int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md) { if (K_X509_REQ_sign) return (K_X509_REQ_sign)(x, pkey, md); + kdWarning() << "X509_REQ_sign not defined!" << endl; return -1; } @@ -1584,36 +1929,191 @@ int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md) int KOpenSSLProxy::X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, unsigned char *bytes, int len, int loc, int set) { if (K_X509_NAME_add_entry_by_txt) return (K_X509_NAME_add_entry_by_txt)(name, field, type, bytes, len, loc, set); + kdWarning() << "X509_NAME_add_entry not defined!" << endl; return -1; } X509_NAME *KOpenSSLProxy::X509_NAME_new() { if (K_X509_NAME_new) return (K_X509_NAME_new)(); + kdWarning() << "X509_NAME_new not defined!" << endl; return 0L; } int KOpenSSLProxy::X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name) { if (K_X509_REQ_set_subject_name) return (K_X509_REQ_set_subject_name)(req, name); + kdWarning() << "X509_REQ_set_subject_name not defined!" << endl; return -1; } unsigned char *KOpenSSLProxy::ASN1_STRING_data(ASN1_STRING *x) { if (K_ASN1_STRING_data) return (K_ASN1_STRING_data)(x); + kdWarning() << "ASN1_STRING_data not defined!" << endl; return 0L; } int KOpenSSLProxy::ASN1_STRING_length(ASN1_STRING *x) { if (K_ASN1_STRING_length) return (K_ASN1_STRING_length)(x); + kdWarning() << "ASN1_STRING_length not defined!" << endl; return 0L; } STACK_OF(SSL_CIPHER) *KOpenSSLProxy::SSL_get_ciphers(const SSL* ssl) { if (K_SSL_get_ciphers) return (K_SSL_get_ciphers)(ssl); + kdWarning() << "SSL_get_ciphers not defined!" << endl; return 0L; } +const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_lastUpdate(const X509_CRL *crl) { + if (K_X509_CRL_get0_lastUpdate) return (K_X509_CRL_get0_lastUpdate)(crl); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return X509_CRL_get_lastUpdate(crl); #endif + kdWarning() << "X509_CRL_get_lastUpdate not defined!" << endl; + return 0L; +} + +const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_nextUpdate(const X509_CRL *crl) { + if (K_X509_CRL_get0_nextUpdate) return (K_X509_CRL_get0_nextUpdate)(crl); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return X509_CRL_get_nextUpdate(crl); +#endif + kdWarning() << "X509_CRL_get_nextUpdate not defined!" << endl; + return 0L; +} + +X509* KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) { + if (K_X509_STORE_CTX_get_current_cert) return (K_X509_STORE_CTX_get_current_cert)(ctx); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return ctx->current_cert; +#endif + kdWarning() << "X509_STORE_CTX_get_current_cert not defined!" << endl; + return 0L; +} + +int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) { + if (K_X509_STORE_CTX_get_error) return (K_X509_STORE_CTX_get_error)(ctx); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return ctx->error; +#endif + kdWarning() << "X509k_STORE_CTX_get_error not defined!" << endl; + return -1; +} +int KOpenSSLProxy::X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) { + if (K_X509_STORE_CTX_get_error_depth) return (K_X509_STORE_CTX_get_error_depth)(ctx); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return ctx->error_depth; +#endif + kdWarning() << "X509_STORE_CTX_get_error_depth not defined!" << endl; + return -1; +} + +void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s) { + if (K_X509_STORE_CTX_set_error) { + (K_X509_STORE_CTX_set_error)(ctx, s); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + ctx->error = s; + return; +#endif + kdWarning() << "X509_STORE_CTX_set_error not defined!" << endl; +} + +void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb) { + if (K_X509_STORE_set_verify_cb) { + (K_X509_STORE_set_verify_cb)(ctx, verify_cb); + return; + } +#if OPENSSL_VERSION_NUMBER < 0x10100000L + X509_STORE_set_verify_cb_func(ctx, verify_cb); + return; +#endif + kdWarning() << "X590_STORE_set_verify_cb not defined!" << endl; +} + +STACK_OF(X509_OBJECT)* KOpenSSLProxy::X509_STORE_get0_objects(X509_STORE *v) { + if (K_X509_STORE_get0_objects) return (K_X509_STORE_get0_objects)(v); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return v->objs; +#endif + kdWarning() << "X509_STORE_get0_objects not defined!" << endl; +} + +X509_LOOKUP_TYPE KOpenSSLProxy::X509_OBJECT_get_type(const X509_OBJECT *a) { + if (K_X509_OBJECT_get_type) return (K_X509_OBJECT_get_type)(a); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return a->type; +#endif + kdWarning() << "X509_OBJECT_get_type not defined!" << endl; +} + +X509* KOpenSSLProxy::X509_OBJECT_get0_X509(const X509_OBJECT *a) { + if (K_X509_OBJECT_get0_X509) return (K_X509_OBJECT_get0_X509)(a); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return a->data.x509; +#endif + kdWarning() << "X509_OBJECT_get0_X509 not defined!" << endl; +} + + +ASN1_TIME* KOpenSSLProxy::X509_getm_notAfter(const X509 *x) { + if (K_X509_getm_notAfter) return (K_X509_getm_notAfter)(x); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return X509_get_notAfter(x); +#endif + kdWarning() << "X509_get_notAfter not defined!" << endl; + return 0L; +} + +ASN1_TIME* KOpenSSLProxy::X509_getm_notBefore(const X509 *x) { + if (K_X509_getm_notBefore) return (K_X509_getm_notBefore)(x); +#if OPENSSL_VERSION_NUMBER < 0x10100000L + return X509_get_notBefore(x); +#endif + kdWarning() << "X509_get_notBefore not defined!" << endl; + return 0L; +} + +/* cover KOpenSSLProxy API compatibility */ +STACK* KOpenSSLProxy::sk_dup(const STACK *s) { + return OPENSSL_sk_dup(s); +} + +void KOpenSSLProxy::sk_free(STACK *s) { + OPENSSL_sk_free(s); +} + +STACK* KOpenSSLProxy::sk_new(int (*cmp)()) { + return OPENSSL_sk_new(cmp); +} + +int KOpenSSLProxy::sk_num(STACK *s) { + return OPENSSL_sk_num(s); +} + +char* KOpenSSLProxy::sk_pop(STACK *s) { + return OPENSSL_sk_pop(s); +} + +int KOpenSSLProxy::sk_push(STACK *s, char *d) { + return OPENSSL_sk_push(s, d); +} + +char* KOpenSSLProxy::sk_value(STACK *s, int n) { + return OPENSSL_sk_value(s, n); +} + +void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) { + X509_STORE_CTX_set0_untrusted(v, x); +} + +SSL_METHOD* KOpenSSLProxy::SSLv23_client_method() { + return TLS_client_method(); +} + +#endif |