2009-01-26 17:10 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

* common.mak
   * include/hbextern.ch
   * source/rtl/Makefile
   + source/rtl/strxor.c
     + Added HB_STRXOR() (work of Mindaugas Kavaliauskas)

   * common.mak
   * source/common/Makefile
   + source/common/hbprintf.c
     + Added hb_snprintf_c() (temp name, untested) (work of Przemyslaw Czerpak)
       [ I've added a normal Harbour license, as per your permission
       on the list. Pls give me feedback is this is wrong. ]

   * source/rdd/usrrdd/example/exlog.prg
     ! Fixed missing #includes.

   * source/rdd/usrrdd/example/hbmk_b32.bat
   + source/rdd/usrrdd/example/hbmk_vc.bat
     + Added MSVC make file.
     ! Added EOL to the last line to hbmk_b32.bat.
     ! xhb.lib dependency removed. It was not needed anyway.
     ; TOFIX: When compiling exhsx.prg, this happens:
              exhsx.obj : error LNK2001: unresolved external symbol _HB_FUN_HSXRDD

   * contrib/hbssl/sslsess.c
   * contrib/hbssl/sslctx.c
   * contrib/hbssl/sslciph.c
     * Minor changes.
This commit is contained in:
Viktor Szakats
2009-01-26 16:13:57 +00:00
parent d0405e1e14
commit cffcac1c84
13 changed files with 1249 additions and 27 deletions

View File

@@ -8,6 +8,36 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-26 17:10 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* common.mak
* include/hbextern.ch
* source/rtl/Makefile
+ source/rtl/strxor.c
+ Added HB_STRXOR() (work of Mindaugas Kavaliauskas)
* common.mak
* source/common/Makefile
+ source/common/hbprintf.c
+ Added hb_snprintf_c() (temp name, untested) (work of Przemyslaw Czerpak)
[ I've added a normal Harbour license, as per your permission
on the list. Pls give me feedback is this is wrong. ]
* source/rdd/usrrdd/example/exlog.prg
! Fixed missing #includes.
* source/rdd/usrrdd/example/hbmk_b32.bat
+ source/rdd/usrrdd/example/hbmk_vc.bat
+ Added MSVC make file.
! Added EOL to the last line to hbmk_b32.bat.
! xhb.lib dependency removed. It was not needed anyway.
; TOFIX: When compiling exhsx.prg, this happens:
exhsx.obj : error LNK2001: unresolved external symbol _HB_FUN_HSXRDD
* contrib/hbssl/sslsess.c
* contrib/hbssl/sslctx.c
* contrib/hbssl/sslciph.c
* Minor changes.
2009-01-26 16:53 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/config/darwin/gcc.cf
! changed CCACHE to HB_CCACHE

View File

@@ -372,6 +372,7 @@ COMMON_LIB_OBJS = \
$(OBJ_DIR)\hbgete$(OBJEXT) \
$(OBJ_DIR)\hbhash$(OBJEXT) \
$(OBJ_DIR)\hbmem$(OBJEXT) \
$(OBJ_DIR)\hbprintf$(OBJEXT) \
$(OBJ_DIR)\hbstr$(OBJEXT) \
$(OBJ_DIR)\hbtrace$(OBJEXT) \
$(OBJ_DIR)\hbver$(OBJEXT) \
@@ -621,6 +622,7 @@ RTL_LIB_OBJS = \
$(OBJ_DIR)\strpeek$(OBJEXT) \
$(OBJ_DIR)\strtoexp$(OBJEXT) \
$(OBJ_DIR)\strtran$(OBJEXT) \
$(OBJ_DIR)\strxor$(OBJEXT) \
$(OBJ_DIR)\strzero$(OBJEXT) \
$(OBJ_DIR)\stuff$(OBJEXT) \
$(OBJ_DIR)\substr$(OBJEXT) \

View File

@@ -75,10 +75,7 @@ HB_FUNC( SSL_CIPHER_GET_BITS )
{
int alg_bits = 0;
if( hb_parptr( 1 ) )
hb_retni( SSL_CIPHER_get_bits( ( SSL_CIPHER * ) hb_parptr( 1 ), &alg_bits ) );
else
hb_retni( 0 );
hb_retni( hb_parptr( 1 ) ? SSL_CIPHER_get_bits( ( SSL_CIPHER * ) hb_parptr( 1 ), &alg_bits ) : 0 );
hb_storni( alg_bits, 2 );
}

View File

@@ -575,9 +575,23 @@ X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x);
long SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x509);
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs);
void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg);
int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg);
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, char *str);
int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, unsigned char *d, long len);
int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len);
int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d);
int SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg);
X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *ctx);
STACK *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx);
int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
@@ -590,14 +604,10 @@ void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess));
void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess));
LHASH *SSL_CTX_sessions(SSL_CTX *ctx);
void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg);
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs);
void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(), char *arg)
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, char *str);
void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK *list);
void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, int (*cb);(void))
int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg);
void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret));
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
@@ -606,23 +616,11 @@ long SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(void));
long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa);
SSL_CTX_set_tmp_rsa_callback
long <STRONG>SSL_CTX_set_tmp_rsa_callback</STRONG>(SSL_CTX *<STRONG>ctx</STRONG>, RSA *(*<STRONG>cb</STRONG>)(SSL *<STRONG>ssl</STRONG>, int <STRONG>export</STRONG>, int <STRONG>keylength</STRONG>));
Sets the callback which will be called when a temporary private key is required. The export flag will be set if the reason for needing a temp key is that an export ciphersuite is in use, in which case, keylength will contain the required keylength in bits. Generate a key of appropriate size (using ???) and return it.
SSL_set_tmp_rsa_callback
long SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength));
The same as SSL_CTX_set_tmp_rsa_callback, except it operates on an SSL session instead of a context.
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb);(void))
int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, unsigned char *d, long len);
int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len);
int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d);
int SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int type);
void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len));
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
*/

View File

@@ -175,10 +175,11 @@ HB_FUNC( SSL_SESSION_HASH )
}
/*
void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a);
char *SSL_SESSION_get_app_data(SSL_SESSION *s);
int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg);
char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx);
void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a);
int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg);
int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(void), int (*dup_func)(void), void (*free_func)(void))
int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x);
int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x);

View File

@@ -892,6 +892,7 @@ EXTERNAL HB_HEXTOSTR
EXTERNAL HB_STRTOHEX
EXTERNAL HB_STRDECODESCAPE
EXTERNAL HB_STRCDECODE
EXTERNAL HB_STRXOR
EXTERNAL HB_ISPRINTER
EXTERNAL HB_GETENV
EXTERNAL HB_USERNAME

View File

@@ -10,6 +10,7 @@ C_SOURCES=\
hbgete.c \
hbwince.c \
hbhash.c \
hbprintf.c \
hbstr.c \
hbdate.c \
hbmem.c \

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,9 @@
* $Id: exfcm.prg 9551 2008-10-05 18:13:15Z vszakats $
*/
#include "common.ch"
#include "dbinfo.ch"
#include "hbusrrdd.ch"
// Request for LOGRDD rdd driver
REQUEST LOGRDD
@@ -40,7 +42,8 @@ PROCEDURE Main()
CLOSE
// Open a table without logging
USE test DRIVER "DBFCDX"
USE test VIA "DBFCDX"
APPEND BLANK
field->name := "Francesco"

View File

@@ -9,7 +9,6 @@ if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=..\..\..\..\include
set HB_ARCHITECTURE=w32
set HB_COMPILER=bcc32
set HB_USER_LIBS=hbuddall.lib hbusrrdd.lib xhb.lib
rem set PRG_USR=-p
set HB_USER_LIBS=hbuddall.lib hbusrrdd.lib
call %HB_BIN_INSTALL%\hbmk.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
call %HB_BIN_INSTALL%\hbmk.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -0,0 +1,14 @@
@echo off
rem
rem $Id$
rem
if "%HB_BIN_INSTALL%" == "" set HB_BIN_INSTALL=..\..\..\..\bin
if "%HB_LIB_INSTALL%" == "" set HB_LIB_INSTALL=..\..\..\..\lib
if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=..\..\..\..\include
set HB_ARCHITECTURE=w32
set HB_COMPILER=msvc
set HB_USER_LIBS=hbuddall.lib hbusrrdd.lib
call %HB_BIN_INSTALL%\hbmk.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -138,6 +138,7 @@ C_SOURCES=\
strpeek.c \
strtoexp.c \
strtran.c \
strxor.c \
strzero.c \
stuff.c \
substr.c \

116
harbour/source/rtl/strxor.c Normal file
View File

@@ -0,0 +1,116 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* HB_STRXOR()
*
* Copyright 2009 Mindaugas Kavaliauskas <dbtopas at dbtopas.lt>
* www - http://www.harbour-project.org
*
* This program 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, or (at your option)
* any later version.
*
* This program 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#include "hbapierr.h"
#include "hbapiitm.h"
HB_FUNC( HB_STRXOR )
{
PHB_ITEM pItem = hb_param( 1, HB_IT_STRING );
if( pItem )
{
PHB_ITEM pItem2;
ULONG ulLen1, ulLen2, ul, ul2;
const char * pStr1;
const char * pStr2;
char * pRet;
pStr1 = hb_itemGetCPtr( pItem );
ulLen1 = hb_itemGetCLen( pItem );
if( ( pItem2 = hb_param( 2, HB_IT_STRING ) ) != NULL )
{
ulLen2 = hb_itemGetCLen( pItem2 );
if( ulLen2 )
{
pStr2 = hb_itemGetCPtr( pItem2 );
pRet = ( char * ) hb_xgrab( ulLen1 + 1 );
memcpy( pRet, pStr1, ulLen1 + 1 );
ul2 = 0;
for( ul = 0; ul < ulLen1; ul++ )
{
pRet[ ul ] ^= pStr2[ ul2 ];
if( ++ul2 == ulLen2 )
ul2 = 0;
}
hb_retclen_buffer( pRet, ulLen1 );
}
else
hb_itemReturn( pItem );
return;
}
else if( ( pItem2 = hb_param( 2, HB_IT_NUMERIC ) ) != NULL )
{
char bChar = ( char ) hb_itemGetNI( pItem2 );
if( bChar )
{
pRet = ( char * ) hb_xgrab( ulLen1 + 1 );
memcpy( pRet, pStr1, ulLen1 + 1 );
for( ul = 0; ul < ulLen1; ul++ )
pRet[ ul ] ^= bChar;
hb_retclen_buffer( pRet, ulLen1 );
}
else
hb_itemReturn( pItem );
return;
}
}
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}