From 30cbadc38dc1f5b4ddd31788b4532093d87c6d60 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 26 Feb 2015 10:40:32 -0700 Subject: [PATCH] changes for MYSQL port --- IDE/MYSQL/CMakeLists_wolfCrypt.txt | 47 ++++++++++++ IDE/MYSQL/CMakeLists_wolfSSL.txt | 42 +++++++++++ IDE/MYSQL/do.sh | 7 ++ src/ssl.c | 72 +++++++++++++++++++ wolfssl/openssl/bn.h | 2 +- wolfssl/openssl/des.h | 16 +++++ wolfssl/openssl/ssl.h | 112 +++++++++++++++++------------ wolfssl/ssl.h | 13 +++- 8 files changed, 265 insertions(+), 46 deletions(-) create mode 100644 IDE/MYSQL/CMakeLists_wolfCrypt.txt create mode 100644 IDE/MYSQL/CMakeLists_wolfSSL.txt create mode 100755 IDE/MYSQL/do.sh diff --git a/IDE/MYSQL/CMakeLists_wolfCrypt.txt b/IDE/MYSQL/CMakeLists_wolfCrypt.txt new file mode 100644 index 000000000..6c6f6b13f --- /dev/null +++ b/IDE/MYSQL/CMakeLists_wolfCrypt.txt @@ -0,0 +1,47 @@ +# CMakeLists.txt +# +# Copyright (C) 2006-2015 wolfSSL Inc. +# +# This file is part of wolfSSL. (formerly known as CyaSSL) +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/wolfssl/wolfcrypt + ${CMAKE_SOURCE_DIR}/extra/wolfssl) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +ADD_DEFINITIONS(${SSL_DEFINES}) +SET(WOLFCRYPT_SOURCES src/aes.c src/arc4.c src/asn.c src/blake2b.c + src/camellia.c src/chacha.c src/coding.c src/compress.c src/des3.c + src/dh.c src/dsa.c src/ecc.c src/error.c src/hc128.c src/hmac.c + src/integer.c src/logging.c src/md2.c src/md4.c src/md5.c src/memory.c + src/misc.c src/pkcs7.c src/poly1305.c src/pwdbased.c src/rabbit.c + src/random.c src/ripemd.c src/rsa.c src/sha.c src/sha256.c src/sha512.c + src/tfm.c src/wc_port.c + ../wolfssl/wolfcrypt/aes.h ../wolfssl/wolfcrypt/arc4.h ../wolfssl/wolfcrypt/asn.h ../wolfssl/wolfcrypt/blake2.h + ../wolfssl/wolfcrypt/camellia.h ../wolfssl/wolfcrypt/chacha.h ../wolfssl/wolfcrypt/coding.h ../wolfssl/wolfcrypt/compress.h ../wolfssl/wolfcrypt/des3.h + ../wolfssl/wolfcrypt/dh.h ../wolfssl/wolfcrypt/dsa.h ../wolfssl/wolfcrypt/ecc.h ../wolfssl/wolfcrypt/error-crypt.h ../wolfssl/wolfcrypt/hc128.h ../wolfssl/wolfcrypt/hmac.h + ../wolfssl/wolfcrypt/integer.h ../wolfssl/wolfcrypt/logging.h ../wolfssl/wolfcrypt/md2.h ../wolfssl/wolfcrypt/md4.h ../wolfssl/wolfcrypt/md5.h ../wolfssl/wolfcrypt/memory.h + ../wolfssl/wolfcrypt/misc.h ../wolfssl/wolfcrypt/pkcs7.h ../wolfssl/wolfcrypt/poly1305.h ../wolfssl/wolfcrypt/pwdbased.h ../wolfssl/wolfcrypt/rabbit.h + ../wolfssl/wolfcrypt/random.h ../wolfssl/wolfcrypt/ripemd.h ../wolfssl/wolfcrypt/rsa.h ../wolfssl/wolfcrypt/sha.h ../wolfssl/wolfcrypt/sha256.h ../wolfssl/wolfcrypt/sha512.h + ../wolfssl/wolfcrypt/tfm.h ../wolfssl/wolfcrypt/wc_port.h + ) + +ADD_CONVENIENCE_LIBRARY(wolfcrypt ${WOLFCRYPT_SOURCES}) +RESTRICT_SYMBOL_EXPORTS(wolfcrypt) + +IF(MSVC) + INSTALL_DEBUG_TARGET(wolfcrypt DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/IDE/MYSQL/CMakeLists_wolfSSL.txt b/IDE/MYSQL/CMakeLists_wolfSSL.txt new file mode 100644 index 000000000..d3b205e5c --- /dev/null +++ b/IDE/MYSQL/CMakeLists_wolfSSL.txt @@ -0,0 +1,42 @@ +# CMakeLists.txt +# +# Copyright (C) 2006-2015 wolfSSL Inc. +# +# This file is part of wolfSSL. (formerly known as CyaSSL) +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/extra/wolfssl + ${CMAKE_SOURCE_DIR}/extra/wolfssl/wolfssl + ${CMAKE_SOURCE_DIR}/extra/wolfssl/wolfssl/wolfcrypt) + +ADD_DEFINITIONS(${SSL_DEFINES}) + +# rename get_tty_password to avoid collisions with the main binary +ADD_DEFINITIONS(-Dget_tty_password_ext=wolfssl_mysql_get_tty_password_ext) +ADD_DEFINITIONS(-Dget_tty_password=wolfssl_mysql_get_tty_password) + +SET(WOLFSSL_SOURCES src/crl.c src/internal.c src/keys.c src/sniffer.c + src/tls.c src/io.c src/ocsp.c src/ssl.c + ../../client/get_password.c ) + +ADD_CONVENIENCE_LIBRARY(wolfssl ${WOLFSSL_SOURCES}) +RESTRICT_SYMBOL_EXPORTS(wolfssl) + +IF(MSVC) + INSTALL_DEBUG_TARGET(wolfssl DESTINATION ${INSTALL_LIBDIR}/debug) +ENDIF() diff --git a/IDE/MYSQL/do.sh b/IDE/MYSQL/do.sh new file mode 100755 index 000000000..093fb3874 --- /dev/null +++ b/IDE/MYSQL/do.sh @@ -0,0 +1,7 @@ +# Place CMakeList in needed directories + +cp CMakeLists_wolfSSL.txt ../../CMakeLists.txt +echo Copied CMakeLists_wolfSSL.txt to wolfssl/CMakeLists.txt +cp CMakeLists_wolfCrypt.txt ../../wolfcrypt/CMakeLists.txt +echo Copied CMakeLists_wolfCrypt.txt to wolfssl/wolfcrypt/CMakeLists.txt + diff --git a/src/ssl.c b/src/ssl.c index 5ef43fc8f..412bfd724 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -225,6 +225,21 @@ int wolfSSL_set_fd(WOLFSSL* ssl, int fd) } +/** + * Get the name of cipher at priotity level passed in. + */ +char* wolfSSL_get_cipher_list(int priority) +{ + const char* const* ciphers = GetCipherNames(); + + if (priority >= GetCipherNamesSize() || priority < 0) { + return 0; + } + + return (char*)ciphers[priority]; +} + + int wolfSSL_get_ciphers(char* buf, int len) { const char* const* ciphers = GetCipherNames(); @@ -3601,6 +3616,26 @@ int wolfSSL_CTX_use_PrivateKey_file(WOLFSSL_CTX* ctx, const char* file,int forma } +/* get cert chaining depth using ssl struct */ +long wolfSSL_get_verify_depth(WOLFSSL* ssl) +{ + if(ssl == NULL) { + return BAD_FUNC_ARG; + } + return MAX_CHAIN_DEPTH; +} + + +/* get cert chaining depth using ctx struct */ +long wolfSSL_CTX_get_verify_depth(WOLFSSL_CTX* ctx) +{ + if(ctx == NULL) { + return BAD_FUNC_ARG; + } + return MAX_CHAIN_DEPTH; +} + + int wolfSSL_CTX_use_certificate_chain_file(WOLFSSL_CTX* ctx, const char* file) { /* procces up to MAX_CHAIN_DEPTH plus subject cert */ @@ -8066,6 +8101,35 @@ int wolfSSL_set_compression(WOLFSSL* ssl) } + int wolfSSL_clear(WOLFSSL* ssl) + { + (void)ssl; + /* TODO: GetErrors().Remove(); */ + return SSL_SUCCESS; + } + + + long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* ses, long t) + { + word32 time; + if (!ses || t < 0) + return BAD_FUNC_ARG; + + /* for cross library compatibility accept a long but convert it to a + word32 (unsigned 32 bit) for wolfSSL sessions */ + if ( (t >> 32) > 0) { + WOLFSSL_MSG("Session time is to large"); + return BAD_FUNC_ARG; + } else { + time = t & 0xFFFFFFFF; + } + + ses->timeout = time; + + return SSL_SUCCESS; + } + + long wolfSSL_CTX_set_mode(WOLFSSL_CTX* ctx, long mode) { /* SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER is wolfSSL default mode */ @@ -8078,6 +8142,14 @@ int wolfSSL_set_compression(WOLFSSL* ssl) } + long wolfSSL_SSL_get_mode(WOLFSSL* ssl) + { + /* TODO: */ + (void)ssl; + return 0; + } + + long wolfSSL_CTX_get_mode(WOLFSSL_CTX* ctx) { /* TODO: */ diff --git a/wolfssl/openssl/bn.h b/wolfssl/openssl/bn.h index 88e7fc955..4d81eb1b3 100644 --- a/wolfssl/openssl/bn.h +++ b/wolfssl/openssl/bn.h @@ -13,7 +13,7 @@ typedef struct WOLFSSL_BIGNUM { int neg; /* openssh deference */ void* internal; /* our big num */ -} WOLFSSL_BIGNUM; +} WOLFSSL_BIGNUM; typedef struct WOLFSSL_BN_CTX WOLFSSL_BN_CTX; diff --git a/wolfssl/openssl/des.h b/wolfssl/openssl/des.h index a35e430eb..a62eda6f3 100644 --- a/wolfssl/openssl/des.h +++ b/wolfssl/openssl/des.h @@ -78,6 +78,22 @@ typedef WOLFSSL_DES_key_schedule DES_key_schedule; #define DES_ncbc_encrypt wolfSSL_DES_ncbc_encrypt #define DES_set_odd_parity wolfSSL_DES_set_odd_parity #define DES_ecb_encrypt wolfSSL_DES_ecb_encrypt +#define DES_ede3_cbc_encrypt(input, output, sz, ks1, ks2, ks3, ivec, enc) \ +do { \ + Des3 des; \ + byte key[24];/* EDE uses 24 size key */ \ + memcpy(key, (ks1), DES_BLOCK_SIZE); \ + memcpy(&key[DES_BLOCK_SIZE], (ks2), DES_BLOCK_SIZE); \ + memcpy(&key[DES_BLOCK_SIZE * 2], (ks3), DES_BLOCK_SIZE); \ + if (enc) { \ + wc_Des3_SetKey(&des, key, (const byte*)(ivec), DES_ENCRYPTION); \ + wc_Des3_CbcEncrypt(&des, (output), (input), (sz)); \ + } \ + else { \ + wc_Des3_SetKey(&des, key, (const byte*)(ivec), DES_ENCRYPTION); \ + wc_Des3_CbcDecrypt(&des, (output), (input), (sz)); \ + } \ +} while(0) #ifdef __cplusplus } /* extern "C" */ diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index 933dc4fb2..34d7948c3 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -41,7 +41,7 @@ #endif -typedef WOLFSSL SSL; +typedef WOLFSSL SSL; typedef WOLFSSL_SESSION SSL_SESSION; typedef WOLFSSL_METHOD SSL_METHOD; typedef WOLFSSL_CTX SSL_CTX; @@ -80,6 +80,21 @@ typedef WOLFSSL_X509_REVOKED X509_REVOKED; typedef WOLFSSL_X509_OBJECT X509_OBJECT; typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; +#define SSL_get_cipher_list(ctx,i) wolfSSL_get_cipher_list((i)) +#define SSL_get_cipher_name(ctx) wolfSSL_get_cipher((ctx)) +#define SSL_get_shared_ciphers(ctx,buf,len) \ + strncpy(buf, "Not Implemented, SSLv2 only", len) + +/* @TODO */ +#define ERR_print_errors_fp(file) + +/* at the moment only returns ok */ +#define SSL_get_verify_result(ctx) X509_V_OK +#define SSL_get_verify_mode wolfSSL_SSL_get_mode +#define SSL_get_verify_depth wolfSSL_get_verify_depth +#define SSL_CTX_get_verify_mode wolfSSL_CTX_get_mode +#define SSL_CTX_get_verify_depth wolfSSL_CTX_get_verify_depth +#define SSL_get_certificate(ctx) 0 /* used to pass to get_privatekey */ #define SSLv3_server_method wolfSSLv3_server_method #define SSLv3_client_method wolfSSLv3_client_method @@ -116,6 +131,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSL_set_fd wolfSSL_set_fd #define SSL_get_fd wolfSSL_get_fd #define SSL_connect wolfSSL_connect +#define SSL_clear wolfSSL_clear #define SSL_write wolfSSL_write #define SSL_read wolfSSL_read @@ -131,13 +147,15 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSL_set_session wolfSSL_set_session #define SSL_get_session wolfSSL_get_session #define SSL_flush_sessions wolfSSL_flush_sessions +/* assume unlimited temporarly */ +#define SSL_CTX_get_session_cache_mode(ctx) 0 #define SSL_CTX_set_verify wolfSSL_CTX_set_verify #define SSL_set_verify wolfSSL_set_verify #define SSL_pending wolfSSL_pending #define SSL_load_error_strings wolfSSL_load_error_strings #define SSL_library_init wolfSSL_library_init -#define SSL_CTX_set_session_cache_mode wolfSSL_CTX_set_session_cache_mode +#define SSL_CTX_set_session_cache_mode wolfSSL_CTX_set_session_cache_mode #define SSL_CTX_set_cipher_list wolfSSL_CTX_set_cipher_list #define SSL_set_cipher_list wolfSSL_set_cipher_list @@ -147,9 +165,9 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSL_set_ex_data wolfSSL_set_ex_data #define SSL_get_shutdown wolfSSL_get_shutdown -#define SSL_set_rfd wolfSSL_set_rfd -#define SSL_set_wfd wolfSSL_set_wfd -#define SSL_set_shutdown wolfSSL_set_shutdown +#define SSL_set_rfd wolfSSL_set_rfd +#define SSL_set_wfd wolfSSL_set_wfd +#define SSL_set_shutdown wolfSSL_set_shutdown #define SSL_set_session_id_context wolfSSL_set_session_id_context #define SSL_set_connect_state wolfSSL_set_connect_state #define SSL_set_accept_state wolfSSL_set_accept_state @@ -176,48 +194,48 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSLv2_server_method wolfSSLv2_server_method #define MD4_Init wolfSSL_MD4_Init -#define MD4_Update wolfSSL_MD4_Update +#define MD4_Update wolfSSL_MD4_Update #define MD4_Final wolfSSL_MD4_Final -#define BIO_new wolfSSL_BIO_new -#define BIO_free wolfSSL_BIO_free +#define BIO_new wolfSSL_BIO_new +#define BIO_free wolfSSL_BIO_free #define BIO_free_all wolfSSL_BIO_free_all -#define BIO_read wolfSSL_BIO_read -#define BIO_write wolfSSL_BIO_write -#define BIO_push wolfSSL_BIO_push -#define BIO_pop wolfSSL_BIO_pop -#define BIO_flush wolfSSL_BIO_flush -#define BIO_pending wolfSSL_BIO_pending +#define BIO_read wolfSSL_BIO_read +#define BIO_write wolfSSL_BIO_write +#define BIO_push wolfSSL_BIO_push +#define BIO_pop wolfSSL_BIO_pop +#define BIO_flush wolfSSL_BIO_flush +#define BIO_pending wolfSSL_BIO_pending #define BIO_get_mem_data wolfSSL_BIO_get_mem_data #define BIO_new_mem_buf wolfSSL_BIO_new_mem_buf -#define BIO_f_buffer wolfSSL_BIO_f_buffer +#define BIO_f_buffer wolfSSL_BIO_f_buffer #define BIO_set_write_buffer_size wolfSSL_BIO_set_write_buffer_size -#define BIO_f_ssl wolfSSL_BIO_f_ssl -#define BIO_new_socket wolfSSL_BIO_new_socket -#define SSL_set_bio wolfSSL_set_bio -#define BIO_eof wolfSSL_BIO_eof -#define BIO_set_ss wolfSSL_BIO_set_ss +#define BIO_f_ssl wolfSSL_BIO_f_ssl +#define BIO_new_socket wolfSSL_BIO_new_socket +#define SSL_set_bio wolfSSL_set_bio +#define BIO_eof wolfSSL_BIO_eof +#define BIO_set_ss wolfSSL_BIO_set_ss -#define BIO_s_mem wolfSSL_BIO_s_mem -#define BIO_f_base64 wolfSSL_BIO_f_base64 +#define BIO_s_mem wolfSSL_BIO_s_mem +#define BIO_f_base64 wolfSSL_BIO_f_base64 #define BIO_set_flags wolfSSL_BIO_set_flags #define OpenSSL_add_all_algorithms wolfSSL_add_all_algorithms -#define SSLeay_add_ssl_algorithms wolfSSL_add_all_algorithms +#define SSLeay_add_ssl_algorithms wolfSSL_add_all_algorithms #define SSLeay_add_all_algorithms wolfSSL_add_all_algorithms -#define RAND_screen wolfSSL_RAND_screen -#define RAND_file_name wolfSSL_RAND_file_name +#define RAND_screen wolfSSL_RAND_screen +#define RAND_file_name wolfSSL_RAND_file_name #define RAND_write_file wolfSSL_RAND_write_file -#define RAND_load_file wolfSSL_RAND_load_file -#define RAND_egd wolfSSL_RAND_egd -#define RAND_seed wolfSSL_RAND_seed -#define RAND_add wolfSSL_RAND_add +#define RAND_load_file wolfSSL_RAND_load_file +#define RAND_egd wolfSSL_RAND_egd +#define RAND_seed wolfSSL_RAND_seed +#define RAND_add wolfSSL_RAND_add -#define COMP_zlib wolfSSL_COMP_zlib -#define COMP_rle wolfSSL_COMP_rle +#define COMP_zlib wolfSSL_COMP_zlib +#define COMP_rle wolfSSL_COMP_rle #define SSL_COMP_add_compression_method wolfSSL_COMP_add_compression_method #define SSL_get_ex_new_index wolfSSL_get_ex_new_index @@ -233,9 +251,9 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define X509_STORE_CTX_get_error wolfSSL_X509_STORE_CTX_get_error #define X509_STORE_CTX_get_error_depth wolfSSL_X509_STORE_CTX_get_error_depth -#define X509_NAME_oneline wolfSSL_X509_NAME_oneline -#define X509_get_issuer_name wolfSSL_X509_get_issuer_name -#define X509_get_subject_name wolfSSL_X509_get_subject_name +#define X509_NAME_oneline wolfSSL_X509_NAME_oneline +#define X509_get_issuer_name wolfSSL_X509_get_issuer_name +#define X509_get_subject_name wolfSSL_X509_get_subject_name #define X509_verify_cert_error_string wolfSSL_X509_verify_cert_error_string #define X509_LOOKUP_add_dir wolfSSL_X509_LOOKUP_add_dir @@ -252,15 +270,18 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define X509_CRL_get_lastUpdate wolfSSL_X509_CRL_get_lastUpdate #define X509_CRL_get_nextUpdate wolfSSL_X509_CRL_get_nextUpdate -#define X509_get_pubkey wolfSSL_X509_get_pubkey -#define X509_CRL_verify wolfSSL_X509_CRL_verify -#define X509_STORE_CTX_set_error wolfSSL_X509_STORE_CTX_set_error +#define X509_get_pubkey wolfSSL_X509_get_pubkey +#define X509_CRL_verify wolfSSL_X509_CRL_verify +#define X509_STORE_CTX_set_error wolfSSL_X509_STORE_CTX_set_error #define X509_OBJECT_free_contents wolfSSL_X509_OBJECT_free_contents -#define EVP_PKEY_free wolfSSL_EVP_PKEY_free -#define X509_cmp_current_time wolfSSL_X509_cmp_current_time -#define sk_X509_REVOKED_num wolfSSL_sk_X509_REVOKED_num -#define X509_CRL_get_REVOKED wolfSSL_X509_CRL_get_REVOKED -#define sk_X509_REVOKED_value wolfSSL_sk_X509_REVOKED_value +#define EVP_PKEY_free wolfSSL_EVP_PKEY_free +#define X509_cmp_current_time wolfSSL_X509_cmp_current_time +#define sk_X509_REVOKED_num wolfSSL_sk_X509_REVOKED_num +#define X509_CRL_get_REVOKED wolfSSL_X509_CRL_get_REVOKED +#define sk_X509_REVOKED_value wolfSSL_sk_X509_REVOKED_value +#define X509_get_notBefore(cert) (ASN1_TIME*)wolfSSL_X509_notBefore((cert)) +#define X509_get_notAfter(cert) (ASN1_TIME*)wolfSSL_X509_notAfter((cert)) + #define X509_get_serialNumber wolfSSL_X509_get_serialNumber @@ -271,8 +292,8 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define SSL_load_client_CA_file wolfSSL_load_client_CA_file -#define SSL_CTX_set_client_CA_list wolfSSL_CTX_set_client_CA_list -#define X509_STORE_CTX_get_ex_data wolfSSL_X509_STORE_CTX_get_ex_data +#define SSL_CTX_set_client_CA_list wolfSSL_CTX_set_client_CA_list +#define X509_STORE_CTX_get_ex_data wolfSSL_X509_STORE_CTX_get_ex_data #define SSL_get_ex_data_X509_STORE_CTX_idx wolfSSL_get_ex_data_X509_STORE_CTX_idx #define SSL_get_ex_data wolfSSL_get_ex_data @@ -368,10 +389,13 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define i2d_SSL_SESSION wolfSSL_i2d_SSL_SESSION #define d2i_SSL_SESSION wolfSSL_d2i_SSL_SESSION +#define SSL_SESSION_set_timeout wolfSSL_SSL_SESSION_set_timeout #define SSL_SESSION_get_timeout wolfSSL_SESSION_get_timeout #define SSL_SESSION_get_time wolfSSL_SESSION_get_time #define SSL_CTX_get_ex_new_index wolfSSL_CTX_get_ex_new_index +/* yassl had set the default to be 500 */ +#define SSL_get_default_timeout(ctx) 500 #ifdef __cplusplus diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 721d33272..9c1c67dc2 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -38,7 +38,7 @@ #endif #endif -#ifdef YASSL_PREFIX +#ifdef WOLFSSL_PREFIX #include "prefix_ssl.h" #endif @@ -169,7 +169,12 @@ enum AlertDescription { certificate_unknown = 46, illegal_parameter = 47, decrypt_error = 51, + #ifdef WOLFSSL_MYSQL_COMPATIBLE + /* catch name conflict for enum protocol with MYSQL build */ + wc_protocol_version = 70, + #else protocol_version = 70, + #endif no_renegotiation = 100, unrecognized_name = 112 }; @@ -211,6 +216,8 @@ WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_file(WOLFSSL_CTX *, const char *file); WOLFSSL_API int wolfSSL_CTX_use_RSAPrivateKey_file(WOLFSSL_CTX*, const char*, int); +WOLFSSL_API long wolfSSL_get_verify_depth(WOLFSSL* ssl); +WOLFSSL_API long wolfSSL_CTX_get_verify_depth(WOLFSSL_CTX* ctx); WOLFSSL_API int wolfSSL_use_certificate_file(WOLFSSL*, const char*, int); WOLFSSL_API int wolfSSL_use_PrivateKey_file(WOLFSSL*, const char*, int); WOLFSSL_API int wolfSSL_use_certificate_chain_file(WOLFSSL*, const char *file); @@ -236,6 +243,7 @@ WOLFSSL_API int wolfSSL_use_RSAPrivateKey_file(WOLFSSL*, const char*, int); WOLFSSL_API WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD*); WOLFSSL_API WOLFSSL* wolfSSL_new(WOLFSSL_CTX*); WOLFSSL_API int wolfSSL_set_fd (WOLFSSL*, int); +WOLFSSL_API char* wolfSSL_get_cipher_list(int priority); WOLFSSL_API int wolfSSL_get_ciphers(char*, int); WOLFSSL_API int wolfSSL_get_fd(const WOLFSSL*); WOLFSSL_API void wolfSSL_set_using_nonblock(WOLFSSL*, int); @@ -259,6 +267,7 @@ WOLFSSL_API int wolfSSL_get_error(WOLFSSL*, int); WOLFSSL_API int wolfSSL_get_alert_history(WOLFSSL*, WOLFSSL_ALERT_HISTORY *); WOLFSSL_API int wolfSSL_set_session(WOLFSSL* ssl,WOLFSSL_SESSION* session); +WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* session, long time); WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl); WOLFSSL_API void wolfSSL_flush_sessions(WOLFSSL_CTX *ctx, long tm); WOLFSSL_API int wolfSSL_SetServerID(WOLFSSL* ssl, const unsigned char*, @@ -747,11 +756,13 @@ WOLFSSL_API long wolfSSL_CTX_set_options(WOLFSSL_CTX*, long); WOLFSSL_API void wolfSSL_ERR_free_strings(void); WOLFSSL_API void wolfSSL_ERR_remove_state(unsigned long); WOLFSSL_API void wolfSSL_EVP_cleanup(void); +WOLFSSL_API int wolfSSL_clear(WOLFSSL* ssl); WOLFSSL_API void wolfSSL_cleanup_all_ex_data(void); WOLFSSL_API long wolfSSL_CTX_set_mode(WOLFSSL_CTX* ctx, long mode); WOLFSSL_API long wolfSSL_CTX_get_mode(WOLFSSL_CTX* ctx); WOLFSSL_API void wolfSSL_CTX_set_default_read_ahead(WOLFSSL_CTX* ctx, int m); +WOLFSSL_API long wolfSSL_SSL_get_mode(WOLFSSL* ssl); WOLFSSL_API long wolfSSL_CTX_sess_set_cache_size(WOLFSSL_CTX*, long);