/*
 * This file was generated automatically by xsubpp version 1.9507 from the 
 * contents of SSLeay.xs. Do not edit this file, edit SSLeay.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST! 
 *
 */

//#line 1 "SSLeay.xs"
/* SSLeay.xs - Perl module for using Eric Young's implementation of SSL
 *
 * Copyright (c) 1996-1999 Sampo Kellomaki <sampo@iki.fi>
 * All Rights Reserved.
 *
 * 19.6.1998, Maintenance release to sync with SSLeay-0.9.0, --Sampo
 * 24.6.1998, added write_partial to support ssl_write_all in more
 *            memory efficient way. --Sampo
 * 8.7.1998,  Added SSL_(CTX)?_set_options and associated constants.
 * 31.3.1999, Tracking OpenSSL-0.9.2b changes, dropping support for
 *            earlier versions
 * 30.7.1999, Tracking OpenSSL-0.9.3a changes, --Sampo
 * 
 * The distribution and use of this module are subject to the conditions
 * listed in COPYRIGHT file at the root of Eric Young's SSLeay-0.9.0
 * distribution (i.e. free, but mandatory attribution and NO WARRANTY).

Removed, perhaps permanently?

int
SSL_add_session(ctx,ses)
     SSL_CTX *          ctx
     SSL_SESSION *      ses

int
SSL_remove_session(ctx,ses)
     SSL_CTX *          ctx
     SSL_SESSION *      ses

void
SSL_flush_sessions(ctx,tm)
     SSL_CTX *          ctx
     long               tm

 */

#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif

/* OpenSSL-0.9.3a has some strange warning about this in
 *    openssl/des.h
 */
#undef _

#include <openssl/err.h>
#include <openssl/lhash.h>
#include <openssl/buffer.h>
#include <openssl/ssl.h>

/* Debugging output */

#if 0
#define PR(s) printf(s);
#define PRN(s,n) printf("'%s' (%d)\n",s,n);
#define SEX_DEBUG 1
#else
#define PR(s)
#define PRN(s,n)
#undef  SEX_DEBUG
#endif

static int
not_here(s)
char *s;
{
    croak("%s not implemented on this architecture", s);
    return -1;
}

/* xsub automagically generated constant evaluator function */

static double
constant(name, arg)
char *name;
int arg;
{
    errno = 0;
    switch (*name) {
    case 'A':
	if (strEQ(name, "AT_MD5_WITH_RSA_ENCRYPTION"))
#ifdef SSL_AT_MD5_WITH_RSA_ENCRYPTION
	    return SSL_AT_MD5_WITH_RSA_ENCRYPTION;
#else
	    goto not_there;
#endif
	break;
    case 'B':
	break;
    case 'C':
	if (strEQ(name, "CB_ACCEPT_EXIT"))
#ifdef SSL_CB_ACCEPT_EXIT
	    return SSL_CB_ACCEPT_EXIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CB_ACCEPT_LOOP"))
#ifdef SSL_CB_ACCEPT_LOOP
	    return SSL_CB_ACCEPT_LOOP;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CB_CONNECT_EXIT"))
#ifdef SSL_CB_CONNECT_EXIT
	    return SSL_CB_CONNECT_EXIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CB_CONNECT_LOOP"))
#ifdef SSL_CB_CONNECT_LOOP
	    return SSL_CB_CONNECT_LOOP;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_DES_192_EDE3_CBC_WITH_MD5"))
#ifdef SSL_CK_DES_192_EDE3_CBC_WITH_MD5
	    return SSL_CK_DES_192_EDE3_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_DES_192_EDE3_CBC_WITH_SHA"))
#ifdef SSL_CK_DES_192_EDE3_CBC_WITH_SHA
	    return SSL_CK_DES_192_EDE3_CBC_WITH_SHA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_DES_64_CBC_WITH_MD5"))
#ifdef SSL_CK_DES_64_CBC_WITH_MD5
	    return SSL_CK_DES_64_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_DES_64_CBC_WITH_SHA"))
#ifdef SSL_CK_DES_64_CBC_WITH_SHA
	    return SSL_CK_DES_64_CBC_WITH_SHA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_DES_64_CFB64_WITH_MD5_1"))
#ifdef SSL_CK_DES_64_CFB64_WITH_MD5_1
	    return SSL_CK_DES_64_CFB64_WITH_MD5_1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_IDEA_128_CBC_WITH_MD5"))
#ifdef SSL_CK_IDEA_128_CBC_WITH_MD5
	    return SSL_CK_IDEA_128_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_NULL"))
#ifdef SSL_CK_NULL
	    return SSL_CK_NULL;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_NULL_WITH_MD5"))
#ifdef SSL_CK_NULL_WITH_MD5
	    return SSL_CK_NULL_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_RC2_128_CBC_EXPORT40_WITH_MD5"))
#ifdef SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5
	    return SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_RC2_128_CBC_WITH_MD5"))
#ifdef SSL_CK_RC2_128_CBC_WITH_MD5
	    return SSL_CK_RC2_128_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_RC4_128_EXPORT40_WITH_MD5"))
#ifdef SSL_CK_RC4_128_EXPORT40_WITH_MD5
	    return SSL_CK_RC4_128_EXPORT40_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CK_RC4_128_WITH_MD5"))
#ifdef SSL_CK_RC4_128_WITH_MD5
	    return SSL_CK_RC4_128_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CLIENT_VERSION"))
#ifdef SSL_CLIENT_VERSION
	    return SSL_CLIENT_VERSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "CT_X509_CERTIFICATE"))
#ifdef SSL_CT_X509_CERTIFICATE
	    return SSL_CT_X509_CERTIFICATE;
#else
	    goto not_there;
#endif
	break;
    case 'D':
	break;
    case 'E':
	break;
    case 'F':
	if (strEQ(name, "FILETYPE_ASN1"))
#ifdef SSL_FILETYPE_ASN1
	    return SSL_FILETYPE_ASN1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "FILETYPE_PEM"))
#ifdef SSL_FILETYPE_PEM
	    return SSL_FILETYPE_PEM;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_CLIENT_CERTIFICATE"))
#ifdef SSL_F_CLIENT_CERTIFICATE
	    return SSL_F_CLIENT_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_CLIENT_HELLO"))
#ifdef SSL_F_CLIENT_HELLO
	    return SSL_F_CLIENT_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_CLIENT_MASTER_KEY"))
#ifdef SSL_F_CLIENT_MASTER_KEY
	    return SSL_F_CLIENT_MASTER_KEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_D2I_SSL_SESSION"))
#ifdef SSL_F_D2I_SSL_SESSION
	    return SSL_F_D2I_SSL_SESSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_CLIENT_FINISHED"))
#ifdef SSL_F_GET_CLIENT_FINISHED
	    return SSL_F_GET_CLIENT_FINISHED;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_CLIENT_HELLO"))
#ifdef SSL_F_GET_CLIENT_HELLO
	    return SSL_F_GET_CLIENT_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_CLIENT_MASTER_KEY"))
#ifdef SSL_F_GET_CLIENT_MASTER_KEY
	    return SSL_F_GET_CLIENT_MASTER_KEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_SERVER_FINISHED"))
#ifdef SSL_F_GET_SERVER_FINISHED
	    return SSL_F_GET_SERVER_FINISHED;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_SERVER_HELLO"))
#ifdef SSL_F_GET_SERVER_HELLO
	    return SSL_F_GET_SERVER_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_GET_SERVER_VERIFY"))
#ifdef SSL_F_GET_SERVER_VERIFY
	    return SSL_F_GET_SERVER_VERIFY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_I2D_SSL_SESSION"))
#ifdef SSL_F_I2D_SSL_SESSION
	    return SSL_F_I2D_SSL_SESSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_READ_N"))
#ifdef SSL_F_READ_N
	    return SSL_F_READ_N;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_REQUEST_CERTIFICATE"))
#ifdef SSL_F_REQUEST_CERTIFICATE
	    return SSL_F_REQUEST_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SERVER_HELLO"))
#ifdef SSL_F_SERVER_HELLO
	    return SSL_F_SERVER_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ACCEPT"))
#ifdef SSL_F_SSL_ACCEPT
	    return SSL_F_SSL_ACCEPT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_CERT_NEW"))
#ifdef SSL_F_SSL_CERT_NEW
	    return SSL_F_SSL_CERT_NEW;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_CONNECT"))
#ifdef SSL_F_SSL_CONNECT
	    return SSL_F_SSL_CONNECT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_DES_CBC_INIT"))
#ifdef SSL_F_SSL_ENC_DES_CBC_INIT
	    return SSL_F_SSL_ENC_DES_CBC_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_DES_CFB_INIT"))
#ifdef SSL_F_SSL_ENC_DES_CFB_INIT
	    return SSL_F_SSL_ENC_DES_CFB_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_DES_EDE3_CBC_INIT"))
#ifdef SSL_F_SSL_ENC_DES_EDE3_CBC_INIT
	    return SSL_F_SSL_ENC_DES_EDE3_CBC_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_IDEA_CBC_INIT"))
#ifdef SSL_F_SSL_ENC_IDEA_CBC_INIT
	    return SSL_F_SSL_ENC_IDEA_CBC_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_NULL_INIT"))
#ifdef SSL_F_SSL_ENC_NULL_INIT
	    return SSL_F_SSL_ENC_NULL_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_RC2_CBC_INIT"))
#ifdef SSL_F_SSL_ENC_RC2_CBC_INIT
	    return SSL_F_SSL_ENC_RC2_CBC_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_ENC_RC4_INIT"))
#ifdef SSL_F_SSL_ENC_RC4_INIT
	    return SSL_F_SSL_ENC_RC4_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_GET_NEW_SESSION"))
#ifdef SSL_F_SSL_GET_NEW_SESSION
	    return SSL_F_SSL_GET_NEW_SESSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_MAKE_CIPHER_LIST"))
#ifdef SSL_F_SSL_MAKE_CIPHER_LIST
	    return SSL_F_SSL_MAKE_CIPHER_LIST;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_NEW"))
#ifdef SSL_F_SSL_NEW
	    return SSL_F_SSL_NEW;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_READ"))
#ifdef SSL_F_SSL_READ
	    return SSL_F_SSL_READ;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_RSA_PRIVATE_DECRYPT"))
#ifdef SSL_F_SSL_RSA_PRIVATE_DECRYPT
	    return SSL_F_SSL_RSA_PRIVATE_DECRYPT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_RSA_PUBLIC_ENCRYPT"))
#ifdef SSL_F_SSL_RSA_PUBLIC_ENCRYPT
	    return SSL_F_SSL_RSA_PUBLIC_ENCRYPT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SESSION_NEW"))
#ifdef SSL_F_SSL_SESSION_NEW
	    return SSL_F_SSL_SESSION_NEW;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SESSION_PRINT_FP"))
#ifdef SSL_F_SSL_SESSION_PRINT_FP
	    return SSL_F_SSL_SESSION_PRINT_FP;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SET_CERTIFICATE"))
#ifdef SSL_F_SSL_SET_CERTIFICATE
	    return SSL_F_SSL_SET_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SET_FD"))
#ifdef SSL_F_SSL_SET_FD
	    return SSL_F_SSL_SET_FD;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SET_RFD"))
#ifdef SSL_F_SSL_SET_RFD
	    return SSL_F_SSL_SET_RFD;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_SET_WFD"))
#ifdef SSL_F_SSL_SET_WFD
	    return SSL_F_SSL_SET_WFD;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_STARTUP"))
#ifdef SSL_F_SSL_STARTUP
	    return SSL_F_SSL_STARTUP;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_CERTIFICATE"))
#ifdef SSL_F_SSL_USE_CERTIFICATE
	    return SSL_F_SSL_USE_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_CERTIFICATE_ASN1"))
#ifdef SSL_F_SSL_USE_CERTIFICATE_ASN1
	    return SSL_F_SSL_USE_CERTIFICATE_ASN1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_CERTIFICATE_FILE"))
#ifdef SSL_F_SSL_USE_CERTIFICATE_FILE
	    return SSL_F_SSL_USE_CERTIFICATE_FILE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_PRIVATEKEY"))
#ifdef SSL_F_SSL_USE_PRIVATEKEY
	    return SSL_F_SSL_USE_PRIVATEKEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_PRIVATEKEY_ASN1"))
#ifdef SSL_F_SSL_USE_PRIVATEKEY_ASN1
	    return SSL_F_SSL_USE_PRIVATEKEY_ASN1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_PRIVATEKEY_FILE"))
#ifdef SSL_F_SSL_USE_PRIVATEKEY_FILE
	    return SSL_F_SSL_USE_PRIVATEKEY_FILE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_RSAPRIVATEKEY"))
#ifdef SSL_F_SSL_USE_RSAPRIVATEKEY
	    return SSL_F_SSL_USE_RSAPRIVATEKEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_RSAPRIVATEKEY_ASN1"))
#ifdef SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1
	    return SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_SSL_USE_RSAPRIVATEKEY_FILE"))
#ifdef SSL_F_SSL_USE_RSAPRIVATEKEY_FILE
	    return SSL_F_SSL_USE_RSAPRIVATEKEY_FILE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "F_WRITE_PENDING"))
#ifdef SSL_F_WRITE_PENDING
	    return SSL_F_WRITE_PENDING;
#else
	    goto not_there;
#endif
	break;
    case 'G':
	break;
    case 'H':
	break;
    case 'I':
	break;
    case 'J':
	break;
    case 'K':
	break;
    case 'L':
	break;
    case 'M':
	if (strEQ(name, "MAX_MASTER_KEY_LENGTH_IN_BITS"))
#ifdef SSL_MAX_MASTER_KEY_LENGTH_IN_BITS
	    return SSL_MAX_MASTER_KEY_LENGTH_IN_BITS;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MAX_RECORD_LENGTH_2_BYTE_HEADER"))
#ifdef SSL_MAX_RECORD_LENGTH_2_BYTE_HEADER
	    return SSL_MAX_RECORD_LENGTH_2_BYTE_HEADER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MAX_RECORD_LENGTH_3_BYTE_HEADER"))
#ifdef SSL_MAX_RECORD_LENGTH_3_BYTE_HEADER
	    return SSL_MAX_RECORD_LENGTH_3_BYTE_HEADER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MAX_SSL_SESSION_ID_LENGTH_IN_BYTES"))
#ifdef SSL_MAX_SSL_SESSION_ID_LENGTH_IN_BYTES
	    return SSL_MAX_SSL_SESSION_ID_LENGTH_IN_BYTES;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MIN_RSA_MODULUS_LENGTH_IN_BYTES"))
#ifdef SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES
	    return SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_CLIENT_CERTIFICATE"))
#ifdef SSL_MT_CLIENT_CERTIFICATE
	    return SSL_MT_CLIENT_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_CLIENT_FINISHED"))
#ifdef SSL_MT_CLIENT_FINISHED
	    return SSL_MT_CLIENT_FINISHED;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_CLIENT_HELLO"))
#ifdef SSL_MT_CLIENT_HELLO
	    return SSL_MT_CLIENT_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_CLIENT_MASTER_KEY"))
#ifdef SSL_MT_CLIENT_MASTER_KEY
	    return SSL_MT_CLIENT_MASTER_KEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_ERROR"))
#ifdef SSL_MT_ERROR
	    return SSL_MT_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_REQUEST_CERTIFICATE"))
#ifdef SSL_MT_REQUEST_CERTIFICATE
	    return SSL_MT_REQUEST_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_SERVER_FINISHED"))
#ifdef SSL_MT_SERVER_FINISHED
	    return SSL_MT_SERVER_FINISHED;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_SERVER_HELLO"))
#ifdef SSL_MT_SERVER_HELLO
	    return SSL_MT_SERVER_HELLO;
#else
	    goto not_there;
#endif
	if (strEQ(name, "MT_SERVER_VERIFY"))
#ifdef SSL_MT_SERVER_VERIFY
	    return SSL_MT_SERVER_VERIFY;
#else
	    goto not_there;
#endif
	break;
    case 'N':
	if (strEQ(name, "NOTHING"))
#ifdef SSL_NOTHING
	    return SSL_NOTHING;
#else
	    goto not_there;
#endif
	break;
    case 'O':
	if (strEQ(name, "OP_MICROSOFT_SESS_ID_BUG"))
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
	    return SSL_OP_MICROSOFT_SESS_ID_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NETSCAPE_CHALLENGE_BUG"))
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
	    return SSL_OP_NETSCAPE_CHALLENGE_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG"))
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
	    return SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_SSLREF2_REUSE_CERT_TYPE_BUG"))
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
	    return SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_MICROSOFT_BIG_SSLV3_BUFFER"))
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
	    return SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_MSIE_SSLV2_RSA_PADDING"))
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
	    return SSL_OP_MSIE_SSLV2_RSA_PADDING;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_SSLEAY_080_CLIENT_DH_BUG"))
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
	    return SSL_OP_SSLEAY_080_CLIENT_DH_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_TLS_D5_BUG"))
#ifdef SSL_OP_TLS_D5_BUG
	    return SSL_OP_TLS_D5_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_SINGLE_DH_USE"))
#ifdef SSL_OP_SINGLE_DH_USE
	    return SSL_OP_SINGLE_DH_USE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_EPHEMERAL_RSA"))
#ifdef SSL_OP_EPHEMERAL_RSA
	    return SSL_OP_EPHEMERAL_RSA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NETSCAPE_CA_DN_BUG"))
#ifdef SSL_OP_NETSCAPE_CA_DN_BUG
	    return SSL_OP_NETSCAPE_CA_DN_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NON_EXPORT_FIRST"))
#ifdef SSL_OP_NON_EXPORT_FIRST
	    return SSL_OP_NON_EXPORT_FIRST;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG"))
#ifdef SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
	    return SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NO_SSLv2"))
#ifdef SSL_OP_NO_SSLv2
	    return SSL_OP_NO_SSLv2;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NO_SSLv3"))
#ifdef SSL_OP_NO_SSLv3
	    return SSL_OP_NO_SSLv3;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_NO_TLSv1"))
#ifdef SSL_OP_NO_TLSv1
	    return SSL_OP_NO_TLSv1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "OP_ALL"))
#ifdef SSL_OP_ALL
	    return SSL_OP_ALL;
#else
	    goto not_there;
#endif

    case 'P':
	if (strEQ(name, "PE_BAD_CERTIFICATE"))
#ifdef SSL_PE_BAD_CERTIFICATE
	    return SSL_PE_BAD_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "PE_NO_CERTIFICATE"))
#ifdef SSL_PE_NO_CERTIFICATE
	    return SSL_PE_NO_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "PE_NO_CIPHER"))
#ifdef SSL_PE_NO_CIPHER
	    return SSL_PE_NO_CIPHER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "PE_UNSUPPORTED_CERTIFICATE_TYPE"))
#ifdef SSL_PE_UNSUPPORTED_CERTIFICATE_TYPE
	    return SSL_PE_UNSUPPORTED_CERTIFICATE_TYPE;
#else
	    goto not_there;
#endif
	break;
    case 'Q':
	break;
    case 'R':
	if (strEQ(name, "READING"))
#ifdef SSL_READING
	    return SSL_READING;
#else
	    goto not_there;
#endif
	if (strEQ(name, "RWERR_BAD_MAC_DECODE"))
#ifdef SSL_RWERR_BAD_MAC_DECODE
	    return SSL_RWERR_BAD_MAC_DECODE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "RWERR_BAD_WRITE_RETRY"))
#ifdef SSL_RWERR_BAD_WRITE_RETRY
	    return SSL_RWERR_BAD_WRITE_RETRY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "RWERR_INTERNAL_ERROR"))
#ifdef SSL_RWERR_INTERNAL_ERROR
	    return SSL_RWERR_INTERNAL_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_AUTHENTICATION_TYPE"))
#ifdef SSL_R_BAD_AUTHENTICATION_TYPE
	    return SSL_R_BAD_AUTHENTICATION_TYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_CHECKSUM"))
#ifdef SSL_R_BAD_CHECKSUM
	    return SSL_R_BAD_CHECKSUM;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_MAC_DECODE"))
#ifdef SSL_R_BAD_MAC_DECODE
	    return SSL_R_BAD_MAC_DECODE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_RESPONSE_ARGUMENT"))
#ifdef SSL_R_BAD_RESPONSE_ARGUMENT
	    return SSL_R_BAD_RESPONSE_ARGUMENT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_SSL_FILETYPE"))
#ifdef SSL_R_BAD_SSL_FILETYPE
	    return SSL_R_BAD_SSL_FILETYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_SSL_SESSION_ID_LENGTH"))
#ifdef SSL_R_BAD_SSL_SESSION_ID_LENGTH
	    return SSL_R_BAD_SSL_SESSION_ID_LENGTH;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_STATE"))
#ifdef SSL_R_BAD_STATE
	    return SSL_R_BAD_STATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_BAD_WRITE_RETRY"))
#ifdef SSL_R_BAD_WRITE_RETRY
	    return SSL_R_BAD_WRITE_RETRY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_CHALLENGE_IS_DIFFERENT"))
#ifdef SSL_R_CHALLENGE_IS_DIFFERENT
	    return SSL_R_CHALLENGE_IS_DIFFERENT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_CIPHER_CODE_TOO_LONG"))
#ifdef SSL_R_CIPHER_CODE_TOO_LONG
	    return SSL_R_CIPHER_CODE_TOO_LONG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_CIPHER_TABLE_SRC_ERROR"))
#ifdef SSL_R_CIPHER_TABLE_SRC_ERROR
	    return SSL_R_CIPHER_TABLE_SRC_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_CONECTION_ID_IS_DIFFERENT"))
#ifdef SSL_R_CONECTION_ID_IS_DIFFERENT
	    return SSL_R_CONECTION_ID_IS_DIFFERENT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_INVALID_CHALLENGE_LENGTH"))
#ifdef SSL_R_INVALID_CHALLENGE_LENGTH
	    return SSL_R_INVALID_CHALLENGE_LENGTH;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_CERTIFICATE_SET"))
#ifdef SSL_R_NO_CERTIFICATE_SET
	    return SSL_R_NO_CERTIFICATE_SET;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_CERTIFICATE_SPECIFIED"))
#ifdef SSL_R_NO_CERTIFICATE_SPECIFIED
	    return SSL_R_NO_CERTIFICATE_SPECIFIED;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_CIPHER_LIST"))
#ifdef SSL_R_NO_CIPHER_LIST
	    return SSL_R_NO_CIPHER_LIST;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_CIPHER_MATCH"))
#ifdef SSL_R_NO_CIPHER_MATCH
	    return SSL_R_NO_CIPHER_MATCH;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_CIPHER_WE_TRUST"))
#ifdef SSL_R_NO_CIPHER_WE_TRUST
	    return SSL_R_NO_CIPHER_WE_TRUST;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_PRIVATEKEY"))
#ifdef SSL_R_NO_PRIVATEKEY
	    return SSL_R_NO_PRIVATEKEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_PUBLICKEY"))
#ifdef SSL_R_NO_PUBLICKEY
	    return SSL_R_NO_PUBLICKEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_READ_METHOD_SET"))
#ifdef SSL_R_NO_READ_METHOD_SET
	    return SSL_R_NO_READ_METHOD_SET;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NO_WRITE_METHOD_SET"))
#ifdef SSL_R_NO_WRITE_METHOD_SET
	    return SSL_R_NO_WRITE_METHOD_SET;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_NULL_SSL_CTX"))
#ifdef SSL_R_NULL_SSL_CTX
	    return SSL_R_NULL_SSL_CTX;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PEER_DID_NOT_RETURN_A_CERTIFICATE"))
#ifdef SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
	    return SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PEER_ERROR"))
#ifdef SSL_R_PEER_ERROR
	    return SSL_R_PEER_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PEER_ERROR_CERTIFICATE"))
#ifdef SSL_R_PEER_ERROR_CERTIFICATE
	    return SSL_R_PEER_ERROR_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PEER_ERROR_NO_CIPHER"))
#ifdef SSL_R_PEER_ERROR_NO_CIPHER
	    return SSL_R_PEER_ERROR_NO_CIPHER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE"))
#ifdef SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE
	    return SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PERR_ERROR_NO_CERTIFICATE"))
#ifdef SSL_R_PERR_ERROR_NO_CERTIFICATE
	    return SSL_R_PERR_ERROR_NO_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PUBLIC_KEY_ENCRYPT_ERROR"))
#ifdef SSL_R_PUBLIC_KEY_ENCRYPT_ERROR
	    return SSL_R_PUBLIC_KEY_ENCRYPT_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PUBLIC_KEY_IS_NOT_RSA"))
#ifdef SSL_R_PUBLIC_KEY_IS_NOT_RSA
	    return SSL_R_PUBLIC_KEY_IS_NOT_RSA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_PUBLIC_KEY_NO_RSA"))
#ifdef SSL_R_PUBLIC_KEY_NO_RSA
	    return SSL_R_PUBLIC_KEY_NO_RSA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_READ_WRONG_PACKET_TYPE"))
#ifdef SSL_R_READ_WRONG_PACKET_TYPE
	    return SSL_R_READ_WRONG_PACKET_TYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_REVERSE_KEY_ARG_LENGTH_IS_WRONG"))
#ifdef SSL_R_REVERSE_KEY_ARG_LENGTH_IS_WRONG
	    return SSL_R_REVERSE_KEY_ARG_LENGTH_IS_WRONG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_REVERSE_MASTER_KEY_LENGTH_IS_WRONG"))
#ifdef SSL_R_REVERSE_MASTER_KEY_LENGTH_IS_WRONG
	    return SSL_R_REVERSE_MASTER_KEY_LENGTH_IS_WRONG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_REVERSE_SSL_SESSION_ID_LENGTH_IS_WRONG"))
#ifdef SSL_R_REVERSE_SSL_SESSION_ID_LENGTH_IS_WRONG
	    return SSL_R_REVERSE_SSL_SESSION_ID_LENGTH_IS_WRONG;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_SHORT_READ"))
#ifdef SSL_R_SHORT_READ
	    return SSL_R_SHORT_READ;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_SSL_SESSION_ID_IS_DIFFERENT"))
#ifdef SSL_R_SSL_SESSION_ID_IS_DIFFERENT
	    return SSL_R_SSL_SESSION_ID_IS_DIFFERENT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_UNABLE_TO_EXTRACT_PUBLIC_KEY"))
#ifdef SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY
	    return SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_UNDEFINED_INIT_STATE"))
#ifdef SSL_R_UNDEFINED_INIT_STATE
	    return SSL_R_UNDEFINED_INIT_STATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_UNKNOWN_REMOTE_ERROR_TYPE"))
#ifdef SSL_R_UNKNOWN_REMOTE_ERROR_TYPE
	    return SSL_R_UNKNOWN_REMOTE_ERROR_TYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_UNKNOWN_STATE"))
#ifdef SSL_R_UNKNOWN_STATE
	    return SSL_R_UNKNOWN_STATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_UNSUPORTED_CIPHER"))
#ifdef SSL_R_UNSUPORTED_CIPHER
	    return SSL_R_UNSUPORTED_CIPHER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_WRONG_PUBLIC_KEY_TYPE"))
#ifdef SSL_R_WRONG_PUBLIC_KEY_TYPE
	    return SSL_R_WRONG_PUBLIC_KEY_TYPE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "R_X509_LIB"))
#ifdef SSL_R_X509_LIB
	    return SSL_R_X509_LIB;
#else
	    goto not_there;
#endif
	break;
    case 'S':
	if (strEQ(name, "SERVER_VERSION"))
#ifdef SSL_SERVER_VERSION
	    return SSL_SERVER_VERSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SESSION_ASN1_VERSION"))
#ifdef SSL_SESSION_ASN1_VERSION
	    return SSL_SESSION_ASN1_VERSION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_ACCEPT"))
#ifdef SSL_ST_ACCEPT
	    return SSL_ST_ACCEPT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_BEFORE"))
#ifdef SSL_ST_BEFORE
	    return SSL_ST_BEFORE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_CLIENT_START_ENCRYPTION"))
#ifdef SSL_ST_CLIENT_START_ENCRYPTION
	    return SSL_ST_CLIENT_START_ENCRYPTION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_CONNECT"))
#ifdef SSL_ST_CONNECT
	    return SSL_ST_CONNECT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_FINISHED_A"))
#ifdef SSL_ST_GET_CLIENT_FINISHED_A
	    return SSL_ST_GET_CLIENT_FINISHED_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_FINISHED_B"))
#ifdef SSL_ST_GET_CLIENT_FINISHED_B
	    return SSL_ST_GET_CLIENT_FINISHED_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_HELLO_A"))
#ifdef SSL_ST_GET_CLIENT_HELLO_A
	    return SSL_ST_GET_CLIENT_HELLO_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_HELLO_B"))
#ifdef SSL_ST_GET_CLIENT_HELLO_B
	    return SSL_ST_GET_CLIENT_HELLO_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_MASTER_KEY_A"))
#ifdef SSL_ST_GET_CLIENT_MASTER_KEY_A
	    return SSL_ST_GET_CLIENT_MASTER_KEY_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_CLIENT_MASTER_KEY_B"))
#ifdef SSL_ST_GET_CLIENT_MASTER_KEY_B
	    return SSL_ST_GET_CLIENT_MASTER_KEY_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_FINISHED_A"))
#ifdef SSL_ST_GET_SERVER_FINISHED_A
	    return SSL_ST_GET_SERVER_FINISHED_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_FINISHED_B"))
#ifdef SSL_ST_GET_SERVER_FINISHED_B
	    return SSL_ST_GET_SERVER_FINISHED_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_HELLO_A"))
#ifdef SSL_ST_GET_SERVER_HELLO_A
	    return SSL_ST_GET_SERVER_HELLO_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_HELLO_B"))
#ifdef SSL_ST_GET_SERVER_HELLO_B
	    return SSL_ST_GET_SERVER_HELLO_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_VERIFY_A"))
#ifdef SSL_ST_GET_SERVER_VERIFY_A
	    return SSL_ST_GET_SERVER_VERIFY_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_GET_SERVER_VERIFY_B"))
#ifdef SSL_ST_GET_SERVER_VERIFY_B
	    return SSL_ST_GET_SERVER_VERIFY_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_INIT"))
#ifdef SSL_ST_INIT
	    return SSL_ST_INIT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_OK"))
#ifdef SSL_ST_OK
	    return SSL_ST_OK;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_READ_BODY"))
#ifdef SSL_ST_READ_BODY
	    return SSL_ST_READ_BODY;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_READ_HEADER"))
#ifdef SSL_ST_READ_HEADER
	    return SSL_ST_READ_HEADER;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_CERTIFICATE_A"))
#ifdef SSL_ST_SEND_CLIENT_CERTIFICATE_A
	    return SSL_ST_SEND_CLIENT_CERTIFICATE_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_CERTIFICATE_B"))
#ifdef SSL_ST_SEND_CLIENT_CERTIFICATE_B
	    return SSL_ST_SEND_CLIENT_CERTIFICATE_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_CERTIFICATE_C"))
#ifdef SSL_ST_SEND_CLIENT_CERTIFICATE_C
	    return SSL_ST_SEND_CLIENT_CERTIFICATE_C;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_CERTIFICATE_D"))
#ifdef SSL_ST_SEND_CLIENT_CERTIFICATE_D
	    return SSL_ST_SEND_CLIENT_CERTIFICATE_D;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_FINISHED_A"))
#ifdef SSL_ST_SEND_CLIENT_FINISHED_A
	    return SSL_ST_SEND_CLIENT_FINISHED_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_FINISHED_B"))
#ifdef SSL_ST_SEND_CLIENT_FINISHED_B
	    return SSL_ST_SEND_CLIENT_FINISHED_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_HELLO_A"))
#ifdef SSL_ST_SEND_CLIENT_HELLO_A
	    return SSL_ST_SEND_CLIENT_HELLO_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_HELLO_B"))
#ifdef SSL_ST_SEND_CLIENT_HELLO_B
	    return SSL_ST_SEND_CLIENT_HELLO_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_MASTER_KEY_A"))
#ifdef SSL_ST_SEND_CLIENT_MASTER_KEY_A
	    return SSL_ST_SEND_CLIENT_MASTER_KEY_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_CLIENT_MASTER_KEY_B"))
#ifdef SSL_ST_SEND_CLIENT_MASTER_KEY_B
	    return SSL_ST_SEND_CLIENT_MASTER_KEY_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_REQUEST_CERTIFICATE_A"))
#ifdef SSL_ST_SEND_REQUEST_CERTIFICATE_A
	    return SSL_ST_SEND_REQUEST_CERTIFICATE_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_REQUEST_CERTIFICATE_B"))
#ifdef SSL_ST_SEND_REQUEST_CERTIFICATE_B
	    return SSL_ST_SEND_REQUEST_CERTIFICATE_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_REQUEST_CERTIFICATE_C"))
#ifdef SSL_ST_SEND_REQUEST_CERTIFICATE_C
	    return SSL_ST_SEND_REQUEST_CERTIFICATE_C;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_REQUEST_CERTIFICATE_D"))
#ifdef SSL_ST_SEND_REQUEST_CERTIFICATE_D
	    return SSL_ST_SEND_REQUEST_CERTIFICATE_D;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_FINISHED_A"))
#ifdef SSL_ST_SEND_SERVER_FINISHED_A
	    return SSL_ST_SEND_SERVER_FINISHED_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_FINISHED_B"))
#ifdef SSL_ST_SEND_SERVER_FINISHED_B
	    return SSL_ST_SEND_SERVER_FINISHED_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_HELLO_A"))
#ifdef SSL_ST_SEND_SERVER_HELLO_A
	    return SSL_ST_SEND_SERVER_HELLO_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_HELLO_B"))
#ifdef SSL_ST_SEND_SERVER_HELLO_B
	    return SSL_ST_SEND_SERVER_HELLO_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_VERIFY_A"))
#ifdef SSL_ST_SEND_SERVER_VERIFY_A
	    return SSL_ST_SEND_SERVER_VERIFY_A;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SEND_SERVER_VERIFY_B"))
#ifdef SSL_ST_SEND_SERVER_VERIFY_B
	    return SSL_ST_SEND_SERVER_VERIFY_B;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_SERVER_START_ENCRYPTION"))
#ifdef SSL_ST_SERVER_START_ENCRYPTION
	    return SSL_ST_SERVER_START_ENCRYPTION;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_X509_GET_CLIENT_CERTIFICATE"))
#ifdef SSL_ST_X509_GET_CLIENT_CERTIFICATE
	    return SSL_ST_X509_GET_CLIENT_CERTIFICATE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "ST_X509_GET_SERVER_CERTIFICATE"))
#ifdef SSL_ST_X509_GET_SERVER_CERTIFICATE
	    return SSL_ST_X509_GET_SERVER_CERTIFICATE;
#else
	    goto not_there;
#endif
	break;
    case 'T':
#if 0
	if (strEQ(name, "TXT_DES_192_EDE3_CBC_WITH_MD5"))
#ifdef SSL_TXT_DES_192_EDE3_CBC_WITH_MD5
	    return SSL_TXT_DES_192_EDE3_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_DES_192_EDE3_CBC_WITH_SHA"))
#ifdef SSL_TXT_DES_192_EDE3_CBC_WITH_SHA
	    return SSL_TXT_DES_192_EDE3_CBC_WITH_SHA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_DES_64_CBC_WITH_MD5"))
#ifdef SSL_TXT_DES_64_CBC_WITH_MD5
	    return SSL_TXT_DES_64_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_DES_64_CBC_WITH_SHA"))
#ifdef SSL_TXT_DES_64_CBC_WITH_SHA
	    return SSL_TXT_DES_64_CBC_WITH_SHA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_DES_64_CFB64_WITH_MD5_1"))
#ifdef SSL_TXT_DES_64_CFB64_WITH_MD5_1
	    return SSL_TXT_DES_64_CFB64_WITH_MD5_1;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_IDEA_128_CBC_WITH_MD5"))
#ifdef SSL_TXT_IDEA_128_CBC_WITH_MD5
	    return SSL_TXT_IDEA_128_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_NULL"))
#ifdef SSL_TXT_NULL
	    return SSL_TXT_NULL;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_NULL_WITH_MD5"))
#ifdef SSL_TXT_NULL_WITH_MD5
	    return SSL_TXT_NULL_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_RC2_128_CBC_EXPORT40_WITH_MD5"))
#ifdef SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5
	    return SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_RC2_128_CBC_WITH_MD5"))
#ifdef SSL_TXT_RC2_128_CBC_WITH_MD5
	    return SSL_TXT_RC2_128_CBC_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_RC4_128_EXPORT40_WITH_MD5"))
#ifdef SSL_TXT_RC4_128_EXPORT40_WITH_MD5
	    return SSL_TXT_RC4_128_EXPORT40_WITH_MD5;
#else
	    goto not_there;
#endif
	if (strEQ(name, "TXT_RC4_128_WITH_MD5"))
#ifdef SSL_TXT_RC4_128_WITH_MD5
	    return SSL_TXT_RC4_128_WITH_MD5;
#else
	    goto not_there;
#endif
#endif
	break;
    case 'U':
	break;
    case 'V':
	if (strEQ(name, "VERIFY_CLIENT_ONCE"))
#ifdef SSL_VERIFY_CLIENT_ONCE
	    return SSL_VERIFY_CLIENT_ONCE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "VERIFY_FAIL_IF_NO_PEER_CERT"))
#ifdef SSL_VERIFY_FAIL_IF_NO_PEER_CERT
	    return SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "VERIFY_NONE"))
#ifdef SSL_VERIFY_NONE
	    return SSL_VERIFY_NONE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "VERIFY_PEER"))
#ifdef SSL_VERIFY_PEER
	    return SSL_VERIFY_PEER;
#else
	    goto not_there;
#endif
	break;
    case 'W':
	if (strEQ(name, "WRITING"))
#ifdef SSL_WRITING
	    return SSL_WRITING;
#else
	    goto not_there;
#endif
	break;
    case 'X':
	if (strEQ(name, "X509_LOOKUP"))
#ifdef SSL_X509_LOOKUP
	    return SSL_X509_LOOKUP;
#else
	    goto not_there;
#endif
	break;
    case 'Y':
	break;
    case 'Z':
	break;
    }
    errno = EINVAL;
    return 0;

not_there:
    errno = ENOENT;
    return 0;
}

/* ============= callback stuff ============== */

static SV * ssleay_verify_callback = (SV*)NULL;

static int
ssleay_verify_callback_glue (int ok, X509_STORE_CTX* ctx)
{
	dSP ;
	int count,res;
	
	ENTER ;
	SAVETMPS;

	PRN("verify callback glue", ok);

	PUSHMARK(sp);
	XPUSHs(sv_2mortal(newSViv(ok)));
	XPUSHs(sv_2mortal(newSViv((int)ctx)));
	PUTBACK ;
	
	if (ssleay_verify_callback == NULL)
		croak ("Net::SSLeay: verify_callback called, but not "
			"set to point to any perl function.\n");

	PR("About to call verify callback.\n");	
	count = perl_call_sv(ssleay_verify_callback, G_SCALAR);
	PR("Returned from verify callback.\n");	

	SPAGAIN;
	
	if (count != 1)
		croak ( "Net::SSLeay: verify_callback "
			"perl function did not return a scalar.\n");
	res = POPi ;

	PUTBACK ;
	FREETMPS ;
	LEAVE ;
	
	return POPi;
}

static SV * ssleay_ctx_verify_callback = (SV*)NULL;

static int
ssleay_ctx_verify_callback_glue (int ok, X509_STORE_CTX* ctx)
{
	dSP ;
	int count,res;
	
	ENTER ;
	SAVETMPS;
	
	PRN("ctx verify callback glue", ok);

	PUSHMARK(sp);
	XPUSHs(sv_2mortal(newSViv(ok)));
	XPUSHs(sv_2mortal(newSViv((int)ctx)));
	PUTBACK ;
	
	if (ssleay_ctx_verify_callback == NULL)
		croak ("Net::SSLeay: ctx_verify_callback called, but not "
			"set to point to any perl function.\n");

	PR("About to call ctx verify callback.\n");	
	count = perl_call_sv(ssleay_ctx_verify_callback, G_SCALAR);
	PR("Returned from ctx verify callback.\n");	

	SPAGAIN;
	
	if (count != 1)
		croak ( "Net::SSLeay: ctx_verify_callback "
			"perl function did not return a scalar.\n");
	res = POPi ;

	PUTBACK ;
	FREETMPS ;
	LEAVE ;
	
	return POPi;
}

#line 1537 "SSLeay.c"
XS(XS_Net__SSLeay_constant)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::constant(name, arg)");
    {
	char *	name = (char *)SvPV(ST(0),PL_na);
	int	arg = (int)SvIV(ST(1));
	double	RETVAL;
	dXSTARG;

	RETVAL = constant(name, arg);
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_hello)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::hello()");
    {
	int	RETVAL;
	dXSTARG;
#line 1539 "SSLeay.xs"
        PR("\tSSLeay Hello World!\n");
        RETVAL = 1;
#line 1566 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#define REM1 "============= SSL CONTEXT functions =============="
XS(XS_Net__SSLeay_CTX_new)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_new()");
    {
	SSL_CTX *	RETVAL;
	dXSTARG;
#line 1549 "SSLeay.xs"
     RETVAL = SSL_CTX_new (SSLv23_method());
#line 1583 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_v2_new)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_v2_new()");
    {
	SSL_CTX *	RETVAL;
	dXSTARG;
#line 1556 "SSLeay.xs"
     RETVAL = SSL_CTX_new (SSLv2_method());
#line 1599 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_v3_new)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_v3_new()");
    {
	SSL_CTX *	RETVAL;
	dXSTARG;
#line 1563 "SSLeay.xs"
     RETVAL = SSL_CTX_new (SSLv3_method());
#line 1615 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_v23_new)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_v23_new()");
    {
	SSL_CTX *	RETVAL;
	dXSTARG;
#line 1570 "SSLeay.xs"
     RETVAL = SSL_CTX_new (SSLv23_method());
#line 1631 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_free)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_free(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));

	SSL_CTX_free(ctx);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_CTX_add_session)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_add_session(ctx, ses)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_add_session(ctx, ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_remove_session)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_remove_session(ctx, ses)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_remove_session(ctx, ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_flush_sessions)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_flush_sessions(ctx, tm)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	long	tm = (long)SvIV(ST(1));

	SSL_CTX_flush_sessions(ctx, tm);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_CTX_set_default_verify_paths)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_set_default_verify_paths(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_set_default_verify_paths(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_load_verify_locations)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_load_verify_locations(ctx, CAfile, CApath)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	char *	CAfile = (char *)SvPV(ST(1),PL_na);
	char *	CApath = (char *)SvPV(ST(2),PL_na);
	int	RETVAL;
	dXSTARG;
#line 1603 "SSLeay.xs"
     RETVAL = SSL_CTX_load_verify_locations (ctx,
					     CAfile?(*CAfile?CAfile:NULL):NULL,
					     CApath?(*CApath?CApath:NULL):NULL
					     );
#line 1730 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_set_verify)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_set_verify(ctx, mode, callback)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	mode = (int)SvIV(ST(1));
	SV *	callback = ST(2);
#line 1616 "SSLeay.xs"
     if (ssleay_ctx_verify_callback == (SV*)NULL) {
        ssleay_ctx_verify_callback = newSVsv(callback);
     } else {
         SvSetSV (ssleay_ctx_verify_callback, callback);
     }
     if (SvTRUE(ssleay_ctx_verify_callback)) {
         SSL_CTX_set_verify(ctx,mode,&ssleay_ctx_verify_callback_glue);
     } else {
         SSL_CTX_set_verify(ctx,mode,NULL);
     }
#line 1756 "SSLeay.c"
    }
    XSRETURN_EMPTY;
}

#define REM10 "============= SSL functions =============="
XS(XS_Net__SSLeay_new)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::new(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	SSL *	RETVAL;
	dXSTARG;

	RETVAL = SSL_new(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_free)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::free(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));

	SSL_free(s);
    }
    XSRETURN_EMPTY;
}

#if 0 /* this seems to be gone in 0.9.0 */
#define XSubPPtmpAAAA 1

XS(XS_Net__SSLeay_debug)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::debug(file)");
    {
	char *	file = (char *)SvPV(ST(0),PL_na);

	SSL_debug(file);
    }
    XSRETURN_EMPTY;
}

#endif
XS(XS_Net__SSLeay_accept)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::accept(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_accept(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_clear)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::clear(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));

	SSL_clear(s);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_connect)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::connect(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_connect(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#if defined(WIN32)
#define XSubPPtmpAAAB 1

XS(XS_Net__SSLeay_set_fd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_fd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;
#line 1664 "SSLeay.xs"
     RETVAL = SSL_set_fd(s,_get_osfhandle(fd));
#line 1868 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_rfd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_rfd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;
#line 1673 "SSLeay.xs"
     RETVAL = SSL_set_rfd(s,_get_osfhandle(fd));
#line 1886 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_wfd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_wfd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;
#line 1682 "SSLeay.xs"
     RETVAL = SSL_set_wfd(s,_get_osfhandle(fd));
#line 1904 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#else
#define XSubPPtmpAAAC 1

XS(XS_Net__SSLeay_set_fd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_fd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_fd(s, fd);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_rfd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_rfd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_rfd(s, fd);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_wfd)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_wfd(s, fd)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	fd = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_wfd(s, fd);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#endif
XS(XS_Net__SSLeay_get_fd)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_fd(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_fd(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_read)
{
    dXSARGS;
    if (items < 1 || items > 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::read(s, max=sizeof(buf))");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
#line 1713 "SSLeay.xs"
     char buf[32768];
#line 1990 "SSLeay.c"
	int	max;
#line 1717 "SSLeay.xs"
     int got;
#line 1994 "SSLeay.c"

	if (items < 2)
	    max = sizeof(buf);
	else {
	    max = (int)SvIV(ST(1));
	}
#line 1719 "SSLeay.xs"
     ST(0) = sv_newmortal();   /* Undefined to start with */
     if ((got = SSL_read(s, buf, max)) >= 0)
         sv_setpvn( ST(0), buf, got);
#line 2005 "SSLeay.c"
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_write)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::write(s, buf)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
#line 1727 "SSLeay.xs"
     STRLEN len;
#line 2019 "SSLeay.c"
	char *	buf = SvPV( ST(1), len);
	int	RETVAL;
	dXSTARG;
#line 1731 "SSLeay.xs"
     RETVAL = SSL_write (s, buf, (int)len);
#line 2025 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_write_partial)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::write_partial(s, from, count, buf)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	from = (int)SvIV(ST(1));
	int	count = (int)SvIV(ST(2));
#line 1741 "SSLeay.xs"
     STRLEN len;
#line 2042 "SSLeay.c"
	char *	buf = SvPV( ST(3), len);
	int	RETVAL;
	dXSTARG;
#line 1745 "SSLeay.xs"
      /*
     if (SvROK( ST(3) )) {
       SV* t = SvRV( ST(3) );
       buf = SvPV( t, len);
     } else
       buf = SvPV( ST(3), len);
       */
     PRN("write_partial from",from);
     PRN(&buf[from],len);
     PRN("write_partial count",count);
     len -= from;
     if (len < 0) {
       croak("from beyound end of buffer");
       RETVAL = -1;
     } else
       RETVAL = SSL_write (s, &(buf[from]), (count<=len)?count:len);
#line 2063 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_RSAPrivateKey)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_RSAPrivateKey(s, rsa)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	RSA *	rsa = (RSA *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_RSAPrivateKey(s, rsa);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_RSAPrivateKey_ASN1)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_RSAPrivateKey_ASN1(s, d, len)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	unsigned char *	d = (unsigned char *)SvPV(ST(1),PL_na);
	long	len = (long)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_RSAPrivateKey_ASN1(s, d, len);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_RSAPrivateKey_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_RSAPrivateKey_file(s, file, type)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_RSAPrivateKey_file(s, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_use_RSAPrivateKey_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_use_RSAPrivateKey_file(ctx, file, type)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_use_RSAPrivateKey_file(ctx, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_PrivateKey)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_PrivateKey(s, pkey)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	EVP_PKEY *	pkey = (EVP_PKEY *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_PrivateKey(s, pkey);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_PrivateKey_ASN1)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_PrivateKey_ASN1(pk, s, d, len)");
    {
	int	pk = (int)SvIV(ST(0));
	SSL *	s = (SSL *)SvIV(ST(1));
	unsigned char *	d = (unsigned char *)SvPV(ST(2),PL_na);
	long	len = (long)SvIV(ST(3));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_PrivateKey_ASN1(pk, s, d, len);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_PrivateKey_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_PrivateKey_file(s, file, type)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_PrivateKey_file(s, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_use_PrivateKey_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_use_PrivateKey_file(ctx, file, type)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_use_PrivateKey_file(ctx, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_certificate)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_certificate(s, x)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	X509 *	x = (X509 *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_certificate(s, x);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_certificate_ASN1)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_certificate_ASN1(s, d, len)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	unsigned char *	d = (unsigned char *)SvPV(ST(1),PL_na);
	long	len = (long)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_certificate_ASN1(s, d, len);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_use_certificate_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::use_certificate_file(s, file, type)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_use_certificate_file(s, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_use_certificate_file)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_use_certificate_file(ctx, file, type)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	char *	file = (char *)SvPV(ST(1),PL_na);
	int	type = (int)SvIV(ST(2));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_use_certificate_file(ctx, file, type);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_state_string)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::state_string(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_state_string(s);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_rstate_string)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::rstate_string(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_rstate_string(s);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_state_string_long)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::state_string_long(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_state_string_long(s);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_rstate_string_long)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::rstate_string_long(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_rstate_string_long(s);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_time)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_time(ses)");
    {
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(0));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_time(ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_time)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_time(ses, t)");
    {
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(0));
	long	t = (long)SvIV(ST(1));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_time(ses, t);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_timeout)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_timeout(ses)");
    {
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(0));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_timeout(ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_timeout)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_timeout(ses, t)");
    {
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(0));
	long	t = (long)SvIV(ST(1));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_timeout(ses, t);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_copy_session_id)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::copy_session_id(to, from)");
    {
	SSL *	to = (SSL *)SvIV(ST(0));
	SSL *	from = (SSL *)SvIV(ST(1));

	SSL_copy_session_id(to, from);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_set_read_ahead)
{
    dXSARGS;
    if (items < 1 || items > 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_read_ahead(s, yes=1)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	yes;

	if (items < 2)
	    yes = 1;
	else {
	    yes = (int)SvIV(ST(1));
	}

	SSL_set_read_ahead(s, yes);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_get_read_ahead)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_read_ahead(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_read_ahead(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_pending)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::pending(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_pending(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_set_cipher_list)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_set_cipher_list(s, str)");
    {
	SSL_CTX *	s = (SSL_CTX *)SvIV(ST(0));
	char *	str = (char *)SvPV(ST(1),PL_na);
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_set_cipher_list(s, str);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_cipher_list)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_cipher_list(s, n)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	n = (int)SvIV(ST(1));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_cipher_list(s, n);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_cipher_list)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_cipher_list(s, str)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	str = (char *)SvPV(ST(1),PL_na);
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_cipher_list(s, str);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_cipher)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_cipher(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_cipher(s);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_shared_ciphers)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_shared_ciphers(s, buf, len)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	char *	buf = (char *)SvPV(ST(1),PL_na);
	int	len = (int)SvIV(ST(2));
	char *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_shared_ciphers(s, buf, len);
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_peer_certificate)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_peer_certificate(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	X509 *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_peer_certificate(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_verify)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_verify(s, mode, callback)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	mode = (int)SvIV(ST(1));
	SV *	callback = ST(2);
#line 1922 "SSLeay.xs"
     if (ssleay_verify_callback == (SV*)NULL)
         ssleay_verify_callback = newSVsv(callback);
     else
         SvSetSV (ssleay_verify_callback, callback);
     if (SvTRUE(ssleay_verify_callback)) {
         SSL_set_verify(s,mode,&ssleay_verify_callback_glue);
     } else {
         SSL_set_verify(s,mode,NULL);
     }
#line 2599 "SSLeay.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_set_bio)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_bio(s, rbio, wbio)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	BIO *	rbio = (BIO *)SvIV(ST(1));
	BIO *	wbio = (BIO *)SvIV(ST(2));

	SSL_set_bio(s, rbio, wbio);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_get_rbio)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_rbio(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	BIO *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_rbio(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_wbio)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_wbio(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	BIO *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_wbio(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_SESSION_new)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::SESSION_new()");
    {
	SSL_SESSION *	RETVAL;
	dXSTARG;

	RETVAL = SSL_SESSION_new();
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_SESSION_print)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::SESSION_print(fp, ses)");
    {
	BIO *	fp = (BIO *)SvIV(ST(0));
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_SESSION_print(fp, ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_SESSION_free)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::SESSION_free(ses)");
    {
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(0));

	SSL_SESSION_free(ses);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_i2d_SSL_SESSION)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::i2d_SSL_SESSION(in, pp)");
    {
	SSL_SESSION *	in = (SSL_SESSION *)SvIV(ST(0));
	unsigned char *	pp = (unsigned char *)SvPV(ST(1),PL_na);
	int	RETVAL;
	dXSTARG;

	RETVAL = i2d_SSL_SESSION(in, &pp);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_session)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_session(to, ses)");
    {
	SSL *	to = (SSL *)SvIV(ST(0));
	SSL_SESSION *	ses = (SSL_SESSION *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_set_session(to, ses);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_d2i_SSL_SESSION)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::d2i_SSL_SESSION(a, pp, length)");
    {
	SSL_SESSION *	a = (SSL_SESSION *)SvIV(ST(0));
	unsigned char *	pp = (unsigned char *)SvPV(ST(1),PL_na);
	long	length = (long)SvIV(ST(2));
	SSL_SESSION *	RETVAL;
	dXSTARG;

	RETVAL = d2i_SSL_SESSION(&a, &pp, length);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#define REM30 "SSLeay-0.9.0 defines these as macros. I expand them here for safety's sake"
XS(XS_Net__SSLeay_get_session)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_session(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	SSL_SESSION *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_session(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_certificate)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_certificate(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	X509 *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_certificate(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_SSL_CTX)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_SSL_CTX(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	SSL_CTX *	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_SSL_CTX(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_ctrl)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ctrl(ssl, cmd, larg, parg)");
    {
	SSL *	ssl = (SSL *)SvIV(ST(0));
	int	cmd = (int)SvIV(ST(1));
	long	larg = (long)SvIV(ST(2));
	char *	parg = (char *)SvPV(ST(3),PL_na);
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_ctrl(ssl, cmd, larg, parg);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_ctrl)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_ctrl(ctx, cmd, larg, parg)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	cmd = (int)SvIV(ST(1));
	long	larg = (long)SvIV(ST(2));
	char *	parg = (char *)SvPV(ST(3),PL_na);
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_ctrl(ctx, cmd, larg, parg);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_get_options)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::get_options(ssl)");
    {
	SSL *	ssl = (SSL *)SvIV(ST(0));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_get_options(ssl);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_set_options)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::set_options(ssl, op)");
    {
	SSL *	ssl = (SSL *)SvIV(ST(0));
	unsigned long	op = (unsigned long)SvUV(ST(1));

	SSL_set_options(ssl, op);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_CTX_get_options)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_get_options(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	long	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_get_options(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_set_options)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_set_options(ctx, op)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	unsigned long	op = (unsigned long)SvUV(ST(1));

	SSL_CTX_set_options(ctx, op);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_CTX_sessions)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sessions(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	LHASH *	RETVAL;
	dXSTARG;
#line 2025 "SSLeay.xs"
    /* NOTE: This should be deprecated. Corresponding macro was removed from ssl.h as of 0.9.2 */
     if (ctx == NULL) croak("NULL SSL context passed as argument.");
     RETVAL = ctx -> sessions;
#line 2908 "SSLeay.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_number)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_number(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	unsigned long	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_number(ctx);
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_connect)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_connect(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_connect(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_connect_good)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_connect_good(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_connect_good(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_connect_renegotiate)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_connect_renegotiate(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_connect_renegotiate(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_accept)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_accept(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_accept(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_accept_renegotiate)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_accept_renegotiate(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_accept_renegotiate(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_accept_good)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_accept_good(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_accept_good(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_hits)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_hits(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_hits(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_cb_hits)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_cb_hits(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_cb_hits(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_misses)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_misses(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_misses(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_timeouts)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_timeouts(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_timeouts(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_cache_full)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_cache_full(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_cache_full(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_get_cache_size)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_get_cache_size(ctx)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_CTX_sess_get_cache_size(ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_CTX_sess_set_cache_size)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::CTX_sess_set_cache_size(ctx, size)");
    {
	SSL_CTX *	ctx = (SSL_CTX *)SvIV(ST(0));
	int	size = (int)SvIV(ST(1));

	SSL_CTX_sess_set_cache_size(ctx, size);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_want)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::want(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_want(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_state)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::state(s)");
    {
	SSL *	s = (SSL *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = SSL_state(s);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_BIO_f_ssl)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::BIO_f_ssl()");
    {
	BIO_METHOD *	RETVAL;
	dXSTARG;

	RETVAL = BIO_f_ssl();
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_ERR_get_error)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_get_error()");
    {
	unsigned long	RETVAL;
	dXSTARG;

	RETVAL = ERR_get_error();
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_ERR_peek_error)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_peek_error()");
    {
	unsigned long	RETVAL;
	dXSTARG;

	RETVAL = ERR_peek_error();
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_ERR_put_error)
{
    dXSARGS;
    if (items != 5)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_put_error(lib, func, reason, file, line)");
    {
	int	lib = (int)SvIV(ST(0));
	int	func = (int)SvIV(ST(1));
	int	reason = (int)SvIV(ST(2));
	char *	file = (char *)SvPV(ST(3),PL_na);
	int	line = (int)SvIV(ST(4));

	ERR_put_error(lib, func, reason, file, line);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_ERR_clear_error)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_clear_error()");
    {

	ERR_clear_error();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_ERR_error_string)
{
    dXSARGS;
    if (items < 1 || items > 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_error_string(error, buf=NULL)");
    {
	unsigned long	error = (unsigned long)SvUV(ST(0));
	char *	buf;
	char *	RETVAL;
	dXSTARG;

	if (items < 2)
	    buf = NULL;
	else {
	    buf = (char *)SvPV(ST(1),PL_na);
	}
#line 2121 "SSLeay.xs"
     RETVAL = ERR_error_string(error,buf);
#line 3260 "SSLeay.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_load_error_strings)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::load_error_strings()");
    {

	SSL_load_error_strings();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_ERR_load_crypto_strings)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_load_crypto_strings()");
    {

	ERR_load_crypto_strings();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_SSLeay_add_ssl_algorithms)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::SSLeay_add_ssl_algorithms()");
    {

	SSLeay_add_ssl_algorithms();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_ERR_load_SSL_strings)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::ERR_load_SSL_strings()");
    {

	ERR_load_SSL_strings();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_RAND_seed)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::RAND_seed(buf)");
    {
#line 2140 "SSLeay.xs"
     STRLEN len;
#line 3322 "SSLeay.c"
	char *	buf = SvPV( ST(1), len);
#line 2144 "SSLeay.xs"
     RAND_seed (buf, (int)len);
#line 3326 "SSLeay.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_RAND_cleanup)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::RAND_cleanup()");
    {

	RAND_cleanup();
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_RAND_load_file)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::RAND_load_file(file_name, how_much)");
    {
	char *	file_name = (char *)SvPV(ST(0),PL_na);
	int	how_much = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = RAND_load_file(file_name, how_much);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_RAND_write_file)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::RAND_write_file(file_name)");
    {
	char *	file_name = (char *)SvPV(ST(0),PL_na);
	int	RETVAL;
	dXSTARG;

	RETVAL = RAND_write_file(file_name);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#define REM40 "Minimal X509 stuff..., this is a bit ugly and should be put in its own modules Net::SSLeay::X509.pm"
XS(XS_Net__SSLeay_X509_get_issuer_name)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_get_issuer_name(cert)");
    {
	X509 *	cert = (X509 *)SvIV(ST(0));
	X509_NAME *	RETVAL;
	dXSTARG;

	RETVAL = X509_get_issuer_name(cert);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_get_subject_name)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_get_subject_name(cert)");
    {
	X509 *	cert = (X509 *)SvIV(ST(0));
	X509_NAME *	RETVAL;
	dXSTARG;

	RETVAL = X509_get_subject_name(cert);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_NAME_oneline)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_NAME_oneline(name)");
    {
	X509_NAME *	name = (X509_NAME *)SvIV(ST(0));
#line 2172 "SSLeay.xs"
     char buf[32768];
#line 3418 "SSLeay.c"
#line 2174 "SSLeay.xs"
     ST(0) = sv_newmortal();   /* Undefined to start with */
     if (X509_NAME_oneline(name, buf, sizeof(buf)))
         sv_setpvn( ST(0), buf, strlen(buf));
#line 3423 "SSLeay.c"
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_get_current_cert)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_get_current_cert(x509_store_ctx)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	X509 *	RETVAL;
	dXSTARG;

	RETVAL = X509_STORE_CTX_get_current_cert(x509_store_ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_get_ex_data)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_get_ex_data(x509_store_ctx, idx)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	int	idx = (int)SvIV(ST(1));
	void *	RETVAL;
	dXSTARG;

	RETVAL = X509_STORE_CTX_get_ex_data(x509_store_ctx, idx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_get_error)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_get_error(x509_store_ctx)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = X509_STORE_CTX_get_error(x509_store_ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_get_error_depth)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_get_error_depth(x509_store_ctx)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = X509_STORE_CTX_get_error_depth(x509_store_ctx);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_set_ex_data)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_set_ex_data(x509_store_ctx, idx, data)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	int	idx = (int)SvIV(ST(1));
	void *	data = INT2PTR(void *,SvIV(ST(2)));
	int	RETVAL;
	dXSTARG;

	RETVAL = X509_STORE_CTX_set_ex_data(x509_store_ctx, idx, data);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_STORE_CTX_set_error)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_set_error(x509_store_ctx, s)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	int	s = (int)SvIV(ST(1));

	X509_STORE_CTX_set_error(x509_store_ctx, s);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_X509_STORE_CTX_set_cert)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_STORE_CTX_set_cert(x509_store_ctx, x)");
    {
	X509_STORE_CTX *	x509_store_ctx = (X509_STORE_CTX *)SvIV(ST(0));
	X509 *	x = (X509 *)SvIV(ST(1));

	X509_STORE_CTX_set_cert(x509_store_ctx, x);
    }
    XSRETURN_EMPTY;
}

XS(XS_Net__SSLeay_X509_get_notBefore)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_get_notBefore(cert)");
    {
	X509 *	cert = (X509 *)SvIV(ST(0));
	ASN1_UTCTIME *	RETVAL;
	dXSTARG;

	RETVAL = X509_get_notBefore(cert);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_X509_get_notAfter)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::X509_get_notAfter(cert)");
    {
	X509 *	cert = (X509 *)SvIV(ST(0));
	ASN1_UTCTIME *	RETVAL;
	dXSTARG;

	RETVAL = X509_get_notAfter(cert);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_P_ASN1_UTCTIME_put2string)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::P_ASN1_UTCTIME_put2string(tm)");
    {
	ASN1_UTCTIME *	tm = (ASN1_UTCTIME *)SvIV(ST(0));
#line 2225 "SSLeay.xs"
     BIO *bp;
     int i;
     char buffer[256];
#line 3582 "SSLeay.c"
#line 2229 "SSLeay.xs"
     bp = BIO_new(BIO_s_mem());
     ASN1_UTCTIME_print(bp,tm);
     i = BIO_read(bp,buffer,255);
     buffer[i] = '\0';
     ST(0) = sv_newmortal();   /* Undefined to start with */
     if ( i > 0 )
         sv_setpvn( ST(0), buffer, i );
     BIO_free(bp);
#line 3592 "SSLeay.c"
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_EVP_PKEY_copy_parameters)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::EVP_PKEY_copy_parameters(to, from)");
    {
	EVP_PKEY *	to = (EVP_PKEY *)SvIV(ST(0));
	EVP_PKEY *	from = (EVP_PKEY *)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	RETVAL = EVP_PKEY_copy_parameters(to, from);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_PEM_get_string_X509)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::PEM_get_string_X509(x509)");
    {
	X509 *	x509 = (X509 *)SvIV(ST(0));
#line 2247 "SSLeay.xs"
     BIO *bp;
     int i;
     char buffer[8196];
#line 3625 "SSLeay.c"
#line 2251 "SSLeay.xs"
     bp = BIO_new(BIO_s_mem());
     PEM_write_bio_X509(bp,x509);
     i = BIO_read(bp,buffer,8195);
     buffer[i] = '\0';
     ST(0) = sv_newmortal();   /* Undefined to start with */
     if ( i > 0 )
         sv_setpvn( ST(0), buffer, i );
     BIO_free(bp);
#line 3635 "SSLeay.c"
    }
    XSRETURN(1);
}

XS(XS_Net__SSLeay_MD5)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Net::SSLeay::MD5(data)");
    {
#line 2263 "SSLeay.xs"
     STRLEN len;
     unsigned char md[MD5_DIGEST_LENGTH];
     unsigned char * ret;
#line 3650 "SSLeay.c"
	unsigned char *	data = (unsigned char *) SvPV( ST(0), len);
#line 2269 "SSLeay.xs"
     ret = MD5(data,len,md);
     if (ret!=NULL) {
	  XSRETURN_PV((char *) md);
     } else {
	  XSRETURN_UNDEF;
     }
#line 3659 "SSLeay.c"
    }
    XSRETURN_EMPTY;
}

#define REM_EOF "/* EOF - SSLeay.xs */"
#ifdef __cplusplus
extern "C"
#endif
XS(boot_Net__SSLeay)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXSproto("Net::SSLeay::constant", XS_Net__SSLeay_constant, file, "$$");
        newXSproto("Net::SSLeay::hello", XS_Net__SSLeay_hello, file, "");
        newXSproto("Net::SSLeay::CTX_new", XS_Net__SSLeay_CTX_new, file, "");
        newXSproto("Net::SSLeay::CTX_v2_new", XS_Net__SSLeay_CTX_v2_new, file, "");
        newXSproto("Net::SSLeay::CTX_v3_new", XS_Net__SSLeay_CTX_v3_new, file, "");
        newXSproto("Net::SSLeay::CTX_v23_new", XS_Net__SSLeay_CTX_v23_new, file, "");
        newXSproto("Net::SSLeay::CTX_free", XS_Net__SSLeay_CTX_free, file, "$");
        newXSproto("Net::SSLeay::CTX_add_session", XS_Net__SSLeay_CTX_add_session, file, "$$");
        newXSproto("Net::SSLeay::CTX_remove_session", XS_Net__SSLeay_CTX_remove_session, file, "$$");
        newXSproto("Net::SSLeay::CTX_flush_sessions", XS_Net__SSLeay_CTX_flush_sessions, file, "$$");
        newXSproto("Net::SSLeay::CTX_set_default_verify_paths", XS_Net__SSLeay_CTX_set_default_verify_paths, file, "$");
        newXSproto("Net::SSLeay::CTX_load_verify_locations", XS_Net__SSLeay_CTX_load_verify_locations, file, "$$$");
        newXSproto("Net::SSLeay::CTX_set_verify", XS_Net__SSLeay_CTX_set_verify, file, "$$$");
        newXSproto("Net::SSLeay::new", XS_Net__SSLeay_new, file, "$");
        newXSproto("Net::SSLeay::free", XS_Net__SSLeay_free, file, "$");
#if XSubPPtmpAAAA
        newXSproto("Net::SSLeay::debug", XS_Net__SSLeay_debug, file, "$");
#endif
        newXSproto("Net::SSLeay::accept", XS_Net__SSLeay_accept, file, "$");
        newXSproto("Net::SSLeay::clear", XS_Net__SSLeay_clear, file, "$");
        newXSproto("Net::SSLeay::connect", XS_Net__SSLeay_connect, file, "$");
#if XSubPPtmpAAAB
        newXSproto("Net::SSLeay::set_fd", XS_Net__SSLeay_set_fd, file, "$$");
        newXSproto("Net::SSLeay::set_rfd", XS_Net__SSLeay_set_rfd, file, "$$");
        newXSproto("Net::SSLeay::set_wfd", XS_Net__SSLeay_set_wfd, file, "$$");
#endif
#if XSubPPtmpAAAC
        newXSproto("Net::SSLeay::set_fd", XS_Net__SSLeay_set_fd, file, "$$");
        newXSproto("Net::SSLeay::set_rfd", XS_Net__SSLeay_set_rfd, file, "$$");
        newXSproto("Net::SSLeay::set_wfd", XS_Net__SSLeay_set_wfd, file, "$$");
#endif
        newXSproto("Net::SSLeay::get_fd", XS_Net__SSLeay_get_fd, file, "$");
        newXSproto("Net::SSLeay::read", XS_Net__SSLeay_read, file, "$;$");
        newXSproto("Net::SSLeay::write", XS_Net__SSLeay_write, file, "$$");
        newXSproto("Net::SSLeay::write_partial", XS_Net__SSLeay_write_partial, file, "$$$$");
        newXSproto("Net::SSLeay::use_RSAPrivateKey", XS_Net__SSLeay_use_RSAPrivateKey, file, "$$");
        newXSproto("Net::SSLeay::use_RSAPrivateKey_ASN1", XS_Net__SSLeay_use_RSAPrivateKey_ASN1, file, "$$$");
        newXSproto("Net::SSLeay::use_RSAPrivateKey_file", XS_Net__SSLeay_use_RSAPrivateKey_file, file, "$$$");
        newXSproto("Net::SSLeay::CTX_use_RSAPrivateKey_file", XS_Net__SSLeay_CTX_use_RSAPrivateKey_file, file, "$$$");
        newXSproto("Net::SSLeay::use_PrivateKey", XS_Net__SSLeay_use_PrivateKey, file, "$$");
        newXSproto("Net::SSLeay::use_PrivateKey_ASN1", XS_Net__SSLeay_use_PrivateKey_ASN1, file, "$$$$");
        newXSproto("Net::SSLeay::use_PrivateKey_file", XS_Net__SSLeay_use_PrivateKey_file, file, "$$$");
        newXSproto("Net::SSLeay::CTX_use_PrivateKey_file", XS_Net__SSLeay_CTX_use_PrivateKey_file, file, "$$$");
        newXSproto("Net::SSLeay::use_certificate", XS_Net__SSLeay_use_certificate, file, "$$");
        newXSproto("Net::SSLeay::use_certificate_ASN1", XS_Net__SSLeay_use_certificate_ASN1, file, "$$$");
        newXSproto("Net::SSLeay::use_certificate_file", XS_Net__SSLeay_use_certificate_file, file, "$$$");
        newXSproto("Net::SSLeay::CTX_use_certificate_file", XS_Net__SSLeay_CTX_use_certificate_file, file, "$$$");
        newXSproto("Net::SSLeay::state_string", XS_Net__SSLeay_state_string, file, "$");
        newXSproto("Net::SSLeay::rstate_string", XS_Net__SSLeay_rstate_string, file, "$");
        newXSproto("Net::SSLeay::state_string_long", XS_Net__SSLeay_state_string_long, file, "$");
        newXSproto("Net::SSLeay::rstate_string_long", XS_Net__SSLeay_rstate_string_long, file, "$");
        newXSproto("Net::SSLeay::get_time", XS_Net__SSLeay_get_time, file, "$");
        newXSproto("Net::SSLeay::set_time", XS_Net__SSLeay_set_time, file, "$$");
        newXSproto("Net::SSLeay::get_timeout", XS_Net__SSLeay_get_timeout, file, "$");
        newXSproto("Net::SSLeay::set_timeout", XS_Net__SSLeay_set_timeout, file, "$$");
        newXSproto("Net::SSLeay::copy_session_id", XS_Net__SSLeay_copy_session_id, file, "$$");
        newXSproto("Net::SSLeay::set_read_ahead", XS_Net__SSLeay_set_read_ahead, file, "$;$");
        newXSproto("Net::SSLeay::get_read_ahead", XS_Net__SSLeay_get_read_ahead, file, "$");
        newXSproto("Net::SSLeay::pending", XS_Net__SSLeay_pending, file, "$");
        newXSproto("Net::SSLeay::CTX_set_cipher_list", XS_Net__SSLeay_CTX_set_cipher_list, file, "$$");
        newXSproto("Net::SSLeay::get_cipher_list", XS_Net__SSLeay_get_cipher_list, file, "$$");
        newXSproto("Net::SSLeay::set_cipher_list", XS_Net__SSLeay_set_cipher_list, file, "$$");
        newXSproto("Net::SSLeay::get_cipher", XS_Net__SSLeay_get_cipher, file, "$");
        newXSproto("Net::SSLeay::get_shared_ciphers", XS_Net__SSLeay_get_shared_ciphers, file, "$$$");
        newXSproto("Net::SSLeay::get_peer_certificate", XS_Net__SSLeay_get_peer_certificate, file, "$");
        newXSproto("Net::SSLeay::set_verify", XS_Net__SSLeay_set_verify, file, "$$$");
        newXSproto("Net::SSLeay::set_bio", XS_Net__SSLeay_set_bio, file, "$$$");
        newXSproto("Net::SSLeay::get_rbio", XS_Net__SSLeay_get_rbio, file, "$");
        newXSproto("Net::SSLeay::get_wbio", XS_Net__SSLeay_get_wbio, file, "$");
        newXSproto("Net::SSLeay::SESSION_new", XS_Net__SSLeay_SESSION_new, file, "");
        newXSproto("Net::SSLeay::SESSION_print", XS_Net__SSLeay_SESSION_print, file, "$$");
        newXSproto("Net::SSLeay::SESSION_free", XS_Net__SSLeay_SESSION_free, file, "$");
        newXSproto("Net::SSLeay::i2d_SSL_SESSION", XS_Net__SSLeay_i2d_SSL_SESSION, file, "$$");
        newXSproto("Net::SSLeay::set_session", XS_Net__SSLeay_set_session, file, "$$");
        newXSproto("Net::SSLeay::d2i_SSL_SESSION", XS_Net__SSLeay_d2i_SSL_SESSION, file, "$$$");
        newXSproto("Net::SSLeay::get_session", XS_Net__SSLeay_get_session, file, "$");
        newXSproto("Net::SSLeay::get_certificate", XS_Net__SSLeay_get_certificate, file, "$");
        newXSproto("Net::SSLeay::get_SSL_CTX", XS_Net__SSLeay_get_SSL_CTX, file, "$");
        newXSproto("Net::SSLeay::ctrl", XS_Net__SSLeay_ctrl, file, "$$$$");
        newXSproto("Net::SSLeay::CTX_ctrl", XS_Net__SSLeay_CTX_ctrl, file, "$$$$");
        newXSproto("Net::SSLeay::get_options", XS_Net__SSLeay_get_options, file, "$");
        newXSproto("Net::SSLeay::set_options", XS_Net__SSLeay_set_options, file, "$$");
        newXSproto("Net::SSLeay::CTX_get_options", XS_Net__SSLeay_CTX_get_options, file, "$");
        newXSproto("Net::SSLeay::CTX_set_options", XS_Net__SSLeay_CTX_set_options, file, "$$");
        newXSproto("Net::SSLeay::CTX_sessions", XS_Net__SSLeay_CTX_sessions, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_number", XS_Net__SSLeay_CTX_sess_number, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_connect", XS_Net__SSLeay_CTX_sess_connect, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_connect_good", XS_Net__SSLeay_CTX_sess_connect_good, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_connect_renegotiate", XS_Net__SSLeay_CTX_sess_connect_renegotiate, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_accept", XS_Net__SSLeay_CTX_sess_accept, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_accept_renegotiate", XS_Net__SSLeay_CTX_sess_accept_renegotiate, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_accept_good", XS_Net__SSLeay_CTX_sess_accept_good, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_hits", XS_Net__SSLeay_CTX_sess_hits, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_cb_hits", XS_Net__SSLeay_CTX_sess_cb_hits, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_misses", XS_Net__SSLeay_CTX_sess_misses, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_timeouts", XS_Net__SSLeay_CTX_sess_timeouts, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_cache_full", XS_Net__SSLeay_CTX_sess_cache_full, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_get_cache_size", XS_Net__SSLeay_CTX_sess_get_cache_size, file, "$");
        newXSproto("Net::SSLeay::CTX_sess_set_cache_size", XS_Net__SSLeay_CTX_sess_set_cache_size, file, "$$");
        newXSproto("Net::SSLeay::want", XS_Net__SSLeay_want, file, "$");
        newXSproto("Net::SSLeay::state", XS_Net__SSLeay_state, file, "$");
        newXSproto("Net::SSLeay::BIO_f_ssl", XS_Net__SSLeay_BIO_f_ssl, file, "");
        newXSproto("Net::SSLeay::ERR_get_error", XS_Net__SSLeay_ERR_get_error, file, "");
        newXSproto("Net::SSLeay::ERR_peek_error", XS_Net__SSLeay_ERR_peek_error, file, "");
        newXSproto("Net::SSLeay::ERR_put_error", XS_Net__SSLeay_ERR_put_error, file, "$$$$$");
        newXSproto("Net::SSLeay::ERR_clear_error", XS_Net__SSLeay_ERR_clear_error, file, "");
        newXSproto("Net::SSLeay::ERR_error_string", XS_Net__SSLeay_ERR_error_string, file, "$;$");
        newXSproto("Net::SSLeay::load_error_strings", XS_Net__SSLeay_load_error_strings, file, "");
        newXSproto("Net::SSLeay::ERR_load_crypto_strings", XS_Net__SSLeay_ERR_load_crypto_strings, file, "");
        newXSproto("Net::SSLeay::SSLeay_add_ssl_algorithms", XS_Net__SSLeay_SSLeay_add_ssl_algorithms, file, "");
        newXSproto("Net::SSLeay::ERR_load_SSL_strings", XS_Net__SSLeay_ERR_load_SSL_strings, file, "");
        newXSproto("Net::SSLeay::RAND_seed", XS_Net__SSLeay_RAND_seed, file, "$");
        newXSproto("Net::SSLeay::RAND_cleanup", XS_Net__SSLeay_RAND_cleanup, file, "");
        newXSproto("Net::SSLeay::RAND_load_file", XS_Net__SSLeay_RAND_load_file, file, "$$");
        newXSproto("Net::SSLeay::RAND_write_file", XS_Net__SSLeay_RAND_write_file, file, "$");
        newXSproto("Net::SSLeay::X509_get_issuer_name", XS_Net__SSLeay_X509_get_issuer_name, file, "$");
        newXSproto("Net::SSLeay::X509_get_subject_name", XS_Net__SSLeay_X509_get_subject_name, file, "$");
        newXSproto("Net::SSLeay::X509_NAME_oneline", XS_Net__SSLeay_X509_NAME_oneline, file, "$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_get_current_cert", XS_Net__SSLeay_X509_STORE_CTX_get_current_cert, file, "$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_get_ex_data", XS_Net__SSLeay_X509_STORE_CTX_get_ex_data, file, "$$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_get_error", XS_Net__SSLeay_X509_STORE_CTX_get_error, file, "$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_get_error_depth", XS_Net__SSLeay_X509_STORE_CTX_get_error_depth, file, "$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_set_ex_data", XS_Net__SSLeay_X509_STORE_CTX_set_ex_data, file, "$$$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_set_error", XS_Net__SSLeay_X509_STORE_CTX_set_error, file, "$$");
        newXSproto("Net::SSLeay::X509_STORE_CTX_set_cert", XS_Net__SSLeay_X509_STORE_CTX_set_cert, file, "$$");
        newXSproto("Net::SSLeay::X509_get_notBefore", XS_Net__SSLeay_X509_get_notBefore, file, "$");
        newXSproto("Net::SSLeay::X509_get_notAfter", XS_Net__SSLeay_X509_get_notAfter, file, "$");
        newXSproto("Net::SSLeay::P_ASN1_UTCTIME_put2string", XS_Net__SSLeay_P_ASN1_UTCTIME_put2string, file, "$");
        newXSproto("Net::SSLeay::EVP_PKEY_copy_parameters", XS_Net__SSLeay_EVP_PKEY_copy_parameters, file, "$$");
        newXSproto("Net::SSLeay::PEM_get_string_X509", XS_Net__SSLeay_PEM_get_string_X509, file, "$");
        newXSproto("Net::SSLeay::MD5", XS_Net__SSLeay_MD5, file, "$");

    /* Initialisation Section */

#if XSubPPtmpAAAA
#endif
#if XSubPPtmpAAAB
#endif
#if XSubPPtmpAAAC
#endif
#line 3815 "SSLeay.c"

    /* End of Initialisation Section */

    XSRETURN_YES;
}

