X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-perl/blobdiff_plain/660b443cc58d4dd4e92730104429fb64d78c7075..f9952aec1cf6c64a5681308eea817b6113a37433:/catacomb-perl.h diff --git a/catacomb-perl.h b/catacomb-perl.h index a30f27d..ec6d8af 100644 --- a/catacomb-perl.h +++ b/catacomb-perl.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: catacomb-perl.h,v 1.1 2004/04/02 18:04:01 mdw Exp $ + * $Id$ * * Main header file for Catacomb/Perl * @@ -26,14 +26,6 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: catacomb-perl.h,v $ - * Revision 1.1 2004/04/02 18:04:01 mdw - * Initial checkin. - * - */ - #ifndef CATACOMB_PERL_H #define CATACOMB_PERL_H @@ -43,16 +35,16 @@ /*----- Header files ------------------------------------------------------*/ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include - #include #include #include @@ -64,15 +56,22 @@ #include #include +#include #include #include +#include +#include +#include +#include #include #include #include #include #include #include +#include +#include #include #include @@ -86,7 +85,8 @@ struct consttab { const char *name; UV val; }; extern U32 findconst(const struct consttab *cc, const char *pkg, const char *name); - +extern void ptrtosv(SV **sv, void *p, const char *type); +extern void *ptrfromsv(SV *sv, const char *type, const char *what, ...); #define SET(sv, ob, ty) sv_setref_pv((sv), (char *)(ty), (void *)(ob)) #define MAKE(ob, ty) SET(NEWSV(0, 0), ob, ty) #define RET(ob, ty) SET(sv_newmortal(), ob, ty) @@ -101,32 +101,58 @@ typedef gcmac gcMAC; typedef grand Rand_True, Rand_DSA; -extern const gccipher *ciphertab[]; -extern const gchash *hashtab[]; -extern const gcmac *mactab[]; extern const struct randtab mgftab[], ctrtab[], ofbtab[]; extern SV *findrand(const struct randtab *rt, const char *cls, const char *name, SV *k); extern void listrand(const struct randtab *rt); +/*------ Key mangling -----------------------------------------------------*/ + +typedef struct Key { + key_file *kf; + key *k; +} Key; + +typedef int KeyErr; +typedef key_data Key_Data; +typedef key_file Key_File; + +extern void warn_keyreporter(const char *file, int line, + const char *err, void *p); +extern SV *keyerr(int rc); + /*------ Multiprecision maths ---------------------------------------------*/ +typedef mp gf; typedef mpmont MP_Mont; typedef mpbarrett MP_Barrett; typedef mpcrt MP_CRT; +typedef mpreduce MP_Reduce; +typedef gfreduce GF_Reduce; + +typedef ec EC_Point; +typedef ec_curve EC_Curve; +typedef field Field; + #define XSINTERFACE_FUNC_SETMP(cv, f) \ CvXSUBANY(cv).any_dptr = (void (*) _((void *)))(mp_##f) +#define XSINTERFACE_FUNC_SETGF(cv, f) \ + CvXSUBANY(cv).any_dptr = (void (*) _((void *)))(gf_##f) #define SET_MP(sv, x) SET(sv, x, "Catacomb::MP") #define RET_MP(x) RET(x, "Catacomb::MP") +#define SET_GF(sv, x) SET(sv, x, "Catacomb::GF") +#define RET_GF(x) RET(x, "Catacomb::GF") + extern mp *mp_fromiv(mp *d, IV iv); extern IV mp_toiv(mp *x); extern mp *mp_readsv(mp *m, SV *sv, STRLEN *off, int radix); extern int mp_writesv(mp *m, SV *sv, int radix); -extern mp *mp_fromsv(SV *sv, const char *what, int radix, int keep, ...); +extern mp *mp_fromsv(SV *sv, const char *what, const char *ty, + int radix, int keep, ...); /*----- Prime generation --------------------------------------------------*/ @@ -142,6 +168,12 @@ typedef struct pgen_event MP_Prime_Gen_Event; extern void pgproc_get(SV *sv, pgen_proc **p, void **ctx); +/*----- Other gear --------------------------------------------------------*/ + +extern field *copy_field(field *f); +extern ec_curve *copy_curve(ec_curve *c); +extern group *copy_group(group *g); + /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus