9c5b124e |
1 | /* -*-c-*- |
2 | * |
3 | * $Id: passphrase.h,v 1.1 1999/12/22 15:58:20 mdw Exp $ |
4 | * |
5 | * Reading passphrases |
6 | * |
7 | * (c) 1999 Straylight/Edgeware |
8 | */ |
9 | |
10 | /*----- Licensing notice --------------------------------------------------* |
11 | * |
12 | * This file is part of Catacomb. |
13 | * |
14 | * Catacomb is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU Library General Public License as |
16 | * published by the Free Software Foundation; either version 2 of the |
17 | * License, or (at your option) any later version. |
18 | * |
19 | * Catacomb 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 Library General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU Library General Public |
25 | * License along with Catacomb; if not, write to the Free |
26 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
27 | * MA 02111-1307, USA. |
28 | */ |
29 | |
30 | /*----- Revision history --------------------------------------------------* |
31 | * |
32 | * $Log: passphrase.h,v $ |
33 | * Revision 1.1 1999/12/22 15:58:20 mdw |
34 | * Portable interface to reading passphrases. |
35 | * |
36 | */ |
37 | |
38 | #ifndef CATACOMB_PASSPHRASE_H |
39 | #define CATACOMB_PASSPHRASE_H |
40 | |
41 | #ifdef __cplusplus |
42 | extern "C" { |
43 | #endif |
44 | |
45 | /*----- Header files ------------------------------------------------------*/ |
46 | |
47 | #include <stddef.h> |
48 | |
49 | /*----- Data structures ---------------------------------------------------*/ |
50 | |
51 | /* --- Passphrase modes --- * |
52 | * |
53 | * @PMODE_VERIFY@ requests that the passphrase be repeated to make sure it's |
54 | * right. |
55 | */ |
56 | |
57 | enum { |
58 | PMODE_READ, |
59 | PMODE_VERIFY |
60 | }; |
61 | |
62 | /*----- Functions provided ------------------------------------------------*/ |
63 | |
64 | /* --- @passphrase_read@ --- * |
65 | * |
66 | * Arguments: @const char *tag@ = pointer to passphrase tag string |
67 | * @unsigned mode@ = reading mode |
68 | * @char *buf@ = pointer to destination buffer |
69 | * @size_t sz@ = size of destination buffer |
70 | * |
71 | * Returns: Zero if successful, nonzero on failure. |
72 | * |
73 | * Use: Reads a passphrase from the user, using some system-specific |
74 | * secure mechanism. The mechanism may keep a cache of |
75 | * passphrases, so the user may not necessarily be prompted. |
76 | */ |
77 | |
78 | extern int passphrase_read(const char */*tag*/, unsigned /*mode*/, |
79 | char */*buf*/, size_t /*sz*/); |
80 | |
81 | /* --- @passphrase_cancel@ --- * |
82 | * |
83 | * Arguments: @const char *tag@ = pointer to passphrase tag string |
84 | * |
85 | * Returns: --- |
86 | * |
87 | * Use: Attempts to make the passphrase cache forget about a |
88 | * particular passphrase. This may be useful if the passphrase |
89 | * turns out to be wrong, or if the user is attempting to change |
90 | * the passphrase. |
91 | */ |
92 | |
93 | extern void passphrase_cancel(const char */*tag*/); |
94 | |
95 | /*----- That's all, folks -------------------------------------------------*/ |
96 | |
97 | #ifdef __cplusplus |
98 | } |
99 | #endif |
100 | |
101 | #endif |