/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */


#ifndef SWIGPYTHON
#define SWIGPYTHON
#endif

#define SWIG_PYTHON_THREADS
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#define SWIGPYTHON_BUILTIN

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__))
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__))
# else
#   define SWIGUNUSED
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif

/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif


#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
# include <math.h>
#endif

#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
# define _DEBUG 1
#else
# include <Python.h>
#endif

/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic C API SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.

  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2
#define SWIG_POINTER_NO_NULL       0x4

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/*
   Flags/methods for returning states.

   The SWIG conversion methods, as ConvertPtr, return an integer
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).

   Use the following macros/flags to set or process the returning
   states.

   In old versions of SWIG, code such as the following was usually written:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   which is the same really, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }

   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   also requires SWIG_ConvertPtr to return new result values, such as

      int SWIG_ConvertPtr(obj, ptr,...) {
        if (<obj is ok>) {
          if (<need new object>) {
            *ptr = <ptr to new allocated object>;
            return SWIG_NEWOBJ;
          } else {
            *ptr = <ptr to old object>;
            return SWIG_OLDOBJ;
          }
        } else {
          return SWIG_BADOBJ;
        }
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   SWIG errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call

      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
*/

#define SWIG_OK                    (0)
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
#  define SWIG_AddCast(r) (r)
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store information on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/*
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCmp(const char *nb, const char *tb) {
  int equiv = 1;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (equiv != 0 && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}

/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

/*
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/*
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;

  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}

/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
                            swig_module_info *end,
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      size_t l = 0;
      size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	size_t i = (l + r) >> 1;
	const char *iname = iter->types[i]->name;
	if (iname) {
	  int compare = strcmp(name, iname);
	  if (compare == 0) {
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
                     swig_module_info *end,
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }

  /* neither found a match */
  return 0;
}

/*
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  const unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/*
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    char d = *(c++);
    unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = (unsigned char)((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = (unsigned char)((d - ('a'-10)) << 4);
    else
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (unsigned char)(d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (unsigned char)(d - ('a'-10));
    else
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/*
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
#define  SWIG_UnknownError    	   -1
#define  SWIG_IOError        	   -2
#define  SWIG_RuntimeError   	   -3
#define  SWIG_IndexError     	   -4
#define  SWIG_TypeError      	   -5
#define  SWIG_DivisionByZero 	   -6
#define  SWIG_OverflowError  	   -7
#define  SWIG_SyntaxError    	   -8
#define  SWIG_ValueError     	   -9
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12
#define  SWIG_NullReferenceError   -13



/* Compatibility macros for Python 3 */
#if PY_VERSION_HEX >= 0x03000000

#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
#define PyInt_Check(x) PyLong_Check(x)
#define PyInt_AsLong(x) PyLong_AsLong(x)
#define PyInt_FromLong(x) PyLong_FromLong(x)
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
#define PyString_Check(name) PyBytes_Check(name)
#define PyString_FromString(x) PyUnicode_FromString(x)
#define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
#define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str)	
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)

#endif

#ifndef Py_TYPE
#  define Py_TYPE(op) ((op)->ob_type)
#endif

/* SWIG APIs for compatibility of both Python 2 & 3 */

#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
#else
#  define SWIG_Python_str_FromFormat PyString_FromFormat
#endif


/* Warning: This function will allocate a new string in Python 3,
 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
 */
SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str)
{
#if PY_VERSION_HEX >= 0x03030000
  return (char *)PyUnicode_AsUTF8(str);
#elif PY_VERSION_HEX >= 0x03000000
  char *newstr = 0;
  str = PyUnicode_AsUTF8String(str);
  if (str) {
    char *cstr;
    Py_ssize_t len;
    if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
      newstr = (char *) malloc(len+1);
      if (newstr)
        memcpy(newstr, cstr, len+1);
    }
    Py_XDECREF(str);
  }
  return newstr;
#else
  return PyString_AsString(str);
#endif
}

#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
#  define SWIG_Python_str_DelForPy3(x)
#else
#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
#endif


SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char *c)
{
#if PY_VERSION_HEX >= 0x03000000
  return PyUnicode_FromString(c); 
#else
  return PyString_FromString(c);
#endif
}

#ifndef PyObject_DEL
# define PyObject_DEL PyObject_Del
#endif

// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
// interface files check for it.
# define SWIGPY_USE_CAPSULE
# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)

#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#define Py_hash_t long
#endif

/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */

SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code) {
  PyObject* type = 0;
  switch(code) {
  case SWIG_MemoryError:
    type = PyExc_MemoryError;
    break;
  case SWIG_IOError:
    type = PyExc_IOError;
    break;
  case SWIG_RuntimeError:
    type = PyExc_RuntimeError;
    break;
  case SWIG_IndexError:
    type = PyExc_IndexError;
    break;
  case SWIG_TypeError:
    type = PyExc_TypeError;
    break;
  case SWIG_DivisionByZero:
    type = PyExc_ZeroDivisionError;
    break;
  case SWIG_OverflowError:
    type = PyExc_OverflowError;
    break;
  case SWIG_SyntaxError:
    type = PyExc_SyntaxError;
    break;
  case SWIG_ValueError:
    type = PyExc_ValueError;
    break;
  case SWIG_SystemError:
    type = PyExc_SystemError;
    break;
  case SWIG_AttributeError:
    type = PyExc_AttributeError;
    break;
  default:
    type = PyExc_RuntimeError;
  }
  return type;
}


SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char* mesg)
{
  PyObject *type = 0;
  PyObject *value = 0;
  PyObject *traceback = 0;

  if (PyErr_Occurred())
    PyErr_Fetch(&type, &value, &traceback);
  if (value) {
    PyObject *old_str = PyObject_Str(value);
    const char *tmp = SWIG_Python_str_AsChar(old_str);
    PyErr_Clear();
    Py_XINCREF(type);
    if (tmp)
      PyErr_Format(type, "%s %s", tmp, mesg);
    else
      PyErr_Format(type, "%s", mesg);
    SWIG_Python_str_DelForPy3(tmp);
    Py_DECREF(old_str);
    Py_DECREF(value);
  } else {
    PyErr_SetString(PyExc_RuntimeError, mesg);
  }
}

SWIGRUNTIME int
SWIG_Python_TypeErrorOccurred(PyObject *obj)
{
  PyObject *error;
  if (obj)
    return 0;
  error = PyErr_Occurred();
  return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
}

SWIGRUNTIME void
SWIG_Python_RaiseOrModifyTypeError(const char *message)
{
  if (SWIG_Python_TypeErrorOccurred(NULL)) {
    /* Use existing TypeError to preserve stacktrace and enhance with given message */
    PyObject *newvalue;
    PyObject *type = NULL, *value = NULL, *traceback = NULL;
    PyErr_Fetch(&type, &value, &traceback);
#if PY_VERSION_HEX >= 0x03000000
    newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
#else
    newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
#endif
    Py_XDECREF(value);
    PyErr_Restore(type, newvalue, traceback);
  } else {
    /* Raise TypeError using given message */
    PyErr_SetString(PyExc_TypeError, message);
  }
}

#if defined(SWIG_PYTHON_NO_THREADS)
#  if defined(SWIG_PYTHON_THREADS)
#    undef SWIG_PYTHON_THREADS
#  endif
#endif
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
#    define SWIG_PYTHON_USE_GIL
#  endif
#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
#    endif
#    ifdef __cplusplus /* C++ code */
       class SWIG_Python_Thread_Block {
         bool status;
         PyGILState_STATE state;
       public:
         void end() { if (status) { PyGILState_Release(state); status = false;} }
         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
         ~SWIG_Python_Thread_Block() { end(); }
       };
       class SWIG_Python_Thread_Allow {
         bool status;
         PyThreadState *save;
       public:
         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
         ~SWIG_Python_Thread_Allow() { end(); }
       };
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
#    else /* C code */
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
#    endif
#  else /* Old thread way, not implemented, user must provide it */
#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
#      define SWIG_PYTHON_INITIALIZE_THREADS
#    endif
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#    endif
#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
#      define SWIG_PYTHON_THREAD_END_BLOCK
#    endif
#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
#    endif
#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
#      define SWIG_PYTHON_THREAD_END_ALLOW
#    endif
#  endif
#else /* No thread support */
#  define SWIG_PYTHON_INITIALIZE_THREADS
#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#  define SWIG_PYTHON_THREAD_END_BLOCK
#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
#  define SWIG_PYTHON_THREAD_END_ALLOW
#endif

/* -----------------------------------------------------------------------------
 * Python API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

/* -----------------------------------------------------------------------------
 * Constant declarations
 * ----------------------------------------------------------------------------- */

/* Constant Types */
#define SWIG_PY_POINTER 4
#define SWIG_PY_BINARY  5

/* Constant information structure */
typedef struct swig_const_info {
  int type;
  const char *name;
  long lvalue;
  double dvalue;
  void   *pvalue;
  swig_type_info **ptype;
} swig_const_info;

#ifdef __cplusplus
}
#endif


/* -----------------------------------------------------------------------------
 * pyrun.swg
 *
 * This file contains the runtime support for Python modules
 * and includes code for managing global variables and pointer
 * type checking.
 *
 * ----------------------------------------------------------------------------- */

#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
# error "This version of SWIG only supports Python >= 2.7"
#endif

#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
# error "This version of SWIG only supports Python 3 >= 3.2"
#endif

/* Common SWIG API */

/* for raw pointers */
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)

#ifdef SWIGPYTHON_BUILTIN
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
#else
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#endif

#define SWIG_InternalNewPointerObj(ptr, type, flags)	SWIG_Python_NewPointerObj(NULL, ptr, type, flags)

#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
#define swig_owntype                                    int

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)


/* Runtime API */

#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)

#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
#define SWIG_fail                        		goto fail					   


/* Runtime API implementation */

/* Error manipulation */

SWIGINTERN void 
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
  PyErr_SetObject(errtype, obj);
  Py_DECREF(obj);
  SWIG_PYTHON_THREAD_END_BLOCK;
}

SWIGINTERN void 
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
  PyErr_SetString(errtype, msg);
  SWIG_PYTHON_THREAD_END_BLOCK;
}

#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)

/* Set a constant value */

#if defined(SWIGPYTHON_BUILTIN)

SWIGINTERN void
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
  PyObject *s = PyString_InternFromString(key);
  PyList_Append(seq, s);
  Py_DECREF(s);
}

SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {   
  PyDict_SetItemString(d, name, obj);
  Py_DECREF(obj);
  if (public_interface)
    SwigPyBuiltin_AddPublicSymbol(public_interface, name);
}

#else

SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
  PyDict_SetItemString(d, name, obj);
  Py_DECREF(obj);                            
}

#endif

/* Append a value to the result obj */

SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
  if (!result) {
    result = obj;
  } else if (result == Py_None) {
    Py_DECREF(result);
    result = obj;
  } else {
    if (!PyList_Check(result)) {
      PyObject *o2 = result;
      result = PyList_New(1);
      PyList_SetItem(result, 0, o2);
    }
    PyList_Append(result,obj);
    Py_DECREF(obj);
  }
  return result;
}

/* Unpack the argument tuple */

SWIGINTERN Py_ssize_t
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
  if (!args) {
    if (!min && !max) {
      return 1;
    } else {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
		   name, (min == max ? "" : "at least "), (int)min);
      return 0;
    }
  }  
  if (!PyTuple_Check(args)) {
    if (min <= 1 && max >= 1) {
      Py_ssize_t i;
      objs[0] = args;
      for (i = 1; i < max; ++i) {
	objs[i] = 0;
      }
      return 2;
    }
    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
    return 0;
  } else {
    Py_ssize_t l = PyTuple_GET_SIZE(args);
    if (l < min) {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
		   name, (min == max ? "" : "at least "), (int)min, (int)l);
      return 0;
    } else if (l > max) {
      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
		   name, (min == max ? "" : "at most "), (int)max, (int)l);
      return 0;
    } else {
      Py_ssize_t i;
      for (i = 0; i < l; ++i) {
	objs[i] = PyTuple_GET_ITEM(args, i);
      }
      for (; l < max; ++l) {
	objs[l] = 0;
      }
      return i + 1;
    }    
  }
}

SWIGINTERN int
SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
  int no_kwargs = 1;
  if (kwargs) {
    assert(PyDict_Check(kwargs));
    if (PyDict_Size(kwargs) > 0) {
      PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
      no_kwargs = 0;
    }
  }
  return no_kwargs;
}

/* A functor is a function object with one single object argument */
#define SWIG_Python_CallFunctor(functor, obj)	        PyObject_CallFunctionObjArgs(functor, obj, NULL);

/*
  Helper for static pointer initialization for both C and C++ code, for example
  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
*/
#ifdef __cplusplus
#define SWIG_STATIC_POINTER(var)  var
#else
#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
#endif

/* -----------------------------------------------------------------------------
 * Pointer declarations
 * ----------------------------------------------------------------------------- */

/* Flags for new pointer objects */
#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)

#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)

#define SWIG_BUILTIN_TP_INIT	    (SWIG_POINTER_OWN << 2)
#define SWIG_BUILTIN_INIT	    (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)

#ifdef __cplusplus
extern "C" {
#endif

/* The python void return value */

SWIGRUNTIMEINLINE PyObject * 
SWIG_Py_Void(void)
{
  PyObject *none = Py_None;
  Py_INCREF(none);
  return none;
}

/* SwigPyClientData */

typedef struct {
  PyObject *klass;
  PyObject *newraw;
  PyObject *newargs;
  PyObject *destroy;
  int delargs;
  int implicitconv;
  PyTypeObject *pytype;
} SwigPyClientData;

SWIGRUNTIMEINLINE int 
SWIG_Python_CheckImplicit(swig_type_info *ty)
{
  SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
  int fail = data ? data->implicitconv : 0;
  if (fail)
    PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
  return fail;
}

SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info *desc) {
  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
  PyObject *klass = data ? data->klass : 0;
  return (klass ? klass : PyExc_RuntimeError);
}


SWIGRUNTIME SwigPyClientData * 
SwigPyClientData_New(PyObject* obj)
{
  if (!obj) {
    return 0;
  } else {
    SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
    /* the klass element */
    data->klass = obj;
    Py_INCREF(data->klass);
    /* the newraw method and newargs arguments used to create a new raw instance */
    if (PyClass_Check(obj)) {
      data->newraw = 0;
      data->newargs = obj;
      Py_INCREF(obj);
    } else {
      data->newraw = PyObject_GetAttrString(data->klass, "__new__");
      if (data->newraw) {
	Py_INCREF(data->newraw);
	data->newargs = PyTuple_New(1);
	PyTuple_SetItem(data->newargs, 0, obj);
      } else {
	data->newargs = obj;
      }
      Py_INCREF(data->newargs);
    }
    /* the destroy method, aka as the C++ delete method */
    data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
    if (PyErr_Occurred()) {
      PyErr_Clear();
      data->destroy = 0;
    }
    if (data->destroy) {
      int flags;
      Py_INCREF(data->destroy);
      flags = PyCFunction_GET_FLAGS(data->destroy);
      data->delargs = !(flags & (METH_O));
    } else {
      data->delargs = 0;
    }
    data->implicitconv = 0;
    data->pytype = 0;
    return data;
  }
}

SWIGRUNTIME void 
SwigPyClientData_Del(SwigPyClientData *data) {
  Py_XDECREF(data->newraw);
  Py_XDECREF(data->newargs);
  Py_XDECREF(data->destroy);
}

/* =============== SwigPyObject =====================*/

typedef struct {
  PyObject_HEAD
  void *ptr;
  swig_type_info *ty;
  int own;
  PyObject *next;
#ifdef SWIGPYTHON_BUILTIN
  PyObject *dict;
#endif
} SwigPyObject;


#ifdef SWIGPYTHON_BUILTIN

SWIGRUNTIME PyObject *
SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
{
  SwigPyObject *sobj = (SwigPyObject *)v;

  if (!sobj->dict)
    sobj->dict = PyDict_New();

  Py_INCREF(sobj->dict);
  return sobj->dict;
}

#endif

SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject *v)
{
  return PyLong_FromVoidPtr(v->ptr);
}

SWIGRUNTIME PyObject *
SwigPyObject_format(const char* fmt, SwigPyObject *v)
{
  PyObject *res = NULL;
  PyObject *args = PyTuple_New(1);
  if (args) {
    if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
      PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
      if (ofmt) {
#if PY_VERSION_HEX >= 0x03000000
	res = PyUnicode_Format(ofmt,args);
#else
	res = PyString_Format(ofmt,args);
#endif
	Py_DECREF(ofmt);
      }
      Py_DECREF(args);
    }
  }
  return res;
}

SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject *v)
{
  return SwigPyObject_format("%o",v);
}

SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject *v)
{
  return SwigPyObject_format("%x",v);
}

SWIGRUNTIME PyObject *
SwigPyObject_repr(SwigPyObject *v)
{
  const char *name = SWIG_TypePrettyName(v->ty);
  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
  if (v->next) {
    PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
# if PY_VERSION_HEX >= 0x03000000
    PyObject *joined = PyUnicode_Concat(repr, nrep);
    Py_DecRef(repr);
    Py_DecRef(nrep);
    repr = joined;
# else
    PyString_ConcatAndDel(&repr,nrep);
# endif
  }
  return repr;  
}

/* We need a version taking two PyObject* parameters so it's a valid
 * PyCFunction to use in swigobject_methods[]. */
SWIGRUNTIME PyObject *
SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
{
  return SwigPyObject_repr((SwigPyObject*)v);
}

SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{
  void *i = v->ptr;
  void *j = w->ptr;
  return (i < j) ? -1 : ((i > j) ? 1 : 0);
}

/* Added for Python 3.x, would it also be useful for Python 2.x? */
SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
{
  PyObject* res;
  if( op != Py_EQ && op != Py_NE ) {
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
  }
  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
  return res;  
}


SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);

#ifdef SWIGPYTHON_BUILTIN
static swig_type_info *SwigPyObject_stype = 0;
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
    SwigPyClientData *cd;
    assert(SwigPyObject_stype);
    cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
    assert(cd);
    assert(cd->pytype);
    return cd->pytype;
}
#else
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
  return type;
}
#endif

SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject *op) {
#ifdef SWIGPYTHON_BUILTIN
  PyTypeObject *target_tp = SwigPyObject_type();
  if (PyType_IsSubtype(op->ob_type, target_tp))
    return 1;
  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
#else
  return (Py_TYPE(op) == SwigPyObject_type())
    || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
#endif
}

SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);

SWIGRUNTIME void
SwigPyObject_dealloc(PyObject *v)
{
  SwigPyObject *sobj = (SwigPyObject *) v;
  PyObject *next = sobj->next;
  if (sobj->own == SWIG_POINTER_OWN) {
    swig_type_info *ty = sobj->ty;
    SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
    PyObject *destroy = data ? data->destroy : 0;
    if (destroy) {
      /* destroy is always a VARARGS method */
      PyObject *res;

      /* PyObject_CallFunction() has the potential to silently drop
         the active exception.  In cases of unnamed temporary
         variable or where we just finished iterating over a generator
         StopIteration will be active right now, and this needs to
         remain true upon return from SwigPyObject_dealloc.  So save
         and restore. */
      
      PyObject *type = NULL, *value = NULL, *traceback = NULL;
      PyErr_Fetch(&type, &value, &traceback);

      if (data->delargs) {
        /* we need to create a temporary object to carry the destroy operation */
        PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
        res = SWIG_Python_CallFunctor(destroy, tmp);
        Py_DECREF(tmp);
      } else {
        PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
        PyObject *mself = PyCFunction_GET_SELF(destroy);
        res = ((*meth)(mself, v));
      }
      if (!res)
        PyErr_WriteUnraisable(destroy);

      PyErr_Restore(type, value, traceback);

      Py_XDECREF(res);
    } 
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
    else {
      const char *name = SWIG_TypePrettyName(ty);
      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
    }
#endif
  } 
  Py_XDECREF(next);
  PyObject_DEL(v);
}

SWIGRUNTIME PyObject* 
SwigPyObject_append(PyObject* v, PyObject* next)
{
  SwigPyObject *sobj = (SwigPyObject *) v;
  if (!SwigPyObject_Check(next)) {
    PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
    return NULL;
  }
  sobj->next = next;
  Py_INCREF(next);
  return SWIG_Py_Void();
}

SWIGRUNTIME PyObject* 
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
  SwigPyObject *sobj = (SwigPyObject *) v;
  if (sobj->next) {    
    Py_INCREF(sobj->next);
    return sobj->next;
  } else {
    return SWIG_Py_Void();
  }
}

SWIGINTERN PyObject*
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
  SwigPyObject *sobj = (SwigPyObject *)v;
  sobj->own = 0;
  return SWIG_Py_Void();
}

SWIGINTERN PyObject*
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
  SwigPyObject *sobj = (SwigPyObject *)v;
  sobj->own = SWIG_POINTER_OWN;
  return SWIG_Py_Void();
}

SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args)
{
  PyObject *val = 0;
  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
    return NULL;
  } else {
    SwigPyObject *sobj = (SwigPyObject *)v;
    PyObject *obj = PyBool_FromLong(sobj->own);
    if (val) {
      if (PyObject_IsTrue(val)) {
        SwigPyObject_acquire(v,args);
      } else {
        SwigPyObject_disown(v,args);
      }
    } 
    return obj;
  }
}

static PyMethodDef
swigobject_methods[] = {
  {"disown",  SwigPyObject_disown,  METH_NOARGS,  "releases ownership of the pointer"},
  {"acquire", SwigPyObject_acquire, METH_NOARGS,  "acquires ownership of the pointer"},
  {"own",     SwigPyObject_own,     METH_VARARGS, "returns/sets ownership of the pointer"},
  {"append",  SwigPyObject_append,  METH_O,       "appends another 'this' object"},
  {"next",    SwigPyObject_next,    METH_NOARGS,  "returns the next 'this' object"},
  {"__repr__",SwigPyObject_repr2,   METH_NOARGS,  "returns object representation"},
  {0, 0, 0, 0}  
};

SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void) {
  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";

  static PyNumberMethods SwigPyObject_as_number = {
    (binaryfunc)0, /*nb_add*/
    (binaryfunc)0, /*nb_subtract*/
    (binaryfunc)0, /*nb_multiply*/
    /* nb_divide removed in Python 3 */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc)0, /*nb_divide*/
#endif
    (binaryfunc)0, /*nb_remainder*/
    (binaryfunc)0, /*nb_divmod*/
    (ternaryfunc)0,/*nb_power*/
    (unaryfunc)0,  /*nb_negative*/
    (unaryfunc)0,  /*nb_positive*/
    (unaryfunc)0,  /*nb_absolute*/
    (inquiry)0,    /*nb_nonzero*/
    0,		   /*nb_invert*/
    0,		   /*nb_lshift*/
    0,		   /*nb_rshift*/
    0,		   /*nb_and*/
    0,		   /*nb_xor*/
    0,		   /*nb_or*/
#if PY_VERSION_HEX < 0x03000000
    0,   /*nb_coerce*/
#endif
    (unaryfunc)SwigPyObject_long, /*nb_int*/
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc)SwigPyObject_long, /*nb_long*/
#else
    0, /*nb_reserved*/
#endif
    (unaryfunc)0,                 /*nb_float*/
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
    (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
#endif
#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
#else
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
#endif
  };

  static PyTypeObject swigpyobject_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
#if PY_VERSION_HEX >= 0x03000000
      PyVarObject_HEAD_INIT(NULL, 0)
#else
      PyObject_HEAD_INIT(NULL)
      0,                                    /* ob_size */
#endif
      "SwigPyObject",                       /* tp_name */
      sizeof(SwigPyObject),                 /* tp_basicsize */
      0,                                    /* tp_itemsize */
      (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
      0,                                    /* tp_print */
      (getattrfunc)0,                       /* tp_getattr */
      (setattrfunc)0,                       /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
      0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
#else
      (cmpfunc)SwigPyObject_compare,        /* tp_compare */
#endif
      (reprfunc)SwigPyObject_repr,          /* tp_repr */
      &SwigPyObject_as_number,              /* tp_as_number */
      0,                                    /* tp_as_sequence */
      0,                                    /* tp_as_mapping */
      (hashfunc)0,                          /* tp_hash */
      (ternaryfunc)0,                       /* tp_call */
      0,                                    /* tp_str */
      PyObject_GenericGetAttr,              /* tp_getattro */
      0,                                    /* tp_setattro */
      0,                                    /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
      swigobject_doc,                       /* tp_doc */
      0,                                    /* tp_traverse */
      0,                                    /* tp_clear */
      (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
      0,                                    /* tp_weaklistoffset */
      0,                                    /* tp_iter */
      0,                                    /* tp_iternext */
      swigobject_methods,                   /* tp_methods */
      0,                                    /* tp_members */
      0,                                    /* tp_getset */
      0,                                    /* tp_base */
      0,                                    /* tp_dict */
      0,                                    /* tp_descr_get */
      0,                                    /* tp_descr_set */
      0,                                    /* tp_dictoffset */
      0,                                    /* tp_init */
      0,                                    /* tp_alloc */
      0,                                    /* tp_new */
      0,                                    /* tp_free */
      0,                                    /* tp_is_gc */
      0,                                    /* tp_bases */
      0,                                    /* tp_mro */
      0,                                    /* tp_cache */
      0,                                    /* tp_subclasses */
      0,                                    /* tp_weaklist */
      0,                                    /* tp_del */
      0,                                    /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
      0,                                    /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
      0,                                    /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
      0,                                    /* tp_print */
#endif
#ifdef COUNT_ALLOCS
      0,                                    /* tp_allocs */
      0,                                    /* tp_frees */
      0,                                    /* tp_maxalloc */
      0,                                    /* tp_prev */
      0                                     /* tp_next */
#endif
    };
    swigpyobject_type = tmp;
    type_init = 1;
    if (PyType_Ready(&swigpyobject_type) < 0)
      return NULL;
  }
  return &swigpyobject_type;
}

SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
{
  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
  if (sobj) {
    sobj->ptr  = ptr;
    sobj->ty   = ty;
    sobj->own  = own;
    sobj->next = 0;
  }
  return (PyObject *)sobj;
}

/* -----------------------------------------------------------------------------
 * Implements a simple Swig Packed type, and use it instead of string
 * ----------------------------------------------------------------------------- */

typedef struct {
  PyObject_HEAD
  void *pack;
  swig_type_info *ty;
  size_t size;
} SwigPyPacked;

SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked *v)
{
  char result[SWIG_BUFFER_SIZE];
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
    return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
  } else {
    return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
  }  
}

SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked *v)
{
  char result[SWIG_BUFFER_SIZE];
  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
    return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
  } else {
    return SWIG_Python_str_FromChar(v->ty->name);
  }  
}

SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
{
  size_t i = v->size;
  size_t j = w->size;
  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
  return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size);
}

SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);

SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void) {
  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
  return type;
}

SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject *op) {
  return ((op)->ob_type == SwigPyPacked_TypeOnce()) 
    || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
}

SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject *v)
{
  if (SwigPyPacked_Check(v)) {
    SwigPyPacked *sobj = (SwigPyPacked *) v;
    free(sobj->pack);
  }
  PyObject_DEL(v);
}

SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void) {
  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
  static PyTypeObject swigpypacked_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
#if PY_VERSION_HEX>=0x03000000
      PyVarObject_HEAD_INIT(NULL, 0)
#else
      PyObject_HEAD_INIT(NULL)
      0,                                    /* ob_size */
#endif
      "SwigPyPacked",                       /* tp_name */
      sizeof(SwigPyPacked),                 /* tp_basicsize */
      0,                                    /* tp_itemsize */
      (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
      0,                                    /* tp_print */
      (getattrfunc)0,                       /* tp_getattr */
      (setattrfunc)0,                       /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000
      0, /* tp_reserved in 3.0.1 */
#else
      (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
#endif
      (reprfunc)SwigPyPacked_repr,          /* tp_repr */
      0,                                    /* tp_as_number */
      0,                                    /* tp_as_sequence */
      0,                                    /* tp_as_mapping */
      (hashfunc)0,                          /* tp_hash */
      (ternaryfunc)0,                       /* tp_call */
      (reprfunc)SwigPyPacked_str,           /* tp_str */
      PyObject_GenericGetAttr,              /* tp_getattro */
      0,                                    /* tp_setattro */
      0,                                    /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT,                   /* tp_flags */
      swigpacked_doc,                       /* tp_doc */
      0,                                    /* tp_traverse */
      0,                                    /* tp_clear */
      0,                                    /* tp_richcompare */
      0,                                    /* tp_weaklistoffset */
      0,                                    /* tp_iter */
      0,                                    /* tp_iternext */
      0,                                    /* tp_methods */
      0,                                    /* tp_members */
      0,                                    /* tp_getset */
      0,                                    /* tp_base */
      0,                                    /* tp_dict */
      0,                                    /* tp_descr_get */
      0,                                    /* tp_descr_set */
      0,                                    /* tp_dictoffset */
      0,                                    /* tp_init */
      0,                                    /* tp_alloc */
      0,                                    /* tp_new */
      0,                                    /* tp_free */
      0,                                    /* tp_is_gc */
      0,                                    /* tp_bases */
      0,                                    /* tp_mro */
      0,                                    /* tp_cache */
      0,                                    /* tp_subclasses */
      0,                                    /* tp_weaklist */
      0,                                    /* tp_del */
      0,                                    /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
      0,                                    /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
      0,                                    /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
      0,                                    /* tp_print */
#endif
#ifdef COUNT_ALLOCS
      0,                                    /* tp_allocs */
      0,                                    /* tp_frees */
      0,                                    /* tp_maxalloc */
      0,                                    /* tp_prev */
      0                                     /* tp_next */
#endif
    };
    swigpypacked_type = tmp;
    type_init = 1;
    if (PyType_Ready(&swigpypacked_type) < 0)
      return NULL;
  }
  return &swigpypacked_type;
}

SWIGRUNTIME PyObject *
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
{
  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
  if (sobj) {
    void *pack = malloc(size);
    if (pack) {
      memcpy(pack, ptr, size);
      sobj->pack = pack;
      sobj->ty   = ty;
      sobj->size = size;
    } else {
      PyObject_DEL((PyObject *) sobj);
      sobj = 0;
    }
  }
  return (PyObject *) sobj;
}

SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
{
  if (SwigPyPacked_Check(obj)) {
    SwigPyPacked *sobj = (SwigPyPacked *)obj;
    if (sobj->size != size) return 0;
    memcpy(ptr, sobj->pack, size);
    return sobj->ty;
  } else {
    return 0;
  }
}

/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

static PyObject *Swig_This_global = NULL;

SWIGRUNTIME PyObject *
SWIG_This(void)
{
  if (Swig_This_global == NULL)
    Swig_This_global = SWIG_Python_str_FromChar("this");
  return Swig_This_global;
}

/* #define SWIG_PYTHON_SLOW_GETSET_THIS */

/* TODO: I don't know how to implement the fast getset in Python 3 right now */
#if PY_VERSION_HEX>=0x03000000
#define SWIG_PYTHON_SLOW_GETSET_THIS 
#endif

SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject *pyobj) 
{
  PyObject *obj;

  if (SwigPyObject_Check(pyobj))
    return (SwigPyObject *) pyobj;

#ifdef SWIGPYTHON_BUILTIN
  (void)obj;
# ifdef PyWeakref_CheckProxy
  if (PyWeakref_CheckProxy(pyobj)) {
    pyobj = PyWeakref_GET_OBJECT(pyobj);
    if (pyobj && SwigPyObject_Check(pyobj))
      return (SwigPyObject*) pyobj;
  }
# endif
  return NULL;
#else

  obj = 0;

#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
  if (PyInstance_Check(pyobj)) {
    obj = _PyInstance_Lookup(pyobj, SWIG_This());      
  } else {
    PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
    if (dictptr != NULL) {
      PyObject *dict = *dictptr;
      obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
    } else {
#ifdef PyWeakref_CheckProxy
      if (PyWeakref_CheckProxy(pyobj)) {
	PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
	return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
      }
#endif
      obj = PyObject_GetAttr(pyobj,SWIG_This());
      if (obj) {
	Py_DECREF(obj);
      } else {
	if (PyErr_Occurred()) PyErr_Clear();
	return 0;
      }
    }
  }
#else
  obj = PyObject_GetAttr(pyobj,SWIG_This());
  if (obj) {
    Py_DECREF(obj);
  } else {
    if (PyErr_Occurred()) PyErr_Clear();
    return 0;
  }
#endif
  if (obj && !SwigPyObject_Check(obj)) {
    /* a PyObject is called 'this', try to get the 'real this'
       SwigPyObject from it */ 
    return SWIG_Python_GetSwigThis(obj);
  }
  return (SwigPyObject *)obj;
#endif
}

/* Acquire a pointer value */

SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
  if (own == SWIG_POINTER_OWN) {
    SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
    if (sobj) {
      int oldown = sobj->own;
      sobj->own = own;
      return oldown;
    }
  }
  return 0;
}

/* Convert a pointer value */

SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
  int res;
  SwigPyObject *sobj;
  int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;

  if (!obj)
    return SWIG_ERROR;
  if (obj == Py_None && !implicit_conv) {
    if (ptr)
      *ptr = 0;
    return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
  }

  res = SWIG_ERROR;

  sobj = SWIG_Python_GetSwigThis(obj);
  if (own)
    *own = 0;
  while (sobj) {
    void *vptr = sobj->ptr;
    if (ty) {
      swig_type_info *to = sobj->ty;
      if (to == ty) {
        /* no type cast needed */
        if (ptr) *ptr = vptr;
        break;
      } else {
        swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
        if (!tc) {
          sobj = (SwigPyObject *)sobj->next;
        } else {
          if (ptr) {
            int newmemory = 0;
            *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
            if (newmemory == SWIG_CAST_NEW_MEMORY) {
              assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
              if (own)
                *own = *own | SWIG_CAST_NEW_MEMORY;
            }
          }
          break;
        }
      }
    } else {
      if (ptr) *ptr = vptr;
      break;
    }
  }
  if (sobj) {
    if (own)
      *own = *own | sobj->own;
    if (flags & SWIG_POINTER_DISOWN) {
      sobj->own = 0;
    }
    res = SWIG_OK;
  } else {
    if (implicit_conv) {
      SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
      if (data && !data->implicitconv) {
        PyObject *klass = data->klass;
        if (klass) {
          PyObject *impconv;
          data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
          impconv = SWIG_Python_CallFunctor(klass, obj);
          data->implicitconv = 0;
          if (PyErr_Occurred()) {
            PyErr_Clear();
            impconv = 0;
          }
          if (impconv) {
            SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
            if (iobj) {
              void *vptr;
              res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
              if (SWIG_IsOK(res)) {
                if (ptr) {
                  *ptr = vptr;
                  /* transfer the ownership to 'ptr' */
                  iobj->own = 0;
                  res = SWIG_AddCast(res);
                  res = SWIG_AddNewMask(res);
                } else {
                  res = SWIG_AddCast(res);		    
                }
              }
            }
            Py_DECREF(impconv);
          }
        }
      }
      if (!SWIG_IsOK(res) && obj == Py_None) {
        if (ptr)
          *ptr = 0;
        if (PyErr_Occurred())
          PyErr_Clear();
        res = SWIG_OK;
      }
    }
  }
  return res;
}

/* Convert a function ptr value */

SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
  if (!PyCFunction_Check(obj)) {
    return SWIG_ConvertPtr(obj, ptr, ty, 0);
  } else {
    void *vptr = 0;
    swig_cast_info *tc;

    /* here we get the method pointer for callbacks */
    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
    if (desc)
      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
    if (!desc)
      return SWIG_ERROR;
    tc = SWIG_TypeCheck(desc,ty);
    if (tc) {
      int newmemory = 0;
      *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
      assert(!newmemory); /* newmemory handling not yet implemented */
    } else {
      return SWIG_ERROR;
    }
    return SWIG_OK;
  }
}

/* Convert a packed pointer value */

SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
  if (!to) return SWIG_ERROR;
  if (ty) {
    if (to != ty) {
      /* check type cast? */
      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
      if (!tc) return SWIG_ERROR;
    }
  }
  return SWIG_OK;
}  

/* -----------------------------------------------------------------------------
 * Create a new pointer object
 * ----------------------------------------------------------------------------- */

/*
  Create a new instance object, without calling __init__, and set the
  'this' attribute.
*/

SWIGRUNTIME PyObject* 
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
{
  PyObject *inst = 0;
  PyObject *newraw = data->newraw;
  if (newraw) {
    inst = PyObject_Call(newraw, data->newargs, NULL);
    if (inst) {
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
      PyObject **dictptr = _PyObject_GetDictPtr(inst);
      if (dictptr != NULL) {
	PyObject *dict = *dictptr;
	if (dict == NULL) {
	  dict = PyDict_New();
	  *dictptr = dict;
	  PyDict_SetItem(dict, SWIG_This(), swig_this);
	}
      }
#else
      if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
        Py_DECREF(inst);
        inst = 0;
      }
#endif
    }
  } else {
#if PY_VERSION_HEX >= 0x03000000
    PyObject *empty_args = PyTuple_New(0);
    if (empty_args) {
      PyObject *empty_kwargs = PyDict_New();
      if (empty_kwargs) {
        inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
        Py_DECREF(empty_kwargs);
        if (inst) {
          if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
            Py_DECREF(inst);
            inst = 0;
          } else {
            Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
          }
        }
      }
      Py_DECREF(empty_args);
    }
#else
    PyObject *dict = PyDict_New();
    if (dict) {
      PyDict_SetItem(dict, SWIG_This(), swig_this);
      inst = PyInstance_NewRaw(data->newargs, dict);
      Py_DECREF(dict);
    }
#endif
  }
  return inst;
}

SWIGRUNTIME int
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
{
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
  PyObject **dictptr = _PyObject_GetDictPtr(inst);
  if (dictptr != NULL) {
    PyObject *dict = *dictptr;
    if (dict == NULL) {
      dict = PyDict_New();
      *dictptr = dict;
    }
    return PyDict_SetItem(dict, SWIG_This(), swig_this);
  }
#endif
  return PyObject_SetAttr(inst, SWIG_This(), swig_this);
} 


SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject *args) {
  PyObject *obj[2];
  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
    return NULL;
  } else {
    SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
    if (sthis) {
      SwigPyObject_append((PyObject*) sthis, obj[1]);
    } else {
      if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0)
        return NULL;
    }
    return SWIG_Py_Void();
  }
}

/* Create a new pointer object */

SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
  SwigPyClientData *clientdata;
  PyObject * robj;
  int own;

  if (!ptr)
    return SWIG_Py_Void();

  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
  if (clientdata && clientdata->pytype) {
    SwigPyObject *newobj;
    if (flags & SWIG_BUILTIN_TP_INIT) {
      newobj = (SwigPyObject*) self;
      if (newobj->ptr) {
        PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
        while (newobj->next)
	  newobj = (SwigPyObject *) newobj->next;
        newobj->next = next_self;
        newobj = (SwigPyObject *)next_self;
#ifdef SWIGPYTHON_BUILTIN
        newobj->dict = 0;
#endif
      }
    } else {
      newobj = PyObject_New(SwigPyObject, clientdata->pytype);
#ifdef SWIGPYTHON_BUILTIN
      newobj->dict = 0;
#endif
    }
    if (newobj) {
      newobj->ptr = ptr;
      newobj->ty = type;
      newobj->own = own;
      newobj->next = 0;
      return (PyObject*) newobj;
    }
    return SWIG_Py_Void();
  }

  assert(!(flags & SWIG_BUILTIN_TP_INIT));

  robj = SwigPyObject_New(ptr, type, own);
  if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
    PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
    Py_DECREF(robj);
    robj = inst;
  }
  return robj;
}

/* Create a new packed object */

SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
}

/* -----------------------------------------------------------------------------*
 *  Get type list 
 * -----------------------------------------------------------------------------*/

#ifdef SWIG_LINK_RUNTIME
void *SWIG_ReturnGlobalTypeList(void *);
#endif

SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
  static void *type_pointer = (void *)0;
  /* first check if module already created */
  if (!type_pointer) {
#ifdef SWIG_LINK_RUNTIME
    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
#else
    type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
    if (PyErr_Occurred()) {
      PyErr_Clear();
      type_pointer = (void *)0;
    }
#endif
  }
  return (swig_module_info *) type_pointer;
}

SWIGRUNTIME void
SWIG_Python_DestroyModule(PyObject *obj)
{
  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
  swig_type_info **types = swig_module->types;
  size_t i;
  for (i =0; i < swig_module->size; ++i) {
    swig_type_info *ty = types[i];
    if (ty->owndata) {
      SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
      if (data) SwigPyClientData_Del(data);
    }
  }
  Py_DECREF(SWIG_This());
  Swig_This_global = NULL;
}

SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info *swig_module) {
#if PY_VERSION_HEX >= 0x03000000
 /* Add a dummy module object into sys.modules */
  PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
#else
  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
  PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
#endif
  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
  if (pointer && module) {
    PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
  } else {
    Py_XDECREF(pointer);
  }
}

/* The python cached type query */
SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void) {
  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
  return cache;
}

SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char *type)
{
  PyObject *cache = SWIG_Python_TypeCache();
  PyObject *key = SWIG_Python_str_FromChar(type); 
  PyObject *obj = PyDict_GetItem(cache, key);
  swig_type_info *descriptor;
  if (obj) {
    descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
  } else {
    swig_module_info *swig_module = SWIG_GetModule(0);
    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
    if (descriptor) {
      obj = PyCapsule_New((void*) descriptor, NULL, NULL);
      PyDict_SetItem(cache, key, obj);
      Py_DECREF(obj);
    }
  }
  Py_DECREF(key);
  return descriptor;
}

/* 
   For backward compatibility only
*/
#define SWIG_POINTER_EXCEPTION  0
#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)

SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char* mesg, int infront)
{  
  if (PyErr_Occurred()) {
    PyObject *type = 0;
    PyObject *value = 0;
    PyObject *traceback = 0;
    PyErr_Fetch(&type, &value, &traceback);
    if (value) {
      PyObject *old_str = PyObject_Str(value);
      const char *tmp = SWIG_Python_str_AsChar(old_str);
      const char *errmesg = tmp ? tmp : "Invalid error message";
      Py_XINCREF(type);
      PyErr_Clear();
      if (infront) {
	PyErr_Format(type, "%s %s", mesg, errmesg);
      } else {
	PyErr_Format(type, "%s %s", errmesg, mesg);
      }
      SWIG_Python_str_DelForPy3(tmp);
      Py_DECREF(old_str);
    }
    return 1;
  } else {
    return 0;
  }
}
  
SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)
{
  if (PyErr_Occurred()) {
    /* add information about failing argument */
    char mesg[256];
    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
    return SWIG_Python_AddErrMesg(mesg, 1);
  } else {
    return 0;
  }
}

SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject *self)
{
  SwigPyObject *v = (SwigPyObject *)self;
  swig_type_info *ty = v ? v->ty : 0;
  return ty ? ty->str : "";
}

SWIGRUNTIME void
SWIG_Python_TypeError(const char *type, PyObject *obj)
{
  if (type) {
#if defined(SWIG_COBJECT_TYPES)
    if (obj && SwigPyObject_Check(obj)) {
      const char *otype = (const char *) SwigPyObject_GetDesc(obj);
      if (otype) {
	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
		     type, otype);
	return;
      }
    } else 
#endif      
    {
      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
      if (otype) {
	PyObject *str = PyObject_Str(obj);
	const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
	if (cstr) {
	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
		       type, otype, cstr);
          SWIG_Python_str_DelForPy3(cstr);
	} else {
	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
		       type, otype);
	}
	Py_XDECREF(str);
	return;
      }
    }   
    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
  } else {
    PyErr_Format(PyExc_TypeError, "unexpected type is received");
  }
}


/* Convert a pointer value, signal an exception on a type mismatch */
SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
  void *result;
  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
    PyErr_Clear();
#if SWIG_POINTER_EXCEPTION
    if (flags) {
      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
      SWIG_Python_ArgFail(argnum);
    }
#endif
  }
  return result;
}

#ifdef SWIGPYTHON_BUILTIN
SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
  PyTypeObject *tp = obj->ob_type;
  PyObject *descr;
  PyObject *encoded_name;
  descrsetfunc f;
  int res = -1;

# ifdef Py_USING_UNICODE
  if (PyString_Check(name)) {
    name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
    if (!name)
      return -1;
  } else if (!PyUnicode_Check(name))
# else
  if (!PyString_Check(name))
# endif
  {
    PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
    return -1;
  } else {
    Py_INCREF(name);
  }

  if (!tp->tp_dict) {
    if (PyType_Ready(tp) < 0)
      goto done;
  }

  descr = _PyType_Lookup(tp, name);
  f = NULL;
  if (descr != NULL)
    f = descr->ob_type->tp_descr_set;
  if (!f) {
    if (PyString_Check(name)) {
      encoded_name = name;
      Py_INCREF(name);
    } else {
      encoded_name = PyUnicode_AsUTF8String(name);
      if (!encoded_name)
        return -1;
    }
    PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
    Py_DECREF(encoded_name);
  } else {
    res = f(descr, obj, value);
  }
  
  done:
  Py_DECREF(name);
  return res;
}
#endif


#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif

SWIGINTERN Py_hash_t
SwigPyObject_hash(PyObject *obj) {
  SwigPyObject *sobj = (SwigPyObject *)obj;
  void *ptr = sobj->ptr;
  return (Py_hash_t)ptr;
}

SWIGINTERN Py_hash_t
SWIG_PyNumber_AsPyHash(PyObject *obj) {
  Py_hash_t result = -1;
#if PY_VERSION_HEX < 0x03020000
  if (PyInt_Check(obj))
    result = PyInt_AsLong(obj);
  else if (PyLong_Check(obj))
    result = PyLong_AsLong(obj);
#else
  if (PyNumber_Check(obj))
    result = PyNumber_AsSsize_t(obj, NULL);
#endif
  else
    PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
  return PyErr_Occurred() ? -1 : result;
}

SWIGINTERN int
SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) {
  PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
  return -1;
}

SWIGINTERN void
SwigPyBuiltin_BadDealloc(PyObject *obj) {
  SwigPyObject *sobj = (SwigPyObject *)obj;
  if (sobj->own) {
    PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name);
  }
}

typedef struct {
  PyCFunction get;
  PyCFunction set;
} SwigPyGetSet;

SWIGINTERN PyObject *
SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) {
  SwigPyGetSet *getset;
  PyObject *tuple, *result;
  if (!closure)
    return SWIG_Py_Void();
  getset = (SwigPyGetSet *)closure;
  if (!getset->get)
    return SWIG_Py_Void();
  tuple = PyTuple_New(0);
  assert(tuple);
  result = (*getset->get)(obj, tuple);
  Py_DECREF(tuple);
  return result;
}

SWIGINTERN PyObject *
SwigPyBuiltin_FunpackGetterClosure (PyObject *obj, void *closure) {
  SwigPyGetSet *getset;
  PyObject *result;
  if (!closure)
    return SWIG_Py_Void();
  getset = (SwigPyGetSet *)closure;
  if (!getset->get)
    return SWIG_Py_Void();
  result = (*getset->get)(obj, NULL);
  return result;
}

SWIGINTERN int
SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) {
  SwigPyGetSet *getset;
  PyObject *tuple, *result;
  if (!closure) {
    PyErr_Format(PyExc_TypeError, "Missing getset closure");
    return -1;
  }
  getset = (SwigPyGetSet *)closure;
  if (!getset->set) {
    PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name);
    return -1;
  }
  tuple = PyTuple_New(1);
  assert(tuple);
  Py_INCREF(val);
  PyTuple_SET_ITEM(tuple, 0, val);
  result = (*getset->set)(obj, tuple);
  Py_DECREF(tuple);
  Py_XDECREF(result);
  return result ? 0 : -1;
}

SWIGINTERN int
SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) {
  SwigPyGetSet *getset;
  PyObject *result;
  if (!closure) {
    PyErr_Format(PyExc_TypeError, "Missing getset closure");
    return -1;
  }
  getset = (SwigPyGetSet *)closure;
  if (!getset->set) {
    PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name);
    return -1;
  }
  result = (*getset->set)(obj, val);
  Py_XDECREF(result);
  return result ? 0 : -1;
}

SWIGINTERN void
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
  PyObject_GC_UnTrack(descr);
  Py_XDECREF(PyDescr_TYPE(descr));
  Py_XDECREF(PyDescr_NAME(descr));
  PyObject_GC_Del(descr);
}

SWIGINTERN PyObject *
SwigPyStaticVar_repr(PyGetSetDescrObject *descr) {
#if PY_VERSION_HEX >= 0x03000000

  return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
#else
  return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
#endif
}

SWIGINTERN int
SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) {
  PyDescrObject *descr;
  descr = (PyDescrObject *)self;
  Py_VISIT((PyObject*) PyDescr_TYPE(descr));
  return 0;
}

SWIGINTERN PyObject *
SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNUSEDPARM(type)) {
  if (descr->d_getset->get != NULL)
    return descr->d_getset->get(obj, descr->d_getset->closure);
#if PY_VERSION_HEX >= 0x03000000
  PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
#else
  PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
#endif
  return NULL;
}

SWIGINTERN int
SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) {
  if (descr->d_getset->set != NULL)
    return descr->d_getset->set(obj, value, descr->d_getset->closure);
#if PY_VERSION_HEX >= 0x03000000
  PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
#else
  PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
#endif
  return -1;
}

SWIGINTERN int
SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) {
  PyObject *attribute;
  PyTypeObject *type;
  descrsetfunc local_set;

  assert(PyType_Check(typeobject));
  type = (PyTypeObject *)typeobject;
  attribute = _PyType_Lookup(type, name);
  if (attribute != NULL) {
    /* Implement descriptor functionality, if any */
    local_set = attribute->ob_type->tp_descr_set;
    if (local_set != NULL)
      return local_set(attribute, (PyObject *)type, value);
#if PY_VERSION_HEX >= 0x03000000
    PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name);
#else 
    PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name));
#endif
  } else {
#if PY_VERSION_HEX >= 0x03000000
    PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name);
#else
    PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name));
#endif
  }

  return -1;
}

SWIGINTERN PyTypeObject*
SwigPyStaticVar_Type(void) {
  static PyTypeObject staticvar_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
#if PY_VERSION_HEX >= 0x03000000
      PyVarObject_HEAD_INIT(&PyType_Type, 0)
#else
      PyObject_HEAD_INIT(&PyType_Type)
      0,                                        /* ob_size */
#endif
      "swig_static_var_getset_descriptor",      /* tp_name */
      sizeof(PyGetSetDescrObject),              /* tp_basicsize */
      0,                                        /* tp_itemsize */
      (destructor)SwigPyStaticVar_dealloc,      /* tp_dealloc */
      0,                                        /* tp_print */
      0,                                        /* tp_getattr */
      0,                                        /* tp_setattr */
      0,                                        /* tp_compare */
      (reprfunc)SwigPyStaticVar_repr,           /* tp_repr */
      0,                                        /* tp_as_number */
      0,                                        /* tp_as_sequence */
      0,                                        /* tp_as_mapping */
      0,                                        /* tp_hash */
      0,                                        /* tp_call */
      0,                                        /* tp_str */
      PyObject_GenericGetAttr,                  /* tp_getattro */
      0,                                        /* tp_setattro */
      0,                                        /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
      0,                                        /* tp_doc */
      SwigPyStaticVar_traverse,                 /* tp_traverse */
      0,                                        /* tp_clear */
      0,                                        /* tp_richcompare */
      0,                                        /* tp_weaklistoffset */
      0,                                        /* tp_iter */
      0,                                        /* tp_iternext */
      0,                                        /* tp_methods */
      0,                                        /* tp_members */
      0,                                        /* tp_getset */
      0,                                        /* tp_base */
      0,                                        /* tp_dict */
      (descrgetfunc)SwigPyStaticVar_get,        /* tp_descr_get */
      (descrsetfunc)SwigPyStaticVar_set,        /* tp_descr_set */
      0,                                        /* tp_dictoffset */
      0,                                        /* tp_init */
      0,                                        /* tp_alloc */
      0,                                        /* tp_new */
      0,                                        /* tp_free */
      0,                                        /* tp_is_gc */
      0,                                        /* tp_bases */
      0,                                        /* tp_mro */
      0,                                        /* tp_cache */
      0,                                        /* tp_subclasses */
      0,                                        /* tp_weaklist */
      0,                                        /* tp_del */
      0,                                        /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
      0,                                        /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
      0,                                        /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
      0,                                        /* tp_print */
#endif
#ifdef COUNT_ALLOCS
      0,                                        /* tp_allocs */
      0,                                        /* tp_frees */
      0,                                        /* tp_maxalloc */
      0,                                        /* tp_prev */
      0                                         /* tp_next */
#endif
    };
    staticvar_type = tmp;
    type_init = 1;
    if (PyType_Ready(&staticvar_type) < 0)
      return NULL;
  }
  return &staticvar_type;
}

SWIGINTERN PyTypeObject*
SwigPyObjectType(void) {
  static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types";
  static PyTypeObject swigpyobjecttype_type;
  static int type_init = 0;
  if (!type_init) {
    const PyTypeObject tmp = {
#if PY_VERSION_HEX >= 0x03000000
      PyVarObject_HEAD_INIT(&PyType_Type, 0)
#else
      PyObject_HEAD_INIT(&PyType_Type)
      0,                                        /* ob_size */
#endif
      "SwigPyObjectType",                       /* tp_name */
      PyType_Type.tp_basicsize,                 /* tp_basicsize */
      0,                                        /* tp_itemsize */
      0,                                        /* tp_dealloc */
      0,                                        /* tp_print */
      0,                                        /* tp_getattr */
      0,                                        /* tp_setattr */
      0,                                        /* tp_compare */
      0,                                        /* tp_repr */
      0,                                        /* tp_as_number */
      0,                                        /* tp_as_sequence */
      0,                                        /* tp_as_mapping */
      0,                                        /* tp_hash */
      0,                                        /* tp_call */
      0,                                        /* tp_str */
      0,                                        /* tp_getattro */
      SwigPyObjectType_setattro,                /* tp_setattro */
      0,                                        /* tp_as_buffer */
      Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
      swigpyobjecttype_doc,                     /* tp_doc */
      0,                                        /* tp_traverse */
      0,                                        /* tp_clear */
      0,                                        /* tp_richcompare */
      0,                                        /* tp_weaklistoffset */
      0,                                        /* tp_iter */
      0,                                        /* tp_iternext */
      0,                                        /* tp_methods */
      0,                                        /* tp_members */
      0,                                        /* tp_getset */
      0,                                        /* tp_base */
      0,                                        /* tp_dict */
      0,                                        /* tp_descr_get */
      0,                                        /* tp_descr_set */
      0,                                        /* tp_dictoffset */
      0,                                        /* tp_init */
      0,                                        /* tp_alloc */
      0,                                        /* tp_new */
      0,                                        /* tp_free */
      0,                                        /* tp_is_gc */
      0,                                        /* tp_bases */
      0,                                        /* tp_mro */
      0,                                        /* tp_cache */
      0,                                        /* tp_subclasses */
      0,                                        /* tp_weaklist */
      0,                                        /* tp_del */
      0,                                        /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
      0,                                        /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
      0,                                        /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
      0,                                        /* tp_print */
#endif
#ifdef COUNT_ALLOCS
      0,                                        /* tp_allocs */
      0,                                        /* tp_frees */
      0,                                        /* tp_maxalloc */
      0,                                        /* tp_prev */
      0                                         /* tp_next */
#endif
    };
    swigpyobjecttype_type = tmp;
    type_init = 1;
    swigpyobjecttype_type.tp_base = &PyType_Type;
    if (PyType_Ready(&swigpyobjecttype_type) < 0)
      return NULL;
  }
  return &swigpyobjecttype_type;
}

SWIGINTERN PyGetSetDescrObject *
SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {

  PyGetSetDescrObject *descr;
  descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0);
  assert(descr);
  Py_XINCREF(type);
  PyDescr_TYPE(descr) = type;
  PyDescr_NAME(descr) = PyString_InternFromString(getset->name);
  descr->d_getset = getset;
  if (PyDescr_NAME(descr) == NULL) {
    Py_DECREF(descr);
    descr = NULL;
  }
  return descr;
}

SWIGINTERN void
SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) {
  Py_ssize_t base_count = 0;
  PyTypeObject **b;
  PyObject *tuple;
  Py_ssize_t i;

  if (!bases[0]) {
    bases[0] = SwigPyObject_type();
    bases[1] = NULL;
  }
  type->tp_base = bases[0];
  Py_INCREF((PyObject *)bases[0]);
  for (b = bases; *b != NULL; ++b)
    ++base_count;
  tuple = PyTuple_New(base_count);
  for (i = 0; i < base_count; ++i) {
    Py_INCREF((PyObject *)bases[i]);
    PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]);
  }
  type->tp_bases = tuple;
}

SWIGINTERN PyObject *
SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) {
  PyObject *result;
  result = (PyObject *)SWIG_Python_GetSwigThis(self);
  Py_XINCREF(result);
  return result;
}

SWIGINTERN void
SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
{
#if PY_VERSION_HEX >= 0x03000000
    type->ob_base.ob_base.ob_type = metatype;
#else
    type->ob_type = metatype;
#endif
}


/* Start of callback function macros for use in PyTypeObject */

typedef PyObject *(*SwigPyWrapperFunction)(PyObject *, PyObject *);

#define SWIGPY_UNARYFUNC_CLOSURE(wrapper)		\
SWIGINTERN PyObject *					\
wrapper##_unaryfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_unaryfunc_closure(wrapper, a);	\
}
SWIGINTERN PyObject *
SwigPyBuiltin_unaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  return wrapper(a, NULL);
}

#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper)			\
SWIGINTERN void							\
wrapper##_destructor_closure(PyObject *a) {			\
    SwigPyBuiltin_destructor_closure(wrapper, #wrapper, a);	\
}
SWIGINTERN void
SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) {
  SwigPyObject *sobj;
  sobj = (SwigPyObject *)a;
  Py_XDECREF(sobj->dict);
  if (sobj->own) {
    PyObject *o;
    PyObject *type = 0, *value = 0, *traceback = 0;
    PyErr_Fetch(&type, &value, &traceback);
    o = wrapper(a, NULL);
    if (!o) {
      PyObject *deallocname = PyString_FromString(wrappername);
      PyErr_WriteUnraisable(deallocname);
      Py_DECREF(deallocname);
    }
    PyErr_Restore(type, value, traceback);
    Py_XDECREF(o);
  }
  if (PyType_IS_GC(a->ob_type)) {
    PyObject_GC_Del(a);
  } else {
    PyObject_Del(a);
  }
}

#define SWIGPY_INQUIRY_CLOSURE(wrapper)			\
SWIGINTERN int						\
wrapper##_inquiry_closure(PyObject *a) {		\
  return SwigPyBuiltin_inquiry_closure(wrapper, a);	\
}
SWIGINTERN int
SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  PyObject *pyresult;
  int result;
  pyresult = wrapper(a, NULL);
  result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0;
  Py_XDECREF(pyresult);
  return result;
}

#define SWIGPY_GETITERFUNC_CLOSURE(wrapper)		\
SWIGINTERN PyObject *					\
wrapper##_getiterfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_getiterfunc_closure(wrapper, a);	\
}
SWIGINTERN PyObject *
SwigPyBuiltin_getiterfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  return wrapper(a, NULL);
}

#define SWIGPY_BINARYFUNC_CLOSURE(wrapper)			\
SWIGINTERN PyObject *						\
wrapper##_binaryfunc_closure(PyObject *a, PyObject *b) {	\
  return SwigPyBuiltin_binaryfunc_closure(wrapper, a, b);	\
}
SWIGINTERN PyObject *
SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
  PyObject *tuple, *result;
  tuple = PyTuple_New(1);
  assert(tuple);
  Py_INCREF(b);
  PyTuple_SET_ITEM(tuple, 0, b);
  result = wrapper(a, tuple);
  Py_DECREF(tuple);
  return result;
}

typedef ternaryfunc ternarycallfunc;

#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper)				\
SWIGINTERN PyObject *							\
wrapper##_ternaryfunc_closure(PyObject *a, PyObject *b, PyObject *c) {	\
  return SwigPyBuiltin_ternaryfunc_closure(wrapper, a, b, c);		\
}
SWIGINTERN PyObject *
SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
  PyObject *tuple, *result;
  tuple = PyTuple_New(2);
  assert(tuple);
  Py_INCREF(b);
  PyTuple_SET_ITEM(tuple, 0, b);
  Py_INCREF(c);
  PyTuple_SET_ITEM(tuple, 1, c);
  result = wrapper(a, tuple);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper)					\
SWIGINTERN PyObject *								\
wrapper##_ternarycallfunc_closure(PyObject *a, PyObject *b, PyObject *c) {	\
  return SwigPyBuiltin_ternarycallfunc_closure(wrapper, a, b, c);		\
}
SWIGINTERN PyObject *
SwigPyBuiltin_ternarycallfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
  (void) c;
  return wrapper(a, b);
}

#define SWIGPY_LENFUNC_CLOSURE(wrapper)			\
SWIGINTERN Py_ssize_t					\
wrapper##_lenfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_lenfunc_closure(wrapper, a);	\
}
SWIGINTERN Py_ssize_t
SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  PyObject *resultobj;
  Py_ssize_t result;
  resultobj = wrapper(a, NULL);
  result = PyNumber_AsSsize_t(resultobj, NULL);
  Py_DECREF(resultobj);
  return result;
}

#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper)				\
SWIGINTERN PyObject *								\
wrapper##_ssizessizeargfunc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) {	\
  return SwigPyBuiltin_ssizessizeargfunc_closure(wrapper, a, b, c);		\
}
SWIGINTERN PyObject *
SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c) {
  PyObject *tuple, *result;
  tuple = PyTuple_New(2);
  assert(tuple);
  PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
  PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
  result = wrapper(a, tuple);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper)						\
SWIGINTERN int											\
wrapper##_ssizessizeobjargproc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) {	\
  return SwigPyBuiltin_ssizessizeobjargproc_closure(wrapper, a, b, c, d);			\
}
SWIGINTERN int
SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) {
  PyObject *tuple, *resultobj;
  int result;
  tuple = PyTuple_New(d ? 3 : 2);
  assert(tuple);
  PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
  PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c));
  if (d) {
    Py_INCREF(d);
    PyTuple_SET_ITEM(tuple, 2, d);
  }
  resultobj = wrapper(a, tuple);
  result = resultobj ? 0 : -1;
  Py_DECREF(tuple);
  Py_XDECREF(resultobj);
  return result;
}

#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper)				\
SWIGINTERN PyObject *							\
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) {		\
  return SwigPyBuiltin_funpack_ssizeargfunc_closure(wrapper, a, b);	\
}
SWIGINTERN PyObject *
SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
  PyObject *tuple, *result;
  tuple = PyTuple_New(1);
  assert(tuple);
  PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
  result = wrapper(a, tuple);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper)			\
SWIGINTERN PyObject *							\
wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) {		\
  return SwigPyBuiltin_ssizeargfunc_closure(wrapper, a, b);		\
}
SWIGINTERN PyObject *
SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) {
  PyObject *arg, *result;
  arg = _PyLong_FromSsize_t(b);
  result = wrapper(a, arg);
  Py_DECREF(arg);
  return result;
}

#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper)					\
SWIGINTERN int									\
wrapper##_ssizeobjargproc_closure(PyObject *a, Py_ssize_t b, PyObject *c) {	\
  return SwigPyBuiltin_ssizeobjargproc_closure(wrapper, a, b, c);		\
}
SWIGINTERN int
SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, PyObject *c) {
  PyObject *tuple, *resultobj;
  int result;
  tuple = PyTuple_New(2);
  assert(tuple);
  PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b));
  Py_INCREF(c);
  PyTuple_SET_ITEM(tuple, 1, c);
  resultobj = wrapper(a, tuple);
  result = resultobj ? 0 : -1;
  Py_XDECREF(resultobj);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_OBJOBJPROC_CLOSURE(wrapper)			\
SWIGINTERN int							\
wrapper##_objobjproc_closure(PyObject *a, PyObject *b) {	\
  return SwigPyBuiltin_objobjproc_closure(wrapper, a, b);	\
}
SWIGINTERN int
SwigPyBuiltin_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
  int result;
  PyObject *pyresult;
  PyObject *tuple;
  tuple = PyTuple_New(1);
  assert(tuple);
  Py_INCREF(b);
  PyTuple_SET_ITEM(tuple, 0, b);
  pyresult = wrapper(a, tuple);
  result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1;
  Py_XDECREF(pyresult);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_FUNPACK_OBJOBJPROC_CLOSURE(wrapper)			\
SWIGINTERN int								\
wrapper##_objobjproc_closure(PyObject *a, PyObject *b) {		\
  return SwigPyBuiltin_funpack_objobjproc_closure(wrapper, a, b);	\
}
SWIGINTERN int
SwigPyBuiltin_funpack_objobjproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) {
  int result;
  PyObject *pyresult;
  pyresult = wrapper(a, b);
  result = pyresult ? (PyObject_IsTrue(pyresult) ? 1 : 0) : -1;
  Py_XDECREF(pyresult);
  return result;
}

#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper)					\
SWIGINTERN int									\
wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) {	\
  return SwigPyBuiltin_objobjargproc_closure(wrapper, a, b, c);			\
}
SWIGINTERN int
SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) {
  PyObject *tuple, *resultobj;
  int result;
  tuple = PyTuple_New(c ? 2 : 1);
  assert(tuple);
  Py_INCREF(b);
  PyTuple_SET_ITEM(tuple, 0, b);
  if (c) {
    Py_INCREF(c);
    PyTuple_SET_ITEM(tuple, 1, c);
  }
  resultobj = wrapper(a, tuple);
  result = resultobj ? 0 : -1;
  Py_XDECREF(resultobj);
  Py_DECREF(tuple);
  return result;
}

#define SWIGPY_REPRFUNC_CLOSURE(wrapper)		\
SWIGINTERN PyObject *					\
wrapper##_reprfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_reprfunc_closure(wrapper, a);	\
}
SWIGINTERN PyObject *
SwigPyBuiltin_reprfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  return wrapper(a, NULL);
}

#define SWIGPY_HASHFUNC_CLOSURE(wrapper)		\
SWIGINTERN Py_hash_t					\
wrapper##_hashfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_hashfunc_closure(wrapper, a);	\
}
SWIGINTERN Py_hash_t
SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  PyObject *pyresult;
  Py_hash_t result;
  pyresult = wrapper(a, NULL);
  if (!pyresult)
    return -1;
  result = SWIG_PyNumber_AsPyHash(pyresult);
  Py_DECREF(pyresult);
  return result;
}

#define SWIGPY_ITERNEXTFUNC_CLOSURE(wrapper)		\
SWIGINTERN PyObject *					\
wrapper##_iternextfunc_closure(PyObject *a) {		\
  return SwigPyBuiltin_iternextfunc_closure(wrapper, a);\
}
SWIGINTERN PyObject *
SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
  return wrapper(a, NULL);
}

/* End of callback function macros for use in PyTypeObject */

#ifdef __cplusplus
}
#endif




#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



#ifdef __cplusplus
extern "C" {
#endif

/* Method creation and docstring support functions */

SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);

#ifdef __cplusplus
}
#endif


  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 


/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p_AES_KEY swig_types[0]
#define SWIGTYPE_p_ASN1_BIT_STRING swig_types[1]
#define SWIGTYPE_p_ASN1_INTEGER swig_types[2]
#define SWIGTYPE_p_ASN1_OBJECT swig_types[3]
#define SWIGTYPE_p_ASN1_STRING swig_types[4]
#define SWIGTYPE_p_ASN1_TIME swig_types[5]
#define SWIGTYPE_p_BIGNUM swig_types[6]
#define SWIGTYPE_p_BIO swig_types[7]
#define SWIGTYPE_p_BIO_METHOD swig_types[8]
#define SWIGTYPE_p_DH swig_types[9]
#define SWIGTYPE_p_DSA swig_types[10]
#define SWIGTYPE_p_ECDSA_SIG swig_types[11]
#define SWIGTYPE_p_EC_KEY swig_types[12]
#define SWIGTYPE_p_ENGINE swig_types[13]
#define SWIGTYPE_p_EVP_CIPHER swig_types[14]
#define SWIGTYPE_p_EVP_CIPHER_CTX swig_types[15]
#define SWIGTYPE_p_EVP_MD swig_types[16]
#define SWIGTYPE_p_EVP_MD_CTX swig_types[17]
#define SWIGTYPE_p_EVP_PKEY swig_types[18]
#define SWIGTYPE_p_FILE swig_types[19]
#define SWIGTYPE_p_HMAC_CTX swig_types[20]
#define SWIGTYPE_p_PKCS7 swig_types[21]
#define SWIGTYPE_p_PyObject swig_types[22]
#define SWIGTYPE_p_RC4_KEY swig_types[23]
#define SWIGTYPE_p_RSA swig_types[24]
#define SWIGTYPE_p_SSL swig_types[25]
#define SWIGTYPE_p_SSL_CIPHER swig_types[26]
#define SWIGTYPE_p_SSL_CTX swig_types[27]
#define SWIGTYPE_p_SSL_METHOD swig_types[28]
#define SWIGTYPE_p_SSL_SESSION swig_types[29]
#define SWIGTYPE_p_SwigPyObject swig_types[30]
#define SWIGTYPE_p_UI_METHOD swig_types[31]
#define SWIGTYPE_p_X509 swig_types[32]
#define SWIGTYPE_p_X509V3_CTX swig_types[33]
#define SWIGTYPE_p_X509_CRL swig_types[34]
#define SWIGTYPE_p_X509_EXTENSION swig_types[35]
#define SWIGTYPE_p_X509_NAME swig_types[36]
#define SWIGTYPE_p_X509_NAME_ENTRY swig_types[37]
#define SWIGTYPE_p_X509_REQ swig_types[38]
#define SWIGTYPE_p_X509_STORE swig_types[39]
#define SWIGTYPE_p_X509_STORE_CTX swig_types[40]
#define SWIGTYPE_p___INTMAX_TYPE__ swig_types[41]
#define SWIGTYPE_p___INT_FAST16_TYPE__ swig_types[42]
#define SWIGTYPE_p___INT_FAST32_TYPE__ swig_types[43]
#define SWIGTYPE_p___INT_FAST64_TYPE__ swig_types[44]
#define SWIGTYPE_p___INT_FAST8_TYPE__ swig_types[45]
#define SWIGTYPE_p___INT_LEAST16_TYPE__ swig_types[46]
#define SWIGTYPE_p___INT_LEAST32_TYPE__ swig_types[47]
#define SWIGTYPE_p___INT_LEAST64_TYPE__ swig_types[48]
#define SWIGTYPE_p___INT_LEAST8_TYPE__ swig_types[49]
#define SWIGTYPE_p___UINTMAX_TYPE__ swig_types[50]
#define SWIGTYPE_p___UINT_FAST16_TYPE__ swig_types[51]
#define SWIGTYPE_p___UINT_FAST32_TYPE__ swig_types[52]
#define SWIGTYPE_p___UINT_FAST64_TYPE__ swig_types[53]
#define SWIGTYPE_p___UINT_FAST8_TYPE__ swig_types[54]
#define SWIGTYPE_p___UINT_LEAST16_TYPE__ swig_types[55]
#define SWIGTYPE_p___UINT_LEAST32_TYPE__ swig_types[56]
#define SWIGTYPE_p___UINT_LEAST64_TYPE__ swig_types[57]
#define SWIGTYPE_p___UINT_LEAST8_TYPE__ swig_types[58]
#define SWIGTYPE_p__cbd_t swig_types[59]
#define SWIGTYPE_p_char swig_types[60]
#define SWIGTYPE_p_f_int_p_X509_STORE_CTX__int swig_types[61]
#define SWIGTYPE_p_f_p_char__void swig_types[62]
#define SWIGTYPE_p_f_p_q_const__char__p_char swig_types[63]
#define SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int swig_types[64]
#define SWIGTYPE_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int swig_types[65]
#define SWIGTYPE_p_f_p_q_const__void__p_void swig_types[66]
#define SWIGTYPE_p_f_p_q_const__void_p_q_const__void__int swig_types[67]
#define SWIGTYPE_p_f_p_void__void swig_types[68]
#define SWIGTYPE_p_p_ASN1_OBJECT swig_types[69]
#define SWIGTYPE_p_p_EVP_PKEY_CTX swig_types[70]
#define SWIGTYPE_p_p_X509_NAME_ENTRY swig_types[71]
#define SWIGTYPE_p_p_unsigned_char swig_types[72]
#define SWIGTYPE_p_pyfd_struct swig_types[73]
#define SWIGTYPE_p_stack_st swig_types[74]
#define SWIGTYPE_p_stack_st_OPENSSL_BLOCK swig_types[75]
#define SWIGTYPE_p_stack_st_OPENSSL_CSTRING swig_types[76]
#define SWIGTYPE_p_stack_st_OPENSSL_STRING swig_types[77]
#define SWIGTYPE_p_stack_st_SSL_CIPHER swig_types[78]
#define SWIGTYPE_p_stack_st_X509 swig_types[79]
#define SWIGTYPE_p_stack_st_X509_EXTENSION swig_types[80]
#define SWIGTYPE_p_unsigned_char swig_types[81]
#define SWIGTYPE_p_void swig_types[82]
static swig_type_info *swig_types[84];
static swig_module_info swig_module = {swig_types, 83, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */

#ifdef SWIG_TypeQuery
# undef SWIG_TypeQuery
#endif
#define SWIG_TypeQuery SWIG_Python_TypeQuery

/*-----------------------------------------------
              @(target):= _m2crypto.so
  ------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
#  define SWIG_init    PyInit__m2crypto

#else
#  define SWIG_init    init_m2crypto

#endif
#define SWIG_name    "_m2crypto"

#define SWIGVERSION 0x040002 
#define SWIG_VERSION SWIGVERSION


#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 


#include <stddef.h>


int SWIG_AsVal_wchar_t(PyObject *p, wchar_t *c) { return SWIG_OK; } 
PyObject *SWIG_From_wchar_t(wchar_t c) { return SWIG_Py_Void(); } 


#ifdef _WIN32
#define _WINSOCKAPI_
#include <WinSock2.h>
#include <Windows.h>
#pragma comment(lib, "Ws2_32")
typedef unsigned __int64 uint64_t;
#endif


#if defined __GNUC__ && __GNUC__ < 5
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic warning "-Wstrict-prototypes"
#endif

#include <openssl/err.h>
#include <openssl/rand.h>
#include <_lib.h>
#include <libcrypto-compat.h>
#include <py3k_compat.h>

#include "compile.h"

static PyObject *ssl_verify_cb_func;
static PyObject *ssl_info_cb_func;
static PyObject *ssl_set_tmp_dh_cb_func;
static PyObject *ssl_set_tmp_rsa_cb_func;
static PyObject *x509_store_verify_cb_func;


  #define SWIG_From_long   PyInt_FromLong 


SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERNINLINE PyObject *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > INT_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
    } else {
#if PY_VERSION_HEX >= 0x03000000
#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
      return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size));
#else
      return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape");
#endif
#else
      return PyString_FromStringAndSize(carray, (Py_ssize_t)(size));
#endif
    }
  } else {
    return SWIG_Py_Void();
  }
}


SWIGINTERNINLINE PyObject * 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


SWIGINTERNINLINE PyObject*
  SWIG_From_int  (int value)
{
  return PyInt_FromLong((long) value);
}


#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
#   define LLONG_MAX __LONG_LONG_MAX__
#   define LLONG_MIN (-LLONG_MAX - 1LL)
#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
#endif


SWIGINTERN int
SWIG_AsVal_double (PyObject *obj, double *val)
{
  int res = SWIG_TypeError;
  if (PyFloat_Check(obj)) {
    if (val) *val = PyFloat_AsDouble(obj);
    return SWIG_OK;
#if PY_VERSION_HEX < 0x03000000
  } else if (PyInt_Check(obj)) {
    if (val) *val = (double) PyInt_AsLong(obj);
    return SWIG_OK;
#endif
  } else if (PyLong_Check(obj)) {
    double v = PyLong_AsDouble(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    double d = PyFloat_AsDouble(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = d;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      long v = PyLong_AsLong(obj);
      if (!PyErr_Occurred()) {
	if (val) *val = v;
	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
      } else {
	PyErr_Clear();
      }
    }
  }
#endif
  return res;
}


#include <float.h>


#include <math.h>


SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
  double x = *d;
  if ((min <= x && x <= max)) {
   double fx = floor(x);
   double cx = ceil(x);
   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
   if ((errno == EDOM) || (errno == ERANGE)) {
     errno = 0;
   } else {
     double summ, reps, diff;
     if (rd < x) {
       diff = x - rd;
     } else if (rd > x) {
       diff = rd - x;
     } else {
       return 1;
     }
     summ = rd + x;
     reps = diff/summ;
     if (reps < 8*DBL_EPSILON) {
       *d = rd;
       return 1;
     }
   }
  }
  return 0;
}


SWIGINTERN int
SWIG_AsVal_long (PyObject *obj, long* val)
{
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(obj)) {
    if (val) *val = PyInt_AsLong(obj);
    return SWIG_OK;
  } else
#endif
  if (PyLong_Check(obj)) {
    long v = PyLong_AsLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
      return SWIG_OverflowError;
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    long v = PyInt_AsLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
	if (val) *val = (long)(d);
	return res;
      }
    }
  }
#endif
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int (PyObject * obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = (int)(v);
    }
  }  
  return res;
}


SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
#if PY_VERSION_HEX>=0x03000000
#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
  if (PyBytes_Check(obj))
#else
  if (PyUnicode_Check(obj))
#endif
#else  
  if (PyString_Check(obj))
#endif
  {
    char *cstr; Py_ssize_t len;
    int ret = SWIG_OK;
#if PY_VERSION_HEX>=0x03000000
#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
    if (!alloc && cptr) {
        /* We can't allow converting without allocation, since the internal
           representation of string in Python 3 is UCS-2/UCS-4 but we require
           a UTF-8 representation.
           TODO(bhy) More detailed explanation */
        return SWIG_RuntimeError;
    }
    obj = PyUnicode_AsUTF8String(obj);
    if (!obj)
      return SWIG_TypeError;
    if (alloc)
      *alloc = SWIG_NEWOBJ;
#endif
    if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
      return SWIG_TypeError;
#else
    if (PyString_AsStringAndSize(obj, &cstr, &len) == -1)
      return SWIG_TypeError;
#endif
    if (cptr) {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
	  *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
	  *alloc = SWIG_NEWOBJ;
	} else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      } else {
#if PY_VERSION_HEX>=0x03000000
#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
	*cptr = PyBytes_AsString(obj);
#else
	assert(0); /* Should never reach here with Unicode strings in Python 3 */
#endif
#else
	*cptr = SWIG_Python_str_AsChar(obj);
        if (!*cptr)
          ret = SWIG_TypeError;
#endif
      }
    }
    if (psize) *psize = len + 1;
#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
    Py_XDECREF(obj);
#endif
    return ret;
  } else {
#if defined(SWIG_PYTHON_2_UNICODE)
#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
#endif
#if PY_VERSION_HEX<0x03000000
    if (PyUnicode_Check(obj)) {
      char *cstr; Py_ssize_t len;
      if (!alloc && cptr) {
        return SWIG_RuntimeError;
      }
      obj = PyUnicode_AsUTF8String(obj);
      if (!obj)
        return SWIG_TypeError;
      if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
        if (cptr) {
          if (alloc) *alloc = SWIG_NEWOBJ;
          *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
        }
        if (psize) *psize = len + 1;

        Py_XDECREF(obj);
        return SWIG_OK;
      } else {
        Py_XDECREF(obj);
      }
    }
#endif
#endif

    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *) vptr;
	if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }
  return SWIG_TypeError;
}





#include <pythread.h>
#include <openssl/crypto.h>

#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L
#define CRYPTO_num_locks()      (CRYPTO_NUM_LOCKS)
static PyThread_type_lock lock_cs[CRYPTO_num_locks()];
static long lock_count[CRYPTO_num_locks()];
static int thread_mode = 0;
#endif

void threading_locking_callback(int mode, int type, const char *file, int line) {
#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L
        if (mode & CRYPTO_LOCK) {
                PyThread_acquire_lock(lock_cs[type], WAIT_LOCK);
                lock_count[type]++;
        } else {
                PyThread_release_lock(lock_cs[type]);
                lock_count[type]--;
        }
#endif
}

unsigned long threading_id_callback(void) {
#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L
    return (unsigned long)PyThread_get_thread_ident();
#else
    return (unsigned long)0;
#endif
}


void threading_init(void) {
#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L
    int i;
    if (!thread_mode) {
        for (i=0; i<CRYPTO_num_locks(); i++) {
            lock_count[i]=0;
            lock_cs[i]=PyThread_allocate_lock();
        }
        CRYPTO_set_id_callback(threading_id_callback);
        CRYPTO_set_locking_callback(threading_locking_callback);
    }
    thread_mode = 1;
#endif
}

void threading_cleanup(void) {
#if defined(THREADING) && OPENSSL_VERSION_NUMBER < 0x10100000L
    int i;
    if (thread_mode) {
        CRYPTO_set_locking_callback(NULL);
        for (i=0; i<CRYPTO_num_locks(); i++) {
            lock_count[i]=0;
            PyThread_release_lock(lock_cs[i]);
            PyThread_free_lock(lock_cs[i]);
        }
    }
    thread_mode = 0;
#endif
}


#include <openssl/bn.h>
#include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <ceval.h>


#if OPENSSL_VERSION_NUMBER < 0x10100000L

#include <string.h>
#include <openssl/engine.h>

# define OPENSSL_zalloc(num) \
        CRYPTO_zalloc(num, __FILE__, __LINE__)

static void *CRYPTO_zalloc(size_t num, const char *file, int line)
{
      void *ret = CRYPTO_malloc(num, file, line);
      if (ret != NULL)
              memset(ret, 0, num);
      return ret;
}

#include <openssl/bn.h>

#ifndef BN_F_BN_GENCB_NEW
# define BN_F_BN_GENCB_NEW       143
#endif

# define BN_GENCB_get_arg(gencb) ((gencb)->arg)

BN_GENCB *BN_GENCB_new(void)
{
    BN_GENCB *ret;

    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
        BNerr(BN_F_BN_GENCB_NEW, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }

    return ret;
}

void BN_GENCB_free(BN_GENCB *cb)
{
    if (cb == NULL)
        return;
    OPENSSL_free(cb);
}


int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
{
    /* If the fields n and e in r are NULL, the corresponding input
     * parameters MUST be non-NULL for n and e.  d may be
     * left NULL (in case only the public key is used).
     */
    if ((r->n == NULL && n == NULL)
        || (r->e == NULL && e == NULL))
        return 0;

    if (n != NULL) {
        BN_free(r->n);
        r->n = n;
    }
    if (e != NULL) {
        BN_free(r->e);
        r->e = e;
    }
    if (d != NULL) {
        BN_free(r->d);
        r->d = d;
    }

    return 1;
}

int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
{
    /* If the fields p and q in r are NULL, the corresponding input
     * parameters MUST be non-NULL.
     */
    if ((r->p == NULL && p == NULL)
        || (r->q == NULL && q == NULL))
        return 0;

    if (p != NULL) {
        BN_free(r->p);
        r->p = p;
    }
    if (q != NULL) {
        BN_free(r->q);
        r->q = q;
    }

    return 1;
}

int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
{
    /* If the fields dmp1, dmq1 and iqmp in r are NULL, the corresponding input
     * parameters MUST be non-NULL.
     */
    if ((r->dmp1 == NULL && dmp1 == NULL)
        || (r->dmq1 == NULL && dmq1 == NULL)
        || (r->iqmp == NULL && iqmp == NULL))
        return 0;

    if (dmp1 != NULL) {
        BN_free(r->dmp1);
        r->dmp1 = dmp1;
    }
    if (dmq1 != NULL) {
        BN_free(r->dmq1);
        r->dmq1 = dmq1;
    }
    if (iqmp != NULL) {
        BN_free(r->iqmp);
        r->iqmp = iqmp;
    }

    return 1;
}

void RSA_get0_key(const RSA *r,
                  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
{
    if (n != NULL)
        *n = r->n;
    if (e != NULL)
        *e = r->e;
    if (d != NULL)
        *d = r->d;
}

void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
{
    if (p != NULL)
        *p = r->p;
    if (q != NULL)
        *q = r->q;
}

void RSA_get0_crt_params(const RSA *r,
                         const BIGNUM **dmp1, const BIGNUM **dmq1,
                         const BIGNUM **iqmp)
{
    if (dmp1 != NULL)
        *dmp1 = r->dmp1;
    if (dmq1 != NULL)
        *dmq1 = r->dmq1;
    if (iqmp != NULL)
        *iqmp = r->iqmp;
}

void DSA_get0_pqg(const DSA *d,
                  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
{
    if (p != NULL)
        *p = d->p;
    if (q != NULL)
        *q = d->q;
    if (g != NULL)
        *g = d->g;
}

int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
{
    /* If the fields p, q and g in d are NULL, the corresponding input
     * parameters MUST be non-NULL.
     */
    if ((d->p == NULL && p == NULL)
        || (d->q == NULL && q == NULL)
        || (d->g == NULL && g == NULL))
        return 0;

    if (p != NULL) {
        BN_free(d->p);
        d->p = p;
    }
    if (q != NULL) {
        BN_free(d->q);
        d->q = q;
    }
    if (g != NULL) {
        BN_free(d->g);
        d->g = g;
    }

    return 1;
}

void DSA_get0_key(const DSA *d,
                  const BIGNUM **pub_key, const BIGNUM **priv_key)
{
    if (pub_key != NULL)
        *pub_key = d->pub_key;
    if (priv_key != NULL)
        *priv_key = d->priv_key;
}

int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
{
    /* If the field pub_key in d is NULL, the corresponding input
     * parameters MUST be non-NULL.  The priv_key field may
     * be left NULL.
     */
    if (d->pub_key == NULL && pub_key == NULL)
        return 0;

    if (pub_key != NULL) {
        BN_free(d->pub_key);
        d->pub_key = pub_key;
    }
    if (priv_key != NULL) {
        BN_free(d->priv_key);
        d->priv_key = priv_key;
    }

    return 1;
}

void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
{
    if (pr != NULL)
        *pr = sig->r;
    if (ps != NULL)
        *ps = sig->s;
}

int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
{
    if (r == NULL || s == NULL)
        return 0;
    BN_clear_free(sig->r);
    BN_clear_free(sig->s);
    sig->r = r;
    sig->s = s;
    return 1;
}

void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
{
    if (pr != NULL)
        *pr = sig->r;
    if (ps != NULL)
        *ps = sig->s;
}

int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
{
    if (r == NULL || s == NULL)
        return 0;
    BN_clear_free(sig->r);
    BN_clear_free(sig->s);
    sig->r = r;
    sig->s = s;
    return 1;
}

void DH_get0_pqg(const DH *dh,
                 const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
{
    if (p != NULL)
        *p = dh->p;
    if (q != NULL)
        *q = dh->q;
    if (g != NULL)
        *g = dh->g;
}

int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
{
    /* If the fields p and g in d are NULL, the corresponding input
     * parameters MUST be non-NULL.  q may remain NULL.
     */
    if ((dh->p == NULL && p == NULL)
        || (dh->g == NULL && g == NULL))
        return 0;

    if (p != NULL) {
        BN_free(dh->p);
        dh->p = p;
    }
    if (q != NULL) {
        BN_free(dh->q);
        dh->q = q;
    }
    if (g != NULL) {
        BN_free(dh->g);
        dh->g = g;
    }

    if (q != NULL) {
        dh->length = BN_num_bits(q);
    }

    return 1;
}

void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
{
    if (pub_key != NULL)
        *pub_key = dh->pub_key;
    if (priv_key != NULL)
        *priv_key = dh->priv_key;
}

int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
{
    /* If the field pub_key in dh is NULL, the corresponding input
     * parameters MUST be non-NULL.  The priv_key field may
     * be left NULL.
     */
    if (dh->pub_key == NULL && pub_key == NULL)
        return 0;

    if (pub_key != NULL) {
        BN_free(dh->pub_key);
        dh->pub_key = pub_key;
    }
    if (priv_key != NULL) {
        BN_free(dh->priv_key);
        dh->priv_key = priv_key;
    }

    return 1;
}

int DH_set_length(DH *dh, long length)
{
    dh->length = length;
    return 1;
}

const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx)
{
    return ctx->iv;
}

unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx)
{
    return ctx->iv;
}

EVP_MD_CTX *EVP_MD_CTX_new(void)
{
    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
}

void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
{
    EVP_MD_CTX_cleanup(ctx);
    OPENSSL_free(ctx);
}

int RSA_size(const RSA* rsa) {
    /* BIGNUM* n = NULL;
    RSA_get0_key(rsa, n, NULL, NULL); */
    return BN_num_bytes(rsa->n);
}

RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth)
{
    RSA_METHOD *ret;

    ret = OPENSSL_malloc(sizeof(RSA_METHOD));

    if (ret != NULL) {
        memcpy(ret, meth, sizeof(*meth));
        ret->name = OPENSSL_strdup(meth->name);
        if (ret->name == NULL) {
            OPENSSL_free(ret);
            return NULL;
        }
    }

    return ret;
}

int RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
{
    char *tmpname;

    tmpname = OPENSSL_strdup(name);
    if (tmpname == NULL) {
        return 0;
    }

    OPENSSL_free((char *)meth->name);
    meth->name = tmpname;

    return 1;
}

int RSA_meth_set_priv_enc(RSA_METHOD *meth,
                          int (*priv_enc) (int flen, const unsigned char *from,
                                           unsigned char *to, RSA *rsa,
                                           int padding))
{
    meth->rsa_priv_enc = priv_enc;
    return 1;
}

int RSA_meth_set_priv_dec(RSA_METHOD *meth,
                          int (*priv_dec) (int flen, const unsigned char *from,
                                           unsigned char *to, RSA *rsa,
                                           int padding))
{
    meth->rsa_priv_dec = priv_dec;
    return 1;
}

int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish) (RSA *rsa))
{
    meth->finish = finish;
    return 1;
}

void RSA_meth_free(RSA_METHOD *meth)
{
    if (meth != NULL) {
        OPENSSL_free((char *)meth->name);
        OPENSSL_free(meth);
    }
}

int RSA_bits(const RSA *r)
{
    return (BN_num_bits(r->n));
}

RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
{
    if (pkey->type != EVP_PKEY_RSA) {
        return NULL;
    }
    return pkey->pkey.rsa;
}

int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder,
                       size_t *pderlen)
{
    /* Make sure encoding is valid */
    if (i2d_X509_NAME(nm, NULL) <= 0)
        return 0;
    if (pder != NULL)
        *pder = (unsigned char *)nm->bytes->data;
    if (pderlen != NULL)
        *pderlen = nm->bytes->length;
    return 1;
}

#endif /* OPENSSL_VERSION_NUMBER */


#if PY_MAJOR_VERSION >= 3

FILE* PyFile_AsFile(PyObject *pyfile) {
    FILE* fp;
    int fd;
    const char *mode_str = NULL;
    PyObject *mode_obj;

    if ((fd = PyObject_AsFileDescriptor(pyfile)) == -1) {
        PyErr_SetString(PyExc_BlockingIOError,
                        "Cannot find file handler for the Python file!");
        return NULL;
    }

    if ((mode_obj = PyObject_GetAttrString(pyfile, "mode")) == NULL) {
        mode_str = "rb";
        PyErr_Clear();
    }
    else {
        /* convert to plain string
         * note that error checking is embedded in the function
         */
        mode_str = PyUnicode_AsUTF8AndSize(mode_obj, NULL);
    }

    if((fp = fdopen(fd, mode_str)) == NULL) {
         PyErr_SetFromErrno(PyExc_IOError);
    }

    Py_XDECREF(mode_obj);
    return fp;
}

#else /* PY2K */

#define PyLong_FromLong(x) PyInt_FromLong(x)
#define PyUnicode_AsUTF8(x) PyString_AsString(x)
#define PyUnicode_FromString(x) PyString_FromString(x)
#define PyUnicode_Format(x, y) PyString_Format(x, y)

#endif /* PY_MAJOR_VERSION */


/* OpenSSL 1.0.2 copmatbility shim */
#if OPENSSL_VERSION_NUMBER < 0x10002000L
typedef void (*OPENSSL_sk_freefunc)(void *);
typedef void *(*OPENSSL_sk_copyfunc)(const void *);
typedef struct stack_st OPENSSL_STACK;

# define MIN_NODES       4
# define sk_deep_copy OPENSSL_sk_deep_copy

void OPENSSL_sk_free(OPENSSL_STACK *st)
{
    if (st == NULL)
        return;
    OPENSSL_free(st->data);
    OPENSSL_free(st);
}

OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *sk,
                             OPENSSL_sk_copyfunc copy_func,
                             OPENSSL_sk_freefunc free_func)
{
    OPENSSL_STACK *ret;
    int i;

    if (sk->num < 0)
        return NULL;

    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
        return NULL;

    /* direct structure assignment */
    *ret = *sk;

    ret->num_alloc = sk->num > MIN_NODES ? (size_t)sk->num : MIN_NODES;
    ret->data = OPENSSL_zalloc(sizeof(*ret->data) * ret->num_alloc);
    if (ret->data == NULL) {
        OPENSSL_free(ret);
        return NULL;
    }

    for (i = 0; i < ret->num; ++i) {
        if (sk->data[i] == NULL)
            continue;
        if ((ret->data[i] = copy_func(sk->data[i])) == NULL) {
            while (--i >= 0)
                if (ret->data[i] != NULL)
                    free_func((void *)ret->data[i]);
            OPENSSL_sk_free(ret);
            return NULL;
        }
    }
    return ret;
}
#endif /* OpenSSL 1.0.2 copmatbility shim */


/* Blob interface. Deprecated. */

Blob *blob_new(int len, const char *errmsg) {

    Blob *blob;
    if (!(blob=(Blob *)PyMem_Malloc(sizeof(Blob)))){
        PyErr_SetString(PyExc_MemoryError, errmsg);
        return NULL;
    }
    if (!(blob->data=(unsigned char *)PyMem_Malloc(len))) {
        PyMem_Free(blob);
        PyErr_SetString(PyExc_MemoryError, errmsg);
        return NULL;
    }
    blob->len=len;
    return blob;
}

Blob *blob_copy(Blob *from, const char *errmsg) {
    Blob *blob=blob_new(from->len, errmsg);
    if (!blob) {
        PyErr_SetString(PyExc_MemoryError, errmsg);
        return NULL;
    }
    memcpy(blob->data, from->data, from->len);
    return blob;
}

void blob_free(Blob *blob) {
    PyMem_Free(blob->data);
    PyMem_Free(blob);
}


/* Python helpers. */




static int
m2_PyObject_AsReadBuffer(PyObject * obj, const void **buffer,
			 Py_ssize_t * buffer_len)
{
    Py_ssize_t len = 0;
    Py_buffer view;

    if (PyObject_CheckBuffer(obj)) {
	if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) == 0) {
	    *buffer = view.buf;
	    len = view.len;
	}
    } else {
    PyErr_SetString(PyExc_TypeError, "expected a readable buffer object");
	return -1;
    }
    if (len > INT_MAX) {
	m2_PyBuffer_Release(obj, &view);
	PyErr_SetString(PyExc_ValueError, "object too large");
	return -1;
    }
    *buffer_len = len;
    m2_PyBuffer_Release(obj, &view);
    return 0;
}

static int
m2_PyObject_AsReadBufferInt(PyObject * obj, const void **buffer,
			    int *buffer_len)
{
    int ret = 0;
    Py_ssize_t len = 0;

    ret = m2_PyObject_AsReadBuffer(obj, buffer, &len);
    *buffer_len = len;
    return ret;
}



static int m2_PyObject_GetBufferInt(PyObject *obj, Py_buffer *view, int flags)
{
    int ret;

    if (PyObject_CheckBuffer(obj))
        ret = PyObject_GetBuffer(obj, view, flags);
    else {
        PyErr_SetString(PyExc_TypeError, "expected a readable buffer object");
        return -1;
    }
    if (ret)
        return ret;
    if (view->len > INT_MAX) {
        PyErr_SetString(PyExc_ValueError, "object too large");
        m2_PyBuffer_Release(obj, view);
        return -1;
    }

    return 0;
}

static BIGNUM*
m2_PyObject_AsBIGNUM(PyObject* value, PyObject* _py_exc)
{
    BIGNUM* bn;
    const void* vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(bn = BN_mpi2bn((unsigned char *)vbuf, vlen, NULL))) {
        PyErr_SetString(_py_exc, ERR_reason_error_string(ERR_get_error()));
        return NULL;
        }

    return bn;
}

static void m2_PyBuffer_Release(PyObject *obj, Py_buffer *view)
{
    if (PyObject_CheckBuffer(obj))
        PyBuffer_Release(view);
    /* else do nothing, view->buf comes from PyObject_AsReadBuffer */
}

static int
m2_PyString_AsStringAndSizeInt(PyObject *obj, char **s, int *len)
{
    int ret;
    Py_ssize_t len2;

    ret = PyBytes_AsStringAndSize(obj, s, &len2);

    if (ret)
       return ret;
    if (len2 > INT_MAX) {
       PyErr_SetString(PyExc_ValueError, "string too large");
       return -1;
    }
    *len = len2;
    return 0;
}

/* Works as PyFile_Name, but always returns a new object. */
PyObject *m2_PyFile_Name(PyObject *pyfile) {
    PyObject *out = NULL;
#if PY_MAJOR_VERSION >= 3
   out = PyObject_GetAttrString(pyfile, "name");
#else
   out = PyFile_Name(pyfile);
   Py_XINCREF(out);
#endif
    return out;
}

/* Yes, __FUNCTION__ is a non-standard symbol, but it is supported by
 * both gcc and MSVC. */
#define m2_PyErr_Msg(type) m2_PyErr_Msg_Caller(type, (const char*) __FUNCTION__)

static void m2_PyErr_Msg_Caller(PyObject *err_type, const char* caller) {
    const char *err_reason;
    const char *data;
    int flags;
    /* This max size of a (longer than ours) OpenSSL error string is hardcoded
     * in OpenSSL's crypto/err/err_prn.c:ERR_print_errors_cb() */
    char err_msg[4096];
    unsigned long err_code = ERR_get_error_line_data(NULL, NULL, &data, &flags);

    if (err_code != 0) {
        err_reason = ERR_reason_error_string(err_code);
        if (data && (flags & ERR_TXT_STRING))
            snprintf(err_msg, sizeof(err_msg), "%s (%s)", err_reason, data);
        else
            snprintf(err_msg, sizeof(err_msg), "%s", err_reason);

        PyErr_SetString(err_type, err_msg);
    } else {
        PyErr_Format(err_type, "Unknown error in function %s.", caller);
    }
}


/* C callbacks invoked by OpenSSL; these in turn call back into
Python. */

int ssl_verify_callback(int ok, X509_STORE_CTX *ctx) {
    PyObject *argv, *ret;
    PyObject *_x509_store_ctx_swigptr=0, *_x509_store_ctx_obj=0, *_x509_store_ctx_inst=0, *_klass=0;
    PyObject *_x509=0, *_ssl_ctx=0;
    SSL *ssl;
    SSL_CTX *ssl_ctx;
    X509 *x509;
    int errnum, errdepth;
    int cret;
    int new_style_callback = 0, warning_raised_exception=0;
    PyGILState_STATE gilstate;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */

    ssl = (SSL *)X509_STORE_CTX_get_app_data(ctx);

    gilstate = PyGILState_Ensure();

    if (PyMethod_Check(ssl_verify_cb_func)) {
        PyObject *func;
        PyCodeObject *code;
        func = PyMethod_Function(ssl_verify_cb_func);
        code = (PyCodeObject *) PyFunction_GetCode(func);
        if (code && code->co_argcount == 3) { /* XXX Python internals */
            new_style_callback = 1;
        }
    } else if (PyFunction_Check(ssl_verify_cb_func)) {
        PyCodeObject *code = (PyCodeObject *) PyFunction_GetCode(ssl_verify_cb_func);
        if (code && code->co_argcount == 2) { /* XXX Python internals */
            new_style_callback = 1;
        }
    } else {
        /* XXX There are lots of other callable types, but we will assume
         * XXX that any other type of callable uses the new style callback,
         * XXX although this is not entirely safe assumption.
         */
        new_style_callback = 1;
    }

    if (new_style_callback) {
        PyObject *x509mod;

        x509mod = PyDict_GetItemString(PyImport_GetModuleDict(), "M2Crypto.X509");
        _klass = PyObject_GetAttrString(x509mod, "X509_Store_Context");

        _x509_store_ctx_swigptr = SWIG_NewPointerObj((void *)ctx, SWIGTYPE_p_X509_STORE_CTX, 0);
        _x509_store_ctx_obj = Py_BuildValue("(Oi)", _x509_store_ctx_swigptr, 0);

        _x509_store_ctx_inst = PyObject_CallObject(_klass, _x509_store_ctx_obj);

        argv = Py_BuildValue("(iO)", ok, _x509_store_ctx_inst);
    } else {
        if (PyErr_Warn(PyExc_DeprecationWarning, "Old style callback, use cb_func(ok, store) instead")) {
            warning_raised_exception = 1;
        }

        x509 = X509_STORE_CTX_get_current_cert(ctx);
        errnum = X509_STORE_CTX_get_error(ctx);
        errdepth = X509_STORE_CTX_get_error_depth(ctx);

        ssl = (SSL *)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
        ssl_ctx = SSL_get_SSL_CTX(ssl);

        _x509 = SWIG_NewPointerObj((void *)x509, SWIGTYPE_p_X509, 0);
        _ssl_ctx = SWIG_NewPointerObj((void *)ssl_ctx, SWIGTYPE_p_SSL_CTX, 0);
        argv = Py_BuildValue("(OOiii)", _ssl_ctx, _x509, errnum, errdepth, ok);
    }

    if (!warning_raised_exception) {
        ret = PyEval_CallObject(ssl_verify_cb_func, argv);
    } else {
        ret = 0;
    }

    if (!ret) {
        /* Got an exception in PyEval_CallObject(), let's fail verification
         * to be safe.
         */
        cret = 0;
    } else {
        /* FIXME This is possibly problematic if ret > MAXINT */
        cret = (int)PyLong_AsLong(ret);
    }
    Py_XDECREF(ret);
    Py_XDECREF(argv);
    if (new_style_callback) {
        Py_XDECREF(_x509_store_ctx_inst);
        Py_XDECREF(_x509_store_ctx_obj);
        Py_XDECREF(_x509_store_ctx_swigptr);
        Py_XDECREF(_klass);
    } else {
        Py_XDECREF(_x509);
        Py_XDECREF(_ssl_ctx);
    }

    PyGILState_Release(gilstate);

    return cret;
}

int x509_store_verify_callback(int ok, X509_STORE_CTX *ctx) {
    PyGILState_STATE gilstate;
    PyObject *argv, *ret;
    PyObject *_x509_store_ctx_swigptr=0, *_x509_store_ctx_obj=0, *_x509_store_ctx_inst=0, *_klass=0;
    int cret;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    PyObject *x509mod;


    gilstate = PyGILState_Ensure();

    /* Below, handle only what is called 'new style callback' in ssl_verify_callback().
       TODO: does 'old style callback' exist any more? */
    x509mod = PyDict_GetItemString(PyImport_GetModuleDict(), "M2Crypto.X509");
    _klass = PyObject_GetAttrString(x509mod, "X509_Store_Context");
    _x509_store_ctx_swigptr = SWIG_NewPointerObj((void *)ctx, SWIGTYPE_p_X509_STORE_CTX, 0);
    _x509_store_ctx_obj = Py_BuildValue("(Oi)", _x509_store_ctx_swigptr, 0);

    _x509_store_ctx_inst = PyObject_CallObject(_klass, _x509_store_ctx_obj);

    argv = Py_BuildValue("(iO)", ok, _x509_store_ctx_inst);

    ret = PyEval_CallObject(x509_store_verify_cb_func, argv);
    if (!ret) {
        /* Got an exception in PyEval_CallObject(), let's fail verification
         * to be safe.
         */
        cret = 0;
    } else {
        cret = (int)PyInt_AsLong(ret);
    }

    Py_XDECREF(ret);
    Py_XDECREF(argv);
    Py_XDECREF(_x509_store_ctx_inst);
    Py_XDECREF(_x509_store_ctx_obj);
    Py_XDECREF(_x509_store_ctx_swigptr);
    Py_XDECREF(_klass);

    PyGILState_Release(gilstate);
    return cret;
}

void ssl_info_callback(const SSL *s, int where, int ret) {
    PyObject *argv, *retval, *_SSL;
    PyGILState_STATE gilstate;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */

    gilstate = PyGILState_Ensure();

    _SSL = SWIG_NewPointerObj((void *)s, SWIGTYPE_p_SSL, 0);
    argv = Py_BuildValue("(iiO)", where, ret, _SSL);

    retval = PyEval_CallObject(ssl_info_cb_func, argv);

    Py_XDECREF(retval);
    Py_XDECREF(argv);
    Py_XDECREF(_SSL);

    PyGILState_Release(gilstate);
}

DH *ssl_set_tmp_dh_callback(SSL *ssl, int is_export, int keylength) {
    PyObject *argv, *ret, *_ssl;
    DH *dh;
    PyGILState_STATE gilstate;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */

    gilstate = PyGILState_Ensure();

    _ssl = SWIG_NewPointerObj((void *)ssl, SWIGTYPE_p_SSL, 0);
    argv = Py_BuildValue("(Oii)", _ssl, is_export, keylength);

    ret = PyEval_CallObject(ssl_set_tmp_dh_cb_func, argv);

    if ((SWIG_ConvertPtr(ret, (void **)&dh, SWIGTYPE_p_DH, SWIG_POINTER_EXCEPTION | 0)) == -1)
      dh = NULL;
    Py_XDECREF(ret);
    Py_XDECREF(argv);
    Py_XDECREF(_ssl);

    PyGILState_Release(gilstate);

    return dh;
}

RSA *ssl_set_tmp_rsa_callback(SSL *ssl, int is_export, int keylength) {
    PyObject *argv, *ret, *_ssl;
    RSA *rsa;
    PyGILState_STATE gilstate;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */

    gilstate = PyGILState_Ensure();

    _ssl = SWIG_NewPointerObj((void *)ssl, SWIGTYPE_p_SSL, 0);
    argv = Py_BuildValue("(Oii)", _ssl, is_export, keylength);

    ret = PyEval_CallObject(ssl_set_tmp_rsa_cb_func, argv);

    if ((SWIG_ConvertPtr(ret, (void **)&rsa, SWIGTYPE_p_RSA, SWIG_POINTER_EXCEPTION | 0)) == -1)
      rsa = NULL;
    Py_XDECREF(ret);
    Py_XDECREF(argv);
    Py_XDECREF(_ssl);

    PyGILState_Release(gilstate);

    return rsa;
}

/* Universal callback for dh_generate_parameters,
 * dsa_generate_parametersm, and rsa_generate_key */
int bn_gencb_callback(int p, int n, BN_GENCB *gencb) {
    PyObject *argv, *ret, *cbfunc;

    cbfunc = (PyObject *)BN_GENCB_get_arg(gencb);
    argv = Py_BuildValue("(ii)", p, n);
    ret = PyEval_CallObject(cbfunc, argv);
    PyErr_Clear();
    Py_DECREF(argv);
    Py_XDECREF(ret);
    return 1;
}

int passphrase_callback(char *buf, int num, int v, void *arg) {
    int i;
    Py_ssize_t len;
    char *str;
    PyObject *argv, *ret, *cbfunc;
    PyGILState_STATE gilstate;

    gilstate = PyGILState_Ensure();
    cbfunc = (PyObject *)arg;
    argv = Py_BuildValue("(i)", v);
    /* PyEval_CallObject sets exception, if needed. */
    ret = PyEval_CallObject(cbfunc, argv);
    Py_DECREF(argv);
    if (ret == NULL) {
        PyGILState_Release(gilstate);
        return -1;
    }

    if (!PyBytes_Check(ret)) {
        PyErr_SetString(PyExc_RuntimeError,
                        "Result of callback is not bytes().");
        Py_DECREF(ret);
        PyGILState_Release(gilstate);
        return -1;
    }
    if ((len = PyBytes_Size(ret)) > num)
        len = num;
    str = PyBytes_AsString(ret);

    for (i = 0; i < len; i++)
        buf[i] = str[i];
    Py_DECREF(ret);
    PyGILState_Release(gilstate);
    return len;
}



void lib_init() {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
    SSLeay_add_all_algorithms();
    ERR_load_ERR_strings();
#endif
}

/* Bignum routines that aren't not numerous enough to
warrant a separate file. */

PyObject *bn_to_mpi(const BIGNUM *bn) {
    int len = 0;
    unsigned char *mpi;
    PyObject *pyo;

    len = BN_bn2mpi(bn, NULL);
    if (!(mpi=(unsigned char *)PyMem_Malloc(len))) {
        m2_PyErr_Msg(PyExc_MemoryError);
        return NULL;
    }
    len=BN_bn2mpi(bn, mpi);

    pyo=PyBytes_FromStringAndSize((const char *)mpi, len);

    PyMem_Free(mpi);
    return pyo;
}

const BIGNUM *mpi_to_bn(PyObject *value) {
    const void *vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    return BN_mpi2bn(vbuf, vlen, NULL);
}

PyObject *bn_to_bin(BIGNUM *bn) {
    int len = 0;
    unsigned char *bin;
    PyObject *pyo;

    len = BN_num_bytes(bn);
    if (!(bin=(unsigned char *)PyMem_Malloc(len))) {
      PyErr_SetString(PyExc_MemoryError, "bn_to_bin");
      return NULL;
    }
    BN_bn2bin(bn, bin);

    pyo=PyBytes_FromStringAndSize((const char *)bin, len);

    PyMem_Free(bin);
    return pyo;
}

const BIGNUM *bin_to_bn(PyObject *value) {
    const void *vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    return BN_bin2bn(vbuf, vlen, NULL);
}

PyObject *bn_to_hex(BIGNUM *bn) {
    char *hex;
    PyObject *pyo;
    Py_ssize_t len = 0;

    hex = BN_bn2hex(bn);
    if (!hex) {
        m2_PyErr_Msg(PyExc_RuntimeError);
        OPENSSL_free(hex);
        return NULL;
    }
    len = strlen(hex);

    pyo=PyBytes_FromStringAndSize(hex, len);

    OPENSSL_free(hex);
    return pyo;
}

BIGNUM *hex_to_bn(PyObject *value) {
    const void *vbuf;
    Py_ssize_t vlen = 0;
    BIGNUM *bn;
    Py_buffer view;

    if (PyObject_CheckBuffer(value)) {
        if (PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) == 0) {
            vbuf = view.buf;
            vlen = view.len;
        }
    }
    else {
        if (m2_PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1)
            return NULL;
    }

    if ((bn=BN_new())==NULL) {
        m2_PyBuffer_Release(value, &view);
        PyErr_SetString(PyExc_MemoryError, "hex_to_bn");
        return NULL;
    }
    if (BN_hex2bn(&bn, (const char *)vbuf) <= 0) {
        m2_PyBuffer_Release(value, &view);
        m2_PyErr_Msg(PyExc_RuntimeError);
        BN_free(bn);
        return NULL;
    }
    m2_PyBuffer_Release(value, &view);
    return bn;
}

BIGNUM *dec_to_bn(PyObject *value) {
    const void *vbuf;
    Py_ssize_t vlen = 0;
    BIGNUM *bn;
    Py_buffer view;

    if (PyObject_CheckBuffer(value)) {
        if (PyObject_GetBuffer(value, &view, PyBUF_SIMPLE) == 0) {
            vbuf = view.buf;
            vlen = view.len;
        }
    }
    else {
        if (m2_PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1)
            return NULL;
    }

    if ((bn=BN_new())==NULL) {
      m2_PyBuffer_Release(value, &view);
      PyErr_SetString(PyExc_MemoryError, "dec_to_bn");
      return NULL;
    }
    if ((BN_dec2bn(&bn, (const char *)vbuf) <= 0)) {
      m2_PyBuffer_Release(value, &view);
      m2_PyErr_Msg(PyExc_RuntimeError);
      BN_free(bn);
      return NULL;
    }
    m2_PyBuffer_Release(value, &view);
    return bn;
}


SWIGINTERNINLINE PyObject* 
SWIG_From_unsigned_SS_long  (unsigned long value)
{
  return (value > LONG_MAX) ?
    PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
{
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(obj)) {
    long v = PyInt_AsLong(obj);
    if (v >= 0) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      return SWIG_OverflowError;
    }
  } else
#endif
  if (PyLong_Check(obj)) {
    unsigned long v = PyLong_AsUnsignedLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
      return SWIG_OverflowError;
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    int dispatch = 0;
    unsigned long v = PyLong_AsUnsignedLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_AddCast(SWIG_OK);
    } else {
      PyErr_Clear();
    }
    if (!dispatch) {
      double d;
      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
	if (val) *val = (unsigned long)(d);
	return res;
      }
    }
  }
#endif
  return SWIG_TypeError;
}


#include <openssl/bio.h>


static PyObject *_bio_err;


void pyfd_init(void);

void bio_init(PyObject *bio_err) {
    Py_INCREF(bio_err);
    _bio_err = bio_err;
    pyfd_init();
}

int bio_free(BIO *bio) {
    int ret;

    Py_BEGIN_ALLOW_THREADS
    ret = BIO_free(bio);
    Py_END_ALLOW_THREADS
    if (ret == 0) {
        m2_PyErr_Msg(_bio_err);
    }
    return ret;
}

BIO * bio_new_file(const char *filename, const char *mode) {
    BIO *ret;

    Py_BEGIN_ALLOW_THREADS
    ret = BIO_new_file(filename, mode);
    Py_END_ALLOW_THREADS

    if (ret == NULL) {
        m2_PyErr_Msg(_bio_err);
    }

    return ret;
}

BIO *bio_new_pyfile(PyObject *pyfile, int bio_close) {
    FILE *fp = NULL;
    BIO *bio = NULL;

    fp = PyFile_AsFile(pyfile);

    bio = BIO_new_fp(fp, bio_close);

    /* returns NULL if error occurred */
    if (bio == NULL) {
        /* Find out the name of the file so we can have good error
         * message. */
        PyObject *pyname = m2_PyFile_Name(pyfile);
        char *name = PyBytes_AsString(pyname);

        if (name == NULL) {
            PyErr_Format(_bio_err,
                         "Opening of the new BIO on file failed!");
        }
        else {
            PyErr_Format(_bio_err,
                         "Opening of the new BIO on file %s failed!", name);
        }
        Py_DECREF(pyname);
    }
    return bio;
}

PyObject *bio_read(BIO *bio, int num) {
    PyObject *blob;
    void *buf;
    int r;

    if (!(buf = PyMem_Malloc(num))) {
        PyErr_SetString(PyExc_MemoryError, "bio_read");
        return NULL;
    }
    Py_BEGIN_ALLOW_THREADS
    r = BIO_read(bio, buf, num);
    Py_END_ALLOW_THREADS
    if (r < 0) {
        PyMem_Free(buf);
        if (ERR_peek_error()) {
            m2_PyErr_Msg(_bio_err);
            return NULL;
        }
        Py_RETURN_NONE;
    }

    blob = PyBytes_FromStringAndSize(buf, r);

    PyMem_Free(buf);
    return blob;
}

PyObject *bio_gets(BIO *bio, int num) {
    PyObject *blob;
    void *buf;
    int r;

    if (!(buf = PyMem_Malloc(num))) {
        PyErr_SetString(PyExc_MemoryError, "bio_gets");
        return NULL;
    }
    Py_BEGIN_ALLOW_THREADS
    r = BIO_gets(bio, buf, num);
    Py_END_ALLOW_THREADS
    if (r < 1) {
        PyMem_Free(buf);
        if (ERR_peek_error()) {
            m2_PyErr_Msg(_bio_err);
            return NULL;
        }
        Py_RETURN_NONE;
    }

    blob = PyBytes_FromStringAndSize(buf, r);

    PyMem_Free(buf);
    return blob;
}

int bio_write(BIO *bio, PyObject *from) {
    const void *fbuf;
    int flen = 0, ret;

    if (m2_PyObject_AsReadBufferInt(from, &fbuf, &flen) == -1)
        return -1;

    Py_BEGIN_ALLOW_THREADS
    ret = BIO_write(bio, fbuf, flen);
    Py_END_ALLOW_THREADS
    if (ret < 0) {
        if (ERR_peek_error()) {
            m2_PyErr_Msg(_bio_err);
            return -1;
        }
    }
    return ret;
}

/* XXX Casting size_t to int. */
int bio_ctrl_pending(BIO *bio) {
    return (int)BIO_ctrl_pending(bio);
}

int bio_ctrl_wpending(BIO *bio) {
    return (int)BIO_ctrl_wpending(bio);
}

int bio_ctrl_get_write_guarantee(BIO *a) {
    return BIO_ctrl_get_write_guarantee(a);
}

int bio_reset(BIO *bio) {
    return (int)BIO_reset(bio);
}


int bio_flush(BIO *bio) {
    return (int)BIO_flush(bio);
}

int bio_seek(BIO *bio, int offset) {
    return (int)BIO_seek(bio, offset);
}

int bio_tell(BIO* bio) {
    return BIO_tell(bio);
}

void bio_set_flags(BIO *bio, int flags) {
    BIO_set_flags(bio, flags);
}

int bio_get_flags(BIO *bio) {
    return BIO_get_flags(bio);
}

/*
 * sets the cipher of BIO @param b to c using key @param key and IV @iv.
 * @param enc should be set to 1 for encryption and zero to decryption.
 *
 */
PyObject *bio_set_cipher(BIO *b, EVP_CIPHER *c, PyObject *key, PyObject *iv, int op) {
    const void *kbuf, *ibuf;
    Py_ssize_t klen, ilen;

    if ((m2_PyObject_AsReadBuffer(key, &kbuf, &klen) == -1)
        || (m2_PyObject_AsReadBuffer(iv, &ibuf, &ilen) == -1))
        return NULL;

    BIO_set_cipher(b, (const EVP_CIPHER *)c,
        (unsigned char *)kbuf, (unsigned char *)ibuf, op);
    Py_RETURN_NONE;
}

int bio_set_mem_eof_return(BIO *b, int v) {
    return (int)BIO_set_mem_eof_return(b, v);
}

int bio_get_fd(BIO *bio) {
    return BIO_get_fd(bio, NULL);
}


int bio_do_handshake(BIO *bio) {
    return BIO_do_handshake(bio);
}

/* macro */
int bio_make_bio_pair(BIO* b1, BIO* b2) {
    return BIO_make_bio_pair(b1, b2);
}

int bio_set_write_buf_size(BIO* b, size_t size) {
    return BIO_set_write_buf_size(b, size);
}

int bio_should_retry(BIO* a) {
    return BIO_should_retry(a);
}

int bio_should_read(BIO* a) {
    return BIO_should_read(a);
}

int bio_should_write(BIO* a) {
    return BIO_should_write(a);
}

/* Macros for things not defined before 1.1.0 */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static BIO_METHOD *
BIO_meth_new( int type, const char *name )
{
    BIO_METHOD *method = malloc( sizeof(BIO_METHOD) );
    memset( method, 0, sizeof(BIO_METHOD) );

    method->type = type;
    method->name = name;

    return method;
}

static void
BIO_meth_free( BIO_METHOD *meth )
{
    if ( meth == NULL ) {
        return;
    }

    free(meth);
}
#define BIO_meth_set_write(m, f) (m)->bwrite = (f)
#define BIO_meth_set_read(m, f) (m)->bread = (f)
#define BIO_meth_set_puts(m, f) (m)->bputs = (f)
#define BIO_meth_set_gets(m, f) (m)->bgets = (f)
#define BIO_meth_set_ctrl(m, f) (m)->ctrl = (f)
#define BIO_meth_set_create(m, f) (m)->create = (f)
#define BIO_meth_set_destroy(m, f) (m)->destroy = (f)
#define BIO_set_shutdown(b, x) (b)->shutdown = x
#define BIO_get_shutdown(b) (b)->shutdown
#define BIO_set_init(b, x)    b->init = x
#define BIO_get_init(b) (b)->init
#define BIO_set_data(b, x)    b->ptr = x
#define BIO_clear_flags(b, x)    b->flags &= ~(x)
#define BIO_get_data(b)    b->ptr
#endif

/* implment custom BIO_s_pyfd */

#ifdef _WIN32
#  define clear_sys_error()       SetLastError(0)
/* Linux doesn't use underscored calls yet */
#  define open(p, f, m) _open(p, f, m)
#  define read(f, b, n) _read(f, b, n)
#  define write(f, b, n) _write(f, b, n)
#  define close(f) _close(f)
#  define lseek(fd, o, w) _lseek(fd, o, w)
#else
# define clear_sys_error()       errno=0
#endif

typedef struct pyfd_struct {
    int fd;
} BIO_PYFD_CTX;

/* Setting up methods_fdp */
static BIO_METHOD *methods_fdp;

static int pyfd_write(BIO *b, const char *in, int inl) {
    int ret, fd;

    if (BIO_get_fd(b, &fd) == -1) {
        PyErr_SetString(_bio_err, "BIO has not been initialized.");
        return -1;
    }
    clear_sys_error();
    ret = write(fd, in, inl);
    BIO_clear_retry_flags(b);
    if (ret <= 0) {
        if (BIO_fd_should_retry(ret))
            BIO_set_retry_write(b);
    }
    return ret;
}

static int pyfd_read(BIO *b, char *out, int outl) {
    int ret = 0, fd;

    if (BIO_get_fd(b, &fd) == -1) {
        PyErr_SetString(_bio_err, "BIO has not been initialized.");
        return -1;
    }
    if (out != NULL) {
        clear_sys_error();
        ret = read(fd, out, outl);
        BIO_clear_retry_flags(b);
        if (ret <= 0) {
            if (BIO_fd_should_retry(ret))
                BIO_set_retry_read(b);
        }
    }
    return ret;
}

static int pyfd_puts(BIO *bp, const char *str) {
    int n, ret;

    n = strlen(str);
    ret = pyfd_write(bp, str, n);
    return ret;
}

static int pyfd_gets(BIO *bp, char *buf, int size) {
    int ret = 0;
    char *ptr = buf;
    char *end = buf + size - 1;

    /* See
    https://github.com/openssl/openssl/pull/3442
    We were here just repeating a bug from OpenSSL
    */
    while (ptr < end && pyfd_read(bp, ptr, 1) > 0) {
        if (*ptr++ == '\n')
           break;
    }

    ptr[0] = '\0';

    if (buf[0] != '\0')
        ret = strlen(buf);
    return ret;
}

static int pyfd_new(BIO* b) {
    BIO_PYFD_CTX* ctx;

    ctx = OPENSSL_zalloc(sizeof(*ctx));
    if (ctx == NULL)
        return 0;

    ctx->fd = -1;

    BIO_set_data(b, ctx);
    BIO_set_shutdown(b, 0);
    BIO_set_init(b, 1);

    return 1;
    }

static int pyfd_free(BIO* b) {
    BIO_PYFD_CTX* ctx;

    if (b == 0)
        return 0;

    ctx = BIO_get_data(b);
    if (ctx == NULL)
        return 0;

    if (BIO_get_shutdown(b) && BIO_get_init(b))
        close(ctx->fd);

    BIO_set_data(b, NULL);
    BIO_set_shutdown(b, 0);
    BIO_set_init(b, 0);

    OPENSSL_free(ctx);

    return 1;
}

static long pyfd_ctrl(BIO *b, int cmd, long num, void *ptr) {
    BIO_PYFD_CTX* ctx;
    int *ip;
    long ret = 1;

    ctx = BIO_get_data(b);
    if (ctx == NULL)
        return 0;

    switch (cmd) {
    case BIO_CTRL_RESET:
        num = 0;
    case BIO_C_FILE_SEEK:
        ret = (long)lseek(ctx->fd, num, 0);
        break;
    case BIO_C_FILE_TELL:
    case BIO_CTRL_INFO:
        ret = (long)lseek(ctx->fd, 0, 1);
        break;
    case BIO_C_SET_FD:
        pyfd_free(b);
        if (*((int *)ptr) > -1) {
            if (!pyfd_new(b) || !(ctx = BIO_get_data(b)))
                return 0;
            ctx->fd = *((int *)ptr);
            BIO_set_shutdown(b, (int)num);
            BIO_set_init(b, 1);
            }
        break;
    case BIO_C_GET_FD:
        if (BIO_get_init(b)) {
            ip = (int *)ptr;
            if (ip != NULL)
                *ip = ctx->fd;
            ret = ctx->fd;
        } else
            ret = -1;
        break;
    case BIO_CTRL_GET_CLOSE:
        ret = BIO_get_shutdown(b);
        break;
    case BIO_CTRL_SET_CLOSE:
        BIO_set_shutdown(b, (int)num);
        break;
    case BIO_CTRL_PENDING:
    case BIO_CTRL_WPENDING:
        ret = 0;
        break;
    case BIO_CTRL_DUP:
    case BIO_CTRL_FLUSH:
        ret = 1;
        break;
    default:
        ret = 0;
        break;
    }
    return ret;
}

void pyfd_init(void) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
    methods_fdp = BIO_meth_new(
        BIO_get_new_index()|BIO_TYPE_DESCRIPTOR|BIO_TYPE_SOURCE_SINK,
        "python file descriptor");
#else
    methods_fdp = BIO_meth_new(
        100 |BIO_TYPE_DESCRIPTOR|BIO_TYPE_SOURCE_SINK,
        "python file descriptor");
#endif

    BIO_meth_set_write(methods_fdp, pyfd_write);
    BIO_meth_set_read(methods_fdp, pyfd_read);
    BIO_meth_set_puts(methods_fdp, pyfd_puts);
    BIO_meth_set_gets(methods_fdp, pyfd_gets);
    BIO_meth_set_ctrl(methods_fdp, pyfd_ctrl);
    BIO_meth_set_create(methods_fdp, pyfd_new);
    BIO_meth_set_destroy(methods_fdp, pyfd_free);
}

BIO* BIO_new_pyfd(int fd, int close_flag) {
    BIO *ret;

    ret = BIO_new(methods_fdp);
    BIO_set_fd(ret, fd, close_flag);
    return ret;
    }


#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
#  define SWIG_LONG_LONG_AVAILABLE
#endif


#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
{
  int res = SWIG_TypeError;
  if (PyLong_Check(obj)) {
    unsigned long long v = PyLong_AsUnsignedLongLong(obj);
    if (!PyErr_Occurred()) {
      if (val) *val = v;
      return SWIG_OK;
    } else {
      PyErr_Clear();
      res = SWIG_OverflowError;
    }
  } else {
    unsigned long v;
    res = SWIG_AsVal_unsigned_SS_long (obj,&v);
    if (SWIG_IsOK(res)) {
      if (val) *val = v;
      return res;
    }
  }
#ifdef SWIG_PYTHON_CAST_MODE
  {
    const double mant_max = 1LL << DBL_MANT_DIG;
    double d;
    res = SWIG_AsVal_double (obj,&d);
    if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
      return SWIG_OverflowError;
    if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
      if (val) *val = (unsigned long long)(d);
      return SWIG_AddCast(res);
    }
    res = SWIG_TypeError;
  }
#endif
  return res;
}
#endif


SWIGINTERNINLINE int
SWIG_AsVal_size_t (PyObject * obj, size_t *val)
{
  int res = SWIG_TypeError;
#ifdef SWIG_LONG_LONG_AVAILABLE
  if (sizeof(size_t) <= sizeof(unsigned long)) {
#endif
    unsigned long v;
    res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
#ifdef SWIG_LONG_LONG_AVAILABLE
  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
    unsigned long long v;
    res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0);
    if (SWIG_IsOK(res) && val) *val = (size_t)(v);
  }
#endif
  return res;
}


#include <openssl/bn.h>


PyObject *bn_rand(int bits, int top, int bottom)
{
    BIGNUM* rnd;
    PyObject *ret;
    char *randhex;

    rnd = BN_new();
    if (rnd == NULL) {
        m2_PyErr_Msg(PyExc_Exception);
        return NULL;
    }

    if (!BN_rand(rnd, bits, top, bottom)) {
        /*Custom errors?*/
        m2_PyErr_Msg(PyExc_Exception);
        BN_free(rnd);
        return NULL;
    }

    randhex = BN_bn2hex(rnd);
    if (!randhex) {
        /*Custom errors?*/
        m2_PyErr_Msg(PyExc_Exception);
        BN_free(rnd);
        return NULL;
    }
    BN_free(rnd);

    ret = PyLong_FromString(randhex, NULL, 16);
    OPENSSL_free(randhex);
    return ret;
}


PyObject *bn_rand_range(PyObject *range)
{
    BIGNUM* rnd;
    BIGNUM *rng = NULL;
    PyObject *ret, *tuple;
    PyObject *format, *rangePyString;
    char *randhex; /* PyLong_FromString is unhappy with const */
    const char *rangehex;

    /* Wow, it's a lot of work to convert into a hex string in C! */
    format = PyUnicode_FromString("%x");

    if (!format) {
        PyErr_SetString(PyExc_RuntimeError, "Cannot create Python string '%x'");
        return NULL;
    }
    tuple = PyTuple_New(1);
    if (!tuple) {
        Py_DECREF(format);
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
        return NULL;
    }
    Py_INCREF(range);
    PyTuple_SET_ITEM(tuple, 0, range);

    rangePyString = PyUnicode_Format(format, tuple);

    if (!rangePyString) {
        PyErr_SetString(PyExc_Exception, "String Format failed");
        Py_DECREF(format);
        Py_DECREF(tuple);
        return NULL;
    }
    Py_DECREF(format);
    Py_DECREF(tuple);

    rangehex = (const char*)PyUnicode_AsUTF8(rangePyString);

    if (!BN_hex2bn(&rng, rangehex)) {
        /*Custom errors?*/
        m2_PyErr_Msg(PyExc_Exception);
        Py_DECREF(rangePyString);
        return NULL;
    }

    Py_DECREF(rangePyString);

    if (!(rnd = BN_new())) {
        PyErr_SetString(PyExc_MemoryError, "bn_rand_range");
        return NULL;
    }

    if (!BN_rand_range(rnd, rng)) {
        /*Custom errors?*/
        m2_PyErr_Msg(PyExc_Exception);
        BN_free(rnd);
        BN_free(rng);
        return NULL;
    }

    BN_free(rng);

    randhex = BN_bn2hex(rnd);
    if (!randhex) {
        /*Custom errors?*/
        m2_PyErr_Msg(PyExc_Exception);
        BN_free(rnd);
        return NULL;
    }
    BN_free(rnd);

    ret = PyLong_FromString(randhex, NULL, 16);
    OPENSSL_free(randhex);
    return ret;
}



static PyObject *_rand_err;

void rand_init(PyObject *rand_err) {
    Py_INCREF(rand_err);
    _rand_err = rand_err;
}

PyObject *rand_seed(PyObject *seed) {
    const void *buf;
    int len = 0;

    m2_PyObject_AsReadBufferInt(seed, &buf, &len);

    RAND_seed(buf, len);
    Py_RETURN_NONE;
}

PyObject *rand_add(PyObject *blob, double entropy) {
    const void *buf;
    int len = 0;

    m2_PyObject_AsReadBufferInt(blob, &buf, &len);

    RAND_add(buf, len, entropy);
    Py_RETURN_NONE;
}

PyObject *rand_bytes(int n) {
    void *blob;
    int ret;
    PyObject *obj;
    
    if (!(blob = PyMem_Malloc(n))) {
        PyErr_SetString(PyExc_MemoryError,
        "Insufficient memory for rand_bytes.");
        return NULL;
    }
    if ((ret = RAND_bytes(blob, n)) == 1) {
        obj = PyBytes_FromStringAndSize(blob, n);
        PyMem_Free(blob);
        return obj;
    } else if (ret == 0) {
        PyErr_SetString(_rand_err, "Not enough randomness.");
        PyMem_Free(blob);
        return NULL;
    } else if (ret == -1) {
        PyErr_SetString(_rand_err,
                        "Not supported by the current RAND method.");
        PyMem_Free(blob);
        return NULL;
    } else {
        PyMem_Free(blob);
        m2_PyErr_Msg(_rand_err);
        return NULL;
    }
}

PyObject *rand_pseudo_bytes(int n) {
    int ret;
    unsigned char *blob;
    PyObject *tuple;
    
    if (!(blob=(unsigned char *)PyMem_Malloc(n))) {
        PyErr_SetString(PyExc_MemoryError, "Insufficient memory for rand_pseudo_bytes.");
        return NULL;
    }
    if (!(tuple=PyTuple_New(2))) {
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
        PyMem_Free(blob);
        return NULL;
    }
    ret = RAND_pseudo_bytes(blob, n);
    if (ret == -1) {
        PyMem_Free(blob);
        Py_DECREF(tuple);
        PyErr_SetString(_rand_err,
            "Function RAND_pseudo_bytes not supported by the current RAND method.");
        return NULL;
    } else {
        PyTuple_SET_ITEM(tuple, 0, PyBytes_FromStringAndSize((char*)blob, n));

        PyMem_Free(blob);
        PyTuple_SET_ITEM(tuple, 1, PyLong_FromLong((long)ret));
        return tuple;
    }
}

PyObject *rand_file_name(void) {
    PyObject *obj;
    char *str;
    if ((obj = PyBytes_FromStringAndSize(NULL, BUFSIZ))==NULL) {
        PyErr_SetString(PyExc_MemoryError, "rand_file_name");
        return NULL;
    }
    str=PyBytes_AS_STRING(obj);
    if (RAND_file_name(str, BUFSIZ)==NULL) {
        PyErr_SetString(PyExc_RuntimeError, "rand_file_name");
        return NULL;
    }
    if (_PyBytes_Resize(&obj, (Py_ssize_t)strlen(str))!=0)
        return NULL; /* mem exception set by _PyBytes_Resize */
    return obj;
}

void rand_screen(void) {
#ifdef _WIN32
    RAND_screen();
#endif
}

int rand_win32_event(unsigned int imsg, int wparam, long lparam) {
#ifdef _WIN32
    return RAND_event(imsg, wparam, lparam);
#else
    return 0;
#endif
}


SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v > UINT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = (unsigned int)(v);
    }
  }  
  return res;
}


#include <assert.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/rsa.h>
#include <openssl/opensslv.h>

#if OPENSSL_VERSION_NUMBER < 0x10100000L

HMAC_CTX *HMAC_CTX_new(void) {
    HMAC_CTX *ret = PyMem_Malloc(sizeof(HMAC_CTX));
    HMAC_CTX_init(ret);
    return ret;
}
#define HMAC_CTX_reset(ctx) HMAC_CTX_init(ctx)
#define HMAC_CTX_free(ctx)          \
    do  {                           \
        HMAC_CTX_cleanup(ctx);      \
        PyMem_Free((void *)ctx);    \
    } while(0)

#define EVP_CIPHER_CTX_reset(ctx) EVP_CIPHER_CTX_init(ctx)
#endif


#define PKCS5_SALT_LEN  8

static PyObject *_evp_err;

void evp_init(PyObject *evp_err) {
    Py_INCREF(evp_err);
    _evp_err = evp_err;
}


RSA *pkey_get1_rsa(EVP_PKEY *pkey) {
    RSA *ret = NULL;

    if ((ret = EVP_PKEY_get1_RSA(pkey)) == NULL) {
        /* _evp_err now inherits from PyExc_ValueError, so we should
         * keep API intact.
         */
        PyErr_Format(_evp_err, "Invalid key in function %s.", __FUNCTION__);
    }

    return ret;
}


PyObject *pkcs5_pbkdf2_hmac_sha1(PyObject *pass,
                                 PyObject *salt,
                                 int iter,
                                 int keylen) {
    unsigned char *key;
    const void *saltbuf;
    const void *passbuf;
    PyObject *ret;
    int passlen = 0, saltlen = 0;

    if (m2_PyObject_AsReadBufferInt(pass, &passbuf, &passlen) == -1)
        return NULL;
    if (m2_PyObject_AsReadBufferInt(salt, &saltbuf, &saltlen) == -1)
        return NULL;

    key = PyMem_Malloc(keylen);
    if (key == NULL)
	return PyErr_NoMemory();
    PKCS5_PBKDF2_HMAC_SHA1((const char *)passbuf, passlen, (const unsigned char *)saltbuf, saltlen, iter,
                           keylen, key);
    ret = PyBytes_FromStringAndSize((char*)key, keylen);
    OPENSSL_cleanse(key, keylen);
    PyMem_Free(key);
    return ret;
}

EVP_MD_CTX *md_ctx_new(void) {
    EVP_MD_CTX *ctx;

    if (!(ctx = EVP_MD_CTX_create())) {
        PyErr_SetString(PyExc_MemoryError, "md_ctx_new");
        return NULL;
    }
    return ctx;
}

void md_ctx_free(EVP_MD_CTX *ctx) {
    EVP_MD_CTX_destroy(ctx);
}

int digest_update(EVP_MD_CTX *ctx, PyObject *blob) {
    const void *buf;
    Py_ssize_t len;

    if (m2_PyObject_AsReadBuffer(blob, &buf, &len) == -1)
        return -1;

    return EVP_DigestUpdate(ctx, buf, (size_t)len);
}

PyObject *digest_final(EVP_MD_CTX *ctx) {
    void *blob;
    int blen;
    PyObject *ret;

    if (!(blob = PyMem_Malloc(EVP_MD_CTX_size(ctx)))) {
        PyErr_SetString(PyExc_MemoryError, "digest_final");
        return NULL;
    }
    if (!EVP_DigestFinal(ctx, blob, (unsigned int *)&blen)) {
        PyMem_Free(blob);
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize(blob, blen);

    PyMem_Free(blob);
    return ret;
}

HMAC_CTX *hmac_ctx_new(void) {
    HMAC_CTX *ctx;

    if (!(ctx = HMAC_CTX_new())) {
        PyErr_SetString(PyExc_MemoryError, "hmac_ctx_new");
        return NULL;
    }
    return ctx;
}

void hmac_ctx_free(HMAC_CTX *ctx) {
    HMAC_CTX_free(ctx);
}

PyObject *hmac_init(HMAC_CTX *ctx, PyObject *key, const EVP_MD *md) {
    const void *kbuf;
    int klen = 0;

    if (m2_PyObject_AsReadBufferInt(key, &kbuf, &klen) == -1)
        return NULL;

    if (!HMAC_Init_ex(ctx, kbuf, klen, md, NULL)) {
        PyErr_SetString(_evp_err, "HMAC_Init failed");
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *hmac_update(HMAC_CTX *ctx, PyObject *blob) {
    const void *buf;
    Py_ssize_t len;

    if (m2_PyObject_AsReadBuffer(blob, &buf, &len) == -1)
        return NULL;

    if (!HMAC_Update(ctx, (const unsigned char *)buf, (size_t)len)) {
        PyErr_SetString(_evp_err, "HMAC_Update failed");
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *hmac_final(HMAC_CTX *ctx) {
    void *blob;
    int blen;
    PyObject *ret;

    if (!(blob = PyMem_Malloc(HMAC_size(ctx)))) {
        PyErr_SetString(PyExc_MemoryError, "hmac_final");
        return NULL;
    }

    if (!HMAC_Final(ctx, blob, (unsigned int *)&blen)) {
        PyErr_SetString(_evp_err, "HMAC_Final failed");
        return NULL;
    }

    ret = PyBytes_FromStringAndSize(blob, blen);

    PyMem_Free(blob);
    return ret;
}

PyObject *hmac(PyObject *key, PyObject *data, const EVP_MD *md) {
    const void *kbuf, *dbuf;
    void *blob;
    int klen = 0;
    unsigned int blen;
    Py_ssize_t dlen;
    PyObject *ret;

    if ((m2_PyObject_AsReadBufferInt(key, &kbuf, &klen) == -1)
        || (m2_PyObject_AsReadBuffer(data, &dbuf, &dlen) == -1))
        return NULL;

    if (!(blob = PyMem_Malloc(EVP_MAX_MD_SIZE))) {
        PyErr_SetString(PyExc_MemoryError, "hmac");
        return NULL;
    }
    HMAC(md, kbuf, klen, (const unsigned char *)dbuf, (size_t)dlen, (unsigned char *)blob, &blen);
    blob = PyMem_Realloc(blob, blen);

    ret = PyBytes_FromStringAndSize(blob, blen);

    PyMem_Free(blob);
    return ret;
}

EVP_CIPHER_CTX *cipher_ctx_new(void) {
    EVP_CIPHER_CTX *ctx;

    if (!(ctx = EVP_CIPHER_CTX_new())) {
        PyErr_SetString(PyExc_MemoryError, "cipher_ctx_new");
        return NULL;
    }
    EVP_CIPHER_CTX_reset(ctx);
    return ctx;
}

void cipher_ctx_free(EVP_CIPHER_CTX *ctx) {
    EVP_CIPHER_CTX_free(ctx);
}

PyObject *bytes_to_key(const EVP_CIPHER *cipher, EVP_MD *md,
                        PyObject *data, PyObject *salt,
                        PyObject *iv, /* Not used */
                        int iter) {
    unsigned char key[EVP_MAX_KEY_LENGTH];
    const void *dbuf, *sbuf;
    int dlen = 0, klen;
    Py_ssize_t slen;
    PyObject *ret;

    if ((m2_PyObject_AsReadBufferInt(data, &dbuf, &dlen) == -1)
        || (m2_PyObject_AsReadBuffer(salt, &sbuf, &slen) == -1))
        return NULL;

    assert((slen == 8) || (slen == 0));
    klen = EVP_BytesToKey(cipher, md, (unsigned char *)sbuf,
        (unsigned char *)dbuf, dlen, iter,
        key, NULL); /* Since we are not returning IV no need to derive it */

    ret = PyBytes_FromStringAndSize((char*)key, klen);

    return ret;
}

PyObject *cipher_init(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
                        PyObject *key, PyObject *iv, int mode) {
    const void *kbuf, *ibuf;
    Py_ssize_t klen, ilen;

    if (key == Py_None)
        kbuf = NULL;
    else if (m2_PyObject_AsReadBuffer(key, &kbuf, &klen) == -1)
        return NULL;

    if (iv == Py_None)
        ibuf = NULL;
    else if (m2_PyObject_AsReadBuffer(iv, &ibuf, &ilen) == -1)
        return NULL;

    if (!EVP_CipherInit(ctx, cipher, (unsigned char *)kbuf,
                        (unsigned char *)ibuf, mode)) {
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *cipher_update(EVP_CIPHER_CTX *ctx, PyObject *blob) {
    const void *buf;
    int len = 0, olen;
    void *obuf;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1)
        return NULL;

    if (!(obuf = PyMem_Malloc(len + EVP_CIPHER_CTX_block_size(ctx) - 1))) {
        PyErr_SetString(PyExc_MemoryError, "cipher_update");
        return NULL;
    }
    if (!EVP_CipherUpdate(ctx, obuf, &olen, (unsigned char *)buf, len)) {
        PyMem_Free(obuf);
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize(obuf, olen);

    PyMem_Free(obuf);
    return ret;
}

PyObject *cipher_final(EVP_CIPHER_CTX *ctx) {
    void *obuf;
    int olen;
    PyObject *ret;

    if (!(obuf = PyMem_Malloc(EVP_CIPHER_CTX_block_size(ctx)))) {
        PyErr_SetString(PyExc_MemoryError, "cipher_final");
        return NULL;
    }
    if (!EVP_CipherFinal(ctx, (unsigned char *)obuf, &olen)) {
        PyMem_Free(obuf);
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize(obuf, olen);

    PyMem_Free(obuf);
    return ret;
}

PyObject *sign_update(EVP_MD_CTX *ctx, PyObject *blob) {
    const void *buf;
    int len;

    if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1)
        return NULL;

    if (!EVP_SignUpdate(ctx, buf, (Py_ssize_t)len)) {
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *sign_final(EVP_MD_CTX *ctx, EVP_PKEY *pkey) {
    PyObject *ret;
    unsigned char *sigbuf;
    unsigned int siglen = EVP_PKEY_size(pkey);

    sigbuf = (unsigned char*)OPENSSL_malloc(siglen);
    if (!sigbuf) {
        PyErr_SetString(PyExc_MemoryError, "sign_final");
        return NULL;
    }

    if (!EVP_SignFinal(ctx, sigbuf, &siglen, pkey)) {
        m2_PyErr_Msg(_evp_err);
        OPENSSL_cleanse(sigbuf, siglen);
        OPENSSL_free(sigbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((char*)sigbuf, siglen);

    OPENSSL_cleanse(sigbuf, siglen);
    OPENSSL_free(sigbuf);
    return ret;
}

int verify_update(EVP_MD_CTX *ctx, PyObject *blob) {
    const void *buf;
    int len;

    if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1)
        return -1;

    return EVP_VerifyUpdate(ctx, buf, (Py_ssize_t)len);
}

int verify_final(EVP_MD_CTX *ctx, PyObject *blob, EVP_PKEY *pkey) {
    const void *kbuf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(blob, &kbuf, &len) == -1)
        return -1;

    return EVP_VerifyFinal(ctx, (const unsigned char *)kbuf, len, pkey);
}

int digest_sign_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey) {
    return EVP_DigestSignInit(ctx, NULL, NULL, NULL, pkey);
}

PyObject *digest_sign_update(EVP_MD_CTX *ctx, PyObject *blob) {
    const void *buf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(blob, (const void **)&buf, &len) == -1)
        return NULL;

    if (!EVP_DigestSignUpdate(ctx, buf, len)) {
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *digest_sign_final(EVP_MD_CTX *ctx) {
    PyObject *ret;
    unsigned char *sigbuf;
    size_t siglen;

    if (!EVP_DigestSignFinal(ctx, NULL, &siglen)) {
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }

    sigbuf = (unsigned char*)OPENSSL_malloc(siglen);
    if (!sigbuf) {
        PyErr_SetString(PyExc_MemoryError, "digest_sign_final");
        return NULL;
    }

    if (!EVP_DigestSignFinal(ctx, sigbuf, &siglen)) {
        m2_PyErr_Msg(_evp_err);
        OPENSSL_cleanse(sigbuf, siglen);
        OPENSSL_free(sigbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((char*)sigbuf, siglen);

    OPENSSL_cleanse(sigbuf, siglen);
    OPENSSL_free(sigbuf);
    return ret;
}

#if OPENSSL_VERSION_NUMBER >= 0x10101000L
PyObject *digest_sign(EVP_MD_CTX *ctx, PyObject *msg) {
    PyObject *ret;
    const void *msgbuf;
    unsigned char *sigbuf;
    int msglen = 0;
    size_t siglen = 0;

    if (m2_PyObject_AsReadBufferInt(msg, (const void **)&msgbuf, &msglen) == -1)
        return NULL;

    if (!EVP_DigestSign(ctx, NULL, &siglen, msgbuf, msglen)) {
        m2_PyErr_Msg(_evp_err);
        return NULL;
    }

    sigbuf = (unsigned char*)OPENSSL_malloc(siglen);
    if (!sigbuf) {
        PyErr_SetString(PyExc_MemoryError, "digest_sign");
        return NULL;
    }

    if (!EVP_DigestSign(ctx, sigbuf, &siglen, msgbuf, msglen)) {
        m2_PyErr_Msg(_evp_err);
        OPENSSL_cleanse(sigbuf, siglen);
        OPENSSL_free(sigbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((char*)sigbuf, siglen);

    OPENSSL_cleanse(sigbuf, siglen);
    OPENSSL_free(sigbuf);
    return ret;

}
#endif

int digest_verify_init(EVP_MD_CTX *ctx, EVP_PKEY *pkey) {
    return EVP_DigestVerifyInit(ctx, NULL, NULL, NULL, pkey);
}

int digest_verify_update(EVP_MD_CTX *ctx, PyObject *blob) {
    const void *buf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(blob, (const void **)&buf, &len) == -1)
        return -1;

    return EVP_DigestVerifyUpdate(ctx, buf, len);
}

int digest_verify_final(EVP_MD_CTX *ctx, PyObject *blob) {
    unsigned char *sigbuf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(blob, (const void **)&sigbuf, &len) == -1)
        return -1;

    return EVP_DigestVerifyFinal(ctx, sigbuf, len);
}

#if OPENSSL_VERSION_NUMBER >= 0x10101000L
int digest_verify(EVP_MD_CTX *ctx, PyObject *sig, PyObject *msg) {
    unsigned char *sigbuf;
    unsigned char *msgbuf;
    int siglen = 0;
    int msglen = 0;

    if (m2_PyObject_AsReadBufferInt(sig, (const void **)&sigbuf, &siglen) == -1)
        return -1;

    if (m2_PyObject_AsReadBufferInt(msg, (const void **)&msgbuf, &msglen) == -1)
        return -1;

    return EVP_DigestVerify(ctx, sigbuf, siglen, msgbuf, msglen);
}
#endif


const EVP_MD *get_digestbyname(const char* name) {
    const EVP_MD *ret = NULL;

    if ((ret = EVP_get_digestbyname(name)) == NULL) {
        m2_PyErr_Msg(_evp_err);
    }

    return ret;
}


int pkey_write_pem_no_cipher(EVP_PKEY *pkey, BIO *f, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_PKCS8PrivateKey(f, pkey, NULL, NULL, 0,
            passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int pkey_write_pem(EVP_PKEY *pkey, BIO *f, EVP_CIPHER *cipher, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_PKCS8PrivateKey(f, pkey, cipher, NULL, 0,
            passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


EVP_PKEY *pkey_new(void) {
    EVP_PKEY *ret;

    if ((ret = EVP_PKEY_new()) == NULL) {
        PyErr_Format(PyExc_MemoryError,
                     "Insufficient memory for new key in function %s.", __FUNCTION__);
    }

    return ret;
}

EVP_PKEY *pkey_read_pem(BIO *f, PyObject *pyfunc) {
    EVP_PKEY *pk;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    pk = PEM_read_bio_PrivateKey(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);

    if (pk == NULL) {
        PyErr_Format(_evp_err,
                     "Unable to read private key in function %s.", __FUNCTION__);
    }

    return pk;
}

EVP_PKEY *pkey_read_pem_pubkey(BIO *f, PyObject *pyfunc) {
    EVP_PKEY *pk;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    pk = PEM_read_bio_PUBKEY(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);

    if (pk == NULL) {
        PyErr_Format(_evp_err,
                     "Unable to read public key in function %s.", __FUNCTION__);
    }

    return pk;
}


int pkey_assign_rsa(EVP_PKEY *pkey, RSA *rsa) {
    return EVP_PKEY_assign_RSA(pkey, rsa);
}

PyObject *pkey_as_der(EVP_PKEY *pkey) {
    unsigned char * pp = NULL;
    int len;
    PyObject * der;
    len = i2d_PUBKEY(pkey, &pp);
    if (len < 0){
        PyErr_SetString(_evp_err, "EVP_PKEY as DER failed");
        return NULL;
    }

    der = PyBytes_FromStringAndSize((char*)pp, len);

    OPENSSL_free(pp);
    return der;
}

PyObject *pkey_get_modulus(EVP_PKEY *pkey)
{
    RSA *rsa;
    DSA *dsa;
    BIO *bio;
    BUF_MEM *bptr;
    PyObject *ret;
    const BIGNUM* bn;

    switch (EVP_PKEY_base_id(pkey)) {
        case EVP_PKEY_RSA:
            rsa = EVP_PKEY_get1_RSA(pkey);

            bio = BIO_new(BIO_s_mem());
            if (!bio) {
                RSA_free(rsa);
                PyErr_SetString(PyExc_MemoryError, "pkey_get_modulus");
                return NULL;
            }

            RSA_get0_key(rsa, &bn, NULL, NULL);
            if (!BN_print(bio, bn)) {
                m2_PyErr_Msg(PyExc_RuntimeError);
                BIO_free(bio);
                RSA_free(rsa);
                return NULL;
            }
            BIO_get_mem_ptr(bio, &bptr);

            ret = PyBytes_FromStringAndSize(bptr->data, bptr->length);

            (void)BIO_set_close(bio, BIO_CLOSE);
            BIO_free(bio);
            RSA_free(rsa);

            return ret;
            break;

        case EVP_PKEY_DSA:
            dsa = EVP_PKEY_get1_DSA(pkey);

            bio = BIO_new(BIO_s_mem());
            if (!bio) {
                DSA_free(dsa);
                PyErr_SetString(PyExc_MemoryError, "pkey_get_modulus");
                return NULL;
            }

            DSA_get0_key(dsa, &bn, NULL);
            if (!BN_print(bio, bn)) {
                m2_PyErr_Msg(PyExc_RuntimeError);
                BIO_free(bio);
                DSA_free(dsa);
                return NULL;
            }
            BIO_get_mem_ptr(bio, &bptr);

            ret = PyBytes_FromStringAndSize(bptr->data, bptr->length);

            (void)BIO_set_close(bio, BIO_CLOSE);
            BIO_free(bio);
            DSA_free(dsa);

            return ret;
            break;

        default:
            PyErr_SetString(_evp_err, "unsupported key type");
            return NULL;
    }
}



#include <openssl/evp.h>

#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
#include <openssl/aes.h>
#endif

/* 
// 2004-10-10, ngps: 
// CTR mode is not included in the default OpenSSL build.
// To use the AES CTR ciphers, link with your own copy of OpenSSL.
*/
#ifdef HAVE_AES_CTR
extern EVP_CIPHER const *EVP_aes_128_ctr(void);
extern EVP_CIPHER const *EVP_aes_192_ctr(void);
extern EVP_CIPHER const *EVP_aes_256_ctr(void);
#endif


AES_KEY *aes_new(void) {
    AES_KEY *key;
    
    if (!(key = (AES_KEY *)PyMem_Malloc(sizeof(AES_KEY)))) {
        PyErr_SetString(PyExc_MemoryError,
                        "Insufficient memory for AES key.");
        return NULL;
    }
    return key;
}   

void AES_free(AES_KEY *key) {
    PyMem_Free((void *)key);
}

/* 
// op == 0: encrypt
// otherwise: decrypt (Python code will supply the value 1.)
*/
PyObject *AES_set_key(AES_KEY *key, PyObject *value, int bits, int op) { 
    char *vbuf; 
    Py_ssize_t vlen;

    if (PyBytes_AsStringAndSize(value, &vbuf, &vlen) == -1)
        return NULL;

    if (op == 0) 
        AES_set_encrypt_key((const unsigned char *)vbuf, bits, key);
    else
        AES_set_decrypt_key((const unsigned char *)vbuf, bits, key);
    Py_RETURN_NONE;
}

/* 
// op == 0: encrypt
// otherwise: decrypt (Python code will supply the value 1.)
*/
PyObject *AES_crypt(const AES_KEY *key, PyObject *in, int outlen, int op) {
    char *buf;
    Py_ssize_t len;
    unsigned char *out;
    PyObject *res;

    if (PyBytes_AsStringAndSize(in, &buf, &len) == -1)
        return NULL;

    if (!(out=(unsigned char *)PyMem_Malloc(outlen))) {
        PyErr_SetString(PyExc_MemoryError, "AES_crypt");
        return NULL;
    }
    if (op == 0)
        AES_encrypt((const unsigned char *)buf, out, key);
    else
        AES_decrypt((const unsigned char *)buf, out, key);
    res = PyBytes_FromStringAndSize((char*)out, outlen);
    PyMem_Free(out);
    return res;
}

int AES_type_check(AES_KEY *key) {
    return 1;
}


#include <openssl/rc4.h>


RC4_KEY *rc4_new(void) {
    RC4_KEY *key;

    if (!(key = (RC4_KEY *)PyMem_Malloc(sizeof(RC4_KEY))))
        PyErr_SetString(PyExc_MemoryError, "rc4_new");
    return key;
}

void rc4_free(RC4_KEY *key) {
    PyMem_Free((void *)key);
}

PyObject *rc4_set_key(RC4_KEY *key, PyObject *value) {
    const void *vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    RC4_set_key(key, vlen, vbuf);
    Py_RETURN_NONE;
}

PyObject *rc4_update(RC4_KEY *key, PyObject *in) {
    PyObject *ret;
    const void *buf;
    Py_ssize_t len;
    void *out;

    if (m2_PyObject_AsReadBuffer(in, &buf, &len) == -1)
        return NULL;

    if (!(out = PyMem_Malloc(len))) {
        PyErr_SetString(PyExc_MemoryError, "expected a string object");
        return NULL;
    }
    RC4(key, len, buf, out);

    ret = PyBytes_FromStringAndSize(out, len);

    PyMem_Free(out);
    return ret;
}

int rc4_type_check(RC4_KEY *key) {
    return 1;
}


#include <openssl/bn.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/dh.h>


static PyObject *_dh_err;

void dh_init(PyObject *dh_err) {
    Py_INCREF(dh_err);
    _dh_err = dh_err;
}

int dh_type_check(DH *dh) {
    /* Our getting here means we passed Swig's type checking,
    XXX Still need to check the pointer for sanity? */
    return 1;
}


DH *dh_read_parameters(BIO *bio) {
    return PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
}

DH *dh_generate_parameters(int plen, int g, PyObject *pyfunc) {
    DH *dh;
    BN_GENCB *gencb;
    int ret;

    if ((gencb=BN_GENCB_new()) == NULL) {
        m2_PyErr_Msg(_dh_err);
        return NULL;
    }

    if ((dh=DH_new()) == NULL) {
        m2_PyErr_Msg(_dh_err);
        BN_GENCB_free(gencb);
        return NULL;
    }

    BN_GENCB_set(gencb, bn_gencb_callback, (void *)pyfunc);

    Py_INCREF(pyfunc);
    ret = DH_generate_parameters_ex(dh, plen, g, gencb);
    Py_DECREF(pyfunc);
    BN_GENCB_free(gencb);

    if (ret)
        return dh;

    m2_PyErr_Msg(_dh_err);
    DH_free(dh);
    return NULL;
}

/* Note return value shenanigan. */
int dh_check(DH *dh) {
    int err;

    return (DH_check(dh, &err)) ? 0 : err;
}

PyObject *dh_compute_key(DH *dh, PyObject *pubkey) {
    const void *pkbuf;
    int pklen = 0, klen;
    void *key;
    BIGNUM *pk;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(pubkey, &pkbuf, &pklen) == -1)
        return NULL;

    if (!(pk = BN_mpi2bn((unsigned char *)pkbuf, pklen, NULL))) {
        m2_PyErr_Msg(_dh_err);
        return NULL;
    }
    if (!(key = PyMem_Malloc(DH_size(dh)))) {
        BN_free(pk);
        PyErr_SetString(PyExc_MemoryError, "dh_compute_key");
        return NULL;
    }
    if ((klen = DH_compute_key((unsigned char *)key, pk, dh)) == -1) {
        BN_free(pk);
        PyMem_Free(key);
        m2_PyErr_Msg(_dh_err);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((const char *)key, klen);

    BN_free(pk);
    PyMem_Free(key);
    return ret;
}

PyObject *dh_get_p(DH *dh) {
    const BIGNUM* p = NULL;
    DH_get0_pqg(dh, &p, NULL, NULL);
    if (!p) {
        PyErr_SetString(_dh_err, "'p' is unset");
        return NULL;
    }
    return bn_to_mpi(p);
}

PyObject *dh_get_g(DH *dh) {
    const BIGNUM* g = NULL;
    DH_get0_pqg(dh, NULL, NULL, &g);
    if (!g) {
        PyErr_SetString(_dh_err, "'g' is unset");
        return NULL;
    }
    return bn_to_mpi(g);
}

PyObject *dh_get_pub(DH *dh) {
    const BIGNUM* pub_key = NULL;
    DH_get0_key(dh, &pub_key, NULL);
    if (!pub_key) {
        PyErr_SetString(_dh_err, "'pub' is unset");
        return NULL;
    }
    return bn_to_mpi(pub_key);
}

PyObject *dh_get_priv(DH *dh) {
    const BIGNUM* priv_key = NULL;
    DH_get0_key(dh, NULL, &priv_key);
    if (!priv_key) {
        PyErr_SetString(_dh_err, "'priv' is unset");
        return NULL;
    }
    return bn_to_mpi(priv_key);
}

PyObject *dh_set_pg(DH *dh, PyObject *pval, PyObject* gval) {
    BIGNUM* p, *g;

    if (!(p = m2_PyObject_AsBIGNUM(pval, _dh_err))
        || !(g = m2_PyObject_AsBIGNUM(gval, _dh_err)))
        return NULL;

    if (!DH_set0_pqg(dh, p, NULL, g)) {
        PyErr_SetString(_dh_err,
            "Cannot set prime number or generator of Z_p for DH.");
        BN_free(p);
        BN_free(g);
        return NULL;
        }

    Py_RETURN_NONE;
}


#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/opensslv.h>


static PyObject *_rsa_err;

void rsa_init(PyObject *rsa_err) {
    Py_INCREF(rsa_err);
    _rsa_err = rsa_err;
}


RSA *rsa_read_key(BIO *f, PyObject *pyfunc) {
    RSA *rsa;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    rsa = PEM_read_bio_RSAPrivateKey(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return rsa;
}


int rsa_write_key(RSA *rsa, BIO *f, EVP_CIPHER *cipher, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_RSAPrivateKey(f, rsa, cipher, NULL, 0,
        passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int rsa_write_key_no_cipher(RSA *rsa, BIO *f, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_RSAPrivateKey(f, rsa, NULL, NULL, 0,
                      passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


RSA *rsa_read_pub_key(BIO *f) {
    return PEM_read_bio_RSA_PUBKEY(f, NULL, NULL, NULL);
}


int rsa_write_pub_key(RSA *rsa, BIO *f) {
    return PEM_write_bio_RSA_PUBKEY(f, rsa);
}

PyObject *rsa_get_e(RSA *rsa) {
    const BIGNUM* e = NULL;
    RSA_get0_key(rsa, NULL, &e, NULL);
    if (!e) {
        PyErr_SetString(_rsa_err, "'e' is unset");
        return NULL;
    }
    return bn_to_mpi(e);
}

PyObject *rsa_get_n(RSA *rsa) {
    const BIGNUM* n = NULL;
    RSA_get0_key(rsa, &n, NULL, NULL);
    if (!n) {
        PyErr_SetString(_rsa_err, "'n' is unset");
        return NULL;
    }
    return bn_to_mpi(n);
}

PyObject *rsa_set_e(RSA *rsa, PyObject *eval) {
    const BIGNUM* n_read = NULL;
    BIGNUM* n = NULL;
    BIGNUM* e;

    if (!(e = m2_PyObject_AsBIGNUM(eval, _rsa_err))) {
        return NULL;
    }

    /* n and e must be set at the same time so if e is unset, set it to zero */
    RSA_get0_key(rsa, &n_read, NULL, NULL);
    if (!n_read) {
        n = BN_new();
    }

    if (RSA_set0_key(rsa, n, e, NULL) != 1) {
        PyErr_SetString(_rsa_err, "Cannot set fields of RSA object.");
        BN_free(e);
        BN_free(n);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *rsa_set_n(RSA *rsa, PyObject *nval) {
    BIGNUM* n;
    const BIGNUM* e_read = NULL;
    BIGNUM* e = NULL;

    if (!(n = m2_PyObject_AsBIGNUM(nval, _rsa_err))) {
        return NULL;
    }

    /* n and e must be set at the same time so if e is unset, set it to zero */
    RSA_get0_key(rsa, NULL, &e_read, NULL);
    if (!e_read) {
        e = BN_new();
    }

    if (RSA_set0_key(rsa, n, e, NULL) != 1) {
        PyErr_SetString(_rsa_err, "Cannot set fields of RSA object.");
        BN_free(n);
        BN_free(e);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *rsa_set_en(RSA *rsa, PyObject *eval, PyObject* nval) {
    BIGNUM* e, *n;

    if (!(e = m2_PyObject_AsBIGNUM(eval, _rsa_err)) ||
        !(n = m2_PyObject_AsBIGNUM(nval, _rsa_err))) {
        return NULL;
    }

    if (!RSA_set0_key(rsa, n, e, NULL)) {
        PyErr_SetString(_rsa_err, "Cannot set fields of RSA object.");
        BN_free(e);
        BN_free(n);
        return NULL;
    }
    Py_RETURN_NONE;
}

static BIGNUM* PyObject_Bin_AsBIGNUM(PyObject* value) {
    BIGNUM* bn;
    const void* vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(bn = BN_bin2bn((unsigned char *)vbuf, vlen, NULL))) {
        m2_PyErr_Msg(_rsa_err);
        return NULL;
        }

    return bn;
}

PyObject *rsa_set_en_bin(RSA *rsa, PyObject *eval, PyObject* nval) {
    BIGNUM* e, *n;

    if (!(e = PyObject_Bin_AsBIGNUM(eval)) ||
        !(n = PyObject_Bin_AsBIGNUM(nval))) {
        return NULL;
    }

    if (!RSA_set0_key(rsa, e, n, NULL)) {
        PyErr_SetString(_rsa_err, "Cannot set fields of RSA object.");
        BN_free(e);
        BN_free(n);
        return NULL;
    }
    Py_RETURN_NONE;
}

PyObject *rsa_private_encrypt(RSA *rsa, PyObject *from, int padding) {
    const void *fbuf;
    void *tbuf;
    int flen = 0, tlen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(from, &fbuf, &flen) == -1)
        return NULL;

    if (!(tbuf = PyMem_Malloc(RSA_size(rsa)))) {
        PyErr_SetString(PyExc_MemoryError, "rsa_private_encrypt");
        return NULL;
    }
    tlen = RSA_private_encrypt(flen, (unsigned char *)fbuf,
        (unsigned char *)tbuf, rsa, padding);
    if (tlen == -1) {
        m2_PyErr_Msg(_rsa_err);
        PyMem_Free(tbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((const char *)tbuf, tlen);

    PyMem_Free(tbuf);
    return ret;
}

PyObject *rsa_public_decrypt(RSA *rsa, PyObject *from, int padding) {
    const void *fbuf;
    void *tbuf;
    int flen = 0, tlen = 0;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(from, &fbuf, &flen) == -1)
        return NULL;

    /* OpenSSL docs are confused here: it says we only need buffer
     * 'RSA_size()-11', but it is true only for RSA PKCS#1 type 1
     * padding. For other uses we need to use different sizes. */
    if (!(tbuf = PyMem_Malloc(RSA_size(rsa)))) {
        PyErr_SetString(PyExc_MemoryError, "rsa_public_decrypt");
        return NULL;
    }
    tlen = RSA_public_decrypt(flen, (unsigned char *)fbuf,
        (unsigned char *)tbuf, rsa, padding);
    if (tlen == -1) {
        m2_PyErr_Msg(_rsa_err);
        PyMem_Free(tbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((const char *)tbuf, tlen);

    PyMem_Free(tbuf);
    return ret;
}

PyObject *rsa_public_encrypt(RSA *rsa, PyObject *from, int padding) {
    const void *fbuf;
    void *tbuf;
    int flen = 0, tlen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(from, &fbuf, &flen) == -1)
        return NULL;

    if (!(tbuf = PyMem_Malloc(RSA_size(rsa)))) {
        PyErr_SetString(PyExc_MemoryError, "rsa_public_encrypt");
        return NULL;
    }
    tlen = RSA_public_encrypt(flen, (unsigned char *)fbuf,
        (unsigned char *)tbuf, rsa, padding);
    if (tlen == -1) {
        m2_PyErr_Msg(_rsa_err);
        PyMem_Free(tbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((const char *)tbuf, tlen);

    PyMem_Free(tbuf);
    return ret;
}

PyObject *rsa_private_decrypt(RSA *rsa, PyObject *from, int padding) {
    const void *fbuf;
    void *tbuf;
    int flen = 0, tlen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(from, &fbuf, &flen) == -1)
        return NULL;

    if (!(tbuf = PyMem_Malloc(RSA_size(rsa)))) {
        PyErr_SetString(PyExc_MemoryError, "rsa_private_decrypt");
        return NULL;
    }
    tlen = RSA_private_decrypt(flen, (unsigned char *)fbuf,
        (unsigned char *)tbuf, rsa, padding);
    if (tlen == -1) {
        m2_PyErr_Msg(_rsa_err);
        PyMem_Free(tbuf);
        return NULL;
    }
    ret = PyBytes_FromStringAndSize((const char *)tbuf, tlen);

    PyMem_Free(tbuf);
    return ret;
}

#if OPENSSL_VERSION_NUMBER >= 0x0090708fL
PyObject *rsa_padding_add_pkcs1_pss(RSA *rsa, PyObject *digest, EVP_MD *hash, int salt_length) {
    const void *dbuf;
    unsigned char *tbuf;
    int dlen, result, tlen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(digest, &dbuf, &dlen) == -1)
        return NULL;

    tlen = RSA_size(rsa);

    if (!(tbuf = OPENSSL_malloc(tlen))) {
        PyErr_SetString(PyExc_MemoryError, "rsa_padding_add_pkcs1_pss");
        return NULL;
    }
    result = RSA_padding_add_PKCS1_PSS(
        rsa,
        tbuf,
        (unsigned char *)dbuf,
        hash,
        salt_length);

    if (result == -1) {
        m2_PyErr_Msg(_rsa_err);
        OPENSSL_cleanse(tbuf, tlen);
        OPENSSL_free(tbuf);
        return NULL;
    }
    ret = PyBytes_FromStringAndSize((const char *)tbuf, tlen);
    OPENSSL_cleanse(tbuf, tlen);
    OPENSSL_free(tbuf);
    return ret;
}

int rsa_verify_pkcs1_pss(RSA *rsa, PyObject *digest, PyObject *signature, EVP_MD *hash, int salt_length) {
    const void *dbuf;
    const void *sbuf;
    int dlen, slen, ret;

    if (m2_PyObject_AsReadBufferInt(digest, &dbuf, &dlen) == -1) {
        return 0;
    }

    if (m2_PyObject_AsReadBufferInt(signature, &sbuf, &slen) == -1) {
        return 0;
    }

    ret = RSA_verify_PKCS1_PSS(
        rsa,
        (unsigned char *)dbuf,
        hash,
        (unsigned char *)sbuf,
        salt_length);

    return ret;
}
#endif

PyObject *rsa_sign(RSA *rsa, PyObject *py_digest_string, int method_type) {
    int digest_len = 0;
    int buf_len = 0;
    int ret = 0;
    unsigned int real_buf_len = 0;
    char *digest_string = NULL;
    unsigned char * sign_buf = NULL;
    PyObject *signature;

    ret = m2_PyString_AsStringAndSizeInt(py_digest_string, &digest_string,
                                         &digest_len);
    if (ret == -1) {
        /* PyString_AsStringAndSize raises the correct exceptions. */
        return NULL;
    }

    buf_len = RSA_size(rsa);
    sign_buf = (unsigned char *)PyMem_Malloc(buf_len);
    ret = RSA_sign(method_type, (const unsigned char *)digest_string, digest_len,
                   sign_buf, &real_buf_len, rsa);

    if (!ret) {
        m2_PyErr_Msg(_rsa_err);
        PyMem_Free(sign_buf);
        return NULL;
    }

    signature =  PyBytes_FromStringAndSize((const char*) sign_buf, buf_len);

    PyMem_Free(sign_buf);
    return signature;
}

int rsa_verify(RSA *rsa, PyObject *py_verify_string, PyObject* py_sign_string, int method_type){
    int ret = 0;
    char * sign_string = NULL;
    char * verify_string = NULL;
    int verify_len = 0;
    int sign_len = 0;

    ret = m2_PyString_AsStringAndSizeInt(py_verify_string, &verify_string,
                                         &verify_len);
    if (ret == -1) {
        /* PyString_AsStringAndSize raises the correct exceptions. */
        return 0;
    }
    ret = m2_PyString_AsStringAndSizeInt(py_sign_string, &sign_string,
                                         &sign_len);
    if (ret == -1) {
        return 0;
    }

    ret = RSA_verify(method_type, (unsigned char *) verify_string,
                     verify_len, (unsigned char *) sign_string,
                     sign_len, rsa);
    if (!ret) {
        m2_PyErr_Msg(_rsa_err);
        return 0;
    }
    return ret;
}

PyObject *rsa_generate_key(int bits, unsigned long e, PyObject *pyfunc) {
    RSA *rsa;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    BN_GENCB *gencb;
    BIGNUM *e_big;
    int ret;

    if ((e_big=BN_new()) == NULL) {
        m2_PyErr_Msg(_rsa_err);
        return NULL;
    }

    if (BN_set_word(e_big, e) == 0) {
        m2_PyErr_Msg(_rsa_err);
        BN_free(e_big);
        return NULL;
    }

    if ((gencb=BN_GENCB_new()) == NULL) {
        m2_PyErr_Msg(_rsa_err);
        BN_free(e_big);
        return NULL;
    }

    if ((rsa = RSA_new()) == NULL) {
        m2_PyErr_Msg(_rsa_err);
        BN_free(e_big);
        BN_GENCB_free(gencb);
        return NULL;
    }

    BN_GENCB_set(gencb, bn_gencb_callback, (void *) pyfunc);

    Py_INCREF(pyfunc);
    ret = RSA_generate_key_ex(rsa, bits, e_big, gencb);
    BN_free(e_big);
    BN_GENCB_free(gencb);
    Py_DECREF(pyfunc);

    if (ret)
        return SWIG_NewPointerObj((void *)rsa, SWIGTYPE_p_RSA, 0);

    m2_PyErr_Msg(_rsa_err);
    RSA_free(rsa);
    return NULL;
}

int rsa_type_check(RSA *rsa) {
    return 1;
}

int rsa_check_pub_key(RSA *rsa) {
    const BIGNUM* n, *e;
    RSA_get0_key(rsa, &n, &e, NULL);
    return n && e;
}


int rsa_write_key_der(RSA *rsa, BIO *bio) {
    return i2d_RSAPrivateKey_bio(bio, rsa);
}


#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/dsa.h>

PyObject *dsa_sig_get_r(DSA_SIG *dsa_sig) {
    const BIGNUM* pr;
    DSA_SIG_get0(dsa_sig, &pr, NULL);
    return bn_to_mpi(pr);
}

PyObject *dsa_sig_get_s(DSA_SIG *dsa_sig) {
    const BIGNUM* qs;
    DSA_SIG_get0(dsa_sig, NULL, &qs);
    return bn_to_mpi(qs);
}


static PyObject *_dsa_err;

void dsa_init(PyObject *dsa_err) {
    Py_INCREF(dsa_err);
    _dsa_err = dsa_err;
}


DSA *dsa_generate_parameters(int bits, PyObject *pyfunc) {
    DSA *dsa;
    BN_GENCB *gencb;
    int ret;

    if ((gencb=BN_GENCB_new()) == NULL) {
        m2_PyErr_Msg(_dh_err);
        return NULL;
    }

    if ((dsa = DSA_new()) == NULL) {
        m2_PyErr_Msg(_dsa_err);
        BN_GENCB_free(gencb);
        return NULL;
    }

    BN_GENCB_set(gencb, bn_gencb_callback, (void *) pyfunc);

    Py_INCREF(pyfunc);
    ret = DSA_generate_parameters_ex(dsa, bits, NULL, 0, NULL, NULL,
                                     gencb);
    Py_DECREF(pyfunc);
    BN_GENCB_free(gencb);

    if (ret)
        return dsa;

    m2_PyErr_Msg(_dsa_err);
    DSA_free(dsa);
    return NULL;
}

DSA *dsa_read_params(BIO *f, PyObject *pyfunc) {
    DSA *ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_read_bio_DSAparams(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);

    if (ret == NULL) {
        m2_PyErr_Msg(_dsa_err);
    }

    return ret;
}

DSA *dsa_read_key(BIO *f, PyObject *pyfunc) {
    DSA *ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_read_bio_DSAPrivateKey(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);

    if (ret == NULL) {
        m2_PyErr_Msg(_dsa_err);
    }

    return ret;
}

DSA *dsa_read_pub_key(BIO *f, PyObject *pyfunc) {
    DSA *ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_read_bio_DSA_PUBKEY(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);

    if (ret == NULL) {
        m2_PyErr_Msg(_dsa_err);
    }

    return ret;
}


PyObject *dsa_get_p(DSA *dsa) {
    const BIGNUM* p = NULL;
    DSA_get0_pqg(dsa, &p, NULL, NULL);
    if (!p) {
        PyErr_SetString(_dsa_err, "'p' is unset");
        return NULL;
    }
    return bn_to_mpi(p);
}

PyObject *dsa_get_q(DSA *dsa) {
    const BIGNUM* q = NULL;
    DSA_get0_pqg(dsa, NULL, &q, NULL);
    if (!q) {
        PyErr_SetString(_dsa_err, "'q' is unset");
        return NULL;
    }
    return bn_to_mpi(q);
}

PyObject *dsa_get_g(DSA *dsa) {
    const BIGNUM* g = NULL;
    DSA_get0_pqg(dsa, NULL, NULL, &g);
    if (!g) {
        PyErr_SetString(_dsa_err, "'g' is unset");
        return NULL;
    }
    return bn_to_mpi(g);
}

PyObject *dsa_get_pub(DSA *dsa) {
    const BIGNUM* pub_key = NULL;
    DSA_get0_key(dsa, &pub_key, NULL);
    if (!pub_key) {
        PyErr_SetString(_dsa_err, "'pub' is unset");
        return NULL;
    }
    return bn_to_mpi(pub_key);
}

PyObject *dsa_get_priv(DSA *dsa) {
    const BIGNUM* priv_key = NULL;
    DSA_get0_key(dsa, NULL, &priv_key);
    if (!priv_key) {
        PyErr_SetString(_dsa_err, "'priv' is unset");
        return NULL;
    }
    return bn_to_mpi(priv_key);
}

PyObject *dsa_set_pqg(DSA *dsa, PyObject *pval, PyObject* qval, PyObject* gval) {
    BIGNUM* p, *q, *g;

    if (!(p = m2_PyObject_AsBIGNUM(pval, _dsa_err))
        || !(q = m2_PyObject_AsBIGNUM(qval, _dsa_err))
        || !(g = m2_PyObject_AsBIGNUM(gval, _dsa_err)))
        return NULL;

    if (!DSA_set0_pqg(dsa, p, q, g)) {
        PyErr_SetString(
            _dsa_err,
            "Cannot set prime number, subprime, or generator of subgroup for DSA.");
        BN_free(p);
        BN_free(q);
        BN_free(g);
        return NULL;
        }

    Py_RETURN_NONE;
    }

PyObject *dsa_set_pub(DSA *dsa, PyObject *value) {
    BIGNUM *bn;
    const void *vbuf;
    int vlen = 0;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(bn = BN_mpi2bn((unsigned char *)vbuf, vlen, NULL))) {
        m2_PyErr_Msg(_dsa_err);
        return NULL;
    }
    if (!DSA_set0_key(dsa, bn, NULL)) {
        BN_free(bn);
        PyErr_SetString(_dsa_err, "Cannot set private and public key for DSA.");
    }
    Py_RETURN_NONE;
}


int dsa_write_params_bio(DSA* dsa, BIO* f) {
    return PEM_write_bio_DSAparams(f, dsa);
}


int dsa_write_key_bio(DSA* dsa, BIO* f, EVP_CIPHER *cipher, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_DSAPrivateKey(f, dsa, cipher, NULL, 0,
                                        passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int dsa_write_key_bio_no_cipher(DSA* dsa, BIO* f, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_DSAPrivateKey(f, dsa, NULL, NULL, 0,
                                        passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int dsa_write_pub_key_bio(DSA* dsa, BIO* f) {
    return PEM_write_bio_DSA_PUBKEY(f, dsa);
}


PyObject *dsa_sign(DSA *dsa, PyObject *value) {
    const void *vbuf;
    int vlen = 0;
    PyObject *tuple;
    DSA_SIG *sig;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(sig = DSA_do_sign(vbuf, vlen, dsa))) {
        m2_PyErr_Msg(_dsa_err);
        return NULL;
    }
    if (!(tuple = PyTuple_New(2))) {
        DSA_SIG_free(sig);
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
        return NULL;
    }
    PyTuple_SET_ITEM(tuple, 0, dsa_sig_get_r(sig));
    PyTuple_SET_ITEM(tuple, 1, dsa_sig_get_s(sig));
    DSA_SIG_free(sig);
    return tuple;
}

int dsa_verify(DSA *dsa, PyObject *value, PyObject *r, PyObject *s) {
    const void *vbuf, *rbuf, *sbuf;
    int vlen = 0, rlen = 0, slen = 0;
    DSA_SIG *sig;
    BIGNUM* pr, *ps;
    int ret;

    if ((m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        || (m2_PyObject_AsReadBufferInt(r, &rbuf, &rlen) == -1)
        || (m2_PyObject_AsReadBufferInt(s, &sbuf, &slen) == -1))
        return -1;

    if (!(sig = DSA_SIG_new())) {
        m2_PyErr_Msg(_dsa_err);
        return -1;
    }
    if (!(pr = BN_mpi2bn((unsigned char *)rbuf, rlen, NULL))) {
        m2_PyErr_Msg(_dsa_err);
        DSA_SIG_free(sig);
        return -1;
    }
    if (!(ps = BN_mpi2bn((unsigned char *)sbuf, slen, NULL))) {
        m2_PyErr_Msg(_dsa_err);
        DSA_SIG_free(sig);
        BN_free(pr);
        return -1;
    }
    if (!DSA_SIG_set0(sig, pr, ps)) {
        m2_PyErr_Msg(_dsa_err);
        DSA_SIG_free(sig);
        BN_free(pr);
        BN_free(ps);
        return -1;
    }

    ret = DSA_do_verify(vbuf, vlen, sig, dsa);
    DSA_SIG_free(sig);
    if (ret == -1)
        m2_PyErr_Msg(_dsa_err);
    return ret;
}

PyObject *dsa_sign_asn1(DSA *dsa, PyObject *value) {
    const void *vbuf;
    int vlen = 0;
    void *sigbuf;
    unsigned int siglen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(sigbuf = PyMem_Malloc(DSA_size(dsa)))) {
        PyErr_SetString(PyExc_MemoryError, "dsa_sign_asn1");
        return NULL;
    }
    if (!DSA_sign(0, vbuf, vlen, (unsigned char *)sigbuf, &siglen, dsa)) {
        m2_PyErr_Msg(_dsa_err);
        PyMem_Free(sigbuf);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize(sigbuf, siglen);

    PyMem_Free(sigbuf);
    return ret;
}

int dsa_verify_asn1(DSA *dsa, PyObject *value, PyObject *sig) {
    const void *vbuf;
    void *sbuf;
    int vlen = 0, slen = 0, ret = 0;

    if ((m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        || (m2_PyObject_AsReadBufferInt(sig, (const void **)&sbuf, &slen)
        == -1))
        return -1;

    if ((ret = DSA_verify(0, vbuf, vlen, sbuf, slen, dsa)) == -1)
        m2_PyErr_Msg(_dsa_err);
    return ret;
}

int dsa_check_key(DSA *dsa) {
    const BIGNUM* pub_key, *priv_key;
    DSA_get0_key(dsa, &pub_key, &priv_key);
    return pub_key != NULL && priv_key != NULL;
}

int dsa_check_pub_key(DSA *dsa) {
    const BIGNUM* pub_key;
    DSA_get0_key(dsa, &pub_key, NULL);
    return pub_key ? 1 : 0;
}

int dsa_keylen(DSA *dsa) {
    const BIGNUM* p;
    DSA_get0_pqg(dsa, &p, NULL, NULL);
    return BN_num_bits(p);
}

int dsa_type_check(DSA *dsa) {
    return 1;
}


#include <pythread.h>
#include <limits.h>
#include <openssl/bio.h>
#include <openssl/dh.h>
#include <openssl/ssl.h>
#include <openssl/tls1.h>
#include <openssl/x509.h>
#ifdef _WIN32
#include <WinSock2.h>
#include <Windows.h>
#pragma comment(lib, "Ws2_32")
typedef unsigned __int64 uint64_t;
#else
#include <poll.h>
#include <sys/time.h>
#endif


static PyObject *_ssl_err;
static PyObject *_ssl_timeout_err;

void ssl_init(PyObject *ssl_err, PyObject *ssl_timeout_err) {
    SSL_library_init();
    SSL_load_error_strings();
    Py_INCREF(ssl_err);
    Py_INCREF(ssl_timeout_err);
    _ssl_err = ssl_err;
    _ssl_timeout_err = ssl_timeout_err;
}

const SSL_METHOD *tlsv1_method(void) {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
    PyErr_WarnEx(PyExc_DeprecationWarning,
                 "Function TLSv1_method has been deprecated.", 1);
#endif
    return TLSv1_method();
}

void ssl_ctx_passphrase_callback(SSL_CTX *ctx, PyObject *pyfunc) {
    SSL_CTX_set_default_passwd_cb(ctx, passphrase_callback);
    SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)pyfunc);
    Py_INCREF(pyfunc);
}

int ssl_ctx_use_x509(SSL_CTX *ctx, X509 *x) {
    int i;

    if (!(i = SSL_CTX_use_certificate(ctx, x))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;

}

int ssl_ctx_use_cert(SSL_CTX *ctx, char *file) {
    int i;

    if (!(i = SSL_CTX_use_certificate_file(ctx, file, SSL_FILETYPE_PEM))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;
}

int ssl_ctx_use_cert_chain(SSL_CTX *ctx, char *file) {
    int i;

    if (!(i = SSL_CTX_use_certificate_chain_file(ctx, file))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;
}


int ssl_ctx_use_privkey(SSL_CTX *ctx, char *file) {
    int i;

    if (!(i = SSL_CTX_use_PrivateKey_file(ctx, file, SSL_FILETYPE_PEM))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;
}

int ssl_ctx_use_rsa_privkey(SSL_CTX *ctx, RSA *rsakey) {
    int i;

    if (!(i = SSL_CTX_use_RSAPrivateKey(ctx, rsakey))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;
}

int ssl_ctx_use_pkey_privkey(SSL_CTX *ctx, EVP_PKEY *pkey) {
    int i;

    if (!(i = SSL_CTX_use_PrivateKey(ctx, pkey))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return i;
}


int ssl_ctx_check_privkey(SSL_CTX *ctx) {
    int ret;

    if (!(ret = SSL_CTX_check_private_key(ctx))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return ret;
}

void ssl_ctx_set_client_CA_list_from_file(SSL_CTX *ctx, const char *ca_file) {
    SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(ca_file));
}

void ssl_ctx_set_verify_default(SSL_CTX *ctx, int mode) {
    SSL_CTX_set_verify(ctx, mode, NULL);
}

void ssl_ctx_set_verify(SSL_CTX *ctx, int mode, PyObject *pyfunc) {
    Py_XDECREF(ssl_verify_cb_func);
    Py_INCREF(pyfunc);
    ssl_verify_cb_func = pyfunc;
    SSL_CTX_set_verify(ctx, mode, ssl_verify_callback);
}

int ssl_ctx_set_session_id_context(SSL_CTX *ctx, PyObject *sid_ctx) {
    const void *buf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(sid_ctx, &buf, &len) == -1)
        return -1;

    return SSL_CTX_set_session_id_context(ctx, buf, len);
}

void ssl_ctx_set_info_callback(SSL_CTX *ctx, PyObject *pyfunc) {
    Py_XDECREF(ssl_info_cb_func);
    Py_INCREF(pyfunc);
    ssl_info_cb_func = pyfunc;
    SSL_CTX_set_info_callback(ctx, ssl_info_callback);
}

long ssl_ctx_set_tmp_dh(SSL_CTX *ctx, DH* dh) {
    return SSL_CTX_set_tmp_dh(ctx, dh);
}

void ssl_ctx_set_tmp_dh_callback(SSL_CTX *ctx,  PyObject *pyfunc) {
    Py_XDECREF(ssl_set_tmp_dh_cb_func);
    Py_INCREF(pyfunc);
    ssl_set_tmp_dh_cb_func = pyfunc;
    SSL_CTX_set_tmp_dh_callback(ctx, ssl_set_tmp_dh_callback);
}

long ssl_ctx_set_tmp_rsa(SSL_CTX *ctx, RSA* rsa) {
    return SSL_CTX_set_tmp_rsa(ctx, rsa);
}

void ssl_ctx_set_tmp_rsa_callback(SSL_CTX *ctx,  PyObject *pyfunc) {
    Py_XDECREF(ssl_set_tmp_rsa_cb_func);
    Py_INCREF(pyfunc);
    ssl_set_tmp_rsa_cb_func = pyfunc;
    SSL_CTX_set_tmp_rsa_callback(ctx, ssl_set_tmp_rsa_callback);
}

int ssl_ctx_load_verify_locations(SSL_CTX *ctx, const char *cafile, const char *capath) {
    return SSL_CTX_load_verify_locations(ctx, cafile, capath);
}

/* SSL_CTX_set_options is a macro. */
long ssl_ctx_set_options(SSL_CTX *ctx, long op) {
    return SSL_CTX_set_options(ctx, op);
}

int bio_set_ssl(BIO *bio, SSL *ssl, int flag) {
    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
    return BIO_ctrl(bio, BIO_C_SET_SSL, flag, (char *)ssl);
}

long ssl_set_mode(SSL *ssl, long mode) {
    return SSL_set_mode(ssl, mode);
}

long ssl_get_mode(SSL *ssl) {
    return SSL_get_mode(ssl);
}

int ssl_set_tlsext_host_name(SSL *ssl, const char *name) {
    long l;

    if (!(l = SSL_set_tlsext_host_name(ssl, name))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    /* Return an "int" to match the 'typemap(out) int' in _lib.i */
    return 1;
}

void ssl_set_client_CA_list_from_file(SSL *ssl, const char *ca_file) {
    SSL_set_client_CA_list(ssl, SSL_load_client_CA_file(ca_file));
}

void ssl_set_client_CA_list_from_context(SSL *ssl, SSL_CTX *ctx) {
    SSL_set_client_CA_list(ssl, SSL_CTX_get_client_CA_list(ctx));
}

int ssl_set_session_id_context(SSL *ssl, PyObject *sid_ctx) {
    const void *buf;
    int len = 0;

    if (m2_PyObject_AsReadBufferInt(sid_ctx, &buf, &len) == -1)
        return -1;

    return SSL_set_session_id_context(ssl, buf, len);
}

int ssl_set_fd(SSL *ssl, int fd) {
    int ret;

    if (!(ret = SSL_set_fd(ssl, fd))) {
        m2_PyErr_Msg(_ssl_err);
        return -1;
    }
    return ret;
}

static void ssl_handle_error(int ssl_err, int ret) {
    int err;

    switch (ssl_err) {
        case SSL_ERROR_SSL:
            PyErr_SetString(_ssl_err,
                            ERR_reason_error_string(ERR_get_error()));
            break;
        case SSL_ERROR_SYSCALL:
            err = ERR_get_error();
            if (err)
                PyErr_SetString(_ssl_err, ERR_reason_error_string(err));
            else if (ret == 0)
                PyErr_SetString(_ssl_err, "unexpected eof");
            else if (ret == -1)
                PyErr_SetFromErrno(_ssl_err);
            else
                assert(0);
            break;
        default:
            PyErr_SetString(_ssl_err, "unexpected SSL error");
     }
}

#ifdef _WIN32
/* http://stackoverflow.com/questions/10905892/equivalent-of-gettimeday-for-windows */
int gettimeofday(struct timeval *tp, void *tzp)
{
    // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
    static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);

    SYSTEMTIME  system_time;
    FILETIME    file_time;
    uint64_t    time;

    GetSystemTime( &system_time );
    SystemTimeToFileTime( &system_time, &file_time );
    time =  ((uint64_t)file_time.dwLowDateTime )      ;
    time += ((uint64_t)file_time.dwHighDateTime) << 32;

    tp->tv_sec  = (long) ((time - EPOCH) / 10000000L);
    tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
    return 0;
}
#endif

static int ssl_sleep_with_timeout(SSL *ssl, const struct timeval *start,
                                  double timeout, int ssl_err) {
#ifdef _WIN32
WSAPOLLFD fd;
#else
struct pollfd fd;
#endif
    struct timeval tv;
    int ms, tmp;

    assert(timeout > 0);
 again:
    gettimeofday(&tv, NULL);
    /* tv >= start */
    if ((timeout + start->tv_sec - tv.tv_sec) > INT_MAX / 1000)
        ms = -1;
    else {
        int fract;

        ms = ((start->tv_sec + (int)timeout) - tv.tv_sec) * 1000;
        fract = (int)((start->tv_usec + (timeout - (int)timeout) * 1000000
                 - tv.tv_usec + 999) / 1000);
        if (ms > 0 && fract > INT_MAX - ms)
            ms = -1;
        else {
            ms += fract;
            if (ms <= 0)
                goto timeout;
        }
    }
    switch (ssl_err) {
	    case SSL_ERROR_WANT_READ:
            fd.fd = SSL_get_rfd(ssl);
            fd.events = POLLIN;
            break;

	    case SSL_ERROR_WANT_WRITE:
            fd.fd = SSL_get_wfd(ssl);
            fd.events = POLLOUT;
            break;

	    case SSL_ERROR_WANT_X509_LOOKUP:
            return 0; /* FIXME: is this correct? */

	    default:
            assert(0);
    }
    if (fd.fd == -1) {
        PyErr_SetString(_ssl_err, "timeout on a non-FD SSL");
        return -1;
    }
    Py_BEGIN_ALLOW_THREADS
#ifdef _WIN32
    tmp = WSAPoll(&fd, 1, ms);
#else
    tmp = poll(&fd, 1, ms);
#endif
    Py_END_ALLOW_THREADS
    switch (tmp) {
    	case 1:
            return 0;
    	case 0:
            goto timeout;
    	case -1:
#ifdef _WIN32
            if (WSAGetLastError() == EINTR)
#else
            if (errno == EINTR)
#endif
                goto again;
            PyErr_SetFromErrno(_ssl_err);
            return -1;
    }
    return 0;

 timeout:
    PyErr_SetString(_ssl_timeout_err, "timed out");
    return -1;
}

PyObject *ssl_accept(SSL *ssl, double timeout) {
    PyObject *obj = NULL;
    int r, ssl_err;
    struct timeval tv;

    if (timeout > 0)
        gettimeofday(&tv, NULL);
 again:
    Py_BEGIN_ALLOW_THREADS
    r = SSL_accept(ssl);
    ssl_err = SSL_get_error(ssl, r);
    Py_END_ALLOW_THREADS


    switch (ssl_err) {
        case SSL_ERROR_NONE:
        case SSL_ERROR_ZERO_RETURN:
            obj = PyLong_FromLong((long)1);
            break;
        case SSL_ERROR_WANT_WRITE:
        case SSL_ERROR_WANT_READ:
            if (timeout <= 0) {
                obj = PyLong_FromLong((long)0);
                break;
            }
            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
                goto again;
            obj = NULL;
            break;
        case SSL_ERROR_SSL:
        case SSL_ERROR_SYSCALL:
            ssl_handle_error(ssl_err, r);
            obj = NULL;
            break;
    }


    return obj;
}

PyObject *ssl_connect(SSL *ssl, double timeout) {
    PyObject *obj = NULL;
    int r, ssl_err;
    struct timeval tv;

    if (timeout > 0)
        gettimeofday(&tv, NULL);
 again:
    Py_BEGIN_ALLOW_THREADS
    r = SSL_connect(ssl);
    ssl_err = SSL_get_error(ssl, r);
    Py_END_ALLOW_THREADS

    
    switch (ssl_err) {
        case SSL_ERROR_NONE:
        case SSL_ERROR_ZERO_RETURN:
            obj = PyLong_FromLong((long)1);
            break;
        case SSL_ERROR_WANT_WRITE:
        case SSL_ERROR_WANT_READ:
            if (timeout <= 0) {
                obj = PyLong_FromLong((long)0);
                break;
            }
            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
                goto again;
            obj = NULL;
            break;
        case SSL_ERROR_SSL:
        case SSL_ERROR_SYSCALL:
            ssl_handle_error(ssl_err, r);
            obj = NULL;
            break;
    }
    
    
    return obj;
}

void ssl_set_shutdown1(SSL *ssl, int mode) {
    SSL_set_shutdown(ssl, mode);
}

PyObject *ssl_read(SSL *ssl, int num, double timeout) {
    PyObject *obj = NULL;
    void *buf;
    int r;
    struct timeval tv;

    if (!(buf = PyMem_Malloc(num))) {
        PyErr_SetString(PyExc_MemoryError, "ssl_read");
        return NULL;
    }


    if (timeout > 0)
        gettimeofday(&tv, NULL);
 again:
    Py_BEGIN_ALLOW_THREADS
    r = SSL_read(ssl, buf, num);
    Py_END_ALLOW_THREADS

    if (r >= 0) {
        buf = PyMem_Realloc(buf, r);
        obj = PyBytes_FromStringAndSize(buf, r);
    } else {
        int ssl_err;

        ssl_err = SSL_get_error(ssl, r);
        switch (ssl_err) {
            case SSL_ERROR_NONE:
            case SSL_ERROR_ZERO_RETURN:
                assert(0);

            case SSL_ERROR_WANT_WRITE:
            case SSL_ERROR_WANT_READ:
            case SSL_ERROR_WANT_X509_LOOKUP:
                if (timeout <= 0) {
                    Py_INCREF(Py_None);
                    obj = Py_None;
                    break;
                }
                if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
                    goto again;
                obj = NULL;
                break;
            case SSL_ERROR_SSL:
            case SSL_ERROR_SYSCALL:
                ssl_handle_error(ssl_err, r);
                obj = NULL;
                break;
        }
    }
    PyMem_Free(buf);


    return obj;
}

PyObject *ssl_read_nbio(SSL *ssl, int num) {
    PyObject *obj = NULL;
    void *buf;
    int r, err;


    if (!(buf = PyMem_Malloc(num))) {
        PyErr_SetString(PyExc_MemoryError, "ssl_read");
        return NULL;
    }


    Py_BEGIN_ALLOW_THREADS
    r = SSL_read(ssl, buf, num);
    Py_END_ALLOW_THREADS


    switch (SSL_get_error(ssl, r)) {
        case SSL_ERROR_NONE:
        case SSL_ERROR_ZERO_RETURN:
            buf = PyMem_Realloc(buf, r);

            obj = PyBytes_FromStringAndSize(buf, r);

            break;
        case SSL_ERROR_WANT_WRITE:
        case SSL_ERROR_WANT_READ:
        case SSL_ERROR_WANT_X509_LOOKUP:
            Py_INCREF(Py_None);
            obj = Py_None;
            break;
        case SSL_ERROR_SSL:
            m2_PyErr_Msg(_ssl_err);
            obj = NULL;
            break;
        case SSL_ERROR_SYSCALL:
            err = ERR_get_error();
            if (err)
                PyErr_SetString(_ssl_err, ERR_reason_error_string(err));
            else if (r == 0)
                PyErr_SetString(_ssl_err, "unexpected eof");
            else if (r == -1)
                PyErr_SetFromErrno(_ssl_err);
            obj = NULL;
            break;
    }
    PyMem_Free(buf);


    return obj;
}

int ssl_write(SSL *ssl, PyObject *blob, double timeout) {
    Py_buffer buf;
    int r, ssl_err, ret;
    struct timeval tv;


    if (m2_PyObject_GetBufferInt(blob, &buf, PyBUF_CONTIG_RO) == -1) {
        return -1;
    }

    if (timeout > 0)
        gettimeofday(&tv, NULL);
 again:
    Py_BEGIN_ALLOW_THREADS
    r = SSL_write(ssl, buf.buf, buf.len);
    ssl_err = SSL_get_error(ssl, r);
    Py_END_ALLOW_THREADS


    switch (ssl_err) {
        case SSL_ERROR_NONE:
        case SSL_ERROR_ZERO_RETURN:
            ret = r;
            break;
        case SSL_ERROR_WANT_WRITE:
        case SSL_ERROR_WANT_READ:
        case SSL_ERROR_WANT_X509_LOOKUP:
            if (timeout <= 0) {
                ret = -1;
                break;
            }
            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
                goto again;
            ret = -1;
            break;
        case SSL_ERROR_SSL:
        case SSL_ERROR_SYSCALL:
            ssl_handle_error(ssl_err, r);
        default:
            ret = -1;
    }

    m2_PyBuffer_Release(blob, &buf);
    return ret;
}

int ssl_write_nbio(SSL *ssl, PyObject *blob) {
    Py_buffer buf;
    int r, err, ret;


    if (m2_PyObject_GetBufferInt(blob, &buf, PyBUF_CONTIG_RO) == -1) {
        return -1;
    }


    Py_BEGIN_ALLOW_THREADS
    r = SSL_write(ssl, buf.buf, buf.len);
    Py_END_ALLOW_THREADS


    switch (SSL_get_error(ssl, r)) {
        case SSL_ERROR_NONE:
        case SSL_ERROR_ZERO_RETURN:
            ret = r;
            break;
        case SSL_ERROR_WANT_WRITE:
        case SSL_ERROR_WANT_READ:
        case SSL_ERROR_WANT_X509_LOOKUP:
            ret = -1;
            break;
        case SSL_ERROR_SSL:
            ret = -1;
            break;
        case SSL_ERROR_SYSCALL:
            err = ERR_get_error();
            if (err)
                PyErr_SetString(_ssl_err, ERR_reason_error_string(err));
            else if (r == 0)
                PyErr_SetString(_ssl_err, "unexpected eof");
            else if (r == -1)
                PyErr_SetFromErrno(_ssl_err);
        default:
            ret = -1;
    }

    m2_PyBuffer_Release(blob, &buf);
    return ret;
}

int ssl_cipher_get_bits(SSL_CIPHER *c) {
    return SSL_CIPHER_get_bits(c, NULL);
}

int sk_ssl_cipher_num(STACK_OF(SSL_CIPHER) *stack) {
    return sk_SSL_CIPHER_num(stack);
}

const SSL_CIPHER *sk_ssl_cipher_value(STACK_OF(SSL_CIPHER) *stack, int idx) {
    return sk_SSL_CIPHER_value(stack, idx);
}

STACK_OF(X509) *ssl_get_peer_cert_chain(SSL *ssl) {
    return SSL_get_peer_cert_chain(ssl);
}

int sk_x509_num(STACK_OF(X509) *stack) {
    return sk_X509_num(stack);
}

X509 *sk_x509_value(STACK_OF(X509) *stack, int idx) {
    return sk_X509_value(stack, idx);
}


void i2d_ssl_session(BIO *bio, SSL_SESSION *sess) {
    i2d_SSL_SESSION_bio(bio, sess);
}


SSL_SESSION *ssl_session_read_pem(BIO *bio) {
    return PEM_read_bio_SSL_SESSION(bio, NULL, NULL, NULL);
}


int ssl_session_write_pem(SSL_SESSION *sess, BIO *bio) {
    return PEM_write_bio_SSL_SESSION(bio, sess);
}

int ssl_ctx_set_session_cache_mode(SSL_CTX *ctx, int mode)
{
    return SSL_CTX_set_session_cache_mode(ctx, mode);
}

int ssl_ctx_get_session_cache_mode(SSL_CTX *ctx)
{
    return SSL_CTX_get_session_cache_mode(ctx);
}

static long ssl_ctx_set_cache_size(SSL_CTX *ctx, long arg)
{
  return SSL_CTX_sess_set_cache_size(ctx, arg);
}

int ssl_is_init_finished(SSL *ssl)
{
  return SSL_is_init_finished(ssl);
}


#include <openssl/asn1.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

#include <openssl/asn1t.h>

typedef STACK_OF(X509) SEQ_CERT;

ASN1_ITEM_TEMPLATE(SEQ_CERT) =
    ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, SeqCert, X509)
ASN1_ITEM_TEMPLATE_END(SEQ_CERT)

IMPLEMENT_ASN1_FUNCTIONS(SEQ_CERT)


X509 *x509_read_pem(BIO *bio) {
    return PEM_read_bio_X509(bio, NULL, NULL, NULL);
}


X509 *d2i_x509(BIO *bio) {
    return d2i_X509_bio(bio, NULL);
}


static PyObject *_x509_err;

void x509_init(PyObject *x509_err) {
    Py_INCREF(x509_err);
    _x509_err = x509_err;
}


X509_REQ *d2i_x509_req(BIO *bio) {
    return d2i_X509_REQ_bio(bio, NULL);
}


X509_REQ *x509_req_read_pem(BIO *bio) {
    return PEM_read_bio_X509_REQ(bio, NULL, NULL, NULL);
}


PyObject *i2d_x509(X509 *x) {
    int len;
    PyObject *ret = NULL;
    unsigned char *buf = NULL;
    len = i2d_X509(x, &buf);
    if (len < 0) {
        m2_PyErr_Msg(_x509_err);
    }
    else {

        ret = PyBytes_FromStringAndSize((char*)buf, len);

        OPENSSL_free(buf);
    }
    return ret;
}


int x509_req_write_pem(BIO *bio, X509_REQ *x) {
    return PEM_write_bio_X509_REQ(bio, x);
}


X509_CRL *x509_crl_read_pem(BIO *bio) {
    return PEM_read_bio_X509_CRL(bio, NULL, NULL, NULL);
}


/* X509_set_version() is a macro. */
int x509_set_version(X509 *x, long version) {
    return X509_set_version(x, version);
}

/* X509_get_version() is a macro. */
long x509_get_version(X509 *x) {
    return X509_get_version(x);
}

/* X509_set_notBefore() is a macro. */
int x509_set_not_before(X509 *x, ASN1_TIME *tm) {
    return X509_set_notBefore(x, tm);
}

/* X509_get_notBefore() is a macro. */
ASN1_TIME *x509_get_not_before(X509 *x) {
    return X509_get_notBefore(x);
}

/* X509_set_notAfter() is a macro. */
int x509_set_not_after(X509 *x, ASN1_TIME *tm) {
    return X509_set_notAfter(x, tm);
}

/* X509_get_notAfter() is a macro. */
ASN1_TIME *x509_get_not_after(X509 *x) {
    return X509_get_notAfter(x);
}

int x509_sign(X509 *x, EVP_PKEY *pkey, EVP_MD *md) {
    return X509_sign(x, pkey, md);
}

/* x509_gmtime_adj() is a macro. */
ASN1_TIME *x509_gmtime_adj(ASN1_TIME *s, long adj) {
    return X509_gmtime_adj(s, adj);
}

PyObject *x509_name_by_nid(X509_NAME *name, int nid) {
    void *buf;
    int len, xlen;
    PyObject *ret;

    if ((len = X509_NAME_get_text_by_NID(name, nid, NULL, 0)) == -1) {
        Py_RETURN_NONE;
    }
    len++;
    if (!(buf = PyMem_Malloc(len))) {
        PyErr_SetString(PyExc_MemoryError, "x509_name_by_nid");
        return NULL;
    }
    xlen = X509_NAME_get_text_by_NID(name, nid, buf, len);

    ret = PyBytes_FromStringAndSize(buf, xlen);

    PyMem_Free(buf);
    return ret;
}

int x509_name_set_by_nid(X509_NAME *name, int nid, PyObject *obj) {
    return X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC, (unsigned char *)PyBytes_AsString(obj), -1, -1, 0);
}

/* x509_name_add_entry_by_txt */
int x509_name_add_entry_by_txt(X509_NAME *name, char *field, int type, char *bytes, int len, int loc, int set) {
    return X509_NAME_add_entry_by_txt(name, field, type, (unsigned char *)bytes, len, loc, set);
}

PyObject *x509_name_get_der(X509_NAME *name) {
    const char* pder="";
    size_t pderlen;
    i2d_X509_NAME(name, 0);
    if (!X509_NAME_get0_der(name, (const unsigned char **)pder, &pderlen)) {
        m2_PyErr_Msg(_x509_err);
        return NULL;
    }
    return PyBytes_FromStringAndSize(pder, pderlen);
}

/* sk_X509_free() is a macro. */
void sk_x509_free(STACK_OF(X509) *stack) {
    sk_X509_free(stack);
}

/* sk_X509_push() is a macro. */
int sk_x509_push(STACK_OF(X509) *stack, X509 *x509) {
    return sk_X509_push(stack, x509);
}

/* sk_X509_pop() is a macro. */
X509 *sk_x509_pop(STACK_OF(X509) *stack) {
    return sk_X509_pop(stack);
}


int x509_store_load_locations(X509_STORE *store, const char *file) {
    int locations = 0;

    if ((locations = X509_STORE_load_locations(store, file, NULL)) < 1) {
        m2_PyErr_Msg(_x509_err);
    }
    return locations;
}

int x509_type_check(X509 *x509) {
    return 1;
}

int x509_name_type_check(X509_NAME *name) {
    return 1;
}

X509_NAME *x509_req_get_subject_name(X509_REQ *x) {
    return X509_REQ_get_subject_name(x);
}

long x509_req_get_version(X509_REQ *x) {
    return X509_REQ_get_version(x);
}

int x509_req_set_version(X509_REQ *x, long version) {
    return X509_REQ_set_version(x, version);
}

int x509_req_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts) {
    return X509_REQ_add_extensions(req, exts);
}

X509_NAME_ENTRY *x509_name_entry_create_by_txt(X509_NAME_ENTRY **ne, char *field, int type, char *bytes, int len) {
    return X509_NAME_ENTRY_create_by_txt( ne, field, type, (unsigned char *)bytes, len);
}


X509V3_CTX *
x509v3_set_nconf(void) {
      X509V3_CTX * ctx;
      CONF *conf = NCONF_new(NULL);

      if (!(ctx=(X509V3_CTX *)PyMem_Malloc(sizeof(X509V3_CTX)))) {
          PyErr_SetString(PyExc_MemoryError, "x509v3_set_nconf");
          return NULL;
      }
      /* X509V3_set_nconf does not generate any error signs at all. */
      X509V3_set_nconf(ctx, conf);
      return ctx;
}


X509_EXTENSION *
x509v3_ext_conf(void *conf, X509V3_CTX *ctx, char *name, char *value) {
      X509_EXTENSION * ext = NULL;
      ext = X509V3_EXT_conf(conf, ctx, name, value);
      PyMem_Free(ctx);
      return ext;
}


/* X509_EXTENSION_free() might be a macro, didn't find definition. */
void x509_extension_free(X509_EXTENSION *ext) {
    X509_EXTENSION_free(ext);
}

PyObject *x509_extension_get_name(X509_EXTENSION *ext) {
    PyObject * ext_name;
    const char * ext_name_str;
    ext_name_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
    if (!ext_name_str) {
        m2_PyErr_Msg(_x509_err);
        return NULL;
    }
    ext_name = PyBytes_FromStringAndSize(ext_name_str, strlen(ext_name_str));
    return ext_name;
}

/* sk_X509_EXTENSION_new_null is a macro. */
STACK_OF(X509_EXTENSION) *sk_x509_extension_new_null(void) {
    return sk_X509_EXTENSION_new_null();
}

/* sk_X509_EXTENSION_free() is a macro. */
void sk_x509_extension_free(STACK_OF(X509_EXTENSION) *stack) {
    sk_X509_EXTENSION_free(stack);
}

/* sk_X509_EXTENSION_push() is a macro. */
int sk_x509_extension_push(STACK_OF(X509_EXTENSION) *stack, X509_EXTENSION *x509_ext) {
    return sk_X509_EXTENSION_push(stack, x509_ext);
}

/* sk_X509_EXTENSION_pop() is a macro. */
X509_EXTENSION *sk_x509_extension_pop(STACK_OF(X509_EXTENSION) *stack) {
    return sk_X509_EXTENSION_pop(stack);
}

/* sk_X509_EXTENSION_num() is a macro. */
int sk_x509_extension_num(STACK_OF(X509_EXTENSION) *stack) {
    return sk_X509_EXTENSION_num(stack);
}

/* sk_X509_EXTENSION_value() is a macro. */
X509_EXTENSION *sk_x509_extension_value(STACK_OF(X509_EXTENSION) *stack, int i) {
    return sk_X509_EXTENSION_value(stack, i);
}

/* X509_STORE_CTX_get_app_data is a macro. */
void *x509_store_ctx_get_app_data(X509_STORE_CTX *ctx) {
  return X509_STORE_CTX_get_app_data(ctx);
}

/* X509_STORE_CTX_get_app_data is a macro. */
void *x509_store_ctx_get_ex_data(X509_STORE_CTX *ctx, int idx) {
  return X509_STORE_CTX_get_ex_data(ctx, idx);
}

void x509_store_set_verify_cb(X509_STORE *store, PyObject *pyfunc) {
    Py_XDECREF(x509_store_verify_cb_func);
    Py_INCREF(pyfunc);
    x509_store_verify_cb_func = pyfunc;
    X509_STORE_set_verify_cb(store, x509_store_verify_callback);
}


STACK_OF(X509) *
make_stack_from_der_sequence(PyObject * pyEncodedString){
    STACK_OF(X509) *certs;
    Py_ssize_t encoded_string_len;
    char *encoded_string;
    const unsigned char *tmp_str;

    encoded_string_len = PyBytes_Size(pyEncodedString);

    if (encoded_string_len > INT_MAX) {
        PyErr_Format(_x509_err, "object too large");
        return NULL;
    }

    encoded_string = PyBytes_AsString(pyEncodedString);

    if (!encoded_string) {
        PyErr_SetString(_x509_err,
                        "Cannot convert Python Bytes to (char *).");
        return NULL;
    }

    tmp_str = (unsigned char *)encoded_string;
    certs = d2i_SEQ_CERT(NULL, &tmp_str, encoded_string_len);
    if (certs == NULL) {
        PyErr_SetString(_x509_err, "Generating STACK_OF(X509) failed.");
        return NULL;
    }
    return certs;
}

/* sk_X509_new_null() is a macro returning "STACK_OF(X509) *". */
STACK_OF(X509) *sk_x509_new_null(void) {
    return sk_X509_new_null();
}


PyObject *
get_der_encoding_stack(STACK_OF(X509) *stack){
    PyObject * encodedString;

    unsigned char * encoding = NULL;
    int len;

    len = i2d_SEQ_CERT(stack, &encoding);
    if (!encoding) {
       m2_PyErr_Msg(_x509_err);
       return NULL;
    }

    encodedString = PyBytes_FromStringAndSize((const char *)encoding, len);

    if (encoding)
        OPENSSL_free(encoding);

    return encodedString;
}



char *x509_name_oneline(X509_NAME *x) {
    return X509_NAME_oneline(x, NULL, 0);
}


#include <openssl/asn1.h>


/* ASN1_TIME_set_string () is a macro */
int asn1_time_type_check(ASN1_TIME *ASN1_TIME) {
    return 1;
}

PyObject *asn1_integer_get(ASN1_INTEGER *asn1) {
    BIGNUM *bn;
    PyObject *ret;
    char *hex;

    bn = ASN1_INTEGER_to_BN(asn1, NULL);

    if (!bn){
        m2_PyErr_Msg(PyExc_RuntimeError);
        return NULL;
    }

    hex = BN_bn2hex(bn);

    if (!hex){
        m2_PyErr_Msg(PyExc_RuntimeError);
        BN_free(bn);
        return NULL;
    }

    BN_free(bn);

    ret = PyLong_FromString(hex, NULL, 16);

    OPENSSL_free(hex);

    return ret;
}

int asn1_integer_set(ASN1_INTEGER *asn1, PyObject *value) {
    BIGNUM *bn = NULL;
    PyObject *fmt, *args, *hex;

/* Despite all hopes to the contrary, we cannot survive here with
 * PyLong_AsLong shims as provided in
 * /usr/include/python2.7/longobject.h.
 */
    long val = PyLong_AsLong(value);
    if (val >= 0) {
        return ASN1_INTEGER_set(asn1, val);
    } else {
        PyErr_Clear();
    }

    if (!PyLong_Check(value)){
        PyErr_SetString(PyExc_TypeError, "expected int or long");
        return 0;
    }

    fmt = PyUnicode_FromString("%x");

    if (!fmt)
        return 0;

    args = PyTuple_New(1);

    if (!args){
        Py_DECREF(fmt);
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() failed");
        return 0;
    }

    Py_INCREF(value);
    PyTuple_SET_ITEM(args, 0, value);
    hex = PyUnicode_Format(fmt, args);

    if (!hex){
        PyErr_SetString(PyExc_RuntimeError, "PyString_Format() failed");
        Py_DECREF(fmt);
        Py_DECREF(args);
        return 0;
    }

    Py_DECREF(fmt);
    Py_DECREF(args);

    if (BN_hex2bn(&bn, PyUnicode_AsUTF8(hex)) <= 0){
        m2_PyErr_Msg(PyExc_RuntimeError);
        Py_DECREF(hex);
        return 0;
    }

    Py_DECREF(hex);

    if (!BN_to_ASN1_INTEGER(bn, asn1)){
        m2_PyErr_Msg(PyExc_RuntimeError);
        BN_free(bn);
        return 0;
    }

    BN_free(bn);

    return 1;
}



#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>


static PyObject *_pkcs7_err, *_smime_err;

void pkcs7_init(PyObject *pkcs7_err) {
    Py_INCREF(pkcs7_err);
    _pkcs7_err = pkcs7_err;
}

void smime_init(PyObject *smime_err) {
    Py_INCREF(smime_err);
    _smime_err = smime_err;
}


PyObject *pkcs7_decrypt(PKCS7 *pkcs7, EVP_PKEY *pkey, X509 *cert, int flags) {
    int outlen;
    char *outbuf;
    BIO *bio;
    PyObject *ret;

    if (!(bio=BIO_new(BIO_s_mem()))) {
        PyErr_SetString(PyExc_MemoryError, "pkcs7_decrypt");
        return NULL;
    }
    if (!PKCS7_decrypt(pkcs7, pkey, cert, bio, flags)) {
        m2_PyErr_Msg(_pkcs7_err);
        BIO_free(bio);
        return NULL;
    }
    outlen = BIO_ctrl_pending(bio);
    if (!(outbuf=(char *)PyMem_Malloc(outlen))) {
        PyErr_SetString(PyExc_MemoryError, "pkcs7_decrypt");
        BIO_free(bio);
        return NULL;
    }
    BIO_read(bio, outbuf, outlen);

    ret = PyBytes_FromStringAndSize(outbuf, outlen);

    BIO_free(bio);
    PyMem_Free(outbuf);
    return ret;
}


PKCS7 *pkcs7_encrypt(STACK_OF(X509) *stack, BIO *bio, EVP_CIPHER *cipher, int flags) {
    return PKCS7_encrypt(stack, bio, cipher, flags);
}



PKCS7 *pkcs7_sign1(X509 *x509, EVP_PKEY *pkey, STACK_OF(X509) *stack, BIO *bio, EVP_MD *hash, int flags) {

    PKCS7 *p7 = PKCS7_sign(NULL, NULL, stack, bio, flags | PKCS7_STREAM);
    if (p7 == NULL) {
        return NULL;
    }
    if (PKCS7_sign_add_signer(p7, x509, pkey, hash, flags) == NULL) {
        return NULL;
    }
    if (PKCS7_final(p7, bio, flags) != 1) {
        return NULL;
    }
    return p7;
}


PKCS7 *pkcs7_sign0(X509 *x509, EVP_PKEY *pkey, BIO *bio, EVP_MD *hash, int flags) {
    return pkcs7_sign1(x509, pkey, NULL, bio, hash, flags);
}


PKCS7 *pkcs7_read_bio(BIO *bio) {
    return PEM_read_bio_PKCS7(bio, NULL, NULL, NULL);
}


PKCS7 *pkcs7_read_bio_der(BIO *bio) {
    return d2i_PKCS7_bio(bio, NULL);
}


PyObject *pkcs7_verify1(PKCS7 *pkcs7, STACK_OF(X509) *stack, X509_STORE *store, BIO *data, int flags) {
    int res, outlen;
    char *outbuf;
    BIO *bio;
    PyObject *ret;

    if (!(bio=BIO_new(BIO_s_mem()))) {
        PyErr_SetString(PyExc_MemoryError, "pkcs7_verify1");
        return NULL;
    }
    Py_BEGIN_ALLOW_THREADS
    res = PKCS7_verify(pkcs7, stack, store, data, bio, flags);
    Py_END_ALLOW_THREADS
    if (!res) {
        m2_PyErr_Msg(_pkcs7_err);
        BIO_free(bio);
        return NULL;
    }
    outlen = BIO_ctrl_pending(bio);
    if (!(outbuf=(char *)PyMem_Malloc(outlen))) {
        PyErr_SetString(PyExc_MemoryError, "pkcs7_verify1");
        BIO_free(bio);
        return NULL;
    }
    BIO_read(bio, outbuf, outlen);

    ret = PyBytes_FromStringAndSize(outbuf, outlen);

    BIO_free(bio);
    PyMem_Free(outbuf);
    return ret;
}

PyObject *pkcs7_verify0(PKCS7 *pkcs7, STACK_OF(X509) *stack, X509_STORE *store, int flags) {
    return pkcs7_verify1(pkcs7, stack, store, NULL, flags);
}


int smime_write_pkcs7_multi(BIO *bio, PKCS7 *pkcs7, BIO *data, int flags) {
    return SMIME_write_PKCS7(bio, pkcs7, data, flags | PKCS7_DETACHED);
}


int smime_write_pkcs7(BIO *bio, PKCS7 *pkcs7, int flags) {
    return SMIME_write_PKCS7(bio, pkcs7, NULL, flags);
}

PyObject *smime_read_pkcs7(BIO *bio) {
    BIO *bcont = NULL;
    PKCS7 *p7;
    PyObject *tuple, *_p7, *_BIO;
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */

    if (BIO_method_type(bio) == BIO_TYPE_MEM) {
        /* OpenSSL FAQ explains that this is needed for mem BIO to return EOF,
         * like file BIO does. Might need to do this for more mem BIOs but
         * not sure if that is safe, so starting with just this single place.
         */
        BIO_set_mem_eof_return(bio, 0);
    }

    Py_BEGIN_ALLOW_THREADS
    p7=SMIME_read_PKCS7(bio, &bcont);
    Py_END_ALLOW_THREADS
    if (!p7) {
        m2_PyErr_Msg(_smime_err);
        return NULL;
    }
    if (!(tuple=PyTuple_New(2))) {
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
        return NULL;
    }
    _p7 = SWIG_NewPointerObj((void *)p7, SWIGTYPE_p_PKCS7, 0);
    PyTuple_SET_ITEM(tuple, 0, _p7);
    if (!bcont) {
        Py_INCREF(Py_None);
        PyTuple_SET_ITEM(tuple, 1, Py_None);
    } else {
        _BIO = SWIG_NewPointerObj((void *)bcont, SWIGTYPE_p_BIO, 0);
        PyTuple_SET_ITEM(tuple, 1, _BIO);
    }
    return tuple;
}


int pkcs7_write_bio(PKCS7 *pkcs7, BIO* bio) {
    return PEM_write_bio_PKCS7(bio, pkcs7);
}


int pkcs7_write_bio_der(PKCS7 *pkcs7, BIO *bio) {
    return i2d_PKCS7_bio(bio, pkcs7);
}

int pkcs7_type_nid(PKCS7 *pkcs7) {
    return OBJ_obj2nid(pkcs7->type);
}

const char *pkcs7_type_sn(PKCS7 *pkcs7) {
    return OBJ_nid2sn(OBJ_obj2nid(pkcs7->type));
}


int smime_crlf_copy(BIO *in, BIO *out) {
    return SMIME_crlf_copy(in, out, PKCS7_TEXT);
}

/* return STACK_OF(X509)* */
STACK_OF(X509) *pkcs7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) {
    return PKCS7_get0_signers(p7, certs, flags);
}



#include <openssl/x509v3.h>


static PyObject *_util_err;

void util_init(PyObject *util_err) {
    Py_INCREF(util_err);
    _util_err = util_err;
}
    
PyObject *util_hex_to_string(PyObject *blob) {
    PyObject *obj;
    const void *buf;
    char *ret;
    Py_ssize_t len;

    if (m2_PyObject_AsReadBuffer(blob, &buf, &len) == -1)
        return NULL;

    ret = hex_to_string((unsigned char *)buf, len);
    if (!ret) {
        m2_PyErr_Msg(_util_err);
        return NULL;
    }

    obj = PyBytes_FromString(ret);

    OPENSSL_free(ret);
    return obj;
}

PyObject *util_string_to_hex(PyObject *blob) {
    PyObject *obj;
    const void *buf;
    unsigned char *ret;
    Py_ssize_t len0;
    long len;

    if (m2_PyObject_AsReadBuffer(blob, &buf, &len0) == -1)
        return NULL;

    len = len0;
    ret = string_to_hex((char *)buf, &len);
    if (ret == NULL) {
        m2_PyErr_Msg(_util_err);
        return NULL;
    }
    obj = PyBytes_FromStringAndSize((char*)ret, len);
    OPENSSL_free(ret);
    return obj;
}


#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/ecdsa.h>
#include <openssl/ecdh.h>


static PyObject *_ec_err;

void ec_init(PyObject *ec_err) {
    Py_INCREF(ec_err);
    _ec_err = ec_err;
}

PyObject *ec_get_builtin_curves(void) {
    /*  size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t
     *  nitems); */
  EC_builtin_curve *curves;
  Py_ssize_t ret_curves = 0;
  size_t num_curves =  EC_get_builtin_curves(NULL, 0);
  PyObject *ret_tuple = NULL;
  PyObject *ret_dict = NULL;
  Py_ssize_t i;
  const char *comment;
  const char *sname;

  if (!(curves = PyMem_Malloc(num_curves * sizeof(EC_builtin_curve)))) {
      PyErr_SetString(PyExc_MemoryError, "ec_get_builtin_curves");
      return NULL;
  }

  ret_curves = (Py_ssize_t)EC_get_builtin_curves(curves, num_curves);

  if (!(ret_tuple = PyTuple_New(ret_curves))) {
      PyErr_SetString(PyExc_MemoryError, "ec_get_builtin_curves");
      return NULL;
  }

  for (i = 0; i < ret_curves; i++) {
    if (!(ret_dict = PyDict_New())) {
        PyErr_SetString(PyExc_MemoryError, "ec_get_builtin_curves");
        return NULL;
    }

    comment = curves[i].comment;
    sname = OBJ_nid2sn(curves[i].nid);
    if (sname == NULL)
        sname = "";

    PyDict_SetItemString(ret_dict, "NID",
                         PyLong_FromLong((long)curves[i].nid));
    PyDict_SetItemString(ret_dict, "sname",
                         PyString_FromString(sname));
    PyDict_SetItemString(ret_dict, "comment",
                         PyString_FromString(comment));

    PyTuple_SET_ITEM(ret_tuple, i, ret_dict);

  }

  PyMem_Free(curves);

  return ret_tuple;
}

EC_KEY* ec_key_new_by_curve_name(int nid)
{
    EC_KEY   *key;
    EC_GROUP *group;
    int ret  =0;
    point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;
    int      asn1_flag = OPENSSL_EC_NAMED_CURVE;

    /* If I simply do "return EC_KEY_new_by_curve_name(nid);"
     * I get large public keys (222 vs 84 bytes for sect233k1 curve).
     * I don't know why that is, but 'openssl ecparam -genkey ...' sets
     * the ASN.1 flag and the point conversion form, and gets the
     * small pub keys. So let's do that too.
     */
    key = EC_KEY_new();
    if (!key) {
        PyErr_SetString(PyExc_MemoryError, "ec_key_new_by_curve_name");
        return NULL;
    }
    group = EC_GROUP_new_by_curve_name(nid);
    if (!group) {
        m2_PyErr_Msg(_ec_err);
        EC_KEY_free(key);
        return NULL;
    }
    EC_GROUP_set_asn1_flag(group, asn1_flag);
    EC_GROUP_set_point_conversion_form(group, form);
    ret = EC_KEY_set_group(key, group);
    EC_GROUP_free(group);
    if (ret == 0)
    {
        /* EC_KEY_set_group only returns 0 or 1, and does not set error. */
        PyErr_SetString(_ec_err, "cannot set key's group");
        EC_KEY_free(key);
        return NULL;
    }

    return key;
}

PyObject *ec_key_get_public_der(EC_KEY *key) {
    char *src=NULL;
    int src_len=0;
    PyObject *pyo=NULL;

    /* Convert to binary */
    src_len = i2d_EC_PUBKEY( key, (unsigned char**)&src );
    if (src_len < 0)
    {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }
    /* Create a PyBuffer containing a copy of the binary,
     * to simplify memory deallocation
     */
    pyo = PyBytes_FromStringAndSize( src, src_len );

    OPENSSL_free(src);

    return pyo;
}

PyObject *ec_key_get_public_key(EC_KEY *key) {
    char *src=NULL;
    int src_len=0;
    PyObject *pyo=NULL;

    /* Convert to binary */
    src_len = i2o_ECPublicKey(key, (unsigned char**)&src);
    if (src_len < 0)
    {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }

    pyo = PyBytes_FromStringAndSize( src, src_len );

    OPENSSL_free(src);

    return pyo;
}



EC_KEY *ec_key_read_pubkey(BIO *f) {
    return PEM_read_bio_EC_PUBKEY(f, NULL, NULL, NULL);
}


int ec_key_write_pubkey(EC_KEY *key, BIO *f) {
    return PEM_write_bio_EC_PUBKEY(f, key );
}


EC_KEY *ec_key_read_bio(BIO *f, PyObject *pyfunc) {
    EC_KEY *ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_read_bio_ECPrivateKey(f, NULL, passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int ec_key_write_bio(EC_KEY *key, BIO *f, EVP_CIPHER *cipher, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_ECPrivateKey(f, key, cipher, NULL, 0,
        passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


int ec_key_write_bio_no_cipher(EC_KEY *key, BIO *f, PyObject *pyfunc) {
    int ret;

    Py_INCREF(pyfunc);
    Py_BEGIN_ALLOW_THREADS
    ret = PEM_write_bio_ECPrivateKey(f, key, NULL, NULL, 0,
                      passphrase_callback, (void *)pyfunc);
    Py_END_ALLOW_THREADS
    Py_DECREF(pyfunc);
    return ret;
}


PyObject *ecdsa_sig_get_r(ECDSA_SIG *ecdsa_sig) {
    const BIGNUM* pr;
    ECDSA_SIG_get0(ecdsa_sig, &pr, NULL);
    return bn_to_mpi(pr);
}

PyObject *ecdsa_sig_get_s(ECDSA_SIG *ecdsa_sig) {
    const BIGNUM* ps;
    ECDSA_SIG_get0(ecdsa_sig, NULL, &ps);
    return bn_to_mpi(ps);
}

PyObject *ecdsa_sign(EC_KEY *key, PyObject *value) {
    const void *vbuf;
    int vlen = 0;
    PyObject *tuple;
    ECDSA_SIG *sig;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(sig = ECDSA_do_sign(vbuf, vlen, key))) {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }
    if (!(tuple = PyTuple_New(2))) {
        ECDSA_SIG_free(sig);
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
        return NULL;
    }
    PyTuple_SET_ITEM(tuple, 0, ecdsa_sig_get_r(sig));
    PyTuple_SET_ITEM(tuple, 1, ecdsa_sig_get_s(sig));
    ECDSA_SIG_free(sig);
    return tuple;
}

int ecdsa_verify(EC_KEY *key, PyObject *value, PyObject *r, PyObject *s) {
    const void *vbuf, *rbuf, *sbuf;
    int vlen = 0, rlen = 0, slen = 0;
    ECDSA_SIG *sig;
    int ret;
    BIGNUM* pr, *ps;

    if ((m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        || (m2_PyObject_AsReadBufferInt(r, &rbuf, &rlen) == -1)
        || (m2_PyObject_AsReadBufferInt(s, &sbuf, &slen) == -1))
        return -1;

    if (!(pr = BN_mpi2bn((unsigned char *)rbuf, rlen, NULL))) {
        m2_PyErr_Msg(_ec_err);
        return -1;
    }
    if (!(ps = BN_mpi2bn((unsigned char *)sbuf, slen, NULL))) {
        m2_PyErr_Msg(_ec_err);
        BN_free(pr);
        return -1;
    }

    if (!(sig = ECDSA_SIG_new())) {
        m2_PyErr_Msg(_ec_err);
        BN_free(pr);
        BN_free(ps);
        return -1;
    }
    if (!ECDSA_SIG_set0(sig, pr, ps)) {
        PyErr_SetString(_ec_err, "Cannot set r and s fields of ECDSA_SIG.");
        ECDSA_SIG_free(sig);
        BN_free(pr);
        BN_free(ps);
        return -1;
    }
    ret = ECDSA_do_verify(vbuf, vlen, sig, key);
    ECDSA_SIG_free(sig);
    if (ret == -1)
        m2_PyErr_Msg(_ec_err);
    return ret;
}


PyObject *ecdsa_sign_asn1(EC_KEY *key, PyObject *value) {
    const void *vbuf;
    int vlen = 0;
    void *sigbuf;
    unsigned int siglen;
    PyObject *ret;

    if (m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        return NULL;

    if (!(sigbuf = PyMem_Malloc(ECDSA_size(key)))) {
        PyErr_SetString(PyExc_MemoryError, "ecdsa_sign_asn1");
        return NULL;
    }
    if (!ECDSA_sign(0, vbuf, vlen, (unsigned char *)sigbuf, &siglen, key)) {
        m2_PyErr_Msg(_ec_err);
        PyMem_Free(sigbuf);
        return NULL;
    }
    ret = PyBytes_FromStringAndSize(sigbuf, siglen);

    PyMem_Free(sigbuf);
    return ret;
}


int ecdsa_verify_asn1(EC_KEY *key, PyObject *value, PyObject *sig) {
    const void *vbuf;
    void *sbuf;
    int vlen = 0, slen = 0, ret;

    if ((m2_PyObject_AsReadBufferInt(value, &vbuf, &vlen) == -1)
        || (m2_PyObject_AsReadBufferInt(sig, (const void **)&sbuf, &slen)
        == -1))
        return -1;

    if ((ret = ECDSA_verify(0, vbuf, vlen, sbuf, slen, key)) == -1)
        m2_PyErr_Msg(_ec_err);
    return ret;
}

PyObject *ecdh_compute_key(EC_KEY *keypairA, EC_KEY *pubkeyB) {
    int sharedkeylen;
    void *sharedkey;
    const EC_POINT *pkpointB;
    PyObject *ret;
    const EC_GROUP* groupA;

    if ((pkpointB = EC_KEY_get0_public_key(pubkeyB)) == NULL)
    {
        PyErr_SetString(_ec_err, "Cannot get the public key of EC_KEY object.");
        return NULL;
    }

    groupA = EC_KEY_get0_group(keypairA);
    sharedkeylen = (EC_GROUP_get_degree(groupA) + 7)/8;

    if (!(sharedkey = PyMem_Malloc(sharedkeylen))) {
        PyErr_SetString(PyExc_MemoryError, "ecdh_compute_key");
        return NULL;
    }
    if ((sharedkeylen = ECDH_compute_key((unsigned char *)sharedkey, sharedkeylen, pkpointB, keypairA, NULL)) == -1) {
        m2_PyErr_Msg(_ec_err);
        PyMem_Free(sharedkey);
        return NULL;
    }

    ret = PyBytes_FromStringAndSize((const char *)sharedkey, sharedkeylen);

    PyMem_Free(sharedkey);

    return ret;
}


EC_KEY* ec_key_from_pubkey_der(PyObject *pubkey) {
    const void *keypairbuf;
    Py_ssize_t keypairbuflen;
    const unsigned char *tempBuf;
    EC_KEY *keypair;

    if (m2_PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1)
    {
        return NULL;
    }

    tempBuf = (const unsigned char *)keypairbuf;
    if ((keypair = d2i_EC_PUBKEY( NULL, &tempBuf, keypairbuflen)) == 0)
    {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }
    return keypair;
}

EC_KEY* ec_key_from_pubkey_params(int nid, PyObject *pubkey) {
    const void *keypairbuf;
    Py_ssize_t keypairbuflen;
    const unsigned char *tempBuf;
    EC_KEY *keypair;

    if (m2_PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1)
    {
        return NULL;
    }

    keypair = ec_key_new_by_curve_name(nid);
    if (!keypair) {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }

    tempBuf = (const unsigned char *)keypairbuf;
    if ((o2i_ECPublicKey( &keypair, &tempBuf, keypairbuflen)) == 0)
    {
        m2_PyErr_Msg(_ec_err);
        return NULL;
    }
    return keypair;
}


// According to [SEC2] the degree of the group is defined as EC key length
int ec_key_keylen(EC_KEY *key) {
    const EC_GROUP *group = EC_KEY_get0_group(key);
    return EC_GROUP_get_degree(group);
}

int ec_key_type_check(EC_KEY *key) {
    return 1;
}


#include <openssl/engine.h>
#include <openssl/ui.h>
#include <stdio.h>



/*
 * Code from engine-pkcs11 1.4.0 in engine-pkcs11.c
 *

99  static char *get_pin(UI_METHOD * ui_method, void *callback_data, char *sc_pin,
100                      int maxlen)
101 {
102         UI *ui;
103         struct {
104                 const void *password;
105                 const char *prompt_info;
106         } *mycb = callback_data;
107 
108         if (mycb->password) {
109                 sc_pin = set_pin(mycb->password);
110                 return sc_pin;
111         }
 
 *
 * So callback_data need to be always provided and have fixed type.
 * UI method still may be NULL.
 *
 * Following functions allocate and free callback data structure with 
 * optional password set.
 */

typedef struct {
    char * password;
    char * prompt;
} _cbd_t;

void * engine_pkcs11_data_new(const char *pin) {
    _cbd_t * cb = (_cbd_t *) PyMem_Malloc(sizeof(_cbd_t));
    if (!cb) {
        PyErr_SetString(PyExc_MemoryError, "engine_pkcs11_data_new");
        return NULL;
    }
    cb->password = NULL;
    if (pin) {
        size_t size = strlen(pin);
        cb->password = (char *) PyMem_Malloc(size + 1);
        if (!cb->password) {
            PyErr_SetString(PyExc_MemoryError, "engine_pkcs11_data_new");
            PyMem_Free(cb);
            return NULL;
        }
        memcpy(cb->password, pin, size + 1);
    }
    cb->prompt = NULL;
    return cb;
}

void engine_pkcs11_data_free(void * vcb) {
    _cbd_t * cb = (_cbd_t *) vcb;
    if (!cb)
        return;
    if (cb->password)
        PyMem_Free(cb->password);
    PyMem_Free(cb);
}



static PyObject *_engine_err;

void engine_init_error(PyObject *engine_err) {
    Py_INCREF(engine_err);
    _engine_err = engine_err;
}

X509 * engine_load_certificate(ENGINE *e, const char * slot) {
    struct {
        const char * slot;
        X509 * cert;
    } cbd;
    cbd.slot = slot;
    cbd.cert = NULL;
    if (!ENGINE_ctrl_cmd(e, "LOAD_CERT_CTRL", 0, &cbd, NULL, 0)) {
        PyErr_SetString(_engine_err, "cannot load certificate");
        return NULL;
    }
    return cbd.cert;
}


#include <openssl/objects.h>


/*
   From the manpage for OBJ_obt2txt ():
   BUGS
      OBJ_obj2txt() is awkward and messy to use: it doesn’t follow the
      convention of other OpenSSL functions where the buffer can be set
      to NULL to determine the amount of data that should be written.
      Instead buf must point to a valid buffer and buf_len should be set
      to a positive value. A buffer length of 80 should be more than
      enough to handle any OID encountered in practice.

   The first call to OBJ_obj2txt () therefore passes a non-NULL dummy
   buffer. This wart is reportedly removed in OpenSSL 0.9.8b, although
   the manpage has not been updated.

   OBJ_obj2txt always prints \0 at the end. But the return value
   is the number of "good" bytes written. So memory is allocated for
   len + 1 bytes but only len bytes are marshalled to python.
*/
PyObject *obj_obj2txt(const ASN1_OBJECT *obj, int no_name)
{
    int len;
    PyObject *ret;
    char *buf;
    char dummy[1];

    len = OBJ_obj2txt(dummy, 1, obj, no_name);
    if (len < 0) {
        m2_PyErr_Msg(PyExc_RuntimeError);
        return NULL;
    } else if (len == 0) {
        /* XXX: For OpenSSL prior to 0.9.8b.

          Changes between 0.9.8a and 0.9.8b  [04 May 2006]
          ...
          *) Several fixes and enhancements to the OID generation code. The old code
             sometimes allowed invalid OIDs (1.X for X >= 40 for example), couldn't
             handle numbers larger than ULONG_MAX, truncated printing and had a
             non standard OBJ_obj2txt() behaviour.
             [Steve Henson]
        */

        len = 80;
    }

    buf = PyMem_Malloc(len + 1);
    len = OBJ_obj2txt(buf, len + 1, obj, no_name);

    ret = PyBytes_FromStringAndSize(buf, len);

    PyMem_Free(buf);

    return ret;
}

#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_OPENSSL_sk_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_num" "', argument " "1"" of type '" "OPENSSL_STACK const *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  result = (int)OPENSSL_sk_num((struct stack_st const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_value" "', argument " "1"" of type '" "OPENSSL_STACK const *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "OPENSSL_sk_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (void *)OPENSSL_sk_value((struct stack_st const *)arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  int arg2 ;
  void *arg3 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  PyObject *swig_obj[3] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_set", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_set" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "OPENSSL_sk_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2],SWIG_as_voidptrptr(&arg3), 0, 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "OPENSSL_sk_set" "', argument " "3"" of type '" "void const *""'"); 
  }
  result = (void *)OPENSSL_sk_set(arg1,arg2,(void const *)arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_sk_compfunc arg1 = (OPENSSL_sk_compfunc) 0 ;
  PyObject *swig_obj[1] ;
  OPENSSL_STACK *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__void_p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_new" "', argument " "1"" of type '" "OPENSSL_sk_compfunc""'"); 
    }
  }
  result = (OPENSSL_STACK *)OPENSSL_sk_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_new_null", 0, 0, 0)) SWIG_fail;
  result = (OPENSSL_STACK *)OPENSSL_sk_new_null();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_new_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_sk_compfunc arg1 = (OPENSSL_sk_compfunc) 0 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  OPENSSL_STACK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_new_reserve", 2, 2, swig_obj)) SWIG_fail;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__void_p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_new_reserve" "', argument " "1"" of type '" "OPENSSL_sk_compfunc""'"); 
    }
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "OPENSSL_sk_new_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (OPENSSL_STACK *)OPENSSL_sk_new_reserve(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_reserve", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_reserve" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "OPENSSL_sk_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (int)OPENSSL_sk_reserve(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_free" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  OPENSSL_sk_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_pop_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_pop_free", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_pop_free" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_void__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_pop_free" "', argument " "2"" of type '" "void (*)(void *)""'"); 
    }
  }
  OPENSSL_sk_pop_free(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_deep_copy(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  OPENSSL_sk_copyfunc arg2 = (OPENSSL_sk_copyfunc) 0 ;
  OPENSSL_sk_freefunc arg3 = (OPENSSL_sk_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  OPENSSL_STACK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_deep_copy", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_deep_copy" "', argument " "1"" of type '" "OPENSSL_STACK const *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__void__p_void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_deep_copy" "', argument " "2"" of type '" "OPENSSL_sk_copyfunc""'"); 
    }
  }
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[2], (void**)(&arg3), SWIGTYPE_p_f_p_void__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_deep_copy" "', argument " "3"" of type '" "OPENSSL_sk_freefunc""'"); 
    }
  }
  result = (OPENSSL_STACK *)OPENSSL_sk_deep_copy((struct stack_st const *)arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_insert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_insert", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_insert" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_insert" "', argument " "2"" of type '" "void const *""'"); 
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "OPENSSL_sk_insert" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  result = (int)OPENSSL_sk_insert(arg1,(void const *)arg2,arg3);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_delete(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_delete", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_delete" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "OPENSSL_sk_delete" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (void *)OPENSSL_sk_delete(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_delete_ptr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_delete_ptr", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_delete_ptr" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_delete_ptr" "', argument " "2"" of type '" "void const *""'"); 
  }
  result = (void *)OPENSSL_sk_delete_ptr(arg1,(void const *)arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_find(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_find", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_find" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_find" "', argument " "2"" of type '" "void const *""'"); 
  }
  result = (int)OPENSSL_sk_find(arg1,(void const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_find_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_find_ex", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_find_ex" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_find_ex" "', argument " "2"" of type '" "void const *""'"); 
  }
  result = (int)OPENSSL_sk_find_ex(arg1,(void const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_push" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_push" "', argument " "2"" of type '" "void const *""'"); 
  }
  result = (int)OPENSSL_sk_push(arg1,(void const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_unshift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_unshift", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_unshift" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OPENSSL_sk_unshift" "', argument " "2"" of type '" "void const *""'"); 
  }
  result = (int)OPENSSL_sk_unshift(arg1,(void const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_shift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_shift" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  result = (void *)OPENSSL_sk_shift(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_pop" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  result = (void *)OPENSSL_sk_pop(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_zero(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_zero" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  OPENSSL_sk_zero(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_set_cmp_func(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  OPENSSL_sk_compfunc arg2 = (OPENSSL_sk_compfunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  OPENSSL_sk_compfunc result;
  
  if (!SWIG_Python_UnpackTuple(args, "OPENSSL_sk_set_cmp_func", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_set_cmp_func" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__void_p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "OPENSSL_sk_set_cmp_func" "', argument " "2"" of type '" "OPENSSL_sk_compfunc""'"); 
    }
  }
  result = (OPENSSL_sk_compfunc)OPENSSL_sk_set_cmp_func(arg1,arg2);
  resultobj = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_q_const__void_p_q_const__void__int);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  OPENSSL_STACK *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_dup" "', argument " "1"" of type '" "OPENSSL_STACK const *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  result = (OPENSSL_STACK *)OPENSSL_sk_dup((struct stack_st const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_sort(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_sort" "', argument " "1"" of type '" "OPENSSL_STACK *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  OPENSSL_sk_sort(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_OPENSSL_sk_is_sorted(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  OPENSSL_STACK *arg1 = (OPENSSL_STACK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OPENSSL_sk_is_sorted" "', argument " "1"" of type '" "OPENSSL_STACK const *""'"); 
  }
  arg1 = (OPENSSL_STACK *)(argp1);
  result = (int)OPENSSL_sk_is_sorted((struct stack_st const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_num" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  result = (int)sk_OPENSSL_STRING_num((struct stack_st_OPENSSL_STRING const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_value" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_STRING_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (char *)sk_OPENSSL_STRING_value((struct stack_st_OPENSSL_STRING const *)arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_STRING_compfunc arg1 = (sk_OPENSSL_STRING_compfunc) 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_STRING *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_new" "', argument " "1"" of type '" "sk_OPENSSL_STRING_compfunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_STRING *)sk_OPENSSL_STRING_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_new_null", 0, 0, 0)) SWIG_fail;
  result = (struct stack_st_OPENSSL_STRING *)sk_OPENSSL_STRING_new_null();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_new_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_STRING_compfunc arg1 = (sk_OPENSSL_STRING_compfunc) 0 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  struct stack_st_OPENSSL_STRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_new_reserve", 2, 2, swig_obj)) SWIG_fail;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_new_reserve" "', argument " "1"" of type '" "sk_OPENSSL_STRING_compfunc""'"); 
    }
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_STRING_new_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (struct stack_st_OPENSSL_STRING *)sk_OPENSSL_STRING_new_reserve(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_reserve", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_reserve" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_STRING_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (int)sk_OPENSSL_STRING_reserve(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  sk_OPENSSL_STRING_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_zero(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_zero" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  sk_OPENSSL_STRING_zero(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_delete(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_delete", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_delete" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_STRING_delete" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (char *)sk_OPENSSL_STRING_delete(arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_delete_ptr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_delete_ptr", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_delete_ptr" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_delete_ptr" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  result = (char *)sk_OPENSSL_STRING_delete_ptr(arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_push" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_push" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_STRING_push(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_unshift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_unshift", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_unshift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_unshift" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_STRING_unshift(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_pop" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  result = (char *)sk_OPENSSL_STRING_pop(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_shift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_shift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  result = (char *)sk_OPENSSL_STRING_shift(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_pop_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  sk_OPENSSL_STRING_freefunc arg2 = (sk_OPENSSL_STRING_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_pop_free", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_pop_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_char__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_pop_free" "', argument " "2"" of type '" "sk_OPENSSL_STRING_freefunc""'"); 
    }
  }
  sk_OPENSSL_STRING_pop_free(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_insert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_insert", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_insert" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_insert" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sk_OPENSSL_STRING_insert" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  result = (int)sk_OPENSSL_STRING_insert(arg1,arg2,arg3);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  int arg2 ;
  char *arg3 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  PyObject *swig_obj[3] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_set", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_set" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_STRING_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "sk_OPENSSL_STRING_set" "', argument " "3"" of type '" "char *""'");
  }
  arg3 = (char *)(buf3);
  result = (char *)sk_OPENSSL_STRING_set(arg1,arg2,arg3);
  resultobj = SWIG_FromCharPtr((const char *)result);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return resultobj;
fail:
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_find(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_find", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_find" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_find" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_STRING_find(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_find_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_find_ex", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_find_ex" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_STRING_find_ex" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_STRING_find_ex(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_sort(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_sort" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  sk_OPENSSL_STRING_sort(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_is_sorted(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_is_sorted" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  result = (int)sk_OPENSSL_STRING_is_sorted((struct stack_st_OPENSSL_STRING const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_STRING *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_dup" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  result = (struct stack_st_OPENSSL_STRING *)sk_OPENSSL_STRING_dup((struct stack_st_OPENSSL_STRING const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_deep_copy(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  sk_OPENSSL_STRING_copyfunc arg2 = (sk_OPENSSL_STRING_copyfunc) 0 ;
  sk_OPENSSL_STRING_freefunc arg3 = (sk_OPENSSL_STRING_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  struct stack_st_OPENSSL_STRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_deep_copy", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_deep_copy" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__char__p_char);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_deep_copy" "', argument " "2"" of type '" "sk_OPENSSL_STRING_copyfunc""'"); 
    }
  }
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[2], (void**)(&arg3), SWIGTYPE_p_f_p_char__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_deep_copy" "', argument " "3"" of type '" "sk_OPENSSL_STRING_freefunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_STRING *)sk_OPENSSL_STRING_deep_copy((struct stack_st_OPENSSL_STRING const *)arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_STRING_set_cmp_func(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_STRING *arg1 = (struct stack_st_OPENSSL_STRING *) 0 ;
  sk_OPENSSL_STRING_compfunc arg2 = (sk_OPENSSL_STRING_compfunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  sk_OPENSSL_STRING_compfunc result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_STRING_set_cmp_func", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_STRING_set_cmp_func" "', argument " "1"" of type '" "struct stack_st_OPENSSL_STRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_STRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_STRING_set_cmp_func" "', argument " "2"" of type '" "sk_OPENSSL_STRING_compfunc""'"); 
    }
  }
  result = (sk_OPENSSL_STRING_compfunc)sk_OPENSSL_STRING_set_cmp_func(arg1,arg2);
  resultobj = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_num" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  result = (int)sk_OPENSSL_CSTRING_num((struct stack_st_OPENSSL_CSTRING const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_value" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_CSTRING_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (char *)sk_OPENSSL_CSTRING_value((struct stack_st_OPENSSL_CSTRING const *)arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_CSTRING_compfunc arg1 = (sk_OPENSSL_CSTRING_compfunc) 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_CSTRING *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_new" "', argument " "1"" of type '" "sk_OPENSSL_CSTRING_compfunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_CSTRING *)sk_OPENSSL_CSTRING_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_new_null", 0, 0, 0)) SWIG_fail;
  result = (struct stack_st_OPENSSL_CSTRING *)sk_OPENSSL_CSTRING_new_null();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_new_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_CSTRING_compfunc arg1 = (sk_OPENSSL_CSTRING_compfunc) 0 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  struct stack_st_OPENSSL_CSTRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_new_reserve", 2, 2, swig_obj)) SWIG_fail;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_new_reserve" "', argument " "1"" of type '" "sk_OPENSSL_CSTRING_compfunc""'"); 
    }
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_CSTRING_new_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (struct stack_st_OPENSSL_CSTRING *)sk_OPENSSL_CSTRING_new_reserve(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_reserve", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_reserve" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_CSTRING_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (int)sk_OPENSSL_CSTRING_reserve(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  sk_OPENSSL_CSTRING_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_zero(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_zero" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  sk_OPENSSL_CSTRING_zero(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_delete(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_delete", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_delete" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_CSTRING_delete" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (char *)sk_OPENSSL_CSTRING_delete(arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_delete_ptr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_delete_ptr", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_delete_ptr" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_delete_ptr" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (char *)sk_OPENSSL_CSTRING_delete_ptr(arg1,(char const *)arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_push" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_push" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_CSTRING_push(arg1,(char const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_unshift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_unshift", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_unshift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_unshift" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_CSTRING_unshift(arg1,(char const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_pop" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  result = (char *)sk_OPENSSL_CSTRING_pop(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_shift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_shift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  result = (char *)sk_OPENSSL_CSTRING_shift(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_pop_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  sk_OPENSSL_CSTRING_freefunc arg2 = (sk_OPENSSL_CSTRING_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_pop_free", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_pop_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_char__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_pop_free" "', argument " "2"" of type '" "sk_OPENSSL_CSTRING_freefunc""'"); 
    }
  }
  sk_OPENSSL_CSTRING_pop_free(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_insert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_insert", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_insert" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_insert" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sk_OPENSSL_CSTRING_insert" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  result = (int)sk_OPENSSL_CSTRING_insert(arg1,(char const *)arg2,arg3);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  int arg2 ;
  char *arg3 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  PyObject *swig_obj[3] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_set", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_set" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_CSTRING_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "sk_OPENSSL_CSTRING_set" "', argument " "3"" of type '" "char const *""'");
  }
  arg3 = (char *)(buf3);
  result = (char *)sk_OPENSSL_CSTRING_set(arg1,arg2,(char const *)arg3);
  resultobj = SWIG_FromCharPtr((const char *)result);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return resultobj;
fail:
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_find(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_find", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_find" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_find" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_CSTRING_find(arg1,(char const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_find_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_find_ex", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_find_ex" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_CSTRING_find_ex" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)sk_OPENSSL_CSTRING_find_ex(arg1,(char const *)arg2);
  resultobj = SWIG_From_int((int)(result));
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_sort(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_sort" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  sk_OPENSSL_CSTRING_sort(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_is_sorted(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_is_sorted" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  result = (int)sk_OPENSSL_CSTRING_is_sorted((struct stack_st_OPENSSL_CSTRING const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_CSTRING *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_dup" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  result = (struct stack_st_OPENSSL_CSTRING *)sk_OPENSSL_CSTRING_dup((struct stack_st_OPENSSL_CSTRING const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_deep_copy(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  sk_OPENSSL_CSTRING_copyfunc arg2 = (sk_OPENSSL_CSTRING_copyfunc) 0 ;
  sk_OPENSSL_CSTRING_freefunc arg3 = (sk_OPENSSL_CSTRING_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  struct stack_st_OPENSSL_CSTRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_deep_copy", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_deep_copy" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__char__p_char);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_deep_copy" "', argument " "2"" of type '" "sk_OPENSSL_CSTRING_copyfunc""'"); 
    }
  }
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[2], (void**)(&arg3), SWIGTYPE_p_f_p_char__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_deep_copy" "', argument " "3"" of type '" "sk_OPENSSL_CSTRING_freefunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_CSTRING *)sk_OPENSSL_CSTRING_deep_copy((struct stack_st_OPENSSL_CSTRING const *)arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_CSTRING_set_cmp_func(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_CSTRING *arg1 = (struct stack_st_OPENSSL_CSTRING *) 0 ;
  sk_OPENSSL_CSTRING_compfunc arg2 = (sk_OPENSSL_CSTRING_compfunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  sk_OPENSSL_CSTRING_compfunc result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_CSTRING_set_cmp_func", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_CSTRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_CSTRING_set_cmp_func" "', argument " "1"" of type '" "struct stack_st_OPENSSL_CSTRING *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_CSTRING *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_CSTRING_set_cmp_func" "', argument " "2"" of type '" "sk_OPENSSL_CSTRING_compfunc""'"); 
    }
  }
  result = (sk_OPENSSL_CSTRING_compfunc)sk_OPENSSL_CSTRING_set_cmp_func(arg1,arg2);
  resultobj = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_num" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  result = (int)sk_OPENSSL_BLOCK_num((struct stack_st_OPENSSL_BLOCK const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_value" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_BLOCK_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (void *)sk_OPENSSL_BLOCK_value((struct stack_st_OPENSSL_BLOCK const *)arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_BLOCK_compfunc arg1 = (sk_OPENSSL_BLOCK_compfunc) 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_BLOCK *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_new" "', argument " "1"" of type '" "sk_OPENSSL_BLOCK_compfunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_BLOCK *)sk_OPENSSL_BLOCK_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_new_null", 0, 0, 0)) SWIG_fail;
  result = (struct stack_st_OPENSSL_BLOCK *)sk_OPENSSL_BLOCK_new_null();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_new_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  sk_OPENSSL_BLOCK_compfunc arg1 = (sk_OPENSSL_BLOCK_compfunc) 0 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  struct stack_st_OPENSSL_BLOCK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_new_reserve", 2, 2, swig_obj)) SWIG_fail;
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[0], (void**)(&arg1), SWIGTYPE_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_new_reserve" "', argument " "1"" of type '" "sk_OPENSSL_BLOCK_compfunc""'"); 
    }
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_BLOCK_new_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (struct stack_st_OPENSSL_BLOCK *)sk_OPENSSL_BLOCK_new_reserve(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_reserve(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_reserve", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_reserve" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_BLOCK_reserve" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (int)sk_OPENSSL_BLOCK_reserve(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  sk_OPENSSL_BLOCK_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_zero(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_zero" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  sk_OPENSSL_BLOCK_zero(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_delete(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_delete", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_delete" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_BLOCK_delete" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (void *)sk_OPENSSL_BLOCK_delete(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_delete_ptr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_delete_ptr", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_delete_ptr" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_delete_ptr" "', argument " "2"" of type '" "void *""'"); 
  }
  result = (void *)sk_OPENSSL_BLOCK_delete_ptr(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_push" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_push" "', argument " "2"" of type '" "void *""'"); 
  }
  result = (int)sk_OPENSSL_BLOCK_push(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_unshift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_unshift", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_unshift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_unshift" "', argument " "2"" of type '" "void *""'"); 
  }
  result = (int)sk_OPENSSL_BLOCK_unshift(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_pop" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  result = (void *)sk_OPENSSL_BLOCK_pop(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_shift(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_shift" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  result = (void *)sk_OPENSSL_BLOCK_shift(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_pop_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  sk_OPENSSL_BLOCK_freefunc arg2 = (sk_OPENSSL_BLOCK_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_pop_free", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_pop_free" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_void__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_pop_free" "', argument " "2"" of type '" "sk_OPENSSL_BLOCK_freefunc""'"); 
    }
  }
  sk_OPENSSL_BLOCK_pop_free(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_insert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_insert", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_insert" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_insert" "', argument " "2"" of type '" "void *""'"); 
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sk_OPENSSL_BLOCK_insert" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  result = (int)sk_OPENSSL_BLOCK_insert(arg1,arg2,arg3);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  int arg2 ;
  void *arg3 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  PyObject *swig_obj[3] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_set", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_set" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_OPENSSL_BLOCK_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2],SWIG_as_voidptrptr(&arg3), 0, 0);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "sk_OPENSSL_BLOCK_set" "', argument " "3"" of type '" "void *""'"); 
  }
  result = (void *)sk_OPENSSL_BLOCK_set(arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_find(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_find", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_find" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_find" "', argument " "2"" of type '" "void *""'"); 
  }
  result = (int)sk_OPENSSL_BLOCK_find(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_find_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *arg2 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_find_ex", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_find_ex" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1],SWIG_as_voidptrptr(&arg2), 0, 0);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_OPENSSL_BLOCK_find_ex" "', argument " "2"" of type '" "void *""'"); 
  }
  result = (int)sk_OPENSSL_BLOCK_find_ex(arg1,arg2);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_sort(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_sort" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  sk_OPENSSL_BLOCK_sort(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_is_sorted(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_is_sorted" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  result = (int)sk_OPENSSL_BLOCK_is_sorted((struct stack_st_OPENSSL_BLOCK const *)arg1);
  resultobj = SWIG_From_int((int)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_OPENSSL_BLOCK *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_dup" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  result = (struct stack_st_OPENSSL_BLOCK *)sk_OPENSSL_BLOCK_dup((struct stack_st_OPENSSL_BLOCK const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_deep_copy(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  sk_OPENSSL_BLOCK_copyfunc arg2 = (sk_OPENSSL_BLOCK_copyfunc) 0 ;
  sk_OPENSSL_BLOCK_freefunc arg3 = (sk_OPENSSL_BLOCK_freefunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  struct stack_st_OPENSSL_BLOCK *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_deep_copy", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_deep_copy" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK const *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__void__p_void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_deep_copy" "', argument " "2"" of type '" "sk_OPENSSL_BLOCK_copyfunc""'"); 
    }
  }
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[2], (void**)(&arg3), SWIGTYPE_p_f_p_void__void);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_deep_copy" "', argument " "3"" of type '" "sk_OPENSSL_BLOCK_freefunc""'"); 
    }
  }
  result = (struct stack_st_OPENSSL_BLOCK *)sk_OPENSSL_BLOCK_deep_copy((struct stack_st_OPENSSL_BLOCK const *)arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_OPENSSL_BLOCK_set_cmp_func(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_OPENSSL_BLOCK *arg1 = (struct stack_st_OPENSSL_BLOCK *) 0 ;
  sk_OPENSSL_BLOCK_compfunc arg2 = (sk_OPENSSL_BLOCK_compfunc) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  sk_OPENSSL_BLOCK_compfunc result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_OPENSSL_BLOCK_set_cmp_func", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_OPENSSL_BLOCK, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_OPENSSL_BLOCK_set_cmp_func" "', argument " "1"" of type '" "struct stack_st_OPENSSL_BLOCK *""'"); 
  }
  arg1 = (struct stack_st_OPENSSL_BLOCK *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "sk_OPENSSL_BLOCK_set_cmp_func" "', argument " "2"" of type '" "sk_OPENSSL_BLOCK_compfunc""'"); 
    }
  }
  result = (sk_OPENSSL_BLOCK_compfunc)sk_OPENSSL_BLOCK_set_cmp_func(arg1,arg2);
  resultobj = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_threading_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "threading_init", 0, 0, 0)) SWIG_fail;
  threading_init();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_threading_cleanup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "threading_cleanup", 0, 0, 0)) SWIG_fail;
  threading_cleanup();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_lib_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "lib_init", 0, 0, 0)) SWIG_fail;
  lib_init();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bn_to_mpi(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIGNUM *arg1 = (BIGNUM *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIGNUM, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bn_to_mpi" "', argument " "1"" of type '" "BIGNUM const *""'"); 
  }
  arg1 = (BIGNUM *)(argp1);
  result = (PyObject *)bn_to_mpi((BIGNUM const *)arg1);
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_mpi_to_bn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  BIGNUM *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  arg1 = swig_obj[0];
  result = (BIGNUM *)mpi_to_bn(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIGNUM, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bn_to_bin(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIGNUM *arg1 = (BIGNUM *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIGNUM, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bn_to_bin" "', argument " "1"" of type '" "BIGNUM *""'"); 
  }
  arg1 = (BIGNUM *)(argp1);
  result = (PyObject *)bn_to_bin(arg1);
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bin_to_bn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  BIGNUM *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  arg1 = swig_obj[0];
  result = (BIGNUM *)bin_to_bn(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIGNUM, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bn_to_hex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIGNUM *arg1 = (BIGNUM *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIGNUM, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bn_to_hex" "', argument " "1"" of type '" "BIGNUM *""'"); 
  }
  arg1 = (BIGNUM *)(argp1);
  result = (PyObject *)bn_to_hex(arg1);
  resultobj = result;
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hex_to_bn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  BIGNUM *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  arg1 = swig_obj[0];
  result = (BIGNUM *)hex_to_bn(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIGNUM, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dec_to_bn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  BIGNUM *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  arg1 = swig_obj[0];
  result = (BIGNUM *)dec_to_bn(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIGNUM, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_print_errors(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "err_print_errors" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    ERR_print_errors(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_get_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned long result;
  
  if (!SWIG_Python_UnpackTuple(args, "err_get_error", 0, 0, 0)) SWIG_fail;
  result = (unsigned long)ERR_get_error();
  resultobj = SWIG_From_unsigned_SS_long((unsigned long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_peek_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned long result;
  
  if (!SWIG_Python_UnpackTuple(args, "err_peek_error", 0, 0, 0)) SWIG_fail;
  result = (unsigned long)ERR_peek_error();
  resultobj = SWIG_From_unsigned_SS_long((unsigned long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_lib_error_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_unsigned_SS_long(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "err_lib_error_string" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = (unsigned long)(val1);
  result = (char *)ERR_lib_error_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_func_error_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_unsigned_SS_long(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "err_func_error_string" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = (unsigned long)(val1);
  result = (char *)ERR_func_error_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_err_reason_error_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned long arg1 ;
  unsigned long val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_unsigned_SS_long(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "err_reason_error_string" "', argument " "1"" of type '" "unsigned long""'");
  } 
  arg1 = (unsigned long)(val1);
  result = (char *)ERR_reason_error_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_s_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_s_bio", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_s_bio();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_s_mem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_s_mem", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_s_mem();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_s_socket(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_s_socket", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_s_socket();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_f_ssl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_f_ssl", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_f_ssl();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_f_buffer(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_f_buffer", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_f_buffer();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_f_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_f_cipher", 0, 0, 0)) SWIG_fail;
  result = (BIO_METHOD *)BIO_f_cipher();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO_METHOD *arg1 = (BIO_METHOD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  BIO *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO_METHOD, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_new" "', argument " "1"" of type '" "BIO_METHOD *""'"); 
  }
  arg1 = (BIO_METHOD *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (BIO *)BIO_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new_socket(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_new_socket", 2, 2, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bio_new_socket" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_new_socket" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (BIO *)BIO_new_socket(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_free_all(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_free_all" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    BIO_free_all(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_dup_chain(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  BIO *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_dup_chain" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (BIO *)BIO_dup_chain(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_push" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bio_push" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (BIO *)BIO_push(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  BIO *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_pop" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (BIO *)BIO_pop(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_eof(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_eof" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)BIO_eof(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__bio_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_bio_err""' of type '""PyObject *""'");
    }
    _bio_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__bio_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_bio_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_pyfd_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_init", 0, 0, 0)) SWIG_fail;
  pyfd_init();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  bio_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_free" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_free(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_new_file", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_new_file" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bio_new_file" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (BIO *)bio_new_file((char const *)arg1,(char const *)arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new_pyfile(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  int arg2 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_new_pyfile", 2, 2, swig_obj)) SWIG_fail;
  {
    arg1=swig_obj[0];
  }
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_new_pyfile" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (BIO *)bio_new_pyfile(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_read(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_read", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_read" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_read" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)bio_read(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_gets(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_gets", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_gets" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_gets" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)bio_gets(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_write(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_write", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_write" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_write(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_ctrl_pending(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_ctrl_pending" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_ctrl_pending(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_ctrl_wpending(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_ctrl_wpending" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_ctrl_wpending(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_ctrl_get_write_guarantee(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_ctrl_get_write_guarantee" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_ctrl_get_write_guarantee(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_reset(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_reset" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_reset(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_flush(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_flush" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)bio_flush(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_seek(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_seek", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_seek" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_seek" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_seek(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_tell(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_tell" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_tell(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_set_flags(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_set_flags", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_set_flags" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_set_flags" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  bio_set_flags(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_get_flags(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_get_flags" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_get_flags(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_set_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  EVP_CIPHER *arg2 = (EVP_CIPHER *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_set_cipher", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_set_cipher" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bio_set_cipher" "', argument " "2"" of type '" "EVP_CIPHER *""'"); 
  }
  arg2 = (EVP_CIPHER *)(argp2);
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "bio_set_cipher" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)bio_set_cipher(arg1,arg2,arg3,arg4,arg5);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_set_mem_eof_return(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_set_mem_eof_return", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_set_mem_eof_return" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_set_mem_eof_return" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_set_mem_eof_return(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_get_fd(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_get_fd" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_get_fd(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_do_handshake(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_do_handshake" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)bio_do_handshake(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_make_bio_pair(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_make_bio_pair", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_make_bio_pair" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bio_make_bio_pair" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_make_bio_pair(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_set_write_buf_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  size_t arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_set_write_buf_size", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_set_write_buf_size" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_set_write_buf_size" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = (size_t)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_set_write_buf_size(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_should_retry(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_should_retry" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_should_retry(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_should_read(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_should_read" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_should_read(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_should_write(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_should_write" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_should_write(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_BIO_PYFD_CTX_fd_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct pyfd_struct *arg1 = (struct pyfd_struct *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_pyfd_struct, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BIO_PYFD_CTX_fd_set" "', argument " "1"" of type '" "struct pyfd_struct *""'"); 
  }
  arg1 = (struct pyfd_struct *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "BIO_PYFD_CTX_fd_set" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  if (arg1) (arg1)->fd = arg2;
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_BIO_PYFD_CTX_fd_get(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct pyfd_struct *arg1 = (struct pyfd_struct *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "BIO_PYFD_CTX_fd_get", 0, 0, 0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_pyfd_struct, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BIO_PYFD_CTX_fd_get" "', argument " "1"" of type '" "struct pyfd_struct *""'"); 
  }
  arg1 = (struct pyfd_struct *)(argp1);
  result = (int) ((arg1)->fd);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int _wrap_new_BIO_PYFD_CTX(PyObject *self, PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  struct pyfd_struct *result = 0 ;
  
  if (!SWIG_Python_CheckNoKeywords(kwargs, "new_BIO_PYFD_CTX")) SWIG_fail;
  if (!SWIG_Python_UnpackTuple(args, "new_BIO_PYFD_CTX", 0, 0, 0)) SWIG_fail;
  result = (struct pyfd_struct *)calloc(1, sizeof(struct pyfd_struct));
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pyfd_struct, SWIG_BUILTIN_INIT |  0 );
  return resultobj == Py_None ? -1 : 0;
fail:
  return -1;
}


SWIGINTERN PyObject *_wrap_delete_BIO_PYFD_CTX(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct pyfd_struct *arg1 = (struct pyfd_struct *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!SWIG_Python_UnpackTuple(args, "delete_BIO_PYFD_CTX", 0, 0, 0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_pyfd_struct, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_BIO_PYFD_CTX" "', argument " "1"" of type '" "struct pyfd_struct *""'"); 
  }
  arg1 = (struct pyfd_struct *)(argp1);
  free((char *) arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_BIO_PYFD_CTX) /* defines _wrap_delete_BIO_PYFD_CTX_destructor_closure */

SWIGINTERN int Swig_var_methods_fdp_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_BIO_METHOD,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""methods_fdp""' of type '""BIO_METHOD *""'");
    }
    methods_fdp = (BIO_METHOD *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var_methods_fdp_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(methods_fdp), SWIGTYPE_p_BIO_METHOD,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_pyfd_write(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_write", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_write" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pyfd_write" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pyfd_write" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_write(arg1,(char const *)arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_read(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_read", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_read" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pyfd_read" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pyfd_read" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_read(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_puts(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_puts", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_puts" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pyfd_puts" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_puts(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_gets(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_gets", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_gets" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pyfd_gets" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pyfd_gets" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_gets(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_new" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_new(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_free" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pyfd_free(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pyfd_ctrl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  int arg2 ;
  long arg3 ;
  void *arg4 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  long val3 ;
  int ecode3 = 0 ;
  int res4 ;
  PyObject *swig_obj[4] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "pyfd_ctrl", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pyfd_ctrl" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pyfd_ctrl" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pyfd_ctrl" "', argument " "3"" of type '" "long""'");
  } 
  arg3 = (long)(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3],SWIG_as_voidptrptr(&arg4), 0, 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "pyfd_ctrl" "', argument " "4"" of type '" "void *""'"); 
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)pyfd_ctrl(arg1,arg2,arg3,arg4);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new_pyfd(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_new_pyfd", 2, 2, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bio_new_pyfd" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_new_pyfd" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (BIO *)BIO_new_pyfd(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bn_rand(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  int arg3 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bn_rand", 3, 3, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "bn_rand" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bn_rand" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bn_rand" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  result = (PyObject *)bn_rand(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bn_rand_range(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (PyObject *)bn_rand_range(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_file_name__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  size_t arg2 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  char *result = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rand_file_name" "', argument " "1"" of type '" "char *""'");
  }
  arg1 = (char *)(buf1);
  ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "rand_file_name" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = (size_t)(val2);
  result = (char *)RAND_file_name(arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_load_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  long arg2 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_load_file", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rand_load_file" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "rand_load_file" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  result = (int)RAND_load_file((char const *)arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_save_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rand_save_file" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  result = (int)RAND_write_file((char const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_poll(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_poll", 0, 0, 0)) SWIG_fail;
  result = (int)RAND_poll();
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_status(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_status", 0, 0, 0)) SWIG_fail;
  result = (int)RAND_status();
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_cleanup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_cleanup", 0, 0, 0)) SWIG_fail;
  RAND_cleanup();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__rand_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_rand_err""' of type '""PyObject *""'");
    }
    _rand_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__rand_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_rand_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_rand_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  rand_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_seed(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (PyObject *)rand_seed(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_add(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  double arg2 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_add", 2, 2, swig_obj)) SWIG_fail;
  {
    arg1=swig_obj[0];
  }
  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "rand_add" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = (double)(val2);
  result = (PyObject *)rand_add(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_bytes(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "rand_bytes" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (PyObject *)rand_bytes(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_pseudo_bytes(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "rand_pseudo_bytes" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (PyObject *)rand_pseudo_bytes(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_file_name__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
  PyObject *resultobj = 0;
  PyObject *result = 0 ;
  
  if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
  result = (PyObject *)rand_file_name();
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_file_name(PyObject *self, PyObject *args) {
  Py_ssize_t argc;
  PyObject *argv[3] = {
    0
  };
  
  if (!(argc = SWIG_Python_UnpackTuple(args, "rand_file_name", 0, 2, argv))) SWIG_fail;
  --argc;
  if (argc == 0) {
    return _wrap_rand_file_name__SWIG_1(self, argc, argv);
  }
  if (argc == 2) {
    int _v;
    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      {
        int res = SWIG_AsVal_size_t(argv[1], NULL);
        _v = SWIG_CheckState(res);
      }
      if (_v) {
        return _wrap_rand_file_name__SWIG_0(self, argc, argv);
      }
    }
  }
  
fail:
  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'rand_file_name'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    RAND_file_name(char *,size_t)\n"
    "    rand_file_name()\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_rand_screen(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_screen", 0, 0, 0)) SWIG_fail;
  rand_screen();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rand_win32_event(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  unsigned int arg1 ;
  int arg2 ;
  long arg3 ;
  unsigned int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  long val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rand_win32_event", 3, 3, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_unsigned_SS_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "rand_win32_event" "', argument " "1"" of type '" "unsigned int""'");
  } 
  arg1 = (unsigned int)(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "rand_win32_event" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rand_win32_event" "', argument " "3"" of type '" "long""'");
  } 
  arg3 = (long)(val3);
  result = (int)rand_win32_event(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_md5(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "md5", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_md5();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sha1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sha1", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_sha1();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ripemd160(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ripemd160", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_ripemd160();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sha224(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sha224", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_sha224();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sha256(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sha256", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_sha256();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sha384(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sha384", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_sha384();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sha512(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sha512", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD *)EVP_sha512();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_MD *arg2 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_init", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "digest_init" "', argument " "2"" of type '" "EVP_MD const *""'"); 
  }
  arg2 = (EVP_MD *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_DigestInit(arg1,(EVP_MD const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede3_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede3_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede3();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede3_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede3_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede3_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede3_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede3_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede3_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_des_ede3_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "des_ede3_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_des_ede3_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bf_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bf_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_bf_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bf_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bf_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_bf_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bf_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bf_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_bf_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bf_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bf_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_bf_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cast5_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cast5_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_cast5_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cast5_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cast5_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_cast5_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cast5_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cast5_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_cast5_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cast5_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cast5_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_cast5_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rc4", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_rc4();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc2_40_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rc2_40_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_rc2_40_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_128_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_128_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_128_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_128_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_128_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_128_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_128_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_128_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_128_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_128_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_128_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_128_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_128_ctr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_128_ctr", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_128_ctr();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_192_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_192_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_192_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_192_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_192_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_192_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_192_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_192_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_192_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_192_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_192_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_192_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_192_ctr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_192_ctr", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_192_ctr();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_256_ecb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_256_ecb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_256_ecb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_256_cbc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_256_cbc", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_256_cbc();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_256_cfb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_256_cfb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_256_cfb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_256_ofb(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_256_ofb", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_256_ofb();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_256_ctr(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_256_ctr", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER *)EVP_aes_256_ctr();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_set_padding(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *arg1 = (EVP_CIPHER_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "cipher_set_padding", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cipher_set_padding" "', argument " "1"" of type '" "EVP_CIPHER_CTX *""'"); 
  }
  arg1 = (EVP_CIPHER_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cipher_set_padding" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_CIPHER_CTX_set_padding(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_free" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  EVP_PKEY_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_assign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  int arg2 ;
  char *arg3 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_assign", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_assign" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "pkey_assign" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkey_assign" "', argument " "3"" of type '" "char *""'");
  }
  arg3 = (char *)(buf3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_PKEY_assign(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return resultobj;
fail:
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_assign_ec(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  EC_KEY *arg2 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_assign_ec", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_assign_ec" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkey_assign_ec" "', argument " "2"" of type '" "EC_KEY *""'"); 
  }
  arg2 = (EC_KEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_PKEY_assign_EC_KEY(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_set1_rsa(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  RSA *arg2 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_set1_rsa", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_set1_rsa" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkey_set1_rsa" "', argument " "2"" of type '" "RSA *""'"); 
  }
  arg2 = (RSA *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_PKEY_set1_RSA(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sign_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_MD *arg2 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sign_init", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sign_init" "', argument " "2"" of type '" "EVP_MD const *""'"); 
  }
  arg2 = (EVP_MD *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_SignInit(arg1,(EVP_MD const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_verify_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_MD *arg2 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "verify_init", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verify_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "verify_init" "', argument " "2"" of type '" "EVP_MD const *""'"); 
  }
  arg2 = (EVP_MD *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_VerifyInit(arg1,(EVP_MD const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_sign_init__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_PKEY_CTX **arg2 = (EVP_PKEY_CTX **) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  ENGINE *arg4 = (ENGINE *) 0 ;
  EVP_PKEY *arg5 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int result;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_sign_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_EVP_PKEY_CTX, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "digest_sign_init" "', argument " "2"" of type '" "EVP_PKEY_CTX **""'"); 
  }
  arg2 = (EVP_PKEY_CTX **)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "digest_sign_init" "', argument " "3"" of type '" "EVP_MD const *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "digest_sign_init" "', argument " "4"" of type '" "ENGINE *""'"); 
  }
  arg4 = (ENGINE *)(argp4);
  res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "digest_sign_init" "', argument " "5"" of type '" "EVP_PKEY *""'"); 
  }
  arg5 = (EVP_PKEY *)(argp5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg5) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_DigestSignInit(arg1,arg2,(EVP_MD const *)arg3,arg4,arg5);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_verify_init__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_PKEY_CTX **arg2 = (EVP_PKEY_CTX **) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  ENGINE *arg4 = (ENGINE *) 0 ;
  EVP_PKEY *arg5 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int result;
  
  if ((nobjs < 5) || (nobjs > 5)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_verify_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_EVP_PKEY_CTX, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "digest_verify_init" "', argument " "2"" of type '" "EVP_PKEY_CTX **""'"); 
  }
  arg2 = (EVP_PKEY_CTX **)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "digest_verify_init" "', argument " "3"" of type '" "EVP_MD const *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "digest_verify_init" "', argument " "4"" of type '" "ENGINE *""'"); 
  }
  arg4 = (ENGINE *)(argp4);
  res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "digest_verify_init" "', argument " "5"" of type '" "EVP_PKEY *""'"); 
  }
  arg5 = (EVP_PKEY *)(argp5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg5) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_DigestVerifyInit(arg1,arg2,(EVP_MD const *)arg3,arg4,arg5);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_size" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EVP_PKEY_size(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__evp_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_evp_err""' of type '""PyObject *""'");
    }
    _evp_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__evp_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_evp_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_evp_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  evp_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_get1_rsa(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  RSA *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_get1_rsa" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (RSA *)pkey_get1_rsa(arg1);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_RSA, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs5_pbkdf2_hmac_sha1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  int arg4 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs5_pbkdf2_hmac_sha1", 4, 4, swig_obj)) SWIG_fail;
  {
    arg1=swig_obj[0];
  }
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pkcs5_pbkdf2_hmac_sha1" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pkcs5_pbkdf2_hmac_sha1" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  result = (PyObject *)pkcs5_pbkdf2_hmac_sha1(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_md_ctx_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "md_ctx_new", 0, 0, 0)) SWIG_fail;
  result = (EVP_MD_CTX *)md_ctx_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_md_ctx_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "md_ctx_free" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  md_ctx_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_update" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_update(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_final" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)digest_final(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac_ctx_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  HMAC_CTX *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "hmac_ctx_new", 0, 0, 0)) SWIG_fail;
  result = (HMAC_CTX *)hmac_ctx_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HMAC_CTX, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac_ctx_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  HMAC_CTX *arg1 = (HMAC_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_HMAC_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hmac_ctx_free" "', argument " "1"" of type '" "HMAC_CTX *""'"); 
  }
  arg1 = (HMAC_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  hmac_ctx_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  HMAC_CTX *arg1 = (HMAC_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "hmac_init", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_HMAC_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hmac_init" "', argument " "1"" of type '" "HMAC_CTX *""'"); 
  }
  arg1 = (HMAC_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "hmac_init" "', argument " "3"" of type '" "EVP_MD const *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)hmac_init(arg1,arg2,(EVP_MD const *)arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  HMAC_CTX *arg1 = (HMAC_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "hmac_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_HMAC_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hmac_update" "', argument " "1"" of type '" "HMAC_CTX *""'"); 
  }
  arg1 = (HMAC_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)hmac_update(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  HMAC_CTX *arg1 = (HMAC_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_HMAC_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hmac_final" "', argument " "1"" of type '" "HMAC_CTX *""'"); 
  }
  arg1 = (HMAC_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)hmac_final(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_hmac(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "hmac", 3, 3, swig_obj)) SWIG_fail;
  {
    arg1=swig_obj[0];
  }
  {
    arg2=swig_obj[1];
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "hmac" "', argument " "3"" of type '" "EVP_MD const *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)hmac(arg1,arg2,(EVP_MD const *)arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_ctx_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cipher_ctx_new", 0, 0, 0)) SWIG_fail;
  result = (EVP_CIPHER_CTX *)cipher_ctx_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_ctx_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *arg1 = (EVP_CIPHER_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cipher_ctx_free" "', argument " "1"" of type '" "EVP_CIPHER_CTX *""'"); 
  }
  arg1 = (EVP_CIPHER_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  cipher_ctx_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bytes_to_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER *arg1 = (EVP_CIPHER *) 0 ;
  EVP_MD *arg2 = (EVP_MD *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  PyObject *arg5 = (PyObject *) 0 ;
  int arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  PyObject *swig_obj[6] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bytes_to_key", 6, 6, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bytes_to_key" "', argument " "1"" of type '" "EVP_CIPHER const *""'"); 
  }
  arg1 = (EVP_CIPHER *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bytes_to_key" "', argument " "2"" of type '" "EVP_MD *""'"); 
  }
  arg2 = (EVP_MD *)(argp2);
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  {
    arg5=swig_obj[4];
  }
  ecode6 = SWIG_AsVal_int(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "bytes_to_key" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = (int)(val6);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)bytes_to_key((EVP_CIPHER const *)arg1,arg2,arg3,arg4,arg5,arg6);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *arg1 = (EVP_CIPHER_CTX *) 0 ;
  EVP_CIPHER *arg2 = (EVP_CIPHER *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cipher_init", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cipher_init" "', argument " "1"" of type '" "EVP_CIPHER_CTX *""'"); 
  }
  arg1 = (EVP_CIPHER_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cipher_init" "', argument " "2"" of type '" "EVP_CIPHER const *""'"); 
  }
  arg2 = (EVP_CIPHER *)(argp2);
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "cipher_init" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)cipher_init(arg1,(EVP_CIPHER const *)arg2,arg3,arg4,arg5);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *arg1 = (EVP_CIPHER_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "cipher_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cipher_update" "', argument " "1"" of type '" "EVP_CIPHER_CTX *""'"); 
  }
  arg1 = (EVP_CIPHER_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)cipher_update(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_cipher_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_CIPHER_CTX *arg1 = (EVP_CIPHER_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_CIPHER_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cipher_final" "', argument " "1"" of type '" "EVP_CIPHER_CTX *""'"); 
  }
  arg1 = (EVP_CIPHER_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)cipher_final(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sign_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sign_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign_update" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)sign_update(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sign_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sign_final", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign_final" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sign_final" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)sign_final(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_verify_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "verify_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verify_update" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)verify_update(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_verify_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  EVP_PKEY *arg3 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "verify_final", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verify_final" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "verify_final" "', argument " "3"" of type '" "EVP_PKEY *""'"); 
  }
  arg3 = (EVP_PKEY *)(argp3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)verify_final(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_sign_init__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_sign_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "digest_sign_init" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_sign_init(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_sign_init(PyObject *self, PyObject *args) {
  Py_ssize_t argc;
  PyObject *argv[6] = {
    0
  };
  
  if (!(argc = SWIG_Python_UnpackTuple(args, "digest_sign_init", 0, 5, argv))) SWIG_fail;
  --argc;
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EVP_MD_CTX, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EVP_PKEY, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_digest_sign_init__SWIG_1(self, argc, argv);
      }
    }
  }
  if (argc == 5) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EVP_MD_CTX, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_p_EVP_PKEY_CTX, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EVP_MD, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          void *vptr = 0;
          int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_ENGINE, 0);
          _v = SWIG_CheckState(res);
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_EVP_PKEY, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              return _wrap_digest_sign_init__SWIG_0(self, argc, argv);
            }
          }
        }
      }
    }
  }
  
fail:
  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'digest_sign_init'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    EVP_DigestSignInit(EVP_MD_CTX *,EVP_PKEY_CTX **,EVP_MD const *,ENGINE *,EVP_PKEY *)\n"
    "    digest_sign_init(EVP_MD_CTX *,EVP_PKEY *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_digest_sign_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_sign_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_sign_update" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)digest_sign_update(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_sign_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_sign_final" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)digest_sign_final(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_sign", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_sign" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)digest_sign(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_verify_init__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int result;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_verify_init" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "digest_verify_init" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_verify_init(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_verify_init(PyObject *self, PyObject *args) {
  Py_ssize_t argc;
  PyObject *argv[6] = {
    0
  };
  
  if (!(argc = SWIG_Python_UnpackTuple(args, "digest_verify_init", 0, 5, argv))) SWIG_fail;
  --argc;
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EVP_MD_CTX, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_EVP_PKEY, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_digest_verify_init__SWIG_1(self, argc, argv);
      }
    }
  }
  if (argc == 5) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EVP_MD_CTX, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *vptr = 0;
      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_p_EVP_PKEY_CTX, 0);
      _v = SWIG_CheckState(res);
      if (_v) {
        void *vptr = 0;
        int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_EVP_MD, 0);
        _v = SWIG_CheckState(res);
        if (_v) {
          void *vptr = 0;
          int res = SWIG_ConvertPtr(argv[3], &vptr, SWIGTYPE_p_ENGINE, 0);
          _v = SWIG_CheckState(res);
          if (_v) {
            void *vptr = 0;
            int res = SWIG_ConvertPtr(argv[4], &vptr, SWIGTYPE_p_EVP_PKEY, 0);
            _v = SWIG_CheckState(res);
            if (_v) {
              return _wrap_digest_verify_init__SWIG_0(self, argc, argv);
            }
          }
        }
      }
    }
  }
  
fail:
  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'digest_verify_init'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    EVP_DigestVerifyInit(EVP_MD_CTX *,EVP_PKEY_CTX **,EVP_MD const *,ENGINE *,EVP_PKEY *)\n"
    "    digest_verify_init(EVP_MD_CTX *,EVP_PKEY *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_digest_verify_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_verify_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_verify_update" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_verify_update(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_verify_final(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_verify_final", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_verify_final" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_verify_final(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_digest_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_MD_CTX *arg1 = (EVP_MD_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "digest_verify", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_MD_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "digest_verify" "', argument " "1"" of type '" "EVP_MD_CTX *""'"); 
  }
  arg1 = (EVP_MD_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)digest_verify(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_get_digestbyname(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  EVP_MD *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_digestbyname" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  result = (EVP_MD *)get_digestbyname((char const *)arg1);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_EVP_MD, 0);
    else {
      resultobj = NULL;
    }
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_write_pem_no_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_write_pem_no_cipher", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_write_pem_no_cipher" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkey_write_pem_no_cipher" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pkey_write_pem_no_cipher(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_write_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  EVP_CIPHER *arg3 = (EVP_CIPHER *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_write_pem", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_write_pem" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkey_write_pem" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkey_write_pem" "', argument " "3"" of type '" "EVP_CIPHER *""'"); 
  }
  arg3 = (EVP_CIPHER *)(argp3);
  {
    if (!PyCallable_Check(swig_obj[3])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pkey_write_pem(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_new", 0, 0, 0)) SWIG_fail;
  result = (EVP_PKEY *)pkey_new();
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_EVP_PKEY, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_read_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  EVP_PKEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_read_pem", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_read_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)pkey_read_pem(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_EVP_PKEY, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_read_pem_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  EVP_PKEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_read_pem_pubkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_read_pem_pubkey" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)pkey_read_pem_pubkey(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_EVP_PKEY, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_assign_rsa(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  RSA *arg2 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkey_assign_rsa", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_assign_rsa" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkey_assign_rsa" "', argument " "2"" of type '" "RSA *""'"); 
  }
  arg2 = (RSA *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pkey_assign_rsa(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_as_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_as_der" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)pkey_as_der(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkey_get_modulus(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EVP_PKEY *arg1 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkey_get_modulus" "', argument " "1"" of type '" "EVP_PKEY *""'"); 
  }
  arg1 = (EVP_PKEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)pkey_get_modulus(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_aes_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  AES_KEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "aes_new", 0, 0, 0)) SWIG_fail;
  result = (AES_KEY *)aes_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_AES_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_AES_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  AES_KEY *arg1 = (AES_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AES_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AES_free" "', argument " "1"" of type '" "AES_KEY *""'"); 
  }
  arg1 = (AES_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  AES_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_AES_set_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  AES_KEY *arg1 = (AES_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "AES_set_key", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AES_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AES_set_key" "', argument " "1"" of type '" "AES_KEY *""'"); 
  }
  arg1 = (AES_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AES_set_key" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "AES_set_key" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)AES_set_key(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_AES_crypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  AES_KEY *arg1 = (AES_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "AES_crypt", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AES_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AES_crypt" "', argument " "1"" of type '" "AES_KEY const *""'"); 
  }
  arg1 = (AES_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AES_crypt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "AES_crypt" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)AES_crypt((AES_KEY const *)arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_AES_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  AES_KEY *arg1 = (AES_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AES_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AES_type_check" "', argument " "1"" of type '" "AES_KEY *""'"); 
  }
  arg1 = (AES_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)AES_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RC4_KEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rc4_new", 0, 0, 0)) SWIG_fail;
  result = (RC4_KEY *)rc4_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_RC4_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RC4_KEY *arg1 = (RC4_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RC4_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rc4_free" "', argument " "1"" of type '" "RC4_KEY *""'"); 
  }
  arg1 = (RC4_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  rc4_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4_set_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RC4_KEY *arg1 = (RC4_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rc4_set_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RC4_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rc4_set_key" "', argument " "1"" of type '" "RC4_KEY *""'"); 
  }
  arg1 = (RC4_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rc4_set_key(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4_update(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RC4_KEY *arg1 = (RC4_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rc4_update", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RC4_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rc4_update" "', argument " "1"" of type '" "RC4_KEY *""'"); 
  }
  arg1 = (RC4_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rc4_update(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rc4_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RC4_KEY *arg1 = (RC4_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RC4_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rc4_type_check" "', argument " "1"" of type '" "RC4_KEY *""'"); 
  }
  arg1 = (RC4_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rc4_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dh_new", 0, 0, 0)) SWIG_fail;
  result = (DH *)DH_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DH, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_free" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  DH_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_size" "', argument " "1"" of type '" "DH const *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)DH_size((DH const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_generate_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_generate_key" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)DH_generate_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dhparams_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  DH *arg2 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dhparams_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dhparams_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dhparams_print" "', argument " "2"" of type '" "DH const *""'"); 
  }
  arg2 = (DH *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)DHparams_print(arg1,(DH const *)arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__dh_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_dh_err""' of type '""PyObject *""'");
    }
    _dh_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__dh_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_dh_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_dh_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  dh_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_type_check" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dh_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_read_parameters(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  DH *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_read_parameters" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (DH *)dh_read_parameters(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DH, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_generate_parameters(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[3] ;
  DH *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dh_generate_parameters", 3, 3, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "dh_generate_parameters" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "dh_generate_parameters" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  result = (DH *)dh_generate_parameters(arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DH, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_check" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dh_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_compute_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dh_compute_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_compute_key" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_compute_key(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_get_p(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_get_p" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_get_p(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_get_g(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_get_g" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_get_g(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_get_pub(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_get_pub" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_get_pub(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_get_priv(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_get_priv" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_get_priv(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dh_set_pg(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DH *arg1 = (DH *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dh_set_pg", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dh_set_pg" "', argument " "1"" of type '" "DH *""'"); 
  }
  arg1 = (DH *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dh_set_pg(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_size" "', argument " "1"" of type '" "RSA const *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)RSA_size((RSA const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_new", 0, 0, 0)) SWIG_fail;
  result = (RSA *)RSA_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_RSA, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_free" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  RSA_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_check_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_check_key" "', argument " "1"" of type '" "RSA const *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)RSA_check_key((RSA const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__rsa_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_rsa_err""' of type '""PyObject *""'");
    }
    _rsa_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__rsa_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_rsa_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_rsa_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  rsa_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_read_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  RSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_read_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_read_key" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (RSA *)rsa_read_key(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_RSA, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_write_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  EVP_CIPHER *arg3 = (EVP_CIPHER *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_write_key", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_write_key" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rsa_write_key" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rsa_write_key" "', argument " "3"" of type '" "EVP_CIPHER *""'"); 
  }
  arg3 = (EVP_CIPHER *)(argp3);
  {
    if (!PyCallable_Check(swig_obj[3])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_write_key(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_write_key_no_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_write_key_no_cipher", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_write_key_no_cipher" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rsa_write_key_no_cipher" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_write_key_no_cipher(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_read_pub_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  RSA *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_read_pub_key" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (RSA *)rsa_read_pub_key(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_RSA, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_write_pub_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_write_pub_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_write_pub_key" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rsa_write_pub_key" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)rsa_write_pub_key(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_get_e(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_get_e" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_get_e(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_get_n(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_get_n" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_get_n(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_set_e(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_set_e", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_set_e" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_set_e(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_set_n(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_set_n", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_set_n" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_set_n(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_set_en(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_set_en", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_set_en" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_set_en(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_PyObject_Bin_AsBIGNUM(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  BIGNUM *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (BIGNUM *)PyObject_Bin_AsBIGNUM(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIGNUM, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_set_en_bin(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_set_en_bin", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_set_en_bin" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_set_en_bin(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_private_encrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_private_encrypt", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_private_encrypt" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rsa_private_encrypt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_private_encrypt(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_public_decrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_public_decrypt", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_public_decrypt" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rsa_public_decrypt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_public_decrypt(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_public_encrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_public_encrypt", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_public_encrypt" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rsa_public_encrypt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_public_encrypt(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_private_decrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_private_decrypt", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_private_decrypt" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rsa_private_decrypt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_private_decrypt(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_padding_add_pkcs1_pss(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_padding_add_pkcs1_pss", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_padding_add_pkcs1_pss" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rsa_padding_add_pkcs1_pss" "', argument " "3"" of type '" "EVP_MD *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "rsa_padding_add_pkcs1_pss" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_padding_add_pkcs1_pss(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_verify_pkcs1_pss(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  EVP_MD *arg4 = (EVP_MD *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_verify_pkcs1_pss", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_verify_pkcs1_pss" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "rsa_verify_pkcs1_pss" "', argument " "4"" of type '" "EVP_MD *""'"); 
  }
  arg4 = (EVP_MD *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "rsa_verify_pkcs1_pss" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_verify_pkcs1_pss(arg1,arg2,arg3,arg4,arg5);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_sign", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_sign" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rsa_sign" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_sign(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_verify", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_verify" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "rsa_verify" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_verify(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_generate_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  unsigned long arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_generate_key", 3, 3, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "rsa_generate_key" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "rsa_generate_key" "', argument " "2"" of type '" "unsigned long""'");
  } 
  arg2 = (unsigned long)(val2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)rsa_generate_key(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_type_check" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_check_pub_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_check_pub_key" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)rsa_check_pub_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_rsa_write_key_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  RSA *arg1 = (RSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "rsa_write_key_der", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rsa_write_key_der" "', argument " "1"" of type '" "RSA *""'"); 
  }
  arg1 = (RSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rsa_write_key_der" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)rsa_write_key_der(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_new", 0, 0, 0)) SWIG_fail;
  result = (DSA *)DSA_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DSA, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_free" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  DSA_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_size" "', argument " "1"" of type '" "DSA const *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)DSA_size((DSA const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_gen_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_gen_key" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)DSA_generate_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__dsa_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_dsa_err""' of type '""PyObject *""'");
    }
    _dsa_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__dsa_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_dsa_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_dsa_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  dsa_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_generate_parameters(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[2] ;
  DSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_generate_parameters", 2, 2, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "dsa_generate_parameters" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (DSA *)dsa_generate_parameters(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_DSA, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_read_params(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  DSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_read_params", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_read_params" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (DSA *)dsa_read_params(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_DSA, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_read_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  DSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_read_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_read_key" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (DSA *)dsa_read_key(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_DSA, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_read_pub_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  DSA *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_read_pub_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_read_pub_key" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (DSA *)dsa_read_pub_key(arg1,arg2);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_DSA, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_get_p(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_get_p" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_get_p(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_get_q(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_get_q" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_get_q(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_get_g(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_get_g" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_get_g(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_get_pub(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_get_pub" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_get_pub(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_get_priv(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_get_priv" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_get_priv(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_set_pqg(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_set_pqg", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_set_pqg" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_set_pqg(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_set_pub(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_set_pub", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_set_pub" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_set_pub(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_write_params_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_write_params_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_write_params_bio" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dsa_write_params_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)dsa_write_params_bio(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_write_key_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  EVP_CIPHER *arg3 = (EVP_CIPHER *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_write_key_bio", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_write_key_bio" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dsa_write_key_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dsa_write_key_bio" "', argument " "3"" of type '" "EVP_CIPHER *""'"); 
  }
  arg3 = (EVP_CIPHER *)(argp3);
  {
    if (!PyCallable_Check(swig_obj[3])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_write_key_bio(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_write_key_bio_no_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_write_key_bio_no_cipher", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_write_key_bio_no_cipher" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dsa_write_key_bio_no_cipher" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_write_key_bio_no_cipher(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_write_pub_key_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_write_pub_key_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_write_pub_key_bio" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dsa_write_pub_key_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)dsa_write_pub_key_bio(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_sign", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_sign" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_sign(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_verify", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_verify" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_verify(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_sign_asn1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_sign_asn1", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_sign_asn1" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)dsa_sign_asn1(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_verify_asn1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "dsa_verify_asn1", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_verify_asn1" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_verify_asn1(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_check_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_check_key" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_check_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_check_pub_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_check_pub_key" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_check_pub_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_keylen(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_keylen" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_keylen(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_dsa_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  DSA *arg1 = (DSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_DSA, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsa_type_check" "', argument " "1"" of type '" "DSA *""'"); 
  }
  arg1 = (DSA *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)dsa_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_ciphers(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_SSL_CIPHER *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_ciphers" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (struct stack_st_SSL_CIPHER *)SSL_get_ciphers((SSL const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_SSL_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_version" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_get_version((SSL const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_get_error", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_error" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_get_error" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_get_error((SSL const *)arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_state(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_state" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_state_string((SSL const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_state_v(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_state_v" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_state_string_long((SSL const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_alert_type(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ssl_get_alert_type" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)SSL_alert_type_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_alert_type_v(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ssl_get_alert_type_v" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)SSL_alert_type_string_long(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_alert_desc(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ssl_get_alert_desc" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)SSL_alert_desc_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_alert_desc_v(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ssl_get_alert_desc_v" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)SSL_alert_desc_string_long(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sslv23_method(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sslv23_method", 0, 0, 0)) SWIG_fail;
  result = (SSL_METHOD *)SSLv23_method();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_METHOD *arg1 = (SSL_METHOD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_CTX *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_METHOD, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_new" "', argument " "1"" of type '" "SSL_METHOD *""'"); 
  }
  arg1 = (SSL_METHOD *)(argp1);
  result = (SSL_CTX *)SSL_CTX_new(arg1);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_SSL_CTX, 0);
    else {
      m2_PyErr_Msg(_ssl_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_free" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_CTX_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_verify_depth(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_verify_depth", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_verify_depth" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_verify_depth" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_CTX_set_verify_depth(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_get_verify_depth(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_get_verify_depth" "', argument " "1"" of type '" "SSL_CTX const *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_get_verify_depth((SSL_CTX const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_get_verify_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_get_verify_mode" "', argument " "1"" of type '" "SSL_CTX const *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_get_verify_mode((SSL_CTX const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_cipher_list(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_cipher_list", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_cipher_list" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_set_cipher_list" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_set_cipher_list(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_add_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  SSL_SESSION *arg2 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_add_session", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_add_session" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_add_session" "', argument " "2"" of type '" "SSL_SESSION *""'"); 
  }
  arg2 = (SSL_SESSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_add_session(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_remove_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  SSL_SESSION *arg2 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_remove_session", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_remove_session" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_remove_session" "', argument " "2"" of type '" "SSL_SESSION *""'"); 
  }
  arg2 = (SSL_SESSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_remove_session(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_session_timeout(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_session_timeout", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_session_timeout" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_session_timeout" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)SSL_CTX_set_timeout(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_get_session_timeout(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_get_session_timeout" "', argument " "1"" of type '" "SSL_CTX const *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)SSL_CTX_get_timeout((SSL_CTX const *)arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_get_cert_store(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_STORE *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_get_cert_store" "', argument " "1"" of type '" "SSL_CTX const *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_STORE *)SSL_CTX_get_cert_store((SSL_CTX const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_STORE, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_default_verify_paths(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_default_verify_paths" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_CTX_set_default_verify_paths(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_ex_data_x509_store_ctx_idx(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_get_ex_data_x509_store_ctx_idx", 0, 0, 0)) SWIG_fail;
  result = (int)SSL_get_ex_data_X509_STORE_CTX_idx();
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_new_ssl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  BIO *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_new_ssl", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_new_ssl" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "bio_new_ssl" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (BIO *)BIO_new_ssl(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BIO, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_new" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL *)SSL_new(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_free" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    SSL_free(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_dup" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL *)SSL_dup(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  BIO *arg3 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_bio", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_bio" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ssl_set_bio" "', argument " "3"" of type '" "BIO *""'"); 
  }
  arg3 = (BIO *)(argp3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_set_bio(arg1,arg2,arg3);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_accept_state(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_accept_state" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_set_accept_state(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_connect_state(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_connect_state" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_set_connect_state(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_shutdown(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_shutdown" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_get_shutdown((SSL const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_shutdown(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_shutdown", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_shutdown" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_set_shutdown" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  SSL_set_shutdown(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_shutdown(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_shutdown" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)SSL_shutdown(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_clear(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_clear" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_clear(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_do_handshake(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_do_handshake" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)SSL_do_handshake(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_renegotiate(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_renegotiate" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)SSL_renegotiate(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_pending(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_pending" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_pending((SSL const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_peer_cert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_peer_cert" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509 *)SSL_get_peer_certificate((SSL const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_current_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_CIPHER *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_current_cipher" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL_CIPHER *)SSL_get_current_cipher((SSL const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_verify_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_verify_mode" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_get_verify_mode((SSL const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_verify_depth(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_verify_depth" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_get_verify_depth((SSL const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_verify_result(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_verify_result" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)SSL_get_verify_result((SSL const *)arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_ssl_ctx(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_CTX *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_ssl_ctx" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL_CTX *)SSL_get_SSL_CTX((SSL const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_CTX, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_default_session_timeout(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_default_session_timeout" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)SSL_get_default_timeout((SSL const *)arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_cipher_list(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_cipher_list", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_cipher_list" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_cipher_list" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_set_cipher_list(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_cipher_list(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_get_cipher_list", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_cipher_list" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_get_cipher_list" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_get_cipher_list((SSL const *)arg1,arg2);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_cipher_get_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CIPHER *arg1 = (SSL_CIPHER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_cipher_get_name" "', argument " "1"" of type '" "SSL_CIPHER const *""'"); 
  }
  arg1 = (SSL_CIPHER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_CIPHER_get_name((SSL_CIPHER const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_cipher_get_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CIPHER *arg1 = (SSL_CIPHER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_cipher_get_version" "', argument " "1"" of type '" "SSL_CIPHER const *""'"); 
  }
  arg1 = (SSL_CIPHER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)SSL_CIPHER_get_version((SSL_CIPHER const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_SESSION *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_session" "', argument " "1"" of type '" "SSL const *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL_SESSION *)SSL_get_session((SSL const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get1_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_SESSION *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get1_session" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL_SESSION *)SSL_get1_session(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  SSL_SESSION *arg2 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_session", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_session" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_session" "', argument " "2"" of type '" "SSL_SESSION *""'"); 
  }
  arg2 = (SSL_SESSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)SSL_set_session(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_SESSION *arg1 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_free" "', argument " "1"" of type '" "SSL_SESSION *""'"); 
  }
  arg1 = (SSL_SESSION *)(argp1);
  SSL_SESSION_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  SSL_SESSION *arg2 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_session_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_session_print" "', argument " "2"" of type '" "SSL_SESSION const *""'"); 
  }
  arg2 = (SSL_SESSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)SSL_SESSION_print(arg1,(SSL_SESSION const *)arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_set_timeout(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_SESSION *arg1 = (SSL_SESSION *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_session_set_timeout", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_set_timeout" "', argument " "1"" of type '" "SSL_SESSION *""'"); 
  }
  arg1 = (SSL_SESSION *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_session_set_timeout" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  result = (long)SSL_SESSION_set_timeout(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_get_timeout(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_SESSION *arg1 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_get_timeout" "', argument " "1"" of type '" "SSL_SESSION const *""'"); 
  }
  arg1 = (SSL_SESSION *)(argp1);
  result = (long)SSL_SESSION_get_timeout((SSL_SESSION const *)arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_accept(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  double arg2 = (double) -1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_accept", 1, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_accept" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  if (swig_obj[1]) {
    ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_accept" "', argument " "2"" of type '" "double""'");
    } 
    arg2 = (double)(val2);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ssl_accept(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_connect(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  double arg2 = (double) -1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_connect", 1, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_connect" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  if (swig_obj[1]) {
    ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
    if (!SWIG_IsOK(ecode2)) {
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_connect" "', argument " "2"" of type '" "double""'");
    } 
    arg2 = (double)(val2);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ssl_connect(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_read(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  double arg3 = (double) -1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_read", 2, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_read" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_read" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  if (swig_obj[2]) {
    ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ssl_read" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = (double)(val3);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ssl_read(arg1,arg2,arg3);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_write(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  double arg3 = (double) -1 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_write", 2, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_write" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    arg2=swig_obj[1];
  }
  if (swig_obj[2]) {
    ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ssl_write" "', argument " "3"" of type '" "double""'");
    } 
    arg3 = (double)(val3);
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_write(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__ssl_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_ssl_err""' of type '""PyObject *""'");
    }
    _ssl_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__ssl_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_ssl_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN int Swig_var__ssl_timeout_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_ssl_timeout_err""' of type '""PyObject *""'");
    }
    _ssl_timeout_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__ssl_timeout_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_ssl_timeout_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_ssl_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_init", 2, 2, swig_obj)) SWIG_fail;
  {
    arg1=swig_obj[0];
  }
  {
    arg2=swig_obj[1];
  }
  ssl_init(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_tlsv1_method(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "tlsv1_method", 0, 0, 0)) SWIG_fail;
  result = (SSL_METHOD *)tlsv1_method();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_passphrase_callback(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_passphrase_callback", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_passphrase_callback" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_passphrase_callback(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_x509(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_x509", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_x509" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_x509" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_x509(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_cert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_cert", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_cert" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_cert" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_cert(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_cert_chain(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_cert_chain", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_cert_chain" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_cert_chain" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_cert_chain(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_privkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_privkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_privkey" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_privkey" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_privkey(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_rsa_privkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  RSA *arg2 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_rsa_privkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_rsa_privkey" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_rsa_privkey" "', argument " "2"" of type '" "RSA *""'"); 
  }
  arg2 = (RSA *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_rsa_privkey(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_use_pkey_privkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_use_pkey_privkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_use_pkey_privkey" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_use_pkey_privkey" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_use_pkey_privkey(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_check_privkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_check_privkey" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_check_privkey(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_client_CA_list_from_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_client_CA_list_from_file", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_client_CA_list_from_file" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_set_client_CA_list_from_file" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_client_CA_list_from_file(arg1,(char const *)arg2);
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_verify_default(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_verify_default", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_verify_default" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_verify_default" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_verify_default(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  int arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[3] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_verify", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_verify" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_verify" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_verify(arg1,arg2,arg3);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_session_id_context(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_session_id_context", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_session_id_context" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_set_session_id_context(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_info_callback(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_info_callback", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_info_callback" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_info_callback(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_tmp_dh(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  DH *arg2 = (DH *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_tmp_dh", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_tmp_dh" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_DH, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_set_tmp_dh" "', argument " "2"" of type '" "DH *""'"); 
  }
  arg2 = (DH *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_ctx_set_tmp_dh(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_tmp_dh_callback(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_tmp_dh_callback", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_tmp_dh_callback" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_tmp_dh_callback(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_tmp_rsa(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  RSA *arg2 = (RSA *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_tmp_rsa", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_tmp_rsa" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_RSA, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_set_tmp_rsa" "', argument " "2"" of type '" "RSA *""'"); 
  }
  arg2 = (RSA *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_ctx_set_tmp_rsa(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_tmp_rsa_callback(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_tmp_rsa_callback", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_tmp_rsa_callback" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_ctx_set_tmp_rsa_callback(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_load_verify_locations(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_load_verify_locations", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_load_verify_locations" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_ctx_load_verify_locations" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ssl_ctx_load_verify_locations" "', argument " "3"" of type '" "char const *""'");
  }
  arg3 = (char *)(buf3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_load_verify_locations(arg1,(char const *)arg2,(char const *)arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_options(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_options", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_options" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_options" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_ctx_set_options(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_bio_set_ssl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  SSL *arg2 = (SSL *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "bio_set_ssl", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bio_set_ssl" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bio_set_ssl" "', argument " "2"" of type '" "SSL *""'"); 
  }
  arg2 = (SSL *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "bio_set_ssl" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)bio_set_ssl(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_mode", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_mode" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_set_mode" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_set_mode(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_mode" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_get_mode(arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_tlsext_host_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_tlsext_host_name", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_tlsext_host_name" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_tlsext_host_name" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_set_tlsext_host_name(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_client_CA_list_from_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_client_CA_list_from_file", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_client_CA_list_from_file" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_client_CA_list_from_file" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_set_client_CA_list_from_file(arg1,(char const *)arg2);
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_client_CA_list_from_context(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  SSL_CTX *arg2 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_client_CA_list_from_context", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_client_CA_list_from_context" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_set_client_CA_list_from_context" "', argument " "2"" of type '" "SSL_CTX *""'"); 
  }
  arg2 = (SSL_CTX *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_set_client_CA_list_from_context(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_session_id_context(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_session_id_context", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_session_id_context" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_set_session_id_context(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_fd(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_fd", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_fd" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_set_fd" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_set_fd(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_set_shutdown1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_set_shutdown1", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_set_shutdown1" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_set_shutdown1" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ssl_set_shutdown1(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_read_nbio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_read_nbio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_read_nbio" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_read_nbio" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ssl_read_nbio(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_write_nbio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_write_nbio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_write_nbio" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_write_nbio(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_cipher_get_bits(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CIPHER *arg1 = (SSL_CIPHER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_cipher_get_bits" "', argument " "1"" of type '" "SSL_CIPHER *""'"); 
  }
  arg1 = (SSL_CIPHER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_cipher_get_bits(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_ssl_cipher_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_SSL_CIPHER *arg1 = (struct stack_st_SSL_CIPHER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_SSL_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_ssl_cipher_num" "', argument " "1"" of type '" "struct stack_st_SSL_CIPHER *""'"); 
  }
  arg1 = (struct stack_st_SSL_CIPHER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)sk_ssl_cipher_num(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_ssl_cipher_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_SSL_CIPHER *arg1 = (struct stack_st_SSL_CIPHER *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  SSL_CIPHER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_ssl_cipher_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_SSL_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_ssl_cipher_value" "', argument " "1"" of type '" "struct stack_st_SSL_CIPHER *""'"); 
  }
  arg1 = (struct stack_st_SSL_CIPHER *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_ssl_cipher_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (SSL_CIPHER *)sk_ssl_cipher_value(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SSL_CIPHER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_get_peer_cert_chain(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_get_peer_cert_chain" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (struct stack_st_X509 *)ssl_get_peer_cert_chain(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_num" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)sk_x509_num(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  X509 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_value" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_x509_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509 *)sk_x509_value(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_i2d_ssl_session(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  SSL_SESSION *arg2 = (SSL_SESSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "i2d_ssl_session", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "i2d_ssl_session" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "i2d_ssl_session" "', argument " "2"" of type '" "SSL_SESSION *""'"); 
  }
  arg2 = (SSL_SESSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    i2d_ssl_session(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_read_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  SSL_SESSION *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_read_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (SSL_SESSION *)ssl_session_read_pem(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_SSL_SESSION, 0);
    else {
      m2_PyErr_Msg(_ssl_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_session_write_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_SESSION *arg1 = (SSL_SESSION *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_session_write_pem", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_SESSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_session_write_pem" "', argument " "1"" of type '" "SSL_SESSION *""'"); 
  }
  arg1 = (SSL_SESSION *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ssl_session_write_pem" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)ssl_session_write_pem(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_session_cache_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_session_cache_mode", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_session_cache_mode" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_session_cache_mode" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_set_session_cache_mode(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_get_session_cache_mode(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_get_session_cache_mode" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_ctx_get_session_cache_mode(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_ctx_set_cache_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL_CTX *arg1 = (SSL_CTX *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  long result;
  
  if (!SWIG_Python_UnpackTuple(args, "ssl_ctx_set_cache_size", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_ctx_set_cache_size" "', argument " "1"" of type '" "SSL_CTX *""'"); 
  }
  arg1 = (SSL_CTX *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ssl_ctx_set_cache_size" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)ssl_ctx_set_cache_size(arg1,arg2);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ssl_is_init_finished(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  SSL *arg1 = (SSL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_SSL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ssl_is_init_finished" "', argument " "1"" of type '" "SSL *""'"); 
  }
  arg1 = (SSL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ssl_is_init_finished(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_check_ca(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_check_ca" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_check_ca(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_new", 0, 0, 0)) SWIG_fail;
  result = (X509 *)X509_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_dup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_dup" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509 *)X509_dup(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_free" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  X509_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_crl_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_CRL *arg1 = (X509_CRL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_CRL, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_crl_free" "', argument " "1"" of type '" "X509_CRL *""'"); 
  }
  arg1 = (X509_CRL *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  X509_CRL_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_crl_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_CRL *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_crl_new", 0, 0, 0)) SWIG_fail;
  result = (X509_CRL *)X509_CRL_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_CRL, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_print" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509_print(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_crl_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_CRL *arg2 = (X509_CRL *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_crl_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_crl_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_CRL, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_crl_print" "', argument " "2"" of type '" "X509_CRL *""'"); 
  }
  arg2 = (X509_CRL *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509_CRL_print(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_serial_number(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_INTEGER *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_serial_number" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_INTEGER *)X509_get_serialNumber(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_serial_number(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  ASN1_INTEGER *arg2 = (ASN1_INTEGER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_serial_number", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_serial_number" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_serial_number" "', argument " "2"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg2 = (ASN1_INTEGER *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_set_serialNumber(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  EVP_PKEY *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_pubkey" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)X509_get_pubkey(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_pubkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_pubkey" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_pubkey" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_set_pubkey(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_issuer_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_NAME *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_issuer_name" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_NAME *)X509_get_issuer_name(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_issuer_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  X509_NAME *arg2 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_issuer_name", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_issuer_name" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_issuer_name" "', argument " "2"" of type '" "X509_NAME *""'"); 
  }
  arg2 = (X509_NAME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_set_issuer_name(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_subject_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_NAME *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_subject_name" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_NAME *)X509_get_subject_name(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_subject_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  X509_NAME *arg2 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_subject_name", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_subject_name" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_subject_name" "', argument " "2"" of type '" "X509_NAME *""'"); 
  }
  arg2 = (X509_NAME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_set_subject_name(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_cmp_current_time(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_cmp_current_time" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  result = (int)X509_cmp_current_time(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_check_purpose(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_check_purpose", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_check_purpose" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_check_purpose" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_check_purpose" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_check_purpose(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_check_trust(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_check_trust", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_check_trust" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_check_trust" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_check_trust" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_check_trust(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_write_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_write_pem", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_write_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_write_pem" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)PEM_write_bio_X509(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_write_pem_file(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  FILE *arg1 = (FILE *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_write_pem_file", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_FILE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_write_pem_file" "', argument " "1"" of type '" "FILE *""'"); 
  }
  arg1 = (FILE *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_write_pem_file" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)PEM_write_X509(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_verify", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_verify" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_verify" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_verify(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_verify_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  long arg1 ;
  long val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_long(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "x509_get_verify_error" "', argument " "1"" of type '" "long""'");
  } 
  arg1 = (long)(val1);
  result = (char *)X509_verify_cert_error_string(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_add_ext(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  X509_EXTENSION *arg2 = (X509_EXTENSION *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_add_ext", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_add_ext" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_add_ext" "', argument " "2"" of type '" "X509_EXTENSION *""'"); 
  }
  arg2 = (X509_EXTENSION *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_add_ext" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_add_ext(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_ext_count(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_ext_count" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_get_ext_count(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_ext(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  X509_EXTENSION *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_get_ext", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_ext" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_get_ext" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_EXTENSION *)X509_get_ext(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_ext_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_EXTENSION *arg2 = (X509_EXTENSION *) 0 ;
  unsigned long arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  unsigned long val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_ext_print", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_ext_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_ext_print" "', argument " "2"" of type '" "X509_EXTENSION *""'"); 
  }
  arg2 = (X509_EXTENSION *)(argp2);
  ecode3 = SWIG_AsVal_unsigned_SS_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_ext_print" "', argument " "3"" of type '" "unsigned long""'");
  } 
  arg3 = (unsigned long)(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "x509_ext_print" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509V3_EXT_print(arg1,arg2,arg3,arg4);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_new", 0, 0, 0)) SWIG_fail;
  result = (X509_NAME *)X509_NAME_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_free" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  X509_NAME_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_NAME *arg2 = (X509_NAME *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_print", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_print" "', argument " "2"" of type '" "X509_NAME *""'"); 
  }
  arg2 = (X509_NAME *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_print" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509_NAME_print(arg1,arg2,arg3);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_get_entry(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  X509_NAME_ENTRY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_get_entry", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_get_entry" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_get_entry" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_NAME_ENTRY *)X509_NAME_get_entry(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_count(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_count" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_entry_count(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_delete_entry(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  X509_NAME_ENTRY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_delete_entry", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_delete_entry" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_delete_entry" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_NAME_ENTRY *)X509_NAME_delete_entry(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_add_entry(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  X509_NAME_ENTRY *arg2 = (X509_NAME_ENTRY *) 0 ;
  int arg3 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_add_entry", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_add_entry" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_add_entry" "', argument " "2"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg2 = (X509_NAME_ENTRY *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_add_entry" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "x509_name_add_entry" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_add_entry(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_add_entry_by_obj(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  ASN1_OBJECT *arg2 = (ASN1_OBJECT *) 0 ;
  int arg3 ;
  unsigned char *arg4 = (unsigned char *) 0 ;
  int arg5 ;
  int arg6 ;
  int arg7 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject *swig_obj[7] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_add_entry_by_obj", 7, 7, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_add_entry_by_obj" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_add_entry_by_obj" "', argument " "2"" of type '" "ASN1_OBJECT *""'"); 
  }
  arg2 = (ASN1_OBJECT *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_add_entry_by_obj" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509_name_add_entry_by_obj" "', argument " "4"" of type '" "unsigned char *""'"); 
  }
  arg4 = (unsigned char *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "x509_name_add_entry_by_obj" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  ecode6 = SWIG_AsVal_int(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "x509_name_add_entry_by_obj" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = (int)(val6);
  ecode7 = SWIG_AsVal_int(swig_obj[6], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "x509_name_add_entry_by_obj" "', argument " "7"" of type '" "int""'");
  } 
  arg7 = (int)(val7);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_add_entry_by_OBJ(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_add_entry_by_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  int arg3 ;
  unsigned char *arg4 = (unsigned char *) 0 ;
  int arg5 ;
  int arg6 ;
  int arg7 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject *swig_obj[7] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_add_entry_by_nid", 7, 7, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_add_entry_by_nid" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_add_entry_by_nid" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_add_entry_by_nid" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509_name_add_entry_by_nid" "', argument " "4"" of type '" "unsigned char *""'"); 
  }
  arg4 = (unsigned char *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "x509_name_add_entry_by_nid" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  ecode6 = SWIG_AsVal_int(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "x509_name_add_entry_by_nid" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = (int)(val6);
  ecode7 = SWIG_AsVal_int(swig_obj[6], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "x509_name_add_entry_by_nid" "', argument " "7"" of type '" "int""'");
  } 
  arg7 = (int)(val7);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_add_entry_by_NID(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_print_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_NAME *arg2 = (X509_NAME *) 0 ;
  int arg3 ;
  unsigned long arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  unsigned long val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_print_ex", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_print_ex" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_print_ex" "', argument " "2"" of type '" "X509_NAME *""'"); 
  }
  arg2 = (X509_NAME *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_print_ex" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  ecode4 = SWIG_AsVal_unsigned_SS_long(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "x509_name_print_ex" "', argument " "4"" of type '" "unsigned long""'");
  } 
  arg4 = (unsigned long)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509_NAME_print_ex(arg1,arg2,arg3,arg4);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_hash(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  unsigned long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_hash" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (unsigned long)X509_NAME_hash_old(arg1);
  resultobj = SWIG_From_unsigned_SS_long((unsigned long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_get_index_by_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_get_index_by_nid", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_get_index_by_nid" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_get_index_by_nid" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_get_index_by_nid" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_get_index_by_NID(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_entry_new", 0, 0, 0)) SWIG_fail;
  result = (X509_NAME_ENTRY *)X509_NAME_ENTRY_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *arg1 = (X509_NAME_ENTRY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_free" "', argument " "1"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg1 = (X509_NAME_ENTRY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  X509_NAME_ENTRY_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_create_by_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY **arg1 = (X509_NAME_ENTRY **) 0 ;
  int arg2 ;
  int arg3 ;
  unsigned char *arg4 = (unsigned char *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  X509_NAME_ENTRY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_entry_create_by_nid", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_create_by_nid" "', argument " "1"" of type '" "X509_NAME_ENTRY **""'"); 
  }
  arg1 = (X509_NAME_ENTRY **)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_entry_create_by_nid" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_entry_create_by_nid" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509_name_entry_create_by_nid" "', argument " "4"" of type '" "unsigned char *""'"); 
  }
  arg4 = (unsigned char *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "x509_name_entry_create_by_nid" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  result = (X509_NAME_ENTRY *)X509_NAME_ENTRY_create_by_NID(arg1,arg2,arg3,arg4,arg5);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_set_object(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *arg1 = (X509_NAME_ENTRY *) 0 ;
  ASN1_OBJECT *arg2 = (ASN1_OBJECT *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_entry_set_object", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_set_object" "', argument " "1"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg1 = (X509_NAME_ENTRY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_entry_set_object" "', argument " "2"" of type '" "ASN1_OBJECT *""'"); 
  }
  arg2 = (ASN1_OBJECT *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_ENTRY_set_object(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_get_object(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *arg1 = (X509_NAME_ENTRY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_OBJECT *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_get_object" "', argument " "1"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg1 = (X509_NAME_ENTRY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_OBJECT *)X509_NAME_ENTRY_get_object(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_get_data(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *arg1 = (X509_NAME_ENTRY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_STRING *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_get_data" "', argument " "1"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg1 = (X509_NAME_ENTRY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_STRING *)X509_NAME_ENTRY_get_data(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_set_data(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY *arg1 = (X509_NAME_ENTRY *) 0 ;
  int arg2 ;
  unsigned char *arg3 = (unsigned char *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_entry_set_data", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_set_data" "', argument " "1"" of type '" "X509_NAME_ENTRY *""'"); 
  }
  arg1 = (X509_NAME_ENTRY *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_entry_set_data" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (PyString_Check(swig_obj[2])) {
      Py_ssize_t len;
      
      arg3 = (unsigned char *)PyString_AsString(swig_obj[2]);
      len = PyString_Size(swig_obj[2]);
      
      
      if (len > INT_MAX) {
        PyErr_SetString(_x509_err, "object too large");
        return NULL;
      }
      arg4 = len;
    } else {
      PyErr_SetString(PyExc_TypeError, "expected string");
      return NULL;
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_NAME_ENTRY_set_data(arg1,arg2,(unsigned char const *)arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_new", 0, 0, 0)) SWIG_fail;
  result = (X509_REQ *)X509_REQ_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_REQ, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_free" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  X509_REQ_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_REQ *arg2 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_print" "', argument " "2"" of type '" "X509_REQ *""'"); 
  }
  arg2 = (X509_REQ *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)X509_REQ_print(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_get_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  EVP_PKEY *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_get_pubkey" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)X509_REQ_get_pubkey(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_set_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_set_pubkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_set_pubkey" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_set_pubkey" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_REQ_set_pubkey(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_set_subject_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  X509_NAME *arg2 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_set_subject_name", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_set_subject_name" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_set_subject_name" "', argument " "2"" of type '" "X509_NAME *""'"); 
  }
  arg2 = (X509_NAME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_REQ_set_subject_name(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_verify", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_verify" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_verify" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_REQ_verify(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_sign", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_sign" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_sign" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "x509_req_sign" "', argument " "3"" of type '" "EVP_MD const *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_REQ_sign(arg1,arg2,(EVP_MD const *)arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_i2d_x509_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "i2d_x509_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "i2d_x509_bio" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "i2d_x509_bio" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)i2d_X509_bio(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_i2d_x509_req_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_REQ *arg2 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "i2d_x509_req_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "i2d_x509_req_bio" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "i2d_x509_req_bio" "', argument " "2"" of type '" "X509_REQ *""'"); 
  }
  arg2 = (X509_REQ *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)i2d_X509_REQ_bio(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_store_new", 0, 0, 0)) SWIG_fail;
  result = (X509_STORE *)X509_STORE_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_STORE, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_free" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  X509_STORE_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_add_cert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_store_add_cert", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_add_cert" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_store_add_cert" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)X509_STORE_add_cert(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_set_verify_cb__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  int (*arg2)(int,X509_STORE_CTX *) = (int (*)(int,X509_STORE_CTX *)) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_set_verify_cb" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  {
    int res = SWIG_ConvertFunctionPtr(swig_obj[1], (void**)(&arg2), SWIGTYPE_p_f_int_p_X509_STORE_CTX__int);
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in method '" "x509_store_set_verify_cb" "', argument " "2"" of type '" "int (*)(int,X509_STORE_CTX *)""'"); 
    }
  }
  X509_STORE_set_verify_cb(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get_current_cert(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get_current_cert" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  result = (X509 *)X509_STORE_CTX_get_current_cert(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get_error" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  result = (int)X509_STORE_CTX_get_error(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get_error_depth(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get_error_depth" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  result = (int)X509_STORE_CTX_get_error_depth(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_free" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  X509_STORE_CTX_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get1_chain(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get1_chain" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  result = (struct stack_st_X509 *)X509_STORE_CTX_get1_chain(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_extension_get_critical(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_EXTENSION *arg1 = (X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_extension_get_critical" "', argument " "1"" of type '" "X509_EXTENSION *""'"); 
  }
  arg1 = (X509_EXTENSION *)(argp1);
  result = (int)X509_EXTENSION_get_critical(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_extension_set_critical(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_EXTENSION *arg1 = (X509_EXTENSION *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_extension_set_critical", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_extension_set_critical" "', argument " "1"" of type '" "X509_EXTENSION *""'"); 
  }
  arg1 = (X509_EXTENSION *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_extension_set_critical" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (int)X509_EXTENSION_set_critical(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_set_flags(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  unsigned long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_store_set_flags", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_set_flags" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_store_set_flags" "', argument " "2"" of type '" "unsigned long""'");
  } 
  arg2 = (unsigned long)(val2);
  result = (int)X509_STORE_set_flags(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_read_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_read_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (X509 *)x509_read_pem(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_d2i_x509(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "d2i_x509" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (X509 *)d2i_x509(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__x509_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_x509_err""' of type '""PyObject *""'");
    }
    _x509_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__x509_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_x509_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_x509_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  x509_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_d2i_x509_req(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_REQ *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "d2i_x509_req" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (X509_REQ *)d2i_x509_req(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509_REQ, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_read_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_REQ *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_read_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (X509_REQ *)x509_req_read_pem(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509_REQ, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_i2d_x509(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "i2d_x509" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)i2d_x509(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_write_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  X509_REQ *arg2 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_write_pem", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_write_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_write_pem" "', argument " "2"" of type '" "X509_REQ *""'"); 
  }
  arg2 = (X509_REQ *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)x509_req_write_pem(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_crl_read_pem(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_CRL *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_crl_read_pem" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (X509_CRL *)x509_crl_read_pem(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509_CRL, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_version", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_version" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_set_version" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_set_version(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_version" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)x509_get_version(arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_not_before(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  ASN1_TIME *arg2 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_not_before", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_not_before" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_not_before" "', argument " "2"" of type '" "ASN1_TIME *""'"); 
  }
  arg2 = (ASN1_TIME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_set_not_before(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_not_before(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_TIME *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_not_before" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_TIME *)x509_get_not_before(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_set_not_after(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  ASN1_TIME *arg2 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_set_not_after", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_set_not_after" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_set_not_after" "', argument " "2"" of type '" "ASN1_TIME *""'"); 
  }
  arg2 = (ASN1_TIME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_set_not_after(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_get_not_after(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_TIME *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_get_not_after" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_TIME *)x509_get_not_after(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  EVP_MD *arg3 = (EVP_MD *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_sign", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_sign" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_sign" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "x509_sign" "', argument " "3"" of type '" "EVP_MD *""'"); 
  }
  arg3 = (EVP_MD *)(argp3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_sign(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_gmtime_adj(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  ASN1_TIME *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_gmtime_adj", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_gmtime_adj" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_gmtime_adj" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  result = (ASN1_TIME *)x509_gmtime_adj(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_by_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_by_nid", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_by_nid" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_by_nid" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)x509_name_by_nid(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_set_by_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  int arg2 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_set_by_nid", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_set_by_nid" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_name_set_by_nid" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_name_set_by_nid(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_add_entry_by_txt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  char *arg4 = (char *) 0 ;
  int arg5 ;
  int arg6 ;
  int arg7 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  int val7 ;
  int ecode7 = 0 ;
  PyObject *swig_obj[7] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_add_entry_by_txt", 7, 7, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_add_entry_by_txt" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_add_entry_by_txt" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_add_entry_by_txt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509_name_add_entry_by_txt" "', argument " "4"" of type '" "char *""'");
  }
  arg4 = (char *)(buf4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "x509_name_add_entry_by_txt" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  ecode6 = SWIG_AsVal_int(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "x509_name_add_entry_by_txt" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = (int)(val6);
  ecode7 = SWIG_AsVal_int(swig_obj[6], &val7);
  if (!SWIG_IsOK(ecode7)) {
    SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "x509_name_add_entry_by_txt" "', argument " "7"" of type '" "int""'");
  } 
  arg7 = (int)(val7);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_name_add_entry_by_txt(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_get_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_get_der" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)x509_name_get_der(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_free" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  sk_x509_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_push" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_x509_push" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)sk_x509_push(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_pop" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509 *)sk_x509_pop(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_load_locations(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_store_load_locations", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_load_locations" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_store_load_locations" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  result = (int)x509_store_load_locations(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_type_check" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_type_check" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_name_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_get_subject_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_NAME *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_get_subject_name" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509_NAME *)x509_req_get_subject_name(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_get_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  long result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_get_version" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (long)x509_req_get_version(arg1);
  resultobj = SWIG_From_long((long)(result));
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_set_version(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_set_version", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_set_version" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_req_set_version" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_req_set_version(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_req_add_extensions(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_REQ *arg1 = (X509_REQ *) 0 ;
  struct stack_st_X509_EXTENSION *arg2 = (struct stack_st_X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_req_add_extensions", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_REQ, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_req_add_extensions" "', argument " "1"" of type '" "X509_REQ *""'"); 
  }
  arg1 = (X509_REQ *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_req_add_extensions" "', argument " "2"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg2 = (struct stack_st_X509_EXTENSION *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)x509_req_add_extensions(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_entry_create_by_txt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME_ENTRY **arg1 = (X509_NAME_ENTRY **) 0 ;
  char *arg2 = (char *) 0 ;
  int arg3 ;
  char *arg4 = (char *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  X509_NAME_ENTRY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_name_entry_create_by_txt", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_p_X509_NAME_ENTRY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_entry_create_by_txt" "', argument " "1"" of type '" "X509_NAME_ENTRY **""'"); 
  }
  arg1 = (X509_NAME_ENTRY **)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509_name_entry_create_by_txt" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "x509_name_entry_create_by_txt" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509_name_entry_create_by_txt" "', argument " "4"" of type '" "char *""'");
  }
  arg4 = (char *)(buf4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "x509_name_entry_create_by_txt" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  result = (X509_NAME_ENTRY *)x509_name_entry_create_by_txt(arg1,arg2,arg3,arg4,arg5);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_NAME_ENTRY, 0 |  0 );
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509v3_set_nconf(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509V3_CTX *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509v3_set_nconf", 0, 0, 0)) SWIG_fail;
  result = (X509V3_CTX *)x509v3_set_nconf();
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509V3_CTX, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509v3_ext_conf(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  void *arg1 = (void *) 0 ;
  X509V3_CTX *arg2 = (X509V3_CTX *) 0 ;
  char *arg3 = (char *) 0 ;
  char *arg4 = (char *) 0 ;
  int res1 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  PyObject *swig_obj[4] ;
  X509_EXTENSION *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509v3_ext_conf", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0],SWIG_as_voidptrptr(&arg1), 0, 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509v3_ext_conf" "', argument " "1"" of type '" "void *""'"); 
  }
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509V3_CTX, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "x509v3_ext_conf" "', argument " "2"" of type '" "X509V3_CTX *""'"); 
  }
  arg2 = (X509V3_CTX *)(argp2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "x509v3_ext_conf" "', argument " "3"" of type '" "char *""'");
  }
  arg3 = (char *)(buf3);
  res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "x509v3_ext_conf" "', argument " "4"" of type '" "char *""'");
  }
  arg4 = (char *)(buf4);
  result = (X509_EXTENSION *)x509v3_ext_conf(arg1,arg2,arg3,arg4);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_X509_EXTENSION, 0);
    else {
      m2_PyErr_Msg(_x509_err);
      resultobj = NULL;
    }
  }
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return resultobj;
fail:
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_extension_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_EXTENSION *arg1 = (X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_extension_free" "', argument " "1"" of type '" "X509_EXTENSION *""'"); 
  }
  arg1 = (X509_EXTENSION *)(argp1);
  x509_extension_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_extension_get_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_EXTENSION *arg1 = (X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_extension_get_name" "', argument " "1"" of type '" "X509_EXTENSION *""'"); 
  }
  arg1 = (X509_EXTENSION *)(argp1);
  result = (PyObject *)x509_extension_get_name(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_extension_new_null", 0, 0, 0)) SWIG_fail;
  result = (struct stack_st_X509_EXTENSION *)sk_x509_extension_new_null();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *arg1 = (struct stack_st_X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_extension_free" "', argument " "1"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg1 = (struct stack_st_X509_EXTENSION *)(argp1);
  sk_x509_extension_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_push(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *arg1 = (struct stack_st_X509_EXTENSION *) 0 ;
  X509_EXTENSION *arg2 = (X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_extension_push", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_extension_push" "', argument " "1"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg1 = (struct stack_st_X509_EXTENSION *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sk_x509_extension_push" "', argument " "2"" of type '" "X509_EXTENSION *""'"); 
  }
  arg2 = (X509_EXTENSION *)(argp2);
  result = (int)sk_x509_extension_push(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_pop(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *arg1 = (struct stack_st_X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  X509_EXTENSION *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_extension_pop" "', argument " "1"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg1 = (struct stack_st_X509_EXTENSION *)(argp1);
  result = (X509_EXTENSION *)sk_x509_extension_pop(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_num(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *arg1 = (struct stack_st_X509_EXTENSION *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_extension_num" "', argument " "1"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg1 = (struct stack_st_X509_EXTENSION *)(argp1);
  result = (int)sk_x509_extension_num(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_extension_value(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509_EXTENSION *arg1 = (struct stack_st_X509_EXTENSION *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  X509_EXTENSION *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_extension_value", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509_EXTENSION, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sk_x509_extension_value" "', argument " "1"" of type '" "struct stack_st_X509_EXTENSION *""'"); 
  }
  arg1 = (struct stack_st_X509_EXTENSION *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "sk_x509_extension_value" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (X509_EXTENSION *)sk_x509_extension_value(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509_EXTENSION, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get_app_data(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get_app_data" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  result = (void *)x509_store_ctx_get_app_data(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_ctx_get_ex_data(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_STORE_CTX *arg1 = (X509_STORE_CTX *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  void *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "x509_store_ctx_get_ex_data", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE_CTX, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_ctx_get_ex_data" "', argument " "1"" of type '" "X509_STORE_CTX *""'"); 
  }
  arg1 = (X509_STORE_CTX *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "x509_store_ctx_get_ex_data" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  result = (void *)x509_store_ctx_get_ex_data(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_set_verify_cb__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
  PyObject *resultobj = 0;
  X509_STORE *arg1 = (X509_STORE *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_store_set_verify_cb" "', argument " "1"" of type '" "X509_STORE *""'"); 
  }
  arg1 = (X509_STORE *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  x509_store_set_verify_cb(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_store_set_verify_cb(PyObject *self, PyObject *args) {
  Py_ssize_t argc;
  PyObject *argv[3] = {
    0
  };
  
  if (!(argc = SWIG_Python_UnpackTuple(args, "x509_store_set_verify_cb", 0, 2, argv))) SWIG_fail;
  --argc;
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509_STORE, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      void *ptr = 0;
      int res = SWIG_ConvertFunctionPtr(argv[1], &ptr, SWIGTYPE_p_f_int_p_X509_STORE_CTX__int);
      _v = SWIG_CheckState(res);
      if (_v) {
        return _wrap_x509_store_set_verify_cb__SWIG_0(self, argc, argv);
      }
    }
  }
  if (argc == 2) {
    int _v;
    void *vptr = 0;
    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509_STORE, 0);
    _v = SWIG_CheckState(res);
    if (_v) {
      _v = (argv[1] != 0);
      if (_v) {
        return _wrap_x509_store_set_verify_cb__SWIG_1(self, argc, argv);
      }
    }
  }
  
fail:
  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'x509_store_set_verify_cb'.\n"
    "  Possible C/C++ prototypes are:\n"
    "    X509_STORE_set_verify_cb(X509_STORE *,int (*)(int,X509_STORE_CTX *))\n"
    "    x509_store_set_verify_cb(X509_STORE *,PyObject *)\n");
  return 0;
}


SWIGINTERN PyObject *_wrap_make_stack_from_der_sequence(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  struct stack_st_X509 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (struct stack_st_X509 *)make_stack_from_der_sequence(arg1);
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_stack_st_X509, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_sk_x509_new_null(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "sk_x509_new_null", 0, 0, 0)) SWIG_fail;
  result = (struct stack_st_X509 *)sk_x509_new_null();
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_stack_st_X509, 0);
    else {
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_get_der_encoding_stack(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "get_der_encoding_stack" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)get_der_encoding_stack(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_x509_name_oneline(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509_NAME *arg1 = (X509_NAME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509_NAME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "x509_name_oneline" "', argument " "1"" of type '" "X509_NAME *""'"); 
  }
  arg1 = (X509_NAME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)x509_name_oneline(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  {
    if (result != NULL)
    OPENSSL_free(result);
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_object_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_object_new", 0, 0, 0)) SWIG_fail;
  result = (ASN1_OBJECT *)ASN1_OBJECT_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_object_create(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  unsigned char *arg2 = (unsigned char *) 0 ;
  int arg3 ;
  char *arg4 = (char *) 0 ;
  char *arg5 = (char *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  int res4 ;
  char *buf4 = 0 ;
  int alloc4 = 0 ;
  int res5 ;
  char *buf5 = 0 ;
  int alloc5 = 0 ;
  PyObject *swig_obj[5] ;
  ASN1_OBJECT *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_object_create", 5, 5, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "asn1_object_create" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_object_create" "', argument " "2"" of type '" "unsigned char *""'"); 
  }
  arg2 = (unsigned char *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "asn1_object_create" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "asn1_object_create" "', argument " "4"" of type '" "char const *""'");
  }
  arg4 = (char *)(buf4);
  res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5);
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "asn1_object_create" "', argument " "5"" of type '" "char const *""'");
  }
  arg5 = (char *)(buf5);
  result = (ASN1_OBJECT *)ASN1_OBJECT_create(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  if (alloc5 == SWIG_NEWOBJ) free((char*)buf5);
  return resultobj;
fail:
  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
  if (alloc5 == SWIG_NEWOBJ) free((char*)buf5);
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_object_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT *arg1 = (ASN1_OBJECT *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_object_free" "', argument " "1"" of type '" "ASN1_OBJECT *""'"); 
  }
  arg1 = (ASN1_OBJECT *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ASN1_OBJECT_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_i2d_asn1_object(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT *arg1 = (ASN1_OBJECT *) 0 ;
  unsigned char **arg2 = (unsigned char **) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "i2d_asn1_object", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "i2d_asn1_object" "', argument " "1"" of type '" "ASN1_OBJECT *""'"); 
  }
  arg1 = (ASN1_OBJECT *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "i2d_asn1_object" "', argument " "2"" of type '" "unsigned char **""'"); 
  }
  arg2 = (unsigned char **)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)i2d_ASN1_OBJECT(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_d2i_asn1_object(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT **arg1 = (ASN1_OBJECT **) 0 ;
  unsigned char **arg2 = (unsigned char **) 0 ;
  long arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  long val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  ASN1_OBJECT *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "d2i_asn1_object", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "d2i_asn1_object" "', argument " "1"" of type '" "ASN1_OBJECT **""'"); 
  }
  arg1 = (ASN1_OBJECT **)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_unsigned_char, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "d2i_asn1_object" "', argument " "2"" of type '" "unsigned char const **""'"); 
  }
  arg2 = (unsigned char **)(argp2);
  ecode3 = SWIG_AsVal_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "d2i_asn1_object" "', argument " "3"" of type '" "long""'");
  } 
  arg3 = (long)(val3);
  result = (ASN1_OBJECT *)d2i_ASN1_OBJECT(arg1,(unsigned char const **)arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_bit_string_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_BIT_STRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_bit_string_new", 0, 0, 0)) SWIG_fail;
  result = (ASN1_BIT_STRING *)ASN1_BIT_STRING_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_BIT_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_string_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_STRING *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_string_new", 0, 0, 0)) SWIG_fail;
  result = (ASN1_STRING *)ASN1_STRING_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_string_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_STRING *arg1 = (ASN1_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_string_free" "', argument " "1"" of type '" "ASN1_STRING *""'"); 
  }
  arg1 = (ASN1_STRING *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ASN1_STRING_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_string_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_STRING *arg1 = (ASN1_STRING *) 0 ;
  void *arg2 = (void *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_string_set", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_string_set" "', argument " "1"" of type '" "ASN1_STRING *""'"); 
  }
  arg1 = (ASN1_STRING *)(argp1);
  {
    if (PyBytes_Check(swig_obj[1])) {
      Py_ssize_t len;
      
      arg2 = PyBytes_AsString(swig_obj[1]);
      len = PyBytes_Size(swig_obj[1]);
      
      if (len > INT_MAX) {
        PyErr_SetString(PyExc_ValueError, "object too large");
        return NULL;
      }
      arg3 = len;
    }
    else {
      PyErr_SetString(PyExc_TypeError, "expected string");
      return NULL;
    }
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ASN1_STRING_set(arg1,(void const *)arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_string_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  ASN1_STRING *arg2 = (ASN1_STRING *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_string_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_string_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_string_print" "', argument " "2"" of type '" "ASN1_STRING *""'"); 
  }
  arg2 = (ASN1_STRING *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)ASN1_STRING_print(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_string_print_ex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  ASN1_STRING *arg2 = (ASN1_STRING *) 0 ;
  unsigned long arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  unsigned long val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_string_print_ex", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_string_print_ex" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_STRING, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_string_print_ex" "', argument " "2"" of type '" "ASN1_STRING *""'"); 
  }
  arg2 = (ASN1_STRING *)(argp2);
  ecode3 = SWIG_AsVal_unsigned_SS_long(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "asn1_string_print_ex" "', argument " "3"" of type '" "unsigned long""'");
  } 
  arg3 = (unsigned long)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)ASN1_STRING_print_ex(arg1,arg2,arg3);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_time_new", 0, 0, 0)) SWIG_fail;
  result = (ASN1_TIME *)ASN1_TIME_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_free" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ASN1_TIME_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_check" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ASN1_TIME_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  long arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  long val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  ASN1_TIME *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_time_set", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_set" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  ecode2 = SWIG_AsVal_long(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "asn1_time_set" "', argument " "2"" of type '" "long""'");
  } 
  arg2 = (long)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_TIME *)ASN1_TIME_set(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_set_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_time_set_string", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_set_string" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_time_set_string" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ASN1_TIME_set_string(arg1,(char const *)arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_print(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  ASN1_TIME *arg2 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_time_print", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_print" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_time_print" "', argument " "2"" of type '" "ASN1_TIME *""'"); 
  }
  arg2 = (ASN1_TIME *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)ASN1_TIME_print(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_integer_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_INTEGER *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_integer_new", 0, 0, 0)) SWIG_fail;
  result = (ASN1_INTEGER *)ASN1_INTEGER_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_integer_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_INTEGER *arg1 = (ASN1_INTEGER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_integer_free" "', argument " "1"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg1 = (ASN1_INTEGER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  ASN1_INTEGER_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_integer_cmp(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_INTEGER *arg1 = (ASN1_INTEGER *) 0 ;
  ASN1_INTEGER *arg2 = (ASN1_INTEGER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_integer_cmp", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_integer_cmp" "', argument " "1"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg1 = (ASN1_INTEGER *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "asn1_integer_cmp" "', argument " "2"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg2 = (ASN1_INTEGER *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ASN1_INTEGER_cmp(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_time_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_TIME *arg1 = (ASN1_TIME *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_TIME, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_time_type_check" "', argument " "1"" of type '" "ASN1_TIME *""'"); 
  }
  arg1 = (ASN1_TIME *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)asn1_time_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_integer_get(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_INTEGER *arg1 = (ASN1_INTEGER *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_integer_get" "', argument " "1"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg1 = (ASN1_INTEGER *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)asn1_integer_get(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_asn1_integer_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_INTEGER *arg1 = (ASN1_INTEGER *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "asn1_integer_set", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_INTEGER, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "asn1_integer_set" "', argument " "1"" of type '" "ASN1_INTEGER *""'"); 
  }
  arg1 = (ASN1_INTEGER *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)asn1_integer_set(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_new", 0, 0, 0)) SWIG_fail;
  result = (PKCS7 *)PKCS7_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PKCS7, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_free" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  PKCS7_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_add_certificate(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  X509 *arg2 = (X509 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_add_certificate", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_add_certificate" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_add_certificate" "', argument " "2"" of type '" "X509 *""'"); 
  }
  arg2 = (X509 *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  PKCS7_add_certificate(arg1,arg2);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__pkcs7_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_pkcs7_err""' of type '""PyObject *""'");
    }
    _pkcs7_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__pkcs7_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_pkcs7_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN int Swig_var__smime_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_smime_err""' of type '""PyObject *""'");
    }
    _smime_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__smime_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_smime_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_pkcs7_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  pkcs7_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smime_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  smime_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_decrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  X509 *arg3 = (X509 *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_decrypt", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_decrypt" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_decrypt" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_decrypt" "', argument " "3"" of type '" "X509 *""'"); 
  }
  arg3 = (X509 *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pkcs7_decrypt" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)pkcs7_decrypt(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_encrypt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  struct stack_st_X509 *arg1 = (struct stack_st_X509 *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  EVP_CIPHER *arg3 = (EVP_CIPHER *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PKCS7 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_encrypt", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_encrypt" "', argument " "1"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg1 = (struct stack_st_X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_encrypt" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_encrypt" "', argument " "3"" of type '" "EVP_CIPHER *""'"); 
  }
  arg3 = (EVP_CIPHER *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pkcs7_encrypt" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (PKCS7 *)pkcs7_encrypt(arg1,arg2,arg3,arg4);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_PKCS7, 0);
    else {
      m2_PyErr_Msg(_smime_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_sign1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  struct stack_st_X509 *arg3 = (struct stack_st_X509 *) 0 ;
  BIO *arg4 = (BIO *) 0 ;
  EVP_MD *arg5 = (EVP_MD *) 0 ;
  int arg6 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  void *argp5 = 0 ;
  int res5 = 0 ;
  int val6 ;
  int ecode6 = 0 ;
  PyObject *swig_obj[6] ;
  PKCS7 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_sign1", 6, 6, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_sign1" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_sign1" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_sign1" "', argument " "3"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg3 = (struct stack_st_X509 *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "pkcs7_sign1" "', argument " "4"" of type '" "BIO *""'"); 
  }
  arg4 = (BIO *)(argp4);
  res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res5)) {
    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "pkcs7_sign1" "', argument " "5"" of type '" "EVP_MD *""'"); 
  }
  arg5 = (EVP_MD *)(argp5);
  ecode6 = SWIG_AsVal_int(swig_obj[5], &val6);
  if (!SWIG_IsOK(ecode6)) {
    SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "pkcs7_sign1" "', argument " "6"" of type '" "int""'");
  } 
  arg6 = (int)(val6);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg5) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (PKCS7 *)pkcs7_sign1(arg1,arg2,arg3,arg4,arg5,arg6);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_PKCS7, 0);
    else {
      m2_PyErr_Msg(_smime_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_sign0(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  X509 *arg1 = (X509 *) 0 ;
  EVP_PKEY *arg2 = (EVP_PKEY *) 0 ;
  BIO *arg3 = (BIO *) 0 ;
  EVP_MD *arg4 = (EVP_MD *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  PKCS7 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_sign0", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_X509, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_sign0" "', argument " "1"" of type '" "X509 *""'"); 
  }
  arg1 = (X509 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_sign0" "', argument " "2"" of type '" "EVP_PKEY *""'"); 
  }
  arg2 = (EVP_PKEY *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_sign0" "', argument " "3"" of type '" "BIO *""'"); 
  }
  arg3 = (BIO *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_EVP_MD, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "pkcs7_sign0" "', argument " "4"" of type '" "EVP_MD *""'"); 
  }
  arg4 = (EVP_MD *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pkcs7_sign0" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (PKCS7 *)pkcs7_sign0(arg1,arg2,arg3,arg4,arg5);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_PKCS7, 0);
    else {
      m2_PyErr_Msg(_smime_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_read_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PKCS7 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_read_bio" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (PKCS7 *)pkcs7_read_bio(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_PKCS7, 0);
    else {
      m2_PyErr_Msg(_pkcs7_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_read_bio_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PKCS7 *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_read_bio_der" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (PKCS7 *)pkcs7_read_bio_der(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */
    
    if (result != NULL)
    resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_PKCS7, 0);
    else {
      m2_PyErr_Msg(_pkcs7_err);
      resultobj = NULL;
    }
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_verify1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  struct stack_st_X509 *arg2 = (struct stack_st_X509 *) 0 ;
  X509_STORE *arg3 = (X509_STORE *) 0 ;
  BIO *arg4 = (BIO *) 0 ;
  int arg5 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  void *argp4 = 0 ;
  int res4 = 0 ;
  int val5 ;
  int ecode5 = 0 ;
  PyObject *swig_obj[5] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_verify1", 5, 5, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_verify1" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_verify1" "', argument " "2"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg2 = (struct stack_st_X509 *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_verify1" "', argument " "3"" of type '" "X509_STORE *""'"); 
  }
  arg3 = (X509_STORE *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "pkcs7_verify1" "', argument " "4"" of type '" "BIO *""'"); 
  }
  arg4 = (BIO *)(argp4);
  ecode5 = SWIG_AsVal_int(swig_obj[4], &val5);
  if (!SWIG_IsOK(ecode5)) {
    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pkcs7_verify1" "', argument " "5"" of type '" "int""'");
  } 
  arg5 = (int)(val5);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)pkcs7_verify1(arg1,arg2,arg3,arg4,arg5);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_verify0(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  struct stack_st_X509 *arg2 = (struct stack_st_X509 *) 0 ;
  X509_STORE *arg3 = (X509_STORE *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_verify0", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_verify0" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_verify0" "', argument " "2"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg2 = (struct stack_st_X509 *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_X509_STORE, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pkcs7_verify0" "', argument " "3"" of type '" "X509_STORE *""'"); 
  }
  arg3 = (X509_STORE *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pkcs7_verify0" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)pkcs7_verify0(arg1,arg2,arg3,arg4);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smime_write_pkcs7_multi(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PKCS7 *arg2 = (PKCS7 *) 0 ;
  BIO *arg3 = (BIO *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "smime_write_pkcs7_multi", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smime_write_pkcs7_multi" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smime_write_pkcs7_multi" "', argument " "2"" of type '" "PKCS7 *""'"); 
  }
  arg2 = (PKCS7 *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "smime_write_pkcs7_multi" "', argument " "3"" of type '" "BIO *""'"); 
  }
  arg3 = (BIO *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "smime_write_pkcs7_multi" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)smime_write_pkcs7_multi(arg1,arg2,arg3,arg4);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smime_write_pkcs7(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PKCS7 *arg2 = (PKCS7 *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "smime_write_pkcs7", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smime_write_pkcs7" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smime_write_pkcs7" "', argument " "2"" of type '" "PKCS7 *""'"); 
  }
  arg2 = (PKCS7 *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "smime_write_pkcs7" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)smime_write_pkcs7(arg1,arg2,arg3);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smime_read_pkcs7(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smime_read_pkcs7" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)smime_read_pkcs7(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_write_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_write_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_write_bio" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_write_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)pkcs7_write_bio(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_write_bio_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_write_bio_der", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_write_bio_der" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_write_bio_der" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)pkcs7_write_bio_der(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_type_nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_type_nid" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)pkcs7_type_nid(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_type_sn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_type_sn" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)pkcs7_type_sn(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_smime_crlf_copy(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "smime_crlf_copy", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smime_crlf_copy" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smime_crlf_copy" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)smime_crlf_copy(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_pkcs7_get0_signers(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PKCS7 *arg1 = (PKCS7 *) 0 ;
  struct stack_st_X509 *arg2 = (struct stack_st_X509 *) 0 ;
  int arg3 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  PyObject *swig_obj[3] ;
  struct stack_st_X509 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "pkcs7_get0_signers", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_PKCS7, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pkcs7_get0_signers" "', argument " "1"" of type '" "PKCS7 *""'"); 
  }
  arg1 = (PKCS7 *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_stack_st_X509, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pkcs7_get0_signers" "', argument " "2"" of type '" "struct stack_st_X509 *""'"); 
  }
  arg2 = (struct stack_st_X509 *)(argp2);
  ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pkcs7_get0_signers" "', argument " "3"" of type '" "int""'");
  } 
  arg3 = (int)(val3);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (struct stack_st_X509 *)pkcs7_get0_signers(arg1,arg2,arg3);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_stack_st_X509, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__util_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_util_err""' of type '""PyObject *""'");
    }
    _util_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__util_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_util_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_util_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  util_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_util_hex_to_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (PyObject *)util_hex_to_string(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_util_string_to_hex(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (PyObject *)util_string_to_hex(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_new", 0, 0, 0)) SWIG_fail;
  result = (EC_KEY *)EC_KEY_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_free" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  EC_KEY_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_size(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_size" "', argument " "1"" of type '" "EC_KEY const *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ECDSA_size((EC_KEY const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_gen_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_gen_key" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EC_KEY_generate_key(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_check_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_check_key" "', argument " "1"" of type '" "EC_KEY const *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)EC_KEY_check_key((EC_KEY const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int Swig_var__ec_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_ec_err""' of type '""PyObject *""'");
    }
    _ec_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__ec_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_ec_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_ec_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  ec_init(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_get_builtin_curves(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_get_builtin_curves", 0, 0, 0)) SWIG_fail;
  result = (PyObject *)ec_get_builtin_curves();
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_new_by_curve_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  EC_KEY *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ec_key_new_by_curve_name" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (EC_KEY *)ec_key_new_by_curve_name(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_get_public_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_get_public_der" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ec_key_get_public_der(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_get_public_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_get_public_key" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ec_key_get_public_key(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_read_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  EC_KEY *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_read_pubkey" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (EC_KEY *)ec_key_read_pubkey(arg1);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_write_pubkey(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_write_pubkey", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_write_pubkey" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ec_key_write_pubkey" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    SWIG_PYTHON_THREAD_BEGIN_ALLOW;
    result = (int)ec_key_write_pubkey(arg1,arg2);
    SWIG_PYTHON_THREAD_END_ALLOW;
  }
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_read_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  BIO *arg1 = (BIO *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  EC_KEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_read_bio", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_read_bio" "', argument " "1"" of type '" "BIO *""'"); 
  }
  arg1 = (BIO *)(argp1);
  {
    if (!PyCallable_Check(swig_obj[1])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EC_KEY *)ec_key_read_bio(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_write_bio(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  EVP_CIPHER *arg3 = (EVP_CIPHER *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_write_bio", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_write_bio" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ec_key_write_bio" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_EVP_CIPHER, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ec_key_write_bio" "', argument " "3"" of type '" "EVP_CIPHER *""'"); 
  }
  arg3 = (EVP_CIPHER *)(argp3);
  {
    if (!PyCallable_Check(swig_obj[3])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg4) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ec_key_write_bio(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_write_bio_no_cipher(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  BIO *arg2 = (BIO *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_write_bio_no_cipher", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_write_bio_no_cipher" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_BIO, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ec_key_write_bio_no_cipher" "', argument " "2"" of type '" "BIO *""'"); 
  }
  arg2 = (BIO *)(argp2);
  {
    if (!PyCallable_Check(swig_obj[2])) {
      PyErr_SetString(PyExc_TypeError, "expected PyCallable");
      return NULL;
    }
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ec_key_write_bio_no_cipher(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_sig_get_r(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ECDSA_SIG *arg1 = (ECDSA_SIG *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ECDSA_SIG, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_sig_get_r" "', argument " "1"" of type '" "ECDSA_SIG *""'"); 
  }
  arg1 = (ECDSA_SIG *)(argp1);
  result = (PyObject *)ecdsa_sig_get_r(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_sig_get_s(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ECDSA_SIG *arg1 = (ECDSA_SIG *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  PyObject *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ECDSA_SIG, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_sig_get_s" "', argument " "1"" of type '" "ECDSA_SIG *""'"); 
  }
  arg1 = (ECDSA_SIG *)(argp1);
  result = (PyObject *)ecdsa_sig_get_s(arg1);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_sign(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ecdsa_sign", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_sign" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ecdsa_sign(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_verify(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  PyObject *arg4 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ecdsa_verify", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_verify" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    arg4=swig_obj[3];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ecdsa_verify(arg1,arg2,arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_sign_asn1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ecdsa_sign_asn1", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_sign_asn1" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ecdsa_sign_asn1(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdsa_verify_asn1(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  PyObject *arg2 = (PyObject *) 0 ;
  PyObject *arg3 = (PyObject *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[3] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "ecdsa_verify_asn1", 3, 3, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdsa_verify_asn1" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    arg2=swig_obj[1];
  }
  {
    arg3=swig_obj[2];
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ecdsa_verify_asn1(arg1,arg2,arg3);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ecdh_compute_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  EC_KEY *arg2 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ecdh_compute_key", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ecdh_compute_key" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ecdh_compute_key" "', argument " "2"" of type '" "EC_KEY *""'"); 
  }
  arg2 = (EC_KEY *)(argp2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)ecdh_compute_key(arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_from_pubkey_der(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  EC_KEY *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  result = (EC_KEY *)ec_key_from_pubkey_der(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_from_pubkey_params(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  PyObject *arg2 = (PyObject *) 0 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[2] ;
  EC_KEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ec_key_from_pubkey_params", 2, 2, swig_obj)) SWIG_fail;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ec_key_from_pubkey_params" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  {
    arg2=swig_obj[1];
  }
  result = (EC_KEY *)ec_key_from_pubkey_params(arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EC_KEY, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_keylen(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_keylen" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ec_key_keylen(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_ec_key_type_check(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  EC_KEY *arg1 = (EC_KEY *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_EC_KEY, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ec_key_type_check" "', argument " "1"" of type '" "EC_KEY *""'"); 
  }
  arg1 = (EC_KEY *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ec_key_type_check(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_builtin_engines(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_builtin_engines", 0, 0, 0)) SWIG_fail;
  ENGINE_load_builtin_engines();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_dynamic(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_dynamic", 0, 0, 0)) SWIG_fail;
  ENGINE_load_dynamic();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_openssl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_openssl", 0, 0, 0)) SWIG_fail;
  ENGINE_load_openssl();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_cleanup(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_cleanup", 0, 0, 0)) SWIG_fail;
  ENGINE_cleanup();
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_new", 0, 0, 0)) SWIG_fail;
  result = (ENGINE *)ENGINE_new();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ENGINE, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_by_id(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  ENGINE *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_by_id" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ENGINE *)ENGINE_by_id((char const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ENGINE, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_free" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ENGINE_free(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_init(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_init" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ENGINE_init(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_finish(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_finish" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ENGINE_finish(arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_get_id(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_get_id" "', argument " "1"" of type '" "ENGINE const *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)ENGINE_get_id((ENGINE const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_get_name(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_get_name" "', argument " "1"" of type '" "ENGINE const *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (char *)ENGINE_get_name((ENGINE const *)arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_ctrl_cmd_string(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  int arg4 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_ctrl_cmd_string", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_ctrl_cmd_string" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "engine_ctrl_cmd_string" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "engine_ctrl_cmd_string" "', argument " "3"" of type '" "char const *""'");
  }
  arg3 = (char *)(buf3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "engine_ctrl_cmd_string" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ENGINE_ctrl_cmd_string(arg1,(char const *)arg2,(char const *)arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
  return NULL;
}


SWIGINTERN PyObject *_wrap_ui_openssl(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  UI_METHOD *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "ui_openssl", 0, 0, 0)) SWIG_fail;
  result = (UI_METHOD *)UI_OpenSSL();
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_UI_METHOD, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__cbd_t_password_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  _cbd_t *arg1 = (_cbd_t *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p__cbd_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_cbd_t_password_set" "', argument " "1"" of type '" "_cbd_t *""'"); 
  }
  arg1 = (_cbd_t *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_cbd_t_password_set" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  if (arg1->password) free((char*)arg1->password);
  if (arg2) {
    size_t size = strlen((const char *)(arg2)) + 1;
    arg1->password = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
  } else {
    arg1->password = 0;
  }
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap__cbd_t_password_get(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  _cbd_t *arg1 = (_cbd_t *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "_cbd_t_password_get", 0, 0, 0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p__cbd_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_cbd_t_password_get" "', argument " "1"" of type '" "_cbd_t *""'"); 
  }
  arg1 = (_cbd_t *)(argp1);
  result = (char *) ((arg1)->password);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap__cbd_t_prompt_set(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  _cbd_t *arg1 = (_cbd_t *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p__cbd_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_cbd_t_prompt_set" "', argument " "1"" of type '" "_cbd_t *""'"); 
  }
  arg1 = (_cbd_t *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_cbd_t_prompt_set" "', argument " "2"" of type '" "char *""'");
  }
  arg2 = (char *)(buf2);
  if (arg1->prompt) free((char*)arg1->prompt);
  if (arg2) {
    size_t size = strlen((const char *)(arg2)) + 1;
    arg1->prompt = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
  } else {
    arg1->prompt = 0;
  }
  resultobj = SWIG_Py_Void();
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap__cbd_t_prompt_get(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  _cbd_t *arg1 = (_cbd_t *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "_cbd_t_prompt_get", 0, 0, 0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p__cbd_t, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_cbd_t_prompt_get" "', argument " "1"" of type '" "_cbd_t *""'"); 
  }
  arg1 = (_cbd_t *)(argp1);
  result = (char *) ((arg1)->prompt);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN int _wrap_new__cbd_t(PyObject *self, PyObject *args, PyObject *kwargs) {
  PyObject *resultobj = 0;
  _cbd_t *result = 0 ;
  
  if (!SWIG_Python_CheckNoKeywords(kwargs, "new__cbd_t")) SWIG_fail;
  if (!SWIG_Python_UnpackTuple(args, "new__cbd_t", 0, 0, 0)) SWIG_fail;
  result = (_cbd_t *)calloc(1, sizeof(_cbd_t));
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p__cbd_t, SWIG_BUILTIN_INIT |  0 );
  return resultobj == Py_None ? -1 : 0;
fail:
  return -1;
}


SWIGINTERN PyObject *_wrap_delete__cbd_t(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  _cbd_t *arg1 = (_cbd_t *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  
  if (!SWIG_Python_UnpackTuple(args, "delete__cbd_t", 0, 0, 0)) SWIG_fail;
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p__cbd_t, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete__cbd_t" "', argument " "1"" of type '" "_cbd_t *""'"); 
  }
  arg1 = (_cbd_t *)(argp1);
  free((char *) arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete__cbd_t) /* defines _wrap_delete__cbd_t_destructor_closure */

SWIGINTERN PyObject *_wrap_engine_pkcs11_data_new(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  void *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_pkcs11_data_new" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  result = (void *)engine_pkcs11_data_new((char const *)arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_pkcs11_data_free(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  void *arg1 = (void *) 0 ;
  int res1 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0],SWIG_as_voidptrptr(&arg1), 0, 0);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_pkcs11_data_free" "', argument " "1"" of type '" "void *""'"); 
  }
  engine_pkcs11_data_free(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_private_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  char *arg2 = (char *) 0 ;
  UI_METHOD *arg3 = (UI_METHOD *) 0 ;
  void *arg4 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int res4 ;
  PyObject *swig_obj[4] ;
  EVP_PKEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_private_key", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_load_private_key" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "engine_load_private_key" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_UI_METHOD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "engine_load_private_key" "', argument " "3"" of type '" "UI_METHOD *""'"); 
  }
  arg3 = (UI_METHOD *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3],SWIG_as_voidptrptr(&arg4), 0, 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "engine_load_private_key" "', argument " "4"" of type '" "void *""'"); 
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)ENGINE_load_private_key(arg1,(char const *)arg2,arg3,arg4);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_public_key(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  char *arg2 = (char *) 0 ;
  UI_METHOD *arg3 = (UI_METHOD *) 0 ;
  void *arg4 = (void *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int res4 ;
  PyObject *swig_obj[4] ;
  EVP_PKEY *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_public_key", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_load_public_key" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "engine_load_public_key" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_UI_METHOD, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "engine_load_public_key" "', argument " "3"" of type '" "UI_METHOD *""'"); 
  }
  arg3 = (UI_METHOD *)(argp3);
  res4 = SWIG_ConvertPtr(swig_obj[3],SWIG_as_voidptrptr(&arg4), 0, 0);
  if (!SWIG_IsOK(res4)) {
    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "engine_load_public_key" "', argument " "4"" of type '" "void *""'"); 
  }
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (EVP_PKEY *)ENGINE_load_public_key(arg1,(char const *)arg2,arg3,arg4);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EVP_PKEY, 0 |  0 );
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN int Swig_var__engine_err_set(PyObject *_val) {
  {
    void *argp = 0;
    int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_PyObject,  0 );  
    if (!SWIG_IsOK(res)) {
      SWIG_exception_fail(SWIG_ArgError(res), "in variable '""_engine_err""' of type '""PyObject *""'");
    }
    _engine_err = (PyObject *)(argp);
  }
  return 0;
fail:
  return 1;
}


SWIGINTERN PyObject *Swig_var__engine_err_get(void) {
  PyObject *pyobj = 0;
  PyObject *self = 0;
  
  (void)self;
  pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(_engine_err), SWIGTYPE_p_PyObject,  0 );
  return pyobj;
}


SWIGINTERN PyObject *_wrap_engine_init_error(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  PyObject *arg1 = (PyObject *) 0 ;
  PyObject *swig_obj[1] ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  {
    arg1=swig_obj[0];
  }
  engine_init_error(arg1);
  resultobj = SWIG_Py_Void();
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_load_certificate(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  PyObject *swig_obj[2] ;
  X509 *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_load_certificate", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_load_certificate" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "engine_load_certificate" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = (char *)(buf2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  {
    if (!arg2) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (X509 *)engine_load_certificate(arg1,(char const *)arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509, 0 |  0 );
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return resultobj;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return NULL;
}


SWIGINTERN PyObject *_wrap_engine_set_default(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ENGINE *arg1 = (ENGINE *) 0 ;
  unsigned int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  unsigned int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "engine_set_default", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ENGINE, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "engine_set_default" "', argument " "1"" of type '" "ENGINE *""'"); 
  }
  arg1 = (ENGINE *)(argp1);
  ecode2 = SWIG_AsVal_unsigned_SS_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "engine_set_default" "', argument " "2"" of type '" "unsigned int""'");
  } 
  arg2 = (unsigned int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)ENGINE_set_default(arg1,arg2);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_nid2obj(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  ASN1_OBJECT *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "obj_nid2obj" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (ASN1_OBJECT *)OBJ_nid2obj(arg1);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_nid2ln(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "obj_nid2ln" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)OBJ_nid2ln(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_nid2sn(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  int arg1 ;
  int val1 ;
  int ecode1 = 0 ;
  PyObject *swig_obj[1] ;
  char *result = 0 ;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "obj_nid2sn" "', argument " "1"" of type '" "int""'");
  } 
  arg1 = (int)(val1);
  result = (char *)OBJ_nid2sn(arg1);
  resultobj = SWIG_FromCharPtr((const char *)result);
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_obj2nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT *arg1 = (ASN1_OBJECT *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_obj2nid" "', argument " "1"" of type '" "ASN1_OBJECT const *""'"); 
  }
  arg1 = (ASN1_OBJECT *)(argp1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)OBJ_obj2nid((ASN1_OBJECT const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  return resultobj;
fail:
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_ln2nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_ln2nid" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)OBJ_ln2nid((char const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_sn2nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_sn2nid" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)OBJ_sn2nid((char const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_txt2nid(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  PyObject *swig_obj[1] ;
  int result;
  
  if (!args) SWIG_fail;
  swig_obj[0] = args;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_txt2nid" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)OBJ_txt2nid((char const *)arg1);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_txt2obj(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int arg2 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  ASN1_OBJECT *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "obj_txt2obj", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_txt2obj" "', argument " "1"" of type '" "char const *""'");
  }
  arg1 = (char *)(buf1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "obj_txt2obj" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (ASN1_OBJECT *)OBJ_txt2obj((char const *)arg1,arg2);
  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap__obj_obj2txt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  char *arg1 = (char *) 0 ;
  int arg2 ;
  ASN1_OBJECT *arg3 = (ASN1_OBJECT *) 0 ;
  int arg4 ;
  int res1 ;
  char *buf1 = 0 ;
  int alloc1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  void *argp3 = 0 ;
  int res3 = 0 ;
  int val4 ;
  int ecode4 = 0 ;
  PyObject *swig_obj[4] ;
  int result;
  
  if (!SWIG_Python_UnpackTuple(args, "_obj_obj2txt", 4, 4, swig_obj)) SWIG_fail;
  res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_obj_obj2txt" "', argument " "1"" of type '" "char *""'");
  }
  arg1 = (char *)(buf1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_obj_obj2txt" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_obj_obj2txt" "', argument " "3"" of type '" "ASN1_OBJECT const *""'"); 
  }
  arg3 = (ASN1_OBJECT *)(argp3);
  ecode4 = SWIG_AsVal_int(swig_obj[3], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_obj_obj2txt" "', argument " "4"" of type '" "int""'");
  } 
  arg4 = (int)(val4);
  {
    if (!arg3) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (int)OBJ_obj2txt(arg1,arg2,(ASN1_OBJECT const *)arg3,arg4);
  {
    resultobj=PyLong_FromLong(result);
    if (PyErr_Occurred()) SWIG_fail;
  }
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return resultobj;
fail:
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
  return NULL;
}


SWIGINTERN PyObject *_wrap_obj_obj2txt(PyObject *self, PyObject *args) {
  PyObject *resultobj = 0;
  ASN1_OBJECT *arg1 = (ASN1_OBJECT *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  PyObject *swig_obj[2] ;
  PyObject *result = 0 ;
  
  if (!SWIG_Python_UnpackTuple(args, "obj_obj2txt", 2, 2, swig_obj)) SWIG_fail;
  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ASN1_OBJECT, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "obj_obj2txt" "', argument " "1"" of type '" "ASN1_OBJECT const *""'"); 
  }
  arg1 = (ASN1_OBJECT *)(argp1);
  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "obj_obj2txt" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = (int)(val2);
  {
    if (!arg1) {
      SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
    }
  }
  result = (PyObject *)obj_obj2txt((ASN1_OBJECT const *)arg1,arg2);
  {
    resultobj=result;
  }
  return resultobj;
fail:
  return NULL;
}


static PyMethodDef SwigMethods[] = {
	 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
	 { "OPENSSL_sk_num", _wrap_OPENSSL_sk_num, METH_O, NULL},
	 { "OPENSSL_sk_value", _wrap_OPENSSL_sk_value, METH_VARARGS, NULL},
	 { "OPENSSL_sk_set", _wrap_OPENSSL_sk_set, METH_VARARGS, NULL},
	 { "OPENSSL_sk_new", _wrap_OPENSSL_sk_new, METH_O, NULL},
	 { "OPENSSL_sk_new_null", _wrap_OPENSSL_sk_new_null, METH_NOARGS, NULL},
	 { "OPENSSL_sk_new_reserve", _wrap_OPENSSL_sk_new_reserve, METH_VARARGS, NULL},
	 { "OPENSSL_sk_reserve", _wrap_OPENSSL_sk_reserve, METH_VARARGS, NULL},
	 { "OPENSSL_sk_free", _wrap_OPENSSL_sk_free, METH_O, NULL},
	 { "OPENSSL_sk_pop_free", _wrap_OPENSSL_sk_pop_free, METH_VARARGS, NULL},
	 { "OPENSSL_sk_deep_copy", _wrap_OPENSSL_sk_deep_copy, METH_VARARGS, NULL},
	 { "OPENSSL_sk_insert", _wrap_OPENSSL_sk_insert, METH_VARARGS, NULL},
	 { "OPENSSL_sk_delete", _wrap_OPENSSL_sk_delete, METH_VARARGS, NULL},
	 { "OPENSSL_sk_delete_ptr", _wrap_OPENSSL_sk_delete_ptr, METH_VARARGS, NULL},
	 { "OPENSSL_sk_find", _wrap_OPENSSL_sk_find, METH_VARARGS, NULL},
	 { "OPENSSL_sk_find_ex", _wrap_OPENSSL_sk_find_ex, METH_VARARGS, NULL},
	 { "OPENSSL_sk_push", _wrap_OPENSSL_sk_push, METH_VARARGS, NULL},
	 { "OPENSSL_sk_unshift", _wrap_OPENSSL_sk_unshift, METH_VARARGS, NULL},
	 { "OPENSSL_sk_shift", _wrap_OPENSSL_sk_shift, METH_O, NULL},
	 { "OPENSSL_sk_pop", _wrap_OPENSSL_sk_pop, METH_O, NULL},
	 { "OPENSSL_sk_zero", _wrap_OPENSSL_sk_zero, METH_O, NULL},
	 { "OPENSSL_sk_set_cmp_func", _wrap_OPENSSL_sk_set_cmp_func, METH_VARARGS, NULL},
	 { "OPENSSL_sk_dup", _wrap_OPENSSL_sk_dup, METH_O, NULL},
	 { "OPENSSL_sk_sort", _wrap_OPENSSL_sk_sort, METH_O, NULL},
	 { "OPENSSL_sk_is_sorted", _wrap_OPENSSL_sk_is_sorted, METH_O, NULL},
	 { "sk_OPENSSL_STRING_num", _wrap_sk_OPENSSL_STRING_num, METH_O, NULL},
	 { "sk_OPENSSL_STRING_value", _wrap_sk_OPENSSL_STRING_value, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_new", _wrap_sk_OPENSSL_STRING_new, METH_O, NULL},
	 { "sk_OPENSSL_STRING_new_null", _wrap_sk_OPENSSL_STRING_new_null, METH_NOARGS, NULL},
	 { "sk_OPENSSL_STRING_new_reserve", _wrap_sk_OPENSSL_STRING_new_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_reserve", _wrap_sk_OPENSSL_STRING_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_free", _wrap_sk_OPENSSL_STRING_free, METH_O, NULL},
	 { "sk_OPENSSL_STRING_zero", _wrap_sk_OPENSSL_STRING_zero, METH_O, NULL},
	 { "sk_OPENSSL_STRING_delete", _wrap_sk_OPENSSL_STRING_delete, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_delete_ptr", _wrap_sk_OPENSSL_STRING_delete_ptr, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_push", _wrap_sk_OPENSSL_STRING_push, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_unshift", _wrap_sk_OPENSSL_STRING_unshift, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_pop", _wrap_sk_OPENSSL_STRING_pop, METH_O, NULL},
	 { "sk_OPENSSL_STRING_shift", _wrap_sk_OPENSSL_STRING_shift, METH_O, NULL},
	 { "sk_OPENSSL_STRING_pop_free", _wrap_sk_OPENSSL_STRING_pop_free, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_insert", _wrap_sk_OPENSSL_STRING_insert, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_set", _wrap_sk_OPENSSL_STRING_set, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_find", _wrap_sk_OPENSSL_STRING_find, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_find_ex", _wrap_sk_OPENSSL_STRING_find_ex, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_sort", _wrap_sk_OPENSSL_STRING_sort, METH_O, NULL},
	 { "sk_OPENSSL_STRING_is_sorted", _wrap_sk_OPENSSL_STRING_is_sorted, METH_O, NULL},
	 { "sk_OPENSSL_STRING_dup", _wrap_sk_OPENSSL_STRING_dup, METH_O, NULL},
	 { "sk_OPENSSL_STRING_deep_copy", _wrap_sk_OPENSSL_STRING_deep_copy, METH_VARARGS, NULL},
	 { "sk_OPENSSL_STRING_set_cmp_func", _wrap_sk_OPENSSL_STRING_set_cmp_func, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_num", _wrap_sk_OPENSSL_CSTRING_num, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_value", _wrap_sk_OPENSSL_CSTRING_value, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_new", _wrap_sk_OPENSSL_CSTRING_new, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_new_null", _wrap_sk_OPENSSL_CSTRING_new_null, METH_NOARGS, NULL},
	 { "sk_OPENSSL_CSTRING_new_reserve", _wrap_sk_OPENSSL_CSTRING_new_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_reserve", _wrap_sk_OPENSSL_CSTRING_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_free", _wrap_sk_OPENSSL_CSTRING_free, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_zero", _wrap_sk_OPENSSL_CSTRING_zero, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_delete", _wrap_sk_OPENSSL_CSTRING_delete, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_delete_ptr", _wrap_sk_OPENSSL_CSTRING_delete_ptr, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_push", _wrap_sk_OPENSSL_CSTRING_push, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_unshift", _wrap_sk_OPENSSL_CSTRING_unshift, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_pop", _wrap_sk_OPENSSL_CSTRING_pop, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_shift", _wrap_sk_OPENSSL_CSTRING_shift, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_pop_free", _wrap_sk_OPENSSL_CSTRING_pop_free, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_insert", _wrap_sk_OPENSSL_CSTRING_insert, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_set", _wrap_sk_OPENSSL_CSTRING_set, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_find", _wrap_sk_OPENSSL_CSTRING_find, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_find_ex", _wrap_sk_OPENSSL_CSTRING_find_ex, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_sort", _wrap_sk_OPENSSL_CSTRING_sort, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_is_sorted", _wrap_sk_OPENSSL_CSTRING_is_sorted, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_dup", _wrap_sk_OPENSSL_CSTRING_dup, METH_O, NULL},
	 { "sk_OPENSSL_CSTRING_deep_copy", _wrap_sk_OPENSSL_CSTRING_deep_copy, METH_VARARGS, NULL},
	 { "sk_OPENSSL_CSTRING_set_cmp_func", _wrap_sk_OPENSSL_CSTRING_set_cmp_func, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_num", _wrap_sk_OPENSSL_BLOCK_num, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_value", _wrap_sk_OPENSSL_BLOCK_value, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_new", _wrap_sk_OPENSSL_BLOCK_new, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_new_null", _wrap_sk_OPENSSL_BLOCK_new_null, METH_NOARGS, NULL},
	 { "sk_OPENSSL_BLOCK_new_reserve", _wrap_sk_OPENSSL_BLOCK_new_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_reserve", _wrap_sk_OPENSSL_BLOCK_reserve, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_free", _wrap_sk_OPENSSL_BLOCK_free, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_zero", _wrap_sk_OPENSSL_BLOCK_zero, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_delete", _wrap_sk_OPENSSL_BLOCK_delete, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_delete_ptr", _wrap_sk_OPENSSL_BLOCK_delete_ptr, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_push", _wrap_sk_OPENSSL_BLOCK_push, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_unshift", _wrap_sk_OPENSSL_BLOCK_unshift, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_pop", _wrap_sk_OPENSSL_BLOCK_pop, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_shift", _wrap_sk_OPENSSL_BLOCK_shift, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_pop_free", _wrap_sk_OPENSSL_BLOCK_pop_free, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_insert", _wrap_sk_OPENSSL_BLOCK_insert, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_set", _wrap_sk_OPENSSL_BLOCK_set, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_find", _wrap_sk_OPENSSL_BLOCK_find, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_find_ex", _wrap_sk_OPENSSL_BLOCK_find_ex, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_sort", _wrap_sk_OPENSSL_BLOCK_sort, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_is_sorted", _wrap_sk_OPENSSL_BLOCK_is_sorted, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_dup", _wrap_sk_OPENSSL_BLOCK_dup, METH_O, NULL},
	 { "sk_OPENSSL_BLOCK_deep_copy", _wrap_sk_OPENSSL_BLOCK_deep_copy, METH_VARARGS, NULL},
	 { "sk_OPENSSL_BLOCK_set_cmp_func", _wrap_sk_OPENSSL_BLOCK_set_cmp_func, METH_VARARGS, NULL},
	 { "threading_init", _wrap_threading_init, METH_NOARGS, NULL},
	 { "threading_cleanup", _wrap_threading_cleanup, METH_NOARGS, NULL},
	 { "lib_init", _wrap_lib_init, METH_NOARGS, NULL},
	 { "bn_to_mpi", _wrap_bn_to_mpi, METH_O, NULL},
	 { "mpi_to_bn", _wrap_mpi_to_bn, METH_O, NULL},
	 { "bn_to_bin", _wrap_bn_to_bin, METH_O, NULL},
	 { "bin_to_bn", _wrap_bin_to_bn, METH_O, NULL},
	 { "bn_to_hex", _wrap_bn_to_hex, METH_O, NULL},
	 { "hex_to_bn", _wrap_hex_to_bn, METH_O, NULL},
	 { "dec_to_bn", _wrap_dec_to_bn, METH_O, NULL},
	 { "err_print_errors", _wrap_err_print_errors, METH_O, NULL},
	 { "err_get_error", _wrap_err_get_error, METH_NOARGS, NULL},
	 { "err_peek_error", _wrap_err_peek_error, METH_NOARGS, NULL},
	 { "err_lib_error_string", _wrap_err_lib_error_string, METH_O, NULL},
	 { "err_func_error_string", _wrap_err_func_error_string, METH_O, NULL},
	 { "err_reason_error_string", _wrap_err_reason_error_string, METH_O, NULL},
	 { "bio_s_bio", _wrap_bio_s_bio, METH_NOARGS, NULL},
	 { "bio_s_mem", _wrap_bio_s_mem, METH_NOARGS, NULL},
	 { "bio_s_socket", _wrap_bio_s_socket, METH_NOARGS, NULL},
	 { "bio_f_ssl", _wrap_bio_f_ssl, METH_NOARGS, NULL},
	 { "bio_f_buffer", _wrap_bio_f_buffer, METH_NOARGS, NULL},
	 { "bio_f_cipher", _wrap_bio_f_cipher, METH_NOARGS, NULL},
	 { "bio_new", _wrap_bio_new, METH_O, NULL},
	 { "bio_new_socket", _wrap_bio_new_socket, METH_VARARGS, NULL},
	 { "bio_free_all", _wrap_bio_free_all, METH_O, NULL},
	 { "bio_dup_chain", _wrap_bio_dup_chain, METH_O, NULL},
	 { "bio_push", _wrap_bio_push, METH_VARARGS, NULL},
	 { "bio_pop", _wrap_bio_pop, METH_O, NULL},
	 { "bio_eof", _wrap_bio_eof, METH_O, NULL},
	 { "pyfd_init", _wrap_pyfd_init, METH_NOARGS, NULL},
	 { "bio_init", _wrap_bio_init, METH_O, NULL},
	 { "bio_free", _wrap_bio_free, METH_O, NULL},
	 { "bio_new_file", _wrap_bio_new_file, METH_VARARGS, NULL},
	 { "bio_new_pyfile", _wrap_bio_new_pyfile, METH_VARARGS, NULL},
	 { "bio_read", _wrap_bio_read, METH_VARARGS, NULL},
	 { "bio_gets", _wrap_bio_gets, METH_VARARGS, NULL},
	 { "bio_write", _wrap_bio_write, METH_VARARGS, NULL},
	 { "bio_ctrl_pending", _wrap_bio_ctrl_pending, METH_O, NULL},
	 { "bio_ctrl_wpending", _wrap_bio_ctrl_wpending, METH_O, NULL},
	 { "bio_ctrl_get_write_guarantee", _wrap_bio_ctrl_get_write_guarantee, METH_O, NULL},
	 { "bio_reset", _wrap_bio_reset, METH_O, NULL},
	 { "bio_flush", _wrap_bio_flush, METH_O, NULL},
	 { "bio_seek", _wrap_bio_seek, METH_VARARGS, NULL},
	 { "bio_tell", _wrap_bio_tell, METH_O, NULL},
	 { "bio_set_flags", _wrap_bio_set_flags, METH_VARARGS, NULL},
	 { "bio_get_flags", _wrap_bio_get_flags, METH_O, NULL},
	 { "bio_set_cipher", _wrap_bio_set_cipher, METH_VARARGS, NULL},
	 { "bio_set_mem_eof_return", _wrap_bio_set_mem_eof_return, METH_VARARGS, NULL},
	 { "bio_get_fd", _wrap_bio_get_fd, METH_O, NULL},
	 { "bio_do_handshake", _wrap_bio_do_handshake, METH_O, NULL},
	 { "bio_make_bio_pair", _wrap_bio_make_bio_pair, METH_VARARGS, NULL},
	 { "bio_set_write_buf_size", _wrap_bio_set_write_buf_size, METH_VARARGS, NULL},
	 { "bio_should_retry", _wrap_bio_should_retry, METH_O, NULL},
	 { "bio_should_read", _wrap_bio_should_read, METH_O, NULL},
	 { "bio_should_write", _wrap_bio_should_write, METH_O, NULL},
	 { "pyfd_write", _wrap_pyfd_write, METH_VARARGS, NULL},
	 { "pyfd_read", _wrap_pyfd_read, METH_VARARGS, NULL},
	 { "pyfd_puts", _wrap_pyfd_puts, METH_VARARGS, NULL},
	 { "pyfd_gets", _wrap_pyfd_gets, METH_VARARGS, NULL},
	 { "pyfd_new", _wrap_pyfd_new, METH_O, NULL},
	 { "pyfd_free", _wrap_pyfd_free, METH_O, NULL},
	 { "pyfd_ctrl", _wrap_pyfd_ctrl, METH_VARARGS, NULL},
	 { "bio_new_pyfd", _wrap_bio_new_pyfd, METH_VARARGS, NULL},
	 { "bn_rand", _wrap_bn_rand, METH_VARARGS, NULL},
	 { "bn_rand_range", _wrap_bn_rand_range, METH_O, NULL},
	 { "rand_load_file", _wrap_rand_load_file, METH_VARARGS, NULL},
	 { "rand_save_file", _wrap_rand_save_file, METH_O, NULL},
	 { "rand_poll", _wrap_rand_poll, METH_NOARGS, NULL},
	 { "rand_status", _wrap_rand_status, METH_NOARGS, NULL},
	 { "rand_cleanup", _wrap_rand_cleanup, METH_NOARGS, NULL},
	 { "rand_init", _wrap_rand_init, METH_O, NULL},
	 { "rand_seed", _wrap_rand_seed, METH_O, NULL},
	 { "rand_add", _wrap_rand_add, METH_VARARGS, NULL},
	 { "rand_bytes", _wrap_rand_bytes, METH_O, NULL},
	 { "rand_pseudo_bytes", _wrap_rand_pseudo_bytes, METH_O, NULL},
	 { "rand_file_name", _wrap_rand_file_name, METH_VARARGS, NULL},
	 { "rand_screen", _wrap_rand_screen, METH_NOARGS, NULL},
	 { "rand_win32_event", _wrap_rand_win32_event, METH_VARARGS, NULL},
	 { "md5", _wrap_md5, METH_NOARGS, NULL},
	 { "sha1", _wrap_sha1, METH_NOARGS, NULL},
	 { "ripemd160", _wrap_ripemd160, METH_NOARGS, NULL},
	 { "sha224", _wrap_sha224, METH_NOARGS, NULL},
	 { "sha256", _wrap_sha256, METH_NOARGS, NULL},
	 { "sha384", _wrap_sha384, METH_NOARGS, NULL},
	 { "sha512", _wrap_sha512, METH_NOARGS, NULL},
	 { "digest_init", _wrap_digest_init, METH_VARARGS, NULL},
	 { "des_ecb", _wrap_des_ecb, METH_NOARGS, NULL},
	 { "des_ede_ecb", _wrap_des_ede_ecb, METH_NOARGS, NULL},
	 { "des_ede3_ecb", _wrap_des_ede3_ecb, METH_NOARGS, NULL},
	 { "des_cbc", _wrap_des_cbc, METH_NOARGS, NULL},
	 { "des_ede_cbc", _wrap_des_ede_cbc, METH_NOARGS, NULL},
	 { "des_ede3_cbc", _wrap_des_ede3_cbc, METH_NOARGS, NULL},
	 { "des_cfb", _wrap_des_cfb, METH_NOARGS, NULL},
	 { "des_ede_cfb", _wrap_des_ede_cfb, METH_NOARGS, NULL},
	 { "des_ede3_cfb", _wrap_des_ede3_cfb, METH_NOARGS, NULL},
	 { "des_ofb", _wrap_des_ofb, METH_NOARGS, NULL},
	 { "des_ede_ofb", _wrap_des_ede_ofb, METH_NOARGS, NULL},
	 { "des_ede3_ofb", _wrap_des_ede3_ofb, METH_NOARGS, NULL},
	 { "bf_ecb", _wrap_bf_ecb, METH_NOARGS, NULL},
	 { "bf_cbc", _wrap_bf_cbc, METH_NOARGS, NULL},
	 { "bf_cfb", _wrap_bf_cfb, METH_NOARGS, NULL},
	 { "bf_ofb", _wrap_bf_ofb, METH_NOARGS, NULL},
	 { "cast5_ecb", _wrap_cast5_ecb, METH_NOARGS, NULL},
	 { "cast5_cbc", _wrap_cast5_cbc, METH_NOARGS, NULL},
	 { "cast5_cfb", _wrap_cast5_cfb, METH_NOARGS, NULL},
	 { "cast5_ofb", _wrap_cast5_ofb, METH_NOARGS, NULL},
	 { "rc4", _wrap_rc4, METH_NOARGS, NULL},
	 { "rc2_40_cbc", _wrap_rc2_40_cbc, METH_NOARGS, NULL},
	 { "aes_128_ecb", _wrap_aes_128_ecb, METH_NOARGS, NULL},
	 { "aes_128_cbc", _wrap_aes_128_cbc, METH_NOARGS, NULL},
	 { "aes_128_cfb", _wrap_aes_128_cfb, METH_NOARGS, NULL},
	 { "aes_128_ofb", _wrap_aes_128_ofb, METH_NOARGS, NULL},
	 { "aes_128_ctr", _wrap_aes_128_ctr, METH_NOARGS, NULL},
	 { "aes_192_ecb", _wrap_aes_192_ecb, METH_NOARGS, NULL},
	 { "aes_192_cbc", _wrap_aes_192_cbc, METH_NOARGS, NULL},
	 { "aes_192_cfb", _wrap_aes_192_cfb, METH_NOARGS, NULL},
	 { "aes_192_ofb", _wrap_aes_192_ofb, METH_NOARGS, NULL},
	 { "aes_192_ctr", _wrap_aes_192_ctr, METH_NOARGS, NULL},
	 { "aes_256_ecb", _wrap_aes_256_ecb, METH_NOARGS, NULL},
	 { "aes_256_cbc", _wrap_aes_256_cbc, METH_NOARGS, NULL},
	 { "aes_256_cfb", _wrap_aes_256_cfb, METH_NOARGS, NULL},
	 { "aes_256_ofb", _wrap_aes_256_ofb, METH_NOARGS, NULL},
	 { "aes_256_ctr", _wrap_aes_256_ctr, METH_NOARGS, NULL},
	 { "cipher_set_padding", _wrap_cipher_set_padding, METH_VARARGS, NULL},
	 { "pkey_free", _wrap_pkey_free, METH_O, NULL},
	 { "pkey_assign", _wrap_pkey_assign, METH_VARARGS, NULL},
	 { "pkey_assign_ec", _wrap_pkey_assign_ec, METH_VARARGS, NULL},
	 { "pkey_set1_rsa", _wrap_pkey_set1_rsa, METH_VARARGS, NULL},
	 { "sign_init", _wrap_sign_init, METH_VARARGS, NULL},
	 { "verify_init", _wrap_verify_init, METH_VARARGS, NULL},
	 { "pkey_size", _wrap_pkey_size, METH_O, NULL},
	 { "evp_init", _wrap_evp_init, METH_O, NULL},
	 { "pkey_get1_rsa", _wrap_pkey_get1_rsa, METH_O, NULL},
	 { "pkcs5_pbkdf2_hmac_sha1", _wrap_pkcs5_pbkdf2_hmac_sha1, METH_VARARGS, NULL},
	 { "md_ctx_new", _wrap_md_ctx_new, METH_NOARGS, NULL},
	 { "md_ctx_free", _wrap_md_ctx_free, METH_O, NULL},
	 { "digest_update", _wrap_digest_update, METH_VARARGS, NULL},
	 { "digest_final", _wrap_digest_final, METH_O, NULL},
	 { "hmac_ctx_new", _wrap_hmac_ctx_new, METH_NOARGS, NULL},
	 { "hmac_ctx_free", _wrap_hmac_ctx_free, METH_O, NULL},
	 { "hmac_init", _wrap_hmac_init, METH_VARARGS, NULL},
	 { "hmac_update", _wrap_hmac_update, METH_VARARGS, NULL},
	 { "hmac_final", _wrap_hmac_final, METH_O, NULL},
	 { "hmac", _wrap_hmac, METH_VARARGS, NULL},
	 { "cipher_ctx_new", _wrap_cipher_ctx_new, METH_NOARGS, NULL},
	 { "cipher_ctx_free", _wrap_cipher_ctx_free, METH_O, NULL},
	 { "bytes_to_key", _wrap_bytes_to_key, METH_VARARGS, NULL},
	 { "cipher_init", _wrap_cipher_init, METH_VARARGS, NULL},
	 { "cipher_update", _wrap_cipher_update, METH_VARARGS, NULL},
	 { "cipher_final", _wrap_cipher_final, METH_O, NULL},
	 { "sign_update", _wrap_sign_update, METH_VARARGS, NULL},
	 { "sign_final", _wrap_sign_final, METH_VARARGS, NULL},
	 { "verify_update", _wrap_verify_update, METH_VARARGS, NULL},
	 { "verify_final", _wrap_verify_final, METH_VARARGS, NULL},
	 { "digest_sign_init", _wrap_digest_sign_init, METH_VARARGS, NULL},
	 { "digest_sign_update", _wrap_digest_sign_update, METH_VARARGS, NULL},
	 { "digest_sign_final", _wrap_digest_sign_final, METH_O, NULL},
	 { "digest_sign", _wrap_digest_sign, METH_VARARGS, NULL},
	 { "digest_verify_init", _wrap_digest_verify_init, METH_VARARGS, NULL},
	 { "digest_verify_update", _wrap_digest_verify_update, METH_VARARGS, NULL},
	 { "digest_verify_final", _wrap_digest_verify_final, METH_VARARGS, NULL},
	 { "digest_verify", _wrap_digest_verify, METH_VARARGS, NULL},
	 { "get_digestbyname", _wrap_get_digestbyname, METH_O, NULL},
	 { "pkey_write_pem_no_cipher", _wrap_pkey_write_pem_no_cipher, METH_VARARGS, NULL},
	 { "pkey_write_pem", _wrap_pkey_write_pem, METH_VARARGS, NULL},
	 { "pkey_new", _wrap_pkey_new, METH_NOARGS, NULL},
	 { "pkey_read_pem", _wrap_pkey_read_pem, METH_VARARGS, NULL},
	 { "pkey_read_pem_pubkey", _wrap_pkey_read_pem_pubkey, METH_VARARGS, NULL},
	 { "pkey_assign_rsa", _wrap_pkey_assign_rsa, METH_VARARGS, NULL},
	 { "pkey_as_der", _wrap_pkey_as_der, METH_O, NULL},
	 { "pkey_get_modulus", _wrap_pkey_get_modulus, METH_O, NULL},
	 { "aes_new", _wrap_aes_new, METH_NOARGS, NULL},
	 { "AES_free", _wrap_AES_free, METH_O, NULL},
	 { "AES_set_key", _wrap_AES_set_key, METH_VARARGS, NULL},
	 { "AES_crypt", _wrap_AES_crypt, METH_VARARGS, NULL},
	 { "AES_type_check", _wrap_AES_type_check, METH_O, NULL},
	 { "rc4_new", _wrap_rc4_new, METH_NOARGS, NULL},
	 { "rc4_free", _wrap_rc4_free, METH_O, NULL},
	 { "rc4_set_key", _wrap_rc4_set_key, METH_VARARGS, NULL},
	 { "rc4_update", _wrap_rc4_update, METH_VARARGS, NULL},
	 { "rc4_type_check", _wrap_rc4_type_check, METH_O, NULL},
	 { "dh_new", _wrap_dh_new, METH_NOARGS, NULL},
	 { "dh_free", _wrap_dh_free, METH_O, NULL},
	 { "dh_size", _wrap_dh_size, METH_O, NULL},
	 { "dh_generate_key", _wrap_dh_generate_key, METH_O, NULL},
	 { "dhparams_print", _wrap_dhparams_print, METH_VARARGS, NULL},
	 { "dh_init", _wrap_dh_init, METH_O, NULL},
	 { "dh_type_check", _wrap_dh_type_check, METH_O, NULL},
	 { "dh_read_parameters", _wrap_dh_read_parameters, METH_O, NULL},
	 { "dh_generate_parameters", _wrap_dh_generate_parameters, METH_VARARGS, NULL},
	 { "dh_check", _wrap_dh_check, METH_O, NULL},
	 { "dh_compute_key", _wrap_dh_compute_key, METH_VARARGS, NULL},
	 { "dh_get_p", _wrap_dh_get_p, METH_O, NULL},
	 { "dh_get_g", _wrap_dh_get_g, METH_O, NULL},
	 { "dh_get_pub", _wrap_dh_get_pub, METH_O, NULL},
	 { "dh_get_priv", _wrap_dh_get_priv, METH_O, NULL},
	 { "dh_set_pg", _wrap_dh_set_pg, METH_VARARGS, NULL},
	 { "rsa_size", _wrap_rsa_size, METH_O, NULL},
	 { "rsa_new", _wrap_rsa_new, METH_NOARGS, NULL},
	 { "rsa_free", _wrap_rsa_free, METH_O, NULL},
	 { "rsa_check_key", _wrap_rsa_check_key, METH_O, NULL},
	 { "rsa_init", _wrap_rsa_init, METH_O, NULL},
	 { "rsa_read_key", _wrap_rsa_read_key, METH_VARARGS, NULL},
	 { "rsa_write_key", _wrap_rsa_write_key, METH_VARARGS, NULL},
	 { "rsa_write_key_no_cipher", _wrap_rsa_write_key_no_cipher, METH_VARARGS, NULL},
	 { "rsa_read_pub_key", _wrap_rsa_read_pub_key, METH_O, NULL},
	 { "rsa_write_pub_key", _wrap_rsa_write_pub_key, METH_VARARGS, NULL},
	 { "rsa_get_e", _wrap_rsa_get_e, METH_O, NULL},
	 { "rsa_get_n", _wrap_rsa_get_n, METH_O, NULL},
	 { "rsa_set_e", _wrap_rsa_set_e, METH_VARARGS, NULL},
	 { "rsa_set_n", _wrap_rsa_set_n, METH_VARARGS, NULL},
	 { "rsa_set_en", _wrap_rsa_set_en, METH_VARARGS, NULL},
	 { "PyObject_Bin_AsBIGNUM", _wrap_PyObject_Bin_AsBIGNUM, METH_O, NULL},
	 { "rsa_set_en_bin", _wrap_rsa_set_en_bin, METH_VARARGS, NULL},
	 { "rsa_private_encrypt", _wrap_rsa_private_encrypt, METH_VARARGS, NULL},
	 { "rsa_public_decrypt", _wrap_rsa_public_decrypt, METH_VARARGS, NULL},
	 { "rsa_public_encrypt", _wrap_rsa_public_encrypt, METH_VARARGS, NULL},
	 { "rsa_private_decrypt", _wrap_rsa_private_decrypt, METH_VARARGS, NULL},
	 { "rsa_padding_add_pkcs1_pss", _wrap_rsa_padding_add_pkcs1_pss, METH_VARARGS, NULL},
	 { "rsa_verify_pkcs1_pss", _wrap_rsa_verify_pkcs1_pss, METH_VARARGS, NULL},
	 { "rsa_sign", _wrap_rsa_sign, METH_VARARGS, NULL},
	 { "rsa_verify", _wrap_rsa_verify, METH_VARARGS, NULL},
	 { "rsa_generate_key", _wrap_rsa_generate_key, METH_VARARGS, NULL},
	 { "rsa_type_check", _wrap_rsa_type_check, METH_O, NULL},
	 { "rsa_check_pub_key", _wrap_rsa_check_pub_key, METH_O, NULL},
	 { "rsa_write_key_der", _wrap_rsa_write_key_der, METH_VARARGS, NULL},
	 { "dsa_new", _wrap_dsa_new, METH_NOARGS, NULL},
	 { "dsa_free", _wrap_dsa_free, METH_O, NULL},
	 { "dsa_size", _wrap_dsa_size, METH_O, NULL},
	 { "dsa_gen_key", _wrap_dsa_gen_key, METH_O, NULL},
	 { "dsa_init", _wrap_dsa_init, METH_O, NULL},
	 { "dsa_generate_parameters", _wrap_dsa_generate_parameters, METH_VARARGS, NULL},
	 { "dsa_read_params", _wrap_dsa_read_params, METH_VARARGS, NULL},
	 { "dsa_read_key", _wrap_dsa_read_key, METH_VARARGS, NULL},
	 { "dsa_read_pub_key", _wrap_dsa_read_pub_key, METH_VARARGS, NULL},
	 { "dsa_get_p", _wrap_dsa_get_p, METH_O, NULL},
	 { "dsa_get_q", _wrap_dsa_get_q, METH_O, NULL},
	 { "dsa_get_g", _wrap_dsa_get_g, METH_O, NULL},
	 { "dsa_get_pub", _wrap_dsa_get_pub, METH_O, NULL},
	 { "dsa_get_priv", _wrap_dsa_get_priv, METH_O, NULL},
	 { "dsa_set_pqg", _wrap_dsa_set_pqg, METH_VARARGS, NULL},
	 { "dsa_set_pub", _wrap_dsa_set_pub, METH_VARARGS, NULL},
	 { "dsa_write_params_bio", _wrap_dsa_write_params_bio, METH_VARARGS, NULL},
	 { "dsa_write_key_bio", _wrap_dsa_write_key_bio, METH_VARARGS, NULL},
	 { "dsa_write_key_bio_no_cipher", _wrap_dsa_write_key_bio_no_cipher, METH_VARARGS, NULL},
	 { "dsa_write_pub_key_bio", _wrap_dsa_write_pub_key_bio, METH_VARARGS, NULL},
	 { "dsa_sign", _wrap_dsa_sign, METH_VARARGS, NULL},
	 { "dsa_verify", _wrap_dsa_verify, METH_VARARGS, NULL},
	 { "dsa_sign_asn1", _wrap_dsa_sign_asn1, METH_VARARGS, NULL},
	 { "dsa_verify_asn1", _wrap_dsa_verify_asn1, METH_VARARGS, NULL},
	 { "dsa_check_key", _wrap_dsa_check_key, METH_O, NULL},
	 { "dsa_check_pub_key", _wrap_dsa_check_pub_key, METH_O, NULL},
	 { "dsa_keylen", _wrap_dsa_keylen, METH_O, NULL},
	 { "dsa_type_check", _wrap_dsa_type_check, METH_O, NULL},
	 { "ssl_get_ciphers", _wrap_ssl_get_ciphers, METH_O, NULL},
	 { "ssl_get_version", _wrap_ssl_get_version, METH_O, NULL},
	 { "ssl_get_error", _wrap_ssl_get_error, METH_VARARGS, NULL},
	 { "ssl_get_state", _wrap_ssl_get_state, METH_O, NULL},
	 { "ssl_get_state_v", _wrap_ssl_get_state_v, METH_O, NULL},
	 { "ssl_get_alert_type", _wrap_ssl_get_alert_type, METH_O, NULL},
	 { "ssl_get_alert_type_v", _wrap_ssl_get_alert_type_v, METH_O, NULL},
	 { "ssl_get_alert_desc", _wrap_ssl_get_alert_desc, METH_O, NULL},
	 { "ssl_get_alert_desc_v", _wrap_ssl_get_alert_desc_v, METH_O, NULL},
	 { "sslv23_method", _wrap_sslv23_method, METH_NOARGS, NULL},
	 { "ssl_ctx_new", _wrap_ssl_ctx_new, METH_O, NULL},
	 { "ssl_ctx_free", _wrap_ssl_ctx_free, METH_O, NULL},
	 { "ssl_ctx_set_verify_depth", _wrap_ssl_ctx_set_verify_depth, METH_VARARGS, NULL},
	 { "ssl_ctx_get_verify_depth", _wrap_ssl_ctx_get_verify_depth, METH_O, NULL},
	 { "ssl_ctx_get_verify_mode", _wrap_ssl_ctx_get_verify_mode, METH_O, NULL},
	 { "ssl_ctx_set_cipher_list", _wrap_ssl_ctx_set_cipher_list, METH_VARARGS, NULL},
	 { "ssl_ctx_add_session", _wrap_ssl_ctx_add_session, METH_VARARGS, NULL},
	 { "ssl_ctx_remove_session", _wrap_ssl_ctx_remove_session, METH_VARARGS, NULL},
	 { "ssl_ctx_set_session_timeout", _wrap_ssl_ctx_set_session_timeout, METH_VARARGS, NULL},
	 { "ssl_ctx_get_session_timeout", _wrap_ssl_ctx_get_session_timeout, METH_O, NULL},
	 { "ssl_ctx_get_cert_store", _wrap_ssl_ctx_get_cert_store, METH_O, NULL},
	 { "ssl_ctx_set_default_verify_paths", _wrap_ssl_ctx_set_default_verify_paths, METH_O, NULL},
	 { "ssl_get_ex_data_x509_store_ctx_idx", _wrap_ssl_get_ex_data_x509_store_ctx_idx, METH_NOARGS, NULL},
	 { "bio_new_ssl", _wrap_bio_new_ssl, METH_VARARGS, NULL},
	 { "ssl_new", _wrap_ssl_new, METH_O, NULL},
	 { "ssl_free", _wrap_ssl_free, METH_O, NULL},
	 { "ssl_dup", _wrap_ssl_dup, METH_O, NULL},
	 { "ssl_set_bio", _wrap_ssl_set_bio, METH_VARARGS, NULL},
	 { "ssl_set_accept_state", _wrap_ssl_set_accept_state, METH_O, NULL},
	 { "ssl_set_connect_state", _wrap_ssl_set_connect_state, METH_O, NULL},
	 { "ssl_get_shutdown", _wrap_ssl_get_shutdown, METH_O, NULL},
	 { "ssl_set_shutdown", _wrap_ssl_set_shutdown, METH_VARARGS, NULL},
	 { "ssl_shutdown", _wrap_ssl_shutdown, METH_O, NULL},
	 { "ssl_clear", _wrap_ssl_clear, METH_O, NULL},
	 { "ssl_do_handshake", _wrap_ssl_do_handshake, METH_O, NULL},
	 { "ssl_renegotiate", _wrap_ssl_renegotiate, METH_O, NULL},
	 { "ssl_pending", _wrap_ssl_pending, METH_O, NULL},
	 { "ssl_get_peer_cert", _wrap_ssl_get_peer_cert, METH_O, NULL},
	 { "ssl_get_current_cipher", _wrap_ssl_get_current_cipher, METH_O, NULL},
	 { "ssl_get_verify_mode", _wrap_ssl_get_verify_mode, METH_O, NULL},
	 { "ssl_get_verify_depth", _wrap_ssl_get_verify_depth, METH_O, NULL},
	 { "ssl_get_verify_result", _wrap_ssl_get_verify_result, METH_O, NULL},
	 { "ssl_get_ssl_ctx", _wrap_ssl_get_ssl_ctx, METH_O, NULL},
	 { "ssl_get_default_session_timeout", _wrap_ssl_get_default_session_timeout, METH_O, NULL},
	 { "ssl_set_cipher_list", _wrap_ssl_set_cipher_list, METH_VARARGS, NULL},
	 { "ssl_get_cipher_list", _wrap_ssl_get_cipher_list, METH_VARARGS, NULL},
	 { "ssl_cipher_get_name", _wrap_ssl_cipher_get_name, METH_O, NULL},
	 { "ssl_cipher_get_version", _wrap_ssl_cipher_get_version, METH_O, NULL},
	 { "ssl_get_session", _wrap_ssl_get_session, METH_O, NULL},
	 { "ssl_get1_session", _wrap_ssl_get1_session, METH_O, NULL},
	 { "ssl_set_session", _wrap_ssl_set_session, METH_VARARGS, NULL},
	 { "ssl_session_free", _wrap_ssl_session_free, METH_O, NULL},
	 { "ssl_session_print", _wrap_ssl_session_print, METH_VARARGS, NULL},
	 { "ssl_session_set_timeout", _wrap_ssl_session_set_timeout, METH_VARARGS, NULL},
	 { "ssl_session_get_timeout", _wrap_ssl_session_get_timeout, METH_O, NULL},
	 { "ssl_accept", _wrap_ssl_accept, METH_VARARGS, NULL},
	 { "ssl_connect", _wrap_ssl_connect, METH_VARARGS, NULL},
	 { "ssl_read", _wrap_ssl_read, METH_VARARGS, NULL},
	 { "ssl_write", _wrap_ssl_write, METH_VARARGS, NULL},
	 { "ssl_init", _wrap_ssl_init, METH_VARARGS, NULL},
	 { "tlsv1_method", _wrap_tlsv1_method, METH_NOARGS, NULL},
	 { "ssl_ctx_passphrase_callback", _wrap_ssl_ctx_passphrase_callback, METH_VARARGS, NULL},
	 { "ssl_ctx_use_x509", _wrap_ssl_ctx_use_x509, METH_VARARGS, NULL},
	 { "ssl_ctx_use_cert", _wrap_ssl_ctx_use_cert, METH_VARARGS, NULL},
	 { "ssl_ctx_use_cert_chain", _wrap_ssl_ctx_use_cert_chain, METH_VARARGS, NULL},
	 { "ssl_ctx_use_privkey", _wrap_ssl_ctx_use_privkey, METH_VARARGS, NULL},
	 { "ssl_ctx_use_rsa_privkey", _wrap_ssl_ctx_use_rsa_privkey, METH_VARARGS, NULL},
	 { "ssl_ctx_use_pkey_privkey", _wrap_ssl_ctx_use_pkey_privkey, METH_VARARGS, NULL},
	 { "ssl_ctx_check_privkey", _wrap_ssl_ctx_check_privkey, METH_O, NULL},
	 { "ssl_ctx_set_client_CA_list_from_file", _wrap_ssl_ctx_set_client_CA_list_from_file, METH_VARARGS, NULL},
	 { "ssl_ctx_set_verify_default", _wrap_ssl_ctx_set_verify_default, METH_VARARGS, NULL},
	 { "ssl_ctx_set_verify", _wrap_ssl_ctx_set_verify, METH_VARARGS, NULL},
	 { "ssl_ctx_set_session_id_context", _wrap_ssl_ctx_set_session_id_context, METH_VARARGS, NULL},
	 { "ssl_ctx_set_info_callback", _wrap_ssl_ctx_set_info_callback, METH_VARARGS, NULL},
	 { "ssl_ctx_set_tmp_dh", _wrap_ssl_ctx_set_tmp_dh, METH_VARARGS, NULL},
	 { "ssl_ctx_set_tmp_dh_callback", _wrap_ssl_ctx_set_tmp_dh_callback, METH_VARARGS, NULL},
	 { "ssl_ctx_set_tmp_rsa", _wrap_ssl_ctx_set_tmp_rsa, METH_VARARGS, NULL},
	 { "ssl_ctx_set_tmp_rsa_callback", _wrap_ssl_ctx_set_tmp_rsa_callback, METH_VARARGS, NULL},
	 { "ssl_ctx_load_verify_locations", _wrap_ssl_ctx_load_verify_locations, METH_VARARGS, NULL},
	 { "ssl_ctx_set_options", _wrap_ssl_ctx_set_options, METH_VARARGS, NULL},
	 { "bio_set_ssl", _wrap_bio_set_ssl, METH_VARARGS, NULL},
	 { "ssl_set_mode", _wrap_ssl_set_mode, METH_VARARGS, NULL},
	 { "ssl_get_mode", _wrap_ssl_get_mode, METH_O, NULL},
	 { "ssl_set_tlsext_host_name", _wrap_ssl_set_tlsext_host_name, METH_VARARGS, NULL},
	 { "ssl_set_client_CA_list_from_file", _wrap_ssl_set_client_CA_list_from_file, METH_VARARGS, NULL},
	 { "ssl_set_client_CA_list_from_context", _wrap_ssl_set_client_CA_list_from_context, METH_VARARGS, NULL},
	 { "ssl_set_session_id_context", _wrap_ssl_set_session_id_context, METH_VARARGS, NULL},
	 { "ssl_set_fd", _wrap_ssl_set_fd, METH_VARARGS, NULL},
	 { "ssl_set_shutdown1", _wrap_ssl_set_shutdown1, METH_VARARGS, NULL},
	 { "ssl_read_nbio", _wrap_ssl_read_nbio, METH_VARARGS, NULL},
	 { "ssl_write_nbio", _wrap_ssl_write_nbio, METH_VARARGS, NULL},
	 { "ssl_cipher_get_bits", _wrap_ssl_cipher_get_bits, METH_O, NULL},
	 { "sk_ssl_cipher_num", _wrap_sk_ssl_cipher_num, METH_O, NULL},
	 { "sk_ssl_cipher_value", _wrap_sk_ssl_cipher_value, METH_VARARGS, NULL},
	 { "ssl_get_peer_cert_chain", _wrap_ssl_get_peer_cert_chain, METH_O, NULL},
	 { "sk_x509_num", _wrap_sk_x509_num, METH_O, NULL},
	 { "sk_x509_value", _wrap_sk_x509_value, METH_VARARGS, NULL},
	 { "i2d_ssl_session", _wrap_i2d_ssl_session, METH_VARARGS, NULL},
	 { "ssl_session_read_pem", _wrap_ssl_session_read_pem, METH_O, NULL},
	 { "ssl_session_write_pem", _wrap_ssl_session_write_pem, METH_VARARGS, NULL},
	 { "ssl_ctx_set_session_cache_mode", _wrap_ssl_ctx_set_session_cache_mode, METH_VARARGS, NULL},
	 { "ssl_ctx_get_session_cache_mode", _wrap_ssl_ctx_get_session_cache_mode, METH_O, NULL},
	 { "ssl_ctx_set_cache_size", _wrap_ssl_ctx_set_cache_size, METH_VARARGS, NULL},
	 { "ssl_is_init_finished", _wrap_ssl_is_init_finished, METH_O, NULL},
	 { "x509_check_ca", _wrap_x509_check_ca, METH_O, NULL},
	 { "x509_new", _wrap_x509_new, METH_NOARGS, NULL},
	 { "x509_dup", _wrap_x509_dup, METH_O, NULL},
	 { "x509_free", _wrap_x509_free, METH_O, NULL},
	 { "x509_crl_free", _wrap_x509_crl_free, METH_O, NULL},
	 { "x509_crl_new", _wrap_x509_crl_new, METH_NOARGS, NULL},
	 { "x509_print", _wrap_x509_print, METH_VARARGS, NULL},
	 { "x509_crl_print", _wrap_x509_crl_print, METH_VARARGS, NULL},
	 { "x509_get_serial_number", _wrap_x509_get_serial_number, METH_O, NULL},
	 { "x509_set_serial_number", _wrap_x509_set_serial_number, METH_VARARGS, NULL},
	 { "x509_get_pubkey", _wrap_x509_get_pubkey, METH_O, NULL},
	 { "x509_set_pubkey", _wrap_x509_set_pubkey, METH_VARARGS, NULL},
	 { "x509_get_issuer_name", _wrap_x509_get_issuer_name, METH_O, NULL},
	 { "x509_set_issuer_name", _wrap_x509_set_issuer_name, METH_VARARGS, NULL},
	 { "x509_get_subject_name", _wrap_x509_get_subject_name, METH_O, NULL},
	 { "x509_set_subject_name", _wrap_x509_set_subject_name, METH_VARARGS, NULL},
	 { "x509_cmp_current_time", _wrap_x509_cmp_current_time, METH_O, NULL},
	 { "x509_check_purpose", _wrap_x509_check_purpose, METH_VARARGS, NULL},
	 { "x509_check_trust", _wrap_x509_check_trust, METH_VARARGS, NULL},
	 { "x509_write_pem", _wrap_x509_write_pem, METH_VARARGS, NULL},
	 { "x509_write_pem_file", _wrap_x509_write_pem_file, METH_VARARGS, NULL},
	 { "x509_verify", _wrap_x509_verify, METH_VARARGS, NULL},
	 { "x509_get_verify_error", _wrap_x509_get_verify_error, METH_O, NULL},
	 { "x509_add_ext", _wrap_x509_add_ext, METH_VARARGS, NULL},
	 { "x509_get_ext_count", _wrap_x509_get_ext_count, METH_O, NULL},
	 { "x509_get_ext", _wrap_x509_get_ext, METH_VARARGS, NULL},
	 { "x509_ext_print", _wrap_x509_ext_print, METH_VARARGS, NULL},
	 { "x509_name_new", _wrap_x509_name_new, METH_NOARGS, NULL},
	 { "x509_name_free", _wrap_x509_name_free, METH_O, NULL},
	 { "x509_name_print", _wrap_x509_name_print, METH_VARARGS, NULL},
	 { "x509_name_get_entry", _wrap_x509_name_get_entry, METH_VARARGS, NULL},
	 { "x509_name_entry_count", _wrap_x509_name_entry_count, METH_O, NULL},
	 { "x509_name_delete_entry", _wrap_x509_name_delete_entry, METH_VARARGS, NULL},
	 { "x509_name_add_entry", _wrap_x509_name_add_entry, METH_VARARGS, NULL},
	 { "x509_name_add_entry_by_obj", _wrap_x509_name_add_entry_by_obj, METH_VARARGS, NULL},
	 { "x509_name_add_entry_by_nid", _wrap_x509_name_add_entry_by_nid, METH_VARARGS, NULL},
	 { "x509_name_print_ex", _wrap_x509_name_print_ex, METH_VARARGS, NULL},
	 { "x509_name_hash", _wrap_x509_name_hash, METH_O, NULL},
	 { "x509_name_get_index_by_nid", _wrap_x509_name_get_index_by_nid, METH_VARARGS, NULL},
	 { "x509_name_entry_new", _wrap_x509_name_entry_new, METH_NOARGS, NULL},
	 { "x509_name_entry_free", _wrap_x509_name_entry_free, METH_O, NULL},
	 { "x509_name_entry_create_by_nid", _wrap_x509_name_entry_create_by_nid, METH_VARARGS, NULL},
	 { "x509_name_entry_set_object", _wrap_x509_name_entry_set_object, METH_VARARGS, NULL},
	 { "x509_name_entry_get_object", _wrap_x509_name_entry_get_object, METH_O, NULL},
	 { "x509_name_entry_get_data", _wrap_x509_name_entry_get_data, METH_O, NULL},
	 { "x509_name_entry_set_data", _wrap_x509_name_entry_set_data, METH_VARARGS, NULL},
	 { "x509_req_new", _wrap_x509_req_new, METH_NOARGS, NULL},
	 { "x509_req_free", _wrap_x509_req_free, METH_O, NULL},
	 { "x509_req_print", _wrap_x509_req_print, METH_VARARGS, NULL},
	 { "x509_req_get_pubkey", _wrap_x509_req_get_pubkey, METH_O, NULL},
	 { "x509_req_set_pubkey", _wrap_x509_req_set_pubkey, METH_VARARGS, NULL},
	 { "x509_req_set_subject_name", _wrap_x509_req_set_subject_name, METH_VARARGS, NULL},
	 { "x509_req_verify", _wrap_x509_req_verify, METH_VARARGS, NULL},
	 { "x509_req_sign", _wrap_x509_req_sign, METH_VARARGS, NULL},
	 { "i2d_x509_bio", _wrap_i2d_x509_bio, METH_VARARGS, NULL},
	 { "i2d_x509_req_bio", _wrap_i2d_x509_req_bio, METH_VARARGS, NULL},
	 { "x509_store_new", _wrap_x509_store_new, METH_NOARGS, NULL},
	 { "x509_store_free", _wrap_x509_store_free, METH_O, NULL},
	 { "x509_store_add_cert", _wrap_x509_store_add_cert, METH_VARARGS, NULL},
	 { "x509_store_ctx_get_current_cert", _wrap_x509_store_ctx_get_current_cert, METH_O, NULL},
	 { "x509_store_ctx_get_error", _wrap_x509_store_ctx_get_error, METH_O, NULL},
	 { "x509_store_ctx_get_error_depth", _wrap_x509_store_ctx_get_error_depth, METH_O, NULL},
	 { "x509_store_ctx_free", _wrap_x509_store_ctx_free, METH_O, NULL},
	 { "x509_store_ctx_get1_chain", _wrap_x509_store_ctx_get1_chain, METH_O, NULL},
	 { "x509_extension_get_critical", _wrap_x509_extension_get_critical, METH_O, NULL},
	 { "x509_extension_set_critical", _wrap_x509_extension_set_critical, METH_VARARGS, NULL},
	 { "x509_store_set_flags", _wrap_x509_store_set_flags, METH_VARARGS, NULL},
	 { "x509_read_pem", _wrap_x509_read_pem, METH_O, NULL},
	 { "d2i_x509", _wrap_d2i_x509, METH_O, NULL},
	 { "x509_init", _wrap_x509_init, METH_O, NULL},
	 { "d2i_x509_req", _wrap_d2i_x509_req, METH_O, NULL},
	 { "x509_req_read_pem", _wrap_x509_req_read_pem, METH_O, NULL},
	 { "i2d_x509", _wrap_i2d_x509, METH_O, NULL},
	 { "x509_req_write_pem", _wrap_x509_req_write_pem, METH_VARARGS, NULL},
	 { "x509_crl_read_pem", _wrap_x509_crl_read_pem, METH_O, NULL},
	 { "x509_set_version", _wrap_x509_set_version, METH_VARARGS, NULL},
	 { "x509_get_version", _wrap_x509_get_version, METH_O, NULL},
	 { "x509_set_not_before", _wrap_x509_set_not_before, METH_VARARGS, NULL},
	 { "x509_get_not_before", _wrap_x509_get_not_before, METH_O, NULL},
	 { "x509_set_not_after", _wrap_x509_set_not_after, METH_VARARGS, NULL},
	 { "x509_get_not_after", _wrap_x509_get_not_after, METH_O, NULL},
	 { "x509_sign", _wrap_x509_sign, METH_VARARGS, NULL},
	 { "x509_gmtime_adj", _wrap_x509_gmtime_adj, METH_VARARGS, NULL},
	 { "x509_name_by_nid", _wrap_x509_name_by_nid, METH_VARARGS, NULL},
	 { "x509_name_set_by_nid", _wrap_x509_name_set_by_nid, METH_VARARGS, NULL},
	 { "x509_name_add_entry_by_txt", _wrap_x509_name_add_entry_by_txt, METH_VARARGS, NULL},
	 { "x509_name_get_der", _wrap_x509_name_get_der, METH_O, NULL},
	 { "sk_x509_free", _wrap_sk_x509_free, METH_O, NULL},
	 { "sk_x509_push", _wrap_sk_x509_push, METH_VARARGS, NULL},
	 { "sk_x509_pop", _wrap_sk_x509_pop, METH_O, NULL},
	 { "x509_store_load_locations", _wrap_x509_store_load_locations, METH_VARARGS, NULL},
	 { "x509_type_check", _wrap_x509_type_check, METH_O, NULL},
	 { "x509_name_type_check", _wrap_x509_name_type_check, METH_O, NULL},
	 { "x509_req_get_subject_name", _wrap_x509_req_get_subject_name, METH_O, NULL},
	 { "x509_req_get_version", _wrap_x509_req_get_version, METH_O, NULL},
	 { "x509_req_set_version", _wrap_x509_req_set_version, METH_VARARGS, NULL},
	 { "x509_req_add_extensions", _wrap_x509_req_add_extensions, METH_VARARGS, NULL},
	 { "x509_name_entry_create_by_txt", _wrap_x509_name_entry_create_by_txt, METH_VARARGS, NULL},
	 { "x509v3_set_nconf", _wrap_x509v3_set_nconf, METH_NOARGS, NULL},
	 { "x509v3_ext_conf", _wrap_x509v3_ext_conf, METH_VARARGS, NULL},
	 { "x509_extension_free", _wrap_x509_extension_free, METH_O, NULL},
	 { "x509_extension_get_name", _wrap_x509_extension_get_name, METH_O, NULL},
	 { "sk_x509_extension_new_null", _wrap_sk_x509_extension_new_null, METH_NOARGS, NULL},
	 { "sk_x509_extension_free", _wrap_sk_x509_extension_free, METH_O, NULL},
	 { "sk_x509_extension_push", _wrap_sk_x509_extension_push, METH_VARARGS, NULL},
	 { "sk_x509_extension_pop", _wrap_sk_x509_extension_pop, METH_O, NULL},
	 { "sk_x509_extension_num", _wrap_sk_x509_extension_num, METH_O, NULL},
	 { "sk_x509_extension_value", _wrap_sk_x509_extension_value, METH_VARARGS, NULL},
	 { "x509_store_ctx_get_app_data", _wrap_x509_store_ctx_get_app_data, METH_O, NULL},
	 { "x509_store_ctx_get_ex_data", _wrap_x509_store_ctx_get_ex_data, METH_VARARGS, NULL},
	 { "x509_store_set_verify_cb", _wrap_x509_store_set_verify_cb, METH_VARARGS, NULL},
	 { "make_stack_from_der_sequence", _wrap_make_stack_from_der_sequence, METH_O, NULL},
	 { "sk_x509_new_null", _wrap_sk_x509_new_null, METH_NOARGS, NULL},
	 { "get_der_encoding_stack", _wrap_get_der_encoding_stack, METH_O, NULL},
	 { "x509_name_oneline", _wrap_x509_name_oneline, METH_O, NULL},
	 { "asn1_object_new", _wrap_asn1_object_new, METH_NOARGS, NULL},
	 { "asn1_object_create", _wrap_asn1_object_create, METH_VARARGS, NULL},
	 { "asn1_object_free", _wrap_asn1_object_free, METH_O, NULL},
	 { "i2d_asn1_object", _wrap_i2d_asn1_object, METH_VARARGS, NULL},
	 { "d2i_asn1_object", _wrap_d2i_asn1_object, METH_VARARGS, NULL},
	 { "asn1_bit_string_new", _wrap_asn1_bit_string_new, METH_NOARGS, NULL},
	 { "asn1_string_new", _wrap_asn1_string_new, METH_NOARGS, NULL},
	 { "asn1_string_free", _wrap_asn1_string_free, METH_O, NULL},
	 { "asn1_string_set", _wrap_asn1_string_set, METH_VARARGS, NULL},
	 { "asn1_string_print", _wrap_asn1_string_print, METH_VARARGS, NULL},
	 { "asn1_string_print_ex", _wrap_asn1_string_print_ex, METH_VARARGS, NULL},
	 { "asn1_time_new", _wrap_asn1_time_new, METH_NOARGS, NULL},
	 { "asn1_time_free", _wrap_asn1_time_free, METH_O, NULL},
	 { "asn1_time_check", _wrap_asn1_time_check, METH_O, NULL},
	 { "asn1_time_set", _wrap_asn1_time_set, METH_VARARGS, NULL},
	 { "asn1_time_set_string", _wrap_asn1_time_set_string, METH_VARARGS, NULL},
	 { "asn1_time_print", _wrap_asn1_time_print, METH_VARARGS, NULL},
	 { "asn1_integer_new", _wrap_asn1_integer_new, METH_NOARGS, NULL},
	 { "asn1_integer_free", _wrap_asn1_integer_free, METH_O, NULL},
	 { "asn1_integer_cmp", _wrap_asn1_integer_cmp, METH_VARARGS, NULL},
	 { "asn1_time_type_check", _wrap_asn1_time_type_check, METH_O, NULL},
	 { "asn1_integer_get", _wrap_asn1_integer_get, METH_O, NULL},
	 { "asn1_integer_set", _wrap_asn1_integer_set, METH_VARARGS, NULL},
	 { "pkcs7_new", _wrap_pkcs7_new, METH_NOARGS, NULL},
	 { "pkcs7_free", _wrap_pkcs7_free, METH_O, NULL},
	 { "pkcs7_add_certificate", _wrap_pkcs7_add_certificate, METH_VARARGS, NULL},
	 { "pkcs7_init", _wrap_pkcs7_init, METH_O, NULL},
	 { "smime_init", _wrap_smime_init, METH_O, NULL},
	 { "pkcs7_decrypt", _wrap_pkcs7_decrypt, METH_VARARGS, NULL},
	 { "pkcs7_encrypt", _wrap_pkcs7_encrypt, METH_VARARGS, NULL},
	 { "pkcs7_sign1", _wrap_pkcs7_sign1, METH_VARARGS, NULL},
	 { "pkcs7_sign0", _wrap_pkcs7_sign0, METH_VARARGS, NULL},
	 { "pkcs7_read_bio", _wrap_pkcs7_read_bio, METH_O, NULL},
	 { "pkcs7_read_bio_der", _wrap_pkcs7_read_bio_der, METH_O, NULL},
	 { "pkcs7_verify1", _wrap_pkcs7_verify1, METH_VARARGS, NULL},
	 { "pkcs7_verify0", _wrap_pkcs7_verify0, METH_VARARGS, NULL},
	 { "smime_write_pkcs7_multi", _wrap_smime_write_pkcs7_multi, METH_VARARGS, NULL},
	 { "smime_write_pkcs7", _wrap_smime_write_pkcs7, METH_VARARGS, NULL},
	 { "smime_read_pkcs7", _wrap_smime_read_pkcs7, METH_O, NULL},
	 { "pkcs7_write_bio", _wrap_pkcs7_write_bio, METH_VARARGS, NULL},
	 { "pkcs7_write_bio_der", _wrap_pkcs7_write_bio_der, METH_VARARGS, NULL},
	 { "pkcs7_type_nid", _wrap_pkcs7_type_nid, METH_O, NULL},
	 { "pkcs7_type_sn", _wrap_pkcs7_type_sn, METH_O, NULL},
	 { "smime_crlf_copy", _wrap_smime_crlf_copy, METH_VARARGS, NULL},
	 { "pkcs7_get0_signers", _wrap_pkcs7_get0_signers, METH_VARARGS, NULL},
	 { "util_init", _wrap_util_init, METH_O, NULL},
	 { "util_hex_to_string", _wrap_util_hex_to_string, METH_O, NULL},
	 { "util_string_to_hex", _wrap_util_string_to_hex, METH_O, NULL},
	 { "ec_key_new", _wrap_ec_key_new, METH_NOARGS, NULL},
	 { "ec_key_free", _wrap_ec_key_free, METH_O, NULL},
	 { "ec_key_size", _wrap_ec_key_size, METH_O, NULL},
	 { "ec_key_gen_key", _wrap_ec_key_gen_key, METH_O, NULL},
	 { "ec_key_check_key", _wrap_ec_key_check_key, METH_O, NULL},
	 { "ec_init", _wrap_ec_init, METH_O, NULL},
	 { "ec_get_builtin_curves", _wrap_ec_get_builtin_curves, METH_NOARGS, NULL},
	 { "ec_key_new_by_curve_name", _wrap_ec_key_new_by_curve_name, METH_O, NULL},
	 { "ec_key_get_public_der", _wrap_ec_key_get_public_der, METH_O, NULL},
	 { "ec_key_get_public_key", _wrap_ec_key_get_public_key, METH_O, NULL},
	 { "ec_key_read_pubkey", _wrap_ec_key_read_pubkey, METH_O, NULL},
	 { "ec_key_write_pubkey", _wrap_ec_key_write_pubkey, METH_VARARGS, NULL},
	 { "ec_key_read_bio", _wrap_ec_key_read_bio, METH_VARARGS, NULL},
	 { "ec_key_write_bio", _wrap_ec_key_write_bio, METH_VARARGS, NULL},
	 { "ec_key_write_bio_no_cipher", _wrap_ec_key_write_bio_no_cipher, METH_VARARGS, NULL},
	 { "ecdsa_sig_get_r", _wrap_ecdsa_sig_get_r, METH_O, NULL},
	 { "ecdsa_sig_get_s", _wrap_ecdsa_sig_get_s, METH_O, NULL},
	 { "ecdsa_sign", _wrap_ecdsa_sign, METH_VARARGS, NULL},
	 { "ecdsa_verify", _wrap_ecdsa_verify, METH_VARARGS, NULL},
	 { "ecdsa_sign_asn1", _wrap_ecdsa_sign_asn1, METH_VARARGS, NULL},
	 { "ecdsa_verify_asn1", _wrap_ecdsa_verify_asn1, METH_VARARGS, NULL},
	 { "ecdh_compute_key", _wrap_ecdh_compute_key, METH_VARARGS, NULL},
	 { "ec_key_from_pubkey_der", _wrap_ec_key_from_pubkey_der, METH_O, NULL},
	 { "ec_key_from_pubkey_params", _wrap_ec_key_from_pubkey_params, METH_VARARGS, NULL},
	 { "ec_key_keylen", _wrap_ec_key_keylen, METH_O, NULL},
	 { "ec_key_type_check", _wrap_ec_key_type_check, METH_O, NULL},
	 { "engine_load_builtin_engines", _wrap_engine_load_builtin_engines, METH_NOARGS, NULL},
	 { "engine_load_dynamic", _wrap_engine_load_dynamic, METH_NOARGS, NULL},
	 { "engine_load_openssl", _wrap_engine_load_openssl, METH_NOARGS, NULL},
	 { "engine_cleanup", _wrap_engine_cleanup, METH_NOARGS, NULL},
	 { "engine_new", _wrap_engine_new, METH_NOARGS, NULL},
	 { "engine_by_id", _wrap_engine_by_id, METH_O, NULL},
	 { "engine_free", _wrap_engine_free, METH_O, NULL},
	 { "engine_init", _wrap_engine_init, METH_O, NULL},
	 { "engine_finish", _wrap_engine_finish, METH_O, NULL},
	 { "engine_get_id", _wrap_engine_get_id, METH_O, NULL},
	 { "engine_get_name", _wrap_engine_get_name, METH_O, NULL},
	 { "engine_ctrl_cmd_string", _wrap_engine_ctrl_cmd_string, METH_VARARGS, NULL},
	 { "ui_openssl", _wrap_ui_openssl, METH_NOARGS, NULL},
	 { "engine_pkcs11_data_new", _wrap_engine_pkcs11_data_new, METH_O, NULL},
	 { "engine_pkcs11_data_free", _wrap_engine_pkcs11_data_free, METH_O, NULL},
	 { "engine_load_private_key", _wrap_engine_load_private_key, METH_VARARGS, NULL},
	 { "engine_load_public_key", _wrap_engine_load_public_key, METH_VARARGS, NULL},
	 { "engine_init_error", _wrap_engine_init_error, METH_O, NULL},
	 { "engine_load_certificate", _wrap_engine_load_certificate, METH_VARARGS, NULL},
	 { "engine_set_default", _wrap_engine_set_default, METH_VARARGS, NULL},
	 { "obj_nid2obj", _wrap_obj_nid2obj, METH_O, NULL},
	 { "obj_nid2ln", _wrap_obj_nid2ln, METH_O, NULL},
	 { "obj_nid2sn", _wrap_obj_nid2sn, METH_O, NULL},
	 { "obj_obj2nid", _wrap_obj_obj2nid, METH_O, NULL},
	 { "obj_ln2nid", _wrap_obj_ln2nid, METH_O, NULL},
	 { "obj_sn2nid", _wrap_obj_sn2nid, METH_O, NULL},
	 { "obj_txt2nid", _wrap_obj_txt2nid, METH_O, NULL},
	 { "obj_txt2obj", _wrap_obj_txt2obj, METH_VARARGS, NULL},
	 { "_obj_obj2txt", _wrap__obj_obj2txt, METH_VARARGS, NULL},
	 { "obj_obj2txt", _wrap_obj_obj2txt, METH_VARARGS, NULL},
	 { NULL, NULL, 0, NULL }
};

static PyMethodDef SwigMethods_proxydocs[] = {
	 { NULL, NULL, 0, NULL }
};

static SwigPyGetSet BIO_PYFD_CTX___dict___getset = { SwigPyObject_get___dict__, 0 };
static SwigPyGetSet BIO_PYFD_CTX_fd_getset = { _wrap_BIO_PYFD_CTX_fd_get, _wrap_BIO_PYFD_CTX_fd_set };
SWIGINTERN PyGetSetDef SwigPyBuiltin__pyfd_struct_getset[] = {
    { (char *)"__dict__", SwigPyBuiltin_FunpackGetterClosure, 0, (char *)"", &BIO_PYFD_CTX___dict___getset },
    { (char *)"fd", SwigPyBuiltin_FunpackGetterClosure, SwigPyBuiltin_FunpackSetterClosure, (char *)"", &BIO_PYFD_CTX_fd_getset },
    { NULL, NULL, NULL, NULL, NULL } /* Sentinel */
};

SWIGINTERN PyObject *
SwigPyBuiltin__pyfd_struct_richcompare(PyObject *self, PyObject *other, int op) {
  PyObject *result = NULL;
  if (!result) {
    if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) {
      result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op);
    } else {
      result = Py_NotImplemented;
      Py_INCREF(result);
    }
  }
  return result;
}

SWIGINTERN PyMethodDef SwigPyBuiltin__pyfd_struct_methods[] = {
  { NULL, NULL, 0, NULL } /* Sentinel */
};

static PyHeapTypeObject SwigPyBuiltin__pyfd_struct_type = {
  {
#if PY_VERSION_HEX >= 0x03000000
    PyVarObject_HEAD_INIT(NULL, 0)
#else
    PyObject_HEAD_INIT(NULL)
    0,                                        /* ob_size */
#endif
    "m2crypto.BIO_PYFD_CTX",                  /* tp_name */
    sizeof(SwigPyObject),                     /* tp_basicsize */
    0,                                        /* tp_itemsize */
    _wrap_delete_BIO_PYFD_CTX_destructor_closure,                 /* tp_dealloc */
    (printfunc) 0,                            /* tp_print */
    (getattrfunc) 0,                          /* tp_getattr */
    (setattrfunc) 0,                          /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
    0,                                        /* tp_compare */
#else
    (cmpfunc) 0,                              /* tp_compare */
#endif
    (reprfunc) 0,                             /* tp_repr */
    &SwigPyBuiltin__pyfd_struct_type.as_number,                   /* tp_as_number */
    &SwigPyBuiltin__pyfd_struct_type.as_sequence,                 /* tp_as_sequence */
    &SwigPyBuiltin__pyfd_struct_type.as_mapping,                  /* tp_as_mapping */
    SwigPyObject_hash,                        /* tp_hash */
    (ternaryfunc) 0,                          /* tp_call */
    (reprfunc) 0,                             /* tp_str */
    (getattrofunc) 0,                         /* tp_getattro */
    (setattrofunc) 0,                         /* tp_setattro */
    &SwigPyBuiltin__pyfd_struct_type.as_buffer,                   /* tp_as_buffer */
#if PY_VERSION_HEX >= 0x03000000
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,   /* tp_flags */
#else
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#endif
    "::pyfd_struct",                          /* tp_doc */
    (traverseproc) 0,                         /* tp_traverse */
    (inquiry) 0,                              /* tp_clear */
    SwigPyBuiltin__pyfd_struct_richcompare,   /* tp_richcompare */
    0,                                        /* tp_weaklistoffset */
    (getiterfunc) 0,                          /* tp_iter */
    (iternextfunc) 0,                         /* tp_iternext */
    SwigPyBuiltin__pyfd_struct_methods,       /* tp_methods */
    0,                                        /* tp_members */
    SwigPyBuiltin__pyfd_struct_getset,        /* tp_getset */
    0,                                        /* tp_base */
    0,                                        /* tp_dict */
    (descrgetfunc) 0,                         /* tp_descr_get */
    (descrsetfunc) 0,                         /* tp_descr_set */
    offsetof(SwigPyObject, dict),             /* tp_dictoffset */
    _wrap_new_BIO_PYFD_CTX,                   /* tp_init */
    (allocfunc) 0,                            /* tp_alloc */
    (newfunc) 0,                              /* tp_new */
    (freefunc) 0,                             /* tp_free */
    (inquiry) 0,                              /* tp_is_gc */
    (PyObject *) 0,                           /* tp_bases */
    (PyObject *) 0,                           /* tp_mro */
    (PyObject *) 0,                           /* tp_cache */
    (PyObject *) 0,                           /* tp_subclasses */
    (PyObject *) 0,                           /* tp_weaklist */
    (destructor) 0,                           /* tp_del */
    (int) 0,                                  /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
    (destructor) 0,                           /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
    (vectorcallfunc) 0,                       /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
    0,                                        /* tp_print */
#endif
#ifdef COUNT_ALLOCS
    (Py_ssize_t) 0,                           /* tp_allocs */
    (Py_ssize_t) 0,                           /* tp_frees */
    (Py_ssize_t) 0,                           /* tp_maxalloc */
    0,                                        /* tp_prev */
    0,                                        /* tp_next */
#endif
  },
#if PY_VERSION_HEX >= 0x03050000
  {
    (unaryfunc) 0,                            /* am_await */
    (unaryfunc) 0,                            /* am_aiter */
    (unaryfunc) 0,                            /* am_anext */
  },
#endif
  {
    (binaryfunc) 0,                           /* nb_add */
    (binaryfunc) 0,                           /* nb_subtract */
    (binaryfunc) 0,                           /* nb_multiply */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc) 0,                           /* nb_divide */
#endif
    (binaryfunc) 0,                           /* nb_remainder */
    (binaryfunc) 0,                           /* nb_divmod */
    (ternaryfunc) 0,                          /* nb_power */
    (unaryfunc) 0,                            /* nb_negative */
    (unaryfunc) 0,                            /* nb_positive */
    (unaryfunc) 0,                            /* nb_absolute */
    (inquiry) 0,                              /* nb_nonzero */
    (unaryfunc) 0,                            /* nb_invert */
    (binaryfunc) 0,                           /* nb_lshift */
    (binaryfunc) 0,                           /* nb_rshift */
    (binaryfunc) 0,                           /* nb_and */
    (binaryfunc) 0,                           /* nb_xor */
    (binaryfunc) 0,                           /* nb_or */
#if PY_VERSION_HEX < 0x03000000
    (coercion) 0,                             /* nb_coerce */
#endif
    (unaryfunc) 0,                            /* nb_int */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* nb_reserved */
#else
    (unaryfunc) 0,                            /* nb_long */
#endif
    (unaryfunc) 0,                            /* nb_float */
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc) 0,                            /* nb_oct */
    (unaryfunc) 0,                            /* nb_hex */
#endif
    (binaryfunc) 0,                           /* nb_inplace_add */
    (binaryfunc) 0,                           /* nb_inplace_subtract */
    (binaryfunc) 0,                           /* nb_inplace_multiply */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc) 0,                           /* nb_inplace_divide */
#endif
    (binaryfunc) 0,                           /* nb_inplace_remainder */
    (ternaryfunc) 0,                          /* nb_inplace_power */
    (binaryfunc) 0,                           /* nb_inplace_lshift */
    (binaryfunc) 0,                           /* nb_inplace_rshift */
    (binaryfunc) 0,                           /* nb_inplace_and */
    (binaryfunc) 0,                           /* nb_inplace_xor */
    (binaryfunc) 0,                           /* nb_inplace_or */
    (binaryfunc) 0,                           /* nb_floor_divide */
    (binaryfunc) 0,                           /* nb_true_divide */
    (binaryfunc) 0,                           /* nb_inplace_floor_divide */
    (binaryfunc) 0,                           /* nb_inplace_true_divide */
    (unaryfunc) 0,                            /* nb_index */
#if PY_VERSION_HEX >= 0x03050000
    (binaryfunc) 0,                           /* nb_matrix_multiply */
    (binaryfunc) 0,                           /* nb_inplace_matrix_multiply */
#endif
  },
  {
    (lenfunc) 0,                              /* mp_length */
    (binaryfunc) 0,                           /* mp_subscript */
    (objobjargproc) 0,                        /* mp_ass_subscript */
  },
  {
    (lenfunc) 0,                              /* sq_length */
    (binaryfunc) 0,                           /* sq_concat */
    (ssizeargfunc) 0,                         /* sq_repeat */
    (ssizeargfunc) 0,                         /* sq_item */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* was_sq_slice */
#else
    (ssizessizeargfunc) 0,                    /* sq_slice */
#endif
    (ssizeobjargproc) 0,                      /* sq_ass_item */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* was_sq_ass_slice */
#else
    (ssizessizeobjargproc) 0,                 /* sq_ass_slice */
#endif
    (objobjproc) 0,                           /* sq_contains */
    (binaryfunc) 0,                           /* sq_inplace_concat */
    (ssizeargfunc) 0,                         /* sq_inplace_repeat */
  },
  {
#if PY_VERSION_HEX < 0x03000000
    (readbufferproc) 0,                       /* bf_getreadbuffer */
    (writebufferproc) 0,                      /* bf_getwritebuffer */
    (segcountproc) 0,                         /* bf_getsegcount */
    (charbufferproc) 0,                       /* bf_getcharbuffer */
#endif
    (getbufferproc) 0,                        /* bf_getbuffer */
    (releasebufferproc) 0,                    /* bf_releasebuffer */
  },
    (PyObject *) 0,                           /* ht_name */
    (PyObject *) 0,                           /* ht_slots */
#if PY_VERSION_HEX >= 0x03030000
    (PyObject *) 0,                           /* ht_qualname */
    0,                                        /* ht_cached_keys */
#endif
};

SWIGINTERN SwigPyClientData SwigPyBuiltin__pyfd_struct_clientdata = {0, 0, 0, 0, 0, 0, (PyTypeObject *)&SwigPyBuiltin__pyfd_struct_type};

static SwigPyGetSet _cbd_t___dict___getset = { SwigPyObject_get___dict__, 0 };
static SwigPyGetSet _cbd_t_password_getset = { _wrap__cbd_t_password_get, _wrap__cbd_t_password_set };
static SwigPyGetSet _cbd_t_prompt_getset = { _wrap__cbd_t_prompt_get, _wrap__cbd_t_prompt_set };
SWIGINTERN PyGetSetDef SwigPyBuiltin___cbd_t_getset[] = {
    { (char *)"__dict__", SwigPyBuiltin_FunpackGetterClosure, 0, (char *)"", &_cbd_t___dict___getset },
    { (char *)"password", SwigPyBuiltin_FunpackGetterClosure, SwigPyBuiltin_FunpackSetterClosure, (char *)"", &_cbd_t_password_getset },
    { (char *)"prompt", SwigPyBuiltin_FunpackGetterClosure, SwigPyBuiltin_FunpackSetterClosure, (char *)"", &_cbd_t_prompt_getset },
    { NULL, NULL, NULL, NULL, NULL } /* Sentinel */
};

SWIGINTERN PyObject *
SwigPyBuiltin___cbd_t_richcompare(PyObject *self, PyObject *other, int op) {
  PyObject *result = NULL;
  if (!result) {
    if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) {
      result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op);
    } else {
      result = Py_NotImplemented;
      Py_INCREF(result);
    }
  }
  return result;
}

SWIGINTERN PyMethodDef SwigPyBuiltin___cbd_t_methods[] = {
  { NULL, NULL, 0, NULL } /* Sentinel */
};

static PyHeapTypeObject SwigPyBuiltin___cbd_t_type = {
  {
#if PY_VERSION_HEX >= 0x03000000
    PyVarObject_HEAD_INIT(NULL, 0)
#else
    PyObject_HEAD_INIT(NULL)
    0,                                        /* ob_size */
#endif
    "m2crypto._cbd_t",                        /* tp_name */
    sizeof(SwigPyObject),                     /* tp_basicsize */
    0,                                        /* tp_itemsize */
    _wrap_delete__cbd_t_destructor_closure,   /* tp_dealloc */
    (printfunc) 0,                            /* tp_print */
    (getattrfunc) 0,                          /* tp_getattr */
    (setattrfunc) 0,                          /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
    0,                                        /* tp_compare */
#else
    (cmpfunc) 0,                              /* tp_compare */
#endif
    (reprfunc) 0,                             /* tp_repr */
    &SwigPyBuiltin___cbd_t_type.as_number,    /* tp_as_number */
    &SwigPyBuiltin___cbd_t_type.as_sequence,  /* tp_as_sequence */
    &SwigPyBuiltin___cbd_t_type.as_mapping,   /* tp_as_mapping */
    SwigPyObject_hash,                        /* tp_hash */
    (ternaryfunc) 0,                          /* tp_call */
    (reprfunc) 0,                             /* tp_str */
    (getattrofunc) 0,                         /* tp_getattro */
    (setattrofunc) 0,                         /* tp_setattro */
    &SwigPyBuiltin___cbd_t_type.as_buffer,    /* tp_as_buffer */
#if PY_VERSION_HEX >= 0x03000000
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,   /* tp_flags */
#else
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES, /* tp_flags */
#endif
    "::_cbd_t",                               /* tp_doc */
    (traverseproc) 0,                         /* tp_traverse */
    (inquiry) 0,                              /* tp_clear */
    SwigPyBuiltin___cbd_t_richcompare,        /* tp_richcompare */
    0,                                        /* tp_weaklistoffset */
    (getiterfunc) 0,                          /* tp_iter */
    (iternextfunc) 0,                         /* tp_iternext */
    SwigPyBuiltin___cbd_t_methods,            /* tp_methods */
    0,                                        /* tp_members */
    SwigPyBuiltin___cbd_t_getset,             /* tp_getset */
    0,                                        /* tp_base */
    0,                                        /* tp_dict */
    (descrgetfunc) 0,                         /* tp_descr_get */
    (descrsetfunc) 0,                         /* tp_descr_set */
    offsetof(SwigPyObject, dict),             /* tp_dictoffset */
    _wrap_new__cbd_t,                         /* tp_init */
    (allocfunc) 0,                            /* tp_alloc */
    (newfunc) 0,                              /* tp_new */
    (freefunc) 0,                             /* tp_free */
    (inquiry) 0,                              /* tp_is_gc */
    (PyObject *) 0,                           /* tp_bases */
    (PyObject *) 0,                           /* tp_mro */
    (PyObject *) 0,                           /* tp_cache */
    (PyObject *) 0,                           /* tp_subclasses */
    (PyObject *) 0,                           /* tp_weaklist */
    (destructor) 0,                           /* tp_del */
    (int) 0,                                  /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
    (destructor) 0,                           /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
    (vectorcallfunc) 0,                       /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
    0,                                        /* tp_print */
#endif
#ifdef COUNT_ALLOCS
    (Py_ssize_t) 0,                           /* tp_allocs */
    (Py_ssize_t) 0,                           /* tp_frees */
    (Py_ssize_t) 0,                           /* tp_maxalloc */
    0,                                        /* tp_prev */
    0,                                        /* tp_next */
#endif
  },
#if PY_VERSION_HEX >= 0x03050000
  {
    (unaryfunc) 0,                            /* am_await */
    (unaryfunc) 0,                            /* am_aiter */
    (unaryfunc) 0,                            /* am_anext */
  },
#endif
  {
    (binaryfunc) 0,                           /* nb_add */
    (binaryfunc) 0,                           /* nb_subtract */
    (binaryfunc) 0,                           /* nb_multiply */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc) 0,                           /* nb_divide */
#endif
    (binaryfunc) 0,                           /* nb_remainder */
    (binaryfunc) 0,                           /* nb_divmod */
    (ternaryfunc) 0,                          /* nb_power */
    (unaryfunc) 0,                            /* nb_negative */
    (unaryfunc) 0,                            /* nb_positive */
    (unaryfunc) 0,                            /* nb_absolute */
    (inquiry) 0,                              /* nb_nonzero */
    (unaryfunc) 0,                            /* nb_invert */
    (binaryfunc) 0,                           /* nb_lshift */
    (binaryfunc) 0,                           /* nb_rshift */
    (binaryfunc) 0,                           /* nb_and */
    (binaryfunc) 0,                           /* nb_xor */
    (binaryfunc) 0,                           /* nb_or */
#if PY_VERSION_HEX < 0x03000000
    (coercion) 0,                             /* nb_coerce */
#endif
    (unaryfunc) 0,                            /* nb_int */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* nb_reserved */
#else
    (unaryfunc) 0,                            /* nb_long */
#endif
    (unaryfunc) 0,                            /* nb_float */
#if PY_VERSION_HEX < 0x03000000
    (unaryfunc) 0,                            /* nb_oct */
    (unaryfunc) 0,                            /* nb_hex */
#endif
    (binaryfunc) 0,                           /* nb_inplace_add */
    (binaryfunc) 0,                           /* nb_inplace_subtract */
    (binaryfunc) 0,                           /* nb_inplace_multiply */
#if PY_VERSION_HEX < 0x03000000
    (binaryfunc) 0,                           /* nb_inplace_divide */
#endif
    (binaryfunc) 0,                           /* nb_inplace_remainder */
    (ternaryfunc) 0,                          /* nb_inplace_power */
    (binaryfunc) 0,                           /* nb_inplace_lshift */
    (binaryfunc) 0,                           /* nb_inplace_rshift */
    (binaryfunc) 0,                           /* nb_inplace_and */
    (binaryfunc) 0,                           /* nb_inplace_xor */
    (binaryfunc) 0,                           /* nb_inplace_or */
    (binaryfunc) 0,                           /* nb_floor_divide */
    (binaryfunc) 0,                           /* nb_true_divide */
    (binaryfunc) 0,                           /* nb_inplace_floor_divide */
    (binaryfunc) 0,                           /* nb_inplace_true_divide */
    (unaryfunc) 0,                            /* nb_index */
#if PY_VERSION_HEX >= 0x03050000
    (binaryfunc) 0,                           /* nb_matrix_multiply */
    (binaryfunc) 0,                           /* nb_inplace_matrix_multiply */
#endif
  },
  {
    (lenfunc) 0,                              /* mp_length */
    (binaryfunc) 0,                           /* mp_subscript */
    (objobjargproc) 0,                        /* mp_ass_subscript */
  },
  {
    (lenfunc) 0,                              /* sq_length */
    (binaryfunc) 0,                           /* sq_concat */
    (ssizeargfunc) 0,                         /* sq_repeat */
    (ssizeargfunc) 0,                         /* sq_item */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* was_sq_slice */
#else
    (ssizessizeargfunc) 0,                    /* sq_slice */
#endif
    (ssizeobjargproc) 0,                      /* sq_ass_item */
#if PY_VERSION_HEX >= 0x03000000
    (void *) 0,                               /* was_sq_ass_slice */
#else
    (ssizessizeobjargproc) 0,                 /* sq_ass_slice */
#endif
    (objobjproc) 0,                           /* sq_contains */
    (binaryfunc) 0,                           /* sq_inplace_concat */
    (ssizeargfunc) 0,                         /* sq_inplace_repeat */
  },
  {
#if PY_VERSION_HEX < 0x03000000
    (readbufferproc) 0,                       /* bf_getreadbuffer */
    (writebufferproc) 0,                      /* bf_getwritebuffer */
    (segcountproc) 0,                         /* bf_getsegcount */
    (charbufferproc) 0,                       /* bf_getcharbuffer */
#endif
    (getbufferproc) 0,                        /* bf_getbuffer */
    (releasebufferproc) 0,                    /* bf_releasebuffer */
  },
    (PyObject *) 0,                           /* ht_name */
    (PyObject *) 0,                           /* ht_slots */
#if PY_VERSION_HEX >= 0x03030000
    (PyObject *) 0,                           /* ht_qualname */
    0,                                        /* ht_cached_keys */
#endif
};

SWIGINTERN SwigPyClientData SwigPyBuiltin___cbd_t_clientdata = {0, 0, 0, 0, 0, 0, (PyTypeObject *)&SwigPyBuiltin___cbd_t_type};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static swig_type_info _swigt__p_AES_KEY = {"_p_AES_KEY", "AES_KEY *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ASN1_BIT_STRING = {"_p_ASN1_BIT_STRING", "ASN1_BIT_STRING *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ASN1_INTEGER = {"_p_ASN1_INTEGER", "ASN1_INTEGER *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ASN1_OBJECT = {"_p_ASN1_OBJECT", "ASN1_OBJECT *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ASN1_STRING = {"_p_ASN1_STRING", "ASN1_STRING *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ASN1_TIME = {"_p_ASN1_TIME", "ASN1_TIME *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_BIGNUM = {"_p_BIGNUM", "BIGNUM *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_BIO = {"_p_BIO", "BIO *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_BIO_METHOD = {"_p_BIO_METHOD", "BIO_METHOD *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_DH = {"_p_DH", "DH *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_DSA = {"_p_DSA", "DSA *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ECDSA_SIG = {"_p_ECDSA_SIG", "ECDSA_SIG *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EC_KEY = {"_p_EC_KEY", "EC_KEY *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ENGINE = {"_p_ENGINE", "ENGINE *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EVP_CIPHER = {"_p_EVP_CIPHER", "EVP_CIPHER *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EVP_CIPHER_CTX = {"_p_EVP_CIPHER_CTX", "EVP_CIPHER_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EVP_MD = {"_p_EVP_MD", "EVP_MD *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EVP_MD_CTX = {"_p_EVP_MD_CTX", "EVP_MD_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_EVP_PKEY = {"_p_EVP_PKEY", "EVP_PKEY *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_FILE = {"_p_FILE", "FILE *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HMAC_CTX = {"_p_HMAC_CTX", "HMAC_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PKCS7 = {"_p_PKCS7", "PKCS7 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PyObject = {"_p_PyObject", "PyObject *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RC4_KEY = {"_p_RC4_KEY", "RC4_KEY *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RSA = {"_p_RSA", "RSA *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SSL = {"_p_SSL", "SSL *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SSL_CIPHER = {"_p_SSL_CIPHER", "SSL_CIPHER *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SSL_CTX = {"_p_SSL_CTX", "SSL_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SSL_METHOD = {"_p_SSL_METHOD", "SSL_METHOD *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SSL_SESSION = {"_p_SSL_SESSION", "SSL_SESSION *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SwigPyObject = {"_p_SwigPyObject", "SwigPyObject *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_UI_METHOD = {"_p_UI_METHOD", "UI_METHOD *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509 = {"_p_X509", "X509 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509V3_CTX = {"_p_X509V3_CTX", "X509V3_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_CRL = {"_p_X509_CRL", "X509_CRL *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_EXTENSION = {"_p_X509_EXTENSION", "X509_EXTENSION *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_NAME = {"_p_X509_NAME", "X509_NAME *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_NAME_ENTRY = {"_p_X509_NAME_ENTRY", "X509_NAME_ENTRY *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_REQ = {"_p_X509_REQ", "X509_REQ *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_STORE = {"_p_X509_STORE", "X509_STORE *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509_STORE_CTX = {"_p_X509_STORE_CTX", "X509_STORE_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INTMAX_TYPE__ = {"_p___INTMAX_TYPE__", "__INTMAX_TYPE__ *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_FAST16_TYPE__ = {"_p___INT_FAST16_TYPE__", "__INT_FAST16_TYPE__ *|int_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_FAST32_TYPE__ = {"_p___INT_FAST32_TYPE__", "__INT_FAST32_TYPE__ *|int_fast32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_FAST64_TYPE__ = {"_p___INT_FAST64_TYPE__", "__INT_FAST64_TYPE__ *|int_fast64_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_FAST8_TYPE__ = {"_p___INT_FAST8_TYPE__", "__INT_FAST8_TYPE__ *|int_fast8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_LEAST16_TYPE__ = {"_p___INT_LEAST16_TYPE__", "__INT_LEAST16_TYPE__ *|int_least16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_LEAST32_TYPE__ = {"_p___INT_LEAST32_TYPE__", "__INT_LEAST32_TYPE__ *|int_least32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_LEAST64_TYPE__ = {"_p___INT_LEAST64_TYPE__", "__INT_LEAST64_TYPE__ *|int_least64_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___INT_LEAST8_TYPE__ = {"_p___INT_LEAST8_TYPE__", "__INT_LEAST8_TYPE__ *|int_least8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINTMAX_TYPE__ = {"_p___UINTMAX_TYPE__", "__UINTMAX_TYPE__ *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_FAST16_TYPE__ = {"_p___UINT_FAST16_TYPE__", "__UINT_FAST16_TYPE__ *|uint_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_FAST32_TYPE__ = {"_p___UINT_FAST32_TYPE__", "__UINT_FAST32_TYPE__ *|uint_fast32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_FAST64_TYPE__ = {"_p___UINT_FAST64_TYPE__", "__UINT_FAST64_TYPE__ *|uint_fast64_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_FAST8_TYPE__ = {"_p___UINT_FAST8_TYPE__", "__UINT_FAST8_TYPE__ *|uint_fast8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_LEAST16_TYPE__ = {"_p___UINT_LEAST16_TYPE__", "__UINT_LEAST16_TYPE__ *|uint_least16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_LEAST32_TYPE__ = {"_p___UINT_LEAST32_TYPE__", "__UINT_LEAST32_TYPE__ *|uint_least32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_LEAST64_TYPE__ = {"_p___UINT_LEAST64_TYPE__", "__UINT_LEAST64_TYPE__ *|uint_least64_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p___UINT_LEAST8_TYPE__ = {"_p___UINT_LEAST8_TYPE__", "__UINT_LEAST8_TYPE__ *|uint_least8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p__cbd_t = {"_p__cbd_t", "_cbd_t *", 0, 0, (void*)&SwigPyBuiltin___cbd_t_clientdata, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_int_p_X509_STORE_CTX__int = {"_p_f_int_p_X509_STORE_CTX__int", "int (*)(int,X509_STORE_CTX *)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_char__void = {"_p_f_p_char__void", "void (*)(char *)|sk_OPENSSL_STRING_freefunc|sk_OPENSSL_CSTRING_freefunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_q_const__char__p_char = {"_p_f_p_q_const__char__p_char", "char *(*)(char const *)|sk_OPENSSL_STRING_copyfunc|sk_OPENSSL_CSTRING_copyfunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int = {"_p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int", "int (*)(char const *const *,char const *const *)|sk_OPENSSL_STRING_compfunc|sk_OPENSSL_CSTRING_compfunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int = {"_p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int", "int (*)(void const *const *,void const *const *)|sk_OPENSSL_BLOCK_compfunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_q_const__void__p_void = {"_p_f_p_q_const__void__p_void", "void *(*)(void const *)|OPENSSL_sk_copyfunc|sk_OPENSSL_BLOCK_copyfunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_q_const__void_p_q_const__void__int = {"_p_f_p_q_const__void_p_q_const__void__int", "int (*)(void const *,void const *)|OPENSSL_sk_compfunc", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_void__void = {"_p_f_p_void__void", "OPENSSL_sk_freefunc|sk_OPENSSL_BLOCK_freefunc|void (*)(void *)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_ASN1_OBJECT = {"_p_p_ASN1_OBJECT", "ASN1_OBJECT **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_EVP_PKEY_CTX = {"_p_p_EVP_PKEY_CTX", "EVP_PKEY_CTX **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_X509_NAME_ENTRY = {"_p_p_X509_NAME_ENTRY", "X509_NAME_ENTRY **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_unsigned_char = {"_p_p_unsigned_char", "unsigned char **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_pyfd_struct = {"_p_pyfd_struct", "BIO_PYFD_CTX *|struct pyfd_struct *|pyfd_struct *", 0, 0, (void*)&SwigPyBuiltin__pyfd_struct_clientdata, 0};
static swig_type_info _swigt__p_stack_st = {"_p_stack_st", "struct stack_st *|OPENSSL_STACK *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_OPENSSL_BLOCK = {"_p_stack_st_OPENSSL_BLOCK", "struct stack_st_OPENSSL_BLOCK *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_OPENSSL_CSTRING = {"_p_stack_st_OPENSSL_CSTRING", "struct stack_st_OPENSSL_CSTRING *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_OPENSSL_STRING = {"_p_stack_st_OPENSSL_STRING", "struct stack_st_OPENSSL_STRING *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_SSL_CIPHER = {"_p_stack_st_SSL_CIPHER", "struct stack_st_SSL_CIPHER *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_X509 = {"_p_stack_st_X509", "struct stack_st_X509 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_stack_st_X509_EXTENSION = {"_p_stack_st_X509_EXTENSION", "struct stack_st_X509_EXTENSION *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_AES_KEY,
  &_swigt__p_ASN1_BIT_STRING,
  &_swigt__p_ASN1_INTEGER,
  &_swigt__p_ASN1_OBJECT,
  &_swigt__p_ASN1_STRING,
  &_swigt__p_ASN1_TIME,
  &_swigt__p_BIGNUM,
  &_swigt__p_BIO,
  &_swigt__p_BIO_METHOD,
  &_swigt__p_DH,
  &_swigt__p_DSA,
  &_swigt__p_ECDSA_SIG,
  &_swigt__p_EC_KEY,
  &_swigt__p_ENGINE,
  &_swigt__p_EVP_CIPHER,
  &_swigt__p_EVP_CIPHER_CTX,
  &_swigt__p_EVP_MD,
  &_swigt__p_EVP_MD_CTX,
  &_swigt__p_EVP_PKEY,
  &_swigt__p_FILE,
  &_swigt__p_HMAC_CTX,
  &_swigt__p_PKCS7,
  &_swigt__p_PyObject,
  &_swigt__p_RC4_KEY,
  &_swigt__p_RSA,
  &_swigt__p_SSL,
  &_swigt__p_SSL_CIPHER,
  &_swigt__p_SSL_CTX,
  &_swigt__p_SSL_METHOD,
  &_swigt__p_SSL_SESSION,
  &_swigt__p_SwigPyObject,
  &_swigt__p_UI_METHOD,
  &_swigt__p_X509,
  &_swigt__p_X509V3_CTX,
  &_swigt__p_X509_CRL,
  &_swigt__p_X509_EXTENSION,
  &_swigt__p_X509_NAME,
  &_swigt__p_X509_NAME_ENTRY,
  &_swigt__p_X509_REQ,
  &_swigt__p_X509_STORE,
  &_swigt__p_X509_STORE_CTX,
  &_swigt__p___INTMAX_TYPE__,
  &_swigt__p___INT_FAST16_TYPE__,
  &_swigt__p___INT_FAST32_TYPE__,
  &_swigt__p___INT_FAST64_TYPE__,
  &_swigt__p___INT_FAST8_TYPE__,
  &_swigt__p___INT_LEAST16_TYPE__,
  &_swigt__p___INT_LEAST32_TYPE__,
  &_swigt__p___INT_LEAST64_TYPE__,
  &_swigt__p___INT_LEAST8_TYPE__,
  &_swigt__p___UINTMAX_TYPE__,
  &_swigt__p___UINT_FAST16_TYPE__,
  &_swigt__p___UINT_FAST32_TYPE__,
  &_swigt__p___UINT_FAST64_TYPE__,
  &_swigt__p___UINT_FAST8_TYPE__,
  &_swigt__p___UINT_LEAST16_TYPE__,
  &_swigt__p___UINT_LEAST32_TYPE__,
  &_swigt__p___UINT_LEAST64_TYPE__,
  &_swigt__p___UINT_LEAST8_TYPE__,
  &_swigt__p__cbd_t,
  &_swigt__p_char,
  &_swigt__p_f_int_p_X509_STORE_CTX__int,
  &_swigt__p_f_p_char__void,
  &_swigt__p_f_p_q_const__char__p_char,
  &_swigt__p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int,
  &_swigt__p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int,
  &_swigt__p_f_p_q_const__void__p_void,
  &_swigt__p_f_p_q_const__void_p_q_const__void__int,
  &_swigt__p_f_p_void__void,
  &_swigt__p_p_ASN1_OBJECT,
  &_swigt__p_p_EVP_PKEY_CTX,
  &_swigt__p_p_X509_NAME_ENTRY,
  &_swigt__p_p_unsigned_char,
  &_swigt__p_pyfd_struct,
  &_swigt__p_stack_st,
  &_swigt__p_stack_st_OPENSSL_BLOCK,
  &_swigt__p_stack_st_OPENSSL_CSTRING,
  &_swigt__p_stack_st_OPENSSL_STRING,
  &_swigt__p_stack_st_SSL_CIPHER,
  &_swigt__p_stack_st_X509,
  &_swigt__p_stack_st_X509_EXTENSION,
  &_swigt__p_unsigned_char,
  &_swigt__p_void,
};

static swig_cast_info _swigc__p_AES_KEY[] = {  {&_swigt__p_AES_KEY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ASN1_BIT_STRING[] = {  {&_swigt__p_ASN1_BIT_STRING, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ASN1_INTEGER[] = {  {&_swigt__p_ASN1_INTEGER, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ASN1_OBJECT[] = {  {&_swigt__p_ASN1_OBJECT, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ASN1_STRING[] = {  {&_swigt__p_ASN1_STRING, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ASN1_TIME[] = {  {&_swigt__p_ASN1_TIME, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_BIGNUM[] = {  {&_swigt__p_BIGNUM, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_BIO[] = {  {&_swigt__p_BIO, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_BIO_METHOD[] = {  {&_swigt__p_BIO_METHOD, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_DH[] = {  {&_swigt__p_DH, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_DSA[] = {  {&_swigt__p_DSA, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ECDSA_SIG[] = {  {&_swigt__p_ECDSA_SIG, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EC_KEY[] = {  {&_swigt__p_EC_KEY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ENGINE[] = {  {&_swigt__p_ENGINE, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EVP_CIPHER[] = {  {&_swigt__p_EVP_CIPHER, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EVP_CIPHER_CTX[] = {  {&_swigt__p_EVP_CIPHER_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EVP_MD[] = {  {&_swigt__p_EVP_MD, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EVP_MD_CTX[] = {  {&_swigt__p_EVP_MD_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_EVP_PKEY[] = {  {&_swigt__p_EVP_PKEY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_FILE[] = {  {&_swigt__p_FILE, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HMAC_CTX[] = {  {&_swigt__p_HMAC_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PKCS7[] = {  {&_swigt__p_PKCS7, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PyObject[] = {  {&_swigt__p_PyObject, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RC4_KEY[] = {  {&_swigt__p_RC4_KEY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RSA[] = {  {&_swigt__p_RSA, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SSL[] = {  {&_swigt__p_SSL, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SSL_CIPHER[] = {  {&_swigt__p_SSL_CIPHER, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SSL_CTX[] = {  {&_swigt__p_SSL_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SSL_METHOD[] = {  {&_swigt__p_SSL_METHOD, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SSL_SESSION[] = {  {&_swigt__p_SSL_SESSION, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SwigPyObject[] = {  {&_swigt__p_SwigPyObject, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_UI_METHOD[] = {  {&_swigt__p_UI_METHOD, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509[] = {  {&_swigt__p_X509, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509V3_CTX[] = {  {&_swigt__p_X509V3_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_CRL[] = {  {&_swigt__p_X509_CRL, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_EXTENSION[] = {  {&_swigt__p_X509_EXTENSION, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_NAME[] = {  {&_swigt__p_X509_NAME, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_NAME_ENTRY[] = {  {&_swigt__p_X509_NAME_ENTRY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_REQ[] = {  {&_swigt__p_X509_REQ, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_STORE[] = {  {&_swigt__p_X509_STORE, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509_STORE_CTX[] = {  {&_swigt__p_X509_STORE_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INTMAX_TYPE__[] = {  {&_swigt__p___INTMAX_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_FAST16_TYPE__[] = {  {&_swigt__p___INT_FAST16_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_FAST32_TYPE__[] = {  {&_swigt__p___INT_FAST32_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_FAST64_TYPE__[] = {  {&_swigt__p___INT_FAST64_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_FAST8_TYPE__[] = {  {&_swigt__p___INT_FAST8_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_LEAST16_TYPE__[] = {  {&_swigt__p___INT_LEAST16_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_LEAST32_TYPE__[] = {  {&_swigt__p___INT_LEAST32_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_LEAST64_TYPE__[] = {  {&_swigt__p___INT_LEAST64_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___INT_LEAST8_TYPE__[] = {  {&_swigt__p___INT_LEAST8_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINTMAX_TYPE__[] = {  {&_swigt__p___UINTMAX_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_FAST16_TYPE__[] = {  {&_swigt__p___UINT_FAST16_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_FAST32_TYPE__[] = {  {&_swigt__p___UINT_FAST32_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_FAST64_TYPE__[] = {  {&_swigt__p___UINT_FAST64_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_FAST8_TYPE__[] = {  {&_swigt__p___UINT_FAST8_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_LEAST16_TYPE__[] = {  {&_swigt__p___UINT_LEAST16_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_LEAST32_TYPE__[] = {  {&_swigt__p___UINT_LEAST32_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_LEAST64_TYPE__[] = {  {&_swigt__p___UINT_LEAST64_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p___UINT_LEAST8_TYPE__[] = {  {&_swigt__p___UINT_LEAST8_TYPE__, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p__cbd_t[] = {  {&_swigt__p__cbd_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_int_p_X509_STORE_CTX__int[] = {  {&_swigt__p_f_int_p_X509_STORE_CTX__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_char__void[] = {  {&_swigt__p_f_p_char__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_q_const__char__p_char[] = {  {&_swigt__p_f_p_q_const__char__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int[] = {  {&_swigt__p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int[] = {  {&_swigt__p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_q_const__void__p_void[] = {  {&_swigt__p_f_p_q_const__void__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_q_const__void_p_q_const__void__int[] = {  {&_swigt__p_f_p_q_const__void_p_q_const__void__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_void__void[] = {  {&_swigt__p_f_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_ASN1_OBJECT[] = {  {&_swigt__p_p_ASN1_OBJECT, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_EVP_PKEY_CTX[] = {  {&_swigt__p_p_EVP_PKEY_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_X509_NAME_ENTRY[] = {  {&_swigt__p_p_X509_NAME_ENTRY, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_unsigned_char[] = {  {&_swigt__p_p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_pyfd_struct[] = {  {&_swigt__p_pyfd_struct, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st[] = {  {&_swigt__p_stack_st, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_OPENSSL_BLOCK[] = {  {&_swigt__p_stack_st_OPENSSL_BLOCK, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_OPENSSL_CSTRING[] = {  {&_swigt__p_stack_st_OPENSSL_CSTRING, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_OPENSSL_STRING[] = {  {&_swigt__p_stack_st_OPENSSL_STRING, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_SSL_CIPHER[] = {  {&_swigt__p_stack_st_SSL_CIPHER, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_X509[] = {  {&_swigt__p_stack_st_X509, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_stack_st_X509_EXTENSION[] = {  {&_swigt__p_stack_st_X509_EXTENSION, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_AES_KEY,
  _swigc__p_ASN1_BIT_STRING,
  _swigc__p_ASN1_INTEGER,
  _swigc__p_ASN1_OBJECT,
  _swigc__p_ASN1_STRING,
  _swigc__p_ASN1_TIME,
  _swigc__p_BIGNUM,
  _swigc__p_BIO,
  _swigc__p_BIO_METHOD,
  _swigc__p_DH,
  _swigc__p_DSA,
  _swigc__p_ECDSA_SIG,
  _swigc__p_EC_KEY,
  _swigc__p_ENGINE,
  _swigc__p_EVP_CIPHER,
  _swigc__p_EVP_CIPHER_CTX,
  _swigc__p_EVP_MD,
  _swigc__p_EVP_MD_CTX,
  _swigc__p_EVP_PKEY,
  _swigc__p_FILE,
  _swigc__p_HMAC_CTX,
  _swigc__p_PKCS7,
  _swigc__p_PyObject,
  _swigc__p_RC4_KEY,
  _swigc__p_RSA,
  _swigc__p_SSL,
  _swigc__p_SSL_CIPHER,
  _swigc__p_SSL_CTX,
  _swigc__p_SSL_METHOD,
  _swigc__p_SSL_SESSION,
  _swigc__p_SwigPyObject,
  _swigc__p_UI_METHOD,
  _swigc__p_X509,
  _swigc__p_X509V3_CTX,
  _swigc__p_X509_CRL,
  _swigc__p_X509_EXTENSION,
  _swigc__p_X509_NAME,
  _swigc__p_X509_NAME_ENTRY,
  _swigc__p_X509_REQ,
  _swigc__p_X509_STORE,
  _swigc__p_X509_STORE_CTX,
  _swigc__p___INTMAX_TYPE__,
  _swigc__p___INT_FAST16_TYPE__,
  _swigc__p___INT_FAST32_TYPE__,
  _swigc__p___INT_FAST64_TYPE__,
  _swigc__p___INT_FAST8_TYPE__,
  _swigc__p___INT_LEAST16_TYPE__,
  _swigc__p___INT_LEAST32_TYPE__,
  _swigc__p___INT_LEAST64_TYPE__,
  _swigc__p___INT_LEAST8_TYPE__,
  _swigc__p___UINTMAX_TYPE__,
  _swigc__p___UINT_FAST16_TYPE__,
  _swigc__p___UINT_FAST32_TYPE__,
  _swigc__p___UINT_FAST64_TYPE__,
  _swigc__p___UINT_FAST8_TYPE__,
  _swigc__p___UINT_LEAST16_TYPE__,
  _swigc__p___UINT_LEAST32_TYPE__,
  _swigc__p___UINT_LEAST64_TYPE__,
  _swigc__p___UINT_LEAST8_TYPE__,
  _swigc__p__cbd_t,
  _swigc__p_char,
  _swigc__p_f_int_p_X509_STORE_CTX__int,
  _swigc__p_f_p_char__void,
  _swigc__p_f_p_q_const__char__p_char,
  _swigc__p_f_p_q_const__p_q_const__char_p_q_const__p_q_const__char__int,
  _swigc__p_f_p_q_const__p_q_const__void_p_q_const__p_q_const__void__int,
  _swigc__p_f_p_q_const__void__p_void,
  _swigc__p_f_p_q_const__void_p_q_const__void__int,
  _swigc__p_f_p_void__void,
  _swigc__p_p_ASN1_OBJECT,
  _swigc__p_p_EVP_PKEY_CTX,
  _swigc__p_p_X509_NAME_ENTRY,
  _swigc__p_p_unsigned_char,
  _swigc__p_pyfd_struct,
  _swigc__p_stack_st,
  _swigc__p_stack_st_OPENSSL_BLOCK,
  _swigc__p_stack_st_OPENSSL_CSTRING,
  _swigc__p_stack_st_OPENSSL_STRING,
  _swigc__p_stack_st_SSL_CIPHER,
  _swigc__p_stack_st_X509,
  _swigc__p_stack_st_X509_EXTENSION,
  _swigc__p_unsigned_char,
  _swigc__p_void,
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

static swig_const_info swig_const_table[] = {
{0, 0, 0, 0.0, 0, 0}};

#ifdef __cplusplus
}
#endif
static PyTypeObject *builtin_bases[2];

/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic
 * memory is used. Also, since swig_type_info structures store pointers to
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization.
 * The idea is that swig generates all the structures that are needed.
 * The runtime then collects these partially filled structures.
 * The SWIG_InitializeModule function takes these initial arrays out of
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned statically to an initial
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded.
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int init;
  
  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
    init = 1;
  } else {
    init = 0;
  }
  
  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    iter=module_head;
    do {
      if (iter==&swig_module) {
        /* Our module is already in the list, so there's nothing more to do. */
        return;
      }
      iter=iter->next;
    } while (iter!= module_head);
    
    /* otherwise we must add our module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }
  
  /* When multiple interpreters are used, a module could have already been initialized in
       a different interpreter, but not yet have a pointer in this interpreter.
       In this case, we do not want to continue adding types... everything should be
       set up already */
  if (init == 0) return;
  
  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
    
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
#endif
    
    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
        type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }
    
    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
        if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
          cast->type = ret;
          ret = 0;
        } else {
          /* Check for casting already in the list */
          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
          if (!ocast) ret = 0;
        }
      }
      
      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;
  
#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
    printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;
  
  if (init_run) return;
  init_run = 1;
  
  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{
  /* c-mode */
#endif
}
#endif



#ifdef __cplusplus
extern "C" {
#endif
  
  /* Python-specific SWIG API */
#define SWIG_newvarlink()                             SWIG_Python_newvarlink()
#define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
#define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
  
  /* -----------------------------------------------------------------------------
   * global variable support code.
   * ----------------------------------------------------------------------------- */
  
  typedef struct swig_globalvar {
    char       *name;                  /* Name of global variable */
    PyObject *(*get_attr)(void);       /* Return the current value */
    int       (*set_attr)(PyObject *); /* Set the value */
    struct swig_globalvar *next;
  } swig_globalvar;
  
  typedef struct swig_varlinkobject {
    PyObject_HEAD
    swig_globalvar *vars;
  } swig_varlinkobject;
  
  SWIGINTERN PyObject *
  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
#if PY_VERSION_HEX >= 0x03000000
    return PyUnicode_InternFromString("<Swig global variables>");
#else
    return PyString_FromString("<Swig global variables>");
#endif
  }
  
  SWIGINTERN PyObject *
  swig_varlink_str(swig_varlinkobject *v) {
#if PY_VERSION_HEX >= 0x03000000
    PyObject *str = PyUnicode_InternFromString("(");
    PyObject *tail;
    PyObject *joined;
    swig_globalvar *var;
    for (var = v->vars; var; var=var->next) {
      tail = PyUnicode_FromString(var->name);
      joined = PyUnicode_Concat(str, tail);
      Py_DecRef(str);
      Py_DecRef(tail);
      str = joined;
      if (var->next) {
        tail = PyUnicode_InternFromString(", ");
        joined = PyUnicode_Concat(str, tail);
        Py_DecRef(str);
        Py_DecRef(tail);
        str = joined;
      }
    }
    tail = PyUnicode_InternFromString(")");
    joined = PyUnicode_Concat(str, tail);
    Py_DecRef(str);
    Py_DecRef(tail);
    str = joined;
#else
    PyObject *str = PyString_FromString("(");
    swig_globalvar *var;
    for (var = v->vars; var; var=var->next) {
      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
    }
    PyString_ConcatAndDel(&str,PyString_FromString(")"));
#endif
    return str;
  }
  
  SWIGINTERN void
  swig_varlink_dealloc(swig_varlinkobject *v) {
    swig_globalvar *var = v->vars;
    while (var) {
      swig_globalvar *n = var->next;
      free(var->name);
      free(var);
      var = n;
    }
  }
  
  SWIGINTERN PyObject *
  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
    PyObject *res = NULL;
    swig_globalvar *var = v->vars;
    while (var) {
      if (strcmp(var->name,n) == 0) {
        res = (*var->get_attr)();
        break;
      }
      var = var->next;
    }
    if (res == NULL && !PyErr_Occurred()) {
      PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
    }
    return res;
  }
  
  SWIGINTERN int
  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
    int res = 1;
    swig_globalvar *var = v->vars;
    while (var) {
      if (strcmp(var->name,n) == 0) {
        res = (*var->set_attr)(p);
        break;
      }
      var = var->next;
    }
    if (res == 1 && !PyErr_Occurred()) {
      PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
    }
    return res;
  }
  
  SWIGINTERN PyTypeObject*
  swig_varlink_type(void) {
    static char varlink__doc__[] = "Swig var link object";
    static PyTypeObject varlink_type;
    static int type_init = 0;
    if (!type_init) {
      const PyTypeObject tmp = {
#if PY_VERSION_HEX >= 0x03000000
        PyVarObject_HEAD_INIT(NULL, 0)
#else
        PyObject_HEAD_INIT(NULL)
        0,                                  /* ob_size */
#endif
        "swigvarlink",                      /* tp_name */
        sizeof(swig_varlinkobject),         /* tp_basicsize */
        0,                                  /* tp_itemsize */
        (destructor) swig_varlink_dealloc,  /* tp_dealloc */
        0,                                  /* tp_print */
        (getattrfunc) swig_varlink_getattr, /* tp_getattr */
        (setattrfunc) swig_varlink_setattr, /* tp_setattr */
        0,                                  /* tp_compare */
        (reprfunc) swig_varlink_repr,       /* tp_repr */
        0,                                  /* tp_as_number */
        0,                                  /* tp_as_sequence */
        0,                                  /* tp_as_mapping */
        0,                                  /* tp_hash */
        0,                                  /* tp_call */
        (reprfunc) swig_varlink_str,        /* tp_str */
        0,                                  /* tp_getattro */
        0,                                  /* tp_setattro */
        0,                                  /* tp_as_buffer */
        0,                                  /* tp_flags */
        varlink__doc__,                     /* tp_doc */
        0,                                  /* tp_traverse */
        0,                                  /* tp_clear */
        0,                                  /* tp_richcompare */
        0,                                  /* tp_weaklistoffset */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
        0,                                  /* tp_del */
        0,                                  /* tp_version_tag */
#if PY_VERSION_HEX >= 0x03040000
        0,                                  /* tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
        0,                                  /* tp_vectorcall */
#endif
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
        0,                                  /* tp_print */
#endif
#ifdef COUNT_ALLOCS
        0,                                  /* tp_allocs */
        0,                                  /* tp_frees */
        0,                                  /* tp_maxalloc */
        0,                                  /* tp_prev */
        0                                   /* tp_next */
#endif
      };
      varlink_type = tmp;
      type_init = 1;
      if (PyType_Ready(&varlink_type) < 0)
      return NULL;
    }
    return &varlink_type;
  }
  
  /* Create a variable linking object for use later */
  SWIGINTERN PyObject *
  SWIG_Python_newvarlink(void) {
    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
    if (result) {
      result->vars = 0;
    }
    return ((PyObject*) result);
  }
  
  SWIGINTERN void 
  SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
    swig_varlinkobject *v = (swig_varlinkobject *) p;
    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
    if (gv) {
      size_t size = strlen(name)+1;
      gv->name = (char *)malloc(size);
      if (gv->name) {
        memcpy(gv->name, name, size);
        gv->get_attr = get_attr;
        gv->set_attr = set_attr;
        gv->next = v->vars;
      }
    }
    v->vars = gv;
  }
  
  SWIGINTERN PyObject *
  SWIG_globals(void) {
    static PyObject *globals = 0;
    if (!globals) {
      globals = SWIG_newvarlink();
    }
    return globals;
  }
  
  /* -----------------------------------------------------------------------------
   * constants/methods manipulation
   * ----------------------------------------------------------------------------- */
  
  /* Install Constants */
  SWIGINTERN void
  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
    PyObject *obj = 0;
    size_t i;
    for (i = 0; constants[i].type; ++i) {
      switch(constants[i].type) {
      case SWIG_PY_POINTER:
        obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
        break;
      case SWIG_PY_BINARY:
        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
        break;
      default:
        obj = 0;
        break;
      }
      if (obj) {
        PyDict_SetItemString(d, constants[i].name, obj);
        Py_DECREF(obj);
      }
    }
  }
  
  /* -----------------------------------------------------------------------------*/
  /* Fix SwigMethods to carry the callback ptrs when needed */
  /* -----------------------------------------------------------------------------*/
  
  SWIGINTERN void
  SWIG_Python_FixMethods(PyMethodDef *methods,
    swig_const_info *const_table,
    swig_type_info **types,
    swig_type_info **types_initial) {
    size_t i;
    for (i = 0; methods[i].ml_name; ++i) {
      const char *c = methods[i].ml_doc;
      if (!c) continue;
      c = strstr(c, "swig_ptr: ");
      if (c) {
        int j;
        swig_const_info *ci = 0;
        const char *name = c + 10;
        for (j = 0; const_table[j].type; ++j) {
          if (strncmp(const_table[j].name, name, 
              strlen(const_table[j].name)) == 0) {
            ci = &(const_table[j]);
            break;
          }
        }
        if (ci) {
          void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
          if (ptr) {
            size_t shift = (ci->ptype) - types;
            swig_type_info *ty = types_initial[shift];
            size_t ldoc = (c - methods[i].ml_doc);
            size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
            char *ndoc = (char*)malloc(ldoc + lptr + 10);
            if (ndoc) {
              char *buff = ndoc;
              memcpy(buff, methods[i].ml_doc, ldoc);
              buff += ldoc;
              memcpy(buff, "swig_ptr: ", 10);
              buff += 10;
              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
              methods[i].ml_doc = ndoc;
            }
          }
        }
      }
    }
  } 
  
  /* -----------------------------------------------------------------------------
   * Method creation and docstring support functions
   * ----------------------------------------------------------------------------- */
  
  /* -----------------------------------------------------------------------------
   * Function to find the method definition with the correct docstring for the
   * proxy module as opposed to the low-level API
   * ----------------------------------------------------------------------------- */
  
  SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
    /* Find the function in the modified method table */
    size_t offset = 0;
    int found = 0;
    while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
      if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
        found = 1;
        break;
      }
      offset++;
    }
    /* Use the copy with the modified docstring if available */
    return found ? &SwigMethods_proxydocs[offset] : NULL;
  }
  
  /* -----------------------------------------------------------------------------
   * Wrapper of PyInstanceMethod_New() used in Python 3
   * It is exported to the generated module, used for -fastproxy
   * ----------------------------------------------------------------------------- */
  
  SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
    if (PyCFunction_Check(func)) {
      PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
      PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
      if (ml)
      func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
    }
#if PY_VERSION_HEX >= 0x03000000
    return PyInstanceMethod_New(func);
#else
    return PyMethod_New(func, NULL, NULL);
#endif
  }
  
  /* -----------------------------------------------------------------------------
   * Wrapper of PyStaticMethod_New()
   * It is exported to the generated module, used for -fastproxy
   * ----------------------------------------------------------------------------- */
  
  SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
    if (PyCFunction_Check(func)) {
      PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
      PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
      if (ml)
      func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
    }
    return PyStaticMethod_New(func);
  }
  
#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------*
 *  Partial Init method
 * -----------------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C"
#endif

SWIGEXPORT 
#if PY_VERSION_HEX >= 0x03000000
PyObject*
#else
void
#endif
SWIG_init(void) {
  PyObject *m, *d, *md, *globals;
  
#if PY_VERSION_HEX >= 0x03000000
  static struct PyModuleDef SWIG_module = {
    PyModuleDef_HEAD_INIT,
    SWIG_name,
    NULL,
    -1,
    SwigMethods,
    NULL,
    NULL,
    NULL,
    NULL
  };
#endif
  
#if defined(SWIGPYTHON_BUILTIN)
  static SwigPyClientData SwigPyObject_clientdata = {
    0, 0, 0, 0, 0, 0, 0
  };
  static PyGetSetDef this_getset_def = {
    (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
  };
  static SwigPyGetSet thisown_getset_closure = {
    SwigPyObject_own,
    SwigPyObject_own
  };
  static PyGetSetDef thisown_getset_def = {
    (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
  };
  PyTypeObject *builtin_pytype;
  int builtin_base_count;
  swig_type_info *builtin_basetype;
  PyObject *tuple;
  PyGetSetDescrObject *static_getset;
  PyTypeObject *metatype;
  PyTypeObject *swigpyobject;
  SwigPyClientData *cd;
  PyObject *public_interface, *public_symbol;
  PyObject *this_descr;
  PyObject *thisown_descr;
  PyObject *self = 0;
  int i;
  
  (void)builtin_pytype;
  (void)builtin_base_count;
  (void)builtin_basetype;
  (void)tuple;
  (void)static_getset;
  (void)self;
  
  /* Metaclass is used to implement static member variables */
  metatype = SwigPyObjectType();
  assert(metatype);
#endif
  
  (void)globals;
  
  /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
  SWIG_This();
  SWIG_Python_TypeCache();
  SwigPyPacked_type();
#ifndef SWIGPYTHON_BUILTIN
  SwigPyObject_type();
#endif
  
  /* Fix SwigMethods to carry the callback ptrs when needed */
  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
  
#if PY_VERSION_HEX >= 0x03000000
  m = PyModule_Create(&SWIG_module);
#else
  m = Py_InitModule(SWIG_name, SwigMethods);
#endif
  
  md = d = PyModule_GetDict(m);
  (void)md;
  
  SWIG_InitializeModule(0);
  
#ifdef SWIGPYTHON_BUILTIN
  swigpyobject = SwigPyObject_TypeOnce();
  
  SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
  assert(SwigPyObject_stype);
  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
  if (!cd) {
    SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
    SwigPyObject_clientdata.pytype = swigpyobject;
  } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
    PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
# if PY_VERSION_HEX >= 0x03000000
    return NULL;
# else
    return;
# endif
  }
  
  /* All objects have a 'this' attribute */
  this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
  (void)this_descr;
  
  /* All objects have a 'thisown' attribute */
  thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
  (void)thisown_descr;
  
  public_interface = PyList_New(0);
  public_symbol = 0;
  (void)public_symbol;
  
  PyDict_SetItemString(md, "__all__", public_interface);
  Py_DECREF(public_interface);
  for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
  SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
  for (i = 0; swig_const_table[i].name != 0; ++i)
  SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
#endif
  
  SWIG_InstallConstants(d,swig_const_table);
  
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_VERSION_NUMBER",SWIG_From_long((long)(0x101010bfL)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_VERSION_TEXT",SWIG_FromCharPtr("OpenSSL 1.1.1k  25 Mar 2021"));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SHLIB_VERSION_HISTORY",SWIG_FromCharPtr(""));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SHLIB_VERSION_NUMBER",SWIG_FromCharPtr("1.1"));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_FILE",SWIG_FromCharPtr("/usr/include/openssl/opensslconf.h"));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_LINE",SWIG_From_int((int)(134)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_MIN_API",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_API_COMPAT",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "bio_noclose",SWIG_From_int((int)(BIO_NOCLOSE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "bio_close",SWIG_From_int((int)(BIO_CLOSE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_READ",SWIG_From_int((int)(0x01)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_WRITE",SWIG_From_int((int)(0x02)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_IO_SPECIAL",SWIG_From_int((int)(0x04)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_RWS",SWIG_From_int((int)((BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_SHOULD_RETRY",SWIG_From_int((int)(0x08)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "BIO_FLAGS_MEM_RDONLY",SWIG_From_int((int)(0x200)));
  globals = SWIG_globals();
  if (!globals) {
    PyErr_SetString(PyExc_TypeError, "Failure to create SWIG globals.");
#if PY_VERSION_HEX >= 0x03000000
    return NULL;
#else
    return;
#endif
  }
  PyDict_SetItemString(md, "cvar", globals);
  Py_DECREF(globals);
  SwigPyBuiltin_AddPublicSymbol(public_interface, "cvar");
  SWIG_addvarlink(globals, "_bio_err", Swig_var__bio_err_get, Swig_var__bio_err_set);
  
  /* type '::pyfd_struct' */
  builtin_pytype = (PyTypeObject *)&SwigPyBuiltin__pyfd_struct_type;
  builtin_pytype->tp_dict = d = PyDict_New();
  SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);
  builtin_pytype->tp_new = PyType_GenericNew;
  builtin_base_count = 0;
  builtin_bases[builtin_base_count] = NULL;
  SwigPyBuiltin_InitBases(builtin_pytype, builtin_bases);
  PyDict_SetItemString(d, "this", this_descr);
  PyDict_SetItemString(d, "thisown", thisown_descr);
  if (PyType_Ready(builtin_pytype) < 0) {
    PyErr_SetString(PyExc_TypeError, "Could not create type 'BIO_PYFD_CTX'.");
#if PY_VERSION_HEX >= 0x03000000
    return NULL;
#else
    return;
#endif
  }
  Py_INCREF(builtin_pytype);
  PyModule_AddObject(m, "BIO_PYFD_CTX", (PyObject *)builtin_pytype);
  SwigPyBuiltin_AddPublicSymbol(public_interface, "BIO_PYFD_CTX");
  d = md;
  SWIG_addvarlink(globals, "methods_fdp", Swig_var_methods_fdp_get, Swig_var_methods_fdp_set);
  SWIG_addvarlink(globals, "_rand_err", Swig_var__rand_err_get, Swig_var__rand_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS5_SALT_LEN",SWIG_From_int((int)(8)));
  SWIG_addvarlink(globals, "_evp_err", Swig_var__evp_err_get, Swig_var__evp_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "AES_BLOCK_SIZE",SWIG_From_int((int)(AES_BLOCK_SIZE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_NO_RC4",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "dh_check_ok",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "dh_check_p_not_prime",SWIG_From_int((int)(DH_CHECK_P_NOT_PRIME)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "dh_check_p_not_strong",SWIG_From_int((int)(DH_CHECK_P_NOT_STRONG_PRIME)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "dh_check_g_failed",SWIG_From_int((int)(DH_UNABLE_TO_CHECK_GENERATOR)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "dh_check_bad_g",SWIG_From_int((int)(DH_NOT_SUITABLE_GENERATOR)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "DH_GENERATOR_2",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "DH_GENERATOR_5",SWIG_From_int((int)(5)));
  SWIG_addvarlink(globals, "_dh_err", Swig_var__dh_err_get, Swig_var__dh_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "no_padding",SWIG_From_int((int)(RSA_NO_PADDING)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "pkcs1_padding",SWIG_From_int((int)(RSA_PKCS1_PADDING)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "pkcs1_oaep_padding",SWIG_From_int((int)(RSA_PKCS1_OAEP_PADDING)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sha1",SWIG_From_int((int)(NID_sha1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sha224",SWIG_From_int((int)(NID_sha224)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sha256",SWIG_From_int((int)(NID_sha256)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sha384",SWIG_From_int((int)(NID_sha384)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sha512",SWIG_From_int((int)(NID_sha512)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_md5",SWIG_From_int((int)(NID_md5)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_ripemd160",SWIG_From_int((int)(NID_ripemd160)));
  SWIG_addvarlink(globals, "_rsa_err", Swig_var__rsa_err_get, Swig_var__rsa_err_set);
  SWIG_addvarlink(globals, "_dsa_err", Swig_var__dsa_err_get, Swig_var__dsa_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_none",SWIG_From_int((int)(SSL_ERROR_NONE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_ssl",SWIG_From_int((int)(SSL_ERROR_SSL)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_want_read",SWIG_From_int((int)(SSL_ERROR_WANT_READ)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_want_write",SWIG_From_int((int)(SSL_ERROR_WANT_WRITE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_want_x509_lookup",SWIG_From_int((int)(SSL_ERROR_WANT_X509_LOOKUP)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_syscall",SWIG_From_int((int)(SSL_ERROR_SYSCALL)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_zero_return",SWIG_From_int((int)(SSL_ERROR_ZERO_RETURN)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ssl_error_want_connect",SWIG_From_int((int)(SSL_ERROR_WANT_CONNECT)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_VERIFY_NONE",SWIG_From_int((int)(0x00)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_VERIFY_PEER",SWIG_From_int((int)(0x01)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_VERIFY_FAIL_IF_NO_PEER_CERT",SWIG_From_int((int)(0x02)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_VERIFY_CLIENT_ONCE",SWIG_From_int((int)(0x04)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "VERIFY_CRL_CHECK_LEAF",SWIG_From_int((int)(X509_V_FLAG_CRL_CHECK)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "VERIFY_CRL_CHECK_CHAIN",SWIG_From_int((int)(X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_CONNECT",SWIG_From_int((int)(0x1000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_ACCEPT",SWIG_From_int((int)(0x2000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_MASK",SWIG_From_int((int)(0x0FFF)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_INIT",SWIG_From_int((int)((SSL_ST_CONNECT|SSL_ST_ACCEPT))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_BEFORE",SWIG_From_int((int)(0x4000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_OK",SWIG_From_int((int)(0x03)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_ST_RENEGOTIATE",SWIG_From_int((int)((0x04|SSL_ST_CONNECT|SSL_ST_ACCEPT))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_LOOP",SWIG_From_int((int)(0x01)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_EXIT",SWIG_From_int((int)(0x02)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_READ",SWIG_From_int((int)(0x04)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_WRITE",SWIG_From_int((int)(0x08)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_ALERT",SWIG_From_int((int)(0x4000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_READ_ALERT",SWIG_From_int((int)((SSL_CB_ALERT|SSL_CB_READ))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_WRITE_ALERT",SWIG_From_int((int)((SSL_CB_ALERT|SSL_CB_WRITE))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_ACCEPT_LOOP",SWIG_From_int((int)((SSL_ST_ACCEPT|SSL_CB_LOOP))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_ACCEPT_EXIT",SWIG_From_int((int)((SSL_ST_ACCEPT|SSL_CB_EXIT))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_CONNECT_LOOP",SWIG_From_int((int)((SSL_ST_CONNECT|SSL_CB_LOOP))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_CONNECT_EXIT",SWIG_From_int((int)((SSL_ST_CONNECT|SSL_CB_EXIT))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_HANDSHAKE_START",SWIG_From_int((int)(0x10)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_CB_HANDSHAKE_DONE",SWIG_From_int((int)(0x20)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_SENT_SHUTDOWN",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_RECEIVED_SHUTDOWN",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_SESS_CACHE_OFF",SWIG_From_int((int)(0x000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_SESS_CACHE_CLIENT",SWIG_From_int((int)(0x001)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_SESS_CACHE_SERVER",SWIG_From_int((int)(0x002)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_SESS_CACHE_BOTH",SWIG_From_int((int)((SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_OP_ALL",SWIG_From_int((int)(0x00000FFFL)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_OP_NO_SSLv2",SWIG_From_int((int)(0x01000000L)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_OP_NO_SSLv3",SWIG_From_int((int)(0x02000000L)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_OP_NO_TLSv1",SWIG_From_int((int)(0x04000000L)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS",SWIG_From_int((int)(0x00000800L)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_MODE_ENABLE_PARTIAL_WRITE",SWIG_From_int((int)(SSL_MODE_ENABLE_PARTIAL_WRITE)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER",SWIG_From_int((int)(SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "SSL_MODE_AUTO_RETRY",SWIG_From_int((int)(SSL_MODE_AUTO_RETRY)));
  SWIG_addvarlink(globals, "_ssl_err", Swig_var__ssl_err_get, Swig_var__ssl_err_set);
  SWIG_addvarlink(globals, "_ssl_timeout_err", Swig_var__ssl_timeout_err_get, Swig_var__ssl_timeout_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_DEFAULT",SWIG_From_int((int)(-1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_COMPAT",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_SSL_CLIENT",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_SSL_SERVER",SWIG_From_int((int)(3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_EMAIL",SWIG_From_int((int)(4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_OBJECT_SIGN",SWIG_From_int((int)(5)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_OCSP_SIGN",SWIG_From_int((int)(6)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_OCSP_REQUEST",SWIG_From_int((int)(7)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_DYNAMIC",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_DYNAMIC_NAME",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_TRUSTED",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_REJECTED",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_TRUST_UNTRUSTED",SWIG_From_int((int)(3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_SSL_CLIENT",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_SSL_SERVER",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_NS_SSL_SERVER",SWIG_From_int((int)(3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_SMIME_SIGN",SWIG_From_int((int)(4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_SMIME_ENCRYPT",SWIG_From_int((int)(5)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_CRL_SIGN",SWIG_From_int((int)(6)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_ANY",SWIG_From_int((int)(7)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_PURPOSE_OCSP_HELPER",SWIG_From_int((int)(8)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509V3_EXT_UNKNOWN_MASK",SWIG_From_long((long)((0xfL << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509V3_EXT_DEFAULT",SWIG_From_long((long)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509V3_EXT_ERROR_UNKNOWN",SWIG_From_long((long)((1L << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509V3_EXT_PARSE_UNKNOWN",SWIG_From_long((long)((2L << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509V3_EXT_DUMP_UNKNOWN",SWIG_From_long((long)((3L << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_commonName",SWIG_From_int((int)(13)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_countryName",SWIG_From_int((int)(14)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_localityName",SWIG_From_int((int)(15)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_stateOrProvinceName",SWIG_From_int((int)(16)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_organizationName",SWIG_From_int((int)(17)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_organizationalUnitName",SWIG_From_int((int)(18)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_serialNumber",SWIG_From_int((int)(105)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_surname",SWIG_From_int((int)(100)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_givenName",SWIG_From_int((int)(99)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_pkcs9_emailAddress",SWIG_From_int((int)(48)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_OK",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_GET_CRL",SWIG_From_int((int)(3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE",SWIG_From_int((int)(4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE",SWIG_From_int((int)(5)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",SWIG_From_int((int)(6)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_SIGNATURE_FAILURE",SWIG_From_int((int)(7)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CRL_SIGNATURE_FAILURE",SWIG_From_int((int)(8)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_NOT_YET_VALID",SWIG_From_int((int)(9)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_HAS_EXPIRED",SWIG_From_int((int)(10)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CRL_NOT_YET_VALID",SWIG_From_int((int)(11)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CRL_HAS_EXPIRED",SWIG_From_int((int)(12)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD",SWIG_From_int((int)(13)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD",SWIG_From_int((int)(14)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD",SWIG_From_int((int)(15)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD",SWIG_From_int((int)(16)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_OUT_OF_MEM",SWIG_From_int((int)(17)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT",SWIG_From_int((int)(18)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN",SWIG_From_int((int)(19)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY",SWIG_From_int((int)(20)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE",SWIG_From_int((int)(21)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_CHAIN_TOO_LONG",SWIG_From_int((int)(22)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_REVOKED",SWIG_From_int((int)(23)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_INVALID_CA",SWIG_From_int((int)(24)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_PATH_LENGTH_EXCEEDED",SWIG_From_int((int)(25)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_INVALID_PURPOSE",SWIG_From_int((int)(26)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_UNTRUSTED",SWIG_From_int((int)(27)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_CERT_REJECTED",SWIG_From_int((int)(28)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "X509_V_ERR_APPLICATION_VERIFICATION",SWIG_From_int((int)(50)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_COMPAT",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_SEP_COMMA_PLUS",SWIG_From_int((int)((1 << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_SEP_CPLUS_SPC",SWIG_From_int((int)((2 << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_SEP_MULTILINE",SWIG_From_int((int)((4 << 16))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_DN_REV",SWIG_From_int((int)((1 << 20))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_FN_LN",SWIG_From_int((int)((1 << 21))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_SPC_EQ",SWIG_From_int((int)((1 << 23))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_DUMP_UNKNOWN_FIELDS",SWIG_From_int((int)((1 << 24))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_FN_ALIGN",SWIG_From_int((int)((1 << 25))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_ONELINE",SWIG_From_int((int)((ASN1_STRFLGS_RFC2253|ASN1_STRFLGS_ESC_QUOTE|XN_FLAG_SEP_CPLUS_SPC|XN_FLAG_SPC_EQ))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_MULTILINE",SWIG_From_int((int)((ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB|XN_FLAG_SEP_MULTILINE|XN_FLAG_SPC_EQ|XN_FLAG_FN_LN|XN_FLAG_FN_ALIGN))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XN_FLAG_RFC2253",SWIG_From_int((int)((ASN1_STRFLGS_RFC2253|XN_FLAG_SEP_COMMA_PLUS|XN_FLAG_DN_REV|XN_FLAG_DUMP_UNKNOWN_FIELDS))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "RSA_3",SWIG_From_int((int)(0x3L)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "RSA_F4",SWIG_From_int((int)(0x10001L)));
  SWIG_addvarlink(globals, "_x509_err", Swig_var__x509_err_get, Swig_var__x509_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_ESC_2253",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_ESC_CTRL",SWIG_From_int((int)(2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_ESC_MSB",SWIG_From_int((int)(4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_ESC_QUOTE",SWIG_From_int((int)(8)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_UTF8_CONVERT",SWIG_From_int((int)(0x10)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_IGNORE_TYPE",SWIG_From_int((int)(0x20)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_SHOW_TYPE",SWIG_From_int((int)(0x40)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_DUMP_ALL",SWIG_From_int((int)(0x80)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_DUMP_UNKNOWN",SWIG_From_int((int)(0x100)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_DUMP_DER",SWIG_From_int((int)(0x200)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ASN1_STRFLGS_RFC2253",SWIG_From_int((int)((ASN1_STRFLGS_ESC_2253|ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB|ASN1_STRFLGS_UTF8_CONVERT|ASN1_STRFLGS_DUMP_UNKNOWN|ASN1_STRFLGS_DUMP_DER))));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_TEXT",SWIG_From_int((int)(0x1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOCERTS",SWIG_From_int((int)(0x2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOSIGS",SWIG_From_int((int)(0x4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOCHAIN",SWIG_From_int((int)(0x8)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOINTERN",SWIG_From_int((int)(0x10)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOVERIFY",SWIG_From_int((int)(0x20)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_DETACHED",SWIG_From_int((int)(0x40)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_BINARY",SWIG_From_int((int)(0x80)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_NOATTR",SWIG_From_int((int)(0x100)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_SIGNED",SWIG_From_int((int)(NID_pkcs7_signed)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_ENVELOPED",SWIG_From_int((int)(NID_pkcs7_enveloped)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_SIGNED_ENVELOPED",SWIG_From_int((int)(NID_pkcs7_signedAndEnveloped)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "PKCS7_DATA",SWIG_From_int((int)(NID_pkcs7_data)));
  SWIG_addvarlink(globals, "_pkcs7_err", Swig_var__pkcs7_err_get, Swig_var__pkcs7_err_set);
  SWIG_addvarlink(globals, "_smime_err", Swig_var__smime_err_get, Swig_var__smime_err_set);
  SWIG_addvarlink(globals, "_util_err", Swig_var__util_err_get, Swig_var__util_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "OPENSSL_NO_EC",SWIG_From_int((int)(0)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp112r1",SWIG_From_int((int)(NID_secp112r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp112r2",SWIG_From_int((int)(NID_secp112r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp128r1",SWIG_From_int((int)(NID_secp128r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp128r2",SWIG_From_int((int)(NID_secp128r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp160k1",SWIG_From_int((int)(NID_secp160k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp160r1",SWIG_From_int((int)(NID_secp160r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp160r2",SWIG_From_int((int)(NID_secp160r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp192k1",SWIG_From_int((int)(NID_secp192k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp224k1",SWIG_From_int((int)(NID_secp224k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp224r1",SWIG_From_int((int)(NID_secp224r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp256k1",SWIG_From_int((int)(NID_secp256k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp384r1",SWIG_From_int((int)(NID_secp384r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_secp521r1",SWIG_From_int((int)(NID_secp521r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect113r1",SWIG_From_int((int)(NID_sect113r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect113r2",SWIG_From_int((int)(NID_sect113r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect131r1",SWIG_From_int((int)(NID_sect131r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect131r2",SWIG_From_int((int)(NID_sect131r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect163k1",SWIG_From_int((int)(NID_sect163k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect163r1",SWIG_From_int((int)(NID_sect163r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect163r2",SWIG_From_int((int)(NID_sect163r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect193r1",SWIG_From_int((int)(NID_sect193r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect193r2",SWIG_From_int((int)(NID_sect193r2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect233k1",SWIG_From_int((int)(NID_sect233k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect233r1",SWIG_From_int((int)(NID_sect233r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect239k1",SWIG_From_int((int)(NID_sect239k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect283k1",SWIG_From_int((int)(NID_sect283k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect283r1",SWIG_From_int((int)(NID_sect283r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect409k1",SWIG_From_int((int)(NID_sect409k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect409r1",SWIG_From_int((int)(NID_sect409r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect571k1",SWIG_From_int((int)(NID_sect571k1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_sect571r1",SWIG_From_int((int)(NID_sect571r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime192v1",SWIG_From_int((int)(NID_X9_62_prime192v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime192v2",SWIG_From_int((int)(NID_X9_62_prime192v2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime192v3",SWIG_From_int((int)(NID_X9_62_prime192v3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime239v1",SWIG_From_int((int)(NID_X9_62_prime239v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime239v2",SWIG_From_int((int)(NID_X9_62_prime239v2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime239v3",SWIG_From_int((int)(NID_X9_62_prime239v3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_prime256v1",SWIG_From_int((int)(NID_X9_62_prime256v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb163v1",SWIG_From_int((int)(NID_X9_62_c2pnb163v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb163v2",SWIG_From_int((int)(NID_X9_62_c2pnb163v2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb163v3",SWIG_From_int((int)(NID_X9_62_c2pnb163v3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb176v1",SWIG_From_int((int)(NID_X9_62_c2pnb176v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb191v1",SWIG_From_int((int)(NID_X9_62_c2tnb191v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb191v2",SWIG_From_int((int)(NID_X9_62_c2tnb191v2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb191v3",SWIG_From_int((int)(NID_X9_62_c2tnb191v3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb208w1",SWIG_From_int((int)(NID_X9_62_c2pnb208w1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb239v1",SWIG_From_int((int)(NID_X9_62_c2tnb239v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb239v2",SWIG_From_int((int)(NID_X9_62_c2tnb239v2)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb239v3",SWIG_From_int((int)(NID_X9_62_c2tnb239v3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb272w1",SWIG_From_int((int)(NID_X9_62_c2pnb272w1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb304w1",SWIG_From_int((int)(NID_X9_62_c2pnb304w1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb359v1",SWIG_From_int((int)(NID_X9_62_c2tnb359v1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2pnb368w1",SWIG_From_int((int)(NID_X9_62_c2pnb368w1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_X9_62_c2tnb431r1",SWIG_From_int((int)(NID_X9_62_c2tnb431r1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls1",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls3",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls4",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls4)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls5",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls5)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls6",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls6)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls7",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls7)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls8",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls8)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls9",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls9)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls10",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls10)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls11",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls11)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_wap_wsg_idm_ecid_wtls12",SWIG_From_int((int)(NID_wap_wsg_idm_ecid_wtls12)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_ipsec3",SWIG_From_int((int)(NID_ipsec3)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "NID_ipsec4",SWIG_From_int((int)(NID_ipsec4)));
  SWIG_addvarlink(globals, "_ec_err", Swig_var__ec_err_get, Swig_var__ec_err_set);
  
  /* type '::_cbd_t' */
  builtin_pytype = (PyTypeObject *)&SwigPyBuiltin___cbd_t_type;
  builtin_pytype->tp_dict = d = PyDict_New();
  SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);
  builtin_pytype->tp_new = PyType_GenericNew;
  builtin_base_count = 0;
  builtin_bases[builtin_base_count] = NULL;
  SwigPyBuiltin_InitBases(builtin_pytype, builtin_bases);
  PyDict_SetItemString(d, "this", this_descr);
  PyDict_SetItemString(d, "thisown", thisown_descr);
  if (PyType_Ready(builtin_pytype) < 0) {
    PyErr_SetString(PyExc_TypeError, "Could not create type '_cbd_t'.");
#if PY_VERSION_HEX >= 0x03000000
    return NULL;
#else
    return;
#endif
  }
  Py_INCREF(builtin_pytype);
  PyModule_AddObject(m, "_cbd_t", (PyObject *)builtin_pytype);
  SwigPyBuiltin_AddPublicSymbol(public_interface, "_cbd_t");
  d = md;
  SWIG_addvarlink(globals, "_engine_err", Swig_var__engine_err_get, Swig_var__engine_err_set);
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_RSA",SWIG_From_int((int)(0x0001)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_DSA",SWIG_From_int((int)(0x0002)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_DH",SWIG_From_int((int)(0x0004)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_RAND",SWIG_From_int((int)(0x0008)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_ECDH",SWIG_From_int((int)(0x0010)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_ECDSA",SWIG_From_int((int)(0x0020)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_CIPHERS",SWIG_From_int((int)(0x0040)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_DIGESTS",SWIG_From_int((int)(0x0080)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_STORE",SWIG_From_int((int)(0x0100)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_ALL",SWIG_From_int((int)(0xFFFF)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "ENGINE_METHOD_NONE",SWIG_From_int((int)(0x0000)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "encrypt",SWIG_From_int((int)(1)));
  SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "decrypt",SWIG_From_int((int)(0)));
  
  /* Initialize threading */
  SWIG_PYTHON_INITIALIZE_THREADS;
#if PY_VERSION_HEX >= 0x03000000
  return m;
#else
  return;
#endif
}

