Perl code patch contributed by "Kurt J. Pires" <kjpires@iat.com>
His own words are: The patch adds no new functionality (other than a simple test package) to the libraries, but it allows them to be compiled with Perl5.6.0. It has only been tested under "Red Hat Linux release 7.0 (Guinness)" with the unpatched verion of OpenSSL 0.9.6 released last September.
This commit is contained in:
parent
87b79c3ef3
commit
95ffe86dbc
@ -72,11 +72,38 @@ BOOT:
|
||||
boot_digest();
|
||||
boot_err();
|
||||
boot_ssl();
|
||||
boot_OpenSSL__BN();
|
||||
boot_OpenSSL__BIO();
|
||||
boot_OpenSSL__Cipher();
|
||||
boot_OpenSSL__MD();
|
||||
boot_OpenSSL__ERR();
|
||||
boot_OpenSSL__SSL();
|
||||
boot_OpenSSL__X509();
|
||||
|
||||
/* */
|
||||
/* The next macro is the completely correct way to call a C */
|
||||
/* function that uses perl calling conventions but is not */
|
||||
/* registered with perl. */
|
||||
/* */
|
||||
/* The second macro seems to work for this context. (We just */
|
||||
/* need a mark for the called function since we don't have */
|
||||
/* any local variables and what-not.) */
|
||||
/* */
|
||||
/* Unfortunately, we need to do this because these boot_* */
|
||||
/* functions are auto-generated by xsubpp and are normally */
|
||||
/* called from DyncLoader, but we're pulling them in here. */
|
||||
/* */
|
||||
#define FULL_callBootFunc(func) { \
|
||||
dSP; \
|
||||
ENTER; \
|
||||
SAVETMPS; \
|
||||
PUSHMARK(SP); \
|
||||
func(); \
|
||||
FREETMPS; \
|
||||
LEAVE; \
|
||||
}
|
||||
#define callBootFunc(func) { \
|
||||
PUSHMARK(SP); \
|
||||
func(); \
|
||||
}
|
||||
callBootFunc(boot_OpenSSL__BN);
|
||||
callBootFunc(boot_OpenSSL__BIO);
|
||||
callBootFunc(boot_OpenSSL__Cipher);
|
||||
callBootFunc(boot_OpenSSL__MD);
|
||||
callBootFunc(boot_OpenSSL__ERR);
|
||||
callBootFunc(boot_OpenSSL__SSL);
|
||||
callBootFunc(boot_OpenSSL__X509);
|
||||
|
||||
|
@ -32,7 +32,7 @@ p5_bio_callback(bio,state,parg,cmd,larg,ret)
|
||||
if ((state == BIO_CB_READ) || (state == BIO_CB_WRITE))
|
||||
XPUSHs(sv_2mortal(newSVpv(parg,larg)));
|
||||
else
|
||||
XPUSHs(&sv_undef);
|
||||
XPUSHs(&PL_sv_undef);
|
||||
/* ptr one */
|
||||
XPUSHs(sv_2mortal(newSViv(larg)));
|
||||
XPUSHs(sv_2mortal(newSViv(ret)));
|
||||
@ -129,9 +129,9 @@ p5_BIO_new(...)
|
||||
PPCODE:
|
||||
pr_name("p5_BIO_new");
|
||||
if ((items == 1) && SvPOK(ST(0)))
|
||||
type = SvPV(ST(0),na);
|
||||
type = SvPV_nolen(ST(0));
|
||||
else if ((items == 2) && SvPOK(ST(1)))
|
||||
type = SvPV(ST(1),na);
|
||||
type = SvPV_nolen(ST(1));
|
||||
else
|
||||
croak("Usage: OpenSSL::BIO::new(type)");
|
||||
EXTEND(sp,1);
|
||||
@ -314,7 +314,7 @@ p5_BIO_getline(bio)
|
||||
PUSHs(sv_newmortal());
|
||||
sv_setpvn(ST(0), "", 0);
|
||||
SvGROW(ST(0), 1024);
|
||||
p=SvPV(ST(0), na);
|
||||
p=SvPV_nolen(ST(0));
|
||||
i = BIO_gets(bio, p, 1024);
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
@ -370,7 +370,7 @@ p5_BIO_puts(bio, in)
|
||||
PREINIT:
|
||||
char *ptr;
|
||||
CODE:
|
||||
ptr = SvPV(in,na);
|
||||
ptr = SvPV_nolen(in);
|
||||
RETVAL = BIO_puts(bio, ptr);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -142,7 +142,7 @@ p5_BN_bn2bin(a)
|
||||
i=BN_num_bytes(a)+2;
|
||||
sv_setpvn(ST(0),"",1);
|
||||
SvGROW(ST(0),i+1);
|
||||
SvCUR_set(ST(0),BN_bn2bin(a,SvPV(ST(0),na)));
|
||||
SvCUR_set(ST(0),BN_bn2bin(a,SvPV_nolen(ST(0))));
|
||||
|
||||
void
|
||||
p5_BN_mpi2bn(a)
|
||||
@ -168,7 +168,7 @@ p5_BN_bn2mpi(a)
|
||||
i=BN_bn2mpi(a,NULL);
|
||||
sv_setpvn(ST(0),"",1);
|
||||
SvGROW(ST(0),i+1);
|
||||
SvCUR_set(ST(0),BN_bn2mpi(a,SvPV(ST(0),na)));
|
||||
SvCUR_set(ST(0),BN_bn2mpi(a,SvPV_nolen(ST(0))));
|
||||
|
||||
void
|
||||
p5_BN_hex2bn(a)
|
||||
@ -208,9 +208,9 @@ p5_BN_bn2hex(a)
|
||||
RETVAL=newSVpv("",0);
|
||||
i=strlen(ptr);
|
||||
SvGROW(RETVAL,i+1);
|
||||
memcpy(SvPV(RETVAL,na),ptr,i+1);
|
||||
memcpy(SvPV_nolen(RETVAL),ptr,i+1);
|
||||
SvCUR_set(RETVAL,i);
|
||||
Free(ptr);
|
||||
OPENSSL_free(ptr);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
@ -226,9 +226,9 @@ p5_BN_bn2dec(a)
|
||||
RETVAL=newSVpv("",0);
|
||||
i=strlen(ptr);
|
||||
SvGROW(RETVAL,i+1);
|
||||
memcpy(SvPV(RETVAL,na),ptr,i+1);
|
||||
memcpy(SvPV_nolen(RETVAL),ptr,i+1);
|
||||
SvCUR_set(RETVAL,i);
|
||||
Free(ptr);
|
||||
OPENSSL_free(ptr);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
@ -20,9 +20,9 @@ p5_EVP_C_new(...)
|
||||
char *name;
|
||||
PPCODE:
|
||||
if ((items == 1) && SvPOK(ST(0)))
|
||||
name=SvPV(ST(0),na);
|
||||
name=SvPV_nolen(ST(0));
|
||||
else if ((items == 2) && SvPOK(ST(1)))
|
||||
name=SvPV(ST(1),na);
|
||||
name=SvPV_nolen(ST(1));
|
||||
else
|
||||
croak("Usage: OpenSSL::Cipher::new(type)");
|
||||
PUSHs(sv_newmortal());
|
||||
@ -112,7 +112,7 @@ p5_EVP_C_cipher(ctx,in)
|
||||
CODE:
|
||||
RETVAL=newSVpv("",0);
|
||||
SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1);
|
||||
EVP_Cipher(ctx,SvPV(RETVAL,na),in.dptr,in.dsize);
|
||||
EVP_Cipher(ctx,SvPV_nolen(RETVAL),in.dptr,in.dsize);
|
||||
SvCUR_set(RETVAL,in.dsize);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
@ -126,7 +126,7 @@ p5_EVP_C_update(ctx, in)
|
||||
CODE:
|
||||
RETVAL=newSVpv("",0);
|
||||
SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1);
|
||||
EVP_CipherUpdate(ctx,SvPV(RETVAL,na),&i,in.dptr,in.dsize);
|
||||
EVP_CipherUpdate(ctx,SvPV_nolen(RETVAL),&i,in.dptr,in.dsize);
|
||||
SvCUR_set(RETVAL,i);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
@ -139,7 +139,7 @@ p5_EVP_C_final(ctx)
|
||||
CODE:
|
||||
RETVAL=newSVpv("",0);
|
||||
SvGROW(RETVAL,EVP_CIPHER_CTX_block_size(ctx)+1);
|
||||
if (!EVP_CipherFinal(ctx,SvPV(RETVAL,na),&i))
|
||||
if (!EVP_CipherFinal(ctx,SvPV_nolen(RETVAL),&i))
|
||||
sv_setpv(RETVAL,"BAD DECODE");
|
||||
else
|
||||
SvCUR_set(RETVAL,i);
|
||||
|
@ -27,9 +27,9 @@ p5_EVP_MD_new(...)
|
||||
char *name;
|
||||
PPCODE:
|
||||
if ((items == 1) && SvPOK(ST(0)))
|
||||
name=SvPV(ST(0),na);
|
||||
name=SvPV_nolen(ST(0));
|
||||
else if ((items == 2) && SvPOK(ST(1)))
|
||||
name=SvPV(ST(1),na);
|
||||
name=SvPV_nolen(ST(1));
|
||||
else
|
||||
croak("Usage: OpenSSL::MD::new(type)");
|
||||
PUSHs(sv_newmortal());
|
||||
@ -45,8 +45,9 @@ datum
|
||||
p5_EVP_MD_name(ctx)
|
||||
EVP_MD_CTX *ctx
|
||||
CODE:
|
||||
RETVAL.dptr=OBJ_nid2ln(EVP_MD_type(EVP_MD_CTX_type(ctx)));
|
||||
RETVAL.dptr=OBJ_nid2ln(EVP_MD_CTX_type(ctx));
|
||||
RETVAL.dsize=strlen(RETVAL.dptr);
|
||||
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
@ -72,9 +72,9 @@ p5_SSL_CTX_new(...)
|
||||
PPCODE:
|
||||
pr_name("p5_SSL_CTX_new");
|
||||
if ((items == 1) && SvPOK(ST(0)))
|
||||
method=SvPV(ST(0),na);
|
||||
method=SvPV_nolen(ST(0));
|
||||
else if ((items == 2) && SvPOK(ST(1)))
|
||||
method=SvPV(ST(1),na);
|
||||
method=SvPV_nolen(ST(1));
|
||||
else
|
||||
croak("Usage: OpenSSL::SSL::CTX::new(type)");
|
||||
|
||||
@ -124,7 +124,7 @@ p5_SSL_CTX_use_PrivateKey_file(ctx,file,...)
|
||||
croak("OpenSSL::SSL::CTX::use_PrivateKey_file(ssl_ctx,file[,type])");
|
||||
if (items == 3)
|
||||
{
|
||||
ptr=SvPV(ST(2),na);
|
||||
ptr=SvPV_nolen(ST(2));
|
||||
if (strcmp(ptr,"der") == 0)
|
||||
i=SSL_FILETYPE_ASN1;
|
||||
else
|
||||
@ -148,7 +148,7 @@ p5_SSL_CTX_set_options(ctx,...)
|
||||
{
|
||||
if (!SvPOK(ST(i)))
|
||||
croak("Usage: OpenSSL::SSL_CTX::set_options(ssl_ctx[,option,value]+)");
|
||||
ptr=SvPV(ST(i),na);
|
||||
ptr=SvPV_nolen(ST(i));
|
||||
if (strcmp(ptr,"-info_callback") == 0)
|
||||
{
|
||||
SSL_CTX_set_info_callback(ctx,
|
||||
@ -325,7 +325,7 @@ p5_SSL_set_options(ssl,...)
|
||||
{
|
||||
if (!SvPOK(ST(i)))
|
||||
croak("Usage: OpenSSL::SSL::set_options(ssl[,option,value]+)");
|
||||
ptr=SvPV(ST(i),na);
|
||||
ptr=SvPV_nolen(ST(i));
|
||||
if (strcmp(ptr,"-info_callback") == 0)
|
||||
{
|
||||
SSL_set_info_callback(ssl,
|
||||
@ -477,7 +477,7 @@ p5_BIO_get_ssl(bio)
|
||||
ret=sv_mortalcopy(ret);
|
||||
}
|
||||
else
|
||||
ret= &sv_undef;
|
||||
ret= &PL_sv_undef;
|
||||
EXTEND(sp,1);
|
||||
PUSHs(ret);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user