1 /* simple-pwquery.c - A simple password query cleint for gpg-agent
2 * Copyright (C) 2002 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
20 #ifndef SIMPLE_PWQUERY_H
21 #define SIMPLE_PWQUERY_H
23 #ifdef SIMPLE_PWQUERY_IMPLEMENTATION /* Begin configuration stuff. */
25 /* Include whatever files you need. */
27 #include "../common/logging.h"
29 /* Try to write error message using the standard gnupg log mechanism. */
30 #define SPWQ_USE_LOGGING 1
32 /* Memory allocation functions used by the implementation. Note, that
33 the returned value is expected to be freed with
35 #define spwq_malloc(a) gcry_malloc (a)
36 #define spwq_free(a) gcry_free (a)
37 #define spwq_secure_malloc(a) gcry_malloc_secure (a)
38 #define spwq_secure_free(a) gcry_free (a)
40 #endif /*SIMPLE_PWQUERY_IMPLEMENTATION*/ /* End configuration stuff. */
43 /* Ask the gpg-agent for a passphrase and present the user with a
44 DESCRIPTION, a PROMPT and optiaonlly with a TRYAGAIN extra text.
45 If a CACHEID is not NULL it is used to locate the passphrase in in
46 the cache and store it under this ID. If OPT_CHECK is true
47 gpg-agent is asked to apply some checks on the passphrase security.
48 If ERRORCODE is not NULL it should point a variable receiving an
49 errorcode; this errocode might be 0 if the user canceled the
50 operation. The function returns NULL to indicate an error. */
51 char *simple_pwquery (const char *cacheid,
54 const char *description,
58 /* Ask the gpg-agent to clear the passphrase for the cache ID CACHEID. */
59 int simple_pwclear (const char *cacheid);
61 /* Perform the simple query QUERY (which must be new-line and 0
62 terminated) and return the error code. */
63 int simple_query (const char *query);
65 /* Set the name of the standard socket to be used if GPG_AGENT_INFO is
66 not defined. The use of this function is optional but if it needs
67 to be called before any other function. Returns 0 on success. */
68 int simple_pw_set_socket (const char *name);
70 #endif /*SIMPLE_PWQUERY_H*/