| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * $Id: passphrase.h,v 1.2 2004/04/08 01:36:15 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 | #ifndef CATACOMB_PASSPHRASE_H |
| 31 | #define CATACOMB_PASSPHRASE_H |
| 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | /*----- Header files ------------------------------------------------------*/ |
| 38 | |
| 39 | #include <stddef.h> |
| 40 | |
| 41 | /*----- Data structures ---------------------------------------------------*/ |
| 42 | |
| 43 | /* --- Passphrase modes --- * |
| 44 | * |
| 45 | * @PMODE_VERIFY@ requests that the passphrase be repeated to make sure it's |
| 46 | * right. |
| 47 | */ |
| 48 | |
| 49 | enum { |
| 50 | PMODE_READ, |
| 51 | PMODE_VERIFY |
| 52 | }; |
| 53 | |
| 54 | /*----- Functions provided ------------------------------------------------*/ |
| 55 | |
| 56 | /* --- @passphrase_read@ --- * |
| 57 | * |
| 58 | * Arguments: @const char *tag@ = pointer to passphrase tag string |
| 59 | * @unsigned mode@ = reading mode |
| 60 | * @char *buf@ = pointer to destination buffer |
| 61 | * @size_t sz@ = size of destination buffer |
| 62 | * |
| 63 | * Returns: Zero if successful, nonzero on failure. |
| 64 | * |
| 65 | * Use: Reads a passphrase from the user, using some system-specific |
| 66 | * secure mechanism. The mechanism may keep a cache of |
| 67 | * passphrases, so the user may not necessarily be prompted. |
| 68 | */ |
| 69 | |
| 70 | extern int passphrase_read(const char */*tag*/, unsigned /*mode*/, |
| 71 | char */*buf*/, size_t /*sz*/); |
| 72 | |
| 73 | /* --- @passphrase_cancel@ --- * |
| 74 | * |
| 75 | * Arguments: @const char *tag@ = pointer to passphrase tag string |
| 76 | * |
| 77 | * Returns: --- |
| 78 | * |
| 79 | * Use: Attempts to make the passphrase cache forget about a |
| 80 | * particular passphrase. This may be useful if the passphrase |
| 81 | * turns out to be wrong, or if the user is attempting to change |
| 82 | * the passphrase. |
| 83 | */ |
| 84 | |
| 85 | extern void passphrase_cancel(const char */*tag*/); |
| 86 | |
| 87 | /*----- That's all, folks -------------------------------------------------*/ |
| 88 | |
| 89 | #ifdef __cplusplus |
| 90 | } |
| 91 | #endif |
| 92 | |
| 93 | #endif |