From aefb5dcecb47c07b16f5a09cd285876da7d085fc Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 11 Oct 2009 08:52:30 +0000 Subject: [PATCH] 2009-10-11 10:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbssl/sslsess.c * contrib/hbssl/ssl.c * contrib/hbssl/hbssl.h * contrib/hbssl/sslctx.c + Added partial support for OpenSSL 1.0.0beta3. Partial because I'm getting a few errors which I cannot resolve, help/input is welcome from interested parties: --- cl.exe -nologo -I. -I../../../../../include -Gs -TP -W4 -wd4127 -Ot2b1 -EHs-c- -MT -IC:\devl\openssl-1.0.0-beta3\include -DOPENSSL_OPT_WINDLL -DUNICODE -Fossl.obj -c ../../../ssl.c ssl.c ../../../ssl.c(1366) : error C2440: '' : cannot convert from 'LPCSTR' to 'HB_FUN_SSL_GET_CLIENT_CA_LIST::stack_st_' Source or target has incomplete type ../../../ssl.c(1366) : error C2059: syntax error : ')' ../../../ssl.c(1374) : error C2059: syntax error : ')' ../../../ssl.c(1391) : error C2440: '' : cannot convert from 'LPCSTR' to 'HB_FUN_SSL_LOAD_CLIENT_CA_FILE::stack_st_' Source or target has incomplete type ../../../ssl.c(1391) : error C2059: syntax error : ')' ../../../ssl.c(1399) : error C2059: syntax error : ')' --- The same in sslctx, plus another weird one regarding X509_NAME. * INSTALL * Updated e-mail size limit on dev list. --- harbour/ChangeLog | 25 +++++++++++++++++++++++++ harbour/INSTALL | 2 +- harbour/contrib/hbssl/hbssl.h | 2 +- harbour/contrib/hbssl/ssl.c | 10 +++++++++- harbour/contrib/hbssl/sslctx.c | 12 ++++++++++-- harbour/contrib/hbssl/sslsess.c | 8 ++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 44e0dd954a..d4e62d3bca 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,31 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-11 10:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbssl/sslsess.c + * contrib/hbssl/ssl.c + * contrib/hbssl/hbssl.h + * contrib/hbssl/sslctx.c + + Added partial support for OpenSSL 1.0.0beta3. + Partial because I'm getting a few errors which I cannot resolve, + help/input is welcome from interested parties: + --- + cl.exe -nologo -I. -I../../../../../include -Gs -TP -W4 -wd4127 -Ot2b1 -EHs-c- -MT -IC:\devl\openssl-1.0.0-beta3\include -DOPENSSL_OPT_WINDLL -DUNICODE -Fossl.obj -c ../../../ssl.c + ssl.c + ../../../ssl.c(1366) : error C2440: '' : cannot convert from 'LPCSTR' to 'HB_FUN_SSL_GET_CLIENT_CA_LIST::stack_st_' + Source or target has incomplete type + ../../../ssl.c(1366) : error C2059: syntax error : ')' + ../../../ssl.c(1374) : error C2059: syntax error : ')' + ../../../ssl.c(1391) : error C2440: '' : cannot convert from 'LPCSTR' to 'HB_FUN_SSL_LOAD_CLIENT_CA_FILE::stack_st_' + Source or target has incomplete type + ../../../ssl.c(1391) : error C2059: syntax error : ')' + ../../../ssl.c(1399) : error C2059: syntax error : ')' + --- + The same in sslctx, plus another weird one regarding X509_NAME. + + * INSTALL + * Updated e-mail size limit on dev list. + 2009-10-10 11:02 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/qth/QPen.qth * contrib/hbqt/qth/QPrintPreviewDialog.qth diff --git a/harbour/INSTALL b/harbour/INSTALL index 722418ff4e..ecdbe41507 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -1308,7 +1308,7 @@ HARBOUR Patches are accepted in 'svn diff' or 'diff -u' format. Always .zip your patch/source files before attaching them. The size limit for e-mails sent to the development list is - 40KB. If you need more, upload it to a site where we can + 70KB. If you need more, upload it to a site where we can access it, or use the sf.net page to submit it. - Given a good history of valuable contributions, you can get write access to the source repository. diff --git a/harbour/contrib/hbssl/hbssl.h b/harbour/contrib/hbssl/hbssl.h index d570bdd033..f29d6f6532 100644 --- a/harbour/contrib/hbssl/hbssl.h +++ b/harbour/contrib/hbssl/hbssl.h @@ -59,7 +59,7 @@ HB_EXTERN_BEGIN -extern SSL_METHOD * hb_ssl_method_id_to_ptr( int n ); +extern const SSL_METHOD * hb_ssl_method_id_to_ptr( int n ); extern void * hb_BIO_is( int iParam ); extern BIO * hb_BIO_par( int iParam ); diff --git a/harbour/contrib/hbssl/ssl.c b/harbour/contrib/hbssl/ssl.c index 6d433c43eb..ba13a15adc 100644 --- a/harbour/contrib/hbssl/ssl.c +++ b/harbour/contrib/hbssl/ssl.c @@ -560,7 +560,11 @@ HB_FUNC( SSL_SET_SSL_METHOD ) SSL * ssl = hb_SSL_par( 1 ); if( ssl ) +#if OPENSSL_VERSION_NUMBER < 0x10000000L + hb_retni( SSL_set_ssl_method( ssl, ( SSL_METHOD * ) hb_ssl_method_id_to_ptr( hb_parni( 2 ) ) ) ); +#else hb_retni( SSL_set_ssl_method( ssl, hb_ssl_method_id_to_ptr( hb_parni( 2 ) ) ) ); +#endif } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -574,7 +578,11 @@ HB_FUNC( SSL_GET_SSL_METHOD ) if( ssl ) { +#if OPENSSL_VERSION_NUMBER < 0x10000000L SSL_METHOD * p = SSL_get_ssl_method( ssl ); +#else + const SSL_METHOD * p = SSL_get_ssl_method( ssl ); +#endif int n; if( p == SSLv2_method() ) n = HB_SSL_CTX_NEW_METHOD_SSLV2; @@ -605,7 +613,7 @@ HB_FUNC( SSL_GET_CURRENT_CIPHER ) SSL * ssl = hb_SSL_par( 1 ); if( ssl ) - hb_retptr( SSL_get_current_cipher( ssl ) ); + hb_retptr( ( void * ) SSL_get_current_cipher( ssl ) ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/contrib/hbssl/sslctx.c b/harbour/contrib/hbssl/sslctx.c index e581f40584..676050809b 100644 --- a/harbour/contrib/hbssl/sslctx.c +++ b/harbour/contrib/hbssl/sslctx.c @@ -83,9 +83,9 @@ SSL_CTX * hb_SSL_CTX_par( int iParam ) return ph ? ( SSL_CTX * ) * ph : NULL; } -SSL_METHOD * hb_ssl_method_id_to_ptr( int n ) +const SSL_METHOD * hb_ssl_method_id_to_ptr( int n ) { - SSL_METHOD * p; + const SSL_METHOD * p; switch( n ) { @@ -111,7 +111,11 @@ HB_FUNC( SSL_CTX_NEW ) { void ** ph = ( void ** ) hb_gcAlloc( sizeof( SSL_CTX * ), SSL_CTX_release ); +#if OPENSSL_VERSION_NUMBER < 0x10000000L + SSL_CTX * ctx = SSL_CTX_new( ( SSL_METHOD * ) hb_ssl_method_id_to_ptr( HB_ISNUM( 1 ) ? hb_parni( 1 ) : HB_SSL_CTX_NEW_METHOD_DEFAULT ) ); +#else SSL_CTX * ctx = SSL_CTX_new( hb_ssl_method_id_to_ptr( HB_ISNUM( 1 ) ? hb_parni( 1 ) : HB_SSL_CTX_NEW_METHOD_DEFAULT ) ); +#endif * ph = ( void * ) ctx; @@ -125,7 +129,11 @@ HB_FUNC( SSL_CTX_SET_SSL_VERSION ) SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); if( ctx ) +#if OPENSSL_VERSION_NUMBER < 0x10000000L + hb_retni( SSL_CTX_set_ssl_version( ctx, ( SSL_METHOD * ) hb_ssl_method_id_to_ptr( hb_parni( 2 ) ) ) ); +#else hb_retni( SSL_CTX_set_ssl_version( ctx, hb_ssl_method_id_to_ptr( hb_parni( 2 ) ) ) ); +#endif } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/contrib/hbssl/sslsess.c b/harbour/contrib/hbssl/sslsess.c index e4040fe9bd..f86b5106cb 100644 --- a/harbour/contrib/hbssl/sslsess.c +++ b/harbour/contrib/hbssl/sslsess.c @@ -93,6 +93,8 @@ HB_FUNC( SSL_SESSION_NEW ) hb_retptrGC( ph ); } +#if OPENSSL_VERSION_NUMBER < 0x10000000L + HB_FUNC( SSL_SESSION_CMP ) { if( hb_SSL_SESSION_is( 1 ) && hb_SSL_SESSION_is( 2 ) ) @@ -107,6 +109,8 @@ HB_FUNC( SSL_SESSION_CMP ) hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +#endif + HB_FUNC( SSL_SESSION_SET_TIME ) { if( hb_SSL_SESSION_is( 1 ) ) @@ -159,6 +163,8 @@ HB_FUNC( SSL_SESSION_GET_TIMEOUT ) hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +#if OPENSSL_VERSION_NUMBER < 0x10000000L + HB_FUNC( SSL_SESSION_HASH ) { if( hb_SSL_SESSION_is( 1 ) ) @@ -172,6 +178,8 @@ HB_FUNC( SSL_SESSION_HASH ) hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +#endif + /* char *SSL_SESSION_get_app_data(SSL_SESSION *s); char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx);