chiark / gitweb /
Initial checkin.
[catacomb-perl] / misc.xs
1 # ---?---
2 #
3 # $Id: misc.xs,v 1.1 2004/04/02 18:04:01 mdw Exp $
4 #
5 # Miscellaneous function interfaces
6 #
7 # (c) 2001 Straylight/Edgeware
8 #
9
10 #----- Licensing notice -----------------------------------------------------
11 #
12 # This file is part of the Perl interface to Catacomb.
13 #
14 # Catacomb/Perl is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18
19 # Catacomb/Perl is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23
24 # You should have received a copy of the GNU General Public License
25 # along with Catacomb/Perl; if not, write to the Free Software Foundation,
26 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28 #----- Revision history -----------------------------------------------------
29 #
30 # $Log: misc.xs,v $
31 # Revision 1.1  2004/04/02 18:04:01  mdw
32 # Initial checkin.
33 #
34
35 MODULE = Catacomb PACKAGE = Catacomb::Passphrase
36
37 SV *
38 read(me, tag, len = 256)
39         SV *me
40         char *tag
41         int len
42         CODE:
43         RETVAL = NEWSV(0, len);
44         if (passphrase_read(tag, PMODE_READ, SvPVX(RETVAL), len + 1))
45           XSRETURN_UNDEF;
46         SvCUR_set(RETVAL, strlen(SvPVX(RETVAL)));
47         SvPOK_on(RETVAL);
48         OUTPUT:
49         RETVAL
50
51 SV *
52 verify(me, tag, len = 256)
53         SV *me
54         char *tag
55         int len
56         CODE:
57         RETVAL = NEWSV(0, len);
58         if (passphrase_read(tag, PMODE_VERIFY, SvPVX(RETVAL), len + 1))
59           XSRETURN_UNDEF;
60         SvCUR_set(RETVAL, strlen(SvPVX(RETVAL)));
61         SvPOK_on(RETVAL);
62         OUTPUT:
63         RETVAL
64
65 SV *
66 cancel(me, tag)
67         SV *me
68         char *tag
69         CODE:
70         passphrase_cancel(tag);
71         XSRETURN_UNDEF;
72
73 MODULE = Catacomb PACKAGE = Catacomb::KeySize
74
75 int
76 keysz(ksz, sz)
77         keysize *ksz
78         int sz
79         CODE:
80         RETVAL = keysz(sz, ksz);
81         OUTPUT:
82         RETVAL
83
84 #----- That's all, folks ----------------------------------------------------