The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
TYPEMAP
BIGNUM *		T_PTRREF
const BIGNUM *		T_PTRREF
BN_CTX *		T_PTRREF
const EC_METHOD *	EC_METHOD
EC_GROUP *		EC_GROUP
const EC_GROUP *	EC_GROUP
EC_POINT *		EC_POINT
const EC_POINT *	EC_POINT
EC_KEY * 		EC_KEY
const EC_KEY * 		EC_KEY
BIO * 			T_PTRREF
point_conversion_form_t	T_ENUM
const unsigned char *	T_PV

INPUT
EC_METHOD
    if( ! SvROK( $arg ) ) { croak( \"argument is not an object\" ); }
    $var = (${type}) SvIV( SvRV( $arg ) );

EC_GROUP
    if( ! SvROK( $arg ) ) { croak( \"argument is not an object\" ); }
    $var = (${type}) SvIV( SvRV( $arg ) );

EC_POINT
    if( ! SvROK( $arg ) ) { croak( \"argument is not an object\" ); }
    $var = (${type}) SvIV( SvRV( $arg ) );

EC_KEY
    if( ! SvROK( $arg ) ) { croak( \"argument is not an object\" ); }
    $var = (${type}) SvIV( SvRV( $arg ) );


# These output types create blessed mortal references to EC pointers
# which ensures that you can call class methods on them and the DESTROY gets
# called when they go out of scope, for auto cleanup

OUTPUT
EC_METHOD
	sv_setsv($arg, sv_2mortal(sv_bless(newRV_noinc( newSViv( (IV)$var ) ), gv_stashpv("Crypt::OpenSSL::EC::EC_METHOD",1))));

EC_GROUP
	sv_setsv($arg, sv_2mortal(sv_bless(newRV_noinc( newSViv( (IV)$var ) ), gv_stashpv("Crypt::OpenSSL::EC::EC_GROUP",1))));

EC_POINT
	sv_setsv($arg, sv_2mortal(sv_bless(newRV_noinc( newSViv( (IV)$var ) ), gv_stashpv("Crypt::OpenSSL::EC::EC_POINT",1))));

EC_KEY
	sv_setsv($arg, sv_2mortal(sv_bless(newRV_noinc( newSViv( (IV)$var ) ), gv_stashpv("Crypt::OpenSSL::EC::EC_KEY",1))));