require '_h2ph_pre.ph';

unless(defined(&HEADER_SSL_LOCL_H)) {
    eval 'sub HEADER_SSL_LOCL_H () {1;}' unless defined(&HEADER_SSL_LOCL_H);
    require 'stdlib.ph';
    require 'time.ph';
    require 'string.ph';
    require 'errno.ph';
    require 'openssl/e_os.ph';
    require 'ssl/buffer.ph';
    require 'ssl/comp.ph';
    require 'ssl/bio.ph';
    require 'ssl/crypto.ph';
    require 'ssl/evp.ph';
    require 'ssl/stack.ph';
    require 'ssl/x509.ph';
    require 'ssl/err.ph';
    require 'ssl/ssl.ph';
    eval 'sub PKCS1_CHECK () {1;}' unless defined(&PKCS1_CHECK);
    eval 'sub c2l {
        local($c,$l) = @_;
	    eval q(($l = ((*(++))) , $l|=(((*(++)))<< 8), $l|=(((*(++)))<<16), $l|=(((*(($c)++)))<<24)));
    }' unless defined(&c2l);
    eval 'sub c2ln {
        local($c,$l1,$l2,$n) = @_;
	    eval q({ $c+=$n; $l1=$l2=0;  &switch {  &case 8: $l2 =((*(--)))<<24;  &case 7: $l2|=((*(--)))<<16;  &case 6: $l2|=((*(--)))<< 8;  &case 5: $l2|=((*(--)));  &case 4: $l1 =((*(--)))<<24;  &case 3: $l1|=((*(--)))<<16;  &case 2: $l1|=((*(--)))<< 8;  &case 1: $l1|=((*(--($c)))); } });
    }' unless defined(&c2ln);
    eval 'sub l2c {
        local($l,$c) = @_;
	    eval q((*(++)=(&0xff), *(++)=((>> 8)&0xff), *(++)=((>>16)&0xff), *(++)=((($l)>>24)&0xff)));
    }' unless defined(&l2c);
    eval 'sub n2l {
        local($c,$l) = @_;
	    eval q(($l =((*(++)))<<24, $l|=((*(++)))<<16, $l|=((*(++)))<< 8, $l|=((*(($c)++)))));
    }' unless defined(&n2l);
    eval 'sub l2n {
        local($l,$c) = @_;
	    eval q((*(++)=((>>24)&0xff), *(++)=((>>16)&0xff), *(++)=((>> 8)&0xff), *(++)=((($l) )&0xff)));
    }' unless defined(&l2n);
    eval 'sub l2cn {
        local($l1,$l2,$c,$n) = @_;
	    eval q({ $c+=$n;  &switch {  &case 8: *(--)=((>>24)&0xff);  &case 7: *(--)=((>>16)&0xff);  &case 6: *(--)=((>> 8)&0xff);  &case 5: *(--)=(&0xff);  &case 4: *(--)=((>>24)&0xff);  &case 3: *(--)=((>>16)&0xff);  &case 2: *(--)=((>> 8)&0xff);  &case 1: *(--)=((($l1) )&0xff); } });
    }' unless defined(&l2cn);
    eval 'sub n2s {
        local($c,$s) = @_;
	    eval q((($s=((($c->[0]))<< 8)| ((($c->[1])) )),$c+=2));
    }' unless defined(&n2s);
    eval 'sub s2n {
        local($s,$c) = @_;
	    eval q((($c->[0]=((>> 8)&0xff), $c->[1]=((($s) )&0xff)),$c+=2));
    }' unless defined(&s2n);
    eval 'sub n2l3 {
        local($c,$l) = @_;
	    eval q((($l =((($c->[0]))<<16)| ((($c->[1]))<< 8)| ((($c->[2])) )),$c+=3));
    }' unless defined(&n2l3);
    eval 'sub l2n3 {
        local($l,$c) = @_;
	    eval q((($c->[0]=((>>16)&0xff), $c->[1]=((>> 8)&0xff), $c->[2]=((($l) )&0xff)),$c+=3));
    }' unless defined(&l2n3);
    eval 'sub SSL_DECRYPT () {0;}' unless defined(&SSL_DECRYPT);
    eval 'sub SSL_ENCRYPT () {1;}' unless defined(&SSL_ENCRYPT);
    eval 'sub TWO_BYTE_BIT () {0x80;}' unless defined(&TWO_BYTE_BIT);
    eval 'sub SEC_ESC_BIT () {0x40;}' unless defined(&SEC_ESC_BIT);
    eval 'sub TWO_BYTE_MASK () {0x7fff;}' unless defined(&TWO_BYTE_MASK);
    eval 'sub THREE_BYTE_MASK () {0x3fff;}' unless defined(&THREE_BYTE_MASK);
    eval 'sub INC32 {
        local($a) = @_;
	    eval q((($a)=(($a)+1)&0xffffffff));
    }' unless defined(&INC32);
    eval 'sub DEC32 {
        local($a) = @_;
	    eval q((($a)=(($a)-1)&0xffffffff));
    }' unless defined(&DEC32);
    eval 'sub MAX_MAC_SIZE () {20;}' unless defined(&MAX_MAC_SIZE);
    eval 'sub SSL_MKEY_MASK () {0x0000001f;}' unless defined(&SSL_MKEY_MASK);
    eval 'sub SSL_kRSA () {0x00000001;}' unless defined(&SSL_kRSA);
    eval 'sub SSL_kDHr () {0x00000002;}' unless defined(&SSL_kDHr);
    eval 'sub SSL_kDHd () {0x00000004;}' unless defined(&SSL_kDHd);
    eval 'sub SSL_kFZA () {0x00000008;}' unless defined(&SSL_kFZA);
    eval 'sub SSL_kEDH () {0x00000010;}' unless defined(&SSL_kEDH);
    eval 'sub SSL_EDH () {( &SSL_kEDH|( &SSL_AUTH_MASK^ &SSL_aNULL));}' unless defined(&SSL_EDH);
    eval 'sub SSL_AUTH_MASK () {0x000003e0;}' unless defined(&SSL_AUTH_MASK);
    eval 'sub SSL_aRSA () {0x00000020;}' unless defined(&SSL_aRSA);
    eval 'sub SSL_aDSS () {0x00000040;}' unless defined(&SSL_aDSS);
    eval 'sub SSL_DSS () { &SSL_aDSS;}' unless defined(&SSL_DSS);
    eval 'sub SSL_aFZA () {0x00000080;}' unless defined(&SSL_aFZA);
    eval 'sub SSL_aNULL () {0x00000100;}' unless defined(&SSL_aNULL);
    eval 'sub SSL_aDH () {0x00000200;}' unless defined(&SSL_aDH);
    eval 'sub SSL_NULL () {( &SSL_eNULL);}' unless defined(&SSL_NULL);
    eval 'sub SSL_ADH () {( &SSL_kEDH| &SSL_aNULL);}' unless defined(&SSL_ADH);
    eval 'sub SSL_RSA () {( &SSL_kRSA| &SSL_aRSA);}' unless defined(&SSL_RSA);
    eval 'sub SSL_DH () {( &SSL_kDHr| &SSL_kDHd| &SSL_kEDH);}' unless defined(&SSL_DH);
    eval 'sub SSL_FZA () {( &SSL_aFZA| &SSL_kFZA| &SSL_eFZA);}' unless defined(&SSL_FZA);
    eval 'sub SSL_ENC_MASK () {0x0001fc00;}' unless defined(&SSL_ENC_MASK);
    eval 'sub SSL_DES () {0x00000400;}' unless defined(&SSL_DES);
    eval 'sub SSL_3DES () {0x00000800;}' unless defined(&SSL_3DES);
    eval 'sub SSL_RC4 () {0x00001000;}' unless defined(&SSL_RC4);
    eval 'sub SSL_RC2 () {0x00002000;}' unless defined(&SSL_RC2);
    eval 'sub SSL_IDEA () {0x00004000;}' unless defined(&SSL_IDEA);
    eval 'sub SSL_eFZA () {0x00008000;}' unless defined(&SSL_eFZA);
    eval 'sub SSL_eNULL () {0x00010000;}' unless defined(&SSL_eNULL);
    eval 'sub SSL_MAC_MASK () {0x00060000;}' unless defined(&SSL_MAC_MASK);
    eval 'sub SSL_MD5 () {0x00020000;}' unless defined(&SSL_MD5);
    eval 'sub SSL_SHA1 () {0x00040000;}' unless defined(&SSL_SHA1);
    eval 'sub SSL_SHA () {( &SSL_SHA1);}' unless defined(&SSL_SHA);
    eval 'sub SSL_SSL_MASK () {0x00180000;}' unless defined(&SSL_SSL_MASK);
    eval 'sub SSL_SSLV2 () {0x00080000;}' unless defined(&SSL_SSLV2);
    eval 'sub SSL_SSLV3 () {0x00100000;}' unless defined(&SSL_SSLV3);
    eval 'sub SSL_TLSV1 () { &SSL_SSLV3;}' unless defined(&SSL_TLSV1);
    eval 'sub SSL_EXP_MASK () {0x00000003;}' unless defined(&SSL_EXP_MASK);
    eval 'sub SSL_NOT_EXP () {0x00000001;}' unless defined(&SSL_NOT_EXP);
    eval 'sub SSL_EXPORT () {0x00000002;}' unless defined(&SSL_EXPORT);
    eval 'sub SSL_STRONG_MASK () {0x0000007c;}' unless defined(&SSL_STRONG_MASK);
    eval 'sub SSL_EXP40 () {0x00000004;}' unless defined(&SSL_EXP40);
    eval 'sub SSL_MICRO () {( &SSL_EXP40);}' unless defined(&SSL_MICRO);
    eval 'sub SSL_EXP56 () {0x00000008;}' unless defined(&SSL_EXP56);
    eval 'sub SSL_MINI () {( &SSL_EXP56);}' unless defined(&SSL_MINI);
    eval 'sub SSL_LOW () {0x00000010;}' unless defined(&SSL_LOW);
    eval 'sub SSL_MEDIUM () {0x00000020;}' unless defined(&SSL_MEDIUM);
    eval 'sub SSL_HIGH () {0x00000040;}' unless defined(&SSL_HIGH);
    eval 'sub SSL_IS_EXPORT {
        local($a) = @_;
	    eval q((($a) &SSL_EXPORT));
    }' unless defined(&SSL_IS_EXPORT);
    eval 'sub SSL_IS_EXPORT56 {
        local($a) = @_;
	    eval q((($a) &SSL_EXP56));
    }' unless defined(&SSL_IS_EXPORT56);
    eval 'sub SSL_IS_EXPORT40 {
        local($a) = @_;
	    eval q((($a) &SSL_EXP40));
    }' unless defined(&SSL_IS_EXPORT40);
    eval 'sub SSL_C_IS_EXPORT {
        local($c) = @_;
	    eval q( &SSL_IS_EXPORT(($c)-> &algo_strength));
    }' unless defined(&SSL_C_IS_EXPORT);
    eval 'sub SSL_C_IS_EXPORT56 {
        local($c) = @_;
	    eval q( &SSL_IS_EXPORT56(($c)-> &algo_strength));
    }' unless defined(&SSL_C_IS_EXPORT56);
    eval 'sub SSL_C_IS_EXPORT40 {
        local($c) = @_;
	    eval q( &SSL_IS_EXPORT40(($c)-> &algo_strength));
    }' unless defined(&SSL_C_IS_EXPORT40);
    eval 'sub SSL_EXPORT_KEYLENGTH {
        local($a,$s) = @_;
	    eval q(( &SSL_IS_EXPORT40($s) ? 5: (($a) &SSL_ENC_MASK) ==  &SSL_DES ? 8: 7));
    }' unless defined(&SSL_EXPORT_KEYLENGTH);
    eval 'sub SSL_EXPORT_PKEYLENGTH {
        local($a) = @_;
	    eval q(( &SSL_IS_EXPORT40($a) ? 512: 1024));
    }' unless defined(&SSL_EXPORT_PKEYLENGTH);
    eval 'sub SSL_C_EXPORT_KEYLENGTH {
        local($c) = @_;
	    eval q( &SSL_EXPORT_KEYLENGTH(($c)-> &algorithms, ($c)-> &algo_strength));
    }' unless defined(&SSL_C_EXPORT_KEYLENGTH);
    eval 'sub SSL_C_EXPORT_PKEYLENGTH {
        local($c) = @_;
	    eval q( &SSL_EXPORT_PKEYLENGTH(($c)-> &algo_strength));
    }' unless defined(&SSL_C_EXPORT_PKEYLENGTH);
    eval 'sub SSL_ALL () {0xffffffff;}' unless defined(&SSL_ALL);
    eval 'sub SSL_ALL_CIPHERS () {( &SSL_MKEY_MASK| &SSL_AUTH_MASK| &SSL_ENC_MASK|  &SSL_MAC_MASK);}' unless defined(&SSL_ALL_CIPHERS);
    eval 'sub SSL_ALL_STRENGTHS () {( &SSL_EXP_MASK| &SSL_STRONG_MASK);}' unless defined(&SSL_ALL_STRENGTHS);
    eval 'sub SSL_PKEY_RSA_ENC () {0;}' unless defined(&SSL_PKEY_RSA_ENC);
    eval 'sub SSL_PKEY_RSA_SIGN () {1;}' unless defined(&SSL_PKEY_RSA_SIGN);
    eval 'sub SSL_PKEY_DSA_SIGN () {2;}' unless defined(&SSL_PKEY_DSA_SIGN);
    eval 'sub SSL_PKEY_DH_RSA () {3;}' unless defined(&SSL_PKEY_DH_RSA);
    eval 'sub SSL_PKEY_DH_DSA () {4;}' unless defined(&SSL_PKEY_DH_DSA);
    eval 'sub SSL_PKEY_NUM () {5;}' unless defined(&SSL_PKEY_NUM);
    unless(defined(&NO_RSA)) {
    }
    unless(defined(&NO_DH)) {
    }
    unless(defined(&NO_RSA)) {
    }
    unless(defined(&NO_DH)) {
    }
    eval 'sub FP_ICC () {(\'int\' (*)( &const  &void *, &const  &void *));}' unless defined(&FP_ICC);
    eval 'sub ssl_put_cipher_by_char {
        local($ssl,$ciph,$ptr) = @_;
	    eval q((($ssl)-> ($method->{put_cipher_by_char})(($ciph),($ptr))));
    }' unless defined(&ssl_put_cipher_by_char);
    eval 'sub ssl_get_cipher_by_char {
        local($ssl,$ptr) = @_;
	    eval q((($ssl)-> ($method->{get_cipher_by_char})($ptr)));
    }' unless defined(&ssl_get_cipher_by_char);
    if(defined(&VMS)) {
	undef(&SSL_COMP_get_compression_methods) if defined(&SSL_COMP_get_compression_methods);
	eval 'sub SSL_COMP_get_compression_methods () { &SSL_COMP_get_compress_methods;}' unless defined(&SSL_COMP_get_compression_methods);
    }
}
1;
