X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-perl/blobdiff_plain/68e68e18c457d31c1c61bc08dd14a56e7e7ac21e..a1a90aaf554eb974e39e34b513747eb666180776:/catacomb-perl.h diff --git a/catacomb-perl.h b/catacomb-perl.h index 130c264..a67c616 100644 --- a/catacomb-perl.h +++ b/catacomb-perl.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: catacomb-perl.h,v 1.2 2004/04/08 01:36:21 mdw Exp $ + * $Id$ * * Main header file for Catacomb/Perl * @@ -35,16 +35,16 @@ /*----- Header files ------------------------------------------------------*/ +#include +#include +#include + #include #include #include #include #include -#include -#include -#include - #include #include #include @@ -56,15 +56,21 @@ #include #include +#include #include #include +#include +#include +#include #include #include #include #include #include #include +#include +#include #include #include @@ -78,7 +84,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) @@ -93,32 +100,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 --------------------------------------------------*/