/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.35 from the
 * contents of SEC.xs. Do not edit this file, edit SEC.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "SEC.xs"

#define XS_Id "$Id: SEC.xs 1734 2019-03-19 10:54:14Z willem $"


#if 0
  "Skipped embedded POD."
#endif
#line 39 "SEC.xs"


#ifdef __cplusplus
extern "C" {
#endif

#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <openssl/opensslv.h>
#include <openssl/evp.h>
#include <openssl/dsa.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/rsa.h>

#ifdef __cplusplus
}
#endif


#ifdef OPENSSL_NO_DSA
#define NO_DSA
#endif

#ifdef OPENSSL_NO_EC
#define NO_ECCGOST
#define NO_ECDSA
#define NO_EdDSA
#endif


#ifndef OPENSSL_VERSION_NUMBER
#define OPENSSL_VERSION_NUMBER 0x40000000L	/* avert disaster */
#endif


#define LIBCRYPTO_VERSION OPENSSL_VERSION_NUMBER
#ifdef LIBRESSL_VERSION_NUMBER
#undef  LIBCRYPTO_VERSION
#define LIBCRYPTO_VERSION LIBRESSL_VERSION_NUMBER
#undef  OPENSSL_VERSION_NUMBER
#define OPENSSL_VERSION_NUMBER 0x10100000L
#if (LIBRESSL_VERSION_NUMBER < 0x20700000L)
#undef  OPENSSL_VERSION_NUMBER
#define OPENSSL_VERSION_NUMBER 0x10002000L
#endif
#define BN_bn2binpad(a, to, tolen) BN_bn2bin(a, to)
#endif


#if (OPENSSL_VERSION_NUMBER < 0x30000000L)
#define EC_POINT_set_affine_coordinates	EC_POINT_set_affine_coordinates_GFp
#endif


#if (OPENSSL_VERSION_NUMBER < 0x10101000L)
#undef NO_EdDSA
#define NO_EdDSA

int EVP_DigestSign(EVP_MD_CTX *ctx,
		unsigned char *sigret, size_t *siglen,
		unsigned char *tbs, size_t tbslen)
{
	EVP_DigestUpdate( ctx, tbs, tbslen );
	return EVP_DigestSignFinal( ctx, sigret, siglen );
}

int EVP_DigestVerify(EVP_MD_CTX *ctx,
		unsigned char *sigret, size_t siglen,
		unsigned char *tbs, size_t tbslen)
{
	EVP_DigestUpdate( ctx, tbs, tbslen );
	return EVP_DigestVerifyFinal( ctx, sigret, siglen );
}
#endif


#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
#undef NO_ECCGOST
#define NO_ECCGOST

#define EVP_MD_CTX_new()	EVP_MD_CTX_create()
#define EVP_MD_CTX_free(ctx)	EVP_MD_CTX_destroy((ctx))
#define EVP_MD_CTX_reset(ctx)	EVP_MD_CTX_init((ctx))

#ifndef NO_DSA
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
{
	BN_free(d->p);
	d->p = p;
	BN_free(d->q);
	d->q = q;
	BN_free(d->g);
	d->g = g;
	return 1;
}

int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
{
	d->priv_key = priv_key;
	d->pub_key = pub_key;
	return 1;
}
#endif

int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
{
	BN_free(r->n);
	r->n = n;
	BN_free(r->e);
	r->e = e;
	BN_free(r->d);
	r->d = d;
	return 1;
}

int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
{
	BN_free(r->p);
	r->p = p;
	BN_free(r->q);
	r->q = q;
	return 1;
}
#endif


#if (OPENSSL_VERSION_NUMBER < 0x10001000L)
#define NO_ECDSA
#error	unsupported libcrypto version
void malfunction() { return LIBCRYPTO_VERSION; }
#endif


#ifndef NO_ECCGOST
BIGNUM *bn_new_hex(const char *hex)
{
	BIGNUM *bn = BN_new();
	BN_hex2bn( &bn, hex );
	return bn;
}
#endif


int checkret(const int ret, int line)
{
	if ( ret == 1 ) return ret;
	croak("libcrypto error (%s line %d)", __FILE__, line);
}

#define checkerr(arg)	checkret( (arg), __LINE__ )


#line 175 "SEC.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 319 "SEC.c"

XS_EUPXS(XS_Net__DNS__SEC__libcrypto_VERSION); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_VERSION)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "void");
    {
#line 202 "SEC.xs"
	char *v = XS_Id;;
	SV *v_SV = newSVpv( v, 16 );
#line 331 "SEC.c"
	SV *	RETVAL;
#line 205 "SEC.xs"
	v = (char*) SvEND(v_SV);
	v = v - 4;
	RETVAL = newSVpvf( "%s %8.8lx", v, LIBCRYPTO_VERSION );
#line 337 "SEC.c"
	RETVAL = sv_2mortal(RETVAL);
	ST(0) = RETVAL;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_md5); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_md5)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	const EVP_MD *	RETVAL;

	RETVAL = EVP_md5();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "const EVP_MDPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha1); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha1)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	const EVP_MD *	RETVAL;

	RETVAL = EVP_sha1();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "const EVP_MDPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha256); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha256)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	const EVP_MD *	RETVAL;

	RETVAL = EVP_sha256();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "const EVP_MDPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha384); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha384)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	const EVP_MD *	RETVAL;

	RETVAL = EVP_sha384();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "const EVP_MDPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha512); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sha512)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	const EVP_MD *	RETVAL;

	RETVAL = EVP_sha512();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "const EVP_MDPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	EVP_PKEY *	RETVAL;

	RETVAL = EVP_PKEY_new();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "EVP_PKEYPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sign); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_sign)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "message, pkey, md=NULL");
    {
#line 235 "SEC.xs"
	EVP_MD_CTX *ctx = EVP_MD_CTX_new();
	unsigned char *m;
	unsigned char sigbuf[512];		/* RFC3110(2) */
	STRLEN slen;
	int r;
#line 484 "SEC.c"
	SV *	RETVAL;
	SV *	message = ST(0)
;
	EVP_PKEY *	pkey;
	const EVP_MD *	md;

	if (SvROK(ST(1)) && sv_derived_from(ST(1), "EVP_PKEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    pkey = INT2PTR(EVP_PKEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_sign",
			"pkey", "EVP_PKEYPtr")
;

	if (items < 3)
	    md = NULL;
	else {
	    if (SvROK(ST(2)) && sv_derived_from(ST(2), "const EVP_MDPtr")) {
		IV tmp = SvIV((SV*)SvRV(ST(2)));
		md = INT2PTR(const EVP_MD *,tmp);
	    }
	    else
		Perl_croak_nocontext("%s: %s is not of type %s",
			    "Net::DNS::SEC::libcrypto::EVP_sign",
			    "md", "const EVP_MDPtr")
;
	}
#line 241 "SEC.xs"
	m = (unsigned char*) SvPVX(message);
	EVP_MD_CTX_reset(ctx);
	checkerr( EVP_DigestSignInit( ctx, NULL, md, NULL, pkey ) );
	slen = sizeof(sigbuf);
	r = EVP_DigestSign( ctx, sigbuf, &slen, m, SvCUR(message) );
	EVP_MD_CTX_free(ctx);
	EVP_PKEY_free(pkey);
	checkerr(r);
	RETVAL = newSVpvn( (char*)sigbuf, slen );
#line 524 "SEC.c"
	RETVAL = sv_2mortal(RETVAL);
	ST(0) = RETVAL;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_verify); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_verify)
{
    dVAR; dXSARGS;
    if (items < 3 || items > 4)
       croak_xs_usage(cv,  "message, signature, pkey, md=NULL");
    {
#line 256 "SEC.xs"
	EVP_MD_CTX *ctx = EVP_MD_CTX_new();
	unsigned char *m;
	unsigned char *s;
#line 543 "SEC.c"
	int	RETVAL;
	dXSTARG;
	SV *	message = ST(0)
;
	SV *	signature = ST(1)
;
	EVP_PKEY *	pkey;
	const EVP_MD *	md;

	if (SvROK(ST(2)) && sv_derived_from(ST(2), "EVP_PKEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(2)));
	    pkey = INT2PTR(EVP_PKEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_verify",
			"pkey", "EVP_PKEYPtr")
;

	if (items < 4)
	    md = NULL;
	else {
	    if (SvROK(ST(3)) && sv_derived_from(ST(3), "const EVP_MDPtr")) {
		IV tmp = SvIV((SV*)SvRV(ST(3)));
		md = INT2PTR(const EVP_MD *,tmp);
	    }
	    else
		Perl_croak_nocontext("%s: %s is not of type %s",
			    "Net::DNS::SEC::libcrypto::EVP_verify",
			    "md", "const EVP_MDPtr")
;
	}
#line 260 "SEC.xs"
	m = (unsigned char*) SvPVX(message);
	s = (unsigned char*) SvPVX(signature);
	EVP_MD_CTX_reset(ctx);
	checkerr( EVP_DigestVerifyInit( ctx, NULL, md, NULL, pkey ) );
	RETVAL = EVP_DigestVerify( ctx, s, SvCUR(signature), m, SvCUR(message) );
	EVP_MD_CTX_free(ctx);
	EVP_PKEY_free(pkey);
#line 584 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#ifndef NO_DSA
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_DSA); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_DSA)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "pkey, key");
    {
	int	RETVAL;
	dXSTARG;
	EVP_PKEY *	pkey;
	DSA *	key;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "EVP_PKEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    pkey = INT2PTR(EVP_PKEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_DSA",
			"pkey", "EVP_PKEYPtr")
;

	if (SvROK(ST(1)) && sv_derived_from(ST(1), "DSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    key = INT2PTR(DSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_DSA",
			"key", "DSAPtr")
;
#line 278 "SEC.xs"
	RETVAL = checkerr( EVP_PKEY_assign( pkey, EVP_PKEY_DSA, (char*)key ) );
#line 627 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_new); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_new)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	DSA *	RETVAL;

	RETVAL = DSA_new();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "DSAPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_set0_pqg); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_set0_pqg)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "d, p_SV, q_SV, g_SV");
    {
#line 288 "SEC.xs"
	BIGNUM *p;
	BIGNUM *q;
	BIGNUM *g;
#line 666 "SEC.c"
	int	RETVAL;
	dXSTARG;
	DSA *	d;
	SV *	p_SV = ST(1)
;
	SV *	q_SV = ST(2)
;
	SV *	g_SV = ST(3)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "DSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    d = INT2PTR(DSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::DSA_set0_pqg",
			"d", "DSAPtr")
;
#line 292 "SEC.xs"
	p = BN_bin2bn( (unsigned char*) SvPVX(p_SV), SvCUR(p_SV), NULL );
	q = BN_bin2bn( (unsigned char*) SvPVX(q_SV), SvCUR(q_SV), NULL );
	g = BN_bin2bn( (unsigned char*) SvPVX(g_SV), SvCUR(g_SV), NULL );
	RETVAL = checkerr( DSA_set0_pqg( d, p, q, g ) );
#line 691 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_set0_key); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_DSA_set0_key)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "dsa, y_SV, x_SV");
    {
#line 302 "SEC.xs"
	BIGNUM *x;
	BIGNUM *y;
#line 708 "SEC.c"
	int	RETVAL;
	dXSTARG;
	DSA *	dsa;
	SV *	y_SV = ST(1)
;
	SV *	x_SV = ST(2)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "DSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    dsa = INT2PTR(DSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::DSA_set0_key",
			"dsa", "DSAPtr")
;
#line 305 "SEC.xs"
	x = BN_bin2bn( (unsigned char*) SvPVX(x_SV), SvCUR(x_SV), NULL );
	y = BN_bin2bn( (unsigned char*) SvPVX(y_SV), SvCUR(y_SV), NULL );
	RETVAL = checkerr( DSA_set0_key( dsa, y, x ) );
#line 730 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_RSA); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_RSA)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "pkey, key");
    {
	int	RETVAL;
	dXSTARG;
	EVP_PKEY *	pkey;
	RSA *	key;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "EVP_PKEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    pkey = INT2PTR(EVP_PKEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_RSA",
			"pkey", "EVP_PKEYPtr")
;

	if (SvROK(ST(1)) && sv_derived_from(ST(1), "RSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    key = INT2PTR(RSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_RSA",
			"key", "RSAPtr")
;
#line 319 "SEC.xs"
	RETVAL = checkerr( EVP_PKEY_assign( pkey, EVP_PKEY_RSA, (char*)key ) );
#line 771 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_new); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_new)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	RSA *	RETVAL;

	RETVAL = RSA_new();
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "RSAPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_set0_factors); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_set0_factors)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "r, p_SV, q_SV");
    {
#line 329 "SEC.xs"
	BIGNUM *p;
	BIGNUM *q;
#line 809 "SEC.c"
	int	RETVAL;
	dXSTARG;
	RSA *	r;
	SV *	p_SV = ST(1)
;
	SV *	q_SV = ST(2)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "RSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    r = INT2PTR(RSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::RSA_set0_factors",
			"r", "RSAPtr")
;
#line 332 "SEC.xs"
	p = BN_bin2bn( (unsigned char*) SvPVX(p_SV), SvCUR(p_SV), NULL );
	q = BN_bin2bn( (unsigned char*) SvPVX(q_SV), SvCUR(q_SV), NULL );
	RETVAL = checkerr( RSA_set0_factors( r, p, q ) );
#line 831 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_set0_key); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_RSA_set0_key)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "r, n_SV, e_SV, d_SV");
    {
#line 341 "SEC.xs"
	BIGNUM *d;
	BIGNUM *e;
	BIGNUM *n;
#line 849 "SEC.c"
	int	RETVAL;
	dXSTARG;
	RSA *	r;
	SV *	n_SV = ST(1)
;
	SV *	e_SV = ST(2)
;
	SV *	d_SV = ST(3)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "RSAPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    r = INT2PTR(RSA *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::RSA_set0_key",
			"r", "RSAPtr")
;
#line 345 "SEC.xs"
	d = BN_bin2bn( (unsigned char*) SvPVX(d_SV), SvCUR(d_SV), NULL );
	e = BN_bin2bn( (unsigned char*) SvPVX(e_SV), SvCUR(e_SV), NULL );
	n = BN_bin2bn( (unsigned char*) SvPVX(n_SV), SvCUR(n_SV), NULL );
	RETVAL = checkerr( RSA_set0_key( r, n, e, d ) );
#line 874 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#ifndef NO_ECDSA
#define XSubPPtmpAAAB 1


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_EC_KEY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_EC_KEY)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "pkey, key");
    {
	int	RETVAL;
	dXSTARG;
	EVP_PKEY *	pkey;
	EC_KEY *	key;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "EVP_PKEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    pkey = INT2PTR(EVP_PKEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_EC_KEY",
			"pkey", "EVP_PKEYPtr")
;

	if (SvROK(ST(1)) && sv_derived_from(ST(1), "EC_KEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    key = INT2PTR(EC_KEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EVP_PKEY_assign_EC_KEY",
			"key", "EC_KEYPtr")
;
#line 360 "SEC.xs"
	RETVAL = checkerr( EVP_PKEY_assign( pkey, EVP_PKEY_EC, (char*)key ) );
#line 917 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_new_by_curve_name); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_new_by_curve_name)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "nid");
    {
	EC_KEY *	RETVAL;
	int	nid = (int)SvIV(ST(0))
;

	RETVAL = EC_KEY_new_by_curve_name(nid);
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "EC_KEYPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_set_private_key); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_set_private_key)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "key, prv_SV");
    {
#line 371 "SEC.xs"
	BIGNUM *prv;
#line 956 "SEC.c"
	int	RETVAL;
	dXSTARG;
	EC_KEY *	key;
	SV *	prv_SV = ST(1)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "EC_KEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    key = INT2PTR(EC_KEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EC_KEY_set_private_key",
			"key", "EC_KEYPtr")
;
#line 373 "SEC.xs"
	prv = BN_bin2bn( (unsigned char*) SvPVX(prv_SV), SvCUR(prv_SV), NULL );
	RETVAL = EC_KEY_set_private_key( key, prv );
	BN_clear_free(prv);
	checkerr(RETVAL);
#line 977 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_set_public_key_affine_coordinates); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_set_public_key_affine_coordinates)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "key, x_SV, y_SV");
    {
#line 383 "SEC.xs"
	BIGNUM *x;
	BIGNUM *y;
#line 994 "SEC.c"
	int	RETVAL;
	dXSTARG;
	EC_KEY *	key;
	SV *	x_SV = ST(1)
;
	SV *	y_SV = ST(2)
;

	if (SvROK(ST(0)) && sv_derived_from(ST(0), "EC_KEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    key = INT2PTR(EC_KEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::EC_KEY_set_public_key_affine_coordinates",
			"key", "EC_KEYPtr")
;
#line 386 "SEC.xs"
	x = BN_bin2bn( (unsigned char*) SvPVX(x_SV), SvCUR(x_SV), NULL );
	y = BN_bin2bn( (unsigned char*) SvPVX(y_SV), SvCUR(y_SV), NULL );
	RETVAL = EC_KEY_set_public_key_affine_coordinates( key, x, y );
	BN_free(x);
	BN_free(y);
	checkerr(RETVAL);
#line 1019 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#endif
#ifndef NO_EdDSA
#define XSubPPtmpAAAC 1


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_private_key); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_private_key)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "nid, key");
    {
	EVP_PKEY *	RETVAL;
	int	nid = (int)SvIV(ST(0))
;
	SV *	key = ST(1)
;
#line 405 "SEC.xs"
	RETVAL = EVP_PKEY_new_raw_private_key( nid, NULL, (unsigned char*) SvPVX(key) , SvCUR(key) );
#line 1044 "SEC.c"
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "EVP_PKEYPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_public_key); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_public_key)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "nid, key");
    {
	EVP_PKEY *	RETVAL;
	int	nid = (int)SvIV(ST(0))
;
	SV *	key = ST(1)
;
#line 412 "SEC.xs"
	RETVAL = EVP_PKEY_new_raw_public_key( nid, NULL, (unsigned char*) SvPVX(key) , SvCUR(key) );
#line 1070 "SEC.c"
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "EVP_PKEYPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif
#ifndef NO_ECCGOST
#define XSubPPtmpAAAD 1


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_new_ECCGOST); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_EC_KEY_new_ECCGOST)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
#line 428 "SEC.xs"
	BIGNUM *a = bn_new_hex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94");
	BIGNUM *b = bn_new_hex("00A6");
	BIGNUM *p = bn_new_hex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97");
	BIGNUM *q = bn_new_hex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893");
	BIGNUM *x = bn_new_hex("01");
	BIGNUM *y = bn_new_hex("8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14");
	BIGNUM *h = bn_new_hex("01");
	BN_CTX *ctx = BN_CTX_new();
	EC_GROUP *group = EC_GROUP_new_curve_GFp(p, a, b, ctx);
	EC_POINT *G = EC_POINT_new(group);
#line 1104 "SEC.c"
	EC_KEY *	RETVAL;
#line 439 "SEC.xs"
	checkerr( EC_POINT_set_affine_coordinates(group, G, x, y, ctx) );
	checkerr( EC_GROUP_set_generator(group, G, q, h) );
	EC_POINT_free(G);
	BN_free(a);
	BN_free(b);
	BN_free(p);
	BN_free(q);
	BN_free(x);
	BN_free(y);
	BN_free(h);
	checkerr( EC_GROUP_check(group, ctx) );
	BN_CTX_free(ctx);
	RETVAL = EC_KEY_new();
	checkerr( EC_KEY_set_group(RETVAL, group) );
	EC_GROUP_free(group);
#line 1122 "SEC.c"
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv(RETVALSV, "EC_KEYPtr", (void*)RETVAL);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_ECCGOST_verify); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_ECCGOST_verify)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "H, r_SV, s_SV, eckey");
    {
#line 460 "SEC.xs"
	BIGNUM *alpha;
	BIGNUM *e = BN_new();
	BIGNUM *m = BN_new();
	BIGNUM *q = BN_new();
	BIGNUM *r;
	BIGNUM *s;
	BN_CTX *ctx = BN_CTX_new();
	const EC_GROUP *group;
	ECDSA_SIG *ecsig;
	unsigned char *bin;
	STRLEN len;
#line 1153 "SEC.c"
	int	RETVAL;
	dXSTARG;
	SV *	H = ST(0)
;
	SV *	r_SV = ST(1)
;
	SV *	s_SV = ST(2)
;
	EC_KEY *	eckey;

	if (SvROK(ST(3)) && sv_derived_from(ST(3), "EC_KEYPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(3)));
	    eckey = INT2PTR(EC_KEY *,tmp);
	}
	else
	    Perl_croak_nocontext("%s: %s is not of type %s",
			"Net::DNS::SEC::libcrypto::ECCGOST_verify",
			"eckey", "EC_KEYPtr")
;
#line 472 "SEC.xs"
	r = BN_bin2bn( (unsigned char*) SvPVX(r_SV), SvCUR(r_SV), NULL );
	s = BN_bin2bn( (unsigned char*) SvPVX(s_SV), SvCUR(s_SV), NULL );
	bin = (unsigned char*) SvPVX(H);
	len = SvCUR(H);
	alpha = BN_bin2bn( bin, len, NULL );

	group = EC_KEY_get0_group(eckey);
	checkerr( EC_GROUP_get_order(group, q, ctx) );
	checkerr( BN_mod(e, alpha, q, ctx) );
	BN_free(alpha);

	/* algebraic transformation of ECC-GOST into equivalent ECDSA problem */
	if ( BN_is_zero(e) ) BN_one(e);
	checkerr( BN_mod_sub(m, q, s, q, ctx) );
	checkerr( BN_mod_sub(s, q, e, q, ctx) );
	BN_CTX_free(ctx);
	BN_free(e);
	BN_free(q);

	ecsig = ECDSA_SIG_new();
	checkerr( ECDSA_SIG_set0(ecsig, r, s) );

	BN_bn2binpad(m, bin, len);
	BN_free(m);
	RETVAL = ECDSA_do_verify( bin, len, ecsig, eckey );
	EC_KEY_free(eckey);
	ECDSA_SIG_free(ecsig);
#line 1201 "SEC.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

#endif
#ifdef croak_memory_wrap
#define XSubPPtmpAAAE 1


XS_EUPXS(XS_Net__DNS__SEC__libcrypto_croak_memory_wrap); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Net__DNS__SEC__libcrypto_croak_memory_wrap)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {

	croak_memory_wrap();
    }
    XSRETURN_EMPTY;
}

#endif
#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Net__DNS__SEC); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Net__DNS__SEC)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        newXS_deffile("Net::DNS::SEC::libcrypto::VERSION", XS_Net__DNS__SEC__libcrypto_VERSION);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_md5", XS_Net__DNS__SEC__libcrypto_EVP_md5);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_sha1", XS_Net__DNS__SEC__libcrypto_EVP_sha1);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_sha256", XS_Net__DNS__SEC__libcrypto_EVP_sha256);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_sha384", XS_Net__DNS__SEC__libcrypto_EVP_sha384);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_sha512", XS_Net__DNS__SEC__libcrypto_EVP_sha512);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_new", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_sign", XS_Net__DNS__SEC__libcrypto_EVP_sign);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_verify", XS_Net__DNS__SEC__libcrypto_EVP_verify);
#if XSubPPtmpAAAA
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_assign_DSA", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_DSA);
        newXS_deffile("Net::DNS::SEC::libcrypto::DSA_new", XS_Net__DNS__SEC__libcrypto_DSA_new);
        newXS_deffile("Net::DNS::SEC::libcrypto::DSA_set0_pqg", XS_Net__DNS__SEC__libcrypto_DSA_set0_pqg);
        newXS_deffile("Net::DNS::SEC::libcrypto::DSA_set0_key", XS_Net__DNS__SEC__libcrypto_DSA_set0_key);
#endif
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_assign_RSA", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_RSA);
        newXS_deffile("Net::DNS::SEC::libcrypto::RSA_new", XS_Net__DNS__SEC__libcrypto_RSA_new);
        newXS_deffile("Net::DNS::SEC::libcrypto::RSA_set0_factors", XS_Net__DNS__SEC__libcrypto_RSA_set0_factors);
        newXS_deffile("Net::DNS::SEC::libcrypto::RSA_set0_key", XS_Net__DNS__SEC__libcrypto_RSA_set0_key);
#if XSubPPtmpAAAB
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_assign_EC_KEY", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_assign_EC_KEY);
        newXS_deffile("Net::DNS::SEC::libcrypto::EC_KEY_new_by_curve_name", XS_Net__DNS__SEC__libcrypto_EC_KEY_new_by_curve_name);
        newXS_deffile("Net::DNS::SEC::libcrypto::EC_KEY_set_private_key", XS_Net__DNS__SEC__libcrypto_EC_KEY_set_private_key);
        newXS_deffile("Net::DNS::SEC::libcrypto::EC_KEY_set_public_key_affine_coordinates", XS_Net__DNS__SEC__libcrypto_EC_KEY_set_public_key_affine_coordinates);
#endif
#if XSubPPtmpAAAC
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_new_raw_private_key", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_private_key);
        newXS_deffile("Net::DNS::SEC::libcrypto::EVP_PKEY_new_raw_public_key", XS_Net__DNS__SEC__libcrypto_EVP_PKEY_new_raw_public_key);
#endif
#if XSubPPtmpAAAD
        newXS_deffile("Net::DNS::SEC::libcrypto::EC_KEY_new_ECCGOST", XS_Net__DNS__SEC__libcrypto_EC_KEY_new_ECCGOST);
        newXS_deffile("Net::DNS::SEC::libcrypto::ECCGOST_verify", XS_Net__DNS__SEC__libcrypto_ECCGOST_verify);
#endif
#if XSubPPtmpAAAE
        newXS_deffile("Net::DNS::SEC::libcrypto::croak_memory_wrap", XS_Net__DNS__SEC__libcrypto_croak_memory_wrap);
#endif

    /* Initialisation Section */

#if XSubPPtmpAAAA
#endif
#if XSubPPtmpAAAB
#endif
#if XSubPPtmpAAAC
#endif
#if XSubPPtmpAAAD
#endif
#if XSubPPtmpAAAE
#endif
#line 1303 "SEC.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

