X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-perl/blobdiff_plain/660b443cc58d4dd4e92730104429fb64d78c7075..a1a90aaf554eb974e39e34b513747eb666180776:/algorithms.xs diff --git a/algorithms.xs b/algorithms.xs index 5844f17..6001d9d 100644 --- a/algorithms.xs +++ b/algorithms.xs @@ -1,6 +1,6 @@ # ---?--- # -# $Id: algorithms.xs,v 1.1 2004/04/02 18:04:01 mdw Exp $ +# $Id$ # # Interface to crypto algorithms # @@ -25,13 +25,6 @@ # along with Catacomb/Perl; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#----- Revision history ----------------------------------------------------- -# -# $Log: algorithms.xs,v $ -# Revision 1.1 2004/04/02 18:04:01 mdw -# Initial checkin. -# - MODULE = Catacomb PACKAGE = Catacomb::CipherClass PROTOTYPES: DISABLE @@ -40,16 +33,8 @@ gccipher * find(me, name) SV *me char *name - PREINIT: - const gccipher **cc; - CODE: - RETVAL = 0; - for (cc = ciphertab; *cc; cc++) { - if (strcmp((*cc)->name, name) == 0) { - RETVAL = (gccipher *)*cc; - break; - } - } + CODE: + RETVAL = (gccipher *)gcipher_byname(name); OUTPUT: RETVAL @@ -57,11 +42,11 @@ SV * list(me) SV *me PREINIT: - const gccipher **cc; + const gccipher *const *cc; SV *sv; PPCODE: - for (cc = ciphertab; *cc; cc++) - XPUSHs(RET(*cc, "Catacomb::CipherClass")); + for (cc = gciphertab; *cc; cc++) + XPUSHs(RET((gccipher *)*cc, "Catacomb::CipherClass")); keysize * keysz(cc) @@ -182,16 +167,8 @@ gchash * find(me, name) SV *me char *name - PREINIT: - const gchash **hc; - CODE: - RETVAL = 0; - for (hc = hashtab; *hc; hc++) { - if (strcmp((*hc)->name, name) == 0) { - RETVAL = (gchash *)*hc; - break; - } - } + CODE: + RETVAL = (gchash *)ghash_byname(name); OUTPUT: RETVAL @@ -199,11 +176,11 @@ SV * list(me) SV *me PREINIT: - const gchash **hc; + const gchash *const *hc; SV *sv; PPCODE: - for (hc = hashtab; *hc; hc++) - XPUSHs(RET(*hc, "Catacomb::HashClass")); + for (hc = ghashtab; *hc; hc++) + XPUSHs(RET((gchash *)*hc, "Catacomb::HashClass")); size_t hashsz(hc) @@ -283,16 +260,8 @@ gcMAC * find(me, name) SV *me char *name - PREINIT: - const gcMAC **mc; - CODE: - RETVAL = 0; - for (mc = mactab; *mc; mc++) { - if (strcmp((*mc)->name, name) == 0) { - RETVAL = (gcMAC *)*mc; - break; - } - } + CODE: + RETVAL = (gcMAC *)gmac_byname(name); OUTPUT: RETVAL @@ -300,11 +269,11 @@ SV * list(me) SV *me PREINIT: - const gcMAC **mc; + const gcMAC *const *mc; SV *sv; PPCODE: - for (mc = mactab; *mc; mc++) - XPUSHs(RET(*mc, "Catacomb::MACClass")); + for (mc = gmactab; *mc; mc++) + XPUSHs(RET((gcMAC *)*mc, "Catacomb::MACClass")); size_t hashsz(mc)